|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
8 J2 M4 \/ `/ M% D, ?+ f* O+ x
2 O4 r# p6 c; T火狐插件,用猴子
) |& A% O( h+ B6 O) J9 C
5 s& D- d; G1 a6 H8 @2 wvar debug=false; ( @2 c, t& b0 A! o
var CleanHideObj=new CleanHideClass();4 g8 n' C3 U- v2 K; v
& A! H4 r# Y& t( h# C, qfunction CleanHideClass()
4 x" r5 s) m( V2 ?4 F{
. D. d/ [) u( ~+ g/ b+ ] & K+ r- A- U0 a
this.on=function(id,bMZ)
2 j' f/ R- `. w# {7 M; T {
# N) M, x1 {9 L- c/ R/ W
. h0 D/ D; a" l- y; w if(id == 0)
: z+ q# U/ i5 Z {
0 X8 F- ^9 w, a$ ? var page=/* document.getElementById("content").contentDocument */document; ( O2 @1 M$ S8 O9 {7 w3 @0 c
this.RemoveHide(page,"span");
, X9 {2 \) w( N* w5 }4 v this.RemoveHide(page,"font"); ?5 Y3 D! y6 F' p
this.RemoveHide(page,"div");
, k% P# p) a* O7 z this.RemoveHide(page,"p");& X2 r- \* [; G& P0 S
" b5 o" B1 v0 ]6 |
}. Y0 d. M" ~: |% _( M
# Y7 d3 Z' e/ a$ W' N! m
}( d. M) U3 N; k
this.getobjstyle=function(node,prop)
0 _& a; v! e$ R: c4 U- q {6 S8 x* u% W* ~1 y( ^
try
8 l6 E/ @* M2 N m) p {
* q0 M# ?& J( }" { return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);, L% }; P) R% A i; E
}
" a7 U# }' ] g; I catch(e)
+ ^ b" P) ]& ] [ {7 L8 ]/ v& M9 e4 ^2 b
if(debug)4 O- m8 g+ f w, |# a7 G- [0 e
{
- w% k) f9 X- @8 m7 [* f' T* t alert(e.message);
5 x: i1 P7 u! r- d# r( m }1 E" }. W' |8 {) e& k
' _! O$ l) W6 p4 W7 r u7 M6 y return "200";3 Z3 |% T- W/ \) k* K
}5 Z! B6 R7 M0 [ n6 u. ^
}
3 U; g5 B! c; q" ^- s) |; \ ! |% D/ q6 W" [
this.RemoveHide=function(page,objname)" T, o& R9 r; @+ M% p x: u
{
3 X3 y' i: e( g7 G9 }( ^ `% r try
% }: C7 o, ^% a/ v0 n {, r9 t7 \3 q' I* B/ z; ^
var minValue=15;, ?* R Q& B/ ^ x, w$ S* t6 L* ]( a
var objs=page.getElementsByTagName(objname);
1 E3 _7 Q( e6 o, c8 |0 u2 [& Z: I! v" T
if(objs.length == 0)
( y# |7 m. k1 x$ M, Y {
) C* ?8 D- [/ i( M3 d" w2 E if(debug)
5 R& n. \/ x* H' | {2 y$ K; G! ]# b4 i9 K
alert("no object found!:"+objname);$ z! t. y( [9 K- I3 m% G
}
$ L3 Q& _6 G8 q& P# q& l1 z. ^ }
2 v3 `9 D( n% O* G. x else: d* z$ o( ]) `5 j; X
{, c; F% f1 w! ?% K) \
4 C, F' H t2 e; b for(var i=objs.length-1;i>=0;i--)
5 U; z b* g) {$ I {
7 d0 k T9 ~0 t' R: k1 o& j1 O: O+ _ var node=objs.item(i); , ? p- B( }" Z- B$ N
+ m1 I: D* Q! H' J- y" v
2 d8 H' J Q% _' |1 [2 e if(this.getobjstyle(node,"display") == "none" || \5 {; I R/ @$ t
this.getobjstyle(node,"visibility") =="hidden" ||( t' c3 K9 h0 u* V) @8 F5 C- G" I# O
parseInt(this.getobjstyle(node,"font-size")) == 0)
6 n2 O1 v8 C# U9 l( Z {
: Q) I4 ~- \, D' C% [" X- @! v0 l if(debug)4 P( C% _/ n+ a' T
{
4 Z0 `- `9 J1 h! Z8 U2 l; H. A9 t alert("remove invisiable!");
& z, N/ V7 Z4 a& F } w& ~0 {8 N3 {5 r8 o" p
node.parentNode.removeChild(node);. K" g8 W, R' n" N
3 K5 i% ^; e- }. s5 c& i8 _ }
- U# X+ c. ^4 [' o3 h; b. l else + a! i: R5 x; J" p% P% _0 h* w
{
- j$ C3 ~+ ^* ^: Q/ C" M7 h3 @: j: i if(node.parentNode)
; u1 _2 ]+ ^3 }/ i% _) a {
7 Y7 a/ \: c7 t6 H8 y0 Z5 n var orgNode=node;
% V$ g" v* m$ `- ^0 h- u. G var orgColor=this.getobjstyle(orgNode,"color")
/ v6 P1 d- o8 t. F0 [ var orgRGB=getRGB(orgColor);
7 I2 i* `' [8 Y3 c D4 q $ ?# X0 { [3 o$ |- A
var parentNode=node.parentNode6 V; U6 p/ q {; u& z. O2 \/ P7 M
var parentBgColor=this.getobjstyle(parentNode,"background-color");$ T! k! G, Y$ ^/ E ~
" {0 p2 m; p, }) c/ T: H* g; |: J
var isLast=false;& Q8 A" h5 A; X7 |( ]
. `9 ]7 _( a) w2 b4 h+ c7 E# y while(parentBgColor == "transparent") 5 u+ t5 L: J# B6 y* X' x
{& _& x, k+ L0 @- Y7 v$ s* P3 _
: j% _* `* O. G/ o , l' i- ]6 O( U6 [/ x1 I% O/ { Y
if(parentNode.parentNode == null)) ^4 v7 B2 y3 e: `( J w
{+ E8 t2 ^# H; [$ l0 T
isLast=true;) f- r+ H1 r/ h' K* A; v
break;( Z1 D! W& B( C$ D
}
- c+ T+ T. x; E, y parentNode=parentNode.parentNode;
1 X8 ?3 z/ j5 z4 z) q parentBgColor=this.getobjstyle(parentNode,"background-color");3 G( R" b" r+ u+ J. z* D) x+ g8 T7 c# ^) q
3 }0 K' b$ w( }9 B- p if(parentBgColor != "transparent") - _- H3 t1 e. S/ M! E$ l5 ?
{! D7 y5 T$ Y3 R% }/ [' g4 z
break;; N6 M! }3 c2 Q" j7 |. r
}
: l" X3 g% }6 v* `& e: w, i2 ^ }! N2 h7 {! c9 X
if(isLast)
) e; u2 {- i+ w/ T- g3 m. z {' i' S7 A, i! ^# ?7 r3 h
if(debug)
1 \- w; R! C7 _" V D. Q {: Z7 K0 [! j+ w; p5 T# L
alert("last!!");: j2 m0 G/ ]9 _! z9 ]
}
* e( |; B# n4 A* w* ^& j if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
) t! u' R2 ?' O4 L {- V; o$ m+ j% s8 x( x; B& ?( q3 B8 }
orgNode.parentNode.removeChild(orgNode);
$ p- [% ?5 @ w8 z }
. O# J6 B+ s% O1 w3 e' `9 t5 z. C }
, k$ _( y5 K# o# j& u6 V else
% n$ v6 v& g4 a8 ~% I {% a2 n7 I1 y6 [) k( ]; I
if(debug)5 E. H6 N$ g5 m- S& l
{
4 b, Y V& G* \ alert("compare color and parent bgcolor!");
% \1 h, E1 R' w+ Z' {* X. s$ @9 O, U }
7 B& n6 {/ |" |9 k8 _( `) f parentBgRGB=getRGB(parentBgColor);
9 F) X) ^) }+ n6 e! q& H if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
5 G5 {' r, Q" x! X {! P$ m/ i; I6 D
orgNode.parentNode.removeChild(orgNode);
7 d! v. h) U* D$ Q' A) G }) p0 \+ g. v) g
}
8 a7 ~! t& E/ s5 `+ D: C/ o2 H1 y& E }) U2 C' d. i' T8 c
}9 S1 t6 R T+ h n5 t% s3 j+ l3 V) P9 O
}) ^$ d6 x$ v. h% ~6 {3 \! r; w" ]
}
' a+ t1 @8 U; ?
$ b( h) S) @: h; m3 u& e% A, E ! m. `% y$ r2 g) @ V
var itemFrames = page.getElementsByTagName("frame");
3 F" Y, m, @; i5 O9 w var itemiFrames = page.getElementsByTagName("iframe");
$ P: l6 F; s/ u' a
2 c2 U* w0 A' R, m7 `% S# g var frame, iframe;* Y- C" w9 R4 N7 b ~+ w, y! u
if (itemFrames.length > 0)
) | w9 e& _7 A4 ] {: ^2 ]% f4 r; ]$ \2 G0 K
for (var i = 0 ; i< itemFrames.length ; i++)
% U. l. K4 Y. @- P: K' ` {
- z& x5 K$ v/ j4 p0 G6 F frame = itemFrames.contentDocument;2 i5 {1 h3 @3 ?7 C1 ]! q: w7 b
this.RemoveHide(frame,objname);
* C& |3 u4 Y. P! _! [1 c }' w l& f* L: V4 W' C: O Z( ^0 M
}
$ D- F$ ?* n J' w, B if (itemiFrames.length > 0). T$ |, `+ Y$ b# o
{7 [" S* t) z) ?3 @( G
for (var i = 0 ; i < itemiFrames.length ; i++)
. q7 q8 K$ I3 j% D) Q1 }+ s {
' w' x. K1 j: e- E7 a" x2 M iframe = itemiFrames.contentDocument;
0 q ^7 P+ Y# w0 h6 U" |- K this.RemoveHide(iframe,objname); 4 d9 }% _+ P) y
} U/ c: g% U9 |$ R. t; Q$ L
} V: ~8 C$ Y" X5 D0 W: }
}( j) E z+ E {1 I1 U
catch(e)
9 P) K2 e, Y |, R { m; o6 A: Z0 e* Y
if(debug)2 U" }2 P# h! r
{" X' u: G j6 |5 A5 o7 T
alert(e.message);
! k1 N7 b! L, a- S }
% Z, @7 k$ I2 K4 B }
4 ^0 _- N% D T0 D# K0 _ }
+ F& _9 p5 o2 O, ^ : G& K4 Z# t6 E, x* b% \/ D
}; K" d- @ p. n# i0 }% d
- x: M- y2 ?3 C
function getRGB(colorString)* C( F4 M$ e/ K+ v' S
{
3 _2 ^2 T4 R4 a( s/ w, R& X/ D var RGB = new Array;
4 l" X7 L9 f. q7 ~! H3 M$ @8 P, S& n var tempSting=colorString.substring(4,colorString.length-1);( s0 I# C: H, }$ m
var tempArray=tempSting.split(",");
- z# ]; i( { y E2 ^8 R9 p
, x7 r1 E0 `' ^7 a9 j7 I+ {% { RGB[0]=parseInt(tempArray[0]);
# T: h$ U, B6 H+ G RGB[1]=parseInt(tempArray[1]);
6 H; a! r1 Z y# q1 V+ h RGB[2]=parseInt(tempArray[2]);
; k$ t; [3 @/ R3 i$ o/ C 1 d8 f! ^0 r, o' C0 [
return RGB;
0 |3 {7 w5 ]: D, Y: C0 c3 X}
) [, j$ r- M, A0 R* `function keys(evt) / i+ L7 Z1 @1 ]1 N" [* Y
{ ; Z+ p4 i& L/ N7 h' R# o) i
if(evt.ctrlKey && evt.keyCode=="81") 6 I) P$ O; N; {4 Z
{ 8 @# L4 x0 j3 e: ^$ Z" I$ a
CleanHideObj.on(0,1);6 I. [7 H) T8 F* y/ S C8 e
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); 8 E* j& K9 y- z
# K d; f! M# F
} ( R8 u( a; ?# r/ g, j
} ' W$ ]0 s- N$ J
document.addEventListener('keydown', keys, false);
$ ?5 l. Z* k. z9 S: M) P3 p4 sGM_registerMenuCommand ('Clean Hide',
. R$ X6 D$ c- f5 P& tfunction(e){
/ [( G& }! V8 N eCleanHideObj.on(0,1)
7 K& d1 p# U8 `) |! l" ]alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
& Z- m8 p; A1 H# A! S0 p9 s9 S});1 \% \4 ]7 w" O1 H, E3 V/ x
|
评分
-
查看全部评分
|