|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 8 L% I2 Q: l9 U; r) a
. M; L' }$ j5 x3 K
火狐插件,用猴子& t" ]* d& f, ^. E1 w/ w6 n
6 h- E3 {0 c! H. d: W- Q
var debug=false; - O* |# x3 P, f6 k! O
var CleanHideObj=new CleanHideClass();; s, a7 u; `8 v5 E" O. a+ E6 K
: `9 Q+ M0 }: B$ K
function CleanHideClass()
# h3 C+ k+ f/ T7 t$ f8 t- l{
z- n( @7 K1 k3 M! N% c* t+ ` ( e. I& H* c2 m: R
this.on=function(id,bMZ)# \, y0 z& V# G& N2 e6 E
{
$ m( o8 }0 c3 p0 @4 A
# o& a0 o, D7 Z( { if(id == 0)5 P5 G( a3 F5 `
{1 e9 Q# F3 [7 X; ^2 ]8 ?) `- t4 F
var page=/* document.getElementById("content").contentDocument */document; ' D, O t% t* c4 t/ G. w
this.RemoveHide(page,"span");
6 p& `) Z) ^* k) ~. W this.RemoveHide(page,"font");) I: Z1 ~% i: B* X8 u
this.RemoveHide(page,"div");
# T$ B9 F2 k) M/ @# c this.RemoveHide(page,"p");
5 ^9 `& I- `. F! X5 _
) h7 P" q, w; s$ ]( J }/ h- X' Y& O5 Z, q8 t
1 j8 S, O0 Z) u4 M
}- o+ z1 M( q* P' K3 I; \
this.getobjstyle=function(node,prop)6 j0 |2 c/ w+ A( Y( y; ^
{
, ]% M; L3 O; Y9 M try7 {: X( e. q/ M& ?9 E6 i8 b% F( x
{
$ Y: _) N4 T4 i" B return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);0 B. E) d8 r+ o! f# }$ [
}- ~6 U3 l; N5 K. c- n5 ?$ j
catch(e)/ v# y6 D6 z3 S5 d" B ?
{
; ]( H) G3 \5 _4 @5 i if(debug)8 _( _, M7 R: u! }
{
9 V& {5 R: m1 t& x alert(e.message);' ~5 t/ G9 n7 Z$ |2 Z
}
% c: Q. n& V! T) j X( \* `: _
% [( O6 `4 \% K/ U- X& ? return "200";
5 I% N# s( {1 o7 q% |' i }
4 \2 V6 B2 V6 q& H. e' n4 I; J6 P }' D D+ Q6 x+ Z; d# B
0 K: U1 {: q0 i6 x2 v
this.RemoveHide=function(page,objname)
2 R& n# M# `5 V( V( K {
& w+ u5 g2 T1 V6 f try
' z& j. ]/ }! J) u/ s- V {
1 P5 c6 D8 ?4 Y+ V- r var minValue=15;
7 |' W! p5 d' V; ^, R% L4 u0 ` var objs=page.getElementsByTagName(objname); " `3 {- N4 C4 |( }5 `5 p4 f
4 J9 ^* i6 f9 S2 P- Y. X if(objs.length == 0) + {( n9 y' }% y$ k6 L/ q& _
{' I' C& C, F4 D7 `
if(debug)
& D# U5 e, t) r2 ? {( T$ S& V! _4 W0 C+ x
alert("no object found!:"+objname);
0 g3 e8 k$ f. V$ l7 d: v }; u4 a6 O% \2 Y% `8 e+ U% R
}
3 \. l: r6 t7 r! G3 b5 H else( u$ e3 Q! T( k, @2 q6 m; O
{
, [/ i. u2 x: g" ~
0 b6 e2 F) B/ |- g) t D for(var i=objs.length-1;i>=0;i--)
4 e4 U0 \8 C9 q6 F {
. ?0 m$ ]0 n) \ var node=objs.item(i);
1 m) m5 t& G$ r. l ( k1 A* b4 v: `0 @ B
7 \# k8 i3 w c- Y+ t& ?% v
if(this.getobjstyle(node,"display") == "none" ||3 ?9 d7 j) Z; Y
this.getobjstyle(node,"visibility") =="hidden" ||, o' ?7 z5 _7 z% p. k
parseInt(this.getobjstyle(node,"font-size")) == 0)
4 o! U; ~& S/ c6 W% [: O$ z5 R+ i {; {, R0 v& e5 t8 z3 @2 K
if(debug)
- K+ K) q- V# y; E {
' W! Z0 g6 h8 D$ x4 r alert("remove invisiable!");/ H: H8 \# P9 W% s1 \
}
0 S* G5 q5 q n3 w; b4 Y node.parentNode.removeChild(node);( M9 |/ g- ~2 o& r* g7 b+ |* f' `
" }% m/ K8 y6 ?$ z$ y
}
/ E. F- W1 {" u" a+ H1 z; r else 1 z0 [" V B: Y; r2 r& _" |/ a1 M1 P
{8 |. b- o% A4 \: Z+ _
if(node.parentNode)
; v- }+ O# p4 M! W# ] {
3 b0 j: h8 `% J! j3 s var orgNode=node;" @' s- c- T( [! t" l
var orgColor=this.getobjstyle(orgNode,"color")& L0 l. w7 X, E7 [& A m
var orgRGB=getRGB(orgColor);
C" w: X6 n; E, i. i8 f% ? w1 m$ c- P6 W- o& I# }9 z8 k" X
var parentNode=node.parentNode
# ` e1 {+ ~1 m3 W' s var parentBgColor=this.getobjstyle(parentNode,"background-color");4 a9 p; X q3 G- P
% Y/ {9 [) @5 _" {
var isLast=false;
' c1 Y' y& ?8 _
- A0 s3 X& M# R. K* W" h, @9 W3 D while(parentBgColor == "transparent") 3 R0 m& K( ?/ R! h
{
' t/ b+ [1 Q! G& G Y
- F! Q8 j( R$ t) g) C: i 5 J( ]3 S# a. W* c9 F, Q
if(parentNode.parentNode == null)
0 ^" x9 ]8 h- j4 f+ Q7 y. V { |+ v s: D! A3 {5 E1 y
isLast=true;
5 I( Q8 P0 J3 d% `& X( v break;
- S- ~/ s: H' w }
& ^" }1 A7 s- V$ ^. k8 J# W u1 Q- l parentNode=parentNode.parentNode;
' I5 r x$ g# ~0 \ parentBgColor=this.getobjstyle(parentNode,"background-color");) r* s7 |& h7 I! P5 v4 ^9 W
$ [* i R) K: B if(parentBgColor != "transparent") - r# M2 z1 k' Q8 d; ?$ o
{4 b5 ^& M7 m. j7 }
break;
; z2 N* m. H* Z }* w1 d$ D: ?/ F2 B
}
* ~9 ~+ Q+ r& ~' K if(isLast)
, E: `6 n! h6 ]) R8 z1 I! d {
% o! C* |" ?9 z8 f( s0 j) p$ Y: X if(debug)
* c; @% X& X; R {, o% A0 S% c$ N' n
alert("last!!");5 \2 K# a1 M7 i9 k" x% H+ @
}/ Z- s l( F4 S6 A/ x5 [8 V6 d. g
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
3 y S. H3 F+ f {' O% j8 f7 C% V8 _' Y& l# i
orgNode.parentNode.removeChild(orgNode); ! b. v$ B; S6 P, O
}
, n; M# W- F% s# \3 R, C C }
6 Z. w2 y* \+ x: O# k& w: @ else0 V0 E5 N1 r% ~
{. y2 j0 X+ }$ Z
if(debug)
_% i6 Z3 `: ?% p& s" w {5 v4 l0 _0 k _/ h4 A6 s; y' U2 p8 W
alert("compare color and parent bgcolor!"); [' n' | Y! j
}- c2 [5 \0 M; [4 v7 L d1 i# t. F
parentBgRGB=getRGB(parentBgColor);
+ K! T1 m* W) M$ n0 r9 J5 V* J if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
* ?. d* L! e3 |* k1 d {8 T; \6 k, m/ K
orgNode.parentNode.removeChild(orgNode);
9 o0 F, K/ F+ w }7 a. }6 I; U$ V- O
}! @( \: L! L2 U" I4 j
}3 p2 x8 [ K5 k2 g
}
2 V! y% F: H, O8 s }
/ }: D: p% s( L2 V- D( \ }
! A* M& o3 I' v5 a7 \: y
' R) {/ ~9 K5 H- O# v2 l 1 Q; ~) p. ^1 |9 w( d. |1 j$ F. ^
var itemFrames = page.getElementsByTagName("frame");/ h5 m0 Q+ A) b! Q, x' w, Z
var itemiFrames = page.getElementsByTagName("iframe");
- B f8 M e! A1 g* G2 a. Z( Y " ?# [1 k7 r* o8 }, {
var frame, iframe;! z0 ~! z$ r; O1 E& k1 L) b' l
if (itemFrames.length > 0)8 t: `$ I) ]& o. s& N) Z- h
{# J3 k/ ?3 O" f9 c. C) o+ `3 d$ f
for (var i = 0 ; i< itemFrames.length ; i++) 1 ?7 I( t) w/ o2 E( K
{
+ J: ^1 l0 L F% A: l( D7 E' n6 u frame = itemFrames.contentDocument;, Y; x7 T' `2 ~% w; l( i4 R
this.RemoveHide(frame,objname);
4 P1 l+ Z t6 z) N5 z3 j( J2 G }& M5 S2 D: N- b! P+ \' e
}
* A2 S' }4 |- o( I if (itemiFrames.length > 0)
& [0 t' [6 z% W3 L! I: y {, G" X2 m7 ?0 q( d: p& R
for (var i = 0 ; i < itemiFrames.length ; i++)
- G2 D( U8 ^8 @3 T" O1 `: v# Q, [ {$ v$ ] Y$ s; [) F4 M
iframe = itemiFrames.contentDocument;
: C8 l( {; x( C this.RemoveHide(iframe,objname); 6 G5 Z: g: G* ~" F* P' M
}
/ E) }+ H$ z7 N }! Y; F: |8 o0 X3 Q- T
}
* I" ^8 }: L6 s0 @+ D" ^0 @/ \4 p% K catch(e)
) r/ k4 F! k, G# k" B4 l {; P) y0 L, ~- J
if(debug)
+ H8 c, p" S6 X0 i {
8 V3 w# _$ P, Q; m6 S$ P" S alert(e.message);
j- k- p/ i, @) B6 [ }8 H: o- g0 D) a" a3 _6 O9 u: z4 r
}
+ J& ~- h( N- d! d |% e+ v- q8 u }2 T$ N9 l. q; r$ w$ G! m
( F B( Z5 b% K2 I
}' z1 w/ |% d* s; q- O
9 ~- N+ {0 W' {- Z2 B* ]
function getRGB(colorString)
- ^9 [. G# B: _, g+ {5 A& a{* g5 H8 Y3 g% k' z f3 ^# y0 x' a
var RGB = new Array;* I2 `: e* R8 j; H' W
var tempSting=colorString.substring(4,colorString.length-1);
. P6 q0 h4 @7 V% k var tempArray=tempSting.split(",");
! K: q* f' y( G- y( A( D6 P8 J( b6 U* O c0 A" j
RGB[0]=parseInt(tempArray[0]);
0 W% x% ?& F' |6 s RGB[1]=parseInt(tempArray[1]);
9 V, b; l" w* M5 m RGB[2]=parseInt(tempArray[2]);8 Z3 ^9 I3 [ w0 _( B
% E r# |% E8 P return RGB;
3 d! f9 {0 _4 N5 u/ H3 i4 D}1 r# ]2 ^* E9 X
function keys(evt) e: l }5 g4 q2 x
{ 3 H3 P, g; x! A6 H1 m0 {
if(evt.ctrlKey && evt.keyCode=="81")
" j1 m! C' X7 P5 D { . |3 u9 t; |4 b
CleanHideObj.on(0,1);9 U8 K" j6 Z6 A ]- [7 Z
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); . y& L# E4 }8 ~
$ j3 y2 Q' s2 F- o, O1 X! w' h8 G
}
: @* e3 M: ^0 j } ) }9 _% u' [# z! ^% Q) A; L
document.addEventListener('keydown', keys, false); * C7 H( q% W) J& ]' V: U
GM_registerMenuCommand ('Clean Hide',2 d. w& J1 P5 c+ ?8 N
function(e){2 _/ R4 t8 U8 k0 ?
CleanHideObj.on(0,1)
5 K& q. Z; f0 y Ealert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");) k2 \. T, V' P
});; f0 b% a6 r: z: j( G5 K: q
|
评分
-
查看全部评分
|