|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 9 J/ x( l9 @ h! h0 Z }& U) ~
8 q9 a4 z( i+ |/ i* ^' ]火狐插件,用猴子
1 P! G2 c" g4 h- \# D
0 |% `" L9 s2 R" uvar debug=false; - C1 e9 J9 j+ w7 a( k# c# I
var CleanHideObj=new CleanHideClass();
e5 P0 |' I, z7 Y1 z" E' ^% }. w3 e/ y
function CleanHideClass() 1 W) q+ H" b4 H4 X: e
{
# q" X! n5 O" O$ m
6 k# O! j0 ?1 ?! L9 y' v this.on=function(id,bMZ)
3 [+ j x# A7 j) l$ V) t4 \; y' b F2 c6 f {* m/ K0 k" X. U6 r& p
+ A$ R, K- D* F
if(id == 0)7 u( X( C! V& K, a( G8 } H% M
{
4 Y1 x' d4 { |2 k& x var page=/* document.getElementById("content").contentDocument */document;
1 }( U4 c3 s& [0 M+ Y2 a this.RemoveHide(page,"span");5 |5 f. U' y! t( t/ C$ [
this.RemoveHide(page,"font");
+ Y; R0 t9 F$ Z( ] this.RemoveHide(page,"div");
) K$ l' l( _! P- H# R% Q; ?: c this.RemoveHide(page,"p");! ]4 |+ Z$ S& v" P4 N. Q/ u
) I) s5 i' r9 t+ m& U& k5 q+ C* Y
}
* A# N$ B/ \2 e, X 7 C: @! `- q, {- k+ b% X" [
} M3 e3 a% M5 M6 f" a1 k
this.getobjstyle=function(node,prop)( t- `6 G" T& J
{: E1 j. h* S7 P+ l7 o
try
m \7 {1 S D$ @. \, t {) ~0 {/ Q" x7 b2 S7 V3 @- U
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
, h# _ ~4 N# M }
: N5 c; P$ _( m8 j5 B8 ?0 g9 I# @ Q catch(e)7 ]+ c7 n" L# f" u( W5 Y
{# e% y" A; { c- @
if(debug)
( N% i" k& h! P+ P& T# I {0 B9 Y; m! A; @9 l' f3 M( E
alert(e.message);
, N' t) X+ ]% g4 U }1 m9 Q. F* ^0 P: {+ K
7 n4 p# r% L n7 Z( y7 _
return "200";
' R9 E2 i+ Z' | F7 j, w }0 U- t, e8 ]" h( q0 j [1 G2 z
}
1 W8 ^2 {6 [0 n3 k ( J7 Z8 o* \ _7 v, Z1 _
this.RemoveHide=function(page,objname)
) Z; R, C. \) e {
5 E {' {, n* v0 u2 A try1 a, |- \8 |* Z9 w8 c
{
+ n. P; h9 A9 l1 I; u' M var minValue=15;0 p7 i7 A; k5 D9 ^3 n
var objs=page.getElementsByTagName(objname); ( h0 N% S* ~: _# B" ?
& M8 h; l5 g* o1 y/ J6 c
if(objs.length == 0)
# q4 F' P& B! m {1 k1 P+ n E+ H8 }+ \- o
if(debug)6 ]8 A" n' U, H
{' w4 i& f; v3 c7 \
alert("no object found!:"+objname);
+ G! @ }5 [. E5 c }
2 V1 t4 I# _+ M5 O1 R6 ~, X# H; ] } l& x# C+ W; {; ^ F
else
& F/ `, j3 g0 `& ~! [ {
D: R) A8 o! u! p- B% @% O0 j( q
m0 n8 ]8 u$ l/ j( ` for(var i=objs.length-1;i>=0;i--) - F! x' A& `& x3 I) j
{
9 f0 C7 ~" N; ]2 F6 s9 J7 ^6 A var node=objs.item(i); 4 R3 c; |4 N# S7 M
: i7 O0 U" n% H9 x. t
& \- F1 y% X% J g+ D- B. E# J
if(this.getobjstyle(node,"display") == "none" ||
# Z5 B, k' E$ K3 s5 v this.getobjstyle(node,"visibility") =="hidden" ||
4 u5 `' x& X& [8 |2 @& h' T. x) v parseInt(this.getobjstyle(node,"font-size")) == 0)
B9 n" j X$ w+ o, z6 R/ c {
* k0 c8 f/ C2 H% A; G7 ~" I2 v/ j if(debug)
C; V, H) A& Y) `/ F/ D" X0 d9 o {
, i5 B, J/ W/ D( b# }& D alert("remove invisiable!");) P: D3 W- G+ H: B j! |) {
}# v5 d& Q5 a1 l
node.parentNode.removeChild(node);) Q/ `. `1 t3 s- n
1 d* b' `! n1 T6 T" ~: L }
( f6 V. S2 x' V! S* { else
* }, G. E$ `9 @. u# K9 ? {" ?. B8 n+ e. g2 S
if(node.parentNode) / r0 i& K0 L! Y: F
{: V0 K, J" n# y) c5 a, r4 i/ w
var orgNode=node;
* i1 N% Z9 S* G( W( c4 t! m var orgColor=this.getobjstyle(orgNode,"color")
' O& I; B+ j& q, m var orgRGB=getRGB(orgColor); J6 Q2 h0 ~6 O8 [+ z
" u! _$ G7 g' t; v- K0 y- y
var parentNode=node.parentNode
) C, ?8 c2 U0 Q var parentBgColor=this.getobjstyle(parentNode,"background-color");
7 x% ?+ q$ c4 A% S* w5 e
1 a3 |6 N0 b- ]# f C1 [ var isLast=false;) o) U- u! T5 ^) Y* n( P' }
; ~0 b, ]3 S+ A& k& X7 w, r1 t% i
while(parentBgColor == "transparent")
) @0 C7 b2 h/ K) Z {
6 D4 m W+ @4 W S ~
& s+ L1 M" @. X1 _
& x# b! L8 k+ F6 y$ C0 [. e if(parentNode.parentNode == null)% f, G9 D5 T$ r7 E
{; w8 [. B i# [) B
isLast=true;/ R: }+ L- t. v7 e' ]
break;
3 U( Z' w7 J4 ]( C2 \) I }: ?8 r5 C* S: P" s1 V. h4 V
parentNode=parentNode.parentNode;7 E: l+ ^3 s! a1 I6 Y7 k7 o r, @
parentBgColor=this.getobjstyle(parentNode,"background-color");
0 I ?3 z3 A/ `$ G2 w* a
5 r0 S3 T& Y" q* _% p, B if(parentBgColor != "transparent") : z/ v! P9 ~- H8 ], m
{: E& R% W7 N3 R
break;* P+ _1 ]( @2 W0 Z
}2 ^- Y$ S" W, V. w
}" h" j: p: u# b% U+ ]- a: l# [; X
if(isLast)
% O' a7 k5 N% c- m: A; c9 A) B {
) X/ C( r! T$ ] if(debug)
o! W Q J$ K; a4 m: F" a {
( E Y0 H7 L4 O0 a: X7 z$ K alert("last!!");
1 \. l2 m5 C* d" X7 L% ] }. n, m. M, O$ g( }! a
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))& p ^! Z+ s6 Y$ ~7 y+ x( R
{6 E5 Q, d9 D/ J# Y6 L' I4 t6 f
orgNode.parentNode.removeChild(orgNode);
3 y2 K1 o: x) D. u! p7 T0 E6 r }0 ]$ x; `" H# b& z/ J7 j2 `: ?1 `, N
}
$ Z& F8 N" N; `: g- S% T else
0 N* w: U) Q: d' k {
9 T( A4 V( w1 t5 [ if(debug)' n9 Y! m& _1 L0 e5 R$ _
{% a& T- }- q5 ]. N7 n4 U, b1 s9 h
alert("compare color and parent bgcolor!");
- x( ]7 j- }5 @, v }) ~! g# [' y4 M6 `) ]
parentBgRGB=getRGB(parentBgColor);5 I3 [/ G2 f8 ~7 d1 K; N2 f
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue)); U& R. s9 n' _7 @
{
2 D; i, |6 a7 k1 z! } orgNode.parentNode.removeChild(orgNode); 2 j" k f" x1 \; A* M) g
}: R0 V* X3 v+ h! I9 `# |! O2 B
}
7 M1 ~& L! m8 `! ? }
! n( k' R! R5 N# E4 F }
* E# S- w9 v# q9 p9 y- g; d* V6 p }+ o1 Q8 S3 w- {
}, u8 Z; p/ v5 e6 f7 o0 I! P1 o- t
! j) E5 J) }; d7 k/ u6 |' C
6 P; V4 y! l5 |: t4 Z# I6 b var itemFrames = page.getElementsByTagName("frame");( c# w' h5 q$ L
var itemiFrames = page.getElementsByTagName("iframe");
1 {! g" ^% f8 \( n/ k # E( z' @* ]) J6 W* `% B
var frame, iframe;7 Z1 m I5 u. t8 x
if (itemFrames.length > 0)
- w5 T8 O( D5 m; P+ \. B2 o {
( ]) c! w2 w7 r& d for (var i = 0 ; i< itemFrames.length ; i++) . { o6 i X' B' E0 {/ w6 R9 ^' S
{
; A7 ]0 f, J$ s: @: `0 { frame = itemFrames.contentDocument;
* Z+ F( |+ t+ ?( v' V* m this.RemoveHide(frame,objname); / i* ~9 e. C' s! y
}
; n( u: S3 x: k# Y5 Q }* e2 W& V) I9 j! Z V4 b* J& u! W
if (itemiFrames.length > 0)" ^4 h6 S6 i. ~! ^5 D' V
{9 E- f2 y5 j# | V
for (var i = 0 ; i < itemiFrames.length ; i++)
6 \$ |' F. \) C! u+ ^4 i {, w- j/ H2 ~ e( H6 @; u* [; Q
iframe = itemiFrames.contentDocument;+ G' d( S- \% G1 \- R& M
this.RemoveHide(iframe,objname); . c! D. d7 ]) O
}+ }4 E% I2 S: h8 |/ m5 {* S
}' B2 X, G0 ]4 o( m( {
}( A" b9 R+ Q, x1 r" m+ J
catch(e)
' |& v( W# `+ r5 Y% z {- Z; G7 ~3 ~- `$ c( _, G
if(debug)
0 m* ?% @ A' j, T1 X {
- V$ Z: b- w+ {8 X ~ alert(e.message);
! e7 f5 d R6 }9 [' {- q }/ j3 L+ W* C0 c, G
}$ e" p. P- _- t9 @
}- Q0 D/ O0 x* N. x- `
7 `5 A* a5 m$ l4 @2 e$ y
}
. u+ |+ z6 D0 h3 v3 o
" m6 N* S9 [( x( w/ I1 Yfunction getRGB(colorString): [0 z% \& ]1 [. N7 ]4 P/ A
{
! E. ]6 h& i+ H% }" { var RGB = new Array;
: o/ h+ |- `2 ^2 `; A var tempSting=colorString.substring(4,colorString.length-1);: @- [0 I6 ]/ H7 A2 i' R
var tempArray=tempSting.split(",");
?5 e. r% H6 w5 s
. l0 M2 E- |: s+ \! t) { RGB[0]=parseInt(tempArray[0]);
' s" @& |8 D/ F8 ` RGB[1]=parseInt(tempArray[1]);
- \ \* g' {- `' {' t- l RGB[2]=parseInt(tempArray[2]);6 z. \0 B: j3 G
4 @5 w+ J" N1 U" a return RGB;
4 J: Q z4 ?5 T}
5 }: g& t: A9 h9 c& F4 t' T6 J1 Ffunction keys(evt)
5 k: h- @( K0 w4 `# B {
( j( f8 c. t. M+ k0 k; {8 } if(evt.ctrlKey && evt.keyCode=="81")
: |% l# A/ G( h0 C+ @ {
+ N( m/ U* T- u CleanHideObj.on(0,1);; Q9 h9 n, z" N: B
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
9 K8 w. z2 a2 Y" e( d" e
7 ~, E0 V F9 Y- @4 ^/ _* b- a/ X' x } ! K7 S* @5 s0 |, ~! r* H) y( T2 d* g
} 2 r [, {% P( P) G
document.addEventListener('keydown', keys, false); . u8 d- M& I2 j
GM_registerMenuCommand ('Clean Hide'," o7 Y" b- a7 l7 g- m1 R/ z1 w
function(e){
8 Z5 S/ M% C! A/ u6 g( {CleanHideObj.on(0,1)
+ J2 ^! g2 Y8 A0 lalert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");' i% F4 k- q; e+ `9 Y3 f' ^1 a
});: a' L) ?8 p/ M. x4 c
|
评分
-
查看全部评分
|