|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
& b8 d2 k1 n8 e6 K, f/ B
. V) l' _5 V+ ? s9 f火狐插件,用猴子' y1 @7 U8 m5 k0 d! |! W5 L- g7 P
" a% ^3 R( Y9 {: z( s1 Svar debug=false;
4 j3 ]7 u: G8 ^% l& i# tvar CleanHideObj=new CleanHideClass();
6 ^1 h' ?* W- B( F! f0 ]+ x2 X6 K7 g. v/ C. K! T% S
function CleanHideClass()
- u2 k; U. r0 _* A4 x4 y, @( s{
$ \4 w$ x9 @1 H$ V1 t: e
/ k0 k! c e' Y k: w5 Z& d this.on=function(id,bMZ), B4 i) W/ ^3 c
{3 M3 ]4 F" ~' v @
( D- h) W2 }( U4 R/ a/ q/ W. d
if(id == 0)
1 @. A8 c, |: x! j+ [9 F {
) H6 ?% b( L% a var page=/* document.getElementById("content").contentDocument */document; + J6 n, K- ~/ w3 g8 u
this.RemoveHide(page,"span");* z$ \; u( a+ a. V6 ?+ R* p0 @, u
this.RemoveHide(page,"font"); D, q0 k- o5 z# L9 X
this.RemoveHide(page,"div"); j; [0 p- d$ w- e" B
this.RemoveHide(page,"p");
' k$ ^. c' @2 R* ? ) u, W# U7 ^) d1 }5 }/ m' x$ k
}. \2 w# i( p j: i m4 I
' A y E# z0 g' F
}
- _$ Z6 |0 o$ a' L& r6 N5 S$ t! g this.getobjstyle=function(node,prop). ?2 H3 C' m9 l3 k7 `9 U7 [; ?
{
5 [# B, r- E0 I% w5 N: P6 n try
3 b% }, O, I% ^ {+ X) x4 a9 w0 {7 K& i
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
! U+ V% q5 x' n; k- ~7 T }
N3 {: q* _# t catch(e)
; l2 Y9 j3 A6 t: s- o! a9 v; A {# f6 {6 x+ z {* F
if(debug)
8 ?, h5 L" u( F0 G8 A3 \" U {, c- t; y$ r! l) _5 o S! l* e
alert(e.message);; M) z/ S' u( f' |. t0 ]8 P' ^
}' l9 n4 _6 \- z0 D$ W4 F2 Q
5 t9 a+ ~6 [+ o, b6 K return "200";9 G0 E0 a6 A5 H W9 i4 H' H: ^ Y
}
0 L0 a- V" O+ u% W- J3 I' K }& n1 t5 w ~. {+ D) n
3 K8 S, j8 n- a+ L this.RemoveHide=function(page,objname)' V9 G3 n$ b" U; T% N
{0 S- `1 `8 P) f m" o* U+ |
try
! W+ A1 R( G" D' `( ~ {
c8 h8 C3 F, p6 i3 F% b var minValue=15;( i! l3 i o2 _' j& W4 J" F- U
var objs=page.getElementsByTagName(objname);
( k$ d9 a0 w# b, k4 b& l
- l0 r! y8 O+ O. C7 p* D if(objs.length == 0)
* C9 K0 O9 v" S/ i. _! J. w {# | a0 E3 L* h7 O
if(debug)
% c$ C0 x5 o' g( l# s+ S9 W/ u {
1 H( f ~2 f3 b9 U+ g' o alert("no object found!:"+objname); w1 x0 Z& C# }0 J( K
}# P* X9 S3 c% o
}
# f0 b5 `' m$ F8 h3 e* A else, v v5 y! c9 `7 ~% \
{6 Q8 y( `5 B- H- H! \0 y
6 |: f, t" l T7 V8 p for(var i=objs.length-1;i>=0;i--)
f+ [9 k* Z& }! J3 q {$ \% p1 c5 K$ f$ _. N. v
var node=objs.item(i);
" t& c# V5 } M4 d5 u
9 F: d# _1 U3 A# R3 ^2 L / v4 @7 D, `+ Y% a' d
if(this.getobjstyle(node,"display") == "none" ||. B( p/ i# R; W) }9 a
this.getobjstyle(node,"visibility") =="hidden" ||
G" V# j4 }3 U. C parseInt(this.getobjstyle(node,"font-size")) == 0) 3 C# |2 ]" D* I, C( n8 V
{$ |; C M3 B& B" T; E& p
if(debug)8 k0 u" T5 F! `
{
6 m% P5 O8 B# D! C; [% ?* ^% `1 ] alert("remove invisiable!");# Z$ d7 j$ Z: g
}
9 B- i+ p+ v5 _" T+ ~ node.parentNode.removeChild(node);$ [$ b+ c/ [! v, t% R
. D) i% b2 k; _% w5 A }; c7 j6 [# r$ |
else , ~1 b( t& L2 D' R# @7 U
{
* M& P$ E" V# o+ H* K7 r1 s if(node.parentNode) / Y& j, N% X$ k1 S4 E% f
{
+ q$ Z/ h: C- K% Q, _) r" q var orgNode=node;
- I, W3 F4 A1 B0 N0 \ var orgColor=this.getobjstyle(orgNode,"color")
: ~$ J) P5 i1 Q3 p. G) \" ?, Y var orgRGB=getRGB(orgColor);
7 B0 l$ X+ i: C4 e3 E+ q$ d7 ~* h
L' p, u5 \3 C+ a6 O- j5 u1 z var parentNode=node.parentNode3 O" Z/ b# ]( E2 }# `8 s
var parentBgColor=this.getobjstyle(parentNode,"background-color");1 A9 h6 U8 c) q8 p# ?2 D6 O
$ {* @* R/ N. F7 F
var isLast=false;0 N- |. z* {* M2 f: g
1 X7 c3 F4 }" I+ k" M- _ while(parentBgColor == "transparent") % q9 X/ d& t K8 L+ Y3 E2 S
{
1 |) m. l$ P7 o ! u) X1 |; b4 P6 D* w
* w- [, S6 E; P7 Z- h0 ?8 B
if(parentNode.parentNode == null)' n0 f" X0 T* a: k2 z+ ?
{
. z9 J. J6 Y: G, k9 g I5 ^; W3 i6 C isLast=true;
- ^1 |6 r. [# d3 T" e break;. C& v7 ~8 t2 u/ ^' E4 D0 T
}7 V9 k7 c$ }! G) @; U
parentNode=parentNode.parentNode;
: J N4 Q; T5 h3 ^' s! C parentBgColor=this.getobjstyle(parentNode,"background-color");% |/ K2 M& a1 M! d$ M/ D
: }+ o7 h1 X# c* h if(parentBgColor != "transparent") - A: {0 q6 n- u
{
% s8 |8 b) ~7 Z/ `8 D break;; U- w& v% h& v7 F* z9 o+ R H, _
}
8 w9 F- J4 a% _: a! @# \ }+ v8 Q0 R- {7 x. o/ o
if(isLast) $ p* g9 B5 J3 @* h, x. G: E
{
4 Z( Y5 U$ k, i6 b if(debug)/ q/ a0 P4 ~ d5 I+ p
{
( c7 S+ V5 K, H1 l% c7 d0 U alert("last!!");) W% [6 O [/ K1 v( q/ |7 V8 h; Z
}, h' Q7 h8 _) o" C
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))+ t0 n: \5 r: W$ E& i# @' j
{" \$ K* u! Z& a2 I7 T+ |- ?
orgNode.parentNode.removeChild(orgNode);
$ C1 k3 z' R5 t0 y }
1 b* z( n: t4 A$ d- e) v }
$ D3 A* ?- @: W" O2 I5 e else
+ F: f! z9 g0 G( R, l$ u {2 A8 a' B: C) Y6 e
if(debug)
; I7 B. n+ p% K F0 X; q" h {. Z1 _7 p# n+ r; Q
alert("compare color and parent bgcolor!");: J1 s4 z1 R' h9 Q
}' f- X* G& {/ X, Y7 H- e
parentBgRGB=getRGB(parentBgColor);+ w8 J7 N5 [6 ?) S
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
2 [! H) g& `0 h5 T0 K( o {
: B+ k0 |8 Y/ i5 t orgNode.parentNode.removeChild(orgNode);
5 f! h6 E( A; L/ V6 c }
3 p# g9 `# T5 K B }" j! {) a9 ~' }# Q8 b
}
8 t2 d% F& ]" i" Y" f6 Y }: T$ F: u5 D# j# z; R( B( C% V# W
}2 G: P0 O1 \5 y" H* t7 M. N
}0 y1 R) F+ O* N5 p: s/ K- V
6 ?9 S. ?$ \. K
6 C& {& e9 @9 H$ T. T: q* t4 S var itemFrames = page.getElementsByTagName("frame");
& M, h9 o& D- t9 l, T- x var itemiFrames = page.getElementsByTagName("iframe");
* A7 N* k4 U3 Y4 m, N1 o; ~ 8 b$ X6 s5 L" t* [; K
var frame, iframe;
2 ^: u7 C4 R5 Y7 I- j if (itemFrames.length > 0)! w) U5 }" z, q7 P
{; w% @/ E% k5 O' ?2 m
for (var i = 0 ; i< itemFrames.length ; i++)
2 }9 L) l- Y% l, B {* X, o- \8 M& X& @9 O6 |7 H
frame = itemFrames.contentDocument;4 ~& ^* g' j1 _$ l, B
this.RemoveHide(frame,objname); + `9 C( z. Z- P5 R8 s, G- S
}
/ a7 T, \7 Q% P3 d4 W }# ]( H5 w& b* ?' g
if (itemiFrames.length > 0)
$ ?/ v% Y+ T, ^7 Z7 T' G1 m { h6 V: p& i; }1 S A5 b' L
for (var i = 0 ; i < itemiFrames.length ; i++) l4 I1 V! f1 l
{* f7 C0 g J: x" r! }( K. K4 M
iframe = itemiFrames.contentDocument;: T( M; ^8 l8 X9 S
this.RemoveHide(iframe,objname); . }& r- F6 P: k2 J1 K5 {
}2 R, F9 @6 H. i% A4 B
}: ]: x7 O0 \5 {2 C# B
}
& [! G' _) h! d! x' U catch(e)
2 n+ ]3 _- P/ q! h" w- F3 u {
" Z4 B2 a( u ^( k0 Q( s. y if(debug)
- z. U! A% @" e; b$ X& K {
; a0 |. l6 i: D, K6 O8 t' x: b alert(e.message);
* G" s; ~: Z, \2 `+ f( u }
3 Y- D; T& h: f& `) K& h }
. @2 Z+ \7 b' H" i, `" ^ }8 r! K. q. s l. l: F, T
; X; u% k# j2 q2 j4 S: H {}- q6 |' w n9 L
4 H4 i* |9 ?1 ~0 |" h! Y/ W. f
function getRGB(colorString)
, Q3 p# i: o4 U: y0 {{: x5 i* F6 `) v$ O
var RGB = new Array;
/ ]$ b: `/ ?* D- l) [ var tempSting=colorString.substring(4,colorString.length-1);1 S( Q' L( i3 B) L8 j
var tempArray=tempSting.split(",");9 z, P2 d G& I2 [
]! X/ N. B; f9 y4 i( G" o RGB[0]=parseInt(tempArray[0]);
/ @% V- P d( t- q! r RGB[1]=parseInt(tempArray[1]);" Z* f- R3 D) T# Z; X: S6 p
RGB[2]=parseInt(tempArray[2]);
6 |6 I' ?# u2 ~% I D+ _
; H/ ?0 n1 _( |3 H return RGB;% e a- T, y9 j8 u' }7 w% Z
}, g. T( n9 R! j" B
function keys(evt) + [% F6 y* v5 K, A0 ^
{
; ], S, v9 I) s4 I5 e# `& R if(evt.ctrlKey && evt.keyCode=="81") T" E' f/ ^ h( P
{
, q8 Y6 s; F9 n6 Y; H CleanHideObj.on(0,1);
2 [* U9 B* g2 H8 B alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); ; m0 s& ^' A. J& b3 `
$ `$ R7 z( n! i" r9 C
} 2 ^) l! M( E* Q9 B8 |! H. @ I
} 2 e5 b2 K4 @2 \& q# J$ E4 }
document.addEventListener('keydown', keys, false);
' \: o- H2 f3 z/ o4 GGM_registerMenuCommand ('Clean Hide',
+ ]* i. R/ O) g) q( b9 vfunction(e){4 O: \- O' y# W7 `5 m
CleanHideObj.on(0,1)! c2 h7 S9 y& l i- k! z8 q% A2 N9 e
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");4 t6 H3 C% [' x' ?
});- w9 G! `! p/ q+ ~: g3 a- A
|
评分
-
查看全部评分
|