|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 ) L5 k8 @5 C$ w
5 p+ e8 w8 y/ \, l; u, |
火狐插件,用猴子3 h) [7 Y. N1 v
5 _; w6 D( p8 a: ^
var debug=false; & Z2 B& A% Z* s- o
var CleanHideObj=new CleanHideClass();( S8 @+ ]: m5 Z1 @& k1 o
) ?6 n8 W" \" ~( x' e1 ~$ D3 Dfunction CleanHideClass() ; Y" @+ @7 ^, p' X1 ^
{
$ B$ W1 L1 i3 U7 y0 a/ G# g + w' U( o% e1 C% |& G4 o. G' k# Z
this.on=function(id,bMZ)/ f% u' ]/ J% S. \
{/ y! r( e( [# A4 r
, s8 P3 N: R0 K3 i( A- D: u
if(id == 0)* C* {8 z$ X" E& m$ e- r3 V/ v: n8 |
{
3 m+ v' ^- p' q' G; j% p& \ var page=/* document.getElementById("content").contentDocument */document; 4 I- A: n5 W+ x& S5 H
this.RemoveHide(page,"span"); A! e9 C2 j# Y# ~# [3 Q, I7 } c% O
this.RemoveHide(page,"font");
' W) N( k- W2 [0 c/ T! G, `, ` this.RemoveHide(page,"div");
4 Q; ~3 Y- T! F% M7 t* I6 B this.RemoveHide(page,"p");
, Y( t8 ?5 n9 @
+ D& {+ \. r! Z* c }6 b. t2 } }# E$ z( ~* I- b) A, ^) u, P
9 m [5 c( j( z/ M% P9 V
}
8 \7 v3 I/ D6 S% a- _ this.getobjstyle=function(node,prop)/ S) ^/ a! H7 ?. D$ A
{
+ F- k7 a4 S& r# K j' f5 U try- T1 @) ~- Y1 P1 ~9 D
{
" q( `1 Q3 j( h* ` return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);. Y9 T- b: E/ F" g* k
}
( f8 ?- H' E. o2 `# z catch(e)) P- D I( W4 P
{! U1 m7 n3 }5 x6 L7 r7 v; l% s
if(debug)5 A7 Q( B) d2 w
{: L5 Z6 M4 }$ Y
alert(e.message);2 w7 F: u) U& Y" I0 c
}9 [ F% }% i3 f; p
% t" {/ { G) H$ l. m return "200";4 }* I* Q; v- v
}! b: ^* P) \3 E" m Y3 r2 l
}( Z L: x0 u3 k+ [
6 v( T+ _9 `, M- L2 R
this.RemoveHide=function(page,objname)
& u& H7 K+ g( h/ e' A6 Y2 Q/ d { f# ^4 A+ ^% }: O
try0 e8 a$ a: u0 D( @$ B0 @
{9 c7 g/ E; Y2 B7 h
var minValue=15;
- y2 E" t# t4 _! A var objs=page.getElementsByTagName(objname);
% g4 P* w* J0 {! L$ \6 l2 n; w% c
if(objs.length == 0)
3 H, u" i$ W% P4 w3 f1 j {8 ], O5 o; x3 Y0 R" m8 }4 o- q: m
if(debug)
* f b( t+ `! c! H- w0 p {# W7 H. {1 {3 [' z n2 o4 \+ k
alert("no object found!:"+objname);- ~* A5 U) R0 f" t+ t. L1 p
}
0 W1 O7 q$ p4 p% ?+ f }. i5 r' ]8 T( T3 v
else
$ z J% F4 w& W, w/ Y; p Q {
; R- j, b6 e$ \& b! x B5 B
& q2 @4 L, y4 [7 Y for(var i=objs.length-1;i>=0;i--)
1 I0 _' G2 a; R" V {
+ v7 a1 {1 ?% l* X) H var node=objs.item(i); 2 j5 o# D/ j! W- h g- C
9 N; O/ F7 E. r4 b% m& D4 r$ m
& C+ Q! l7 K, b7 c. ^ if(this.getobjstyle(node,"display") == "none" ||" i5 j1 R% g* g" N+ w' F" g
this.getobjstyle(node,"visibility") =="hidden" ||
5 Z. F- p8 M3 e/ R+ @! e7 n parseInt(this.getobjstyle(node,"font-size")) == 0) + X7 U) `9 h, u& p+ s H, k: A! `
{
/ F# X2 \; r8 {3 m3 Y6 F1 f if(debug)! _" a8 h) D/ J* X/ u
{- R( q3 K' p$ w% x
alert("remove invisiable!");
1 y2 d3 Q) ?4 B! [2 P7 a- k7 p' E }
% Y# p: m2 g( S# y- g6 l node.parentNode.removeChild(node);# `9 o- l" T2 Y9 f4 z
: I1 I) G1 Z7 }3 h) {6 y
}
6 G" C' u" A x6 ?! @$ y& l else 8 s. {+ e3 A8 h; d$ M
{# ?. Y9 B6 c3 C: b! b8 M
if(node.parentNode)
$ P, w" t) O) m* b6 z/ e0 V {% ?9 ~' J8 a/ P S$ w( B: Z
var orgNode=node;
* n+ f ~0 ^4 O/ b* Z1 z3 y# _% o var orgColor=this.getobjstyle(orgNode,"color")( r5 \1 N. x' j) M
var orgRGB=getRGB(orgColor); 5 N8 i- n5 F# T$ K
4 `/ x5 g" ` q7 ?1 l; e# M var parentNode=node.parentNode
7 q/ V0 L7 D2 u, D& Z, R var parentBgColor=this.getobjstyle(parentNode,"background-color");
& `3 @7 Y4 ?( W$ _4 m# ?/ C
# Q0 C7 d9 Z4 E9 C" E: O var isLast=false;* l& v& w+ D" ?- j% D+ W9 z
3 q$ f3 P# z1 c, E: b9 | while(parentBgColor == "transparent") 0 \/ x7 Z- M2 V$ B$ H
{
3 @ g7 _4 ^6 _ 0 m: N5 q& K5 x. s# Q& Y e( X
; B, `# C/ r9 S7 J: d: @
if(parentNode.parentNode == null)! N: ?$ _' O; I- a: U
{# u0 a9 P) U9 M2 {9 i- N7 `
isLast=true;
7 j) Y e" _4 S) Q; p break;( f2 w5 h+ Q# U- A
}) S6 B6 O( L7 \
parentNode=parentNode.parentNode;
/ B7 _, U, U# T8 [ parentBgColor=this.getobjstyle(parentNode,"background-color");' q: l& @' v" c2 }
0 W+ N, |, J# G$ b
if(parentBgColor != "transparent") / N7 m5 L V) x# W! W' x
{
1 T9 K* Q2 X8 i$ }! t/ H) ] break;) G2 c: n8 S0 [( w( m& v8 y! n
}& f. M1 O( X: U: U' F& Q% t
}
& G9 \* g; V* A# M, M& r+ m if(isLast) 2 l+ f' d4 @* [* [$ w8 `3 F
{
2 t: ]8 `* t/ @1 Z* `5 a+ R if(debug)8 H# { m1 T- J
{; h( V( w4 [" d" S+ P; f* F& i
alert("last!!");
q7 _ V+ A- e8 T4 l7 b( `, G( W }
/ x6 c8 B' O/ ]3 \. i4 Z# Q: ?/ _ if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))( c# |$ ]" k4 f) ]; v# G
{
. h9 l* n: ^: z* T# L orgNode.parentNode.removeChild(orgNode);
8 {! |2 k1 L5 T: A. S }% o5 a- w3 s8 P4 K# |
}' J9 k; z/ R1 n* [: l
else+ q- \2 h `0 C# _3 Z( ~% f# A
{: D2 {0 I% q' B" _9 {) s, U
if(debug)
, O x6 a/ y0 Y7 {; L/ O- i {# @5 K. i+ J5 Y! q4 d% {5 ]
alert("compare color and parent bgcolor!");
# ^% r0 X$ \4 l( M$ U/ E }
5 n' D) M. q: n7 R; G4 w# i" p parentBgRGB=getRGB(parentBgColor);
}$ x1 P" ?0 |, k* F8 P: d8 y if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
0 _8 s9 I" }5 u% Z& x( L {, b& v1 Z$ O$ P/ M( l7 S$ Z/ o
orgNode.parentNode.removeChild(orgNode);
+ i6 d9 B& z9 k. T9 V }: m8 g' }/ Z0 h' c" t
}3 n# q6 @) y. w/ y* Z6 N/ m
}; s) w2 j; @2 g8 M
}/ L9 d3 G, j" g! R0 M
}2 J' x; G# r: Y* U( E
}
# K' @0 e" X1 Z9 I2 A/ q. V' |: w1 f
6 ]: `& ^6 d, N- l0 L. o! P8 z
* J# n2 A: |# | var itemFrames = page.getElementsByTagName("frame");
: U' ^% X9 H/ [ var itemiFrames = page.getElementsByTagName("iframe");
* h" K5 y# c( G* N, ^
6 P" d3 y5 |6 v8 C' e var frame, iframe;6 G1 I; n& T0 `( e5 s0 ^
if (itemFrames.length > 0)
6 p1 \; v6 d7 h( H& c2 K) w c {
1 \3 x9 v0 `5 x ^/ S! [, | for (var i = 0 ; i< itemFrames.length ; i++)
$ ^ y2 `3 r3 a% h: W, V6 O1 s6 f {, Z/ u+ @4 L4 U
frame = itemFrames.contentDocument;
8 Q$ ~: f5 X9 {1 A' T: s* ^ this.RemoveHide(frame,objname);
6 b' ` K; l2 w/ U0 @: Q }" n5 E1 v9 x, C* k8 d
}
5 s2 D1 G5 F$ |& O if (itemiFrames.length > 0)
( I% p/ Y7 p( j( p& W7 e, R {9 w& ?. Z4 R3 ?$ ^
for (var i = 0 ; i < itemiFrames.length ; i++) % ]! o0 G& F b ~! a
{
! b1 ]1 I: E D( i& M& X y" j) r. @ iframe = itemiFrames.contentDocument;# z& I6 y7 M$ [' @2 h) B: f9 N
this.RemoveHide(iframe,objname); / v. { [/ L. a/ A6 R
}4 M! {* ?$ \) o: D
}0 x1 v& n* T5 C" t, T, V+ ?" F2 g
}% X+ s T4 L* j# k M/ s
catch(e)# g' C3 q, u( }3 b
{8 X9 y0 E) g' N. o
if(debug)
: y% D5 W( X! L) e! B/ l9 Z {9 L; p0 Y0 b. C, D/ ^! A/ c' ~. s# P
alert(e.message);9 L5 y! t& r$ S8 I- g& \
}7 M& J) e- I, {1 G
}6 p! B; `& W" S4 v* j: U
}
3 [' }; b9 @: U% B |5 W4 m" p
; R' t9 p2 D$ r5 B" V}
1 V$ I9 G! H/ @" w; v/ x- t" s. u
4 U7 Q) e+ R2 L" g: cfunction getRGB(colorString)& M4 j6 Z6 E/ v/ b
{
) A9 U+ E* H3 [9 d, @5 { var RGB = new Array;
: ]" P: D! O- E4 [$ r var tempSting=colorString.substring(4,colorString.length-1);
5 j1 q: v: a1 S, ^ var tempArray=tempSting.split(",");
8 z: C( P4 N9 e4 Z9 ]4 ^6 {4 u$ y5 b4 z
RGB[0]=parseInt(tempArray[0]);1 |( q' X+ p# s+ k
RGB[1]=parseInt(tempArray[1]);9 C4 P1 f# I: f- R- X
RGB[2]=parseInt(tempArray[2]);
% Y9 h$ [# G. H9 }. v% \
, y; j- G0 l: i5 m0 F return RGB;' C8 ~+ }. R6 B0 _$ N* d
}, f; }) R& o, h1 \' _# k
function keys(evt)
) j8 @- R6 z+ o. T { " {3 H$ Y- P: l- r: ^# N
if(evt.ctrlKey && evt.keyCode=="81") & B* `( k7 @6 A
{ 2 D8 u8 M+ w- ~; m) B+ ]# P& w5 t; r
CleanHideObj.on(0,1);( q( V9 N- m4 j
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); 7 ]2 s% I2 r2 d2 m/ W" ]- m; M
4 D: _. \. o/ H7 q# I/ N6 }9 I/ ]
}
- m4 m( C* v S& m k( F, n- R) [ }
5 u* D7 o" o9 G! N" p9 X$ ?. `document.addEventListener('keydown', keys, false);
& O1 u; b0 @& n, S; qGM_registerMenuCommand ('Clean Hide'," f( W) s: G8 _6 n; M2 E( o
function(e){
% j0 } Y$ l) ]; e/ f hCleanHideObj.on(0,1)) X; a0 R. P3 F6 P5 Z+ o
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
' E, o3 V6 V3 u- ~});) Y# n5 q; N. R4 F/ P5 f
|
评分
-
查看全部评分
|