|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 $ G3 d5 E( o4 c$ B7 Z! v
% t1 G" P+ }' L# d- k% H火狐插件,用猴子
# E. x4 z* {6 q& G. U. Y
1 M( w1 b: `9 |$ Ovar debug=false; 5 k1 \- f" G. g7 K6 B- I, Z
var CleanHideObj=new CleanHideClass();
. e, {6 g Z$ L+ D# ~1 d+ G% W4 @. k& j" l' I/ o7 ?
function CleanHideClass()
3 M) }8 ]6 O+ d9 D% x$ Q% Y" G{ . h+ m8 t% V5 W9 D: B/ `
* H5 j& U: u1 W# q this.on=function(id,bMZ)
) t& F1 H& Z3 T& |! \ {$ K- L% Q( C5 d5 j- {7 t* h7 C
) X% w L p( u6 y8 [
if(id == 0)* m) G, I* E9 A" _$ }) C
{
. ?, u$ r! l l) j6 R/ n( }6 Y var page=/* document.getElementById("content").contentDocument */document; . M. M/ f- s/ {4 D' c
this.RemoveHide(page,"span");7 D- H. z: Y) T# O
this.RemoveHide(page,"font");
$ ~/ D7 r( ~' q% y0 L' D; j" M this.RemoveHide(page,"div");2 V# I6 S/ k+ Z1 c* \7 E# N- p% ^
this.RemoveHide(page,"p");
* j* J) h) D6 o
{4 O# {; Q. T7 `8 q }
; X# I. k$ X5 p% e, y& o; [
6 U Y+ h: s8 N( ~ }# R' E) m9 g# a9 R; a. x: c$ n
this.getobjstyle=function(node,prop)
4 K( J& D6 ?/ ^5 q" L {8 d! u: l% \# z/ [! e: c
try6 P8 f% c6 ^6 v! h- m! D: h: [
{! f0 u. K8 ^9 A: K
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
1 a2 | S9 P( k; y }
( W3 e1 S: A# k% @ catch(e)
w$ _# \2 F9 k: K( v& V6 Y+ {( k2 d {3 m0 x0 u6 `, l9 m1 T' h) J
if(debug)4 u; g, j7 ], `# |6 ~/ W
{
5 B0 W% l6 @3 \ alert(e.message); b1 \- j$ {+ ^8 n
}
# H" P: ?4 Y- `: F$ F
+ a6 z( l* I. H' C, G1 s. k return "200";
# ~6 }8 k: @' v! D T }0 m. c4 h) r- F- j- |
}
$ `) O# O& E7 G- q' L7 a # E& H* G2 T+ M# z$ X1 y+ ?
this.RemoveHide=function(page,objname)
) y5 C* U3 F: k" h3 ?$ @) H0 ^9 \ {
% K* T7 N1 a6 y0 A- T+ G1 y2 @ try
8 R: Y. A" I+ i# ] {+ k' x' b* X& s; O1 G6 o! d
var minValue=15;
& ]1 u3 x# Y0 r# O( w var objs=page.getElementsByTagName(objname);
' s6 n( i% l; u. _$ }- U. X) X- N
/ ^& [+ I% x' G. v/ j8 W if(objs.length == 0)
/ f; e+ N9 {' t6 q- u {# @1 l! N5 U v- p
if(debug)0 }7 V" H' p/ N# Q5 T& w
{
. `" y2 J& W9 ~2 G2 T! b alert("no object found!:"+objname);
; e# N& v: f7 t6 d* l- I7 ]* x }
7 O" _! J& q' E( a0 g. R }
5 r" q' Q8 T5 ~ }' u7 _ else
7 `; `, S, u; |' B( w {
# Y4 m5 H3 G0 v3 x' o1 M* `% X , }' R' M7 k! f+ p0 x9 }2 ^/ q
for(var i=objs.length-1;i>=0;i--)
7 i! S* P, C# J# w5 ^7 E% U1 H {5 K# n# A3 r# o0 E$ g
var node=objs.item(i); # |6 Z: l0 o# E; M) G
# S' @7 Q8 J. w/ M- S& h " ]/ f9 T' l) z# O5 c) I
if(this.getobjstyle(node,"display") == "none" ||
! `* L. c9 i7 M5 s! l, s9 I( `. v2 B! K this.getobjstyle(node,"visibility") =="hidden" ||& q3 B1 w3 S# c- f4 E& J& H. V( d7 R
parseInt(this.getobjstyle(node,"font-size")) == 0) 2 @- K1 P! e# x8 C6 q5 p! L! ]
{
0 \0 @6 w2 @- t; [ if(debug)
o4 q# H" c0 b% ?% S/ p {
- E# ` h$ d6 F6 s2 m( n4 E alert("remove invisiable!");
8 r. o: U" |5 g0 {6 y }
* S) L( m# n& [% k/ Y3 }4 x: V node.parentNode.removeChild(node);3 V/ ?. a# r! {2 J! p# c/ F
T. j( x4 y0 f2 ^( ~6 K; `) t9 k }
: {, g% h& Y6 B. {3 } else
3 j; t- A3 X- S$ G {7 {8 ` |9 F5 f( u. h
if(node.parentNode) % P$ Z: K/ d5 H b5 G
{
7 @" Y! b) U, e- ?# K var orgNode=node;( i% K' J+ j v; C
var orgColor=this.getobjstyle(orgNode,"color")! N* d# q6 S9 `9 H# R
var orgRGB=getRGB(orgColor);
) Z1 G4 R6 i; S r: `3 D
, e; w5 u0 V* i4 n3 i( @+ O/ d var parentNode=node.parentNode
0 ~2 V; X( l6 W! @% `3 W8 W& s9 j3 w6 K var parentBgColor=this.getobjstyle(parentNode,"background-color");: X; v' v7 P9 n# m
8 ~) g7 ]! M8 j! u* f7 s" s var isLast=false;
1 L- @. \ g( x" M( T) k' d
* x$ P7 E2 H+ s/ I! P while(parentBgColor == "transparent")
! T; n" p l8 c+ V0 Y% i {: }2 I7 U w; ]' p5 t: u k" U, M
H9 h! n( U5 E* P% E
0 e% k' W$ m" i" \ if(parentNode.parentNode == null)
( f7 u' k N: Z( D9 b6 Q7 \. L {
' }2 X0 H) w. p4 {1 g! s9 B isLast=true;, f# l6 w9 U, ?2 @# i# \, o
break;
( S6 Z5 c( o' ^8 e1 C1 ] }3 ~% |0 @5 S$ F0 m Z
parentNode=parentNode.parentNode;
1 {5 ~3 m, F/ n) Q; V/ G$ C parentBgColor=this.getobjstyle(parentNode,"background-color");4 T6 x9 ^& o2 ?) n
& B3 B& C; ^! p: G& v) y2 M
if(parentBgColor != "transparent")
1 ?4 s# X* j% @5 ] {! T+ o9 B% x' G: l
break;
6 u* q) Q) ?* I }1 l. t+ i% k: i( w9 |" i
}
% V, h$ b% R+ `+ v" G0 r/ k if(isLast) 5 T0 I7 |; W R& N) B/ W1 p
{! c1 Q! w+ U5 f
if(debug) C/ e, U$ q( `" n' `: R
{, ^! `. F# F# B1 E, n( x
alert("last!!");
* y; u4 f0 H1 ^1 U+ Z6 k }
/ f) N$ R p2 b& b+ }+ h if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))# m2 n! _( c% O7 Z4 F0 U9 b
{
/ D, E) A/ \) A% R* j0 n orgNode.parentNode.removeChild(orgNode); 7 P" q1 B% {" n; w' |# Z
}5 s2 q7 z" Q& a* a2 R8 E
}( H2 z& k* V* o/ E" W9 W' z
else2 h, n3 y1 e4 d* ^+ x
{
7 ~5 v% t0 k. o5 B if(debug)
# Z1 l/ ~0 x+ \9 w {& r; V0 ?) ]1 _, ^3 q
alert("compare color and parent bgcolor!");
% E8 _$ i1 I/ u. } }
H' @, Z0 u6 x4 h6 u0 i8 W" e parentBgRGB=getRGB(parentBgColor);
X" W( T0 w- u# n3 g4 y% T8 K2 Q7 V if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
7 f" H7 H6 s& h& ~/ t {
% X. C# D6 ~; f0 }& { orgNode.parentNode.removeChild(orgNode);
$ }4 t# y% Z# N" { ~0 b }+ Q( p5 S9 M, Q; V& N6 j
}
5 a" y. F/ U: M. @ }2 k( o" Q' Q# T& x
}* Y, r x% d; W( _4 D" f) b$ p
}
+ D1 t) s: t' j8 W }
7 }% f K# _6 l. D) }7 _) S/ }
& a# l6 l1 f# u" x4 ~. k
. S* }: C( A! h var itemFrames = page.getElementsByTagName("frame");" [4 M$ R9 B9 V. Z! }2 J& F1 x
var itemiFrames = page.getElementsByTagName("iframe");7 I' N1 A$ M E; s. q- R% o
1 p9 z8 E' `! F$ {
var frame, iframe;8 U7 a" N+ v# q$ _
if (itemFrames.length > 0)) f- ^' N( l* P, a
{& i, U) F1 o; O+ P
for (var i = 0 ; i< itemFrames.length ; i++)
8 {( b W! L' H" B3 }) p4 h8 w {7 A) x/ S* l7 [. z. P+ k3 X7 X" \* r
frame = itemFrames.contentDocument;
$ X4 E1 p7 ?4 R8 _. z) F7 Z this.RemoveHide(frame,objname);
/ O+ K& I& N: D4 N6 N& P }8 n$ g F. q7 U
}
' n x" b: B/ B/ y" b if (itemiFrames.length > 0)
5 _4 g6 U* w/ S+ Z$ V2 v( @ h2 _ {9 W) Y l" d% _
for (var i = 0 ; i < itemiFrames.length ; i++) , P4 } C1 T6 R$ H. S9 g: p
{2 r9 Q) P1 w9 m8 \( A8 }5 J
iframe = itemiFrames.contentDocument;
+ \6 _; C5 T6 J& W2 X, }: L this.RemoveHide(iframe,objname); + p7 L7 A4 S2 [- L! Q9 z
}
9 t% Z+ N Z- @' i1 ?+ Y }
5 r3 h0 B4 n0 J$ Y& N }
+ T5 \% l) P+ |3 | catch(e)
1 O- o) x( O7 |- l* }% X {
+ T- E4 }0 K: C2 {8 W if(debug)
# B; z2 e( }3 e. e, v6 c: q$ O {
" ]" f3 M1 I/ ~. [! E alert(e.message);
. c7 W# z# c( s }4 [" F* ] J+ A1 q9 ~ S& Z
}
; k7 W) {# E, Y! h: O }
4 L3 b2 k5 n# P8 d% a/ \+ ^# m4 t & ?7 i$ P9 @. l% k; Z/ s* H" H
}
! j; c( g' H& C
}0 Y8 d4 m1 n( zfunction getRGB(colorString)
* E3 ?2 l3 a* r) D+ K- m4 M{
$ x, D5 m' o2 q4 }* d2 z' ` var RGB = new Array;' A' H1 v! K" @6 F7 l& p# N& b
var tempSting=colorString.substring(4,colorString.length-1);
* l1 q# r* j, z+ @ var tempArray=tempSting.split(",");: ]! q; p+ y; u, F9 Y" L
) x6 ~9 T& l- M; C% I1 b
RGB[0]=parseInt(tempArray[0]);
. x! l2 t, j& }! e. L' x1 P7 s& L" N RGB[1]=parseInt(tempArray[1]);
4 O( R9 s/ ^' d RGB[2]=parseInt(tempArray[2]);
/ L% B. a4 Y0 s' T9 k ( r% Q$ P. d5 U' U/ k: ^5 `1 y, U
return RGB; P" a3 x; y2 t4 p. G' @0 r4 z
}
. S L# _5 g+ |! A7 c: p0 [function keys(evt) + T% |+ }8 H1 N* _
{
( P3 B9 r/ b/ r7 a: M if(evt.ctrlKey && evt.keyCode=="81") . `3 ~$ _! W0 {
{
+ I7 H& N# }; S2 S7 U8 j# Y CleanHideObj.on(0,1);
( U( q- X9 S9 U& B2 R$ l alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); 2 `3 I/ E. x0 B. A# e2 c: d+ w- J
# Z. n2 z, B7 A4 v2 _ }
7 ^& j8 m7 C4 V1 h3 ? } 6 }4 o, n- C1 H/ `
document.addEventListener('keydown', keys, false);
: L' _& {1 b- y0 a: q1 x8 U" ~2 O) b; iGM_registerMenuCommand ('Clean Hide',
9 i9 N Q( H5 Y$ ?: xfunction(e){
) D% F7 e6 `0 S6 O6 ECleanHideObj.on(0,1)
4 h1 Q' I% F9 x F0 w2 x8 P3 ualert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
( Z# D- B+ z! ?});
) N" h J+ ]* a |
评分
-
查看全部评分
|