|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
& B& ], p) `2 c6 ?. ^, U% p
$ `9 Y$ Z: ^& Y8 w0 ]2 c+ @. u1 \" K火狐插件,用猴子5 r. }8 D* K! D2 e' Z. K# r7 ~8 o
" I' t8 F0 |2 R' e& \' f8 D
var debug=false;
. ~: a. E' C4 [- mvar CleanHideObj=new CleanHideClass();
3 M! V4 l8 ~6 j; `; u, _
$ h) r( k( I# K7 | _; Kfunction CleanHideClass()
# d1 B3 [9 D1 X* ?{
! |; `1 `7 }. P( `) T# ~( k2 u- O
0 B" B4 _# o) j8 p7 o6 v this.on=function(id,bMZ)
( O/ S* V0 p% X {
, D# C8 r6 v$ b( z+ V
+ M! Q; s0 e7 o9 u$ g if(id == 0)
6 ]6 u2 {( I L o; }) u- z% e {
: A+ ~) \" {# a* s; S var page=/* document.getElementById("content").contentDocument */document;
) G# E/ G/ l# b0 ]- F) V! G+ p& n this.RemoveHide(page,"span");
7 _, ~% D& D5 j this.RemoveHide(page,"font");
4 r9 P: T- ~( Z this.RemoveHide(page,"div");% r! u3 g2 b `
this.RemoveHide(page,"p");& y5 K/ X! ]1 `4 @/ P5 n* a
p- T( M. e& w4 V9 [2 g7 r3 u }" \) D5 x/ @: F) ?4 m3 A
( R2 Q4 M! q4 p+ K9 J8 k3 C3 J }! ^3 Q2 h" w6 N: _* i+ ]& R# L% F
this.getobjstyle=function(node,prop)
k8 P: i! ]& }. B' F9 J1 v1 `# r+ y {4 P, m5 l& c; {8 J8 q+ J* e
try
* u0 r& T* b" W {+ ?0 [( ]% S, e; G% f4 \; s
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
- l8 o, J; S. A: \# L! P' z/ M4 x! O }
4 ]1 k+ B$ q; n; j, I0 w. J& a4 _ catch(e)
7 x a* U7 T4 U {
5 Z$ i8 e7 ]3 H1 v* x if(debug)( A* f/ o! J' C$ v" M
{
3 T0 p1 s' J+ \* v: s" w alert(e.message);$ }) @7 |/ L: U6 K: ~' A4 A& s% C
}, X8 W2 y" g8 [# V
: ^4 \ V! Z0 U U. I6 D* k! s' x
return "200";; V" v9 U% {# S9 ^! g7 E8 O
}
/ s+ `+ F: o& s( @ a. G }) a( x% n$ `& V
1 d8 h# q8 r( G$ o0 g8 H# x
this.RemoveHide=function(page,objname)
. _% l# ?' g( k {
" G5 ] P; C2 q; _1 L5 f% k try+ Y. c# U. n* |" i: y c. Q
{
" j7 f: N# d" f, j( \ var minValue=15;7 ^& ?& b9 o8 T5 ]
var objs=page.getElementsByTagName(objname); ) E! P' K$ v! @ K Z8 J7 E
/ e) _: B1 s2 A: f: `( t1 ?, T S
if(objs.length == 0) + c' p/ |1 t K" m6 @( S7 d
{
$ Z' @* i5 H! ]. w/ k if(debug)) F/ M9 c* A9 ? e
{
8 \4 G; P, z( t, Z8 c& ]) k alert("no object found!:"+objname);
( q) ~: p0 `9 O6 f! X. ` }1 A/ A% f; g0 a# `- z$ i
}
. ?1 i. E3 l- { L% @: Q- O4 p9 E else
% Z5 A. ~" _; C* Z* k {3 z! g6 o$ x# G; t
( I/ R/ ? `! M: K for(var i=objs.length-1;i>=0;i--)
6 X" m; ? {' X; Q {, M {
; i3 X0 J4 T6 Z7 s' b5 L9 L* s7 }) J var node=objs.item(i); # J _/ |* w% P5 a- d' h4 ~
- P* {. {1 c, w' \ 7 {/ D& [4 o8 r1 j- @
if(this.getobjstyle(node,"display") == "none" ||8 G* I+ P. ^) P, N1 [# U
this.getobjstyle(node,"visibility") =="hidden" ||
8 ?# W5 V' _& P8 ~ parseInt(this.getobjstyle(node,"font-size")) == 0)
4 j6 }7 H8 B$ f {- q, G" b, K" U3 e
if(debug)6 l7 N* A, Y1 r: C, h7 W2 ]
{3 W5 A* ^, X: o2 n, b! ~
alert("remove invisiable!");6 h# p9 q5 @. T) e5 m8 o
}' ` W; ^" D. L% o
node.parentNode.removeChild(node);
+ m, u% Y1 Z8 G8 W& b! Y
, ~) o4 `) S l$ {$ o/ O E+ b1 I, t }
1 ]# a+ h+ b+ N1 F; |' r: y else
* t/ Y0 D, U3 P; M9 Y5 ~/ W- [9 B# g2 I x {
2 [$ C K0 k; }) M e0 Q5 e if(node.parentNode)
8 U) k5 N$ \+ u+ e: `' M {2 k0 B& m. b1 z/ _! W
var orgNode=node;
3 Q$ J2 s8 w: @ var orgColor=this.getobjstyle(orgNode,"color")" ~& N* \% _- N% J1 p
var orgRGB=getRGB(orgColor); - M% H5 A5 K- x0 D
+ F" c3 M6 \" D" D+ W% o var parentNode=node.parentNode$ ], N! E; F8 E, ^, P; H
var parentBgColor=this.getobjstyle(parentNode,"background-color");6 C- P. N# f$ H- U
* ]* W$ |( e8 X4 _. p var isLast=false; |# ]4 f$ ?6 C, [
3 b. Q1 P+ K( }. A
while(parentBgColor == "transparent")
7 V& y6 x9 U) m9 P5 ` {
, H5 z! [4 A) v: N3 B * w) S5 U; p9 q4 F
5 @3 [" p/ U* h0 _: G- X& P if(parentNode.parentNode == null)/ V/ N9 t, n/ C( \
{
& v, U4 x3 r. z6 `+ v9 {, L isLast=true;
q" t! `" I6 M break;7 F- T& l' w, L" N4 V z8 r& K% V
}
& j0 N, W9 |$ Z# e: O' T0 V6 ^( p parentNode=parentNode.parentNode;
/ S, @7 y" Q! R& H parentBgColor=this.getobjstyle(parentNode,"background-color");
/ o" g) f2 x# E# M6 ^, w9 x: i. A( k) W8 Q: V- G# M: h+ b: R
if(parentBgColor != "transparent")
4 g) N5 E) h9 o' @9 T8 { {
1 i! ]. @. V4 C break;5 e0 \ e5 j8 A: S6 E* i' f
}
: C3 d) |5 \5 z- b) B }( ]7 I/ {' r; Z9 p) l& |
if(isLast)
8 E4 j+ S+ x" i, d3 X0 R {3 B( f" i% u0 @) G1 d* W$ [" X
if(debug)
/ J* F3 m! j- H a) ]" M {
# H0 a; s! p7 B! v2 y4 n/ t* S6 U alert("last!!");
* x; H& O [# J- H }$ @/ J z$ l- X! ^! T
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
7 ^4 K4 X1 c' h1 o9 ?) E {' u8 P T. V' C9 g. s
orgNode.parentNode.removeChild(orgNode); % s4 ~$ f! d# o$ p
}
; A# k& f% \0 K }
# S. E& O0 O; K# H" J9 ~ else
; I7 X U7 R O' | {
( F y, O3 s- h8 Z- s if(debug), A; t9 r. k9 ^0 |8 }2 g6 f
{: ^8 [8 ^- g* C7 E
alert("compare color and parent bgcolor!");
) ^3 i3 u5 [; i8 m/ r }
3 W% |: o6 [: h g7 S& E2 c parentBgRGB=getRGB(parentBgColor);* C/ o* k2 ?0 H. F) l
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
S: \( h7 C8 W! \0 U- s- c. ~ {
* h8 J* [* W$ [ orgNode.parentNode.removeChild(orgNode);
2 j* Z" y# j! K }
0 t9 H% H. U9 s- {( o }2 b' V! q, ~( X" L4 n
}
" Y) `/ R/ L/ d4 [" i7 V }4 c, y* N. J3 b
}* |+ K' c1 _, x3 r
}
h' k0 ]2 V0 @ " W$ j/ u# j! f" \9 k, f
! F( {5 q% w; p; Z/ Z3 w var itemFrames = page.getElementsByTagName("frame");
0 _8 t7 l, A+ A# T6 @# V6 d2 g, B var itemiFrames = page.getElementsByTagName("iframe");
6 Y. p6 W; q+ W
3 K# e7 R& n( o8 n3 R9 h6 \9 h var frame, iframe;' w, J6 ~1 I4 a; ^) K% \* F1 C4 s
if (itemFrames.length > 0)! ~( P6 k" W4 g" P" {* s
{) a5 d: m. K7 c* g3 K+ e8 Z
for (var i = 0 ; i< itemFrames.length ; i++) : M3 x: _% i/ p0 ^5 A
{
7 @; `3 ~, U m frame = itemFrames.contentDocument;, [- R4 c( U O; q5 H; `/ t
this.RemoveHide(frame,objname);
& |7 F6 h. o+ r0 |3 i2 o: V" Z }1 l0 T' w: F' Q9 Z8 C
}; A& V/ R3 x2 C( E8 e
if (itemiFrames.length > 0)
- `" Z& Z& [- H {2 \7 f$ q V6 m9 z
for (var i = 0 ; i < itemiFrames.length ; i++)
0 A/ e. W9 a; a; P6 p {
- x) v( m# a9 l1 {7 N iframe = itemiFrames.contentDocument;
+ x3 \- S# d" W% ?" U" }0 t- q) _# b this.RemoveHide(iframe,objname);
2 @ [7 p" B; n+ s0 | }, m2 D3 a8 I3 J: j5 k
}
# Y3 d( c4 m% O% S5 G2 | }' u$ x0 R* j$ a% l
catch(e) h7 E! |: A+ e2 l" G! Z7 @
{
. r/ x3 p! k! g2 c4 d* y if(debug)
6 K/ r/ _5 j/ Q& Q+ O7 p {
2 x: U K# m! q5 `2 s3 E alert(e.message);
! I' V* n: g' P: _2 I# [ }! z; g8 b$ K. E% ~7 o* s
}2 N6 H* G' R: L; f
}
; \4 N; X0 k4 U a * n% \' I+ a6 Q6 k) a6 V
}9 }/ ^/ V# d- R" D0 D- A
1 o$ p3 n$ T# e0 S* M$ w. Ofunction getRGB(colorString): v( | E, L* d' e7 Z% c9 _
{
: j$ ~9 x W1 N var RGB = new Array;4 J% A" V2 k; G# t
var tempSting=colorString.substring(4,colorString.length-1);
1 x/ [4 q# G3 g var tempArray=tempSting.split(",");8 K" k7 ^& k6 G$ u3 a. y# U, W
, M/ d# O6 B& Q; q# S
RGB[0]=parseInt(tempArray[0]);
v( |0 N& N' D* Q RGB[1]=parseInt(tempArray[1]);0 d2 w) ]) C! P1 }+ u7 ?$ I
RGB[2]=parseInt(tempArray[2]);
* e( A/ a5 x0 T# ~4 N: n ' j$ C6 Z8 g/ B. ?5 C4 z/ q2 m8 T' r
return RGB;
" W" [$ G; x% E( \9 }+ ^}! I) t# [6 r+ h! |* J$ }
function keys(evt) ; u5 p4 W9 U9 ~3 z/ `" d
{ X8 l6 S: K' [7 J
if(evt.ctrlKey && evt.keyCode=="81")
) X1 x. Q% @3 c: ^; Y- ] { 7 u% f; R' `* W( W
CleanHideObj.on(0,1);
8 x4 ~. s5 B* k; R alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); 3 o5 m: ?! ~/ ?4 Z. I' k
6 [+ V! t; _- x) t/ q
}
. b8 m5 o7 v# q* {3 Y) v }
6 N W4 a! r/ g9 Q5 p% rdocument.addEventListener('keydown', keys, false);
5 L8 O, `9 E1 O+ |0 e% mGM_registerMenuCommand ('Clean Hide',% [9 T. q9 C& \' R& K1 M
function(e){
, q) z6 |6 y+ a1 ?# L+ l ^CleanHideObj.on(0,1). Q6 k) R7 J% p% k
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
' ]! a/ I! X7 D});& t' _% ~0 p- o& q6 w
|
评分
-
查看全部评分
|