|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
4 u4 W5 z* N0 x+ k" o0 v" h, O/ p# O
火狐插件,用猴子
" y, F) M3 ]7 E; ~, @9 t6 ]8 H
! Z3 D. `9 W% _* W4 c0 p' @var debug=false;
- k& t. `: u5 S1 {. K3 yvar CleanHideObj=new CleanHideClass();
t/ f0 k2 p0 T. ]+ B+ b8 `$ R2 ?0 X
function CleanHideClass() " ?: P; `" J) f& n# j- i
{
! Z# g% j) q8 c- S ; z0 e5 U5 e: w+ m) W3 Q
this.on=function(id,bMZ)! y! u+ e' d7 Z* P& `7 F" D( v" C
{, x+ |8 R7 K4 i S" M
( `8 K' ^( g# J$ ?2 D, ^' l if(id == 0)
% B$ t2 c' X4 \1 {3 m {4 E0 r8 u7 `: w3 c
var page=/* document.getElementById("content").contentDocument */document;
3 c$ l3 X* Y f1 _ this.RemoveHide(page,"span");5 i* ~4 }0 M1 x2 u. N5 s9 J& ^
this.RemoveHide(page,"font");
; a" w$ \5 b( P7 O7 D' u this.RemoveHide(page,"div");2 v" [' s; r' i) q/ w
this.RemoveHide(page,"p");
& ^6 _* q& U1 t: m* Y$ s
5 Y+ y! ]4 a" T5 Z! Q }
+ m2 }( \' g* \2 y2 m6 `- ^ 2 S0 ?1 U* X1 |
}; Q! H9 g4 j8 Y* z; f3 Q- r
this.getobjstyle=function(node,prop)9 a# ^& B4 @& T
{# X; k- M" z2 ^7 G3 x+ e
try1 M* t- H1 J& C2 Z0 @
{% P B3 j$ q5 C
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
& j% }1 h4 }& i }
3 A* ~0 O" V1 r) } catch(e)5 G+ Y9 j% j: W0 _$ I
{+ h$ D% X0 P$ s6 e3 C* t
if(debug)3 L& R4 ~6 M6 L8 g; |' F
{9 [$ B0 ~1 U* r; M9 E3 @
alert(e.message);4 U8 b0 ~! U o3 }: \, o3 \6 Q
}
: Y* S. {3 E1 J
. A2 h0 ?. O5 I) O$ K: I" ? return "200";
8 n, q- b) E5 ?7 s/ m }5 e3 n8 c* D6 M( y
}
9 d8 ^0 q" u& t; B& U
6 i9 \1 j* g. M% g this.RemoveHide=function(page,objname)
9 y$ ]1 s) F$ u a. o* H3 } {
* D- s$ @, r6 ~# p try+ y, ]3 U- S6 ?0 u
{) q0 A; K; U/ n9 q6 m
var minValue=15;( i' K. L5 L* P4 _$ n2 x/ q
var objs=page.getElementsByTagName(objname);
2 m0 u6 g, b' d- i* w2 f+ x+ V! r8 S
if(objs.length == 0)
/ q c( C7 c0 c, P+ ? {
& r3 l5 U! U8 U+ r z if(debug)6 E4 s% D; {0 x$ I
{1 d7 R2 \1 ?8 H1 o
alert("no object found!:"+objname);
$ q. }9 \& i8 C" I! J }
& y1 `1 e5 o4 v0 ? }: M' }# ]7 ^( L
else2 e6 e. Y! G: G X/ c0 u* _
{
+ b9 G# \5 k- o7 q4 T6 U ! o k" m' ^ M5 Z
for(var i=objs.length-1;i>=0;i--)
) t- k9 }, T- @/ d3 K: O+ R {
( T& d* ? O' j/ \* y var node=objs.item(i); $ I1 w' ^* W( a4 y- f3 p! V! v( m
# W- V& \& w* _
' ]8 r* U O8 L: E. w
if(this.getobjstyle(node,"display") == "none" ||! M5 h/ d4 }6 T5 u( M" x6 W) t: J
this.getobjstyle(node,"visibility") =="hidden" ||
5 X% H5 ^7 S" X5 ^- _# w0 m$ W parseInt(this.getobjstyle(node,"font-size")) == 0) 2 p" z* C0 g# o2 i' i# k& v3 j7 K* l0 V1 T
{, D$ L* Q6 d, u# a
if(debug)$ h3 i8 l3 t* T: M. t P, G. s
{
& R! Y( V1 g* u9 H. p alert("remove invisiable!");
h: {* d* W( C2 E6 x& U }
/ u2 p7 s+ q5 t4 l! g2 W node.parentNode.removeChild(node);
* A2 U& }3 l3 J7 `
5 P# ]. d: S7 {; V3 `1 v }
! C5 l6 j1 T/ q, ?$ B else G3 u9 M6 h+ c& Y: E ]3 E" \
{7 q% `# h; ]5 l5 Y
if(node.parentNode) 2 O5 d! R0 O$ k! D! P# m" x, E) o
{0 q( o' Q- }. j
var orgNode=node;
5 V5 H# a& `, h* I' z0 a9 a var orgColor=this.getobjstyle(orgNode,"color")
0 I. M+ V* H* _$ q% }1 D! K var orgRGB=getRGB(orgColor); 3 ?6 D& n" f1 ?0 D* |6 k) k D, ~
! D) ?+ ?& M( t! y% v, l% O
var parentNode=node.parentNode# F, [+ p5 `. G6 P9 t/ K. \7 f
var parentBgColor=this.getobjstyle(parentNode,"background-color");' ^+ c3 ^5 W2 b, D- i/ s" c
, J5 U, I! k1 R7 |# H8 z var isLast=false;! l- @* `, A) E. R8 W# n& |
8 \( k* O6 d) |9 U7 U
while(parentBgColor == "transparent")
+ K g9 d0 U3 k5 j% U9 V1 `0 b { b) ` ?* c0 Z6 p! q) t/ Y
. C& h, `& `" y+ i j3 E( Z" U. ~ : `% l. J4 `- B \! m/ Z( M
if(parentNode.parentNode == null)) U; ~7 I1 n0 { h+ Q7 V* B2 K
{7 ]1 G7 N" B0 O: i
isLast=true;
5 ?' l; I! L; j# g8 y break;* s" T" u0 }5 o* t# M
}5 O' J. w( A+ k& |4 w: ]. D
parentNode=parentNode.parentNode;) q/ M% ^6 d4 m0 @1 j) O y; V# ~
parentBgColor=this.getobjstyle(parentNode,"background-color");" k% ]5 g9 _# O
/ M7 O: ]# {* a; a" r if(parentBgColor != "transparent") . H" F0 E$ o" A6 S+ n
{5 |% V w1 U) Q* J7 |, `3 _
break;1 ]: }/ N% j( ?) u$ b
}
6 f" U& R; R$ V; S, K }2 P( a! @1 z7 l
if(isLast) 4 ^/ w6 f0 L, y7 Y% t8 i. x
{: s s4 r& x+ E8 U& E% I
if(debug)
: p% U9 y* x8 q3 H2 g {
- ?( H" t: G8 I9 r# j; n7 a alert("last!!");
) n4 a. f4 o+ V/ M7 Z3 R }
8 @- m# d# c3 t# w if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))! u* |3 k! Y9 h% k
{
) g5 m% k' I9 S* L; v. p orgNode.parentNode.removeChild(orgNode);
: N( o1 {* ]$ @6 E0 k4 L7 z }
% v& g9 T9 [. G4 \0 g4 A2 b }
- q! L/ t( b5 V; c8 Y- G else
$ E0 y6 w; n$ W, k( i2 r0 i {
# o/ R/ b) V3 }2 _/ B$ s if(debug); Q! v/ D3 J* A6 x% N/ v
{- |: C$ p+ z6 j# y T9 _% ?8 H9 n4 U6 ]
alert("compare color and parent bgcolor!");
2 k& J7 Q. F5 Q# d- X _ }# M1 R) r7 h0 W) Y% m" \- |% w
parentBgRGB=getRGB(parentBgColor);
+ s8 D, ]8 n! H- \ if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue)); N. H( v s9 x- t
{& n \! e& o/ z
orgNode.parentNode.removeChild(orgNode);
+ M/ w% L7 n) [3 ~4 h0 Y }, u$ [2 D8 ]3 u+ U
}+ |* I7 w; @! { |
}8 Z) o6 `) ]3 ^% y. q% q F0 N
}
" q0 A% w8 \& g" W! d# L }' D, ~3 h1 A3 J9 Q; {0 \/ D& S* i: S
}/ I8 |* L3 f: S4 R2 W) u& B
9 Y" `! Y% @- Z! w* i
* i, P. @& Q4 f- f% B' C var itemFrames = page.getElementsByTagName("frame");
/ b+ X; c9 ]; v7 n( w var itemiFrames = page.getElementsByTagName("iframe");: [0 g4 t2 `1 I8 _
6 Q) g' B0 R9 Y; J! d) v
var frame, iframe;- V$ g2 M1 y% r( [ q
if (itemFrames.length > 0)
6 l$ s' l! F& h E2 M. Y' o {/ f2 u% \0 b- d$ b9 r* Y& y
for (var i = 0 ; i< itemFrames.length ; i++)
6 h# v9 K- o, t( { s0 c0 f# Y0 ?7 I( b {" A# q. R, L' o# B
frame = itemFrames.contentDocument;
% e; |9 {! U# { this.RemoveHide(frame,objname);
4 i8 ^4 {; c: }4 i3 G }
, p0 k, G4 _/ L8 e% q& _ }
) |) L j+ W9 ]3 \, O8 h if (itemiFrames.length > 0)
! j( L$ F% v2 Z* r+ [6 C7 ? {2 l" H% @% k+ c! U$ e
for (var i = 0 ; i < itemiFrames.length ; i++)
8 U# K+ {) D% W { s2 R- V& n) U9 u
iframe = itemiFrames.contentDocument;
K* ?3 h+ ?: ^$ } this.RemoveHide(iframe,objname); , Y" `( h+ g8 n4 c" u" P k
}) |+ ^0 f. W _5 t7 V1 {$ K$ f
}; h" S2 x$ ^9 }+ N
}% y+ [; w/ J% F0 s" K1 }
catch(e)
3 q' G Y( v$ g {
9 y* j% k2 u6 e& D8 i& N if(debug)
: f" t& a% L. \- Q0 Y9 o f/ p {) t. |( m2 N, Q: ]
alert(e.message);
& H K# s' h) @7 z/ {% }* }; T }* Q# d5 }8 t* p; q
}
* F" P5 `1 X0 a1 {8 H8 { }; x' a5 X0 h2 l
- }+ F' P, ~2 v8 y8 t
}
, M) ~9 I b9 V
2 Z* M B% O* u3 ] Qfunction getRGB(colorString)
7 p) K0 H) {, M{. L) |- y+ [- j0 \: ~
var RGB = new Array;
3 V# J+ j# J/ p- M1 s! l" r var tempSting=colorString.substring(4,colorString.length-1);
! k8 \4 J3 w3 O- u2 ?. O X1 g& O, t var tempArray=tempSting.split(","); v$ {* L& u- z( V) N9 k7 n/ v" x
' {% Y4 c3 o1 R7 n% A: [
RGB[0]=parseInt(tempArray[0]);# X2 }. ~: ?2 i; W! x, B
RGB[1]=parseInt(tempArray[1]);4 _! f* o1 t0 z6 p4 k* j7 Z
RGB[2]=parseInt(tempArray[2]);* H" z( J; c/ T$ F3 k& ?
4 d5 c0 |6 O1 a, P- p return RGB;4 a# Q, I( v: g3 `$ r1 s) \/ V$ Y$ U6 }
}
# r% {! `9 y5 x9 vfunction keys(evt)
9 g0 e. g2 n5 {- S. n { 3 B+ c, V, I& R3 }3 ^' f% w
if(evt.ctrlKey && evt.keyCode=="81")
p+ I, k) Q( [ {
1 V1 L0 Z3 X. F8 R) N; D% y! p CleanHideObj.on(0,1);
9 K4 Z9 J& v$ P1 Z* n4 r& i. \; T7 N alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); , e9 v8 O# Q* \7 l
& o8 d* M3 w2 Y( Z O8 j$ a7 @4 K
} / F6 ?: G( k. Z
} & b! X. X. M; n. e4 W% `, I2 a
document.addEventListener('keydown', keys, false); 4 c4 E9 N8 q% K$ l# T- M
GM_registerMenuCommand ('Clean Hide',2 ~" a b: l7 r
function(e){! A" u& A( \% y9 d
CleanHideObj.on(0,1)
3 ^: L* e/ h. a3 A0 E6 {alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
; j3 K- P* v" N6 m. E$ S9 I1 Z});
/ ]: O) u& @. D {' U |
评分
-
查看全部评分
|