|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
; s7 o5 Z6 l9 j# z( {( P0 [ P3 Q; s u) d, r. p% `8 d
火狐插件,用猴子% R* | Q1 H4 O- w8 K& m
; f5 s2 ?1 _( m
var debug=false;
& x$ f7 s- G* s% m& ivar CleanHideObj=new CleanHideClass();
0 X" q2 P# k3 _! | c7 \* \; g6 P. C8 v# _
function CleanHideClass()
* s# t+ m& W3 L6 a* J# v2 K% Z{
8 S7 u+ |3 I( g x# c$ a
. e( Z+ R9 Z1 X this.on=function(id,bMZ)0 n& S. r8 z: P* K- o
{% O. r$ ^0 w. `9 P
+ V- |+ u& X3 }' V: t if(id == 0): O4 c& b4 \/ I7 w
{6 n! m+ \( ~5 _
var page=/* document.getElementById("content").contentDocument */document; + c' C8 @' \) [
this.RemoveHide(page,"span");- `( S, y' U& m
this.RemoveHide(page,"font");6 I4 u& Z& `+ Z# g8 {1 ]
this.RemoveHide(page,"div");& m8 f% n0 m, H2 x5 y0 U
this.RemoveHide(page,"p");
) n% P) Z0 o! z
; Y. C+ w1 z+ S5 ?" M: s% @ u }
+ c. `$ @# S; i& E/ {: E4 M $ d! W- W# F! ?( c5 Z7 T* I# l
}! z/ q/ F3 I2 N6 ]
this.getobjstyle=function(node,prop)
7 V3 y6 u0 f/ ^) D6 @- |2 m% P {. ]6 w" K8 ?7 |9 O" h1 F3 G" I" e
try
! m4 @+ p, S( C) M {
2 u7 a" Q3 H# G9 l return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);3 _+ R4 N" ^4 e
}
5 k# U3 I0 R {! F2 r( B$ f catch(e)
0 p' G5 p# d; G) F0 {- I+ P0 Y {
% `- |( o9 o9 g8 K/ H, L% g% w if(debug). _, C. T+ O3 Z: W
{
; F: r6 q% x$ w, @ alert(e.message);
3 } X& Y9 t" |0 S2 C* E }7 K! q7 _. _2 t3 n7 W; h
. s1 \: b" Q( a% O+ U return "200"; F# m/ [# J8 T$ h% g
}
, ]# H/ y; f0 {; Q }% |: ~+ {1 N5 }7 z1 Q& }
- f6 H4 B0 Q1 e ?. K4 y* d+ I# i
this.RemoveHide=function(page,objname)6 s& Z# C1 G& G& l" u9 U* r# h
{$ S2 ?. n0 B0 E
try
' K, d% @. ^: T) @ {! V& \" a0 }! V! V
var minValue=15;
l% z( n1 A( D, E var objs=page.getElementsByTagName(objname); + L* t1 _' g/ q9 G. V, r
+ }, U- m% L4 _- m
if(objs.length == 0) ' Y+ x! ]6 V+ K. R7 L4 J
{
. v7 I' U$ X. H if(debug)
% j- p( u" y2 B! D {5 r4 x b# }9 h7 w1 a' Z
alert("no object found!:"+objname);
: @8 N- j2 J3 k. W/ @ ^1 ~, V }% T( x( n" {, a' c, E/ i
}
. a9 i3 W( g }' \! o+ @: X else- ~4 U% d8 z, B q1 u
{/ I) L9 u, {6 _; S9 W4 \
4 r' C+ t7 S/ h) w- ` for(var i=objs.length-1;i>=0;i--) 5 L+ B2 z' C, _7 f, s7 d+ y) q4 h
{9 @8 n. d( s; R7 T5 m
var node=objs.item(i); + G& h3 j+ E" v
2 X% G$ Z- h+ K! a6 P
' [- j4 N) {0 e% s$ I7 L5 c5 ?
if(this.getobjstyle(node,"display") == "none" ||
]- R" g( i4 l- U this.getobjstyle(node,"visibility") =="hidden" ||* `, m& p) c$ \6 M" b# ?7 o: ]# ]
parseInt(this.getobjstyle(node,"font-size")) == 0)
9 g& a2 h4 p" O+ K; F/ M {& [/ }3 i$ L4 ?: x% i
if(debug)" G: ~1 K3 I8 c5 T, I
{
, d! F) Q; i0 X1 e2 J/ s9 c- ~* Z alert("remove invisiable!");0 Z0 `7 i) `! J2 Q
}+ Y8 R1 H% t1 m1 R3 C
node.parentNode.removeChild(node);5 q+ y* r# q6 r5 ~- e4 X( p( c
& K& X: m) X' G1 h" `3 V* c8 U }" X8 `1 \( B1 @+ d* @# s, V
else
, o7 @. W& U9 }# D% s& ~- \0 G2 C {( r: S1 i( K1 w6 B; s. ~
if(node.parentNode) " H1 D8 \' B- _
{$ ]$ c1 ~4 E" j
var orgNode=node;
: O2 _& @3 y4 Z/ }0 K var orgColor=this.getobjstyle(orgNode,"color")4 _* B# z6 p! a6 |2 c
var orgRGB=getRGB(orgColor);
3 I% Y$ ]9 V6 ?0 R3 K% R
6 n" }; s# A1 Q3 w0 | var parentNode=node.parentNode
& o c# w0 G$ n4 S var parentBgColor=this.getobjstyle(parentNode,"background-color");4 `5 X3 b9 B6 f- E& C, \/ T' H. p8 K
! @) c. y6 q; K9 F" p6 v8 g b9 s7 `
var isLast=false;
. v3 E: z3 O5 T( t3 g0 I 6 d3 ?! n( Q* T4 w
while(parentBgColor == "transparent")
. f. R8 O( v/ ^& p( r {6 s8 j0 a* v$ ~$ V* ?
# J3 i4 g' x$ U2 b+ C! }+ j
4 z2 ^1 q. @& j. t% n7 ?
if(parentNode.parentNode == null). F$ j' e. Q( G
{
: H/ c$ |* i/ r6 O; |8 P' O isLast=true;
+ M' O: r+ f5 @- l5 L8 l4 A break;
0 o/ i8 T: |" u. g( D }8 G. I+ v" Z% i( T+ k* T, X8 A
parentNode=parentNode.parentNode;
9 N" _4 ?( D v* G! G$ e4 r& w parentBgColor=this.getobjstyle(parentNode,"background-color");
# s1 ]5 f3 w3 T4 D" s3 D1 y/ ~' U7 |1 i% ~6 u
if(parentBgColor != "transparent")
! E7 F* h' j1 u- r {( U1 Y# C6 o. S r# P$ {
break;
6 }' U: J/ a) V: u# q* q; c9 a+ N }
* |# h- o, v( q! T, {& p# U# S# ?7 d/ I& k }) o+ h5 W( c. H; j' U1 d& w
if(isLast) & W/ \ {' b" S& i. n2 {
{
7 e$ K! f$ j/ v9 K if(debug)
& R' G- u8 j( n' }+ w1 ~- a {
9 t0 p. D! e' \3 n4 a: m3 u7 J' p( W! z alert("last!!");
) m7 G7 o) I, g0 U/ m. R }/ M0 c. \1 g! `1 D0 W
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))& G5 p" J3 e3 C* J$ j1 i
{1 g' _8 o" ?1 z3 Q% \& _
orgNode.parentNode.removeChild(orgNode); ! ?; p8 L5 m8 t2 Z5 r" b
}
9 J2 y" _: ^. f4 S7 x: a }
/ I. w: z9 ^9 N8 g: }/ p8 | else/ M3 z2 Y! s7 \: @
{
5 \% M& Q3 v5 b0 v# s3 [9 m if(debug)0 u* V" F2 J/ B
{5 h, q7 L! s- R% y) D
alert("compare color and parent bgcolor!");
P3 n! ?3 n' t# F& m }- c4 u0 F4 B" Q0 t3 |1 R, o+ B c
parentBgRGB=getRGB(parentBgColor);7 y/ W" W5 ^' ~
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))2 l. X9 t' t: l9 \0 {- Z3 T
{8 @) T. E% Y0 Z% A5 E
orgNode.parentNode.removeChild(orgNode); + Y) @ U* M% l
}
8 k. ?3 n1 G9 N! U. f; A }
8 K1 W8 \% x& k8 ^+ _! p* t( p }' D% u, \6 G6 p+ q5 ]( O
}
: [: `5 e4 b! a% c+ n1 x. p }4 w" ?) ]2 n6 M. n( o
}
- P8 o* u: L; p: s ! H% D: a: C6 k' ~+ X% s
2 H! z& r7 w- L var itemFrames = page.getElementsByTagName("frame");( Z2 V' u. f1 k* Z
var itemiFrames = page.getElementsByTagName("iframe");8 D1 e( c w3 I8 a7 q; S
, z! R7 e2 o/ d; m var frame, iframe;7 H3 G" B+ J* x3 Y+ r3 ^4 g4 [9 t
if (itemFrames.length > 0)
9 `0 F# |/ `" V {7 y, U$ W9 G6 `# n1 B; M {
for (var i = 0 ; i< itemFrames.length ; i++)
1 L6 O2 {! H1 }* x {
# m& w+ S6 N+ _8 ]/ ` frame = itemFrames.contentDocument;, M- r& D6 R c
this.RemoveHide(frame,objname); ' S$ K+ K1 f1 c6 L) p
}
1 ^4 E5 A+ @( I, V5 N; A, W }; f. s) C+ O& [: ^0 t l) D! v
if (itemiFrames.length > 0)6 M: F$ m7 F: P# t+ h1 v& O
{
# d, a; k5 T) N& J: J for (var i = 0 ; i < itemiFrames.length ; i++)
3 T. ?2 P/ f+ ^ {7 |( K& m/ o8 M) q; F& M5 a& B1 c
iframe = itemiFrames.contentDocument;+ \2 A; u& c8 {9 }1 ?1 p( a
this.RemoveHide(iframe,objname); 1 U1 ?, L3 J( P3 _) [/ [& {
}+ n! H+ Y- x. t9 T7 o0 ~* s
}
5 L0 H+ V3 J8 Z6 S }
) ?. Q5 j# N8 m6 t. y0 h& W- O' i catch(e)1 u# \3 a; i! y9 c, S
{
& p# ?8 q- Q' c# _. D& o8 v if(debug)
3 B# C+ Q) w7 ~% D- ?0 A( k {
# |0 _' y' C1 [9 F alert(e.message);6 j6 O. O5 p% n, j7 ^) }3 j
}
" @9 Y" @. Z- W8 w# J2 j. ~: F4 J }. \- I. z2 d. l, |0 e; d' y8 d4 h0 P
}% `0 i. w1 M' G0 \8 s2 F2 ^( l K
. U. I7 t3 Y& b- H D* {
}, s% k) |; j) Y# Z9 u* ~. j& ?, K) Y
# h" p5 q! [5 W. X" Xfunction getRGB(colorString)& K8 {1 X2 x7 b6 u
{3 p5 y: |0 [6 j
var RGB = new Array;& b2 S+ @; ]9 l3 v" a! _
var tempSting=colorString.substring(4,colorString.length-1);
' s u' R: {/ G' e* d7 T; ]" J var tempArray=tempSting.split(",");- T5 g/ [) c* ~0 w& v5 v0 w
* n, n+ c; ~# \0 @( k T RGB[0]=parseInt(tempArray[0]);
9 D( b8 R! j9 [; T; y( |1 f: m RGB[1]=parseInt(tempArray[1]);8 g9 v0 d- J/ f: c) y) D
RGB[2]=parseInt(tempArray[2]);) x* E# ^% N" m% e0 d% c, a" k
2 n0 }' q" C6 z0 X7 `
return RGB;
9 o# @0 R" e" [* y; Q}
x |6 o7 y& O* a9 w1 Bfunction keys(evt)
4 t1 I3 G1 Y" J. E! a* q {
# k& P5 U6 l3 {/ Y/ p: e if(evt.ctrlKey && evt.keyCode=="81")
* d3 D3 O3 w1 `! ]+ Q" h0 a7 d3 {1 K { [% L, x' V2 }
CleanHideObj.on(0,1);* P+ Z! _5 x0 r5 z: m& T
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
! ^6 D% |' a9 i5 S' O
' \9 |4 m+ G3 a R2 r% G( y }
: b. c4 V' g' b% j% s } * ?. X" o" \5 V, L3 e3 |) ^& r
document.addEventListener('keydown', keys, false); 9 n& S! m/ n8 t! I7 [( I9 ~) G
GM_registerMenuCommand ('Clean Hide',
4 ^# V2 U4 C3 \% C3 F; L* J& K' Xfunction(e){) U" I; @- s7 J
CleanHideObj.on(0,1)
9 x3 a3 w+ [" s4 ~5 E! Z. v/ ialert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
) Y# w: p' E5 Z! |' n});
/ j: i7 y4 R! H9 k w3 H' c |
评分
-
查看全部评分
|