|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
% z w7 o6 V% [' W& R
0 f+ g' E) x- V1 }; R1 ]( f火狐插件,用猴子: A6 j) H+ Q1 d' Q8 E4 p
z9 q3 ?. P1 `9 R6 L3 tvar debug=false;
+ B+ \' z- {1 M* a) rvar CleanHideObj=new CleanHideClass();
9 ?9 g* {2 }6 [# T2 n
( N) l2 n5 @% wfunction CleanHideClass()
& W' ^# V4 h# _6 r9 Q{
$ n- P, {" ]- J$ @: O6 E% P2 ? # j" b8 H" a3 _
this.on=function(id,bMZ)
' Z# l& d' x+ C$ S {9 L* _6 h* L6 \
9 }0 o. d, f o" I* D2 U5 B
if(id == 0)
5 l0 T, m/ W2 Q9 s {1 u9 u8 T# r$ t
var page=/* document.getElementById("content").contentDocument */document;
8 v" A/ G# u, ~) x$ F3 Z this.RemoveHide(page,"span");
9 Z, f. w# d3 o3 L; E this.RemoveHide(page,"font");7 p+ x5 q( B0 t# {8 ?5 }! z
this.RemoveHide(page,"div");
. z/ `7 R, ~/ e1 L1 e this.RemoveHide(page,"p");& n$ x1 Z% P0 X; J/ q) [: A
* z! L- X" n7 ^! H }
5 J0 Q4 }) b( s) z, g; U/ e; C
2 U$ J8 e; q$ j+ ]$ j }
7 D6 |. O5 [ @ K$ A7 D this.getobjstyle=function(node,prop)8 P, ]4 t. J0 W! i9 q- @ }- i
{: d4 f6 ], V( |
try
* U8 T- V ^2 t2 N2 I; Q* o {
# Y- e+ z7 A; e3 ~- [ return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);9 ^: z3 {* ]8 }! G2 \
}
# b1 d- [" \7 r2 M! T7 L; r D catch(e)
; y1 g8 S2 t, }+ F {$ @! e. u' |% T- V s5 d0 {% W
if(debug) ?5 K& ~; g, r8 Y. j
{
0 g6 c" @& ^5 n alert(e.message);% W9 s; z: a O4 \; C% T1 G
}5 O; o! H' h# P3 C( _( u* I% }
( J) p0 ?( O+ h* _' y return "200";7 c+ D' m4 I! B, u6 f' g- F
}- V' ^% z$ C( l+ R u2 ~
} I2 o/ f: d, y5 l* |
8 z8 [" {1 p# e this.RemoveHide=function(page,objname)
/ Q1 q2 p3 N1 x3 g {
/ g$ m7 x2 ^1 r try
# m6 y$ F+ K$ e {
?0 H6 j: \" B! w0 N0 k2 p var minValue=15;" @# g% X, J; h `5 X$ P9 I
var objs=page.getElementsByTagName(objname); ! _ l) N4 J& C% i4 W2 l
9 Q6 @% e0 c7 f if(objs.length == 0) ( X3 ? u; J/ ?. k
{
$ m1 q( X' x! J3 B% D' H& ^ if(debug)
$ @; d+ Y+ a. l2 i" E {5 @3 Y3 T9 s0 g$ B) U
alert("no object found!:"+objname);7 Y9 T, b. ~, E2 I
}6 P6 H/ B- e I: M+ ~
}
. w! b+ h& @1 d else
, @- T0 R0 N% X) M6 k {
, L2 W# f+ u+ ^9 I: ?
3 m4 u& Q' k0 G for(var i=objs.length-1;i>=0;i--)
0 ^* m0 Z0 Q. W {! j3 l% [' Y- d$ O. u
var node=objs.item(i); / V+ A8 ]# S9 |! _
* w3 U6 g$ @' N& q9 l7 b: H! x% \
* c+ B( N# l, N' j1 r1 | if(this.getobjstyle(node,"display") == "none" ||
% _; F2 {9 |1 `( p- X* D this.getobjstyle(node,"visibility") =="hidden" ||
) Y" h5 a% C4 n2 p" D2 U9 x parseInt(this.getobjstyle(node,"font-size")) == 0)
+ i4 r8 ?6 O0 y! \' _% b+ @* e, E {
" B9 s/ k5 X9 h- t6 G/ C0 G5 f if(debug)
1 ]" f! G, N( r4 o2 z {
! Y6 A& r: w2 q$ E$ K7 | alert("remove invisiable!");. w# ^# h) ?: I3 k$ Q
}! o2 O: M5 K$ D# Z) I+ G( m6 u3 I1 t
node.parentNode.removeChild(node);% |! O1 d, w* E7 c6 `, ^8 @
) u* k: U( a, [
}
- |' L( k" i) `- G0 p8 \# N else
. J, G6 l; l- D( _0 l+ Z {4 k: S2 ^. t+ j8 a
if(node.parentNode)
, Z$ H# x: h& F% F {. N: d% Q t# p( T7 q' w
var orgNode=node;- |6 Z2 x2 M# D8 L) |2 ^1 d8 F
var orgColor=this.getobjstyle(orgNode,"color")
9 j J4 k4 r# Q, r" i4 L var orgRGB=getRGB(orgColor);
6 ~+ A' B3 N5 v" a) p5 d. w$ {. |$ ~
, r; ]' E# J- z. ^9 U var parentNode=node.parentNode
* W5 _+ I/ I: S( @ var parentBgColor=this.getobjstyle(parentNode,"background-color");
2 s$ ^! y6 n0 D, ?( ]- g' I
* A* i1 \8 I4 E' m: g' F7 S var isLast=false;2 L6 y. t' R7 u! ~9 P6 ^9 x$ @- Q
T% E0 |) b1 |& G9 V2 H
while(parentBgColor == "transparent")
) y5 j5 B' `0 U1 J5 P {
4 [0 a6 }( `7 u3 d 6 X1 M, D8 J( X5 s
. Z7 v- x. y) j h& ] if(parentNode.parentNode == null)
! o, G2 j8 n) ]& \ {
+ L8 u' }1 \% g6 n: Y9 s/ w isLast=true;
% {, \: d* a k$ e5 C break;* k; U+ d5 n$ G# b+ N
}
3 }+ i: b+ Z3 w2 E" L! e parentNode=parentNode.parentNode;6 J" H+ }2 G7 G; ~& s9 z
parentBgColor=this.getobjstyle(parentNode,"background-color");
# ~& f3 f( ~9 J& p. @
; i) i/ E; z) t0 f ~ if(parentBgColor != "transparent") & Y$ k! z9 y& v m v q* w
{
" X- v& C5 } m4 ?7 U$ b break;0 x/ {+ X8 I% V
}7 x9 [; ]9 Y& z9 R5 X
}( R- u, J# D$ V7 J) z! q
if(isLast)
0 u/ F8 w9 } r' P {2 _$ s" F' D3 n" X l
if(debug)) G: m& L% H8 s" u
{& H- Q' I& H1 K4 D* k
alert("last!!");- T' s0 y! g/ P3 q, D& u& B2 t( j7 |
}
4 |% P# |/ h1 o* e if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
+ M& p/ [* C8 I* Y {; ], u: {/ M V
orgNode.parentNode.removeChild(orgNode); " D. i0 j7 V7 |3 y5 W7 K: H
}
9 a4 A `1 a- C$ `# ]. K4 v/ v }
% l/ x1 J! E4 i8 g. Y9 e else
5 v) t" b% x! _' C {
2 Z3 c* r4 W2 q7 V8 \ if(debug)
, M# P- g& B. Q( \ {
7 I S, N$ `2 ]' C+ A alert("compare color and parent bgcolor!");, l6 e5 g- G+ P
}/ x8 i0 z$ v; J! S2 j; y( F
parentBgRGB=getRGB(parentBgColor);
' p! Y" s* l( N5 U9 Q u' u if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))2 _6 } h9 R, G2 x( H
{
3 ^1 s& A2 ^/ _6 d) C orgNode.parentNode.removeChild(orgNode);
( g: X. p5 d# R& u2 K }
6 {+ R) s- f* E9 U# A }
: H! W, r z2 T& C% x( h! F }
8 F$ n, S8 C O: `( ~ }
0 k2 R2 c* e4 t }
8 z' p$ F7 U6 J+ e) Q }
6 D5 o( U* A X4 i1 D * T$ }! S2 c: e5 [3 M
* h: `8 ~6 P' C8 _+ d var itemFrames = page.getElementsByTagName("frame");) r0 ?) s3 W) h7 j2 F1 t6 g- x
var itemiFrames = page.getElementsByTagName("iframe");
: h2 J4 W4 j2 D' U) t7 o! o
2 G/ R% o" l H2 J( }, O3 F5 k var frame, iframe;) |7 T0 o- L; S3 e
if (itemFrames.length > 0)
* m) M1 k2 T- a$ B! I3 L& o8 X {
4 M- Q9 x% o! } for (var i = 0 ; i< itemFrames.length ; i++) # p7 ]; X+ S7 A( e: c
{
8 E9 B T& ~& g0 h: ^ frame = itemFrames.contentDocument;
5 Y# Q! y+ j, [. h- e1 H5 R* } this.RemoveHide(frame,objname); 7 C+ w8 \ Q. O+ l4 ]& _; T
}. C( X: I* K1 w3 o/ d; Z( C9 I% e
}; G" G) D% ~3 T* R2 y
if (itemiFrames.length > 0)2 r$ ]3 J( \8 Q3 P% y
{& L7 F) v# j f: l
for (var i = 0 ; i < itemiFrames.length ; i++)
7 i& C% d2 Y& x0 g {+ g! M2 }3 y+ O
iframe = itemiFrames.contentDocument;
/ m5 X) E4 \, K this.RemoveHide(iframe,objname); 8 ~$ u) @& }8 W& ~( n
}2 W$ _- o- p( c" s0 z$ T/ t6 k' G# }1 ~
}, i3 ?7 Z/ b9 \! k
}
% w9 X" ?# Y# P& i catch(e), f: S1 h7 b7 J2 a
{
/ N* I1 e& I. ^- ^0 ~# }3 z u if(debug)
8 ?" r( h0 j7 g1 v1 G, g6 T C$ ~ {. U8 R, n' t' N; w% k, f% Z
alert(e.message);
, ?* h( V- j, Z2 ^ }/ w0 M7 G/ T$ [3 c
}
1 J3 i" R1 @# b# P; `; i }
0 A: p1 Q' O& J6 V6 Q7 {6 a4 `( R# d . A7 _9 d' e; \& h% d
}( M1 O/ F5 S0 u* c+ L" X& H
, z" ~" ~+ h# a, T U
function getRGB(colorString): l& A; h, O: z$ z6 H4 \
{
. N# [' Z$ g9 h3 O" Z9 s% C var RGB = new Array; D( x3 v2 y2 l- s3 t
var tempSting=colorString.substring(4,colorString.length-1);
- i. N9 M5 `$ A! C1 Q! t6 ], C8 W var tempArray=tempSting.split(",");
A0 U- C; ^/ L) A) I
* Y4 L$ m- h. c RGB[0]=parseInt(tempArray[0]);
# r& F2 D" H2 j RGB[1]=parseInt(tempArray[1]);( b1 G6 z6 B7 O' c) n+ S3 m
RGB[2]=parseInt(tempArray[2]);
' E" j5 T7 N% _) ~" Y: R2 W 1 y6 l' B& {) N# v: t" _
return RGB;
3 T) K+ k7 I+ v; h* h: n% q}
" Q( @1 Y0 w5 [6 Y# Z+ Zfunction keys(evt) - F- ]7 ^; D+ Z. f @
{
- U! f* M2 H9 g- }% P if(evt.ctrlKey && evt.keyCode=="81")
; Z. W. I- Y8 X V { " N! B( Y9 E2 N; x8 l% `1 a+ f0 v1 j
CleanHideObj.on(0,1);8 G; H5 m$ z/ ~8 K
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
/ `, g1 A6 ^) R; [6 d0 u! k$ Y
* H5 c; }* `( e } ; f+ @; F# d2 b2 Z S
}
1 m+ }/ `7 Y( Ddocument.addEventListener('keydown', keys, false); ) E2 p u( u* T$ H1 A) [
GM_registerMenuCommand ('Clean Hide',! K6 r3 T$ i# S4 x9 _
function(e){$ U8 O% `1 b: v5 U! k7 g
CleanHideObj.on(0,1)
3 Z$ c# P4 ?0 A* `1 d, a: dalert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
, G( @7 D8 ~9 E5 j});+ |( W1 C- M y
|
评分
-
查看全部评分
|