|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
2 X) d. h& R2 v$ N# E, [" o& L6 k! F8 |: C: d. N* R
火狐插件,用猴子
$ M2 _% I) w/ E3 M- d! i1 z
3 J; g6 P- t, m8 ovar debug=false;
" f( o. E* k/ g4 D6 M; E1 Q0 g( ~var CleanHideObj=new CleanHideClass();% P" U8 Z% S# W, _
7 L% W. C/ w' ^. o" T2 g8 t8 ffunction CleanHideClass() : ], k/ a' K6 h3 E
{
6 o0 T# [ Y T
5 }3 P% t9 ?: g this.on=function(id,bMZ)
, V4 Z9 {1 T0 d( K {; L% ], e$ |) e* {) Q' A: [2 W
! C3 }9 Z+ B" g5 H6 ^" z9 |3 H if(id == 0)
# E; ~2 `. t& R. {# v& H {
% ?4 D- U) U& j+ k var page=/* document.getElementById("content").contentDocument */document; & F; [6 V. N. H$ m
this.RemoveHide(page,"span");4 ?# M& @+ W8 ^" V5 T# P
this.RemoveHide(page,"font");: v% V# F+ X( s- k) i
this.RemoveHide(page,"div");
c' d! E1 @6 f3 A6 s this.RemoveHide(page,"p");
9 ?) B0 b1 e! S$ X2 h# ` + T7 C1 r. Y7 y7 u M( \( K
}
! `- g3 Z S' e) o
6 u/ d$ _' g4 m }; K% H- s2 J4 a7 F
this.getobjstyle=function(node,prop)2 r% }; ]' b9 b: G9 I0 s5 T
{( z# o+ i, L( D9 v1 a( E1 k- ?
try
( j, q4 n6 d# C {
$ H0 h8 e+ X" A2 y: \( R. Z. Y( c return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
# t. l3 G; C5 U& J& ] }
! Q! {, |2 S* n# |8 F catch(e)8 | y2 ^8 u% L2 x
{
# ~# \0 y4 q7 F4 k9 d; ]; F if(debug)
9 x" k" P! s( I0 ?* d {
) Z2 a0 i8 Q' h8 j alert(e.message);
+ @4 a) d/ f- P$ J* ? }9 k9 e s$ `0 t. {6 Z0 V
( {1 Q5 a# x% M$ d" c' g" J7 a
return "200";% ~- n6 n3 m( J7 p: K
}. F; S Q8 p' p+ y1 H
}7 q& q! L/ S/ r: R( r+ }
4 S; P! i5 {- ^! n
this.RemoveHide=function(page,objname)4 m* r. s g9 o3 I4 F% Y$ S
{
) N; u+ I1 [. K) _: X! B try9 t. |$ [/ D- K4 k0 U0 ^9 H
{
% g- f* I+ _3 ~) E var minValue=15;0 T4 O" J0 H" g: `$ ]
var objs=page.getElementsByTagName(objname); 6 Q/ Q9 H$ x! r
# Y; m# F3 ~! S' C if(objs.length == 0) 3 L: P8 q3 N. r+ A( ?4 F. y
{
' l6 o' D6 e/ Q" p& }' O! ?3 ` if(debug)
* g0 C8 v. U- \2 a( l- S {
# U* i0 O q1 `6 F1 J+ a/ O) g alert("no object found!:"+objname);
) [) H4 q9 o5 {' w" | }
7 U: R. Z. H4 O* u$ M }6 G& A A1 k* X; \( E
else& M: w, D1 P6 b0 h
{4 W' m* I6 x# h# q) ?
( P" C h2 r2 ^6 L" D7 t3 P
for(var i=objs.length-1;i>=0;i--) 5 M/ ^ R' k: g
{
) |5 B3 ?6 s0 t* B# E var node=objs.item(i);
5 O$ P1 H2 W" Q2 B# K" A/ I0 y * U" C6 K2 U0 i9 F1 Z
% g) u: {6 B1 q7 w5 D& A
if(this.getobjstyle(node,"display") == "none" ||3 d2 b2 E( C% D( o# f7 z
this.getobjstyle(node,"visibility") =="hidden" ||4 T& i& O4 k; x; M: {. v
parseInt(this.getobjstyle(node,"font-size")) == 0) * ~3 C9 Y1 R- K: L* B
{6 S6 y( w) l0 Y0 }5 j" x3 @7 v
if(debug)
$ y: L2 i: |. q+ D! k5 W {
; O% z! X) U! \" c0 u5 m alert("remove invisiable!");4 ~! v8 ~! Q! E B0 ]
}, H$ ~( E& F) @) _
node.parentNode.removeChild(node);
) e/ f* j1 _# G( h! k2 f0 k, g
/ ]1 H0 j- K1 h1 G& v }
( z; k: }. A/ i( N2 `9 F) c else - B; j8 b5 |! ^6 Q& d
{
, O3 H4 d1 _5 {- y if(node.parentNode)
' a" b0 _* [/ h6 c- V# \6 h {
/ I3 w8 A# {* j8 [1 S# P$ \ var orgNode=node;
+ n" [: }& L2 L var orgColor=this.getobjstyle(orgNode,"color")
/ x* V) ^2 r( Z/ o1 v var orgRGB=getRGB(orgColor);
4 i6 H+ Y9 R' n 4 R J2 ^5 }( _" j( c
var parentNode=node.parentNode
2 T6 V6 W+ M) @+ k% I var parentBgColor=this.getobjstyle(parentNode,"background-color");* X! F/ O6 T3 k$ T7 t
; K! x. ?! t- h- o var isLast=false;( g. F) A' g. i" D. y/ ]" d
& f2 \% }0 e; R1 x) v7 N
while(parentBgColor == "transparent")
$ `) S+ d! T$ O0 x6 X, m {
# J2 P" s6 D; z( X , _+ `& G5 ]- |; ?1 @+ |
8 B4 |% i: q+ P& A if(parentNode.parentNode == null). K( [% o4 T9 n- }1 X
{$ F9 Y2 K/ u6 z2 q
isLast=true;5 I% ]+ g6 o% H9 C
break;
6 h5 x4 z j' C0 o0 u }
1 }+ B' i' U0 W4 K4 I; ], a parentNode=parentNode.parentNode;5 o9 |8 z2 X. ?7 I& m9 {( Y
parentBgColor=this.getobjstyle(parentNode,"background-color");
: ~) ]2 C. y5 b8 r" R" x
- |3 l) f1 D7 W* m if(parentBgColor != "transparent")
1 Q2 I& V# W! M: z {
3 u- L2 _) n' m% C' m1 n! P! h break;
' k3 e) X$ Y9 `' a5 l# I }- R' b1 O* i0 j8 D
}/ u C8 w& B% Y) S
if(isLast) 4 \1 T' J3 o" f
{
# L; R# V+ _5 e4 g/ B if(debug)) b3 c& K' c% m. E0 P( S8 T+ H
{" n; P3 w6 {8 n' Z
alert("last!!");8 Z ~; t9 X; k: t$ z* V6 l! M, l
}5 e# S: `$ D; c$ |
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))& ]9 M9 z' T/ Y- \/ `
{6 O l" c" J' @" t% b- N1 E
orgNode.parentNode.removeChild(orgNode);
4 i" b, V2 p1 W }
: N+ V! {) m7 f, i }0 Z8 a8 r% Q3 T2 |% }
else* e8 g; q: H9 C0 c2 ]3 |6 c! O
{; d# G( g1 h4 X, @* ]: U9 `
if(debug)
+ K7 t/ W' c+ `1 P \6 @. A1 S1 r; j {/ C! z; K9 V& P8 Z
alert("compare color and parent bgcolor!");
# H6 h) O4 \' C6 f: F: F7 R }( T5 |6 t2 _0 e9 G' ? `& [6 J
parentBgRGB=getRGB(parentBgColor);: h" y. D1 L/ J& G4 N( m
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
9 c% k: H7 q1 {1 a2 |3 ~& c {
2 O6 d, u# h ] orgNode.parentNode.removeChild(orgNode);
+ m% l L* s/ h$ ? }# G; C u4 T# ^* j: b
}
- Y" h# G) E9 z }
- q* A9 F4 D* o } G1 l0 c$ o, a$ a+ a& i/ ~7 ?2 |' q+ Z
}
( c0 q$ _0 g) n/ D }, h. n0 I0 k. D6 ^
4 G: U/ p0 |) Y5 i% b1 b
$ U2 p! T7 {6 d4 S6 H# \5 W8 x+ S6 i4 ` var itemFrames = page.getElementsByTagName("frame");
5 j7 h. Z$ K- i var itemiFrames = page.getElementsByTagName("iframe");
% C# v$ g7 S5 m4 z
! N% s' z" E, Q. _ var frame, iframe;+ b1 \3 F- T6 }* Y9 Z, v; \! \/ N
if (itemFrames.length > 0). S7 r+ ^4 c9 ~( S$ K* O' e4 ?
{- Y0 W; K2 S: J
for (var i = 0 ; i< itemFrames.length ; i++) 0 W1 k) O" X, Z6 J) v' Z" K
{! `9 s" g* } R! C" H3 ]! S
frame = itemFrames.contentDocument;
: Q$ t: k( A' [4 T this.RemoveHide(frame,objname); 3 N7 `# ~" \4 X7 o9 m* ^
}) J9 J- `2 P' V+ Y/ k5 [
}, y$ x% r/ f% P
if (itemiFrames.length > 0)
4 L* n. F7 k6 n( o" ^+ e" I {$ U: l( D9 @+ X( I& L4 ]
for (var i = 0 ; i < itemiFrames.length ; i++)
5 l2 n1 V3 s- d2 G { L0 b3 i! K ?0 t$ e( G! d! R6 y9 {
iframe = itemiFrames.contentDocument;7 @; t# h9 |) N1 P* X
this.RemoveHide(iframe,objname);
1 u% q& F& p1 [& S }
. b0 }/ u4 l3 V( p }
[ V( j9 o; [+ ^ Q5 V }
- J/ a2 E! z4 D# i m- n5 w; y- D3 N catch(e) \# t6 A$ o6 Y* O! h4 Q, a
{
+ B2 u9 S: v" F3 C! v- [/ y if(debug)
0 z3 a2 M4 Y0 p$ q/ Z# U4 r {) Y% S4 c' H9 j b
alert(e.message);
7 K3 q) D: ~$ ~! }$ Q- p }+ S' b" y; U" {: J3 P1 U+ `7 G
}, p6 K( \' X& F y: _2 Q
}
% ^( O) w4 w" I& D / j( W- x. i1 o) I- |
}; U# ~% h/ q- }3 _! X: k- \' V
5 w4 X; g q- A, w jfunction getRGB(colorString)/ H8 I0 R0 o# h( e$ l% b0 _: a4 w) @
{
# Z5 l6 p. H0 H* J1 H$ N1 b var RGB = new Array;2 i1 X9 h# v+ e r' l
var tempSting=colorString.substring(4,colorString.length-1);
8 G, c2 i7 O$ H var tempArray=tempSting.split(",");
8 Z S/ y4 {* W/ Z& \/ a8 u W* d: F7 l, F% k
RGB[0]=parseInt(tempArray[0]);
5 I& S j, r* r! {9 |7 o1 T% J. D RGB[1]=parseInt(tempArray[1]);2 \, T3 h) Y/ N
RGB[2]=parseInt(tempArray[2]);% ?) f/ l4 Q9 Z" l- N) l4 {5 p
+ ]( H7 w) r- R, J# \ return RGB;
% \+ n, ]2 V W D$ |}) s R. c& p# P
function keys(evt)
1 k7 x4 R9 {3 n {
7 g, w8 f: V0 a$ Y2 C P if(evt.ctrlKey && evt.keyCode=="81") 5 S2 g0 X3 t; @/ [& m [, x
{ 1 T" N+ v$ e# Q; F; R
CleanHideObj.on(0,1);
3 H5 B7 g s/ k( i( q alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
. I! X9 ]( ]3 r; x+ X+ o# u
: r+ ]/ ^( g- L7 p/ A Y }
5 N- c& M) W8 j; c/ m }
( M4 {; i2 d2 ]8 o% Pdocument.addEventListener('keydown', keys, false); 2 O$ u& O! D* N9 W6 \
GM_registerMenuCommand ('Clean Hide',# j( Z6 `7 O; g! {+ j1 g3 o2 b! [
function(e){
+ r* ]& |1 G% |CleanHideObj.on(0,1)
* ~- N- B# k7 q( r$ U T* nalert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
3 p+ H! L7 `" c/ V" R});
6 b- G" m9 I1 k0 L' n; B" H: \& y |
评分
-
查看全部评分
|