|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 " `( l% V7 {- e7 J) d( b
; L: |3 b5 s# E/ n0 Q$ u$ O6 j+ X1 f3 L火狐插件,用猴子
8 x. u4 t- Y9 W7 } Y
( I8 x* s- q( k9 Rvar debug=false; $ a8 } L3 z% h: I9 Z
var CleanHideObj=new CleanHideClass();
( \$ n% T: X4 D
0 A; h [3 P V% j+ N( \( l5 k6 L% Zfunction CleanHideClass()
. E6 X" A2 ?4 A- L{ - I- ^5 M" O9 t) r
' Y' P2 L' X9 f2 \ this.on=function(id,bMZ)9 l8 O4 R1 N+ d- \8 L: M) ~! o
{% Q5 ]2 R2 p \# O) m# p
7 P) y7 ?8 G9 x7 M! i w* \1 W
if(id == 0): f4 Y4 v+ L" Y( r( x! P
{
; P, i5 \ g! y, w( g/ o var page=/* document.getElementById("content").contentDocument */document;
) J. n# G8 A3 d) r this.RemoveHide(page,"span");
# `, U3 f. k* Y/ E this.RemoveHide(page,"font");
% M `$ Q3 S0 W8 B& J7 ? this.RemoveHide(page,"div");
& R, a) _0 F0 y( y2 O8 d this.RemoveHide(page,"p");
" r( G9 a! j0 R1 m 4 a3 S) Q( Q4 c
}
: k$ ^, U: t2 }$ L! @
/ p; B8 G9 E" n }
6 ~; V+ E( q6 [9 ^9 F this.getobjstyle=function(node,prop), ^0 N. X* o J# a" Q4 [$ P
{
* P1 O2 N3 S& G1 x9 l try2 y. G; ]6 X3 f _
{. e7 Z: _+ w' D# i8 m$ g- U
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
& ~* L" C5 P0 ` m. y% o( M+ U { }
4 k; t' g. W8 u* K' H9 h catch(e)- x0 _2 @, L W3 `8 x
{
' E% g. U2 k/ H+ q! t# T! g( N if(debug)
1 Z9 P8 W9 V4 ] {& P6 Y3 b# Z2 N8 [- ~/ R
alert(e.message);5 R) I; q4 ]; {6 r( y
}
2 n' J& B: }1 Z) D& p$ U% ^. v+ u ( d6 {- Y( W" K8 i7 s8 ~
return "200";
. W* f. R( C8 N; c! b. @/ ~* x/ M; @7 Z }0 a2 B! l/ @/ x/ S; C
}1 [/ U c* P9 J
% M0 p. T, S3 d l
this.RemoveHide=function(page,objname)
: Y8 |, g3 t: \+ }* S {% F/ c) i1 e8 n- Y+ q- X
try2 c3 R2 a( F% y2 V( p6 ]
{ P9 W+ y9 N" _) g/ ]; @5 ~/ N
var minValue=15;
8 n7 w. [! A4 Z7 O5 @. } var objs=page.getElementsByTagName(objname); ; G* T( q7 c" r: {6 n/ Z" g# X
' @. u v* X0 L! A8 Z
if(objs.length == 0)
! z2 A8 p" K- U5 L5 u6 I {( b0 R# _# U. Y
if(debug)
8 |& U8 g( b: R: t& j1 F" G {
. h/ ]4 v) m0 G! C3 P* Z1 } alert("no object found!:"+objname);. A1 c. h- C( F# Q
}
+ @' r# B" l# i( f }- K/ ]- u- f8 C$ }6 c
else' _6 p/ c5 ~) \+ P1 M
{1 ~. a5 ~5 ~0 Z6 K7 S
4 d( n9 _' Y6 } for(var i=objs.length-1;i>=0;i--) # q1 Q, N# j- l0 ~
{3 w% ]* f. r. D9 `9 D
var node=objs.item(i); % h P5 S w" F; }$ x
2 L1 j6 L# E9 N! G" W
0 C5 \& }% {+ ]8 M if(this.getobjstyle(node,"display") == "none" ||1 j$ X9 k2 e- \$ T) v
this.getobjstyle(node,"visibility") =="hidden" ||
4 V& j+ Y+ `6 I parseInt(this.getobjstyle(node,"font-size")) == 0)
1 s/ Y0 e% r1 T+ a0 D9 q {
5 w* R# g& @# u4 E* G2 B if(debug)
2 p! R5 ~$ G% {: Z- a$ ?7 [+ j {. r% i. e7 b4 a9 m3 g
alert("remove invisiable!");: ?& [+ c) O8 Q. U9 m b
}7 l$ n- Z: q7 f5 C8 @3 D
node.parentNode.removeChild(node);/ p# ]+ k2 f. v
$ P+ @( @0 R1 t. ~' o/ q }
5 ^1 y! p2 l# O, _& x2 Q" c/ H else f' u/ H: d- D& x! Q
{
- ?6 H+ D; M6 w9 X$ G if(node.parentNode) ) `, e2 ?! I$ J( S+ {( J5 c, q% ^
{
$ s7 J4 @8 q2 Q9 O var orgNode=node;
5 _! |! n( `9 q8 W$ g1 b- K var orgColor=this.getobjstyle(orgNode,"color")
1 |% y" h0 |3 W( @ var orgRGB=getRGB(orgColor);
9 @+ n/ b0 i, s' W7 s1 }/ H
0 m% s }, x! C. G9 W var parentNode=node.parentNode
9 d" d- m4 X6 g) E" m var parentBgColor=this.getobjstyle(parentNode,"background-color");* J8 g. Q# a3 B
$ Y* N. M* B2 G- r7 b" [
var isLast=false;
6 E9 Q4 @ f# i/ f" ]
8 @& b- Z% n# T; N+ [. s while(parentBgColor == "transparent")
, q* g. _4 `6 \5 O# Y; d( B {: n1 q% ]- ~, k8 F5 H- G
& `& ~) y( \8 n X9 O' d `. k/ I7 L6 `0 C5 e
if(parentNode.parentNode == null)
, }( z0 D- w1 _$ c1 U$ } {
3 p1 r2 Z( r6 n% J9 R. x* I isLast=true;
9 k8 W7 D1 t H) t9 O4 X7 d6 V break;' m. E; s; X. P' \ Y0 I
}! l) K) \7 n3 p; N8 K, O! B/ |0 v
parentNode=parentNode.parentNode;
' l& l6 K, e0 @+ W! ]( r0 v parentBgColor=this.getobjstyle(parentNode,"background-color");7 S0 h3 X4 H' J. B2 A
; D0 B* r$ H P) @* ]) J
if(parentBgColor != "transparent")
, J) s7 a) x% u4 R {
* a ` {) S. r" j break;
# I: n! s& m# V9 h* H+ x }* X2 V3 n6 K4 H0 |4 f% a( Y% W
}' x! x; v/ {. t* q
if(isLast) D7 N! }% H" C3 i/ ]0 ^- D
{) y9 }8 N( a2 D: v6 E
if(debug)
+ h/ G) d5 q" z6 V$ V6 E" F0 J {3 S U Y! A) G# G3 R9 r
alert("last!!");
2 }. A. m* X! u4 ^2 y) d6 ]: E }. b* a. ^4 u! `6 V Y
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
0 }7 g3 f* U5 r. T: G+ S {; T% X: q/ w; ?
orgNode.parentNode.removeChild(orgNode);
M8 s% z1 `. B5 q4 o }
. O, W. g! C0 `. S6 e }3 Y [) M' D, o- g a& H- F
else' S: J0 a* @9 n
{
$ N$ T% w) R7 l3 U if(debug)
/ h5 x) F% u9 t3 e3 d5 {7 t {
+ y4 n7 }" j8 J alert("compare color and parent bgcolor!");5 }" j d- s! |8 @3 O+ B: U' b
}$ L( E2 L! M. W: g: ?
parentBgRGB=getRGB(parentBgColor);3 |% a3 {2 c$ J
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))+ M* L: Q6 L; R4 `5 k
{
1 C0 |; U" x& V. b/ |7 E orgNode.parentNode.removeChild(orgNode);
) f& N+ z) g7 K' S' R( y( |/ L }1 w9 z+ I! j' D$ e6 C( h/ x O- T
}
( s. L" E/ x) E3 v }: T, G# ^% r& r- P2 {
}
* n% ^4 f$ j% j+ V7 z+ B }
4 s' }1 i+ `$ L5 c7 s6 s7 D* M+ q% @% Y2 W }& r! F: E7 |+ q9 P2 v6 t
8 q: j$ G O; x# [$ g
1 g9 q8 V9 A& i* i2 U; I
var itemFrames = page.getElementsByTagName("frame");
* v4 n" |5 o8 W) R var itemiFrames = page.getElementsByTagName("iframe");" u. Z `9 a( ]; f r/ Q
$ B, t* W4 n f. L# h% S
var frame, iframe;
9 q; [& ? c/ P! f; |1 m& H if (itemFrames.length > 0)5 _+ U- ^4 M% [3 W7 T: }* r+ y
{/ S! W8 @6 y' |' B D
for (var i = 0 ; i< itemFrames.length ; i++)
/ F" n/ o4 f4 n: t {
! S) u; O7 Q7 s frame = itemFrames.contentDocument;
! c0 _$ E1 q5 Q* f. u; c" U4 O& ? this.RemoveHide(frame,objname);
( p; m% S6 u2 y a; U+ q4 Z }& v+ v+ u y% _/ P# Z8 Q
}
* e" y; E7 g5 J: V P5 P$ A if (itemiFrames.length > 0)
' R; p% N8 U$ n# T {
3 I; p% u) g) x for (var i = 0 ; i < itemiFrames.length ; i++) ' H4 U# ^2 {( ]& P- t% j1 o
{, A8 Y3 Q" }" y& e% C- S
iframe = itemiFrames.contentDocument;
: T9 ?2 n! F: ^" x this.RemoveHide(iframe,objname); G: T! J# z+ h) X. t( B! Q, G
}& _7 x" A9 M# X# k' T2 _% u
}
7 ^- Q) F7 f2 n/ H" ^. I9 l C+ {% V }
4 I5 b; M" D/ T; c: J4 q catch(e)
5 |1 x+ w9 X" D+ i {
" |) b% K9 F# B* ~* k if(debug)) n" N7 v: J2 J6 x6 u
{
# n; ~( I2 K* b- ?, |& D2 B4 a# W alert(e.message);$ e* p5 o) s/ S+ C
}0 P. V1 k, f, I5 K
}
; {$ {$ A1 U& N+ U, G; T2 U0 V }3 ^! ?0 S/ j. A" s- `3 ^- p; W+ R/ U% y
; @4 G" E. ]) i3 T" Z
}
# _! W8 ]: C# m: M5 f# I/ |$ p, A) ]% D, l; j, {. y/ |
function getRGB(colorString)
. _4 e) F3 M5 Y* `: p{
2 @2 y& @( h% o6 Q8 h1 t0 |+ e var RGB = new Array;
4 R! P0 o. T+ }, ?, D* U var tempSting=colorString.substring(4,colorString.length-1);
/ H8 S& \( V) j" B var tempArray=tempSting.split(","); h' @% R) U/ I) C: j6 J: O& F
4 U/ E) ?1 k' z) x RGB[0]=parseInt(tempArray[0]);4 B. a! Y9 v1 P O
RGB[1]=parseInt(tempArray[1]);2 a! a: V, [+ ]8 Q% Q7 p5 v, Y
RGB[2]=parseInt(tempArray[2]);
6 p+ b5 l2 O' U/ G' g/ a. H' y
& ?% s8 N1 X) A3 q return RGB;
! X+ Y- ~# W; L5 [* B; R+ x}
. h4 C3 g- Z2 r/ b6 [; g. @function keys(evt) 4 a" `( Y7 y) w1 c. g8 E- R& ?
{ ( C$ E5 S0 w) g2 @
if(evt.ctrlKey && evt.keyCode=="81")
9 @7 I. e) H1 v- c. ^& y {
: z' h. s5 @/ v+ O" J8 @ CleanHideObj.on(0,1);
& p- [+ J% L3 s" j+ j alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); 8 U; O+ O c- R
8 l' S0 n6 q2 j5 F
}
8 U. G4 l0 p/ Z: \, T4 i: M# i } ; q: o/ _7 L2 ]% K* g( g
document.addEventListener('keydown', keys, false); - E& G" [+ n! [8 |. X: Q
GM_registerMenuCommand ('Clean Hide',% i: G9 d0 Q6 b7 z, D4 P0 g
function(e){7 t9 ?- ^0 \ @+ R, b: H5 @" D
CleanHideObj.on(0,1)0 R9 F8 U$ d1 c* a1 A. e
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
. r0 b& I3 N: |3 ?4 A) V7 K( N});
% N$ N/ P! \* { |
评分
-
查看全部评分
|