|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
. A5 l& q4 K/ O" ?4 K! K2 D( l. p U# a; |2 e" W
火狐插件,用猴子
; U7 }$ x! c/ [7 |' c
: M) ^2 b" W: J! |. dvar debug=false; 1 |& D4 ^- D9 e/ c2 s- D# e
var CleanHideObj=new CleanHideClass();+ b0 n; `/ G; g1 `: I7 l
& X1 Q6 K( o: U; m4 Gfunction CleanHideClass() : \" I) ^7 }- |$ }6 N; w$ R
{
. V6 A2 Z, f" X3 \ 7 E! {- u% E. @+ T1 h) m
this.on=function(id,bMZ) X! t% `) v- |) i$ x
{6 G& U8 z0 J) q6 S9 g' u/ j3 P9 j
3 G! C8 z: K. h8 L1 z0 x i# q: b if(id == 0); }" o$ I2 L: v, q
{
# K8 a$ s$ H6 x0 A+ ] var page=/* document.getElementById("content").contentDocument */document; # e! l: p$ X0 D4 a" M$ T
this.RemoveHide(page,"span");
2 x/ T. }- f# x' E this.RemoveHide(page,"font");- ^/ h0 Q, ^2 A6 G+ g1 t9 A' E7 }
this.RemoveHide(page,"div");
, c% C( T( g! ?" A& ?2 c this.RemoveHide(page,"p");
! z" h! j& V" j( u, T2 W , S# m! Z0 r' r
}
) n) b% _1 k: g. h 4 C9 R4 [3 ]$ l+ B8 W- f s+ w& {
}9 q( D. u2 l" d$ u( m
this.getobjstyle=function(node,prop) S5 S& ^; P3 [" \+ ^
{
, R3 p: L D0 c9 g! j& z7 w3 b2 p1 t try
: d. r' t3 `8 r1 q8 L; {9 O/ } {) @6 y2 _0 J5 ?2 d
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);$ e) Y. J* g! I. z/ Y
}
: i" i' _8 s$ P catch(e)! ]+ R" U. q/ A3 _1 g
{
; M; V* b; M/ D. ?( }) T if(debug)/ W6 l4 ]4 a- \
{8 L- Z- r# n9 Q9 Z$ a9 ~) k
alert(e.message);* q% p$ e4 S8 u: x3 x6 J1 t- X( c
}
0 i6 _8 u( X& {3 m+ q! j4 R6 \ 3 ^# ~2 B. c8 ^
return "200";: [5 \# P* I+ H/ L! c9 W8 X! M
}
! F; N2 ]+ r8 v: S: H$ A }
3 I8 D3 h* R% g! Y$ L0 x6 L% ?5 B 4 Z- p7 e; _& O8 B) z6 w
this.RemoveHide=function(page,objname)
2 ^. ~- o) y/ d/ c {- }# E' \! \$ ~; z m9 p
try E! U+ J* K3 C" j) z! S4 f0 }) N7 l
{
; g& {) X* }9 e; d ?& a var minValue=15;- _7 l( T: v- c0 f, T" q
var objs=page.getElementsByTagName(objname);
) ~& E$ D! i1 D6 q6 {6 e+ ?. G$ T$ O) O0 n
if(objs.length == 0)
* p1 K! T9 G3 M. x. U+ I {
1 O4 Z3 ?/ n! }% g% D7 v% | if(debug)* u7 N |; D. l+ D# f& K2 v0 I9 Q6 e
{
( I( X h( O/ M) Y. e alert("no object found!:"+objname);
; @+ s4 I, k/ ~, @! f" ?% F7 H0 i2 g7 k }7 _# B8 @4 D g8 K
}7 F& n! _$ t" W3 s: L" ?
else3 c5 b0 M, b1 Y8 y% u* x
{
# q" _, n- y: d W( ~& ?. g" {) j& q" K
for(var i=objs.length-1;i>=0;i--)
, B1 u; j! L* W, |; c {
+ Z5 ~! e/ [5 s0 H4 C4 H5 v var node=objs.item(i); ! E( I; X0 M& M( |6 |! {
+ W2 H+ C. X5 ^/ c- W6 o0 D
+ _7 M- `- n" [" K' \1 J
if(this.getobjstyle(node,"display") == "none" || K) v! |2 [. y% P1 N
this.getobjstyle(node,"visibility") =="hidden" ||% T8 N; a3 M3 Q- k& X
parseInt(this.getobjstyle(node,"font-size")) == 0)
# t4 ?. n, E9 @4 Y: } {
2 ?3 G0 `( I: _, M7 v if(debug)7 q! x- Q5 V3 v5 V
{/ {. i5 k% a: g/ _9 L2 ?3 }
alert("remove invisiable!");) q1 Y8 y: J4 a Q5 m
}
: w2 b+ Z) @3 s4 V4 O/ t7 ~ node.parentNode.removeChild(node);
2 d* n$ | F+ _9 N 3 l# u. T' i o) ~+ s/ X& e
}
. s9 P- {6 `5 ]5 A6 ]; G( j9 f r else
1 ~& ^9 r$ i* X8 @6 ? v" W {
, G3 `2 c" F' d2 D8 l5 q if(node.parentNode) 7 C0 o- l; }" I& {
{
4 ?/ ^. F- d2 o var orgNode=node;
|! K0 f4 \1 `5 F6 b; n2 [ var orgColor=this.getobjstyle(orgNode,"color")- N$ \8 h4 `" D! l* F! L
var orgRGB=getRGB(orgColor); # _# c }+ l+ t; ^
& w+ E( K/ X* D! l f/ I
var parentNode=node.parentNode6 o! }) l9 Q% ^! x
var parentBgColor=this.getobjstyle(parentNode,"background-color");( x: J8 L7 U% K+ O) t3 q
4 T) {6 j8 C2 a8 Y4 n
var isLast=false;
$ u3 y5 f, i$ v: U z * }( g5 j8 q3 o) _+ I
while(parentBgColor == "transparent") : v( O# D8 f# L$ a8 g+ s
{
7 S& G1 [0 Q1 M- Z
7 C0 Z" b% r5 R+ K- a8 m8 F
9 Q5 I6 y& n- a# U if(parentNode.parentNode == null) G0 p6 o' T1 O% B2 M1 o
{
n1 h1 V0 v5 F* h+ S& g" Z8 l isLast=true;6 a+ M& X+ @. V4 g R! w' m
break;
& v' k$ j4 H7 f3 `! G }
: q, J/ H( B8 H/ I' [% l5 i% {& ^ parentNode=parentNode.parentNode;
" E; I1 O+ i5 q7 o parentBgColor=this.getobjstyle(parentNode,"background-color");6 c: x' y( G; C( m5 \5 P( H# j
" m7 Q: A1 ]* z0 k; g# L! Z
if(parentBgColor != "transparent") 5 \3 M- n! a! a+ j: \$ D
{8 n+ M" |. X/ F1 j& _
break;
6 |. ^, S" ? D7 e8 C }4 P6 W- f {8 ?4 d; {6 h
}" E9 z: y8 {1 |5 u& s6 N
if(isLast) ! Z/ B+ f# z5 z% L: d4 y) M
{
8 o5 G4 F6 x# v- c+ x4 g if(debug)
4 T6 F' z5 M9 W8 [; ]6 B4 Y {9 a0 e) T4 [2 ^& H
alert("last!!");: X9 C+ t( N& |
}
p3 k* K; ~5 b R" b" ^. a if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
$ I! t" b5 }* n+ C' @ R; Q {
. C. M1 Z; @6 Q, n" E6 L orgNode.parentNode.removeChild(orgNode);
; V* J! b! x6 x8 ` }
0 `' m B+ ?+ q2 G$ A h" ?) T }
+ p* A r7 X) g& a' [ else$ Z7 ~$ g: T+ z8 v$ I9 Q6 o
{, U- `/ H- c. P# f, v+ x6 D7 c
if(debug)
~6 l7 O1 F1 v6 ]+ B' i0 b, N {
! O3 ]' r$ v" W# }2 O2 t% a alert("compare color and parent bgcolor!");7 b2 ~+ z, F5 H# e/ C$ V$ H; F
}( b4 N+ q" r: R
parentBgRGB=getRGB(parentBgColor);9 R3 c3 [- j+ R: S( N
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
0 Z/ ?1 H2 R! z" }2 {5 j {
: `: p1 I3 O8 Y2 q& c1 n orgNode.parentNode.removeChild(orgNode);
% k# F2 @: F; b; t6 z }7 d" H9 r$ J \+ U
}
) X% n- E. U5 b$ Q }* b7 b+ O6 [, ~) [
}* G- F7 M9 M: \* X9 u! C5 R
}
, l' x1 W0 Z N) J4 v! u* ^+ ] }/ R4 @" Z: |0 ?* a9 g/ m
4 ]5 x9 z3 ~( d: X 3 W% \7 t8 c; k/ I. b
var itemFrames = page.getElementsByTagName("frame");
5 [" {9 c. p* i; }; O var itemiFrames = page.getElementsByTagName("iframe");; D0 B$ h9 H( v0 }0 C- J: F
& a, W) X: c8 A7 [$ y8 ?( u3 K v; t/ o9 x var frame, iframe;
- L" X3 j% V8 h if (itemFrames.length > 0): D+ {; _* m9 g& O
{
! Q, e! u3 }" g& x; l. g for (var i = 0 ; i< itemFrames.length ; i++) ' l! v0 J: N. V6 F
{
/ w# f, h! d+ `9 Z% s( q frame = itemFrames.contentDocument;; d, ~' X. V; V# g
this.RemoveHide(frame,objname); - W5 g1 R# o. U0 x, C/ L( {
}3 o0 b2 c9 t% I. l6 T0 }
}
& }* h, ]7 [! ^+ |) Z* O. S; j if (itemiFrames.length > 0)3 [/ f- S% O$ G$ e% ?
{: Q, }! ?; n/ ^8 Y, p
for (var i = 0 ; i < itemiFrames.length ; i++) / G, s6 x$ v9 c& H+ k( V
{
* ?. K, `+ v2 a# O. S1 u iframe = itemiFrames.contentDocument;
% t3 f2 C9 e2 H' C! B9 Y% Z this.RemoveHide(iframe,objname);
& o7 r8 g: `' P& m }
3 \+ J0 G3 m; q* v2 ` }
. }& g5 M/ G% h, U! u+ @5 w }
' F* u8 Q; k" m, b+ e3 O catch(e)+ u& e) \6 o* k5 b2 M, M
{
6 ?0 k' v* @" U9 d3 `6 v if(debug)3 w& Z$ @( B6 ^# n; [; W& z
{
' t9 C% X- f2 c alert(e.message);
( j4 q% g1 o4 O' c4 n }
& C- u! l' t/ w9 c H, Z }
) ]5 b7 [1 a$ G5 L5 e4 q }
. t8 g+ D$ `9 K/ B% N5 e 0 Q6 ?2 E3 G. @& G: J/ a7 I- k& ^
}: |' Z9 f4 d/ r x* k# J% i
- `, u. J! R6 X; k$ `; H
function getRGB(colorString)* h8 Q4 _: X; ~6 j9 ^0 d
{0 z6 A# z4 v& _' d+ E
var RGB = new Array;; P0 n/ }7 W+ e3 W0 H3 w6 Y
var tempSting=colorString.substring(4,colorString.length-1);/ A& `8 Q. S* c2 y. N M
var tempArray=tempSting.split(",");
* [0 Z. o3 S3 [0 j8 _' C5 \7 U
3 X! T* x- s+ P; s# l RGB[0]=parseInt(tempArray[0]);. G0 [; e2 m. `0 g( k0 U5 G8 n( X
RGB[1]=parseInt(tempArray[1]);6 C9 w0 n, h+ M1 c, {* \
RGB[2]=parseInt(tempArray[2]);2 \$ G' j: u0 j2 z0 o
( K' V. {; r+ h7 d return RGB;
$ n: g! o! w! Z1 E}/ r- J( y- a; e( W# [5 Q
function keys(evt) 1 |3 \* u- k0 u3 f9 \/ H
{ 1 O" z/ i$ i- Z
if(evt.ctrlKey && evt.keyCode=="81") ; w" L3 F' T4 }* }3 J
{ % U ^8 }+ I" s: Y# k4 N
CleanHideObj.on(0,1);3 Z( _* n2 V6 j8 J5 r
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
?) F* n3 u4 R7 G4 a3 N
' O7 ~7 T6 o2 j! s4 r4 } } $ w C. }6 M0 }( U- @" t t5 t8 q& s
}
5 R6 w* i( b! C0 H+ `4 Rdocument.addEventListener('keydown', keys, false);
& } ?! X& B* j4 d; PGM_registerMenuCommand ('Clean Hide',. \" }1 H- h, `5 }, U7 r' E
function(e){; D j9 D* k) U+ M
CleanHideObj.on(0,1)+ F/ a$ c& |. e. C+ F$ h6 b
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
& N5 g; \9 ^* T! m9 B) `});) f) b3 d& v- Z; m) V( o* V
|
评分
-
查看全部评分
|