|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
! Q0 |& Y; p% Z" G2 }1 j2 [- `/ _9 E; j2 E) _5 \- l6 ], {6 f
火狐插件,用猴子9 X, k% M; Q- \1 V
; k% r( \/ C- ]5 o$ I& Dvar debug=false;
$ o% R# z5 k5 J9 S2 p- Tvar CleanHideObj=new CleanHideClass();
; L4 w5 p, k$ i0 z1 g# h. |
) q5 A7 A$ v1 h' M# J# S! dfunction CleanHideClass()
2 Q, ~" k# Z5 V! D7 j{
! K/ E3 Z8 S! y0 A5 E/ A1 Z* Z " I. v$ P8 G" i, S# j& a- `' `! T: m
this.on=function(id,bMZ)
( _6 ~6 [1 o/ M- i1 a {" B/ [- q/ v$ F% ?/ z1 a
' P b3 l, Q, B$ y
if(id == 0)
, ^6 G; t' M6 t8 K+ a. |# ?! k {9 ~6 d: ~8 U; ?# |+ W
var page=/* document.getElementById("content").contentDocument */document;
6 h& n" [* @+ l4 [ this.RemoveHide(page,"span");- C0 ^0 U/ P" m. C1 K6 I8 y M1 \
this.RemoveHide(page,"font");9 y( P; ?7 F) k& @
this.RemoveHide(page,"div");
9 T% n& P z4 D. V' F/ S/ Y/ e this.RemoveHide(page,"p");
. R2 {* p1 L; B" T: D
3 Y) Y* `& m' @+ R }6 n. \( ~0 N2 h" d
/ K6 G1 \9 _4 J8 N }
" }4 i( T# p- O/ \9 S% p this.getobjstyle=function(node,prop)- c0 e. t" W/ y0 O) V
{9 z) [. g w2 E
try& a X/ s* s+ h, e
{
: c% f& n$ `% F; R return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);& J( ~# l9 `0 ~( b/ d
}
/ u, o8 c0 T! a catch(e)
0 C# O# f9 l8 a* L B# [ {! R/ \# g7 L( M( B% g
if(debug) I; u; H: E1 `
{, D. |/ t# |& \# Q& K0 ^0 n- D4 C: X
alert(e.message);
% s1 n$ A6 e7 ^7 e: C' V0 I }* x9 P' L8 A3 @' V4 Q Q M; ?
8 Z7 E# R; O8 U) e7 E) o4 y/ {
return "200";/ H8 f0 u" V7 I2 C) @0 {
}
8 ~% |$ D& Z2 g/ k& `; ? }
6 L8 }. ^+ m6 B2 B/ S* }3 `
: u3 A5 U0 ~) I. p' z! w# X& ` this.RemoveHide=function(page,objname)' I. j: s) A* c4 ?
{4 W8 V* g: U* F% A2 J
try
* E. M% y% H* }/ z' V: Q {
% w( u' M( V2 k: D: i var minValue=15;: d% f; {* O; S% Z& z
var objs=page.getElementsByTagName(objname); 0 W$ N; Q7 S* s$ m7 ~
( T& v2 f/ A4 g6 V, r$ S$ X( L
if(objs.length == 0) % V$ G4 c' z1 k$ K
{9 a E3 p/ O9 Z7 `2 p
if(debug)- k1 S$ v( E) E5 b8 o" J
{) I* K1 Z' q4 M9 D# t
alert("no object found!:"+objname);( F- ]8 y4 M. V) V# g* i
}
6 e, T0 E2 J) `' @1 [0 u; { }
$ S7 V4 N) o; y. y5 } else
0 U& i" Z+ s: k% I, X- g# W. W; c {/ K8 k- {. i0 _! S$ B/ w
4 v6 w* z0 c8 t4 p! p- Y1 g; E* R
for(var i=objs.length-1;i>=0;i--)
; b: `/ z# e* }$ w! @1 O( N" \/ z; a {9 A) C7 y. G( C/ B5 H# F
var node=objs.item(i);
9 ]; Q- Q4 u/ I7 r, j7 p/ j$ q 1 p6 b7 U& H4 z" c5 E) }
- v( _! @9 c6 }- X
if(this.getobjstyle(node,"display") == "none" ||3 H" R; i% W$ z* H4 d$ f7 r
this.getobjstyle(node,"visibility") =="hidden" ||: [5 T$ n1 L* R K+ B
parseInt(this.getobjstyle(node,"font-size")) == 0)
* w" ~6 S: W2 ?% d1 i4 V {
' F3 `. o: d ] H6 O' [* v if(debug)
, G0 x- I3 S! U; f# k2 U9 T {
& {' O5 a' R5 i3 ~ alert("remove invisiable!");
& }9 J5 M. }* V& h( K6 f) V }( Y: S1 c4 f( t$ q( A
node.parentNode.removeChild(node);
8 ^2 V b$ K* ^8 K2 u7 h5 o3 T
; h8 s1 U3 x$ Y* V0 q* O! M }, f0 ]* O0 S# s1 r$ t$ `/ P0 O0 p
else
* S0 ~# R @8 w: O {' f, t1 S6 \3 T% s* V
if(node.parentNode) 5 m* p( D- a. ~
{9 q3 X/ ~9 m! h( H A, j$ g2 I" V6 A
var orgNode=node;4 g2 I7 H3 V* y% c5 k% V" D; ^
var orgColor=this.getobjstyle(orgNode,"color")
V L1 @8 i7 X! S) x% Y2 X var orgRGB=getRGB(orgColor);
( c# i: f( u# m
$ e+ C: ]+ N( O var parentNode=node.parentNode% S0 ?6 D0 J8 X, Q* d7 F( ]
var parentBgColor=this.getobjstyle(parentNode,"background-color");
6 o5 d& }, l+ J/ ] ( k l% L& o/ o! p
var isLast=false;0 W1 o5 K# D$ r3 B4 r& C% B2 r; Q
( D6 D2 r6 B6 [ while(parentBgColor == "transparent") ! B: m; F: Q1 z* K( ^$ U
{
- s& U) r' m; O, M* w3 h6 i) L
k" Y& m h' b; L. D4 ]
- Y- d- a/ A; m4 L if(parentNode.parentNode == null)
! K/ e X4 A5 a% h9 h {
T0 s0 Q3 V" E5 ~5 u isLast=true;+ z8 K4 z! v+ X5 r V# m# H
break;9 d% x* H' i( k& t1 v0 q: G
}
& U R, s% E% G parentNode=parentNode.parentNode;
& S& q2 L+ r" a; j6 M% I( S parentBgColor=this.getobjstyle(parentNode,"background-color");
" ^2 C% r5 k7 a, i7 }1 E
: W. k9 a9 b0 J& ^( o; _2 H, ]7 A if(parentBgColor != "transparent") ) t* O2 j+ S: u
{" M4 j+ @: {- K& f) r6 U( ]
break;9 F" @0 r, u9 K9 L; ~& x5 S
}; j$ C0 R. F$ z8 K# a
}1 `% `5 J- O( T( J# V u
if(isLast) # e7 ^1 |/ |3 j- J, D
{
; a+ x& k" d1 C8 V' O if(debug)
! p, _$ O5 F% m1 G. V! b {
. ~6 w6 I* \( C) ~% B& i alert("last!!");/ s. c U4 B2 \9 o/ D2 V5 `
}
5 t, K# x9 M( B: c7 H/ f) T if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))# b/ S/ y& m6 Z& |0 T- }
{
% K# k6 i# ?9 F6 T orgNode.parentNode.removeChild(orgNode); 5 N* h& H1 O/ s; h: x' W
}0 y" i; u0 P" a4 G( L% m" G
}
0 l0 R i- @: t3 w else) Z# A% G0 d, z& L- A8 G0 O
{2 K6 k' a5 `8 y
if(debug)
8 L: s, l* x' c7 E. m" c0 y( F# r {( y$ C! e4 c2 H3 a, x+ t D: c$ _! n
alert("compare color and parent bgcolor!");8 a2 Z4 ^& G5 y7 B9 y/ O, w
}
f4 N* u3 I" V. e/ W parentBgRGB=getRGB(parentBgColor);$ y$ T- y' Q& W1 K5 v9 Y
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue)) q: V/ s* Q7 D x, ^2 U5 `
{
3 Q% _6 G) M9 ~1 [ orgNode.parentNode.removeChild(orgNode);
. o' w2 }+ {) A# o }4 g4 k5 V1 c/ z: Q* s" \
}- q" m) K F8 k1 S. K# x8 u
}
6 Z1 p; k3 c$ q* \! \/ Z" u }
3 ], i" I, m; X5 i! m. ^ } w; C4 i) |4 X2 }
}0 z8 _0 L* J/ ?% p; h# R
; O( h2 o. g; r2 t# ]
- }3 Q$ v& ?6 | var itemFrames = page.getElementsByTagName("frame");
2 [3 Q' ]: q* H) l/ g! H7 O var itemiFrames = page.getElementsByTagName("iframe");8 t5 \/ |% S$ x" k( }, W. L S
0 A! p/ U3 e0 L: F4 E var frame, iframe;4 y' B) Q# v7 E5 s3 d
if (itemFrames.length > 0)5 j0 W$ x% X H, A
{
) T/ r2 h' f; B& i& ^2 k for (var i = 0 ; i< itemFrames.length ; i++)
0 [$ e7 `/ j! O1 w% P {/ w( m X* P$ g# M& h( U
frame = itemFrames.contentDocument;: z% R/ t: o* C0 U7 d) ^
this.RemoveHide(frame,objname);
4 y. f F! S* U# g T }. H3 R" O H4 d# t! ]9 z; d
}
1 d; p2 C, N2 }" z# O7 q if (itemiFrames.length > 0)
+ L4 p& G0 g7 w2 s& j0 i/ s {, p' Z* M j ?7 b; i
for (var i = 0 ; i < itemiFrames.length ; i++)
: o q! z, z4 e! i1 Y* x {
3 `1 ~! ^( ~. p8 j5 g' @9 W/ G iframe = itemiFrames.contentDocument;
: s* e4 r1 }3 R this.RemoveHide(iframe,objname); , [$ F8 B1 }0 u8 ^8 z0 E& n0 Y+ R
}
- C( D- e1 i( {: O }' P( @' p8 `7 E& r5 n
}
6 u3 z1 e$ O0 ]' ^, i1 m( M catch(e)
4 U8 U7 p8 b3 C j& G5 D" U {. S O) W9 r; D" u2 ~
if(debug)) e4 _( j( E3 P! Q9 U
{. ~/ B8 V% X$ t# Q
alert(e.message);
/ N+ c2 Z8 a" u2 y }" n- {8 O: G4 A. c5 p- K7 k5 F( p3 N
}$ R$ x( M: H- [0 C$ v
}0 y; y! U2 k/ m
0 [) B, s6 x+ l' l' j
}
- x( {* Q+ i5 R1 R3 ^& _8 g; W7 c3 W* Q$ T
function getRGB(colorString)
) d0 T5 G. D+ y6 k" l J{
8 w% S C* D) C6 z( S+ A/ w. Q var RGB = new Array;; v1 A8 r5 p1 b% T5 k% G
var tempSting=colorString.substring(4,colorString.length-1);
1 z2 y! Y. f, \& N3 q var tempArray=tempSting.split(",");( l& y# T4 I! ?) @" e
; w! s8 d/ T7 y0 e0 D
RGB[0]=parseInt(tempArray[0]);
: N' Z" n9 r& \ RGB[1]=parseInt(tempArray[1]);6 }; {7 J1 o1 J
RGB[2]=parseInt(tempArray[2]);8 N J3 Q9 B W V$ f
3 }! K5 n" m9 W3 Z E* a* T* q return RGB;
% Y8 i' h' c" x( z% p8 N+ G}
5 A- H m0 m( K, hfunction keys(evt) 4 `( a3 Y+ K' |8 j2 @
{ . o( x6 c; P8 N) r/ k
if(evt.ctrlKey && evt.keyCode=="81") ?4 R0 W. {" v# I
{
8 D* I3 x- P$ m$ O$ x+ @7 \) ^5 [ CleanHideObj.on(0,1);/ F1 `& p$ b; j
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
; p0 h+ z1 j0 v) Z; ^- N. J3 v$ s
* T/ c4 ]/ `3 d) Q9 g/ T1 C1 B } " y6 x: ^2 {+ z2 L% W6 a
}
w) `. h4 u# m* b; W2 adocument.addEventListener('keydown', keys, false);
( Y# J% x4 w; p) dGM_registerMenuCommand ('Clean Hide',
$ O, [* Q6 U3 N, i/ ~function(e){6 `+ @) X0 U- g6 s' q/ t4 r+ i
CleanHideObj.on(0,1)7 F. i2 W* \9 Y- j7 K
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");$ a) E# m/ o6 e- |9 a |+ l
});) N, f: i$ b+ M2 P* ~% |0 j
|
评分
-
查看全部评分
|