|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
0 T- B1 L2 K \1 U% G5 f6 \- S
# n: ]2 t' F5 {% |火狐插件,用猴子
5 B: h/ B6 C" v$ u0 b$ K/ Z: U( ]* c* s: M1 S, Q ?" v
var debug=false;
0 Z5 q+ \2 S' t; C3 p2 Hvar CleanHideObj=new CleanHideClass();9 S2 z) S, {2 G5 f+ H
+ S7 ^ f" \( }3 h) H- M$ P P& N6 Y6 w
function CleanHideClass() & b. s3 f Q, h- a: d
{
% K' i* T2 `5 \7 {* i5 T& K 9 f/ t, ^- E7 d( i
this.on=function(id,bMZ)
8 [, c/ K; A B3 z3 S0 [" h* f) w {
7 Y# v" B1 I. i* g- d" d5 W/ @! l 7 Z: _4 o: C# k3 W! [0 ~
if(id == 0)
7 _4 Y( m$ p' e5 f& p* [: J& E& B {+ o0 u% m) w8 Y# `
var page=/* document.getElementById("content").contentDocument */document; * o2 o: v, o4 M& e( E4 G6 R5 A
this.RemoveHide(page,"span");
9 W* w& G6 ]) Y! H+ J( O, H0 L this.RemoveHide(page,"font");: g- P9 M) D$ }5 U& O- g
this.RemoveHide(page,"div");
( Y( b1 W( M# J$ D( E: I! w& Y6 h this.RemoveHide(page,"p");
$ p* i/ d$ z7 Z, X) F ]
. P, P+ d. ?# J }- @: c. ~+ _, X# H2 @
' ?' B3 Q7 J! V) T
}/ w6 H9 l5 P6 F' R! N% ?
this.getobjstyle=function(node,prop)
4 U6 l+ j) w: P, c3 h {9 E; n9 ^ z2 T0 v+ B
try
6 _- ]4 k5 G2 d( j3 a {
/ F2 Q5 R* s; {) ] return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
( `! v! i4 b+ ?! g$ z }! G& Y2 ]( r0 w' P5 P
catch(e): R3 A( Y0 z n. L% V* s
{/ i& I' Z4 o( q, a- j* E% ~: [- o
if(debug) a% W2 t$ @ V; Z3 c p
{6 t2 Z- j. P/ K+ Z3 R
alert(e.message);
. W$ _* S- E% L: ?; Q; |8 G }
1 _' u0 V- [; [3 {$ X
8 W" w+ O$ y+ G. E/ u return "200";2 o( Y C+ B! @3 h
}
! k/ h8 k- I/ a" j& X$ h }
2 q/ R* n' v7 e5 ?; N% U . |( w( I' {/ i. w1 Y$ x/ U1 Y
this.RemoveHide=function(page,objname)& l, N) p5 Y% D& a0 G
{- a7 H* ^: J# B1 O& c9 ?( Q
try# B& K c: F3 ?+ `+ o9 P7 n
{& v& }- b& d. `: k: K3 Y1 @" X
var minValue=15;
/ |8 \- [& m! z0 [2 a: I0 r+ t var objs=page.getElementsByTagName(objname); 6 s. l3 Q( s: d2 q7 S" O+ q
9 h: p3 _0 Z3 [8 d* M' Z if(objs.length == 0)
; t2 C5 x: o. } {- s& f3 X8 @9 J7 s& A- X; v; \
if(debug); h4 u0 ~: u) }# C) P# Z! Q
{
& `6 y; E; f6 m. Y: V, {( H) f alert("no object found!:"+objname); ?9 o1 k& r& t
}
/ f7 }8 w7 P$ G. {0 C" F0 c }
7 b5 t% X! Z0 e* I1 { else4 ?3 [2 f$ A" j9 g3 q
{
. o4 y9 o$ G% I+ s/ `* g; a; L7 i4 A
1 Q, \, r z5 a/ s1 x5 L% P for(var i=objs.length-1;i>=0;i--) 3 z9 J; k4 ~% B
{- E& E7 V$ g0 a T: F
var node=objs.item(i); " i3 b* x* t1 U( D/ m8 C ~* j
& b7 q f0 j: f; V/ w. K, G& M
/ |: f( s* ^8 o" ^
if(this.getobjstyle(node,"display") == "none" ||
& }. B W! J$ K this.getobjstyle(node,"visibility") =="hidden" ||+ Z# K0 o* N5 _# V% e
parseInt(this.getobjstyle(node,"font-size")) == 0) B" m1 \, K% |1 ^- d$ _4 @+ @
{0 x! f, u- }0 Z8 W0 w# r8 h
if(debug)8 b6 W" p+ n5 m. g
{
1 _, ^0 F0 y- M: x+ E alert("remove invisiable!");8 }7 ^% a' V- W& k- o! o8 l, s
}
* {) _ v% ^, H: a- H/ z+ d node.parentNode.removeChild(node);7 Z2 A# U3 M8 \8 _) T
) J2 g1 z$ Y' s* e1 E6 L) k( F
}
f7 |: P) ^* {. H& P else
3 ^ c# y$ `# W3 `0 h N {
: @- h8 b& f$ _ @7 o& B# |1 x1 {! H if(node.parentNode)
0 e4 I) F. Q) e+ F$ i8 B7 S4 W9 X {
( I( O, |; Y& ?6 W- E- N var orgNode=node;* N( G6 H, @9 h) M6 o* [' ^, N
var orgColor=this.getobjstyle(orgNode,"color")
* c! o" @" r; |; n1 y1 C! B var orgRGB=getRGB(orgColor); $ c# S+ E4 ?: q: l* ?8 B
$ {7 a! l' t3 O8 F& L7 M J: K var parentNode=node.parentNode
n. f ^- X/ J' P2 ~" K8 L$ e. T var parentBgColor=this.getobjstyle(parentNode,"background-color");
* f' Z# Q8 E! O4 q 3 F; q* J! [3 E- D3 Y* A
var isLast=false;
$ G4 J8 [6 N) O0 R/ y; d
* K7 f9 t9 o4 g9 T, F" D/ U while(parentBgColor == "transparent")
+ w$ ^: ~9 D( {% j6 g3 `5 W {
; H7 [- D8 m" j; B3 N* P5 b + K2 N4 [# S |- v+ ~5 L/ ?# P
0 S4 t: U6 j6 Z# b" q if(parentNode.parentNode == null)
8 q# u) Y2 Y4 Q2 c1 ` {
6 e$ Y/ y) G: G* Z4 c isLast=true;( g' [% z) x" a& Q( _' X5 o9 n
break;% x* j; t3 n1 w( [! N7 d
}3 V% [* \* K P4 H5 T8 t
parentNode=parentNode.parentNode;
8 Z) ~' f& U9 Y7 E$ Q parentBgColor=this.getobjstyle(parentNode,"background-color");5 J2 l% N/ r' N3 b# G6 _- \
' T; ]2 a0 O# y2 b
if(parentBgColor != "transparent") & s$ J, `+ w7 j3 ^7 g
{" a" m- Y- W4 @/ u3 Z; d
break;/ x- Y8 Y/ `5 G% Q; l9 r1 Y0 J
}1 T$ P4 ~1 E% H' @* U, A; Z/ d, n
}9 c7 V+ W5 k: y7 l" g! J# }2 T+ p. N
if(isLast)
- Z" ~* C* `" n' t; q0 ~ {- k" p( h; D: Q/ I+ }) K- H
if(debug)
& W/ J1 T/ s$ O% Q% \- H {
! [8 h+ C0 C3 d! l! E; T, { alert("last!!");
) K5 H$ g! a$ I1 t3 ~+ ~9 |0 ~' d }
3 ^- _* a0 Z! k" {# U if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
/ Y, N3 t% |" @1 V3 K {
5 E* c% u& a8 k orgNode.parentNode.removeChild(orgNode); & X) N$ u3 o7 B2 q
}
7 H# n+ I. X9 J: Q8 E8 l }" O+ ~; K% ~- ]2 `
else
' x" n2 [# r" l( U {
7 G6 r8 l" {$ T+ f7 n; R if(debug): q7 M9 A: c3 B1 o7 s8 W# R
{
( L/ y$ v; {- _( J* `. E alert("compare color and parent bgcolor!");4 y# r* ~' F4 ~: o
}9 U9 `5 d8 i# ~+ f" x
parentBgRGB=getRGB(parentBgColor);& E- w* ]& X5 V
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))* L/ B4 X0 Q- E1 M( E Z$ H' m# B# Q
{
# c$ ]! p9 q% X" \8 C# l orgNode.parentNode.removeChild(orgNode); 5 A! j) w3 k$ C6 B% q
}
% C7 N& G* y4 d. Z }1 D8 j4 H' b/ x: d8 }9 N
} W/ q, V8 m G+ j/ ?, j% _ \
}
- j' J6 n9 X7 p- a# [# `/ D8 L7 v4 N }
' B/ b p- h4 o8 d( z% K }
5 }0 a: f; N$ ^7 G2 a% D9 X
* b% G4 {* X+ H$ D( n9 p- _8 C0 h' z( z 7 [1 E& \ e7 F6 s
var itemFrames = page.getElementsByTagName("frame");
* @0 }4 f' H* o) N# X( l var itemiFrames = page.getElementsByTagName("iframe");
' o2 w0 a+ t" W9 A ) ?' N$ D2 A/ N! c
var frame, iframe;6 ^/ _1 o3 K3 L8 X N: m) O7 ~
if (itemFrames.length > 0)
6 m% w, }4 T6 R/ v' I, I" K# w2 ? {( b8 F9 \0 B) h& f; _3 D( l& U7 B
for (var i = 0 ; i< itemFrames.length ; i++) 1 c5 F* S6 w* w$ P- e4 S. A
{
% T7 C& q) |( y6 ?: o$ L) C6 G; {, z3 v3 T frame = itemFrames.contentDocument;
' I$ X$ g. A S; x" _- x this.RemoveHide(frame,objname);
" m* q2 u0 s( r& u0 ]+ u }
: x9 J' j8 {( ~: d }+ T" S: U" M. V$ P- r
if (itemiFrames.length > 0)7 F7 P( T+ U% a v8 `% ~3 U
{
: ? f. b8 Y# P1 r" n4 \2 N for (var i = 0 ; i < itemiFrames.length ; i++) " l( t+ q R1 w: p' n" l. |
{# j. n& V5 y+ r% @( {4 @8 i; v# o
iframe = itemiFrames.contentDocument;# e" J# [/ v5 O4 h% l, L
this.RemoveHide(iframe,objname);
% l. D0 U/ Q! T, K7 N( `: D }
( Z! @9 t' _1 S }
. ^7 L! c* G& m: h% \" r; S }* H' ?2 L: {0 J7 {, g. x
catch(e)
) |- T* Z% E& |# B/ {2 E0 U$ D* B* ~ {3 v: J3 t2 {7 r' u, _5 h$ w- B
if(debug)& t5 A6 P7 L1 \3 H- t+ H% V
{6 H% z6 o- T$ _' c7 I5 s
alert(e.message);- X0 K: k& b& h6 a( K9 ^7 |
}$ u9 h2 a) v8 M' x6 b+ c4 I
}
3 ~. N; W) W8 k' D8 W( a }1 \: _# x. V" i3 o! t, G, @ J; K- {
' b" i, L: S+ b0 O0 j5 W}
3 }8 Z: v2 ~" G- t( V* ~
. [+ m$ [0 A% f d( b$ ]" L. Yfunction getRGB(colorString)
- r; L$ H* ^3 r3 E3 m{
5 i9 o4 R' n9 s# f var RGB = new Array;
3 o* W+ u% A' b" u; u' M8 T1 h8 E var tempSting=colorString.substring(4,colorString.length-1);# G- Z3 E: g- W5 s, i [& G
var tempArray=tempSting.split(",");
9 `# z$ F7 g) t3 s! V( ?% h% P! z9 c8 C- `* Y' j
RGB[0]=parseInt(tempArray[0]);/ j: y) g" b* x! X/ ^
RGB[1]=parseInt(tempArray[1]);! C! E- t2 z# z6 ~0 |" `1 @
RGB[2]=parseInt(tempArray[2]);/ z2 \- r- C( S9 n
, J* A' d" n( u9 v return RGB;* m) X, D7 h' @7 @4 {
}9 P( y* R; b2 b
function keys(evt)
4 j2 i/ K8 |. q {
- w" E' L' [$ s if(evt.ctrlKey && evt.keyCode=="81") ; P, G* P- I8 }& G, \
{ ' o$ C! C( R2 Q4 D1 r+ ^6 v" F/ P
CleanHideObj.on(0,1);4 O- ~5 \3 t& D1 W' M
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); , U* C3 l- b0 h; y0 s# H# r6 z% R
% K' u% S0 [4 F7 c8 D5 r" T1 A }
$ u* v- h b( T$ o2 F' [ }
: d2 u# ?7 J% j2 [document.addEventListener('keydown', keys, false); 7 B6 J) z, w8 _5 A7 j% m) R7 {2 c
GM_registerMenuCommand ('Clean Hide',
! d6 n! t2 }* e$ }" _function(e){- Q9 N4 T K3 y- B, i. E
CleanHideObj.on(0,1)' b& N7 J. u" Q! K# f5 R, b; f
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");8 _8 G- k4 v: E5 x
});
$ D& V n% i9 f0 \- B |
评分
-
查看全部评分
|