|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
8 Z1 Y0 n' l2 u" C1 L2 |" j( z3 J- `0 w* g& w, ^: _+ x
火狐插件,用猴子
G0 q) x t3 i5 l! P' X7 {
2 L( E, `$ D& D3 Bvar debug=false;
- R' G/ l# E }4 ^: v: Q* I4 ~var CleanHideObj=new CleanHideClass();
3 Y* C2 r: N7 H# L7 @' V; h: l% ]3 Q7 O" ^ n
function CleanHideClass() ( p9 Q) r; Z' o
{ ; Z% {% I# r% y' D. u( r/ P
: \; {" @4 B0 ^3 W# c) }5 X/ e this.on=function(id,bMZ)
* x$ q) N- G, g5 ]- h4 a {
: d' ?- V% q0 m7 D; s2 M6 r8 X
0 j& i4 e# D( }# C }3 _9 N* m if(id == 0)
& B; T& _2 o' J+ u, x1 V$ { {
. c7 h3 _) s3 s& D5 X% T var page=/* document.getElementById("content").contentDocument */document; 2 \ y& W& G6 i9 i8 _2 f
this.RemoveHide(page,"span");1 L7 _& p/ M4 Q
this.RemoveHide(page,"font");% |% E) y1 R! M6 z* g, m4 J9 f. M
this.RemoveHide(page,"div");8 i" b5 M( s, @8 C7 h
this.RemoveHide(page,"p");
: {0 h: m7 n3 l0 d7 t
$ p4 O9 B* z1 x Y9 z0 c b+ g }; O2 T) H3 g: Y8 ]
7 o( T8 i7 g. j! q* }5 X* }$ q0 D }+ r2 j5 z( Z( h; K6 @
this.getobjstyle=function(node,prop)8 ]0 [( ]9 T* v9 K5 G
{1 F$ h+ k2 P7 n5 C1 `
try
* T& q+ b) W, s) `8 ^ U7 m {
$ S7 I% i8 e1 D; j) K# L return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
4 A" n" U9 Y, `6 I" |) _0 o+ L }- q$ E+ _6 d( | |% Q# |, d1 j
catch(e); }5 _- R8 p3 R4 @: c R2 l9 [+ h
{: ~3 s3 U( f! P9 K2 a. b
if(debug)$ S* F w- j( n* Z9 `* C
{& K! }+ y+ _* K
alert(e.message);
) @& v- h H k: [! Y# ?) O: ? }+ F& i, }5 m; r1 Y! _: C9 g
/ ? W$ V- q p- ?: V/ L
return "200";
$ V: c; }+ l, I7 J. L }* F5 Y; f% d5 M* y" G( [1 v8 ]9 O
}
* l2 [, }/ s* N7 I' {2 X
- _) q3 _: {# B$ j% E t& [2 r this.RemoveHide=function(page,objname)" K# r2 o7 }- ?9 A
{$ q; Y4 j9 M- ^. X6 K+ _
try
+ ?7 ^: J- a4 N: Z" @ {) A: k, H7 c( V; t ^
var minValue=15;: X- H/ M: S0 H* t# A. d$ L$ a# O
var objs=page.getElementsByTagName(objname);
, q0 O* ^9 w' [* P) S1 S+ t! W$ P, c8 i
if(objs.length == 0) $ j+ Q) f# R- p; \ q! }& u4 ~3 R
{
* ]3 v: Z, O0 N) ?# d if(debug)
" C. s' c6 a) ~( h {4 Y- v% I0 g! F& [) y
alert("no object found!:"+objname);
. q/ `$ x8 ~$ W8 k, @8 x# U" ~( z }. `5 d( y9 V+ Q7 ]2 W# m2 }7 z
}
5 r1 n2 j0 ]& \, b, j/ V `. h else
3 V7 }: q, c$ u; O! b4 L {- ~7 u; }+ q, g$ ~3 S5 o" P0 g
6 S. {7 L' w9 d" ~3 B4 r, D for(var i=objs.length-1;i>=0;i--) 8 y+ V" I& d0 s" I0 S+ ^- I. |7 _
{9 n8 _8 G6 G/ K
var node=objs.item(i); 5 |, g! F8 T; H: J7 j
1 V& N9 N4 T' `5 U/ e" ^
; W/ L. ?8 d' v/ o: I if(this.getobjstyle(node,"display") == "none" ||
5 W: Z* P/ O! {5 b this.getobjstyle(node,"visibility") =="hidden" ||
$ |8 `5 r4 |" y7 Q4 s4 r' R5 P) z parseInt(this.getobjstyle(node,"font-size")) == 0)
V; |5 t; B& j- @* z2 `6 z1 c {2 R2 d- A- X9 z; |! ^# T1 k/ t
if(debug)$ [' k/ t' Q5 N' r
{
M. t# \7 E$ f; A3 A- v, A5 X alert("remove invisiable!");
0 `# H1 J2 C9 K) U p }% x& j4 {5 o$ j$ v
node.parentNode.removeChild(node);
/ e+ t9 H- u9 M2 x2 I" P: [9 C3 x
$ T3 ^# L5 O& j4 u3 F1 ] }
' B, B: ]7 C7 r- ]; n7 Y else 6 @- u9 q; W2 z2 G# H
{ N( G! L2 K; N$ l
if(node.parentNode) ! Q; b+ r, J. l3 [8 z, A
{8 ^" B3 u! `9 I6 F$ ^
var orgNode=node;
2 k9 S) T! ~6 y- C var orgColor=this.getobjstyle(orgNode,"color"): h! u& x/ w% [$ e" K( a7 d5 b
var orgRGB=getRGB(orgColor); 8 }9 `$ ]& |0 X9 a% p% E
6 J9 ]6 [9 D4 [: _, Z var parentNode=node.parentNode8 W: z5 S$ g0 V8 n* g- K h/ G
var parentBgColor=this.getobjstyle(parentNode,"background-color");3 P" K% k4 @. u' B
" S# v# e9 ` B% s1 w' S
var isLast=false;
1 x2 H4 P% ~6 L5 M$ o" k; n
' z1 W8 N) s. y5 m9 f3 i while(parentBgColor == "transparent") 6 [: W5 X n7 F" n0 H# U+ c+ ^
{2 a8 U1 \3 _ F' F- O5 u
' ~* d0 v5 r% Y$ T3 W7 t
1 r) _+ }! e' O5 o if(parentNode.parentNode == null): h0 b f- a0 D/ [. P
{5 a+ p5 |: k( p5 y& E
isLast=true;% s9 k% i/ j1 g5 C
break;
$ q* r M" a9 T9 Q }, c6 t, w2 M; _6 u- g' J* m( M
parentNode=parentNode.parentNode;
# j8 i, p7 i7 w parentBgColor=this.getobjstyle(parentNode,"background-color");% @0 Q9 ?% h: W
/ @1 \8 d1 e3 A6 ~/ e" [ if(parentBgColor != "transparent") 4 M9 L& J" S' B, Y* _
{5 [( s; Q( c3 ]8 [7 U. F H3 j" A
break;- |- b2 {9 S0 @9 ` x5 P' ~* ]5 I+ C
}- Y) d0 j% A9 E$ C) K
}! D- w5 g J, S* S
if(isLast) , _7 E0 R9 H h, h/ o8 J5 h' O: [& H
{
$ a0 L. O. b& n* K N+ u if(debug). B. @. e" w3 ]8 g7 v! g
{
8 V3 A3 Q7 m+ w$ z6 L: X& k alert("last!!");6 z' o. f' s, I
}7 d H3 P; D" O, H" g
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
4 J ~, I; ^# c# R {
* m; U5 K m# o8 e7 o( z orgNode.parentNode.removeChild(orgNode); + l# l4 @/ o. f, C) B/ K
}: ?1 z2 t9 i7 {4 _
}
( J' f! D; P! ^) H# ~ else! t- p; U$ L _8 p- @
{, e: {6 B( B& { L; W# c9 s5 e; [
if(debug)0 E4 @) y! g8 q! F& [# _
{* _3 r% i& X' v c- Z
alert("compare color and parent bgcolor!");
) i' i. Y6 _3 E$ G$ T8 b }
" f7 ~+ R# Z/ m R$ K8 z$ o% F: D1 N+ ` parentBgRGB=getRGB(parentBgColor);: C3 j& O4 Z* b8 N( A& n
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))" \6 `- ?8 f4 v: y' E
{
1 E! j1 t5 h0 R. `' }8 B6 A4 A% r orgNode.parentNode.removeChild(orgNode); " L/ G" _9 q0 J" ^7 W: M* \
}. B3 X% q# \5 |% } E' O F
}
3 n0 w. f3 O4 F/ t }. o0 J6 l2 F9 r
}3 o+ M- @) w+ y6 d4 h
}; a+ _2 \$ k8 h5 ]7 ^8 p3 K
}
# w( p C" H; W8 b9 Z; e) P( @; U ^ t % `* S9 t+ @$ U, Z) k3 u; V
9 ^! |9 Z" ^( }
var itemFrames = page.getElementsByTagName("frame");
* E0 i* H; K( H$ \% Z0 P0 } var itemiFrames = page.getElementsByTagName("iframe");
- N7 T! G0 V8 z( p; J0 m ) |: {$ `, J$ C. |
var frame, iframe;
: T# A1 }" ]: l! S9 O if (itemFrames.length > 0)' ?1 S2 f# w9 @8 \7 q- \* c. S' z, h
{& O- U# M- B, X5 ]5 w+ G1 P
for (var i = 0 ; i< itemFrames.length ; i++) , x4 ]; R* ?# v' K3 b9 F
{
3 w- N; i7 s0 D m F% E5 j8 Y frame = itemFrames.contentDocument;% g9 {; ^2 Q' u c6 M
this.RemoveHide(frame,objname); , o) b. Y& n; N4 x6 g- J3 L" G
}3 G, t7 E6 L7 K* q$ {2 [8 Q
}0 I$ d' v( o" ?' z
if (itemiFrames.length > 0)7 X- d+ |& F% `
{
$ p8 H% z' }3 ? for (var i = 0 ; i < itemiFrames.length ; i++)
- `5 w- B- _$ R8 _0 \ {
4 X& e2 h7 V4 n9 i5 s. l& w0 K1 J iframe = itemiFrames.contentDocument;! J/ w+ g1 t4 p* e: U' J9 Q
this.RemoveHide(iframe,objname); 4 J, `: C5 C' M1 o% K" H A$ w5 e
}
`; _9 n% p2 S }
5 a7 d) Q7 t) N% g% R- {# q }
1 [/ G* Q9 E( A, ` catch(e)
$ a4 t. O$ D# R( g9 p {
) S' z I1 b" g) M- A0 q( g! M" o, u if(debug)6 @. I7 `/ Z' I! d; v4 }+ [
{
& [0 N" F/ ^; X# n- ]3 Z. T alert(e.message);
9 A, T2 V, A4 g) g6 u5 c }5 r/ O1 p3 t8 N& L
}7 A8 i' a& G0 l, Y# ~& S
}
$ R8 N6 y1 A6 D- y+ w D2 f; y6 `
4 ]6 I. A8 J+ x# x4 }$ d" x}
5 d8 g% t, ^7 Q6 h9 F, K
7 H, Y. f0 y1 S, R. ifunction getRGB(colorString)1 X9 M6 H2 G2 o& d) b, |2 @ W
{; e6 p' }* U) L4 z2 B$ n
var RGB = new Array;
8 Q7 @( D8 {5 X! \% z) e2 Y/ \ var tempSting=colorString.substring(4,colorString.length-1);
2 d- ~1 Z# F0 @ var tempArray=tempSting.split(",");0 m# X$ b& N, N r: A* R" q
1 R2 |$ @' Q; l C RGB[0]=parseInt(tempArray[0]);0 q* m" T" S# ^, }( y% z G
RGB[1]=parseInt(tempArray[1]);0 |6 L! {+ T3 D+ W/ Z
RGB[2]=parseInt(tempArray[2]);6 d* }$ @7 V3 z/ q9 y0 L
; o# g1 @ a+ t& n& R) K6 k* ? return RGB;
- A. V* E9 o8 R% }9 o; M" x0 m}
0 ]" P6 T1 d2 x0 H+ A; Qfunction keys(evt)
: I# j' P' }- ]* |- S- f {
$ H# Y9 P, V& ]# e if(evt.ctrlKey && evt.keyCode=="81")
7 |' A4 `' u4 L2 }2 q! O {
/ d; |3 D4 }, ~6 I N0 m0 ^1 ` CleanHideObj.on(0,1);# T, ~) b) X& P4 m) L4 N
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); 9 N" o* U$ C# z; x) K
& E, P3 ?& b$ n/ K u4 V$ i3 } }
/ e) G+ m! _5 M' J; E! [ } . b& O5 c* Z! p" H: B
document.addEventListener('keydown', keys, false);
- s2 ^$ z. L6 L- ?$ k! VGM_registerMenuCommand ('Clean Hide',! N1 u2 }2 e6 f& f( m* g R5 L
function(e){" o6 ~; j9 _: M4 e- K6 a1 d
CleanHideObj.on(0,1), d: w1 m( Y/ O& u# G5 C6 k
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
6 z* T' D: I* b: I. f4 Z});: w" N+ N& f6 n8 G/ C- O
|
评分
-
查看全部评分
|