|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 0 i6 M% L$ ^) u2 Q/ g# k2 g& g( f
+ h( R, _; }6 _8 {7 f7 k火狐插件,用猴子$ A( A: \3 b6 z" E! o
. z9 B; y4 o9 [7 @+ E! e) H+ c/ |
var debug=false;
. d5 w3 A% S( ]1 Y9 r# A4 avar CleanHideObj=new CleanHideClass();7 t+ _, ^& q) a; ~
5 Q* u4 c* U4 v
function CleanHideClass()
. B: s0 m" m6 t. \{ - d+ o4 r1 O- \. H9 m
* T5 G' x/ \7 ~: [+ c
this.on=function(id,bMZ)
0 A# r3 @" r! z. M {
& u- @- q6 x' w4 q% k" J; ~6 Q4 o 6 ?/ g- z% ?. i! w2 [1 L3 w
if(id == 0)
/ l- e, A9 ?5 m; \ O4 n3 { {+ ~' Q6 E3 \ ~
var page=/* document.getElementById("content").contentDocument */document;
% @5 f) X9 x/ J' x% d( X; Z# j this.RemoveHide(page,"span");
F7 u" }5 l, G% o4 D this.RemoveHide(page,"font");
& ~& {3 R( t% M( } A0 C& i this.RemoveHide(page,"div");
; B" [" _- O, r this.RemoveHide(page,"p");3 u" g- L. q0 s( S! W+ w* C
) Y" G1 E( Q& n- H P+ Q- f5 X
}* A0 i. w; `& b- P, A4 c
, g8 ]4 f8 j; O; e
}1 r# I w1 o( p9 s
this.getobjstyle=function(node,prop)
3 ~& V6 d( o6 u0 z: V8 O2 t. u# P {
) z" m5 Q" i- {' L" B: n try
1 I4 K/ S/ J* g8 j {
( h, O& f+ W0 o' Z& Q% u return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
4 V7 z' ?3 h* ^- S h }0 r h/ f4 A( [! `2 C! s
catch(e), r4 h3 {: R7 K; g1 x1 f0 f7 x
{
( L. G* ]7 d! D if(debug)1 K N) x$ k# V {! _' i
{1 X* Y% {4 B/ m8 o- V ~' J+ ?
alert(e.message);
2 o; a% x f' c& ]' s7 M, | }
# H8 C* e' Y' j+ [1 ]7 f5 a & H8 A! Z8 y$ B% q& Z
return "200";
5 t5 ]9 n6 f5 ` }
1 G7 t5 z9 q' }$ p: t9 U6 P5 z+ F }
% B$ e7 \& m$ M( V* o/ c& w/ V5 E # K4 Q4 a& T' x( L/ Z; _
this.RemoveHide=function(page,objname)% B: C+ L! n5 b
{
& ?. c5 K3 I7 x) h. W8 c try
3 Z, o: B- e# g {
1 @& x6 g/ x. F( H. Q: U var minValue=15;
/ ?& n5 C' W* X' n' N# p var objs=page.getElementsByTagName(objname);
5 t4 _. i" U% X* [1 M$ x
- `9 q! Z! J0 W" Y$ L if(objs.length == 0) + |7 o$ X, P8 e8 M
{
, T0 x) E) |' R* p; Q0 ^0 Y+ n! H if(debug)( o2 k+ S5 _ o9 H+ H
{
) f3 V6 T- R9 W" Q5 l alert("no object found!:"+objname);7 L( R* ?; @! w
}6 `( s5 M& m* O' n. e; V! R
}& D: M+ X i6 J) W- U5 T
else; U5 P4 G! Q) u; \; r! |
{
* A% M1 u5 S. C) t, S; u2 K + C q5 o! F, G- t" @
for(var i=objs.length-1;i>=0;i--)
! g; s6 f& t" B) ?' F8 E [- E$ L6 r {) u6 F: U; ], |6 e' [. k
var node=objs.item(i); - D# a! B# b3 U4 J7 h' _
( L4 b" i* e& K 1 c% w+ e& N1 d9 o. l
if(this.getobjstyle(node,"display") == "none" ||
+ M% i$ q% n0 ? this.getobjstyle(node,"visibility") =="hidden" ||
7 n) t- [; O" [/ I: M( B parseInt(this.getobjstyle(node,"font-size")) == 0)
% h6 N& H/ k/ g {5 o) q! S% W2 A% i% r0 N7 z8 S
if(debug) O* v* ~: F/ F, y7 {
{
, @' E1 q G% ^" r4 z v2 T6 {% E alert("remove invisiable!");( n- [6 \ X0 K8 Z
}
) ?, |5 Y0 l" v9 } node.parentNode.removeChild(node);
7 F/ [7 W4 V3 {! v ; B$ @% A. J0 N- d8 F! S; D9 ?0 Y
}. C0 ~3 n. o- o. T
else ) c+ ^) J# A2 v( r& \) B
{
7 K6 p7 W7 K+ f; g z" ^ if(node.parentNode)
# F( Q' [; T& y; V1 C {
" _& r9 Z7 z, ^ var orgNode=node;. L5 h! g$ W3 Y7 Y3 u/ \$ v
var orgColor=this.getobjstyle(orgNode,"color")
1 ~4 ]% } V/ W: [% q var orgRGB=getRGB(orgColor); , t* ]- Y, \+ M5 z* n! E% M
4 \- f3 e8 I o2 V$ S' F% p) T: _ var parentNode=node.parentNode
R5 |1 k7 }& A var parentBgColor=this.getobjstyle(parentNode,"background-color");3 v! t! d* N8 v
. W' c! i8 y" J( U. m7 G/ M var isLast=false;, G# [7 d7 @( @1 R" G! w
# f% G: F; n/ o( r! M C" G while(parentBgColor == "transparent")
G* y4 a8 ~0 k, J {! E# v0 E, c+ g! i5 I0 H" t! f
* X# V0 S: X! B& _$ C
4 m# ~& I) E' Z2 R if(parentNode.parentNode == null)+ A& m( E3 k0 K% n/ t' n9 ?
{
* Z8 d* m: T* k2 l isLast=true;5 y% q: {8 O! v7 w2 I; C
break;0 O9 K5 w f% x5 N5 H ? X$ b5 l
}
5 W$ j. F- M8 d0 i' r8 R. A' W parentNode=parentNode.parentNode;
3 _; Y7 K: \$ ~1 x9 U+ k parentBgColor=this.getobjstyle(parentNode,"background-color");
5 @7 k; k u9 ]5 w6 D5 H; M1 i& V. ^# i" Y, h% m5 K3 }
if(parentBgColor != "transparent") % Y- X3 O; q- ]1 z: x) r- f2 d4 P
{) ?/ P4 b9 U) e& ?* r& Q& m6 K" s
break;
' M( c- Q( {0 g( \. X, ^ }6 q1 O8 X! m1 {5 [$ U0 Y' U
}' u- {; g1 w3 F+ y" z
if(isLast)
9 @/ V& D; v( Y! Y {
* P% t, ~' f" R7 _+ L+ k( ? if(debug)
4 b; U6 E. M' _# D! o; j8 Q {5 D+ P/ q* s u9 L
alert("last!!");
6 A& z# A, I( D }
9 z8 q9 a; @% T7 W8 j# a9 R8 D: _ if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))' H+ Y* q& ^/ |8 y4 B% L
{
3 Y9 @1 B1 V$ ? u* \7 ?, k6 N orgNode.parentNode.removeChild(orgNode); . R7 \7 O C1 w+ |
}! p# x# x6 d8 m3 c. S8 N
}
% h2 _! D) Z4 l: ^( B( j else1 w6 k, g* R: T2 _- I, J
{! t% ^4 j; c& r+ C& l# Q
if(debug)9 U6 C5 f" j5 C
{ ?4 m1 |- A& o5 J" Z2 s
alert("compare color and parent bgcolor!");8 J T. w$ R& W6 s1 g; \ _
}! f- _1 D! S! C, W
parentBgRGB=getRGB(parentBgColor);
- T5 P& H% c5 N if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))) s/ d+ ]: q! q; i7 G
{
. v* `" A8 o( `& @% N5 W7 ?5 { orgNode.parentNode.removeChild(orgNode); 5 k1 j' l9 D, d
}
: D% Y' W) b; J }
7 B+ L) j, t1 \3 Q" }2 p8 A }0 b" l" p7 L# r+ g& k: F8 k
}% k4 B, ^, z% I3 Z: b8 O
}$ K5 q8 l2 Y6 u. ~9 Z, x
}/ t/ ~3 e. n a X% c
& P* V1 M$ s( D. _. F! t) ?
5 ]$ S( t5 E. t4 b' ` var itemFrames = page.getElementsByTagName("frame");4 s# Y m$ x+ Y/ M6 A& ^9 j
var itemiFrames = page.getElementsByTagName("iframe");
6 Y0 s) I- \9 z+ P5 [5 _9 J - b7 I+ ^ v' e0 j% X3 f8 F. k
var frame, iframe;
' ^0 m& x0 E% [9 a3 U if (itemFrames.length > 0)4 Q+ b; `( L* r! o: E6 f0 }
{2 {0 e' y" Y; C2 f: ?
for (var i = 0 ; i< itemFrames.length ; i++) * U0 ` L% h) ?* |9 g2 ?! I
{. T- o+ a8 U0 V
frame = itemFrames.contentDocument;
, R z! J: l9 Z+ W4 a& c- K; K this.RemoveHide(frame,objname);
5 X$ Z5 |* A7 q* c9 {5 `& m; @ }) {" [2 `0 P: @' n
}; S4 d k5 f6 I q- h2 _4 v
if (itemiFrames.length > 0) x2 ^8 }3 _5 B$ i+ {1 d
{ N8 y, g% w% o
for (var i = 0 ; i < itemiFrames.length ; i++) * E) G ^2 [9 ]" E* d, f
{
4 m% s8 J/ P8 O8 R1 C3 }% f iframe = itemiFrames.contentDocument;7 `5 {* Q; \5 |1 m
this.RemoveHide(iframe,objname); 1 _! F% C4 K$ a) {
}
( Z( E, h+ `, d( O* _* C! j) P# { }3 |% e% u2 i2 j1 b% X8 c# Z
}
* T. T& f; p5 \$ @4 P& x5 z catch(e)- H- Y& u5 A; ~9 D2 q- X3 Q- s) g. c
{
& ~2 o# S. p% `' H6 Y0 P+ f if(debug)
. V2 K/ h* z6 ~5 ~ {5 W1 P G7 V) i
alert(e.message);6 J5 g7 x- O) M _! p6 B4 F
}- |: m9 B: C% K& ?% y; }/ |
}) |( h3 \ |" @& J# y/ L; q+ G+ E. R
}4 w% O8 }/ I# m5 h0 Y. f! k
( O$ w$ e" B0 ~. R
}8 J2 @2 l7 T* M9 ?9 f" a6 d. H
$ N% o3 }3 ?( ~) a- kfunction getRGB(colorString), I: b$ u8 f- T* n; ?
{: S& K' x. `0 O: P5 C. ?
var RGB = new Array;
5 I5 e8 \* x1 g" Z var tempSting=colorString.substring(4,colorString.length-1);: T2 r: t/ K7 O2 ^
var tempArray=tempSting.split(",");
/ Q3 z5 ?0 W' |; @, Z6 r3 v2 T' e! y7 r
RGB[0]=parseInt(tempArray[0]);
& ~% ?& T( s- J# { RGB[1]=parseInt(tempArray[1]);
7 Q5 l) y$ j8 ]. k/ K9 _ RGB[2]=parseInt(tempArray[2]);6 p" z: Z1 w- d. o: U
$ g/ I `) k3 U' C% L" J* n return RGB;
- _5 [3 m$ |1 I7 n8 n" N! F}
. F; n& P7 Z' r/ ffunction keys(evt) s1 O. ]% z* R" r9 s. X3 D
{ 6 }; k& P$ w9 C
if(evt.ctrlKey && evt.keyCode=="81") " T$ [6 `% _0 O7 x# J! J% m
{ 1 {" S2 ~& @) x, v
CleanHideObj.on(0,1);
! O- c: I* J0 j alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); 3 f: A% I0 H% [0 |) b' d Y
: B" r/ T% h: V3 y/ b& [ } 8 Q5 I. F& t$ j/ W8 \
} - {: u, U% Q* l( @1 u
document.addEventListener('keydown', keys, false); 6 m4 H N! d/ \9 i+ d
GM_registerMenuCommand ('Clean Hide',, H3 I# z; @: U/ m; t
function(e){' N ~+ Q8 T+ _* x h8 P0 D: f5 l
CleanHideObj.on(0,1)
5 W1 N8 k" k" F. J- G& r! ~ l valert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
( ?* a' q; f* Q" ~$ X1 @3 r% U});+ A8 q# l% o7 W3 |# E
|
评分
-
查看全部评分
|