|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
5 b& u# k% `! A" u9 [3 l0 C7 p) w& {4 _
' ?. s- k) I) a" Y+ \1 C火狐插件,用猴子
0 i! g8 g( C: V
/ p) A3 e" @/ ^var debug=false;
* M% `% z. w0 @, E+ i* Ovar CleanHideObj=new CleanHideClass();% S% `) i: F9 g4 ~6 Z; w# `
, ?* G1 B) _/ I" efunction CleanHideClass() 1 s T( ]: @ S, y2 ^4 u
{
/ N. t% m I2 \
/ H. Q0 i9 o- N7 W# Z5 `% P% L- m this.on=function(id,bMZ)
! h* l, l6 _: d' @+ V+ @ {& t, _; O4 \- R+ F" w0 f. z
- A4 o; H5 A! R' K! b' J if(id == 0)
8 j8 H4 I% I" s$ { {. O9 [7 N$ K# ~0 N7 R' a
var page=/* document.getElementById("content").contentDocument */document; 1 Q5 i. I0 z' E3 y3 I X) W+ E
this.RemoveHide(page,"span");3 `5 [6 e6 ]* w/ k J
this.RemoveHide(page,"font");
6 h; n1 p! N' j6 W, q \ this.RemoveHide(page,"div");
8 z, q3 n1 V% w0 F. B% k6 z4 f this.RemoveHide(page,"p");7 W7 h) [% S- q# L* O) R, `
/ A( v( e0 P u }! Q4 H- m7 b( i/ D0 h2 l) C6 p0 K
0 ~% ~7 D$ u+ ^# t }
' p* }" r6 A4 G3 O" n this.getobjstyle=function(node,prop)' S, D* ~) B. ~
{
- U6 r9 e, H4 n4 C: p0 {( @ try3 ^, ^, P6 Y! `
{
7 V) U- f8 v1 U return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
% z8 ]/ y$ U( J! b9 i }) {# r, @ N& e
catch(e)) E9 F% y+ O/ y
{
9 N k# \! R: Q3 r; w; f9 I, B if(debug). n% P7 q% G. B" O% N+ T
{
' x2 S, n9 p& y alert(e.message);/ Z3 `5 ^6 U" i
}
1 `8 t. ~7 X- d4 v% f( k7 r 3 B7 t5 [ a; Y+ H1 d; |
return "200";
- r! S! O5 k/ h# o/ v7 D' Z! p }/ D8 Y" m* g+ |* E# }2 F1 d3 {
}
?0 w: l2 l6 R- ~8 P, D 8 U$ o6 X! C+ f0 |# `6 m
this.RemoveHide=function(page,objname)
5 U& M# f" ]: g: y- Z- j {) S5 m7 X) `+ d
try2 r, ~% P0 s8 t) {
{7 L" ?7 H; \' F$ g8 \" K4 S- {
var minValue=15;
) z+ R1 w. m0 {7 k1 [ var objs=page.getElementsByTagName(objname);
3 I3 w# Q2 U' v1 o9 c# e* r" m( m' k( q) P5 K% F
if(objs.length == 0) & ^' t" t$ R) U- M
{( a5 t* M# \0 A1 N
if(debug)
1 ]: O7 x# Y; j: ]& F {
* G* Q6 t2 V( n# g1 y alert("no object found!:"+objname);6 z# v/ P1 s. v8 ?1 O |
}% X) ?. {8 x% }% Z0 F
}
. Q( y! G, ~- |+ @( H% X6 N+ [! m else! \& v& g* t! e$ ?6 [. V7 l# h
{/ L2 L& x a0 k: q9 B0 b
2 ?, R5 m& |& ` h
for(var i=objs.length-1;i>=0;i--)
! C# {( u$ W& [' m- w {. x+ C8 f' Y( M+ [! {/ o) H
var node=objs.item(i); 9 Z/ G1 t) [8 I7 K7 p& M9 k. g
' e+ Z7 c7 t3 {
! t- D6 V/ J" _; ^- ~
if(this.getobjstyle(node,"display") == "none" ||( {3 F0 U& t+ M# f9 J3 o
this.getobjstyle(node,"visibility") =="hidden" ||
p* ~( t! u2 [; L+ n parseInt(this.getobjstyle(node,"font-size")) == 0)
8 C+ Y9 t& w, B4 N6 Q- |! G& L0 Q {
+ o3 D8 M2 L; E% o( t) q) } if(debug), }) ]+ B+ K- P; {% F
{# L/ U( x$ E: f" O, ~
alert("remove invisiable!");
$ @; O) y# n" x" s1 B; ]" J }8 a9 F m+ J3 R2 R/ P3 k2 o2 X
node.parentNode.removeChild(node);( [% ?& O2 J) s- e9 e) Q
, }5 k3 f- l. }" c }5 P& z" p/ ^- M o
else
( K- t2 i( c1 b, B {4 N; ^; T( g/ b( @$ k
if(node.parentNode) ! C& N; M' x- W6 ^' j- |: e% T
{
; r9 ?, R) H1 w7 T9 ?7 T5 w) m var orgNode=node;
. y9 [8 R) X$ J* o1 ]8 W- p var orgColor=this.getobjstyle(orgNode,"color")
! V# v1 I# ~1 [% q. S var orgRGB=getRGB(orgColor); 7 J( i- y! K8 a# k( j
" O6 A* g' D' L! \% k var parentNode=node.parentNode
* e" }3 z- q7 P* L' r3 t1 R var parentBgColor=this.getobjstyle(parentNode,"background-color");. `7 r _ I% Z. j2 V/ v2 e
0 Y b- R; k! W+ {6 i, Y8 n var isLast=false;
* R5 I F* Z- h: ]
2 V6 m7 c' X1 T1 m" r; @ while(parentBgColor == "transparent") + ?3 d. L9 i' ^4 E5 K! C
{# Q" u; m* `# U Z3 z, t7 q& M0 g
% c1 b( Z. d: f$ U' u' N
8 }5 F5 g6 {7 J4 P5 C' ] K if(parentNode.parentNode == null); ^! F8 c) i6 d9 b/ e3 W8 Y
{
% F9 A7 n" D2 ^2 O. C/ g9 A isLast=true;
8 ], F3 t1 I. T) N break;* K+ h5 Y1 t7 X H
}
" H0 |) o4 S7 T4 Q( u parentNode=parentNode.parentNode;3 I: {3 d' v9 T' j0 K! E D+ N
parentBgColor=this.getobjstyle(parentNode,"background-color");- _7 l1 Q% a0 \% v2 h7 T/ `6 T
' a5 ^. a) i6 v/ u8 C: c if(parentBgColor != "transparent") 9 K E. C$ [) }* @) V$ m3 s
{) t4 A* m: B* s# w1 {: b1 p K
break;- j3 e. `# R* L( {# r
}9 M( p! _9 Z% \% a: o
}9 t4 h2 U c: U# P: [2 D( u
if(isLast) * |- n0 g' T! Q
{ \, a" N% A7 o6 d; t6 F% a* s3 T
if(debug)
; l6 x- |6 t( i9 Z {
( }5 J0 w$ F" g5 q( [ alert("last!!");
) l& F2 c: H! {$ A5 R" |- a }
6 y/ E Y- K7 D5 C; D' i0 b if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))% B+ C1 V" w7 b5 r; ^% X9 ~
{: f. E' C' \% r$ }1 X/ g& Q0 Y- u/ O3 r3 {
orgNode.parentNode.removeChild(orgNode); 9 _ I" B6 G; B( A' z1 r
}
- }) J5 X# C" p7 K$ Z1 n3 h }' b8 F. D% ?0 m" j% G6 M% U
else# {4 {9 T1 m# I7 j# A" `
{) K. E3 B" a7 x( C5 ^" |0 q
if(debug); Z' f2 t7 G; D" D
{. r# k' e2 G. a# c
alert("compare color and parent bgcolor!");
3 M! e: H6 y6 Y }+ P% q0 b8 y6 ]
parentBgRGB=getRGB(parentBgColor);4 h) J. q5 }7 W- P6 T# o
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
& K( P5 @5 I9 ^8 h6 w- d) m! D {3 \. i. S- t+ q+ U# C4 m* x
orgNode.parentNode.removeChild(orgNode); ) U( L* Q8 e: s2 U+ U
}
, c( h( m; }# D1 P x }# o6 _; G& k/ Q+ R: N$ T
}) ]- v/ B) M2 A. _1 D3 }# V+ ?. ]
}
4 Z6 Z3 y" B2 ^ `, @ }4 N4 F7 z. U* `8 o5 J s( {
}
% |$ x1 |+ W3 V6 i
9 ~' @% @' k& N- y 1 g6 ~" X1 B7 K6 b
var itemFrames = page.getElementsByTagName("frame");
! `6 }( i/ S' O+ ~4 f var itemiFrames = page.getElementsByTagName("iframe");
; \" o+ H" {: Q& |: [( m7 W3 J / t# Q3 f& m v' E5 E
var frame, iframe;
# r5 V4 f4 g0 j5 c$ I Z; ^ if (itemFrames.length > 0)
; N6 O+ }" j' _2 A {
: Q6 C! ]$ T* f! y: d for (var i = 0 ; i< itemFrames.length ; i++) . G6 F% R5 F( z! f5 Y8 x
{
& w* ?1 ], c% ]2 r1 j frame = itemFrames.contentDocument;: H4 w3 |( i2 d8 T& Y
this.RemoveHide(frame,objname);
& M7 m8 [' d+ K# Q5 N }$ p! @: U- ?1 N9 o
}
/ y0 ~" r+ w0 X. q6 O) X* J if (itemiFrames.length > 0)0 g3 J4 s3 {5 q! U
{& y/ a, Z) d% j/ {, O
for (var i = 0 ; i < itemiFrames.length ; i++)
( ~5 e& h- u/ i( V {
( N( E* k7 p+ G8 ^. ] iframe = itemiFrames.contentDocument;
& B" }/ |1 o, t4 A- k- e! j$ W% L/ R this.RemoveHide(iframe,objname); 0 y: v( |* Z1 r
}
' M( o! a" Q \( H+ t }
+ u4 c1 u" T7 M }
/ |6 o* P/ |% v3 v% p catch(e)1 n7 K" `9 }$ n9 r R
{- I2 D% B2 F) U& k9 ~+ V
if(debug)# _, Q# d9 \% m( n- A
{
+ j- j2 h! J9 n6 T2 b alert(e.message);
$ N7 {+ X/ s( c3 G }6 o5 `/ X4 I6 `; d% W2 V$ D
}- {: |2 M5 P4 c" p3 U& c& j
}
, M, q# v- j4 O! w9 E
( Y; s# x6 F' V F: A- R}+ q1 P6 I+ m. \% P1 }
) J( e6 S6 W. ~function getRGB(colorString)
# [. o) k5 U% W9 ?7 i9 M{ i7 |; F! J! X3 v
var RGB = new Array;
9 r1 `8 S* K. p0 M \ var tempSting=colorString.substring(4,colorString.length-1);) J4 s1 p2 Y! N0 P2 `( ^
var tempArray=tempSting.split(",");* B- d1 J: [0 }' H% J
" e g% H$ e# k [0 d. y RGB[0]=parseInt(tempArray[0]);
, ^. V: ^; h/ | K RGB[1]=parseInt(tempArray[1]);) n% F( j7 m% M
RGB[2]=parseInt(tempArray[2]);$ D$ }% }1 l/ O; `6 F9 w
6 u) {& E' V5 G6 ?2 m
return RGB;2 r$ b4 D, c( W) o1 c# \
}
# {, o* @! L4 q1 h' E b: f* Vfunction keys(evt)
: j9 D1 Q: Q# b" R {
8 J: |6 J9 f( U1 K9 `3 q& o2 w if(evt.ctrlKey && evt.keyCode=="81") & p* O3 ?0 \0 X6 s" {/ g, a9 ?- H4 Y
{ * \; A" A- x- t2 k+ L
CleanHideObj.on(0,1);5 U9 C$ D8 n2 ^' \0 n
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); 6 C! `3 G! ^; d& ]
7 k! `: w9 W# L2 h( J( T
}
6 y& V- a- t% a2 X4 N } 3 k& s) m3 ^3 |7 e" K# s
document.addEventListener('keydown', keys, false);
0 x! j7 k0 I. K$ MGM_registerMenuCommand ('Clean Hide',, D- \- I4 `* i9 Y) r- t7 m% ]
function(e){; |5 v+ j6 w( u! m0 z3 i' D: H$ ]
CleanHideObj.on(0,1)1 z4 p, G( M4 j' p
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
6 b3 ]* g3 Q7 p2 ?' ^9 B});
- M# T1 _3 F" C6 i7 s! v4 G4 x# _' [ |
评分
-
查看全部评分
|