|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 3 e+ k9 R/ d2 U! [+ q2 S" w/ V
9 R/ d5 j( z7 v7 }8 u, E6 f$ u3 y火狐插件,用猴子0 l! a, h. Z1 h- L9 L k- U) q
N# U' }1 e$ }, b7 j5 u3 T* ?. c
var debug=false;
1 ^ L. `6 M! ` |8 C# Wvar CleanHideObj=new CleanHideClass();0 q3 \# Z4 N% [. G. X- U# Y. v
2 V7 T& X' u, F; _1 }) m+ R! S4 Bfunction CleanHideClass()
/ C" k! [2 p$ w @5 V9 A{
9 G# ^$ _# y! C K& V- ^ # D$ v6 Q- `6 x3 z1 R6 W. {* }
this.on=function(id,bMZ)
# @) R3 Q7 X$ P6 e2 @0 a {! U2 P6 T1 h( C$ @) Q z
& o3 I( s6 F" d
if(id == 0)
% @/ {9 G( g! P$ }6 w) d6 ` {( `/ J4 Q5 k, a' T$ u
var page=/* document.getElementById("content").contentDocument */document;
9 Y" X& `$ U; } this.RemoveHide(page,"span");! r" n) l, M. M, [1 Q }+ K
this.RemoveHide(page,"font");
/ Q, F8 I6 n8 L this.RemoveHide(page,"div");+ J) a" P- V. D( u( @
this.RemoveHide(page,"p");
* U" k4 Q4 X, l0 f
, o* g, |9 F0 x0 C }
# ^$ h S j. h/ A. T+ l' O [ ) k) X' m2 k# I; \- @* J4 G+ H+ ]
}# `( c0 F+ l& N5 Y1 W! M
this.getobjstyle=function(node,prop); U4 s1 Q' A& _$ C$ p# ?
{
. v6 @7 x( k# I9 V0 P) L% V" N try) j. U: T4 d$ Q8 O
{
7 A/ Q9 V) z8 R! m* K" P return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
w- f. U0 M% J6 X% c1 X }
: }+ s* Z; A# }) C3 E3 l catch(e)
: E8 f$ M( L' `9 o {
# [- V' K$ h$ n) `$ e+ |; l: [. ] if(debug)% q J2 f2 g( C n- D( J
{' Z ]) t, p2 B! ~
alert(e.message);
. x: D( d: X( E; U) S1 o }4 V* U+ o( N7 A: E0 a
* F3 C( }9 u9 F9 G
return "200";5 @( k' e0 T2 _$ H! { B
}
, W& T: k( |+ c }' g& s) z; F$ D- F8 |& z( z" Y- V
" ]: @: m2 Z: z& Q- O
this.RemoveHide=function(page,objname)
' e X( P4 c. t5 j x {
5 X! L4 t8 q. _" {' S0 y try. x4 _. J& M. I3 {5 [, ?7 B" Q
{
" Q; O+ O# t( T5 ]7 }$ ~( } var minValue=15;
: ]: v* ?0 | c; H( Z# g var objs=page.getElementsByTagName(objname); : ?3 f! P+ H; k
" s7 c+ |/ w o% [' f# c. { if(objs.length == 0)
$ h' F: t8 h# n2 k {- w+ T) l1 v* X' u7 S: K
if(debug)
' L3 R) u3 K6 l: e" e$ O! ~ {! V' H1 {5 h3 ]1 a
alert("no object found!:"+objname);
! g$ B' x; k% U7 f+ {* T: q% O }
) s8 @& N- L6 M }6 L' L9 c) G. C* k$ y" _* ?
else1 S/ `0 q6 i2 b: Q" ]3 i% f2 A8 m
{/ I/ d! C1 C! ~9 z2 V9 I/ R
3 x0 M3 z, [/ q- E. u& M
for(var i=objs.length-1;i>=0;i--) 3 J- S# e7 n8 s7 [6 f7 J' T
{
% w5 l, e8 s2 C/ U: K: b- Y var node=objs.item(i);
# B$ G- T& Y9 i- M
8 U6 F! p+ t* f- F( v
; ^( [. |/ ?+ w7 K1 J9 O, G) E if(this.getobjstyle(node,"display") == "none" ||
# c: ?3 h5 v! ?8 E: u: p this.getobjstyle(node,"visibility") =="hidden" ||
" @5 k& K! S8 n8 z4 ^: U1 V4 M parseInt(this.getobjstyle(node,"font-size")) == 0) , H7 Z8 g; ?) _& p3 `4 c
{
) H9 H* |3 L1 c; i# B if(debug)
! I/ k5 {+ E4 r {
. V# f( h) r5 h) H3 B alert("remove invisiable!");+ C, Y) P& j/ V3 @/ s, E
}+ W6 g1 \$ @1 j# |. ?9 N5 v
node.parentNode.removeChild(node);
0 A, v" }( P G5 w
: Q- B; o8 t5 K+ ?6 M) Z1 a }
/ x7 F' A$ w9 O% U% n* }/ x! l else
4 ~$ G' m2 R. @# ?2 l S {
3 h: A7 D2 b4 m3 I if(node.parentNode) - W% |1 B5 I4 \/ S9 [5 m
{4 X$ d+ f: s+ ?2 M
var orgNode=node;
1 d* F; _3 W: k5 V( V var orgColor=this.getobjstyle(orgNode,"color")
; U; D; p6 J* K( W* z- L: Y var orgRGB=getRGB(orgColor);
9 Q0 e. H2 @/ i& @2 g
; P( R7 x0 ~/ P0 Y" D s; H var parentNode=node.parentNode
) G0 H6 v- G1 z0 P5 W) s var parentBgColor=this.getobjstyle(parentNode,"background-color");
* ~( D' J7 G+ `* { 6 H$ |9 B% r. T( b7 ]2 C7 ^
var isLast=false;# y9 R. K) }1 n5 J, t
; M4 p( e/ z7 m+ Z1 W) j( }% r while(parentBgColor == "transparent")
8 n5 q6 d( S' ]8 c {4 u* ~6 Z8 G! Y9 V& G$ S
( \$ ?) G+ I2 A. e, K- ~* o- `
5 @6 P$ m! ~. I& P if(parentNode.parentNode == null)
B; p/ V' W. S+ @8 Z, V" N {: Z6 B6 A( e5 M) F! N! j5 z
isLast=true;
7 O! ]. W" q4 l+ S( V1 H: H% Y break;/ b6 R3 v( @1 T9 j( P
}$ Q1 u( ?2 ~: J; I+ J; |, y
parentNode=parentNode.parentNode;
: Y, {7 v1 ~# X1 o2 O7 q parentBgColor=this.getobjstyle(parentNode,"background-color");
D/ k: Y; d) s2 s# [: G* x8 J2 [4 _. ~7 d8 \0 j% k* L2 B' `$ x0 L( K
if(parentBgColor != "transparent")
2 U1 ?; r/ N* y/ M$ m/ f+ n9 S {
0 j" O8 J4 x( E( p5 |2 v5 o break;
0 z$ o+ o$ T; d( w5 { }. |2 d3 q( |- F) u$ x- R
}' T3 K6 l# Y" p
if(isLast) . _$ G; a* S2 O/ h2 h9 L
{
2 E* l% O, K6 g3 q: } if(debug)+ b6 L! y/ P- E! E" Z! s$ z0 a' ]
{7 W! U4 [. _* Y& G
alert("last!!");$ T/ `7 E* }- W: e; M6 q+ _" M
}* Y' {; S; E ]2 x
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
0 s0 q& g( w* L; \: `8 l {) B2 B; }4 C" Q2 N, A" g1 e
orgNode.parentNode.removeChild(orgNode); ' u+ b9 s# `$ W, s; i
}
5 e. ^4 m) Y0 K7 }$ J( V+ ]; ] }3 W' M' N* e( U" t* `
else$ _# w" I1 s& S( G$ E% K
{1 _5 y7 g' O4 Q8 k( M
if(debug)
- a4 ? E0 _# B( P% g {" T' c' ^) R1 r; j$ j
alert("compare color and parent bgcolor!");
6 g2 |2 g, a9 q: `% j' ? }9 Q! W8 {& b3 w7 v0 I
parentBgRGB=getRGB(parentBgColor);5 @4 T2 I6 |; [
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
5 {) H$ {' v! m2 I. J/ ^9 W {
- t- c2 r, e& k4 h" ~4 ]5 C% L0 J orgNode.parentNode.removeChild(orgNode);
% F0 r& B& G5 L- s }
2 j, x4 t1 W0 I/ O* A7 [/ u4 r }
) _6 g. p9 ^) s# d }
! F! \- G% w( u0 V2 i3 ~/ I* l }
; H- T' Q4 w0 d }" I/ u5 n! I+ I7 z
}
+ V8 ^2 t; T4 u( B2 \
I4 X" }( x" l$ K7 w! v ; _+ X! |( |1 h/ u3 }% M
var itemFrames = page.getElementsByTagName("frame");6 t# ?8 {6 D; p
var itemiFrames = page.getElementsByTagName("iframe");; t& U' c" X: n( j7 q
- ^. m, \0 B5 O- b# ?0 T
var frame, iframe;
: @$ R. A, l0 |9 S7 ~" J if (itemFrames.length > 0)6 o) H/ x" V7 H# [
{
6 c1 `8 @# c' a for (var i = 0 ; i< itemFrames.length ; i++) & ^7 ?: r5 S D7 p' r* \+ J
{( j% U7 _& s- n. U# n
frame = itemFrames.contentDocument;
2 O% m% i) b6 b, z5 [ this.RemoveHide(frame,objname); , z, F% s% S) F4 s/ I7 X1 Y
}
, M1 k8 b& f8 H+ ^2 r }" ]; S0 Z& }+ _' Z! q& e% R' h
if (itemiFrames.length > 0)/ Q; Q! ?& i* p* `* S
{1 o) f, N& E$ s
for (var i = 0 ; i < itemiFrames.length ; i++) ) [% y% p7 A2 d9 \
{: w9 d1 b. E# X4 a l1 _! Y
iframe = itemiFrames.contentDocument;
2 {3 x8 C v% c" q5 g8 l; U$ w this.RemoveHide(iframe,objname);
+ G& S* l% _! T- k }" h9 \# B7 \9 J5 o7 a
}/ Z; o) O3 m$ E" U: J0 A
}" w# K+ @! J; |* J( X
catch(e)
9 Q. s- l; X9 y7 }$ E {" b9 i2 B) @8 P
if(debug)" J9 H* v) k r0 ~" x2 r A
{
8 a5 q% D$ h* X K. V# _# r4 X G alert(e.message);; I- v z' y* m/ V# z8 s5 r
}( n: z! A8 I& v) x. m/ w
}
4 H2 O% p O1 ` }9 T8 s$ ?) L9 R x5 P3 X
2 ^4 u1 ^1 f& d
}
5 D( d* v: n$ z8 P; h2 R2 y' M
4 D+ Z: p9 \1 E$ w5 {# Mfunction getRGB(colorString)3 q9 p' I* N2 Y0 J% ^' _9 E9 I
{& p* L1 g" Y0 O- X7 e5 T
var RGB = new Array;
: B. M& h. f( s var tempSting=colorString.substring(4,colorString.length-1);9 N; r& V1 g- G" a
var tempArray=tempSting.split(",");2 Q4 i% h8 W+ t
7 I% Y$ i$ R3 o- J) h2 A V8 c
RGB[0]=parseInt(tempArray[0]);' A5 l ]- v3 k3 {& z5 y7 d
RGB[1]=parseInt(tempArray[1]);
( H, g ?+ H; m, h$ t( a7 m RGB[2]=parseInt(tempArray[2]);, q3 n( H6 n+ I f
+ k6 w5 J8 M: l" K0 c9 D return RGB;* x2 M% E: E7 z3 p+ Y& `1 [
} J/ J3 t, W4 C S3 A! A3 t
function keys(evt)
% L( L. ?: \& \- U# f9 l. n { v& Q( X5 ?5 q
if(evt.ctrlKey && evt.keyCode=="81")
- W& X# w Y& G { & |# E' Z) z- t
CleanHideObj.on(0,1);
6 W9 F- ` g# C6 L5 J9 X" W% z8 k2 A% P alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
- [: W9 v1 S9 i4 z w0 K 8 _; s& O/ j0 ^# m. i6 U& \
} ' [" T& j+ [: k# W: X' j, S: i
}
+ a% ?1 y$ _' i2 \& odocument.addEventListener('keydown', keys, false); ! c4 c3 S# V D" [# G. o5 s
GM_registerMenuCommand ('Clean Hide',, {, n- @1 v) a! b+ Y
function(e){
, Q9 E* I' B6 e2 }CleanHideObj.on(0,1)
/ J' |1 f, ] M8 S* f5 s( Walert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
6 Z5 ~. J& y" M6 z});6 R9 x# I' @0 @% ]0 a7 {! c
|
评分
-
查看全部评分
|