|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 ) H- T2 j- T9 ^8 S& @
( |3 j( D) C4 Y& U) ~/ @" I
火狐插件,用猴子
$ `4 @3 L$ s7 p% D6 V/ l9 W' R; p; \' l1 C0 h/ n6 M
var debug=false; ) n2 ?- d' u! P
var CleanHideObj=new CleanHideClass();0 V u8 I/ A$ W. ?, N3 ^1 y
: W: F) ~# J: p% Afunction CleanHideClass()
8 x1 f# z2 k# y{ ( D. N1 Q1 o: e
6 _/ `. {/ j4 A; e
this.on=function(id,bMZ)- ?9 i) ?5 U0 H
{
; F# S' C! E) a6 g: |! K / r4 M F |1 \, `9 o
if(id == 0)
+ @0 @( I) u" I) A3 { {
- k" S# l0 h$ ~ var page=/* document.getElementById("content").contentDocument */document; 3 i: f% V. k0 O' l. d
this.RemoveHide(page,"span");
% l1 \/ _ d. y- [7 O this.RemoveHide(page,"font");
: v- x" a3 j2 e4 `9 H' f# G0 T, H7 W this.RemoveHide(page,"div");/ F! I7 ?1 S' e7 j5 c( ~ f( i
this.RemoveHide(page,"p");
. T" l4 b& K6 T4 x6 H * h9 Z, h' a% v+ }& E
}
* F; J1 e. h) l2 ]8 _3 z6 e 2 g# d9 q' I% w
}
4 G' g$ f8 z# {: }) }6 X this.getobjstyle=function(node,prop)
$ {6 `! R: n# S, t7 q {% N; N# q8 M$ f
try, C! H" {! {( Z- o# O
{. b1 F& t& f# J- d* j5 P' s+ G3 d
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
- \$ I) ` d* @0 J% H6 K* m }
' o3 U* s5 c$ H( M" d* [) Y2 w catch(e)
& E( X5 j9 a P: g# Z {0 p9 _; d2 Z/ s4 Y: b! _* m2 v
if(debug)
# c% W: I6 n* |* A) Y! W* x4 @( ^& X {4 H' K8 ]6 N! u% F
alert(e.message);5 s* ~6 G, g+ {' g5 }
}4 Y# f+ Y* i2 s+ ~
3 ]4 l1 p4 I& C& Q8 c2 d/ a
return "200";, c1 n( I6 R: k6 Y
}
( Y! S1 s6 _8 d) M9 g$ s }% ?$ ? V! o, |( a4 s1 P
; w4 `4 C' R/ {5 n9 R( {
this.RemoveHide=function(page,objname)7 R5 f7 P q* [; v2 P" s
{
+ |8 \! ?7 K; i% d" M# ^1 i try. m; G! U( b' |& h8 Z- z
{' V4 X. y9 a; B" Z: E$ I) o8 p T
var minValue=15;; H( {% H2 r. I1 a8 {5 g& z
var objs=page.getElementsByTagName(objname);
( Q1 T; V4 c5 f4 _
3 S* W- ~& b$ r: P7 }& |) G if(objs.length == 0) 0 a- O. Y% B6 i4 _ G9 X
{
% T& N1 a! A- t4 H+ y if(debug)
" O! n5 W0 P O' Z, j; D) W' p {
! O0 {2 j; r; R4 x alert("no object found!:"+objname);6 s: N/ F. w9 C. z/ V( p
}% G/ B! j5 S5 o8 y
}2 g( k% \+ \ K. r/ B7 O
else7 B# ?# x& g2 h" J; h
{
3 W, C1 q8 r- W- `+ D
2 u' j! w: Y G4 @# J* @ for(var i=objs.length-1;i>=0;i--)
5 D. h# V: C% m; C/ g {
6 P% r5 t' s) ]5 q7 ?5 H. X6 a var node=objs.item(i);
# I9 y, {' _# e& N- D5 v " ^5 d1 q/ {% [. C- N: F
" v8 M( K% J' v$ c& i
if(this.getobjstyle(node,"display") == "none" ||
: V. G: X# _1 ~/ n this.getobjstyle(node,"visibility") =="hidden" ||
5 U) T2 [0 G0 b& I1 c" K5 ? parseInt(this.getobjstyle(node,"font-size")) == 0) 9 ~" I c6 i( c8 D. h5 `
{" M$ L' L; J+ j
if(debug)
' F* V& o/ P0 S6 j {
5 y8 }; }4 u+ u5 |8 B& C alert("remove invisiable!");
7 k7 q+ b8 z1 f1 p: I } O) t# T; z' V [4 P2 Q3 P
node.parentNode.removeChild(node);
; |5 [5 e% L$ k4 ]3 n3 U# w $ Q5 \$ }" c" H( [
}; ~. A% e! C* n% s. h
else , e, I2 E! I0 \, D4 ^' v
{9 N$ X% i3 q9 F( t/ }2 s
if(node.parentNode) $ h2 M6 {0 L6 w. T
{. r( \1 P' z' a: ` P5 ^
var orgNode=node;
! y5 s% b8 B5 ] var orgColor=this.getobjstyle(orgNode,"color")
. i" t) F; T3 Y1 |" Q, M var orgRGB=getRGB(orgColor);
3 k) e7 y# h8 S p& s: F8 W. ^' L% V
var parentNode=node.parentNode
) K& _( ^6 J$ K, ]; q0 L s; a var parentBgColor=this.getobjstyle(parentNode,"background-color");) n. B$ I7 Y+ f# U1 V) v5 P
$ v; Z6 o# R( f9 H1 D7 w; W# {' ^
var isLast=false;* I+ u% Y0 e& T7 |" C, \% R
8 i+ I# |7 L( u/ M) |
while(parentBgColor == "transparent") * ?; }8 _$ B- ?+ r: `: R
{
/ U* g( {3 {1 w% d, e5 ?
/ `# [ i6 h/ h3 y1 M t% U( H " ], Q" W3 T- a4 H
if(parentNode.parentNode == null), e: t3 z% V0 @, M9 U) S1 {8 J: E
{/ r$ g+ C6 I. b0 N( U; D0 D
isLast=true;
5 V2 g: u a+ _& M4 A9 T( O break;' N, Z% ]) p; i/ K8 m5 g% j$ X
}
; r( D7 c- |$ s3 M$ B; s7 i' e parentNode=parentNode.parentNode;7 T x6 v: ^* r% A- i# g
parentBgColor=this.getobjstyle(parentNode,"background-color");
1 G( g3 j- R, g. j; M# u
/ d* \4 r) R# e3 u' s$ H; q if(parentBgColor != "transparent") 0 u: B, z% R+ f V' T# }
{7 b% M( v2 b# @. y1 g/ u3 T
break;2 W5 j1 E% T1 H3 P) S$ @+ N7 ^
}
$ ]0 s8 i9 e1 F0 o" p5 r7 a* X }' Z4 O5 v, J- G' r9 _
if(isLast) # `- h4 ?: w0 H; ^" D
{" n# O4 l$ `6 Q, b" y; G
if(debug)2 y, q. l2 t: n5 y2 K- f
{
* `! o1 p. U, J0 ^- u' K$ D% l6 G alert("last!!");
. Y0 c+ q8 _ x$ c7 R }4 ~ k; Y4 ^3 K: Q
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
4 P$ ?) s% M0 u7 _3 |8 E4 R {$ R- h; C5 a- W/ w, z! }
orgNode.parentNode.removeChild(orgNode);
+ n6 q2 i& Q: S0 J4 U/ o. H- E }
$ g( ], t; h1 w, A }( d% ?4 q4 p( j
else7 t( E( _, i2 U- T; u( ?7 z9 I3 Z/ G
{
. {! K$ ~2 [$ y if(debug)* h7 F8 B' ?& I8 _0 R
{
" l+ e2 Z# i! n alert("compare color and parent bgcolor!");
1 |/ ~! |. D! ] }+ L, k3 s/ s; r1 d: |9 D( I5 _
parentBgRGB=getRGB(parentBgColor);
5 S" j% J9 }1 R3 ^( e* h7 S if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))2 w) F. c5 p6 u& r7 x4 a
{6 F5 l7 j7 ~' e# b1 d- o
orgNode.parentNode.removeChild(orgNode); 0 V0 g5 T$ @7 g: J, D* P8 a* F/ K/ K
}8 r j; o2 w* a
}, U6 c0 n0 U' c# i4 d8 U& h
} }2 x2 W% _$ G y }
}" w- b+ ^5 @: w. g% q
}1 L' t5 \/ Z" \- q* t0 ~4 s) u& V
}
5 l3 {' y- W( s6 |
! }+ {1 q( h; |. p( E$ R) H9 M
& s o6 m& D! {, w var itemFrames = page.getElementsByTagName("frame");
8 b2 g' e3 [, A2 O% t var itemiFrames = page.getElementsByTagName("iframe");
5 o% B, R( S* j+ ?; C
5 a( I T0 y, R/ b& h: E& X% [7 v var frame, iframe;" h, ]0 x; J, d& y( m
if (itemFrames.length > 0)
9 n x/ Z0 T# K" t6 O {
_2 D m* L+ R8 Q) n+ u4 q9 e for (var i = 0 ; i< itemFrames.length ; i++)
5 _* X1 [8 {# C. W" k8 Y {
4 I6 s# |8 i$ J' l- n9 B frame = itemFrames.contentDocument;
8 m4 U; j$ s, P9 B* k' z1 A9 R this.RemoveHide(frame,objname); & l# G# | Y- L' Y2 d
}
' g( j- D3 v8 Z6 Z$ I- j7 X }) A% Q- J2 q- R. H4 P. [
if (itemiFrames.length > 0)
2 O6 n# Y2 |; m, ~1 m, G! r {
! h3 l, w( Q8 ~: F7 ?9 Y( q for (var i = 0 ; i < itemiFrames.length ; i++)
6 Y5 \# K" Z1 T( S. D8 q {& C( I$ w' P$ _3 w3 P
iframe = itemiFrames.contentDocument;# p5 z" `6 f% ]4 i
this.RemoveHide(iframe,objname);
) |3 H/ s! L4 k' R1 B3 T& T }
/ s( G. K2 o1 \- m* q } R* h5 C" q. [. T- E2 a
}
6 g! F1 e5 J+ S0 L- K. Z, z* U8 {4 a catch(e)
' R; a& J/ P. W8 N9 j {
: f Q$ G% ]) l7 r0 K if(debug)1 b, c( q) `! ]3 o8 F# P `
{0 K" q! n' }: A; g. Q/ B
alert(e.message);: T1 H3 L) [! X: m: W% q
}
3 F, P3 p/ k m: S' l+ t }3 Z- E" Q/ j, L9 B3 V( y. I
}
6 `: e- B1 ^3 f! ~3 z' y+ x - F1 z) y, N6 y9 x; o( y v
}
0 j+ V. @* W0 G |6 N- P$ i4 d
; ?# b9 u+ c$ o9 v/ g4 J$ Afunction getRGB(colorString), t1 a+ M5 y6 Y5 _3 C5 v8 q4 d1 ]
{* \1 M+ Z8 O* I' v4 F: b, O2 B
var RGB = new Array;- r$ h, S7 Z8 ?& o) q
var tempSting=colorString.substring(4,colorString.length-1);3 O5 j, r) x4 s# e) J( {+ j% ?9 |
var tempArray=tempSting.split(",");
! w3 c5 L4 h5 m$ E1 A1 N1 N2 t& w' P+ i
RGB[0]=parseInt(tempArray[0]);
. P) H3 ?7 C6 `4 P! C1 k% w% l RGB[1]=parseInt(tempArray[1]);7 P8 _7 ]3 v. l2 ]
RGB[2]=parseInt(tempArray[2]);6 Z+ V" T5 p* d
" v2 K4 v2 A( d N- ?" P' j1 P4 k return RGB;& q8 G% R) O2 }
}
( `/ z8 r. }( p& Q" X; }function keys(evt)
$ M8 \6 `: ]+ s# e { 9 t0 ?! n. [3 y$ {+ o6 v
if(evt.ctrlKey && evt.keyCode=="81")
5 p6 K& z7 O: m. D' J3 E {
+ u& y* G7 ~5 `+ {& p; h CleanHideObj.on(0,1);
% d+ J% @) o0 Q1 D alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); 2 O% ~: N' g, }# `% P% }
' w' W6 ?6 d% s, K+ a# ~
} / {9 y( D+ k0 _/ b2 d$ O+ F
}
3 F4 M5 H/ n- S& Q* p8 L3 fdocument.addEventListener('keydown', keys, false); . d9 {( ^" u6 D+ n/ M
GM_registerMenuCommand ('Clean Hide',# E( N B& b) g7 f6 ?2 ?7 T
function(e){ S% m5 X( W0 o6 B
CleanHideObj.on(0,1)
7 z, e" V) ?5 q/ r& n/ Ralert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
9 M% [7 v9 p, f});* i6 }/ b; x1 B0 t. F6 j' f2 n3 K
|
评分
-
查看全部评分
|