|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
3 k0 I0 q4 w0 P7 L$ {* U0 F- I' H
火狐插件,用猴子
( a' H) A4 o) p. A+ S/ _$ f( N4 q/ A* j; z% L! M8 x [. M5 @
var debug=false;
, {+ l! K/ Q7 g5 V; p: I% T7 cvar CleanHideObj=new CleanHideClass();, b, A* O% Q3 p/ u2 W5 R
) ^! X/ ?* e: Ffunction CleanHideClass() 5 F Y* E8 l$ t8 A
{ , w, K. Z% N3 o1 {% j
! ?. K. @" h4 Q# w. ? this.on=function(id,bMZ)6 y: n1 X7 A4 c; p6 Z+ @+ z" @
{9 W2 [" `/ Z& \% Y
\9 `+ q# [% a1 M if(id == 0)! ~/ m3 M$ B! H- X9 P, G O! D
{; |& r) X9 A) w" ]$ p! F
var page=/* document.getElementById("content").contentDocument */document;
' W4 E( r+ L' {) f2 d$ Z% [ this.RemoveHide(page,"span");
% \+ }8 c" U. [ this.RemoveHide(page,"font"); S9 Q8 Y2 n4 F' P; d( o, Z
this.RemoveHide(page,"div");
3 t. L7 L3 ~0 q8 }1 B! P( Z! G this.RemoveHide(page,"p");. N s, [0 u8 `' ^+ d
0 N$ Q( |" c1 n2 _' N }
' s* O8 b, @ S2 R, b
1 e3 _% o% P1 r% |& _ }" j& i! s f# ^% w# C1 d* u' v
this.getobjstyle=function(node,prop)- R* d/ ~8 J0 i8 I5 \9 _
{ u! L; l$ }) ]. a* t$ F
try# K- T1 G7 W X& B8 O. z) H
{# ^' f% ^$ z# y6 k
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);9 g, X$ q' o7 s: `% J
}
! {5 Q- @8 r% r5 \ R catch(e)" S6 m) j% l$ N0 X
{
V+ N9 y/ Q, m. P- w4 ]: r; E) {0 u if(debug)
- \& r1 ~( @0 Z {
. h; U, @( n( o0 L8 E; C2 Z alert(e.message);4 E$ m3 G" v/ }* e
}
& G A# r: M) Z: r , m* c: n: |4 A. k) J( r; A& u& h
return "200";
( @2 V9 K0 Y3 h7 \: o" S }( ~9 G$ @1 i) {: Y4 F
}& m$ b* _/ Q* F! O9 W( V6 n3 t( \
8 c) ]+ X8 W' F1 }/ V this.RemoveHide=function(page,objname)
/ P) E6 ?. y6 h" h* X9 p {
4 a; r% t, k. E' a: ~/ q/ h try
6 z3 T5 V3 L& c* \5 W { ^2 E8 F, u2 P. I1 X
var minValue=15;
4 b, a6 M+ N% J: n# r var objs=page.getElementsByTagName(objname);
8 N; j- |" ?$ ~) k/ j
+ C8 ~& b( s* z2 _ if(objs.length == 0)
; ~6 ]9 n' Y2 w {' z3 [* {9 X/ E
if(debug)
0 x3 }/ L z% H* z/ O9 r {, l" b+ n2 H# b- o( _9 p1 v: F C& ~
alert("no object found!:"+objname);
1 P# B5 a3 \/ P" L; c5 a }7 G) T3 H! |: X0 C0 O- k' c
}
5 Y5 W! C/ m! O! u- T4 u else
/ r" a/ ]) C: N1 H2 T6 ~ {
/ e# l6 v* R+ o8 n: d: P% f+ e1 k5 n
% T2 V' z4 q1 b" v. ]6 k" } for(var i=objs.length-1;i>=0;i--)
( d" b6 O3 B1 j" j) s& V {, p: K! M j. C
var node=objs.item(i); * _% ?% E3 U0 J) ?, |
/ i! T0 I! a; g, ]
y" h3 l/ I( {) V+ { if(this.getobjstyle(node,"display") == "none" ||
1 k! E3 V' V% K0 ?& M: \; B8 h: } this.getobjstyle(node,"visibility") =="hidden" ||. B1 t% r1 W! x. x" ?" S2 [* x! \
parseInt(this.getobjstyle(node,"font-size")) == 0) 7 N; [$ P. z8 l3 W4 T2 ^
{4 _8 e, ~" Q* V: P2 A
if(debug) a$ @7 f/ h w# g
{
+ K$ E& f- [8 i" q) e& Y alert("remove invisiable!"); X, \9 c& w1 K) x* Y [/ E
}' K3 J; {/ T$ D I- L/ }: T. u( x
node.parentNode.removeChild(node);( N/ c7 |8 M4 m
. _% G4 U& s: ` }
) L3 H, p$ r1 {6 z/ p else
2 h+ t$ K+ g2 p {
1 h) O2 e9 c& F5 t/ k if(node.parentNode) , x0 C2 ~- x& ~5 V; l* ^4 v
{3 Y7 l+ A; P' E* y7 t+ j5 G
var orgNode=node;
+ m, p# T9 J( R1 x var orgColor=this.getobjstyle(orgNode,"color"): x: x4 g& N* x6 g1 n% ]; D4 Y
var orgRGB=getRGB(orgColor); 9 b$ r; V t- I* X, }( v1 l
. J1 _* N% ~% P* K4 m var parentNode=node.parentNode8 U% m& t6 H1 n- E1 B: U5 y: r5 Z
var parentBgColor=this.getobjstyle(parentNode,"background-color");; ^2 d P" h) L- ]
- E. g) K& u6 V) O, v# O3 _) z
var isLast=false;0 O. x9 m' ]# `: X7 K3 s0 e
% E/ K7 e8 _" p8 q
while(parentBgColor == "transparent") : M" K, c0 a) l) Y" e
{6 J5 q+ i% q) W) s, w
5 V/ m2 @0 u7 ^- c0 [+ b* Z , D) i" R, t5 ]; |4 R, Q3 }
if(parentNode.parentNode == null)+ T. H& g" H8 X
{1 }" M3 {/ @2 s& V( E) Z
isLast=true;( V$ ~6 r. N+ }: b
break;& t; [7 A" w: |4 P
}
& ^2 P! B* J3 f! @2 W* i' H parentNode=parentNode.parentNode;2 {* R7 m3 e, ^1 f' `5 _% y
parentBgColor=this.getobjstyle(parentNode,"background-color");
5 g2 d& J+ h A% z0 O2 u3 R* I0 x7 H" }1 Y
if(parentBgColor != "transparent") 4 g4 ?* A: `1 N! S' h6 ~
{7 O4 I" y, @& X& \) s' q
break;' J. X# C% _5 k/ u2 q3 q
}( y1 x6 z! h2 J0 ?6 j f" ^1 ?# G0 R; o
}" H: x6 K0 G4 E4 [% g- O2 j
if(isLast) - n) D T& _' t1 V9 K- S. ]+ }
{/ r% @- c$ A9 z, i' @
if(debug)
" q6 D% q+ ?, f9 Y* R) {' U {
" B6 B; ?0 v3 v! Z alert("last!!");
8 h& \, N4 K# E2 p. J& @5 g }
) A1 N a0 ], G/ C9 l if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue)). {) l. c! w7 D' Z9 V
{
6 Y, _9 N) v$ H( W orgNode.parentNode.removeChild(orgNode);
) _3 t& Q: Q* K }
4 O$ I( e/ R0 R) k8 \ }: E1 Z6 F+ \9 Z$ `5 M: d
else+ x% p i' s# Y0 b1 F
{/ g, [- [5 A5 D3 x6 Q- B
if(debug)0 V* F1 `& V- F
{
* q: h4 c4 Q. k$ v! c4 {/ z; W( a alert("compare color and parent bgcolor!");: r. u5 l8 [4 Q3 e
}
f8 k( _( [- o parentBgRGB=getRGB(parentBgColor);
7 @: }- Q* @% K. ]" |. _, Y if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
+ w# h( h9 [* ^0 b; X# H {
{& i! Q0 c9 Y# Y | orgNode.parentNode.removeChild(orgNode); : v/ R% t9 ~% R6 Q
}$ s: U' u* R! P
}1 Y, h. Q {; }4 O' {4 R% V
}
- M$ M; Q$ _: d8 u5 n }
9 N+ a9 g- e# R: Z. i L. E }( |; v& ]# h( N
}
- s; A+ _ G0 x. w9 \# G
8 Z* S \ U: s2 M0 x/ O1 b' Z7 _5 i 0 ]: f- L$ {7 ^8 I0 Z
var itemFrames = page.getElementsByTagName("frame");
& O& q' R* A \% I var itemiFrames = page.getElementsByTagName("iframe");
5 P+ ^. K6 R4 g3 L& d
6 k. O5 J6 ]0 [3 C7 ?8 d% A var frame, iframe;# ^1 Z/ p/ l- W# I+ v6 c% c
if (itemFrames.length > 0) B( i4 A: T" @8 s O) y; R; I) m H
{1 u( j3 A6 M$ r
for (var i = 0 ; i< itemFrames.length ; i++) 7 V, M. T1 {# ~+ L
{ a5 D _" G" h% K" p
frame = itemFrames.contentDocument;
: i L) P7 i/ l8 u! G this.RemoveHide(frame,objname);
% L" ~( y" U9 G, Q- ? }
8 |, w( z4 U! ]6 [ }
7 ]3 b% I' j7 t if (itemiFrames.length > 0)# Z8 ]: `; b) X7 y
{
* J/ _+ J+ p4 |3 G9 Y for (var i = 0 ; i < itemiFrames.length ; i++) 2 l$ [1 ~0 k. m6 B, k9 Q/ c
{$ C- y' D: h t) G
iframe = itemiFrames.contentDocument;& ^4 P4 N' r7 S& e {
this.RemoveHide(iframe,objname);
x$ o) c3 X1 U/ s- ~ }# R; w+ d- s& I0 ^. x) |2 t
}1 n% \: s! l# x8 c4 L. @. a! m
}% `+ V1 U* M6 h: J4 S! }& h
catch(e)
/ A/ d+ ^4 f$ ?7 _, c' [% r! ~ {" T. X( B& O' A( i" W+ B
if(debug)
; q* K5 `2 L. e {( I K: `$ n) C
alert(e.message);
% _6 r# {3 z2 V- x) ^9 E- b }
4 \3 @6 j; S9 u1 @+ ]+ S O1 } }' l! b! d8 I1 s+ @. o8 v
}9 L* @7 w" P! e3 j
; n9 L- m) I& f/ ^% h
}$ o3 H5 W& Z9 T% l. O/ H+ V$ K
" S( a9 I0 A4 u5 K; ]' }function getRGB(colorString)" }. g7 A+ {, s" e# t: A/ T
{2 Q6 J0 R( u9 O' D
var RGB = new Array;& I/ Y/ g4 q- N6 F! a3 f
var tempSting=colorString.substring(4,colorString.length-1);. h+ F* j; M- D% U f2 S# E6 a3 c
var tempArray=tempSting.split(",");
& J- }$ N, M4 K+ q$ c v
( ~4 x) P' t$ g4 [ RGB[0]=parseInt(tempArray[0]);
5 ~6 F. C$ v& k0 A [8 W* V7 k RGB[1]=parseInt(tempArray[1]);# N& \+ A2 t% \- Q8 y Z
RGB[2]=parseInt(tempArray[2]);
% m9 z" n* e0 G7 o; ~: H/ p
; R& d/ {6 {; j% x return RGB;
& h/ z8 `, }: M, m2 x/ n}( o& ^4 _* A# U2 N
function keys(evt) 5 B5 E2 V) j) D z5 W2 T
{
3 P7 V9 ?* k5 p: _' Z if(evt.ctrlKey && evt.keyCode=="81") 7 s6 `7 N2 U$ Z3 t
{ ) N/ f* y* @1 Z1 _! o8 `3 s$ J
CleanHideObj.on(0,1);9 [2 r9 s, G% S$ M% y% D
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); - b) w! ?) a! ?: M" H \( h
3 G# ~# W1 n" G" b+ r
} + `4 z/ Y% W( I8 N9 Z+ v
} $ Y& I) G4 G6 ^2 N
document.addEventListener('keydown', keys, false);
$ I2 U3 l! q1 H. ]( hGM_registerMenuCommand ('Clean Hide',
3 E! b- P' u, F0 x/ N* P! jfunction(e){
4 U+ H* D1 s# Y+ z; ICleanHideObj.on(0,1)
4 c1 Z5 I5 ?, e1 u$ d9 D5 Walert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");4 m4 u6 S6 B$ E5 s7 `0 W
});
7 r( K- b: R6 Q# ?$ \5 {( V6 B |
评分
-
查看全部评分
|