|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
4 ^/ ]" W# ]. F5 d. ^) S# \0 u+ z, B7 H
火狐插件,用猴子
0 k6 v2 _4 i: i! w6 w! B0 F$ U8 S6 G$ `: I
var debug=false; 8 D$ m* F1 a9 ^$ h) n
var CleanHideObj=new CleanHideClass();& m% X3 p+ R1 w3 I- p: U0 F
4 F6 [; O! K3 c8 g) r8 P. g' sfunction CleanHideClass()
* K: h. M* {; v! k8 P* H{ 7 @" G! h& F# H9 \8 B% H% |! g
, i. H& S7 E4 b' D, a9 F3 m2 A% T this.on=function(id,bMZ)
; y5 w( \3 G7 I. E/ n2 F {
( r1 w. a- `; x0 `4 K
( e5 i A M" q- H/ A/ W if(id == 0)0 x' v& e# i. ~5 o3 X' b
{& U) n8 i/ A& R# s: q3 F
var page=/* document.getElementById("content").contentDocument */document; + l* S$ @+ M2 Y6 } s
this.RemoveHide(page,"span");- L2 k2 E, J2 w
this.RemoveHide(page,"font");4 W( }; e; \2 ~7 |# R! o) R
this.RemoveHide(page,"div");
$ `4 v3 ^, `# n6 V; R this.RemoveHide(page,"p");
* _6 _' h" S6 d2 ] 7 ~. U# j* Y ]" q5 g& ^
}) @) F" F$ R( f1 i
/ D/ B+ U% g! x7 A/ W' N9 [! ?
}
$ ?1 E- h, |& J O0 N this.getobjstyle=function(node,prop)0 P, q; K% u4 B: o) W0 Z/ R
{
2 O- ~/ N% O) }- ?& F- E8 C9 f try9 R7 ]- ?: I- O. `$ a# T
{
+ I) j9 A" m D( n2 h return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
* S! o. r* N- s" _3 }8 u }
% p9 @1 C" ?) F5 b8 A* g L catch(e)
, O/ k3 ?) d2 m' F, _5 ?/ c, M {0 |+ ^/ Z$ z" H2 ]! k
if(debug)* c5 |8 R1 y# V
{
# @3 ~0 q6 j' A alert(e.message);
( L/ Y- A( I3 `; ]/ i& I# i }
( A% D' S+ x6 ]$ d$ e # c$ Q; q7 d+ v2 z
return "200";8 M9 R9 x# _# m
}
2 W, K& O K3 j7 U }' G5 k- U6 u& k: y# P4 ~
) r% M6 f) ^/ d' k+ x- a( J) W% v this.RemoveHide=function(page,objname)1 Y$ \0 Q: o7 T$ L% O
{
8 Q1 j( `& [% C5 e try4 A0 X: w' }' s/ x X
{" B' m/ u# `- D- D7 ~$ R" S, K% q
var minValue=15;) L! |) c# ?% F! o
var objs=page.getElementsByTagName(objname); : B0 d" w. C. A/ x0 n+ B- v: R8 X0 \
' i$ P$ V+ M+ B8 N; ^
if(objs.length == 0) 1 V. X8 u' g" f6 {; ~/ }
{( P6 N/ R9 o& }% o4 Q
if(debug)8 K5 e; ]3 B/ c. P, O
{9 g- L" V- {. Y! I( _# F
alert("no object found!:"+objname);
) z- z# j+ e' e" ? M2 K }
3 X* ]3 h. U: c$ f' p }7 v% J: A; a+ ^8 t# Y5 q& t- f# `
else. U* C" b0 C. Y! H9 f. K4 r
{1 ?' `; a! x* d) {2 j' }! U N) ?
/ O7 c! t# Z4 c1 A
for(var i=objs.length-1;i>=0;i--) # R+ T7 j6 g9 B
{
: T6 k+ V$ I$ L; e- n" v var node=objs.item(i);
+ V1 w% `# Y4 a$ O. `
' g7 H# u9 O! B' v/ {0 g1 q
, V( f' W0 v3 @4 X% l8 G6 H if(this.getobjstyle(node,"display") == "none" ||+ L/ P: l' N: y: j
this.getobjstyle(node,"visibility") =="hidden" ||$ n c; u! ?7 y
parseInt(this.getobjstyle(node,"font-size")) == 0) 5 L p$ W/ N6 E) ]7 z2 R8 \
{+ @* `' y+ s- M4 r
if(debug)
! D( Y& n1 I# E) K: K$ W0 N( P {
9 H- b t" c9 q/ |! R0 w alert("remove invisiable!");0 s$ U' u( a( I1 ?, ~% I
}
' t" K* W9 C6 J+ t node.parentNode.removeChild(node);
4 d, C9 G1 R4 i P; b ; z- N. Z( Z! H& N" }
}3 T6 j6 M0 K# @5 j0 ?
else / ^; Z- m) y8 F: E$ O: g- [
{1 c+ p, Q! E) }& D) `
if(node.parentNode) 4 i! r* }1 B; ~0 Y. U) a- U' Y
{ i5 B$ C6 D$ h
var orgNode=node;9 w8 A' F/ Y# ^9 |; R0 u
var orgColor=this.getobjstyle(orgNode,"color")( M9 A H. D; I" E, T: o) E8 r
var orgRGB=getRGB(orgColor); " J& Z1 B: f* L8 E+ z1 r7 ^
) i# ^2 b! R* b; S6 t/ q. {
var parentNode=node.parentNode
2 C& N; w6 _0 N. W- k var parentBgColor=this.getobjstyle(parentNode,"background-color"); ~% ?' g9 Q3 U0 L4 w% o u
# }& _2 T( ?3 }8 W' X9 G var isLast=false;9 S0 B% T% A- n- c' f
) w5 }2 |0 m! C% d1 ^
while(parentBgColor == "transparent")
2 U+ w. ~$ E+ g _% A5 }/ N {* K8 P6 o, L# a8 S
* X& z' O3 ?; d$ j 0 Q# {. p# Z" w
if(parentNode.parentNode == null)1 p7 p% P. x! `! G$ R9 ~5 i: V
{" [' _7 I c) K# j4 o% M- f
isLast=true;
/ L, n4 q: p0 w# ~. x6 L/ i break;
" x/ K0 o% f+ k( | }
0 M& y0 [* x% O( O h parentNode=parentNode.parentNode;
0 K2 D7 m; F6 F7 o0 P( b& {" f parentBgColor=this.getobjstyle(parentNode,"background-color");
+ |9 W' ?' A& k6 e0 @; Y' V1 d5 e* ]% g0 X3 t9 I0 ^/ I
if(parentBgColor != "transparent") 7 H/ o4 u! S7 f/ Z7 S" T( h
{% l6 K! H$ t& w
break;
# r7 x* L& c/ C' W }
1 e: d. E, X8 o7 [ }
' M% b8 d9 J% Z. W3 O5 v4 c6 U; e& @ if(isLast) . K/ D- \1 C1 ~* S2 @$ p; ]# h5 @
{
! ?( }/ P* b7 _, x( F2 w: @# Q if(debug)8 w; I0 l9 c$ |1 E! e
{
# W" [) Z) ]# P& ~: P alert("last!!");
' h* M" _4 s- t5 m/ _5 S }* a$ C( c5 [0 M' E
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
`' k, k" \7 v) S4 N: `) W7 n: @ {- J; J% F' y) z/ p+ p( Y
orgNode.parentNode.removeChild(orgNode);
8 o- b9 a l6 i. }5 k# H }
1 ]( z( n- } b9 X1 @+ q }: L5 P+ O1 s3 p+ a
else- ?3 {. x) w( z4 }' d( L( o7 h! B
{
5 g! M0 z, O8 H: p0 h. v if(debug)9 a% r' {" Q: D& x
{
' s& D% I: H" a( b alert("compare color and parent bgcolor!");
# G$ o% S6 ?: l" |- `+ i3 ] }
9 A* o ~6 l% N5 C- ? parentBgRGB=getRGB(parentBgColor);8 E; L/ Q% ^( K- b" A
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
! W. ]8 k3 ` q V8 e1 q) @ {
x+ A; F k* _2 n8 ` orgNode.parentNode.removeChild(orgNode); : D0 a( w$ ?$ W( N9 [
}- j, h4 y3 Y6 g3 L% }( m
}, f+ o4 C. K/ i5 v7 S# Y% k
}
& H! X3 G- b0 }0 a% }- @9 |2 \# @ }/ J3 ?9 j8 C! W; y9 d
}4 V) f( p# S0 M6 s& F
}
/ o6 L- B& V4 d# p0 B2 M & `9 u. j# a. P4 v
e, H# V2 x5 ?6 U5 a
var itemFrames = page.getElementsByTagName("frame");
' q- ?6 y3 Q" O8 T var itemiFrames = page.getElementsByTagName("iframe");5 ] H5 {# S: _* c! o7 m+ J
2 l2 X" |3 d+ n" q
var frame, iframe;# F* B D' K+ ]* L1 a6 s }3 k& p
if (itemFrames.length > 0)
2 }% o: O" ]& k/ Y9 k {
1 N) D# N- u% M8 G4 } ]( v for (var i = 0 ; i< itemFrames.length ; i++) ) {5 @- i" |; Q9 t2 f4 t; X
{
( Y* h/ _: c( t6 h9 k( |% { frame = itemFrames.contentDocument;
( w: G- z, q0 I9 h& Q this.RemoveHide(frame,objname);
" P- X3 X, a$ ?+ n }
0 F; T9 H# y# u2 o& L }
. W' ^) [3 u6 G if (itemiFrames.length > 0)
) y. C$ q' `7 g8 Y0 @, Z: }7 a {
, v- i; l# d$ T0 f! \ for (var i = 0 ; i < itemiFrames.length ; i++)
' v, ?, g$ M) l* T {
1 o! F" n+ M/ |0 e% B iframe = itemiFrames.contentDocument;" K% q& |( g5 L7 j' ~
this.RemoveHide(iframe,objname); % l$ G! P+ X2 b. J3 E x9 E
}0 n' A2 R5 D2 [: F, D, L$ D$ P) `* j5 ?
}2 l' K. R( G4 a
}
) _+ x' C i3 J% e catch(e)
) c' [, L1 \ Z1 W! F4 @7 C5 y {4 e. Y4 r" |6 {. M1 r: c
if(debug)
- g# k3 b. E( g, q9 l& F# n {* w0 U2 ?- Y t4 D
alert(e.message);
4 }: M, Q# v- t5 ~ V# R Q }. p7 A8 u' C; D" O# x: Y
}
) v; S8 W" C6 U1 Q( ]" a" u }
. j" r! Q5 w7 f$ B8 Y3 n4 @/ C! g$ R 1 G+ G) }- z$ Q0 e0 ^8 V {
}
' |9 C. q# m) d5 H* z8 A7 I8 P, D5 {+ S0 A
function getRGB(colorString)7 `* P" j$ `% k. @; H
{
; N$ e+ G, t1 J* H$ S var RGB = new Array;
% E; K1 j4 {0 ?+ o% D var tempSting=colorString.substring(4,colorString.length-1);5 o3 T# }8 x$ V- D0 u( R G |
var tempArray=tempSting.split(",");+ v+ g: T. M- g. g" i( o7 m! e
0 U$ B2 l4 T M! }
RGB[0]=parseInt(tempArray[0]);
$ F. b9 ?. ]7 R6 {- C0 x RGB[1]=parseInt(tempArray[1]);
! M& S+ k2 k! V( H2 [ RGB[2]=parseInt(tempArray[2]);
1 T% R" C7 s* [6 C! | 7 t) X& p: V- W( i( V
return RGB;
! s+ s1 O9 |8 R& y* X6 }}, p2 `. I! x2 x2 w, J9 M9 C
function keys(evt)
$ W- `$ u7 _$ S- [ |7 D- j {
* d) d: H# Q5 I if(evt.ctrlKey && evt.keyCode=="81") ' M" H# G) n; k* V- c0 l$ K
{ 1 N" M# I. ~; F% {. u' P* x% L6 y
CleanHideObj.on(0,1);) x2 j+ x8 D, |! O
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
3 l5 O O1 Y2 _0 q" @3 C; S& m
9 y/ }5 `* A- O } . o4 \9 k3 U/ _+ _/ h
} . ]/ A7 x7 O( D M: U8 e; t/ c
document.addEventListener('keydown', keys, false);
; B7 J* x* C" j( B$ D: gGM_registerMenuCommand ('Clean Hide',1 w K' o! d0 i- M. U
function(e){
W0 W# v- s+ CCleanHideObj.on(0,1)0 {4 P9 z+ n+ F# A
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
$ }% ^2 e G% R});
?. H- o" J% A* \ |
评分
-
查看全部评分
|