|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 : d O/ p! M8 h& r0 g- l4 ?
9 `8 t+ n' y- j( |火狐插件,用猴子8 ~. p8 i: r3 ~$ h
# E! H* ]3 }$ _+ f# ^var debug=false;
3 Z& G3 f6 _! j0 R# Gvar CleanHideObj=new CleanHideClass();! H" T4 z Y, ^3 A* n
) B& C' D( i- s3 d! B& ifunction CleanHideClass()
4 V* W F ^- p# h, W' r{
+ i9 S* m2 {( m7 g% w / N$ c, ]8 K" x6 f8 } M+ A3 y C
this.on=function(id,bMZ)( j, p+ H1 g1 C) s8 G9 {/ Y% D
{& p& E: b; \! s( d3 C/ J$ L/ t* p
( C- {! E2 P1 r/ \* Y4 `
if(id == 0)
7 d! o+ S4 Y ~ {
$ u# R2 L) l1 L* s) u# k( [5 A var page=/* document.getElementById("content").contentDocument */document; ) M1 ? v2 R: [2 }
this.RemoveHide(page,"span");9 K) [. n& h& t# \: a
this.RemoveHide(page,"font");9 O1 Y% S3 k4 N3 o
this.RemoveHide(page,"div");% R- l7 Y2 \4 X+ C
this.RemoveHide(page,"p");
# W j- Q* g5 f. {2 W; K, b 9 |) J" N, u/ e0 m
}
6 v x0 T+ M) C# H/ F1 U 7 G) ` v. @+ W; |; ]
}
" r! u7 R9 K, L# k7 i- \/ E& P this.getobjstyle=function(node,prop)3 n2 n. K4 ~- X/ K+ ?4 s6 P
{
' H" Y3 J% s0 D& b3 ~ try# g1 i' s5 h1 y I% S( {3 H
{" e+ Y; S3 n, D5 }4 Z/ @$ X9 O5 W) v3 l
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
7 p% w7 f7 F. n. z, d# N& [ }
9 y1 ?0 o, }5 t4 U8 }$ u% ` catch(e)$ ]# B. e( G* e4 }1 W' _% G6 S
{
) f) N7 ^6 z4 b" v6 P% ] if(debug)
' Y+ [5 m' S, e, A3 d' r8 b {+ f* M2 K2 V( x" E1 n
alert(e.message);" S6 W F4 t2 s' b% m
}8 j2 q) S1 c5 ]% e: R- W
& l: n! @7 _9 `& D1 E" |. C$ a5 d2 D return "200";
2 b" l% \/ u% U7 w }
+ _: {0 O Z" n. v) Q: c }
3 | j5 \# y/ @" ^- } 2 z( h* L: Y \+ c: ^. s, }$ m
this.RemoveHide=function(page,objname)
4 c' _3 H) s1 |$ J- G; T( y {
3 u7 z! _) S" Y/ q4 l3 z m/ s: ^/ _$ i6 Y try
: G5 ~- l) z) t: ?5 { {
4 ?3 f1 j; }0 ^9 E var minValue=15;
0 z3 r& \2 b) h var objs=page.getElementsByTagName(objname); s4 K* t% Q2 i
1 I+ H7 K1 {1 s2 H0 U
if(objs.length == 0) 5 w% Y6 F N. {& i6 ^! U
{/ F% T* b! \% ~+ |3 J" v
if(debug)
1 J3 `, d3 J, H4 f; c+ f7 Y {% Z' o( v# f! n$ ` Q
alert("no object found!:"+objname);+ Z) @; K1 y; z
}% t0 K6 d/ H- m! L8 k$ u
}" f) v3 m! c' w% R- k. p i3 q, k' g
else
. e/ ~' c& R8 B6 r8 O' U1 X7 m1 U {. A) O# q3 f* d: _* d
3 s/ C& B* G' l0 ~ for(var i=objs.length-1;i>=0;i--) % j% ` S2 ~$ i5 K4 D
{4 f: R v& b4 W% N
var node=objs.item(i); % a& c7 x$ g" ?1 V3 n
6 j) U1 `$ z" E. C
4 d, j9 @, e& q/ I$ d if(this.getobjstyle(node,"display") == "none" ||1 a4 k4 S5 ]8 q) s5 z7 L) E
this.getobjstyle(node,"visibility") =="hidden" ||
1 {: g$ k1 V& i% w parseInt(this.getobjstyle(node,"font-size")) == 0)
( F! R, n% Q/ b {2 x; E- s0 i7 H# Y
if(debug)6 p6 H) m' a! o
{7 J3 W4 ~- Y, }
alert("remove invisiable!");+ X0 S" a; {& H6 Y& `6 ~
}0 V- a+ [5 R% x2 t0 A
node.parentNode.removeChild(node);$ A( m5 B% M5 t0 o
( C1 f+ n: o% ~/ @' x& |
}+ `" |% f& _; {( u
else + t+ V& M, a" q) f
{0 X# e* ~- P% `8 u3 B" y* \
if(node.parentNode) , o4 m& k( V. N( U- m" h- q I9 N
{" d6 T& Q8 t: Z2 @
var orgNode=node;9 E6 ~3 N: m; G& ?* } J2 Y) F' w& G4 t
var orgColor=this.getobjstyle(orgNode,"color")0 G3 ]. s% S5 h& [1 B- T1 D
var orgRGB=getRGB(orgColor);
$ P9 `2 ?4 ^1 m. Y3 }+ V2 t : Y" P; h( c8 m1 w0 `: U
var parentNode=node.parentNode
9 V' z% Y w. O$ X var parentBgColor=this.getobjstyle(parentNode,"background-color");% Y& F' F' Y8 \+ J
& X' H- ]: n+ z- R9 U& o var isLast=false;# n. ?) {( D( u1 [1 a
4 E8 t Y- c0 ]3 v! }3 R5 q
while(parentBgColor == "transparent") ! e% O$ p" h3 A% A% {* O$ E4 Q1 I
{
: L! z( Y5 h' V0 J* C/ z1 ~ ) `$ B9 l$ x w* g7 d1 `
- x# d' ?' T ?* q# G: [# k
if(parentNode.parentNode == null)& N4 T, N! S' \4 \* M' Y
{
' ]0 f2 |. K5 n4 J+ n% t2 l+ m isLast=true;4 x- P+ z+ G ? b, M, ?) f
break;
! R9 ?+ u3 m. F$ d1 C) F6 S4 r }
1 g% \ \+ a0 {. H# q( N parentNode=parentNode.parentNode;
" j* M1 U+ S/ Y* u$ p# } parentBgColor=this.getobjstyle(parentNode,"background-color");
3 n" F/ ~6 X9 h" h W; s- P; J
" I$ X. H3 ~, L if(parentBgColor != "transparent")
& V; ]# b& z, w3 G( J8 p7 K3 I {
3 L) G& C9 t9 f/ U break;
1 [8 ~0 ?$ F% A0 i0 c2 _6 K. a }
2 O" I8 W" H# l& b }
9 p9 m6 N6 H" v& K# \& l if(isLast)
' N) f- l! p& _0 t {
1 D2 F* g9 ~9 r if(debug)7 a9 N- m* d" L2 Y e, Z3 q
{( g" u$ A* s/ [: @: L/ q
alert("last!!");
$ b% e9 |" L& n3 ^* \ }
/ s9 d' \. Z# k" X if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))( |5 I3 [ Y2 f
{; @3 n7 A( e5 J* ?/ {( m/ r, P
orgNode.parentNode.removeChild(orgNode);
4 B( _5 f1 D5 q- F( y+ _0 X; d }- @3 J4 u4 W8 s; K J
}
+ M1 X) W: s/ ` N" Q else. T6 h, D5 x; V* p% y$ e
{
. ^& D: a e5 W+ E$ s) } if(debug)6 v9 e) o! ]" b5 `+ n
{, d8 ~8 [3 f% y
alert("compare color and parent bgcolor!");. ^* Z8 h' v u6 ~ D* r
}
- h5 z7 F( h9 t! V+ J# i% E parentBgRGB=getRGB(parentBgColor); j8 ^9 D# H& V( A3 n1 v
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
6 {+ {$ H, Q/ s8 a6 E! L {
& P t) w; M+ Y# e1 `: Q orgNode.parentNode.removeChild(orgNode); 4 y% ^1 ~' k9 v9 ~
}
! J% d& s0 c6 A7 ]! G; ?# ~: ? }9 }+ C! k) j, F% ? r; E6 l
}
! _- o* a" x E }
9 L* a5 ]: C8 w8 }' X4 d }+ P5 U% u$ ]' e% x
}8 L- x* m8 I" j. Q3 v
7 B) W! {; Y$ u/ n) { , f& W) g1 }8 N }0 Z) K
var itemFrames = page.getElementsByTagName("frame");
% B1 B P& \5 ], T0 z+ E5 M, d9 a var itemiFrames = page.getElementsByTagName("iframe");, C: T) K2 o. J1 Z l6 P: O
; X* H |3 O' Z- B: E% \ var frame, iframe;* w. {% ]7 Q. K4 r8 u- u
if (itemFrames.length > 0)
4 `" [! K0 ?0 v) i6 F) e6 i {
1 y7 U9 {1 Y* e# ] for (var i = 0 ; i< itemFrames.length ; i++) : W) {& {6 F" U8 K6 W2 K2 z
{. D2 j$ W. [9 Y! E% U9 Z+ ]8 x
frame = itemFrames.contentDocument;
$ o* \4 ~% G* o9 D5 U0 o this.RemoveHide(frame,objname); 7 y7 i5 e3 ]/ r$ f- u8 q+ X" }
}
0 O" q; P& X/ }1 }- p- ` }6 b2 F1 q5 f: s$ T6 L
if (itemiFrames.length > 0)) Q `$ S- d9 p
{
4 D" `$ x8 Z& S" S- e7 s& ?1 D l for (var i = 0 ; i < itemiFrames.length ; i++) 0 E6 U N; e7 g5 b1 c
{
6 Z( ~) ]: \# ]6 R# P iframe = itemiFrames.contentDocument;9 P# Y; h+ [/ U# Y$ m3 u' |
this.RemoveHide(iframe,objname); 3 p0 i0 {& {6 ]- _0 K
}
5 f' f* A5 o; }% | }
9 X4 l+ l2 K. T9 i }
4 B% ^3 E. M- Y& _" u catch(e)
. ^, P' k/ o c4 j! j: n. S* s {
, b) t0 g( |; ^6 b- ]* l if(debug)
) f$ `+ W' D7 r) X8 r {
+ X0 y1 A1 i l+ o1 i+ ? alert(e.message);) {( `0 k! w6 z) H" p. i
}
6 ` G) j9 H, o: ? }
9 P7 q: Y9 ^2 A. {5 u3 ?5 p L) ]. J" e }" y0 H# e' S" J6 }& M7 S9 B
, A/ e) r- K8 u: h
}
8 W* N2 f& n9 R! p( U% n0 E2 z
9 M8 r7 J. S4 S& x- S0 Tfunction getRGB(colorString)
3 Z7 l2 }$ E" b( D, p2 U{
0 j K: v% M# v$ A. X0 j var RGB = new Array;
& \1 O4 Z3 |' z, e, \( p- { var tempSting=colorString.substring(4,colorString.length-1);) e- ]" h' I- K! Z p, G4 |( U u
var tempArray=tempSting.split(",");
5 n) V- ~: I/ Q* p \3 `- S1 }' `- A3 J8 a
RGB[0]=parseInt(tempArray[0]);
) T) e( h$ y- O RGB[1]=parseInt(tempArray[1]);
; }0 F1 u9 d2 d k0 r y RGB[2]=parseInt(tempArray[2]);
* X5 z ^" u$ O O 5 X3 p3 v. z; Y: J5 \
return RGB;+ \4 I5 _) @8 |! n J
}# B8 C8 r v( Q! K) N
function keys(evt) . I/ D `) s* Q- {& H. ^( ~- f- g
{ ! z4 U0 T" i8 t. I1 m+ }( d
if(evt.ctrlKey && evt.keyCode=="81") " g1 c1 Y, ~* t0 B4 H5 t
{
( I3 c2 A5 M7 S O8 L/ P CleanHideObj.on(0,1);
: f" E; |! c9 k& R7 K) |' d alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); ( P3 ^% h9 H0 X; N
) q, v7 E" L. P& P
}
% O: a# W4 \1 C+ i) X C3 g0 B6 k } c0 Q) v: y/ z/ s, j- u" t- w
document.addEventListener('keydown', keys, false);
0 t9 E, i" I- Q+ h( H1 pGM_registerMenuCommand ('Clean Hide',: E, W7 E5 N9 S. j, m; R4 j; H
function(e){
$ Z# x% `& y9 O! m- M: E% ?/ d. Z5 |+ sCleanHideObj.on(0,1)
4 w: G5 ~: E0 a* Calert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
% O0 N6 v3 \4 A( s});
, ~ P, `% F# I( g |
评分
-
查看全部评分
|