阅读:3691回复:0
俺的第一个greasemonkey脚本,针对华侨路茶坊的字体问题
写得比较烂,请大家海涵。华侨路茶坊(http://bbs.njhouse365.com)的字体在firefox下面显得过小,主要是网页编写得太烂。文字用了<font size="1">使得字体过小,然后又在CSS中设定FONT标记的字体大小为9pt。但是它的CSS语法有错误,造成其在firefox下无效。俺的脚本只是修改了一下CSS中的这个错误,字体能够正常显示了。要安装这个脚本需要安装greasemonkey扩展。
// ==UserScript== // @name FixFont // @namespace http://greasemonkey.mozdev.org/ // @description change style of font on bbs.njhouse365.com // @include http://*.njhouse365.com/* // ==/UserScript== (function() { var Styler = { addGlobalStyle: function(css) { var head = document.getElementsByTagName('head')[0]; if (!head) return; var style1 = document.getElementsByTagName('style')[0]; var style2 = document.createElement('style'); style2.type = 'text/css'; style2.innerHTML = css; head.replaceChild(style2,style1); } } Styler.addGlobalStyle(' \ .en { font-family: "MS Shell Dlg,Tahoma"; font-size: 9px}\ FONT {font-size:9pt}\ BODY {CURSOR: default; FONT-FAMILY:MS Shell Dlg,Tahoma ; FONT-SIZE: 9px;\ SCROLLBAR-BASE-COLOR: #B5BBDD;\ SCROLLBAR-ARROW-COLOR: #FFFFFF;}\ td,p,div,body{font-size:9pt;color="#000000";font-family: "MS Shell Dlg,Tahoma "} \ A { COLOR: #000000; CURSOR: ; FONT-SIZE: 9pt; TEXT-DECORATION: none} \ UL {CURSOR: default; FONT-FAMILY: MS Shell Dlg,Tahoma; FONT-SIZE: 9pt}\ LI {CURSOR: default; FONT-FAMILY: MS Shell Dlg,Tahoma; FONT-SIZE: 9pt}\ P {CURSOR: default; FONT-FAMILY: MS Shell Dlg,Tahoma, sans-serif; FONT-SIZE: 9pt}\ TD {FONT-FAMILY: MS Shell Dlg,Tahoma, sans-serif; FONT-SIZE: 9pt}\ TR {FONT-FAMILY: MS Shell Dlg,Tahoma, sans-serif; FONT-SIZE: 9pt}\ SELECT {BACKGROUND-COLOR: #cccccc; COLOR: #51485f; FONT-FAMILY: 宋体; FONT-SIZE: 9pt}\ INPUT {BACKGROUND-COLOR: #cccccc; COLOR: #000000; FONT-FAMILY: MS Shell Dlg,Tahoma, sans-serif; FONT-SIZE: 9pt}\ TEXTAREA {BACKGROUND-COLOR: #cccccc; COLOR: #000000; FONT-FAMILY: MS Shell Dlg,Tahoma, sans-serif; FONT-SIZE: 9pt}\ OPTION {BACKGROUND-COLOR: #cccccc; COLOR: #51485f; FONT-SIZE: 9pt}\ FORM {FONT-FAMILY: MS Shell Dlg,tahoma; FONT-SIZE: 9pt}\ .thtcolor {COLOR: #171A39;}\ #all A:active {COLOR: #665F39;}\ #all A:visited {COLOR: #red ;text-decoration: none}\ #all A:hover {COLOR: #3D4F7A;text-decoration: none;position: relative;left: 1px; top: 1px;}\ #all A:link {COLOR: #000000;text-decoration: none}\ #cat A:active { COLOR: #665F39;\ text-decoration: none}\ #cat A:visited { COLOR: #171A39 ;\ text-decoration: none}\ #cat A:hover { COLOR: #665F39;\ text-decoration: underline;position: relative;left: 1px; top: 1px;}\ #cat A:link { COLOR: #171A39 ;\ text-decoration: none}\ '); })(); |
|