|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
. O- {+ x' x. Q
, k. y& W, B6 ]- D: \. G火狐插件,用猴子8 }+ v# v0 u6 @1 L: d# |
. M+ n7 ^' K5 a- X4 q/ Nvar debug=false;
+ X6 b" |0 _+ Pvar CleanHideObj=new CleanHideClass();6 Y- e* Q- |' j2 V% W
. [' X5 S% F% N. H2 m+ sfunction CleanHideClass()
& a" a h' s3 `. X" {{
! H. X* M, ?5 ~& G ; K0 K' y* s. [# |+ `& a) b
this.on=function(id,bMZ)3 L" F* S9 k5 T2 f( M' w$ ~6 q
{
5 ]# |0 {6 O' R, n8 p+ j 7 }# l* |1 y% I3 Y4 b
if(id == 0)
) Q; t9 O/ A D, k% T- S {5 v* o: R. i x" C6 G( h
var page=/* document.getElementById("content").contentDocument */document; ; z3 H+ T9 i5 Y( \
this.RemoveHide(page,"span");
& D' }+ u$ ?0 n2 h this.RemoveHide(page,"font");
& `3 H0 @# w0 N& j* P7 w this.RemoveHide(page,"div");; v/ |+ _& C! T" b, Q% \( [
this.RemoveHide(page,"p");
2 R z1 u+ k' J
4 c. W) M9 d( b* R }; Z/ p! S! o: H' ~
8 F2 f8 K( }$ m- @6 L4 p }
& I$ o5 R$ M3 B! [# `$ W8 y$ j( K this.getobjstyle=function(node,prop)
# z2 Y4 W. _4 A: H' T2 _& l/ ~3 N% S {
( H7 q% A, H& i: B9 _ try% E z) `; S! |
{- Y4 \( ?& _' n# L# @
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
& V* W7 |7 j% I- G }2 i2 @. U1 K3 q# ?
catch(e)
& E2 O$ ]- ] k; K/ j( Q: D {2 c( ]6 P! k; }0 ^& X$ y! t" b- t
if(debug); Z/ F. o! {8 f2 |8 w. f
{- p) G" x6 s3 \, Q3 A
alert(e.message);
& V! f. D& Z7 O }: [4 h' X7 j; J3 M
) k5 T$ g) F2 Y2 Q; N. K
return "200";. {, h9 D. }+ x$ w" O
}
9 H, a+ W* U0 `! H. ~( ~ }& {6 i0 ]: i2 R) V* Q
2 b0 H, _- f2 D+ ~" y) ` this.RemoveHide=function(page,objname)" q- E: G4 v/ V" k2 y, J
{
. J. ]) a. X1 K/ z8 o8 ~ try) Y3 ?, O3 g* t: D' `, Y
{
1 B3 M4 X8 ^/ b1 x4 [7 T4 t# `! k var minValue=15;: x. d5 j0 b9 B. n7 H" |, z
var objs=page.getElementsByTagName(objname); + w$ @* `% e, o: b0 t
7 {9 P* d3 c' _& [& L
if(objs.length == 0)
. k1 c+ @ }2 u. Y5 W) n {$ b! J2 S2 T) t4 _- P3 P& H2 P
if(debug)( w. @* t8 J$ A. g
{
$ y5 q {( h/ c' v, C1 u0 [- `& q alert("no object found!:"+objname);; A1 b @! q4 g; [
}
, d& k- _) C+ D. d3 O }
# {. X2 I7 ?- m, m9 _ else; F$ f; X3 d" D! o
{! O% H9 U7 U! C K1 ]/ D
& p6 {/ Z& M7 ~: A for(var i=objs.length-1;i>=0;i--)
! n4 w. M( P1 q8 f {1 [) z4 s4 ^( u' t. _
var node=objs.item(i);
9 p9 t1 W2 _0 ?( c; W4 O
" v' L& d8 T- ~ P3 {, @' x* v) c . i- j6 j" J6 y
if(this.getobjstyle(node,"display") == "none" ||0 L, V4 [7 M/ X8 F+ A2 @3 A
this.getobjstyle(node,"visibility") =="hidden" ||3 V6 f s) K7 n! e) c) y$ Z1 |, Z
parseInt(this.getobjstyle(node,"font-size")) == 0) 8 L. C: ]* N+ \2 c) | i% e
{! W0 d* n3 C/ p/ {2 O
if(debug)2 D" W, l( n9 Y) D6 `
{
4 A% L0 @+ D, `" F# x M alert("remove invisiable!");1 }( z2 g2 D- w/ e- {
}
9 m: ~7 R4 }1 u( q S) ~: _- ~ node.parentNode.removeChild(node);
/ m, c) _+ z& D/ B9 } . v/ b( r) d1 n% l! x$ @/ a
}
: G4 C) J9 |7 i else
8 a0 U: Q: r! q. o6 S. X! U { F$ w8 L& X0 U. V/ k" N) x
if(node.parentNode)
5 ^; B3 F5 e K: K {5 i5 B- m& \+ |0 E' M3 ]
var orgNode=node;8 C2 B" F+ w/ x7 k+ W$ P$ L
var orgColor=this.getobjstyle(orgNode,"color")" \; z! B9 p$ G/ c; a+ i- x
var orgRGB=getRGB(orgColor); 3 o9 T9 [; H$ T7 E) ]1 O2 r0 N( i
6 }# f6 M9 k$ [2 j. @ var parentNode=node.parentNode
9 n# U" F- |# Z# t3 ]4 ] d1 W var parentBgColor=this.getobjstyle(parentNode,"background-color");
: W6 y, f' C% t4 r I' E ; q" j" `& X3 f3 M, ]* n1 _
var isLast=false;
# a' J* ~$ H4 z
: _! Y6 d+ z" i2 L. f while(parentBgColor == "transparent")
. |, N* r/ ~3 Q: a0 B {
+ T" ~* t4 E- H9 h! f
) A& G" h- N) t7 O) Y& D
1 K$ }& N! ]& w3 ~' e+ k8 w if(parentNode.parentNode == null)0 G6 _1 z' M- X$ A
{$ n' I* F7 a; ]2 j- z' q% d
isLast=true;
/ e6 F$ G- N# y/ ^! u- m break;
: A2 W; \+ `+ z/ L8 d" m; N% V }/ u. T4 @- t+ I6 O6 r
parentNode=parentNode.parentNode;4 V" T! n0 p! J/ g9 s- Q$ ?" u
parentBgColor=this.getobjstyle(parentNode,"background-color");
# a9 W' q! K; {" k- H1 \) ?
- I9 Y2 R- @; v4 K/ L2 W! b if(parentBgColor != "transparent") + O# j( m h, W5 x# C: T7 |
{
- Z) L; i* N% p4 g3 z4 J% ` break;
8 p8 v$ ?: ~ Q: t( x6 H) R% T6 { }
( }4 Y( |& m6 r }
# p$ t$ L$ `9 P4 ]( y if(isLast)
' n5 ]8 {8 L" f; P% ?9 q {
7 r1 G3 @ c$ u; s: ? if(debug)
/ l7 [$ G2 H1 a2 K1 `# ~- V" ` {
, A0 B7 r" \6 f& E( \ alert("last!!");
9 Y9 @0 ]' D5 O" Q6 H }
. c( f! Z; n4 K/ Z! I( Q" E4 B if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue)), p2 c. e2 k3 h+ }7 \8 I' v
{
( Q7 M2 k' a: u* N1 A5 p orgNode.parentNode.removeChild(orgNode); 7 H! s2 S3 h+ Y4 Y; @3 F ^. V
}' j6 {- C' k6 h/ S; }
}
4 x: k9 P! c, j else
' \, w: e i+ t" f& B, c {! ^" }) J, K' P
if(debug)
" Z' j" d5 P' V% ~$ U# V( a- }6 x {
4 D' H/ H. o$ k; v" y% e% m alert("compare color and parent bgcolor!");
6 x+ c8 B7 g$ y }
9 k% T& K6 y9 h* [3 o$ w) a1 o parentBgRGB=getRGB(parentBgColor);
0 X+ y0 Q5 a; G8 T( ~" t* `+ q if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))1 y2 i6 X' |3 M# ^
{
( z+ T! ~4 M8 k5 _- P8 `$ S orgNode.parentNode.removeChild(orgNode); ) }5 f% ^' d6 U
}
' j, V, M0 v j+ A) H3 p }; e( j. v1 n+ u) f! x- i
}! _1 b1 r* n- g! {7 h9 U* L6 T$ P
}0 V; I' |) r1 h: r% c) b
}
- d: n6 [/ e* x. E; q0 s }6 a) O, T2 u1 C! G1 G5 x! I4 d
- k' C( t( D0 I9 F
1 ]- F, h% `" }- y1 N7 k0 r var itemFrames = page.getElementsByTagName("frame");
8 p' V; {: o3 K$ U var itemiFrames = page.getElementsByTagName("iframe");* \5 `1 L3 p1 |6 H8 u: q
4 t4 c& \' i" W
var frame, iframe;: H8 e- W$ S( f/ Y% j' p& ~
if (itemFrames.length > 0)3 F: b/ p1 x" Q- ?
{
7 S2 \( H( m2 Z for (var i = 0 ; i< itemFrames.length ; i++)
. W1 h8 O) w- {! \ {
- Z9 L f3 Z8 a0 b9 b9 f6 M5 I frame = itemFrames.contentDocument;
1 G) p8 F! P+ U% Q8 D( R; Y% n o this.RemoveHide(frame,objname); 1 | k+ y6 W9 D) e) ^
}
0 }; c; k3 k* ^8 W3 o- A9 L }- H* W9 V5 X9 ?' N. F, P! u$ n
if (itemiFrames.length > 0)5 m3 y, i( R& }2 S( F; `7 [
{
- L9 @6 ^! ?9 e3 ^ for (var i = 0 ; i < itemiFrames.length ; i++) ; \0 u& Y; u' `" e
{" u$ v6 w$ X K% e R
iframe = itemiFrames.contentDocument;
5 o8 W0 k& r. {: K% o this.RemoveHide(iframe,objname); z1 R: Z) \0 U- X$ A$ _
}3 _5 L, `& V5 p/ f3 T
}0 J/ R* o/ f7 l3 H; B- p
}
( z% @6 P1 S& l/ T" z catch(e)
+ k4 @$ A+ f: R5 P2 u {; ?# q( J) N0 x3 Q
if(debug)
( i+ v3 y3 i$ X4 | {0 `3 j' ^$ e# U8 j4 ?9 m5 \
alert(e.message);( T" B w2 ] U G
}
9 {) x3 Y C% B4 ]0 W! X }
6 b8 e# W0 o% |# L" ?" Q' _% a }
3 Z* l8 i4 q' D8 N9 Y |5 E. s; g7 L
}
. v5 {7 n% z+ R I. U( |" ^/ H7 ^, M
function getRGB(colorString)! A7 k6 S/ o: t A
{
" \+ ?, R+ P$ i var RGB = new Array;
+ H! b, P+ V/ V7 d$ f. { var tempSting=colorString.substring(4,colorString.length-1);. N& T0 X. n$ b c
var tempArray=tempSting.split(",");
% X9 h, B# e3 Y" g, y/ ]% |' g& H- u
4 B$ s* ~( u K8 ?. [ RGB[0]=parseInt(tempArray[0]);
5 ^8 z7 s# w, b# s2 k. ?9 T+ @" z RGB[1]=parseInt(tempArray[1]);
3 V9 q) Y! v& t& e/ d RGB[2]=parseInt(tempArray[2]);
# J& [/ t+ z( e, T& R/ w * p! r1 F7 X7 J9 Y8 z w W% d6 y
return RGB;' S% @9 w8 k; E% e3 u2 b) _: @
}
7 H" }7 B/ I: Tfunction keys(evt)
+ k. {. |) @5 A: _* |8 I9 U {
2 i/ Z! D8 L5 B if(evt.ctrlKey && evt.keyCode=="81") 0 ^$ P/ i, l5 R z* Z9 C
{ ; R4 N% n! X+ b* f Y$ s) o
CleanHideObj.on(0,1);0 e3 \ @* S$ M" ?
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); . o) x1 s3 n( s# e, n
! k; P* W' }- I+ }3 {+ r }
% ^, y# s. k# L) z8 _8 u } $ N4 {' y, B: w/ t, l; ]0 O
document.addEventListener('keydown', keys, false);
# k, ~/ V T3 N9 h+ oGM_registerMenuCommand ('Clean Hide',, I0 K$ D4 m! @* M. ?' O
function(e){! q+ P, [' d% n- o9 R, `! n
CleanHideObj.on(0,1)1 A0 |- M6 _) Y
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");" C+ e' t8 h! D# r$ k
});+ }; P7 R7 _0 I, ?( w s! O( o
|
评分
-
查看全部评分
|