|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
, e# s' w. I6 `" H1 h
/ y* W5 v" M$ ]+ x8 v+ O火狐插件,用猴子* S$ L$ `- ?& j
Q) D8 C1 Z4 X' W) C
var debug=false;
0 C6 v V: n3 ^, @, `var CleanHideObj=new CleanHideClass();
# c c9 k9 i: ]5 B1 v* N; V; `% ?- s
function CleanHideClass()
4 h8 x, p! _# {) W# A9 o8 z{ , d+ I7 W$ Y( n' h, K
; i4 B) O7 f# O# c5 o) b" [: D this.on=function(id,bMZ)
: Z# m$ E+ I4 c; H: L e8 e {
' ~9 r) y* K5 W7 o( s$ d u 0 K) T6 ~, G5 p- S9 V
if(id == 0)4 c, F) ]$ Q3 C# T# o
{2 _. I1 Q3 M. ]& A$ J/ h3 @
var page=/* document.getElementById("content").contentDocument */document;
6 P* S9 W. I( ?, j this.RemoveHide(page,"span");
6 i: w/ u% V) B- G this.RemoveHide(page,"font");. {, a p6 k9 D, n1 T! p9 d
this.RemoveHide(page,"div");
, L5 e7 q# x2 C( [, ?% w this.RemoveHide(page,"p");
5 w' k( |# g9 n: X
( l9 F* { r, A }4 X b" i" m: w4 e3 L
! f P" H* x9 v- u& y1 q
}/ x9 S! h4 h9 _' [* U% P3 q
this.getobjstyle=function(node,prop)/ L& M6 d9 _0 p5 q5 \# i% V
{
* x8 } B8 r0 ^% a& a0 b4 E try. ?" n% U5 S+ x/ x$ y: P
{' W) s+ ~: J, _- G
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);- f# k+ ~5 c2 c/ r
}
/ q& w$ I* v* I( n catch(e)) v9 S! K$ g) O1 @
{' A; b S) [; B: B; V# O/ {8 L
if(debug)
6 K- d) }( U e) @$ h {- ], d- k4 y% y) R
alert(e.message);
1 J% U3 S" Q+ _& Q9 o }
7 ] P; U5 M+ n1 y/ F0 S" W
$ n. B$ D; S7 n" @/ Q9 p/ Y! d* ~ return "200";% e+ l+ g: t- J: T' f+ r
}4 c# E' c" Y! c( B, d
}5 S3 T. j( T; B, v0 K& `7 _
" D* V6 F$ w2 R; z& F
this.RemoveHide=function(page,objname)
! e* G$ f |5 B; R, q2 s+ Q { o! f S' ]7 K7 A" t' A, G
try
, y/ O0 n- y F* x* D {
( j- U7 i" q& t var minValue=15;
/ ]7 I: H% [$ }+ w1 m+ d var objs=page.getElementsByTagName(objname); ) G3 s/ H( m, t
# i4 [- j; y* [3 J& }& ?7 y if(objs.length == 0) 7 c i: r0 r8 E" C V! q4 X2 N' E
{
8 H! Z e) F3 E8 E( U" p8 P6 ] if(debug)
' W/ A# Z1 x' [$ } {7 v" h- W" m5 v5 ]/ H8 ]7 Q
alert("no object found!:"+objname);
1 B9 s/ Y% g! F* T( l4 Y }
9 J6 b1 C0 X- e/ }, o9 O R }
( I B4 \8 {1 W6 ^ else+ i- A$ v! v! | a+ E
{* y" X n/ }' L+ M0 j' m: E
8 s$ u7 ?/ Z+ I& V& T( i
for(var i=objs.length-1;i>=0;i--)
8 O3 ]: x" G9 a' g {
1 X3 L: y j9 T) K var node=objs.item(i);
8 _: J9 r2 U; C$ {2 G8 I . J" u5 j0 X7 O& n) `
# c8 L; Y! l' m$ h' o! S6 s/ \4 n
if(this.getobjstyle(node,"display") == "none" ||4 @2 s U! g. K3 s. n
this.getobjstyle(node,"visibility") =="hidden" ||
% w6 a5 L* e0 e3 e6 G: I- |5 J3 m parseInt(this.getobjstyle(node,"font-size")) == 0) & Z; y4 J4 Q2 I
{
" U6 p/ P0 N: X2 E# U9 |! Z if(debug)
7 G4 b4 {9 U- ~0 U" K' ` {
# T! @. P. N. Z% V' y: T$ J alert("remove invisiable!");
$ a$ U/ h6 i$ w# g3 \ }6 N- s i; V, @7 C4 `* _
node.parentNode.removeChild(node);
7 q* b( ]) y1 ~2 J9 h0 G% G ( v& `9 g3 J' l1 u- q; i
}( r7 ]+ | `& v) I$ h ]7 x
else & y( E, I5 O+ S( B3 X
{+ F' t' d5 J, u! T# H2 E( n
if(node.parentNode)
- h- p. o4 N' `" h4 e; ?) U" z( ^ {) }; N d+ s7 {; E
var orgNode=node;* O1 |6 i* c! \/ c9 ^; v! L1 Z1 O
var orgColor=this.getobjstyle(orgNode,"color")
- y" U, g1 m$ E& F var orgRGB=getRGB(orgColor);
+ i1 |$ L- k1 c/ Z, @2 @/ o% } |
' T$ k( ~9 P) F5 `- A var parentNode=node.parentNode
" v3 }3 B. V5 P var parentBgColor=this.getobjstyle(parentNode,"background-color");
3 a) p2 k9 @! Y+ X: G/ U/ Z
B& W8 \! V! {+ A var isLast=false;5 A5 L! A. T: b5 q1 D% K9 N% M
, K" G# |% ]1 s$ ^/ h7 h4 Z
while(parentBgColor == "transparent")
2 O. I+ Z. y8 [7 z' l3 C+ Y {
2 d0 y6 z' I' F1 G- \& y) f
; [8 U/ w. ^. z) g
' h4 W" C+ u# }6 a if(parentNode.parentNode == null)0 } O! {/ f# C9 i
{
( i" d# g# }6 T: t1 { isLast=true;8 Z3 ?& p; `- b* g r
break;
. R% Y* R* C {5 g, g5 _" S }- ?9 T% M! P: q! G' u3 }+ K5 ]
parentNode=parentNode.parentNode;
, |$ y" Y# ^# b parentBgColor=this.getobjstyle(parentNode,"background-color");
9 e' u1 Z2 M" c0 `' n Y0 A! w" Q" Z1 f3 P# R6 q
if(parentBgColor != "transparent")
7 Y. g( t. n" x2 B9 n6 ?7 K# Q, H9 p* T {/ }: i3 A* ]0 O F5 b
break;& C$ t* E) W3 z( y3 u3 Y
}
, [! I/ _( P0 Z! B" O2 d7 B. U }
4 ]; a+ g. e1 `" o' J4 m! c+ o+ F if(isLast)
0 E8 ^6 V1 X$ }4 Q. y( i# L, }: X {
E5 w; a% J' k4 u% C/ a9 W3 F. h! G if(debug)' o" O7 C7 z% |( G
{$ H0 G( g5 l% V6 r
alert("last!!");) t$ `- M$ J1 G+ G2 H- B
}
& V! O9 K: M; A1 A1 F; | x if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue)); N* a7 j/ v$ K) `7 C% E2 g- {
{6 C; F2 Q/ Q9 _5 W" p7 s8 e
orgNode.parentNode.removeChild(orgNode);
: E/ [0 G% d6 k5 D, F( H7 u, f4 _ }
1 e* Y3 g Q% F6 X- x }
8 F z- h7 @' J, \2 y else
, `% b6 c5 b& a5 `0 d# ^+ z+ H8 E' G {9 O* F4 H2 B0 N4 t" N- f1 d
if(debug)
! h/ r; k A" O {) e6 i$ d! ?5 `% ~& @, t; ]$ Y
alert("compare color and parent bgcolor!");
4 C: R1 e2 b2 W8 d' i+ O2 `( p }
3 \7 p) V v) s6 C parentBgRGB=getRGB(parentBgColor);
: g, g9 e; s" @# L if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
5 Q/ z% G, a5 q2 ?" |, Y8 x) F: Z7 Q {
9 I" @( U( |6 h3 Y4 X9 T1 [ orgNode.parentNode.removeChild(orgNode); 8 i: a* C* @/ n* }) U; A2 i
}4 i4 y& o$ r! h& ]6 L
}
! i6 h$ C; F M1 g: l }
* w. D2 P5 I# i/ O }
* I' L i- N- E$ A' d3 K' C }
/ J; v' [5 e# k# `) C }
+ g. ~/ J! _; ]& f% _, S% X) f @9 Y
+ G( g6 V% a4 s0 i' c! j4 U5 \
5 H% D" `2 g3 b- b2 I/ j var itemFrames = page.getElementsByTagName("frame");
. S, P6 j8 ?3 E, ^6 o! J8 [ var itemiFrames = page.getElementsByTagName("iframe");$ f6 Q% E( b: d0 p6 U. w" J
! l2 l# d" B; R& n2 {( E/ L
var frame, iframe;
; l+ e& P. w( |" P if (itemFrames.length > 0)5 b! W* A0 O i; X* j6 e
{
; y' ?9 g) T1 N6 n0 } for (var i = 0 ; i< itemFrames.length ; i++) , U: D% C$ ?- W* a8 ]6 l; ]
{- ?7 i2 @) E& p) G
frame = itemFrames.contentDocument;
8 L1 `5 C2 R9 Z* s- W this.RemoveHide(frame,objname);
2 z6 r( M8 s0 ]% Y; @ }% G N, w& a9 X4 N) G: _2 \
}4 N8 b* f1 k8 d/ x
if (itemiFrames.length > 0)
4 ~: ~2 n; }" L" l {8 y3 A- F/ u4 h3 }( S- V9 O& m0 o
for (var i = 0 ; i < itemiFrames.length ; i++) ; Q( b8 K% _& M9 \# x! V! o
{$ e' h4 H; b! @7 h: I: G5 `
iframe = itemiFrames.contentDocument;5 x$ {) I- x6 q1 c0 _4 ?; Y# Y$ T" Z
this.RemoveHide(iframe,objname); 2 d8 S, ^, K$ J9 H2 B- e% h
}
- I3 f( x2 \- p5 b8 v; ]6 m' E( P }
% V9 m* k: }; ?$ B- P) U% t }
# s4 ^5 l( E) }" ^8 D3 \. R% K3 u catch(e): S. j, K o( O* w! y
{" n7 H+ U/ s6 H+ G/ g
if(debug)
' |$ ?3 K% ] A {" A+ n2 R9 u; Y+ c
alert(e.message);
9 G9 y# M! D& U* l. v* w7 h$ _8 X }
) ]0 H. p( L+ W; [/ ~. j8 r8 q }
8 {0 P5 T# w; L9 O! G d }
: o l7 f; y2 J0 v# M, E6 n: W3 ~ ; |" X1 S2 t: [: b0 k* _# @9 ~
}0 F+ C; d P& K' ~' N
, k$ w2 r1 `: Efunction getRGB(colorString)/ S7 ^/ V5 }1 ^3 A$ R
{% F0 M) p- W- Y! D6 @- C
var RGB = new Array;+ S& ?4 k: W9 j* X& k* p, y
var tempSting=colorString.substring(4,colorString.length-1);
5 Y ~( D: t% Y* A var tempArray=tempSting.split(",");
8 j f( z) L8 N% E
" N* S0 g8 P$ N6 q RGB[0]=parseInt(tempArray[0]);2 N$ B5 y; V1 r6 R& V- z# C) E
RGB[1]=parseInt(tempArray[1]);$ m% s+ b" x2 P Z' C; A1 p7 n n
RGB[2]=parseInt(tempArray[2]);' y9 t* M6 ~" N# d# |
# V# d" ~% H, v. I R; p* _ return RGB;
1 X" Z5 D. P% K}7 {, o& D/ Y5 o/ j$ k0 V$ {
function keys(evt) - P8 A c, D: z' N
{
6 w6 Y3 ~# D$ U5 ^; d$ `1 E4 r% H if(evt.ctrlKey && evt.keyCode=="81")
" _' d1 H2 K: c1 ~' X* o; j { 3 M5 B- Q# o. a) B0 I: w# ]
CleanHideObj.on(0,1);
" r8 [5 v! \- u4 S% { alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); $ Z7 {8 E. R* i0 w
3 A6 H, t( |5 u& r1 y+ D) t
} 5 j9 a2 @: `) \. ?! P# n3 m! Z
} # s/ @! |- `3 x. n& m& p
document.addEventListener('keydown', keys, false); & z7 `; k) L# _ o# m
GM_registerMenuCommand ('Clean Hide',! M" T( t, @" q
function(e){
5 z: Y1 q9 J Q! LCleanHideObj.on(0,1)
& Q% h8 O# @( _/ g$ K1 B7 v$ L! ]alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");) I {. w6 Q- W# f& r: O
});
4 _' _$ x$ P, i( Q9 ] |
评分
-
查看全部评分
|