|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
: U* z# R3 w- }: C: [
! L0 I1 a; ^, d火狐插件,用猴子
' ~4 f8 ^) T o5 Q) X3 n% h; ]* K( y/ {# R5 e6 t4 y
var debug=false; 1 z% |4 J# ]0 D- u
var CleanHideObj=new CleanHideClass();+ A" C) h, o* n2 U& p- F
/ q$ C3 k" o( tfunction CleanHideClass()
& H) s5 b, F1 @{
9 ^( I3 y) G# w5 m& H* r ^
$ \7 Y$ g1 c& ]7 c5 q this.on=function(id,bMZ)/ c; Q, K2 }. O
{' x0 I2 H* ` O5 O, D
+ B& k& O, `& M; \
if(id == 0); _: _/ q( I' N: q
{
5 \5 k+ _* F' x- O( n2 r var page=/* document.getElementById("content").contentDocument */document; % p3 Y ~4 V X" R2 ]
this.RemoveHide(page,"span");
+ V. T! u% m* S+ }; [! V! M this.RemoveHide(page,"font");, x# ~( a; _7 d% `+ X; L& i y
this.RemoveHide(page,"div");
# X# q6 T) l# s6 m0 f( O6 I this.RemoveHide(page,"p");: Y* b/ V/ ^, Z9 n q" I: c, \; r
6 @; h2 A, u7 X( R
}
: `' Z/ s0 u5 I
# d8 O5 M( ?9 `# D# I }2 ]2 U6 Z% [& C9 m2 b
this.getobjstyle=function(node,prop)% _+ g; E7 t5 r( X: J% J
{7 I/ e1 h/ S2 V6 `& }4 A
try) p6 o( M5 ^3 ^, @6 C5 l
{! W7 V. ~! R# d( r4 Z
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
% V, y. T3 T- b+ r. W) F/ \. O }( B) s C, m! l" ^4 B4 C
catch(e)6 a3 _4 g9 d o/ i& P2 [
{
* V0 H( y' n/ o, B8 q) A' T if(debug)
' m$ U4 t8 b- D- t' T3 V' x {0 R4 {2 r; O. J1 o& f
alert(e.message);
) L, o* V6 Q. } }
f( V# f- ^9 M" v " y( @ m% B, F/ |7 X9 {% \4 e
return "200";! ]$ b4 g) L- H9 F
}# ^* G G4 t8 Q
}
3 j2 N0 m P+ s3 U5 B* Q$ [
. X% U1 ]; n) Q6 P$ V8 ?% M this.RemoveHide=function(page,objname)
2 B5 d0 o4 L# h1 t( ` {
, `0 ]' }; r; r1 h6 ~2 ] try
2 H `, f" h) X$ l {6 X# ~. _9 R5 ?; D# b e
var minValue=15;
/ z& |- H. ~- x F! u var objs=page.getElementsByTagName(objname);
% z. Z0 C% H7 x# ^& |5 _+ g" _3 u6 P8 E: C+ Q
if(objs.length == 0)
4 \# q! W' ^, M {
% M' q3 m3 @; @ if(debug)
$ {# e' I {% U% a# G) L {
0 h, D4 r( H! q" S alert("no object found!:"+objname);0 B' _8 E2 G6 }5 ~' z" C2 V
}
! z& J* K& u# D' J$ Z6 { }, L' c/ y" m/ C* J1 o# I1 G, j& S
else
+ P& R% p: a. t5 M6 [ {
7 u* Z( B- `6 K( M2 |# a- y+ C$ @2 q
# ^7 o+ K7 R1 ~; G/ Z/ u" T for(var i=objs.length-1;i>=0;i--) & j' h: Z1 G$ H4 X7 V
{+ O$ Z+ F4 r: C% t: l' f6 }
var node=objs.item(i); . u3 Y/ y/ _ p3 m2 v
F% G9 m. X% k
# O; Y9 _1 d1 M* Q+ M( U if(this.getobjstyle(node,"display") == "none" ||
2 P" n% y# U0 L this.getobjstyle(node,"visibility") =="hidden" ||. f8 u S+ e9 ?+ c
parseInt(this.getobjstyle(node,"font-size")) == 0)
1 V; u0 l7 ~8 l5 A% v0 c# s; i {! G9 A6 S; P8 Q9 D! @3 U
if(debug)
1 g7 y. K2 ?% R% p j' x. n {- d2 [' ?2 ~4 T4 L
alert("remove invisiable!");) u% c7 c7 v+ f9 i$ ~
}
]( `+ J8 @# }4 t: f D) U node.parentNode.removeChild(node);
# v9 D' h; K* t# y4 w ' s) g. P+ j0 N2 n
}# {7 R8 q6 T$ Z. G5 z* T; t/ ~
else
, Q) ~, J( V; Z& f1 { {( c& N$ c. ^6 F) a! e2 j
if(node.parentNode) + _/ J s! j$ ~% F6 `5 F5 f
{
2 \; a) {) ?( T+ v var orgNode=node;
% p( V6 @$ b% y4 @4 {7 n var orgColor=this.getobjstyle(orgNode,"color")
k8 I" ]% I* D! t" r3 T* j var orgRGB=getRGB(orgColor);
( L' {3 T4 p# a4 \. T, ]# M, e
- x2 o% J" u. V" m/ p var parentNode=node.parentNode
+ \, a |% w, e8 ~. E/ a N/ v" g' F var parentBgColor=this.getobjstyle(parentNode,"background-color");8 {" x9 h, r2 `6 [
5 Q; p5 s6 F+ ^3 t* C var isLast=false;2 \( {, j% b) e, M% x( n
7 v# r s+ P& l% s- b5 h
while(parentBgColor == "transparent")
- B- X0 K2 F/ q+ U7 x6 X {
6 d( y( F1 E9 A2 R& A8 @/ `% J% j/ b Z - e1 f+ e$ K* K* R6 L$ t
2 i0 L+ E. `, x3 F2 C# c# Q9 ~ if(parentNode.parentNode == null)
/ }0 c2 r0 h1 Z8 P: S- } {2 s S1 x# e( o& x) A( m0 M
isLast=true; v( u/ U: r! i* o* l
break;
, q$ Z# j8 w x: p4 w& D( l2 G5 X }' D4 X/ e( s3 @
parentNode=parentNode.parentNode;! D9 a `% d9 l5 o; R$ b6 K [
parentBgColor=this.getobjstyle(parentNode,"background-color");
) v- l( A8 k! ^3 ?$ v
; E6 X$ D3 [( ~3 r; w if(parentBgColor != "transparent") 8 H- m& B* L0 W1 ^! i7 P
{
( `. Y* l9 |$ s. ]2 ^( s break;
5 `8 s1 y- q; D }( X0 Y$ z% z5 D$ p; ^6 L
}
& U# ~) O5 u T& r8 _! W0 `' {4 o if(isLast) _1 D5 f* p. {' i1 @6 j
{, j- p0 Z4 C& U$ ]$ O; I
if(debug)4 j; f! E; N$ |( H# q Q
{ @. L3 l6 X% K, q7 B7 w: }9 `7 W
alert("last!!");
( C+ X/ u9 V! p* p9 u }
! y. L% P8 w. M5 o& p+ h7 @ if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
& J6 d. j" `( K* t {) z# W I V `8 o& X( L
orgNode.parentNode.removeChild(orgNode);
7 E; V8 P e& { }1 y3 C# E* K: u$ p3 P3 F3 x; |
}
4 t7 t& o, @1 M J, [; f8 } else4 w5 W+ u/ x( S. p- j" o5 L) F
{
9 h% ]+ x. @+ R& d+ C! B0 v if(debug)
7 n' `6 t6 _1 ^$ Z+ t$ s {
1 q) w7 t! I0 |; \0 y# _ alert("compare color and parent bgcolor!");
, r' n: k* F4 f, o }
3 j+ T# w; H7 B9 c1 ~4 N% c* s$ q parentBgRGB=getRGB(parentBgColor);
, C) u/ o% g4 l }; ?* h if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))4 K/ b z8 u; y K5 h+ e0 Y B
{' j6 P) P3 ?6 X% { a+ a3 _( {# J
orgNode.parentNode.removeChild(orgNode);
: _/ z3 Z% ]8 B/ T) o }
8 L$ v- ~: ?2 t/ x5 U+ a }2 ~4 h: s8 J Q" t7 S2 v
}$ o f3 m4 M* z2 s# n5 {
}
* `' U9 A/ Q9 ^3 B) i' f }4 z8 [% e' R& d! K
}. b& P2 {* |$ }9 o6 A; X0 w
% O! f7 T$ G* U ; s, E3 G- R: y& X7 s! f4 n
var itemFrames = page.getElementsByTagName("frame");
/ }$ l- A8 D S$ R( d5 T var itemiFrames = page.getElementsByTagName("iframe");
! b; s1 `1 {/ ~. S9 e& T- a: H5 s $ B2 x& j3 c/ y2 p$ P0 D
var frame, iframe;
8 G/ A5 O, X0 P' t" \: }# o- t if (itemFrames.length > 0)' ~, z- l' b" r7 J8 e8 d
{9 o' b5 D5 y) P9 i
for (var i = 0 ; i< itemFrames.length ; i++) # |4 Z ~+ Q1 {# Y6 w, a" P1 Z
{! s/ F6 ~5 Q3 ]- w
frame = itemFrames.contentDocument;
% a3 a+ n: I3 Z9 {' \( B this.RemoveHide(frame,objname);
* G5 G. Z6 m( u }
0 V& I$ c) L4 o+ Z% {5 p# E }5 }" \; W" t4 a0 [9 \) t
if (itemiFrames.length > 0)
+ ]4 A; v6 F* ? ] {
/ q5 p3 w0 P4 B9 D for (var i = 0 ; i < itemiFrames.length ; i++)
3 }2 }2 S5 q# A4 Y) a* _9 V% L1 f8 Q {
* q" d) ~+ l* d) y( ~: d) @ iframe = itemiFrames.contentDocument;% I. c! e- }3 V# f' L/ s5 X
this.RemoveHide(iframe,objname);
! `( b5 s5 V7 a$ B0 a$ n: b }6 K4 K/ j% ^8 k' N
}
/ P( h# _6 V- l0 H }
5 z+ p/ g4 |2 K0 q0 j catch(e)
3 A# a$ e: L Q+ h$ i: P {
$ L' t& C7 Z$ G2 \ if(debug)
6 u; i% v5 X. C! M {
' V+ N- D2 t2 b: a3 n: k2 [- H alert(e.message);+ v$ }. G9 a9 ?/ A g, p
}
" r1 u( O- u6 }$ A }
& O! V ]8 P! p }$ i4 _, U5 i" w0 E2 G
8 r7 N* Q% Z V3 v1 @3 O. p}( D6 `1 q* R5 H# P
) p" O0 f1 B: o! l+ X/ W0 q Ffunction getRGB(colorString)
- W) Y) A3 D( o8 l" w% }% p9 Q{$ x3 z' P& x4 Z3 s7 `: b
var RGB = new Array;; p) z$ Y+ y2 m! x8 `
var tempSting=colorString.substring(4,colorString.length-1);
6 _" H) d. ]- V5 s+ I8 v var tempArray=tempSting.split(",");* `7 K. }1 W; X; X5 b( E1 a
* T' |: ^" S+ H* J5 x! p/ T RGB[0]=parseInt(tempArray[0]);
Y( M; ^7 ?, M, B' `; R! K& S RGB[1]=parseInt(tempArray[1]);
# ~: n& K. o, |, j, L) c8 X RGB[2]=parseInt(tempArray[2]);
' D8 w, w! o! s$ C: P
' [) [# h/ e% \% E3 V8 X o6 A return RGB;
1 d4 T0 `! e( e! X; F! B5 d}6 u! ?# M8 s+ G0 W2 G
function keys(evt)
. L" u4 D- v% G' f- N7 D# X) R {
6 D, b7 m- F' U4 K, C. S7 v. Y if(evt.ctrlKey && evt.keyCode=="81")
6 v0 v0 y% U9 N1 a* } { - {; i3 y6 ~$ t( i( o( }
CleanHideObj.on(0,1);
; G, H5 b; u0 q; W' v8 L( A: g3 ~% X+ s4 d alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
4 t: I8 M6 ^5 v. y0 x$ U# c, N $ m) A- U; u$ A4 j
}
% G2 u$ s3 Y3 p3 ^ } " t; p7 r' S# f3 L5 i Z
document.addEventListener('keydown', keys, false);
7 d0 X4 T: a/ c+ _1 aGM_registerMenuCommand ('Clean Hide',
+ g& N `9 M7 U! a. jfunction(e){
1 D& |$ q7 N$ x* H. A9 UCleanHideObj.on(0,1)
# B& ~& a5 M/ s5 ?; Valert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
( ]# [5 r+ u1 x5 t/ M});
$ W( Y/ v P" R6 {' @0 K |
评分
-
查看全部评分
|