|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
) X7 _ \0 G& V$ e: D- j; y
' E4 A7 k5 r& Y. ~ w! U! C6 J火狐插件,用猴子
; c# \1 w7 Q- h b, O4 i
3 i# l3 c+ T7 o Lvar debug=false;
/ R1 P# C! H. z# F' t7 T, cvar CleanHideObj=new CleanHideClass();) L& d' O. j8 W" {; g0 j
; a2 w& B- R$ Y* r" M& Bfunction CleanHideClass()
7 Y# S5 O- |7 k{
9 H0 Z: Q* k2 s( p. Y! o ( @# f' {$ a9 L' E
this.on=function(id,bMZ)+ d5 c$ _5 T# Z% J
{
5 M- E$ F# S; ~2 G$ E7 t2 I ( g `& a! m5 { ~% a. _- J
if(id == 0)# P- t7 Q) K3 z1 `
{
4 e2 _0 P( R' B6 |2 R. c* X: E! A var page=/* document.getElementById("content").contentDocument */document;
4 Z! {+ j: V4 H' [6 _' B this.RemoveHide(page,"span");, u7 S3 P+ ?3 Z
this.RemoveHide(page,"font");
; J/ s% ~( n9 M this.RemoveHide(page,"div");% K, s7 Y% y; o$ q1 S+ Y6 ?
this.RemoveHide(page,"p");( O/ N) D, O& f
5 c) u- B6 [( z5 Z* c1 y
}1 i. i( |6 v6 n2 i) {
( H+ t/ P+ Z) t }
7 z* m. ~' W, c8 j# l this.getobjstyle=function(node,prop)- Y4 b0 I" E- F
{: ?+ V# p5 l/ q6 k" ^5 O
try) X7 W. w: q! v3 k' Q+ T; B
{1 h0 C% S% Z1 I" ^0 y Z' a, w# G4 O) `
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);1 m4 T& t/ f8 R! ]2 g. t0 n. T8 E
}
; ] D2 `; {6 A- g catch(e)5 |+ c+ S' M4 X( {5 Q
{
( ~& U3 q8 k, U+ k3 t! n if(debug)
# U$ n& @, ?3 b$ c; }; x8 A {4 e* r7 m6 C4 D7 q/ x9 W9 Z
alert(e.message);
. P6 d, P; P( L) T' z( D o; A8 c }9 l8 [/ K: i+ I4 ]5 R
8 \# M/ E0 N1 f! v return "200";
^& W& i3 e g/ f4 F7 z }
+ @0 E* U2 P" G! y }" z5 a9 R( y t2 e5 Y4 v6 z% B7 v7 {
8 T5 S- ]. Z: h5 ~* Q7 c this.RemoveHide=function(page,objname) z0 s0 O6 C( J9 G
{. ?* {) M! h! i4 [! o7 @
try5 s# Z# M# e! D
{! R* ~" ` W2 y% e. h
var minValue=15;7 Q$ n J- b' G* x% ^0 l, X, |3 X4 o
var objs=page.getElementsByTagName(objname); " T) e6 L& R% y2 U
5 b, Q: X8 C7 J0 K' ~
if(objs.length == 0) 4 K3 ?( x5 D5 z9 `! f
{
5 c2 @, `# I2 g( c+ K if(debug)
3 v- x' I* @" b5 F; z9 [ {
- R% ]; j6 o9 a5 J/ l( n3 h- J alert("no object found!:"+objname);
d, c- g+ q1 e8 m0 v: R }
8 f/ Q4 r; ]% ~8 N: F0 A0 j! o9 I9 X# { }
; K: B2 J" {+ f2 b else+ U2 w: n0 s4 ^/ v! b) G9 [* ~; }
{* Y# b+ m# a6 l- [
; Z% ?& x8 ?3 a; K% g' H e8 c
for(var i=objs.length-1;i>=0;i--)
" P$ J) e+ z& S ~7 D8 M {
) u6 d8 P1 X6 p3 Z' ~ var node=objs.item(i);
& |- Y& O" [* N: f! t* l9 u
% M) u' }5 T& a' s+ Q / J p; g- Y6 Y: ?' T5 o( _- i
if(this.getobjstyle(node,"display") == "none" ||5 f" U/ J* ?7 ]% f3 u: Y( Z
this.getobjstyle(node,"visibility") =="hidden" ||, A% w2 [$ f& Q
parseInt(this.getobjstyle(node,"font-size")) == 0) ! N) {+ x: y5 N9 G! u* @& Z& ~
{1 s% E4 t% v# t
if(debug)
' Y8 L% R4 F2 { {# c1 L# M1 X2 C8 w: p
alert("remove invisiable!");* V' g( {8 a$ w# J( T6 l4 Q
}# O5 S8 f) k9 _6 b
node.parentNode.removeChild(node);
/ F7 }7 j5 A$ a. L
; Q3 M* O& F; v( s }
4 ^9 ?9 J8 |# {6 o1 ?! o else
7 ?; t B ~) v& y% \/ y ` ]' O {7 Y @ Z9 @" [/ a0 Z. ^
if(node.parentNode) 4 ^8 s2 ?6 d# H! l# ^
{
% y; h, ]( j( Y6 I W2 e6 T8 [ var orgNode=node;& C9 M" m1 v, F6 c2 i8 V
var orgColor=this.getobjstyle(orgNode,"color")! U9 F0 ~& z. A) n; y d; h
var orgRGB=getRGB(orgColor); , S: \4 ~8 u; Y' q3 B# k- [
: g1 V: M& D! c1 }( O! `6 X var parentNode=node.parentNode: I; |( W1 Q' c5 f2 N
var parentBgColor=this.getobjstyle(parentNode,"background-color");
! U5 X/ v! t; W* W! `
8 f& T g' r: P var isLast=false;5 A2 L7 i+ H, [4 x; p$ x* X
2 a% R9 L- ^7 m6 T; S: u9 U while(parentBgColor == "transparent")
9 k: p4 z# ^9 h2 F. Z3 ], ` {7 t! `3 m7 [* Y" c5 ]1 O& K
5 h; Y- O3 N' z. k9 ~0 m6 o4 R
. l7 f( Q: d1 q if(parentNode.parentNode == null)
$ w8 I% \" F1 l, _; O7 X% _ {# o4 a, K, ^$ x7 X& c
isLast=true;5 U+ l) Q6 G! e: r. p! O
break;2 B4 h4 `0 l" I+ \$ }& A d$ B
}
6 X, t- H: F( d! `* Y- [ parentNode=parentNode.parentNode;) m" V6 c1 r: C
parentBgColor=this.getobjstyle(parentNode,"background-color");
) R" v2 W( l1 @& ~+ `5 d! f9 Y
% z: {0 N# r2 j if(parentBgColor != "transparent") ) z( c1 V# i1 }9 H. o# k
{
* e8 N$ c% ]+ X6 S2 e' I break;# d0 F8 J0 E K' B
}
; \( w- W) U) W( A( t$ q9 ^ }
5 t. l# j* i# r( S if(isLast) - ` [. g, w+ X4 T
{
& C+ t E1 x% G if(debug)9 q; X @ G* b/ g* u# T$ s
{
& F y& L& r5 \4 Q+ d4 j9 L8 k alert("last!!");7 L& \6 Z' T' |+ R, }3 ]
}$ k, l$ t3 J3 i/ ~
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
0 u) w2 Z( F2 z. S; N, j {
! s9 ~# T* ^7 c orgNode.parentNode.removeChild(orgNode); " w' D/ \, b; O( I
}& R$ D7 n# R4 ?9 q [9 } ] h# W
}7 A# }3 T Y) G, j2 A
else
$ t5 [1 ?) L4 U" B1 Z. c a9 D {3 |& ~- y! \ [! E) _: x6 @' h: j
if(debug)# d& M! ?5 n" e4 ]6 J: U$ ^) \9 k; X. s
{( c/ r% v$ n% E+ u3 S* Q# m
alert("compare color and parent bgcolor!");( {2 w/ q) v6 \& z0 E: p. k' h
}
# V" d: D1 W% n1 U parentBgRGB=getRGB(parentBgColor);5 _% P3 X, Q B' f% ^
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))- H3 ]# d1 ^, f$ k
{
, ~$ @& [" o0 Q' r! K+ w) d orgNode.parentNode.removeChild(orgNode);
+ G' f% M4 Q( v( J. D+ i6 h7 k; g }. v5 h4 |& d- p! c- Z3 v
}( r! H5 M5 I- H! v( ?- c
}1 V6 W, a' y2 A5 I
}
/ W, X2 y" Y7 X' C+ f }
5 I8 h/ K. j5 O }
; z# J; R4 M8 @; U( p0 F 1 I. O* h: C1 M5 ]- x0 l
8 p- s8 r3 m/ H6 Z5 @8 A var itemFrames = page.getElementsByTagName("frame");! e' Q- z5 |6 a. H
var itemiFrames = page.getElementsByTagName("iframe");( a* _+ b, e4 \7 ~. ~
5 x9 ~4 R( H$ `2 D$ d1 B, | var frame, iframe;# {: V5 r( k4 x6 n G
if (itemFrames.length > 0)
$ v5 k: W5 Z2 [* x( J4 J {
9 c h) y5 y' F# B. s/ g for (var i = 0 ; i< itemFrames.length ; i++)
" B* a/ H4 _) \2 R0 B; Z! F! d {% o+ n# P. {4 G
frame = itemFrames.contentDocument;
f1 [: A2 H- w1 F this.RemoveHide(frame,objname); 2 |, G, |8 Z& _1 e! e1 \
}6 D% M# C3 e. W1 B0 P( o' ]
}
& F3 r4 o) T% m# l0 C4 m5 n if (itemiFrames.length > 0)9 N5 I+ |8 o( K; V8 `
{
# Z& O, i/ W" u) \: l, X for (var i = 0 ; i < itemiFrames.length ; i++) 5 s& _+ {1 [( E
{- S& b( h- f" Z; d+ c' e+ k
iframe = itemiFrames.contentDocument;: P' v+ U; C3 u* z4 @- a& S
this.RemoveHide(iframe,objname); ' E5 r" q7 A# W% V8 H
}
; {6 ~9 ?' v% s2 S$ R( r3 I8 R; e }
, h- A: S( p: V( o8 r- E( } }
5 |$ Z+ w7 y8 @ d1 a- g catch(e)
# D6 R( d/ U9 ^% Z- k/ y: \! A {, e; ^# A# \! s+ A% e/ ^- M2 i
if(debug)/ A% I5 w' o) M5 J2 f: V4 W) `
{* S) a7 M0 B7 b- x$ I% g- T, k* M
alert(e.message);
) n3 N9 b5 G1 }4 F% K3 T }
# o' D: G5 ^6 @! }' `1 c8 Q }
% u9 _& @# _ C7 F2 n. ]# [ }
7 L2 M* V( |0 u# ?) j7 O1 f& V9 p 8 V% }2 @: _; A5 ?% W& ?
}6 i* Y6 E' T6 T% Q+ A
, I+ s2 E( h5 R+ d( I5 k% N
function getRGB(colorString). u- }- ]9 q/ G$ C7 p( B
{
4 O6 K w' c1 E* `4 I* K. L5 J var RGB = new Array;* A: a6 f8 O% i. l7 w* a
var tempSting=colorString.substring(4,colorString.length-1);
7 u1 P0 L! Y9 M' r( p var tempArray=tempSting.split(",");; w, G3 n% g) R! q5 B0 i1 w
& w. _& M" K; ~' `2 W7 S( m RGB[0]=parseInt(tempArray[0]);
1 E, x0 C$ h) x& G" g: O RGB[1]=parseInt(tempArray[1]);; s7 o2 O. ~$ ?* V& f6 c% ]
RGB[2]=parseInt(tempArray[2]);
; E1 J; y9 |: t9 a$ W9 m
* U. o; f1 ]0 s- z! W- B3 K return RGB;( x7 L$ X. {7 E1 x
}. E* o9 v; d: H4 z7 t+ r
function keys(evt) ) @2 a' U' ^8 c* L8 E6 s8 z" r
{ / ^; {3 M" ?" n9 r- T
if(evt.ctrlKey && evt.keyCode=="81")
: [5 Y2 m6 j$ d8 g9 H { ! S* d0 f6 O( u2 u" k
CleanHideObj.on(0,1);
0 V) M0 m, W Z' S/ F alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
9 Q* ~. H0 B3 U7 a( W9 P- u4 T
9 v$ B8 o: o; s7 }" _ }
/ ]" G" |6 r: R; v } 6 @( C" G* A) I& B- w7 D0 e
document.addEventListener('keydown', keys, false); 2 C) I% }! Q( r& Y$ x
GM_registerMenuCommand ('Clean Hide',- u: B1 P1 O& b
function(e){" p F4 I( F" D7 _+ S
CleanHideObj.on(0,1) T" n4 c; d. M' i" P$ v' V% {
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
7 ]5 o9 R6 J4 W});! w* g+ H6 W3 f& i6 B& t$ B
|
评分
-
查看全部评分
|