|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
# H. W2 F& F9 h* |) H' v) ^* v- y
8 v! g2 u, T! }* F- y. f+ e火狐插件,用猴子% O3 S& Z7 n3 G8 ?) q8 a. e! ~6 p( t
6 S- R5 J4 P) z. S8 q! Pvar debug=false;
6 W' O( v5 a+ B N p" O- Z/ M$ Avar CleanHideObj=new CleanHideClass();
. N7 H/ g+ u4 F. T- @. _% u
$ z* t# ~2 R% S7 U5 T' b; Afunction CleanHideClass() ) U$ Y6 Z( C" G" z
{
# e! x* R+ K G2 J
9 x1 F' b5 C8 n this.on=function(id,bMZ)& B% |; ]5 N- t# V0 r; `9 h% c h8 ~
{
4 c( N2 t/ n/ @; j3 c
' f) ?, K6 }! F* |) o- |5 q( V if(id == 0)
+ W+ W. v7 Q) k4 e& b {
0 _+ M0 ^. \9 ~* q: x+ } var page=/* document.getElementById("content").contentDocument */document;
) ?1 N7 g, T3 Q this.RemoveHide(page,"span");
3 J6 r. L# `5 B" F" k% m this.RemoveHide(page,"font");
: S+ X& h% `" X this.RemoveHide(page,"div");
x2 l1 Q0 X( t8 L; w' k4 [: x) L this.RemoveHide(page,"p");4 b% M2 V7 L# E, H* ]
8 |, t6 n% j3 m }, r* k! m: O' q
. `6 M* Z8 H2 |4 @/ _
}) j; w0 R# G) W f; P- j. |9 T# f
this.getobjstyle=function(node,prop)
* l3 e5 p0 w) g+ S) { {
% `( v: D& e$ h2 J& ^. H$ j2 ~* f try
c. S7 c( _4 Q9 _5 X {
5 W- Y9 i0 s% D; v; a- | return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
t: d& O6 e- I/ `2 z. n+ a }
8 s/ V" V# L6 C t$ @" A1 X, d catch(e)3 S% T5 a2 U: W( r
{
' W8 S+ q& j& ] if(debug)
+ X+ t1 n8 `% [' E! ?9 D3 \# _ {
: A) ]& F g5 X* @& n alert(e.message);& ?( ^6 E, [0 [2 V: B B! x2 o' F% f
}
4 ?; b1 m8 w# P ( O7 B7 N; V7 |" o2 m
return "200";
1 G& o' A1 L9 A, ^8 P4 Z+ Q" u, Y }
- m6 m/ l" S2 M1 e/ y }
, P! p9 K4 B$ P) R) ?& L6 q9 I% t/ r' T/ P 4 y5 a1 C/ B- @4 E3 t# K& {2 W
this.RemoveHide=function(page,objname)8 H1 Y, b! u: Y$ L+ C: {7 t* j
{
: J. k i; j6 j: I try/ N* V8 O4 @6 w' {
{8 c: d/ E! j0 H; \$ Y
var minValue=15;
. ^, z; O, h) Z# }3 H var objs=page.getElementsByTagName(objname); 4 {- v6 |/ C' v d" w9 ` n6 w
( L, m; p* U, Y: z* m I
if(objs.length == 0) ; B( t! m( J* B9 y
{4 o- b, [) F) N- W/ z
if(debug)
" i. Y/ o4 b* R- i# L/ b, N9 m {
; U3 Q' D: k. J" v; o8 r alert("no object found!:"+objname);; j' `6 [8 |2 w2 f& P0 U) T
}. x, O8 K0 l: d7 b9 D4 u
}+ J" G. i/ n' x7 A0 g" M' w
else$ d9 v. K: w. ?4 T8 T% o, G( I3 m
{
' `4 X1 v2 i0 Z v/ A q
5 z. o- Z2 f9 F8 l5 H5 r for(var i=objs.length-1;i>=0;i--) - J' c; y: C/ L r. k& [( F
{: i0 `( n, |0 y% |
var node=objs.item(i);
7 j4 ]0 W% r( H
5 t# N* I) m0 I3 K4 L7 ]0 d9 \9 g 0 `& ~6 U* C5 i' ^" o
if(this.getobjstyle(node,"display") == "none" ||, G) W; ? C- s( m f# ^# p
this.getobjstyle(node,"visibility") =="hidden" ||2 E/ m- }( C- Z
parseInt(this.getobjstyle(node,"font-size")) == 0)
6 b' L- d- b/ ^, a {" K( F d) k. M3 L" e9 v; e P
if(debug)# [5 K( q, c# i: W4 @7 R" h
{
# X1 `" I, J [ alert("remove invisiable!");6 O2 p7 L6 W, J" p4 b
}4 H9 a4 l( D9 P; r9 F
node.parentNode.removeChild(node);
/ X" r: W7 B8 K# Z4 }7 w# U
1 z! S, Y! B/ s! B+ B6 z }
4 n! T+ ^/ v7 D2 m. b, s, Q) M. v else
: h$ o4 e& d; |: n3 w# s- Q. I {
! i' p8 [/ O( x4 W' b1 | if(node.parentNode) - Z! B; \. A; q P9 r' R( T3 j
{0 F9 ~2 p2 ~2 f9 ~& Y# s
var orgNode=node;
/ o0 B# y5 y9 X* [6 z1 @ var orgColor=this.getobjstyle(orgNode,"color")$ R9 V2 Q3 ~0 R: b1 q
var orgRGB=getRGB(orgColor); ' o; [! g8 g3 h+ E
) m# N! d% q$ S+ d# r% z- O var parentNode=node.parentNode
1 n# B& r6 C W" K F. |$ m var parentBgColor=this.getobjstyle(parentNode,"background-color");7 @; J0 \0 o/ L, Y
2 p" m$ R0 A- _- w7 f! D
var isLast=false;: a4 p* v0 U! ]) r2 e
$ g0 U& t( k7 f' ~ while(parentBgColor == "transparent") ' @. m. ^% a# H1 t- R
{# y$ D0 r6 {; v# y9 i9 s5 B
+ f& R* ]' Z; _$ T5 X1 c* p
$ D3 g+ L0 Q( `+ R( D* F6 D; ]
if(parentNode.parentNode == null)( T' V7 H6 y8 G& `" c6 L) W2 r, J
{
& F. G8 ]# k3 D, Z8 e- S6 X isLast=true;
7 y5 N- W$ U( g8 w/ P; J break;" u3 c/ i* m2 A, {* ~' f7 R
}
* I! v- o, I% {/ u7 C& F parentNode=parentNode.parentNode;- t4 d( l6 X2 x. q
parentBgColor=this.getobjstyle(parentNode,"background-color");+ H4 D% H3 Z z9 D8 b; j) d
2 f8 k" o; }5 _
if(parentBgColor != "transparent") & ]+ `( ]' B6 d& G
{
0 Z& c3 {. v. L, O% e: ` break;
# Q) t9 G/ L* [, S' f }+ h& `/ t1 F# ?" H7 Q6 z8 _
}$ j& p& M' w1 @! Z8 ]
if(isLast) & B6 ]& f( H9 H" C5 n# y3 ^
{
$ U( O$ S. _" C4 j0 A' b" h if(debug)
0 ~. i# z) A) l3 _1 x, I1 ~7 D {
$ s- S" T5 ?, z; o& R- O. D alert("last!!");" E% l3 E3 n0 L- u5 I6 q
}
! d$ U( G% Q5 V if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))0 V5 u( L! f3 n
{8 v# }6 h* P7 F: ~: l
orgNode.parentNode.removeChild(orgNode); - U; n8 m. i% C$ W2 \1 U$ U
}
) c; h7 C, x1 Q- }$ o' U& J }
: `/ h/ A/ `4 ~3 a7 y/ F" m' _) D else
+ o/ _" S! \' W W+ u {* r) G" [3 h( F6 o) |& f+ l) q
if(debug). g9 v) d. h1 [9 x# g$ Z' x
{
/ D2 f. Z, E# N5 E alert("compare color and parent bgcolor!");' [8 s! `- k }& N% G
}/ B4 }9 W& u- G. [ o8 o
parentBgRGB=getRGB(parentBgColor);' R6 t7 ^& o' p
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
, ~9 u5 I2 P* f, x; o0 q {
& V3 R6 }7 g) e0 k! M4 q: ? orgNode.parentNode.removeChild(orgNode);
" O( V( D, g! S: k, P+ [ }, ]. a8 w/ L, s6 _7 c! k
}" w5 X; u5 R1 u2 r7 d; x
}: |, @+ j& I% V9 }
}
2 a, u5 Y' @+ m* ^- W }
, d" _5 F2 e% _& R }2 t2 d3 {% L) a) y! \( t
, l; M' D% c( k/ v/ O# O 3 b7 v6 N- V3 C) ]1 F' b1 R9 [( z7 a
var itemFrames = page.getElementsByTagName("frame");
! R/ s" T3 o. X var itemiFrames = page.getElementsByTagName("iframe");
; i7 M' S8 q) T2 T! ^! i- w P8 R
% a( N; n* L& W( x* Z var frame, iframe;0 @9 W* K, Y7 X: l
if (itemFrames.length > 0)
f. y: F) H- \& U: Q {
( c, ~6 O% h3 y- t) a: s2 H" c for (var i = 0 ; i< itemFrames.length ; i++)
0 Y4 W+ [& Y" S3 F, Y4 P& {% q {
M$ X; z4 {( H6 n( ~* Z frame = itemFrames.contentDocument;
2 h0 K' Q* l: k, ^0 R this.RemoveHide(frame,objname);
! |& y+ _ B, y6 c; a M2 l0 E }
+ b$ U" z7 q1 N. ^8 v& W }0 O) _3 I7 C$ y
if (itemiFrames.length > 0)* {( z/ g& y( t( W+ j0 c8 \# P6 J
{$ e( g+ v! r* ?$ N/ W
for (var i = 0 ; i < itemiFrames.length ; i++) 7 V5 h6 D8 e! F! H* r
{
9 R) x$ }( D& J, Z7 |! i iframe = itemiFrames.contentDocument;
, ^6 R6 ]& w! w. [8 ` this.RemoveHide(iframe,objname); & ^! a! M4 ] Z* M% [& Z. \
}
! k% F( P* [. U1 Z/ U2 y/ n9 V8 w; X }9 X7 ?3 T" W8 C$ {: i
}
$ q# E; B' j& s1 M. k2 r' b3 q catch(e) m$ `( W+ t5 r" D. X$ \
{; X& P6 S2 \$ c8 X) k H, y# ?# B
if(debug)+ W! h, d5 ^8 i j% i
{
! n) N g; u. F% U alert(e.message);
6 f; t7 ~2 y3 P+ i2 i* P }
, I @3 F! P8 i h$ E. S ? }
7 V; A0 s( N. l }# q8 U2 I$ l& c" f1 b. w' v6 y
2 @7 ]: w V4 t$ F
}
9 U+ r: ?2 n: r0 @* Y, T+ r" C+ U
9 ?6 ^8 H4 U7 ^+ c) s& D) L+ nfunction getRGB(colorString)
; [ t: I+ o8 K4 e{( ?; a* b/ H& z: B/ {# E; @
var RGB = new Array;6 a3 A5 T2 H! \, ^7 G6 x
var tempSting=colorString.substring(4,colorString.length-1);
3 O; Y% D0 K0 V4 J5 E, Z var tempArray=tempSting.split(",");; I6 p# ]& r: C1 R- u8 M; H
+ M$ {$ |8 b# v& F8 Q* T* ?
RGB[0]=parseInt(tempArray[0]);
4 Y. I' D/ P& S RGB[1]=parseInt(tempArray[1]);# g( `& c* z* a4 P7 _
RGB[2]=parseInt(tempArray[2]);
+ d5 `/ ]8 s5 i; ^- Z7 W% }! d : m& @7 w9 K% t( y Q6 @6 G6 R
return RGB;
' \: M2 ], S: B; {& n6 `/ n1 Y e# [1 n}3 V/ U' c/ A$ q$ j
function keys(evt)
2 p3 J% [0 r) V! o+ k) C V { 3 d- j: g9 E3 a7 _+ C" ?
if(evt.ctrlKey && evt.keyCode=="81")
6 P( h: T+ ~7 |1 X, _# J2 m) A { " M% i" L5 H1 H5 h y% d7 v
CleanHideObj.on(0,1);
* N! U, f8 Q$ c" S( m C3 {$ f alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); / |4 R4 q( p1 V8 o3 V: L( v( R
. B4 O# m% H- h: a. z/ H! w+ F
} ; P, {" }7 Z: d! v/ j
} * h9 B" p5 t( d
document.addEventListener('keydown', keys, false);
) z2 S6 i o' _5 Q4 h6 {! S* E+ e8 `GM_registerMenuCommand ('Clean Hide',* k2 ` X* f, c L) B9 a6 X
function(e){
" Q# s: S% W* n9 ?3 [7 k3 rCleanHideObj.on(0,1)& ~, `9 i! a8 c
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
% t" Q) n q9 d: ]+ |) w5 E7 K});0 C8 z" M7 e7 ~2 F& U
|
评分
-
查看全部评分
|