|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
! z! ~6 U) X M) y4 x9 Z3 y) t J4 D# Z4 R! D2 }
火狐插件,用猴子
7 q) |4 s) w, \' f ]* v- K! W! l4 S0 D! e3 r" z4 Y
var debug=false;
# Z8 w2 h% u# s( v: o7 T, B( Rvar CleanHideObj=new CleanHideClass();
! ]% W7 ]% M% E5 @$ g0 W2 W9 n
function CleanHideClass()
/ Y$ H, e: ?; f5 o; T{ ; S. O* N8 y0 H, ~& y; U
3 s, K( Z: F' w# {" a& C* c7 v
this.on=function(id,bMZ)
1 ?8 }0 j; |% n7 h. ?, Y0 a {. S- p2 C3 s2 s% ?9 |: N: P9 G
3 ?9 Z0 b$ D; d }0 J+ i if(id == 0)
* N2 `& |8 `1 v0 p9 p {
: M, z% \) v* {' s( M% p var page=/* document.getElementById("content").contentDocument */document; ) X: }; M V5 q. ^' d8 x
this.RemoveHide(page,"span");7 z' Z' u0 p1 M/ b
this.RemoveHide(page,"font");
8 L, k; i: f$ v" m- x this.RemoveHide(page,"div");
9 t8 Z' A% h- y0 k+ Y$ a this.RemoveHide(page,"p");: ?% j0 p7 |4 i1 |% H# `
2 G1 M( c) K6 V+ a
}# Q/ V2 D* [" a) E' _" A; X
# q- ^( M6 A! D' O3 o
}
; r, e; L% o# ~ B A; C2 z4 `4 Q; y this.getobjstyle=function(node,prop)
, c3 b6 O9 A3 d8 v/ k {
. b# `6 C( h: u7 j8 M try, p4 v4 B! \# T* [8 ?9 Z
{* K9 ]. t4 \; M- Z3 [
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);7 D9 ^7 }- c, z: u
}
4 q; x" s. w0 s: A5 ` catch(e), K }+ R" l X* s
{5 Y; x+ c9 [. f' h1 y2 E0 E( F4 ?
if(debug)! D- s. Y# D) O0 R0 p# u
{$ U) v5 }' a- V6 w$ V* P k! h
alert(e.message);2 d, t& _4 v4 \, o' l h; s1 j
}
% t7 E$ F% v- D7 ~- c3 ]
! k5 q6 ?/ R% w6 m1 M return "200";
2 V2 H( E* U9 p- b: L' [& l; F }
1 A+ z6 E5 K5 ]7 P }
0 B$ P5 [0 t2 l+ u9 d% v
8 h. j( P$ c% n: M2 G this.RemoveHide=function(page,objname); U/ X7 e( z8 S, j* S
{9 n% M( G" N5 D4 q3 D
try5 k+ ^2 a8 X+ `' y& \, @ ]9 P" k
{# v) }1 U8 H* R
var minValue=15;
+ z# x& v; |8 ?9 P. g/ ? var objs=page.getElementsByTagName(objname); / M, }, y( r' Y/ D
. H! o2 s* F$ o' i
if(objs.length == 0)
8 o. i0 P2 A. Y* M7 y6 E9 c {
/ ?1 w, \$ r! E. Z* w7 I2 N# a if(debug)$ X9 m' k! Z4 Z3 q
{
) _$ z( {; q h7 r, c alert("no object found!:"+objname);. R, m/ y, v P }3 f2 [* w
}
1 M# \2 m/ L3 P* u% O: D5 m } J5 [, Z% E6 C4 v: P4 }3 h4 `
else* L) j, z% [! | l' a
{
. H/ n, N9 p' A) b
/ v2 i; i8 T" U5 k0 k* y l( H7 x" T for(var i=objs.length-1;i>=0;i--)
' |7 X5 G# B0 @9 H* n& m4 d7 ~ {# W) I' `( I U) w( H! G: ]
var node=objs.item(i);
+ \8 {! t4 _7 O7 ^2 R* i# K! L% M
5 M N0 G% M: `1 J' G/ R
; Y8 ^4 \5 H# C0 {# G6 n if(this.getobjstyle(node,"display") == "none" ||! C# \& k& p0 u
this.getobjstyle(node,"visibility") =="hidden" ||
1 m. o- ?' V5 \' O9 h% t) N% t# } parseInt(this.getobjstyle(node,"font-size")) == 0)
, L- i8 W4 |. h: X# \% J {! `* F* o: N1 A- ?* A) G" \ r' w
if(debug)* j0 Q; H& T }1 ^. j% I
{
3 V h$ U: x. Y/ { alert("remove invisiable!");( q: s$ S! |3 H2 V* v" t: }( f
} |7 l- Y# y$ b7 w) C
node.parentNode.removeChild(node);) K. s" M* u5 P1 i$ x& u/ w
) `" ^* s* L2 `4 [3 r3 B6 X9 a
}" |3 o% h1 s4 I0 G
else
3 @9 P* S+ G+ x {" i9 _* X! @; Q# A( J- B$ T- e3 B
if(node.parentNode)
8 D* q% x: [8 d( y. V {: B% Z) h; E4 n
var orgNode=node;2 O( Z* A7 {- Y/ K# _
var orgColor=this.getobjstyle(orgNode,"color")0 z6 X9 @2 T) g3 P5 I. P$ c! {
var orgRGB=getRGB(orgColor); ( \7 T6 k* K1 o3 [% W
( l; g) |. o0 S# e/ f
var parentNode=node.parentNode) c+ U0 }. A6 L4 u" @" |
var parentBgColor=this.getobjstyle(parentNode,"background-color");4 l8 i& N& p* Z o& G$ X
& b7 T- @1 T' P% F- R
var isLast=false;0 L# X6 g# I$ B
& N$ A1 R, J5 C) S8 q ^+ T, b* T while(parentBgColor == "transparent")
# ]4 T9 P1 [) d3 O {
9 K% e' i; v4 D$ e( l
! F! t# i4 t! N9 N # ^6 U$ [6 D/ x4 z" A) m0 W0 w
if(parentNode.parentNode == null)
, s8 }0 R$ P; u {
3 w0 \ x+ l1 t& [0 d5 A isLast=true;6 S/ B8 e8 n( W) l; C- m4 i( W
break;# s! P w% N3 ]# B7 w
}+ ^. y/ a6 H& V. r# ?
parentNode=parentNode.parentNode;: T* m, X6 ^ C# Z2 a3 H
parentBgColor=this.getobjstyle(parentNode,"background-color");( Q; b* S8 r: o) [2 n: p2 n, E
1 G. a& L4 ^( B1 L/ M8 l } if(parentBgColor != "transparent")
& T" z; [, h* m {
7 s/ {5 H1 v L% k, `1 V break;
! e+ j& ]8 C& @% B2 W }
* ], V- M9 M) P9 E3 ^; T# }2 ~ }
8 H& K6 i# D. {# O) |4 ~ if(isLast)
8 x5 z N9 A! Q6 ]0 \! a% i {+ f" y0 L1 Y8 o% [
if(debug)* }. Y6 I" c- w- |& g" G/ ?
{3 [ w" @/ }1 k- t
alert("last!!");# p* W( l$ `, P
}
. u0 v# s6 {2 b% X6 a if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
) E, m4 s0 @% q2 P! U {, `3 n/ P/ f8 l- Y5 S- Y
orgNode.parentNode.removeChild(orgNode); 8 j$ s0 }6 E) u1 O( h! n
}
+ q, J @: h" C3 N) |2 j4 r4 c0 V1 Q }/ ?; [* p N' N. `
else
( T/ s+ ?7 g' M: V {
/ ^; S5 Y# J( H8 n% J if(debug)
X5 O% X1 G: z) P- ` {0 D6 a6 d+ }' k4 M+ W
alert("compare color and parent bgcolor!");
- X; Z/ ~# o7 o }
7 M# H' i: n0 U1 c/ } parentBgRGB=getRGB(parentBgColor);
/ Q9 E) s6 O2 J3 W: t6 X if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))! u( q! R; r0 W; e+ D; W+ Q
{. M* F0 Q6 R5 i
orgNode.parentNode.removeChild(orgNode);
( Q! p/ t. a: F3 u6 }# x) C4 I }) m9 k1 [8 q: z+ B% M
}7 A: G. m# r6 D* x$ B1 J4 `
}8 s: i5 D3 U- R- t! G8 x( K, x! e
}5 A" U7 ^, C: |) r$ c5 d
}9 L5 H' r9 q9 p7 m: K
}
8 V/ q( S3 g- e7 i
, U l! i2 x- J# h! q- H) o; T # d e5 d& W: i L4 G' y- v
var itemFrames = page.getElementsByTagName("frame");
2 B5 V- A3 D" R- g _5 V var itemiFrames = page.getElementsByTagName("iframe");, ?+ z7 j! q" Z( n8 o
6 ^9 W( k& L- G
var frame, iframe;
: P& I: J- ]. Y$ G if (itemFrames.length > 0)
( M6 p1 a; B% ~8 ]1 [) o% {0 } {
( k; t4 [0 _- w% @) L for (var i = 0 ; i< itemFrames.length ; i++) ' l; \7 ]7 d' Z( b$ N q* d
{
" k7 s( V3 C+ ]" U" b frame = itemFrames.contentDocument;
" q- m" m. L& b7 K7 n1 C this.RemoveHide(frame,objname);
9 ^ ~$ Y- l" e4 x* u( I- R }
4 z* ?: j j) |# x$ j1 P5 I }* M( C2 i$ I8 I0 a1 u/ f/ Y
if (itemiFrames.length > 0)) j3 m9 @" ?9 ~: l7 ]5 c
{
# \, _+ o1 s9 H# w. Q for (var i = 0 ; i < itemiFrames.length ; i++)
) G) i+ F: n( g2 S0 P0 b6 B8 g {
. ?% P7 ^ N4 H: ^5 N | iframe = itemiFrames.contentDocument;6 r2 y: _, f( y" _( g$ u
this.RemoveHide(iframe,objname);
8 Y7 A2 S1 W' v1 u4 G* c" M+ M }
/ c: R5 r/ \2 k7 j4 K+ t6 n9 I }
% B6 {) i* h$ m& X }
5 V* a, U' E! g0 h catch(e)
( f: P- ? v" g# Z2 G. @" [ {
; W; m, X$ w" }4 d1 d" Z if(debug)
* z/ {+ Q( f& g" E {
. V T w/ f2 M( E1 I alert(e.message);" ~! ?. t1 z" W: Y* i# K
}/ p a0 R. p' ^2 S6 v
}
) n; A$ c. T2 W/ E }
1 Z* Y4 y6 K% `4 u, E; n
/ H' g* K* y) J% J2 P# }5 J' @}6 f M: ?8 z$ c" T( n
. E# i _9 v/ f9 i- h( a# s6 h
function getRGB(colorString)$ W8 q9 }# K" O1 [+ K' l
{
/ y3 Y+ \1 @0 _4 ~7 y8 b' q var RGB = new Array;9 k9 s0 T" |; U, I! r
var tempSting=colorString.substring(4,colorString.length-1);1 V- \2 `) C# y# x: S
var tempArray=tempSting.split(",");
: x& q* B5 E- J8 v7 J+ T) u- t- x f4 X% ?" E
RGB[0]=parseInt(tempArray[0]);
1 m- h+ P0 r: a" y/ P) W RGB[1]=parseInt(tempArray[1]);# q R& a5 e0 l3 R. s9 v. ^" @
RGB[2]=parseInt(tempArray[2]); D5 N% l) `1 H: Z" ^9 {
( f0 f# a* K/ n4 m4 c3 t, w9 G e3 z
return RGB;
6 N# Z8 L! i. j& p}6 J7 p/ n& h. x" o- z7 O( Z
function keys(evt) ' q1 V8 q: _! i0 t2 F* n
{
6 n% q1 V' r% j3 G- ~* _' f if(evt.ctrlKey && evt.keyCode=="81")
4 V2 B u- }- w; c. V/ l3 w$ _& P! H {
& ]1 N5 U( P8 O* V; {# e5 \ CleanHideObj.on(0,1);; E! b. a3 Q8 l1 @2 g. L. v
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); / _, G* q# J" d: E" l
' S+ i e; l8 T
}
& l# Y8 l. l+ y0 }+ |' d. I } + Q$ X3 J1 s& c' M# M7 q/ d3 _
document.addEventListener('keydown', keys, false); ( z1 l6 F( C* F0 K+ E
GM_registerMenuCommand ('Clean Hide',
+ O0 `- H9 ^6 T" @+ K8 rfunction(e){4 r% ?7 r l1 B; z
CleanHideObj.on(0,1)
: H. H& y; C. f2 f+ jalert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
# a. A. P% N" l: B: ]. l});/ W; k" X3 l+ A4 e2 K. m1 N) n
|
评分
-
查看全部评分
|