|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 ( O9 ~/ I2 X$ |1 f. x u
% ?/ Q( B+ g8 X8 \
火狐插件,用猴子; G' l& y& R9 e. r
9 b) ^7 @2 s& P/ m% ivar debug=false; # | `2 P( ~ v- |
var CleanHideObj=new CleanHideClass();. e& I$ Y( C! v8 p1 y
4 R1 T& ^( C6 ^3 k' d0 q M/ j0 pfunction CleanHideClass()
% M. r5 v% N- A8 x8 k* S; _{
% ?2 A& f) T- B& y, E. Q# e* B
- E' n# X- N8 |: t* }! m6 V1 l0 Q this.on=function(id,bMZ)2 q. B6 ~" s2 i$ I
{
1 P, r1 z' _! O# z6 @- G9 [+ r
. W+ b8 ~0 f9 _9 n if(id == 0)
8 z' B4 y" _, a# ^0 _: _ {
3 M+ }" d6 W& `6 a; R6 z. h4 G1 @ var page=/* document.getElementById("content").contentDocument */document;
9 R/ K# W6 U, P3 Y0 k& r this.RemoveHide(page,"span");
4 N; i" [- [; S. d X this.RemoveHide(page,"font");1 L8 a! g- C, N# |
this.RemoveHide(page,"div");
8 d# N, p; ~, A+ A4 P this.RemoveHide(page,"p");
# T9 L9 n! c; l 2 h. k: v* B( C' y% A# F* H
}
1 L9 ^2 y; U5 r7 G) r; C
% W" m& s7 D( o }3 n) N1 n% ^% f+ s- @2 E
this.getobjstyle=function(node,prop)9 _7 I+ Y% ]3 g. u# u0 s1 W% V1 c m
{
. K, E$ [# q* `- _ try. O7 _$ U7 w( m# y9 {$ |, R" r& m
{8 X" X( Y7 b! X/ U3 i- i) ^$ M( I" y
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);: I' P6 T+ @, Y+ U
}& P: j) |4 X* ^
catch(e)
- L/ N2 l( Y. O+ S. p0 s. F {
: g/ h( J5 R8 i% _) l! { if(debug); u- ~4 ?) j8 J
{
& H) A- Y' N; f/ E alert(e.message);; r& y( b' u A8 \1 {
}
% b1 f$ n0 J# g6 b( j
$ S* o9 d8 z z5 t. f8 v. v return "200";
3 G" z. {5 X5 S" W' M$ B9 C: K( B }/ i- l }4 I" D0 x7 q
}
, m5 X+ q G; O+ H 5 H) N$ z# X' B5 y; ~5 |( C- }
this.RemoveHide=function(page,objname)
- [7 i: t* [: N9 p# X8 c i {0 o* z& K K" Z O, `
try
, l# @8 _5 E( Z4 b {* v+ ]& I W; z8 v( Z
var minValue=15;
( w( }3 `; e0 v/ W1 p0 y1 q5 Q var objs=page.getElementsByTagName(objname);
a0 L' [3 I4 Z% r
6 ~5 ]5 k* W. L5 W if(objs.length == 0)
6 @/ G7 d- e5 g% c j8 N/ I {
c% i: Y2 U) L+ N' m/ u5 t" ?! y if(debug)8 g4 P7 ^$ B. P1 r" `
{+ J: s' f6 c( `% C2 _
alert("no object found!:"+objname); {. J( P& M, w9 y; T
}: v5 W% i9 x; s7 ?
} ?9 K3 h' G5 }3 c
else- x2 \) D) o% N/ h
{
3 W2 r( b: P% E6 c; {
) [/ N& F7 B0 o& f for(var i=objs.length-1;i>=0;i--)
0 u! b1 Y- Y* A% {8 ]/ r {
) Q. P1 O# b E3 {) \# t- W) V2 U var node=objs.item(i);
e- \3 Y9 I7 X( V$ d' A " N: K& k7 O& |+ A, _
7 g7 s7 o& w# ]9 J( G
if(this.getobjstyle(node,"display") == "none" ||
1 q. G( u" K5 S/ C$ M9 Y, D2 Q/ T this.getobjstyle(node,"visibility") =="hidden" ||) M, u: E& q N8 D8 S
parseInt(this.getobjstyle(node,"font-size")) == 0)
5 r+ T, i; A9 l {
1 Z/ p6 ]' W+ G' e7 w if(debug)$ H8 o( k+ r- \; x3 |
{
0 k1 H' |- @! ^4 h' ? alert("remove invisiable!");- [' I( }0 u O1 @* p6 u
}) u. i% O# }! `) \+ N
node.parentNode.removeChild(node);
7 ?& e* p8 G, y! y* {
4 A1 \6 h; r5 G/ {5 U% x }
/ A, I5 l' G3 y else " |8 A) E6 ?' ^4 R" Z
{. B( x6 q& ~+ w0 W1 m0 b
if(node.parentNode) 0 ]6 v; `$ A* E# A, t4 R% G
{7 U# I2 {0 `3 V8 r L, D
var orgNode=node;" N* [/ f9 |/ D- \! `' K# [
var orgColor=this.getobjstyle(orgNode,"color")
. k* y9 n, u! B5 d7 q var orgRGB=getRGB(orgColor); : s( U, b0 D$ O2 i: B6 d1 ~$ B
+ H3 Z% N0 ?; o5 q! E var parentNode=node.parentNode- p! G5 ^6 l1 G& ~6 V$ `7 _- Y
var parentBgColor=this.getobjstyle(parentNode,"background-color");
0 R% ^0 g" ^1 }( f: A1 L2 d
9 r+ ^0 F. T! u; X: j var isLast=false;
8 s L0 D6 l+ Z# Z) M
: }3 A! C/ F r while(parentBgColor == "transparent") ( |0 d& r3 h9 |2 w
{
. Z3 z4 g7 L' d+ C, Y* N/ {5 w
f4 V8 y# b6 L. d6 A! b" u % g3 ~/ O' D/ t# B6 H" {! c) A
if(parentNode.parentNode == null)
% S5 E: B0 j" l6 J {) F% h2 i. x. R( |7 o
isLast=true;
/ I7 a+ O# G3 Y6 d. N& c break;/ U; i: a4 V/ c: }
}
* [5 l+ w& g, I# h- [/ t parentNode=parentNode.parentNode;# M. i3 k+ i6 _4 {
parentBgColor=this.getobjstyle(parentNode,"background-color");/ p3 Y1 z3 W C6 {6 e& J4 F, f* {
5 @5 n) h/ Y: n8 x if(parentBgColor != "transparent")
) z1 R6 M4 x* }7 T* T/ u {
2 D7 c2 _# e" K6 T2 i( | break;
! V- Y9 I1 D/ R8 I3 x. y$ p) H }
# d0 m. S" U: r, e }
7 p4 r% C6 r8 |* L if(isLast)
% ^& R3 ` d j3 Y! K {) ^! V" A/ K3 r' r M& }
if(debug)
Z& K2 l$ U! m {* w1 K6 R6 H( E5 {
alert("last!!");; U- J6 b T" v
}
4 {7 J( S, m t& I. p N if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
/ J' r" a/ p/ Z( c! h1 v {
, O0 x0 g( P% _ orgNode.parentNode.removeChild(orgNode); - j" R2 W' M: j, B' P% e. F
}$ M/ c" G* R3 A9 v
}' C ?0 a& T( s. s" V7 t/ L
else- J! L5 w4 T8 L7 ` ^$ K# s
{
! ^% C; R+ L% U8 P0 `$ M if(debug)
/ ]4 A0 E9 s/ B4 v7 Y K {
' w6 D( \" H* M1 | alert("compare color and parent bgcolor!");
$ B$ P: K8 | B; z: {! J# V }
0 y: s# B* T. s5 T* Q, w parentBgRGB=getRGB(parentBgColor);
8 ^8 W; c2 h7 s( A' s if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))" f, a' b, b7 E% `
{
! T2 n! x; h& z x6 ]8 ]7 d orgNode.parentNode.removeChild(orgNode);
" W1 ?# I) k _) ^/ D4 W6 ? }" q$ [: C6 i" e g ?
}
4 A% t8 k! m0 o3 S- p% P8 ^ }" B8 B# G, K- |/ p
}2 n" ^. v- J4 r9 y8 @
}
- v7 x$ ^) F7 r# d3 C! `# p, e* i }4 @% z5 v3 b! |9 r2 u; M
2 s/ h" I! g. S2 ~0 B' u+ z2 I
5 `5 }% o" B9 T) J+ D6 Q4 m- X var itemFrames = page.getElementsByTagName("frame");/ K( v- i6 G' Y3 P+ b# {6 L
var itemiFrames = page.getElementsByTagName("iframe");& ^9 s1 |( y' Z+ S5 Y3 N0 g
5 i% t& S1 B: y" R5 G9 `
var frame, iframe;
% z; W2 v% A+ d, x if (itemFrames.length > 0)- v0 s- r: w+ T& d
{
; b7 _2 O# F# g" u for (var i = 0 ; i< itemFrames.length ; i++)
# v! r9 |/ r; r {$ w% `; `" T/ b& L
frame = itemFrames.contentDocument;
+ }% N. N' n/ J U( { this.RemoveHide(frame,objname); 9 T7 l! ~" p9 b: x: c
}
" F; U& `; z5 j& l: D }
* l/ r& Z2 p/ o2 x" |. W- Z) a if (itemiFrames.length > 0)
2 {+ I# i5 j& Y# S: z/ v2 h" ] {
5 f' X( n. }) q- F2 A+ | for (var i = 0 ; i < itemiFrames.length ; i++)
0 _+ B+ J' Q0 M& f! a {
$ f8 C% s$ I, v# Y iframe = itemiFrames.contentDocument;
% L! c7 W! \' B! K, U6 g' _ this.RemoveHide(iframe,objname);
2 x2 A0 v; R3 t, Q( O6 h! w1 x" w/ t }" b! w; p+ f6 k( s T5 E: g# A
}
6 f( x4 a! w- ]5 _) K' m }
6 S4 ~4 p- U: Z1 }- ]1 M catch(e)
9 j7 j6 R8 \( V) w {
, f: v! W4 y# J. x if(debug)0 `( v( ^5 z& _ ~
{
( T8 \& h1 e* V/ Z alert(e.message);
{% V$ e; a) e$ r$ x7 Y1 n }
/ f9 F( y/ r# P- g }
9 e8 N! j' }' c$ L }
8 J5 t9 c; x, I
: u/ m/ y+ p- K2 x}7 u3 y( ?( @1 `0 M1 a
+ U6 p# d' Z" w( Efunction getRGB(colorString)
8 ~# f$ w4 u/ d0 m{
* E! W* ]3 \0 g3 X var RGB = new Array;
4 h7 b2 j4 w3 N& B6 f var tempSting=colorString.substring(4,colorString.length-1);
' B3 {2 M! Z9 e" { var tempArray=tempSting.split(",");/ G' V' n2 d+ o( w K
; v9 \0 n9 p4 L& ~9 C. M* ^' d
RGB[0]=parseInt(tempArray[0]);
! w9 t2 t: k+ N. I. V RGB[1]=parseInt(tempArray[1]);) [! |' |8 y: q& k9 `7 p6 V
RGB[2]=parseInt(tempArray[2]);
6 n/ l% d4 c1 c- J, o8 u & T% u! L" w3 T
return RGB;
+ C. h. _8 ?) _2 ?4 U}
h4 W, C: X: p0 i' u0 efunction keys(evt) % H, D- ^ O& {) z, i% n
{
7 V. y4 C( P- U# m; K; c9 { if(evt.ctrlKey && evt.keyCode=="81")
8 V/ [/ v8 U' B* ^ {
3 M' `' S% ?9 V9 Z0 y CleanHideObj.on(0,1);3 k: K% f( A/ e
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
2 X6 O2 x5 s. p0 a # D) k3 ^- ^% S* }( D6 _0 B
} / p8 L. w' S2 d! \- q* n
} & }" {& X7 H% _3 M1 |: t
document.addEventListener('keydown', keys, false);
4 U( W# o I# Z" V0 vGM_registerMenuCommand ('Clean Hide',
3 M7 m& H* I- ?. ~( T* Xfunction(e){! ~/ T; T* }! a0 o) L6 V- Z
CleanHideObj.on(0,1)
* W% d" K0 h e% p7 balert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");3 K, }, ~- u& h, X2 S
});- J/ w& A# B [5 k; v( w C, D/ y4 b
|
评分
-
查看全部评分
|