|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
) E4 z8 H0 l- G. T4 j2 L/ h b: c, A) p6 R3 N
火狐插件,用猴子( ~( x2 o- a& C4 n- C
6 `7 M' c. `; j. s, v# @8 {
var debug=false; / U; Y* k0 u2 K6 ?2 Q8 ?
var CleanHideObj=new CleanHideClass();
. Y7 M) R/ r2 l# U1 s8 P' }9 @# W& ^- r
function CleanHideClass() ! {/ s7 ?, a9 `* f. x) Y! }2 ~
{ $ G! B L4 Q* w5 x1 w- @
; v4 U: L& q4 n* g" P
this.on=function(id,bMZ)+ I! M9 o0 p$ J/ i+ ^/ e
{
, B2 K1 I4 P# k0 ?, ^ , C6 N1 O) c1 Q
if(id == 0)& z! l1 W' u/ U# R( g
{4 v5 `" ~2 B/ _* u' @, _
var page=/* document.getElementById("content").contentDocument */document; + R% x5 X& o0 j
this.RemoveHide(page,"span");% @ V# B; L! h0 ]/ Q
this.RemoveHide(page,"font");
2 a C' M8 L% X* f2 ] this.RemoveHide(page,"div");
: q8 F" o# f2 X/ G& ~0 J this.RemoveHide(page,"p");
i* t' o# Z7 b, [8 V
8 O! U) R' K$ A! w: z }- b& D: X) y- W+ m# ? Z, W3 {
( C0 R* w9 S# r, ^$ n5 }2 _ }+ z7 \' O5 ^7 U* V) f
this.getobjstyle=function(node,prop); T( ]2 P* |7 l9 m- |
{
/ Z6 h3 ?- h" I% w& C' d1 z9 Y try6 ]1 }" ]) K( I0 G( Y
{
f& n/ |. S8 e+ W& w0 f return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
5 d) D8 Y% ~" \) h& B }8 o4 Q6 M- b7 `$ U/ a" C% e8 Y3 f
catch(e) _* u& {$ p& A' ]) s) y6 o5 y
{
3 k5 f( i& I" U1 r2 o6 l+ c if(debug)
$ M+ K" h1 J- f% L {
. I; d- A$ ]. Z alert(e.message);
8 E& a* \; N/ }; V0 h }
+ U. I! W+ G$ L! y7 @2 c; [7 W
9 y6 c7 H- q0 C return "200";
7 w' R' m4 @( K9 V, f% c }
; C6 z' n2 ^& j$ d: c }! x% t2 G( c* `& E0 G
- P6 Z$ c* l$ f4 Z6 A8 `
this.RemoveHide=function(page,objname)
- q7 I6 m+ v' |! W { I( V: H! a3 w3 R: w7 ]- q
try6 e% [4 z2 ?) n% K( I+ q2 t+ s
{
6 Z% p8 v) C& b6 R/ { var minValue=15;7 ` C! h, V1 b3 j. `& C/ H5 D* j; @
var objs=page.getElementsByTagName(objname);
9 h& |6 ]' }- f9 {! e1 g# i# j5 l; N- N7 Q
if(objs.length == 0)
' m7 X [% B3 J/ o {+ @9 P; S- a4 e8 Z- }4 I
if(debug)
- `" a; E' }( ^( T {8 O# [8 N5 I3 F# h
alert("no object found!:"+objname);- I7 F; e* ?7 a8 t
}
: A1 |9 l6 ]- P: C! O5 P( E }
- A% ? N: d( q, i% R8 v5 s) L Q' y else
, n6 e+ j. e0 {( b5 H {
+ _* L+ a& U; H6 ?* n 5 P/ R7 v# F1 F e9 e
for(var i=objs.length-1;i>=0;i--) / E. J- W! @/ M, W3 d% U8 e# ?
{. _, Y5 o7 p% i# X
var node=objs.item(i); 8 z* K6 s8 Y7 O5 e/ J$ E/ r5 e( Y
; f! }( h" {/ d9 X8 |
: I1 Z6 Z3 \: p: V/ M9 }4 a3 S- i if(this.getobjstyle(node,"display") == "none" ||* s& x5 ^; R8 y
this.getobjstyle(node,"visibility") =="hidden" ||7 K2 e; f0 j0 d
parseInt(this.getobjstyle(node,"font-size")) == 0) 7 D; h7 f& I: Q
{
6 ~: d1 O9 r: Y' f& `; j4 c if(debug)
) T/ A6 u) J; F9 f- P {+ p+ g6 P7 P" h2 H+ l6 H5 u" ]! ^2 {
alert("remove invisiable!");9 e1 \5 G1 Y/ ]3 F* N9 n# l
}
* d3 D) p; M1 J" E/ R, I( i node.parentNode.removeChild(node);5 q6 c) v q& k
. o. @( M& R4 k; V# V- A" n6 T
}
; L$ z' G( L2 m& [9 [0 Z else
$ A8 y& m+ y* c: T# ? {
! ?) N$ o/ i, V- n1 i1 x6 I if(node.parentNode) 5 ]3 D- @1 e" @
{
; n% ~$ K. [+ M& b) u var orgNode=node;
! B/ e4 k2 Q4 G, f |, G0 H var orgColor=this.getobjstyle(orgNode,"color")' q$ b9 V5 S7 j" s, ?7 _7 a5 U
var orgRGB=getRGB(orgColor); / Z @: i* M1 f$ R( z" g$ z
, N; W1 }% Q" e, ^" \ var parentNode=node.parentNode. l8 [9 V3 p/ W, w9 w0 y( `" H! @
var parentBgColor=this.getobjstyle(parentNode,"background-color");
1 w8 d8 o' b5 E ) d8 y6 P, U! a( ?$ L* F
var isLast=false;7 I6 Z3 D3 G1 V+ D( D; Q
$ D9 A1 y; O9 l* N
while(parentBgColor == "transparent")
) C, B# e/ \1 W) a7 j1 [# f {
& R* t8 [( Z7 p8 L* V% v
, h& _; s a u/ Y
2 P1 @* J- h& R I if(parentNode.parentNode == null)
@. n s* ? A7 ^8 a( P {5 Z) y9 X' D9 d* \3 o$ Q
isLast=true;
7 s3 x, |) L+ Q: c* N* p break;
( C& h7 o1 I }/ R3 G: k }
/ B8 g% C; I. `' D0 y# l/ V3 F; J parentNode=parentNode.parentNode;& S4 W; n# l. S _
parentBgColor=this.getobjstyle(parentNode,"background-color");# t' a0 F' b5 {
8 P X7 X# y( m4 E+ @* N
if(parentBgColor != "transparent")
8 j- O. L% `* E/ |$ @ {* y2 D6 F" {- s
break;
$ \) v, o. Y9 [/ M }* F3 i2 C% M$ y
}2 O* v6 Y0 M# }- V! i0 U
if(isLast)
. d- n7 N {, w# W% O6 P {2 t/ R; k6 V/ C
if(debug)
' Q! |' b6 b/ h {7 \# A0 z7 G/ ^! S4 s8 d$ A) q
alert("last!!");
/ N+ `6 B1 W5 i& ?& t }
4 F1 M5 X$ ?' d- G& I if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))2 K+ |! ]0 q& ]8 B7 ~ z% E7 E
{: c. v( ^: f# Y
orgNode.parentNode.removeChild(orgNode);
- _6 Y/ o0 y: f Y' J }# B3 H# B, K U) b T" n' Z$ k8 o
} c7 E+ h T( {, X
else7 d3 z; b+ E' q. K, }) K1 v7 }2 H8 e
{3 m) ^/ ^0 V7 J; ?! l6 K
if(debug)
2 m# j- D9 W9 V4 b5 V3 p! N {. L- d3 d' y1 i$ [- V& u7 g
alert("compare color and parent bgcolor!");
# w B* {& p2 `$ Z }/ m$ q* K. r; ]# b6 R
parentBgRGB=getRGB(parentBgColor);
: u, e m1 l& {" B( N- Z if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
* b: l) C+ c( _9 I. ] {
8 {- \9 e0 f) L2 x8 a; M( E orgNode.parentNode.removeChild(orgNode); / j5 T5 J, F& Y; Q; G. V+ e
}/ g, R2 K* |! }7 O, C
}) {. w# V6 d' \: }8 f/ c$ B3 k
}
" d, Y7 j5 v1 d; s0 e }
4 z5 q6 K0 x8 h. a% Q* u }
; W2 e9 T" G+ N. b# h* w# x s/ Q }1 [/ S- v% `, `# H" d5 x; k
& i3 o0 O' V6 f# U
l: ?+ g1 Y7 v' X var itemFrames = page.getElementsByTagName("frame");" m& _, ], |) U3 i
var itemiFrames = page.getElementsByTagName("iframe");6 u, F' u2 d( i# \
M" O0 x8 P E: F var frame, iframe;
- C0 W- K+ S Q if (itemFrames.length > 0)
% W; a3 Q! |( v1 `$ }# R {
6 z1 \9 l) E$ T; u" f4 m" o for (var i = 0 ; i< itemFrames.length ; i++) & K1 b/ J$ a' j& J1 A2 A# E
{
) R/ q" f/ P5 `: ` frame = itemFrames.contentDocument;
. f* [0 D7 v7 y this.RemoveHide(frame,objname); 4 R, \8 A7 I' [7 Z y6 b6 R
}
$ n; Y3 f j! }, O Y }
" d1 _( T( o9 B; }/ @5 d if (itemiFrames.length > 0)# b( K- b+ ~2 D1 i. T( r! P- s3 t
{
" I, g) T' Y( g) x/ p for (var i = 0 ; i < itemiFrames.length ; i++) # S. X# ~4 d3 x
{) _1 `' c2 }- B9 d
iframe = itemiFrames.contentDocument;9 r! d* R" g; c. B9 ~9 J3 A7 A
this.RemoveHide(iframe,objname);
~ ]6 c) q+ G: \! \" x0 n* L( i }3 f r9 q8 d0 w& P1 b0 a: T
}
7 D0 r: ^, f0 }- y }+ \2 c* Q6 Z" G% Z0 V+ Z
catch(e)5 M4 }2 j8 J! B9 N; D) [) T! L* g5 i
{
. |% u; r. y/ t _- s" ]+ ^) S if(debug)
9 K0 M$ `7 ?: R8 }- q9 I {2 |8 Y0 H) m- {+ I
alert(e.message);
# g# }4 f: z: `1 r9 [# ` }
% l6 _) d9 F B0 e* O/ p7 c }# L7 a5 U7 p& x2 C& G; {6 u
}7 H* Z9 y$ {+ J( a3 a j- w7 K
; X+ g3 a% N( y2 d6 P) _
}
. l0 n* I9 t6 n3 q% }, Q* l) B2 ]0 n" o$ K9 c3 B" L [0 C1 ?( ~( F
function getRGB(colorString)4 }# Z% \. s8 _* n: N. g9 F
{
% R% ^0 o. S c9 V u var RGB = new Array;
! x* g. u% e9 m8 ?0 Q8 M var tempSting=colorString.substring(4,colorString.length-1);1 t* A9 i$ v( Z& z
var tempArray=tempSting.split(",");
1 z; W7 Q/ t* _" T+ d$ U1 k) H( W: \7 O$ `3 }+ ?9 U6 L
RGB[0]=parseInt(tempArray[0]);2 L8 _0 z* o1 |" _$ F: H
RGB[1]=parseInt(tempArray[1]);
x8 `2 r& [" J' |. n0 M! d* \ RGB[2]=parseInt(tempArray[2]);
0 O; w! A% D: X$ q
$ g( ~& [ R l return RGB;
: h6 ?) I2 r6 e8 F+ ?8 N3 D% L}
( Y8 g% j: {4 E8 p @4 Ffunction keys(evt)
7 e- }# c- J. x' {0 P {
" K" j3 ]; M; R/ B8 ?% Q2 |8 g if(evt.ctrlKey && evt.keyCode=="81")
4 g& d6 e1 \: ?1 n7 r, @5 k2 j {
0 F6 V( e; E, u4 F/ E CleanHideObj.on(0,1);
) U3 y/ M5 g1 s( n8 [ alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
S* j& q8 C5 O1 r7 Q. i+ y% E& L
/ ~" a5 m0 u* u) p$ ^% d1 j& J } * p, }3 U% U3 b" Y4 ^0 m
}
3 s' z$ V" c" c" h; L* o) tdocument.addEventListener('keydown', keys, false); u2 f: P8 Y' ? a' i; }3 T
GM_registerMenuCommand ('Clean Hide',) P. [; H0 l* i5 y; P
function(e){
6 [- G. e' Z" f2 x3 @CleanHideObj.on(0,1)
6 |* H. e5 H$ o" ]9 C8 V9 r6 Talert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
4 F: z% S4 Y/ I" Q. [; s8 z- z});) d0 W6 U- [, F
|
评分
-
查看全部评分
|