|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 / A) Z* u- @/ W1 h( P" x- n
4 i3 x: l+ L1 _' V+ t( P0 k火狐插件,用猴子; `9 \" S; W$ d9 v5 }* m2 K8 I
, u/ {. c8 U9 T5 q% Uvar debug=false; * S6 F& V4 D$ w2 q- [# Z
var CleanHideObj=new CleanHideClass();
, L" R5 G8 M' j! T' W5 t
5 S1 ?) ?9 q, R) k& } Ifunction CleanHideClass() " w+ M! s. c' D6 l# J& i
{
( M, y1 O, j5 F
) r& \9 x$ Q. E. { this.on=function(id,bMZ)4 o6 }! G( S3 V m$ ?( k
{
: O+ c: P5 h- N8 m # e% [: X. S, N+ g$ F
if(id == 0) X% n/ e" `6 w
{
' | L. d- l8 K5 q( J; t {: } var page=/* document.getElementById("content").contentDocument */document;
! L# E J3 j' k this.RemoveHide(page,"span");
, u/ {& A' }! Z# _7 v; R3 |* H this.RemoveHide(page,"font");2 u- k/ G8 d, ^/ J" \- U
this.RemoveHide(page,"div");
0 ]& ~+ T7 f+ t4 x- I& Y* f this.RemoveHide(page,"p");& n: ^, ]! d, O/ z& a+ t( Z/ C1 e0 ?
- H) B( G( }- \8 p9 l8 Y }; k0 u; p1 G- t# X4 r3 B8 g8 g9 d
# K( ^ D |3 y' _. V; ?! X3 c- G
}+ ]2 |' G7 `% F Z6 r/ b
this.getobjstyle=function(node,prop)
! H, I5 n8 U; m: w/ [ {. |$ L- J5 i1 S9 S5 s, j
try
8 n. s$ O9 ^2 W) l {
" q0 y: h. E& y) ^( ^6 | return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
( `: S. T( N; p/ @" { } b2 `2 {6 z$ t9 j
catch(e)
7 p6 {7 `* k& m. i; B1 t {
5 V8 G+ _ i# L! H- g0 g4 s, q if(debug)
1 g6 Q' V- H0 l8 F+ `# j1 ? {7 W0 B' ]4 l# \* [, a+ A9 k
alert(e.message);/ C# f( T* D* ?! {2 v
}. p' `0 b+ @' B
) s# R# J. |* @7 r+ e* N return "200";
1 F; ^( D# b3 O2 b6 {7 X5 e }
- A2 k N) z* ^0 b( g }
% E N: s. v1 w, W ; b8 F: S& n; B3 j7 L/ z
this.RemoveHide=function(page,objname)
& L P( z1 P# X+ Y* N7 v# @ {" D" _: R- ^* S; G* M6 |
try( V. Z! a z# O$ a/ h$ N, R
{
- T \$ n6 R( f r7 R% m: S var minValue=15;6 X, A) R3 z6 w5 v8 t1 M
var objs=page.getElementsByTagName(objname);
# b8 ~0 U9 [( \7 J; h- e$ |& B/ Q; `, ~+ A
if(objs.length == 0) 4 B7 V3 E# N3 l" {& ~" X
{
3 y& V. `7 ^9 @" _ if(debug)
0 C, }! q( q, L: l {4 \& x3 U1 d" E
alert("no object found!:"+objname);% V) a' v! S- F. H# z- M! v
}# {2 H; |; A& k5 m
}+ B8 [1 J) R& \* `+ i1 R
else& f1 B, x, ~. y, y1 f
{
7 t: u7 k2 h0 t" Y9 T
( t k; E+ S" @, c for(var i=objs.length-1;i>=0;i--)
* x6 l/ L0 z# o$ I {
) r" y) q; z$ T$ l2 Y var node=objs.item(i);
0 o4 S6 R! T. U' J( M. a; `9 ^ ( o4 H1 }' q, ^, V5 E( I
' e6 ~1 u; ?5 z" X if(this.getobjstyle(node,"display") == "none" || L" E+ X7 V. y3 O; X) e
this.getobjstyle(node,"visibility") =="hidden" ||* [* j, c* V" [4 O# \0 r& {
parseInt(this.getobjstyle(node,"font-size")) == 0)
% N: `$ l. K% j1 | {2 H8 X4 x2 |3 N8 ?. ~
if(debug)
# g& t# N, U2 s& z* d3 w/ C {# ]* |5 R; G ^; O( e% J
alert("remove invisiable!");
: D! ~( B7 u/ s) `$ ^( Q; U+ r }2 P" z+ |8 l3 v& p+ A3 M6 y# i
node.parentNode.removeChild(node);
" t) |7 [& K4 x! e, y( x( y % q0 ?+ x" u5 W$ o! c5 G8 j+ A
}: v* X" e: g+ o+ T
else 7 f$ ^+ S: S* |5 k, C- w1 |
{
9 ?, w* c6 P( V- J, `" N if(node.parentNode)
- H4 ]; r' K% m% E. ~8 y6 w" }* S {2 U9 `$ Q) [. |; [% d
var orgNode=node;
3 c2 S: o0 B# w& \, ~% o var orgColor=this.getobjstyle(orgNode,"color"), L, O0 B, P. z3 Q1 `, j
var orgRGB=getRGB(orgColor);
" |9 \$ t' o9 ?* Y0 u. m/ T
. y; U; ~ {$ f$ o! R8 p var parentNode=node.parentNode
, g- h( s5 g* J3 { var parentBgColor=this.getobjstyle(parentNode,"background-color");; u7 N8 [, K& V3 | c& G- H
! S3 V( B( y$ I% A4 b) Z8 i var isLast=false;9 M" l% ^' @( [" c2 r
& D u7 y# j6 ]- A9 y: M# F' _1 e while(parentBgColor == "transparent")
) P- `5 S* X+ |8 X, o2 l' U+ E {* W0 z6 \5 V; N, U7 Y
( T, M" {9 o( i7 q7 u a
+ a; `6 [0 o$ u) |5 k! Y if(parentNode.parentNode == null)- ~& Y& v2 M% P) x, \1 Z
{6 a4 n% M4 g* g+ M5 H+ S
isLast=true;5 k4 y/ d8 q! F6 H! C/ U
break;* f n3 U1 u( }: c
}
$ u4 A- L& H: X% R: p2 y0 i% v2 I parentNode=parentNode.parentNode;
% b, c: [- {* F" u parentBgColor=this.getobjstyle(parentNode,"background-color");; c" q3 J+ t+ X' m6 \
9 x0 h8 m5 a/ b+ O8 v
if(parentBgColor != "transparent") # Y9 p' k$ J: d
{
% p5 S0 W/ _8 g break;
6 |0 {! p! a! }* [$ M5 X! Y }
" n! X' X6 @2 p% O }$ m1 k1 T2 V2 X( {; ?, O
if(isLast) $ C/ V2 d( ?2 q6 T% Z0 R
{; @; J$ Z1 D# ^/ V
if(debug), `1 H) ]% w, X
{6 M' L( y) o. ^ l2 l; O" t$ r/ T
alert("last!!");0 T) }% J, f1 `. n0 S; G
}
" e' p O0 @) x2 R if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
3 A" M5 s& y$ Y& o% d9 F {' A: R+ ^' ~; D8 F- M0 a
orgNode.parentNode.removeChild(orgNode); g C+ ?# V2 D& |, |3 R& O1 u
}
) a9 {5 b* P5 \1 g' j }/ A2 k* q- V8 }6 f
else' X6 B# ^9 K6 w7 E5 Z- y6 `
{3 _8 S. M$ k. J: g& y4 r" w" C
if(debug)
0 a0 B: Z5 h- E3 V% d# q6 L5 p# i* [ {2 V* m# w3 H1 i Q! ]# d" U) _
alert("compare color and parent bgcolor!");
! _2 X& I. y. b5 d }
+ H* h* @6 J K4 \$ @ parentBgRGB=getRGB(parentBgColor);% {" E9 T4 ~' ?
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
* j# O3 J% b3 R {1 d+ ~! x4 B% x: E: O
orgNode.parentNode.removeChild(orgNode); & G0 k4 A. \2 S# c7 j
}$ M! b. D, K7 X$ o5 h6 L! k! m# j P
}7 q4 A f e/ |$ j7 M
}& _% _" S7 q% H( e. `
}
2 |/ z& l1 @. @# p) ] }) d; J! [+ i% K
}! i% |' ^% [/ ^0 [$ f. X7 h& T
% F0 \+ C% \. u* C ! g7 h3 w" }( \' n3 d M' c5 _$ R
var itemFrames = page.getElementsByTagName("frame");' S& _- b, h7 n b* E3 F
var itemiFrames = page.getElementsByTagName("iframe");/ n' r# l* X5 `3 {; O% t$ G5 q
) E1 y" K. `6 G! L9 U3 h* h( a/ P var frame, iframe;3 S+ _4 k h/ T( `0 u9 N
if (itemFrames.length > 0)
7 V1 D3 X: A# h3 C6 Q {
! n9 }) F! K! J/ t for (var i = 0 ; i< itemFrames.length ; i++) $ w5 Q& ~1 k1 A1 P8 e h
{
9 D( _6 Q. [/ ]4 Z' B7 C9 h frame = itemFrames.contentDocument;
9 J4 b% Z7 ] h4 J4 w$ f1 D* D0 m2 u4 w this.RemoveHide(frame,objname); C5 W j6 s3 g% Y% O w( }3 c
}' ~: w% w3 H' \8 R8 d0 @. F
}
' G( f& ]9 j4 F if (itemiFrames.length > 0)
8 V9 |# C& [) Y& E, Q {
8 g/ V+ k% }3 \: L, v9 n1 w' _ for (var i = 0 ; i < itemiFrames.length ; i++)
, I A9 m9 r3 e {
! M+ ]& h7 V1 c4 N4 e iframe = itemiFrames.contentDocument;4 [" q# O5 ?9 _4 M8 u- S
this.RemoveHide(iframe,objname);
* y" d/ u, k1 H! {! U/ c7 G$ K% t }
( f$ ]6 ^1 c- ]! W# g) ? }
# c% H h: R% ?& | m2 U; D3 \ }& l/ S2 x! ?& ~( {, }! M$ X+ Q
catch(e)* n" k% G/ [/ ^9 k" v4 i
{$ x8 @! D; A( I; G2 l4 m
if(debug)
# t, q" S7 e1 B7 x9 B {
3 k/ k. S% |+ t! l( {* G0 I alert(e.message);0 z, L1 b v$ V6 W& i
} {' s2 [( `( e6 h9 G
}9 Q% m; }; q- a+ C) g/ W$ r
}
5 Q* ] `3 J! v, |) U
/ l D0 e+ \8 y}: z2 Q; _8 h: f
+ P( G1 [1 r) @
function getRGB(colorString)7 E6 N5 ^$ J8 g+ e: g. g- m4 p* E
{
* Y* ^3 A' i' W5 v2 a* a var RGB = new Array;
! A. d1 F; m" a- @ var tempSting=colorString.substring(4,colorString.length-1);2 `. f3 r& }# E d4 I4 i
var tempArray=tempSting.split(",");
: @3 [( q6 Q9 i, W5 u
3 e* `: z; g/ b0 g9 E RGB[0]=parseInt(tempArray[0]);1 J5 u7 B" \, h) h# i) N
RGB[1]=parseInt(tempArray[1]);0 ~3 ]# ~! j5 [; H' R
RGB[2]=parseInt(tempArray[2]);
& `2 {& t& |8 _0 `/ @: k - Q5 W |( A. f/ p
return RGB;
. O$ v$ e$ m+ w}
& a ~; |9 r# \: e Sfunction keys(evt) 8 Q! I' L/ V( C4 \; e
{ 6 }* X, }/ P e' ?
if(evt.ctrlKey && evt.keyCode=="81")
$ o3 e% Q8 p, B/ u2 n2 W {
5 N, k$ Y- |% O CleanHideObj.on(0,1);
. ?9 \! ]! Y- L- |) t alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
# C, J$ p0 S1 f
0 u7 B2 R3 F' f$ e }
$ k( K0 ]( F& C! i$ H4 X }
% |3 ]9 s- d/ G) n fdocument.addEventListener('keydown', keys, false); 8 K& h* W- g1 F; L5 X0 N! `# q2 n
GM_registerMenuCommand ('Clean Hide',
+ s6 _& ^7 C) |1 |function(e){; x+ A6 t6 E% |) q4 |' d* u& G
CleanHideObj.on(0,1)
: x* j) }6 N+ c1 Dalert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");9 y4 S6 g8 \; O2 ~
});
7 t0 \/ O9 r( r/ _& r/ p |
评分
-
查看全部评分
|