|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
0 i$ r$ R4 K7 ~+ P
3 R5 U) w! y' a4 F火狐插件,用猴子- f5 e) Z& m. G
* E% j! f) ?* k0 j4 mvar debug=false;
7 @. A+ F1 B3 Y6 W7 s* S3 m# Lvar CleanHideObj=new CleanHideClass();
/ A0 W% k, u, e
P9 \& N5 G' N* }' c/ |function CleanHideClass() - T2 P# n$ q$ b3 S, J& K
{
0 F* c2 W) j- A; u+ |, _5 l
2 _7 N# H, K r3 t6 v this.on=function(id,bMZ)
; p9 G2 H- z/ h0 Q4 i' r% G/ O7 X {4 p( m/ i0 d1 N. s7 O$ _4 @, G- P# o: P
8 a0 v" e7 ]" L/ Y! H* L G if(id == 0)
8 w+ G5 S: r+ B+ {0 {* E i% u9 R {
$ m( I+ P9 ~. [* V l: w var page=/* document.getElementById("content").contentDocument */document;
- I0 j2 h8 K4 r- X: A this.RemoveHide(page,"span");, v7 @( D" H7 H. R
this.RemoveHide(page,"font");
# f. z0 V; _9 | this.RemoveHide(page,"div");) |3 o. F# ^3 n. s" j% l
this.RemoveHide(page,"p");
% o9 ~4 G! l- F
2 {! e& Y# R4 Q% Q4 [4 f }
2 ~% o0 i% [- K: I/ C' I& W 2 r5 U, b( j) x0 t
}' d0 t, @! i! w+ \
this.getobjstyle=function(node,prop)
' a7 [1 X1 D2 _1 q( r' p1 @ {/ N/ v/ ]& N/ s" Y3 T9 y
try; Z4 t6 E+ C$ z) H6 o+ t
{
5 C, e. k% E& \' r5 v return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
3 m9 ` T: _% a( X% S }# {( T* ]* ^! G" A! V
catch(e) r* a; V$ S9 K5 h' d! r, @- D
{
' S8 B! H2 Z$ Y# N" F$ U, Z& Q if(debug)
; ]9 t$ Y- y% r' W {1 l$ K! s7 _' Q2 @( U& r
alert(e.message);
5 H6 w f8 y8 z2 n6 _ b }
+ T( T* ]0 [2 W @
+ v0 F/ n. A5 C5 e' L return "200";
c+ _: _' O/ `4 D9 y' I# r' j }
; ?* u! ~4 w, o! ]7 w% s }
, Q/ F" K! O" f1 M# X2 P' U
! c( \! j0 V% f$ n" a0 e this.RemoveHide=function(page,objname)& K7 k! b4 |9 c
{
8 U H9 x& I( t+ u0 W! ? try
( F0 V4 u! o7 K, M, i* D {
+ `; j( D( `" `& O v" {; ]. D var minValue=15;* x9 P) Y7 V8 a) _5 p$ G
var objs=page.getElementsByTagName(objname);
% J7 `6 ?- y* c! c: O! f7 V m( o$ o: S# V$ J
if(objs.length == 0)
$ u! h n. S8 b8 W. \. ^4 S {
U- h2 W" X0 x, H' ?! W" n/ ~ if(debug)- ?3 o7 p+ |- W9 ~9 }7 j
{; n5 T9 q8 m" i k5 [
alert("no object found!:"+objname);4 p3 F" e5 H2 C
}5 t0 g V" \# K2 b" k3 Y( ~5 e
}. I2 R1 I+ w" L7 V5 n8 \5 z
else
# D+ {: m" c% P, g0 k& e! a5 B& j {. g: O' b6 c) a
4 W$ Z% o: ^" u for(var i=objs.length-1;i>=0;i--) $ }/ r/ R, J7 o5 E
{
! f; M6 S* u+ m. w2 w* ~( e var node=objs.item(i); 9 \2 z+ [/ d3 N* s3 d
/ n# Z( {0 N- z
) y- w" @( ~* _( q8 B5 X! S+ \
if(this.getobjstyle(node,"display") == "none" ||
- L2 Z# y+ R7 h2 W! H this.getobjstyle(node,"visibility") =="hidden" ||
( G8 J6 E# f V2 {& f8 R parseInt(this.getobjstyle(node,"font-size")) == 0)
7 s1 P5 E# \7 g9 i) n% y, F {
~4 F- D3 F- e* h if(debug)) E' w3 J/ K( U" I/ o W
{
+ o6 ?* i) ^) o/ P alert("remove invisiable!");
$ b3 e6 _, F( x" a# @9 [ }
0 g! A! j% J- B/ Q0 d node.parentNode.removeChild(node);: x9 w2 L) H4 T9 H( r/ u
$ p; v, a2 e: H
}4 a+ @% W3 L. w" B4 t6 g
else + D4 h# @+ _7 a& d
{# K, c; h5 n# y3 u. _; S8 }
if(node.parentNode) g2 X X, z, Q( g7 V9 u
{
" K8 X8 O( b2 {; J( |( y var orgNode=node;
. e. _1 i& l1 n6 X; a& @; z4 ~ var orgColor=this.getobjstyle(orgNode,"color")7 W0 B. `" o9 F( _( C+ D/ ?
var orgRGB=getRGB(orgColor);
3 I+ Q: I( ?+ f$ C
6 _, W y2 m" M# W var parentNode=node.parentNode
8 p1 V' s; }. a1 ^$ V2 I: g* z8 X var parentBgColor=this.getobjstyle(parentNode,"background-color");
# b5 l* A* E3 ~2 X ( [, m" G: E7 r: l
var isLast=false;
9 u3 K0 R1 S3 B6 S( p, H U
5 Z/ H& W+ z# o& X& K" q) S while(parentBgColor == "transparent") / X( l. {9 n0 O6 }8 }* J
{* t* M. j3 ^7 N7 h1 b, q% H
/ L. m+ I: w) w ^
4 r% Q5 t! Q! c8 s* ]% T0 p% Y7 y, d
if(parentNode.parentNode == null)
# {$ n. B7 l: C {, t% N2 b ]: j; v
isLast=true;8 \, r4 r& g1 \" Q6 T0 z
break;
, y: T' g7 v/ ~( l9 g% p _* w }, s# O# o7 t& F9 B
parentNode=parentNode.parentNode;
. q& ]+ M8 c5 r3 M& m% R parentBgColor=this.getobjstyle(parentNode,"background-color");
& |# Q* B, H, J+ J/ Y/ I
i# c6 x0 X9 S0 F" o if(parentBgColor != "transparent")
5 J7 F1 E! ~5 Q8 Q! `% l( b {# z, ?' W, ?$ _1 R* r7 s
break;
& j' w x# T1 o }
- p X, t+ ?/ F. j+ g }
- E( J ~: j/ M2 ~" ]) ]2 | if(isLast) * B" Z- R7 n* U0 U- J( w0 P
{% c& U% I4 B: l
if(debug)
$ z& @% M/ L( U8 Q" P( b/ O8 U {
6 y: m4 m, d/ w" ]% ` alert("last!!");0 s7 G; p$ U& P% `
}
0 p* K& w4 E9 \ if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))1 z1 Q7 U A Z/ F$ y2 C
{
: N7 Z" M3 q* E/ n; I0 U7 M orgNode.parentNode.removeChild(orgNode); 6 P& Z( i; ^5 |7 p2 x5 ~5 N. \
}
& `) Z# K+ R+ _+ u- c }8 \+ {% \; R4 s, h7 V
else4 |* r/ a$ E. Y5 m$ v8 ?# a8 N" Q! v
{
1 s2 ^3 A3 n* e5 w5 y if(debug)
, |/ _9 v0 J8 g6 j {
: d/ X6 F! b" B- o alert("compare color and parent bgcolor!");/ w% e' K9 D" g# Z: @
}
* Q7 I& ?9 D* U) f& \8 h5 g& A2 W parentBgRGB=getRGB(parentBgColor);
" X- X& U* D6 o4 ^ if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
& s2 e; J$ _4 A {
1 g A7 Z, G: n- ?( [5 n0 A orgNode.parentNode.removeChild(orgNode);
) v- R% C$ u; s! W9 ~3 q6 E: J }
& x$ |7 C+ M' o6 s }$ |# |" \. c3 |& k
}6 o! d" _4 T& ]4 ]9 F6 X
}
u( \7 V, q0 C7 B8 P8 `. ~ }
1 g5 t1 `# x% Y4 [ }3 Y P: u5 `6 H: Z; O4 \2 S
' A/ p7 i. Q, V7 r' U( w3 \
9 J7 {' R' n1 B. T* f5 J+ j2 V4 | var itemFrames = page.getElementsByTagName("frame");# y7 g: d3 |2 W- r4 e
var itemiFrames = page.getElementsByTagName("iframe");
( M- N2 N& r* I; y3 u1 ?+ o% \ : C4 e4 o! v; E! u. E5 f
var frame, iframe;
5 C# R. h' x' } if (itemFrames.length > 0)
: J- Z7 m* r* X, H {
9 J) t) ^; I8 j/ r" x for (var i = 0 ; i< itemFrames.length ; i++) , n! P |3 H3 Y7 @0 C. H
{1 n2 z- t5 p3 x; g. {8 D
frame = itemFrames.contentDocument;
* ~/ ?. z2 l% C: a9 M this.RemoveHide(frame,objname);
9 q8 Z- O8 S9 P% }. h }
) ~' Y B; K. m/ u }
/ ^3 t) i; V3 e* N" b if (itemiFrames.length > 0)
' e. j# Y% N. |3 K+ N& k {
# K- R" D$ M3 Z# u4 X, T for (var i = 0 ; i < itemiFrames.length ; i++)
/ T0 ] d+ s% u9 U: ~4 l {5 o: }- }: G- A; z! Z
iframe = itemiFrames.contentDocument;' c7 x# T0 K! W& J
this.RemoveHide(iframe,objname);
/ }# h( Z: Q) M) H }
8 j4 U; I7 g# w }
" p% n# X/ X `4 I6 ~3 q }
/ i% }4 e# |7 p0 [ catch(e)
9 A/ q2 [5 Z* P& @+ }3 W {
2 h5 s) Q; t ~ |% p if(debug)* m: ~: T" `' l! T6 c I7 ^
{/ G& Y. q2 H8 c
alert(e.message);& U" P" C5 J1 e _* }
}
( M, i- Q% v# T1 G8 j }2 X9 }& E/ ^0 L7 v4 G; _ j1 w
}! O) Y1 c) u% u* `" j
5 }5 r% z7 V n4 Y, m. H6 P f/ C}
9 R l: |" P% N) t" M- O5 s7 ^: A/ N4 V* x
function getRGB(colorString). [- H) [4 l+ L4 V) G
{% i6 ]( K( ]1 m, A1 r* K
var RGB = new Array;
7 M" [! z+ O& l T0 j0 { var tempSting=colorString.substring(4,colorString.length-1);3 o& a" R# s# ~; K
var tempArray=tempSting.split(",");. }: [. _ z7 w: J( ^
) J( R4 b( [4 x" O( w8 N. X RGB[0]=parseInt(tempArray[0]);
: I1 {! L' e# `3 w. b9 S RGB[1]=parseInt(tempArray[1]);
* u5 d2 k$ b, j+ }% U7 A RGB[2]=parseInt(tempArray[2]);1 f9 G) _1 O2 c
" q+ G! R! |) ~! Y return RGB;
7 C" y% e" C; o% r}
: o6 v- _, x9 |function keys(evt)
; ?6 z7 _- T: B: S: Y% ]* Z {
- u. H4 X2 {$ G6 U if(evt.ctrlKey && evt.keyCode=="81") . {1 y. w) ~2 [/ R( V
{ ' c$ h) |1 u; V9 \: `$ H3 C) S
CleanHideObj.on(0,1);! |( V+ p3 ?# d" N" g
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); % s2 b7 v. ^% A5 f. `5 \& E
?& d- X7 E. `4 @4 n6 ^
}
$ N2 @- ^, M0 x5 X6 e# i2 a }
, h9 k, z9 Y9 O3 t8 J! Q, g }4 ndocument.addEventListener('keydown', keys, false); " m- |$ ^% n" O6 t# `5 ]
GM_registerMenuCommand ('Clean Hide',
6 e- P1 J/ y$ ~& L1 l! W5 hfunction(e){+ \' s1 n7 V0 @' ?3 g
CleanHideObj.on(0,1)
r" V/ |& K6 n7 Balert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");' d; t& v( q. w* n3 K
});
+ b" Z$ p, d& _8 w! V$ o: S |
评分
-
查看全部评分
|