|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 / N0 o* d: S7 ^8 L7 [& d. Y
7 X( k! c4 W4 E9 G T! O6 R火狐插件,用猴子, E) [* j" S% n Z; K3 X
, ^- v0 O; r0 {% K* `# ~var debug=false; 3 C2 G4 O$ t; N8 x
var CleanHideObj=new CleanHideClass();( t0 V( B7 r% u8 o; U8 _
7 D1 l- _4 N2 k" v+ G% D! ?
function CleanHideClass()
# o+ G4 }! `- x* R% X8 }( `1 |- O{
$ ?/ N% h( ~3 | . z" d5 @+ B! d& Q% u, ~
this.on=function(id,bMZ)
5 n+ x: H6 _; } {% A& W1 M+ m8 E( x; K! {
5 x% O, w# ~8 _/ t0 u' J) n if(id == 0)( U3 l; \! ^0 U1 K% e$ w* b
{
2 F, `7 t) N% \ var page=/* document.getElementById("content").contentDocument */document;
( H& q1 N1 h0 E* X% K this.RemoveHide(page,"span");( }' s/ s$ `7 k# c n, e+ g7 B
this.RemoveHide(page,"font");
, I( q% F* h: C3 E( y& v this.RemoveHide(page,"div");5 n6 w. O9 Z# I/ e! ]
this.RemoveHide(page,"p");
7 C, y" L7 a8 F2 J2 ] 3 ?" S' ?% \0 q, Q9 Q
}8 b& U# t; u* X% j
8 x/ T. v0 Z( I& o
}
( H% L: X; R' ~# { this.getobjstyle=function(node,prop)) l! W: a* m; |( m |3 H$ {
{; A( W( C: @# p2 F( T& ? h
try5 S( Q1 h/ X {% |+ a2 W
{
! M8 y# ~6 }4 {' X1 f return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);7 |: I9 P: g; g, h/ d9 l) j% S
}
2 a* k9 t7 A. q" Y' z* C catch(e)
% @$ B2 I& m( G% s C, {3 K6 W! ? s {
0 A% t' j0 z3 [% b! ^! o& Z if(debug)
8 h; J: Q2 b, s3 `4 y% q4 \ {
1 Z5 b$ |) [* f+ j1 d2 U5 q alert(e.message);
% M4 h+ l1 s5 D }$ {0 ~0 a" X# L! K
/ j* ~4 X3 {" S' u* G2 q return "200";
7 J. V0 h# ? B8 `) C. c }6 j* D' M( \; r
}8 q8 n5 D/ G5 _2 b1 p+ Q1 p
% M7 {5 @4 |& A
this.RemoveHide=function(page,objname)
* _# y9 [2 s6 T( W {
- G# p o u# y6 b- P try6 u( @* @2 {) S, q& x7 h1 M' }; N% g; S
{
6 j# ~6 f0 a7 Z var minValue=15;5 W# Z, P* s5 n# b. f2 k6 [( n$ y* N
var objs=page.getElementsByTagName(objname); 3 \% Z$ W# D2 R8 J2 Y
9 N5 p7 D2 V+ c# J$ _4 I
if(objs.length == 0)
# |: f. w5 @2 {: S8 D, e {
; D8 Z) h$ u* H9 l if(debug): |/ b, i* U8 ^7 C. j
{
; K B P6 s8 g: P, ^ alert("no object found!:"+objname);
1 l" C% s7 b1 l! ?0 r3 v }: Y' [2 Q* p f5 W5 p" x: C3 l
}/ }2 I$ m, B+ t
else
* l# w7 a1 F& A9 J- n9 E( O) ] {
7 n4 r8 e/ S0 \; I- N" w+ r2 T K
( A3 [9 x E6 e( E for(var i=objs.length-1;i>=0;i--)
$ }+ {3 O3 M8 e6 C6 G {
9 s" d9 a% U; p% B7 T, c+ K var node=objs.item(i);
8 [; O: B0 q; l5 P, |- @/ ]1 W 2 h5 _! y! g# D4 x- ^
; C! E5 o F- V+ b7 E! R* P& Y# ^ if(this.getobjstyle(node,"display") == "none" ||
6 C X. Q- y2 q/ v: z( s+ a5 M6 v this.getobjstyle(node,"visibility") =="hidden" ||2 s2 Z; U% \1 X# x, D
parseInt(this.getobjstyle(node,"font-size")) == 0) , g2 f. O, D) a' [
{; Z. s' @) y4 \1 e4 o1 H* N
if(debug)
) I& s& Y9 o4 X" V3 U {+ x1 i ^1 H4 o" S
alert("remove invisiable!");1 E' K6 p% ^8 v0 X
}
9 i6 Q' f) f& {/ P0 l$ Y w node.parentNode.removeChild(node);
* H' k/ n# Y& }1 R+ e p
2 u4 A* s- ]8 h }5 T/ v- p( P7 s" D. F
else ! l+ z; F& T8 r" M& b
{
& M% C( R# h4 z- K if(node.parentNode)
1 B3 B% N7 F% R2 [ {
% [* v- g8 {- ` var orgNode=node;! B. r5 `% v5 Q# ]
var orgColor=this.getobjstyle(orgNode,"color")" f7 ^/ q. M; {! R8 g
var orgRGB=getRGB(orgColor); % x: T; Y" i/ s5 V$ M
4 ]1 M4 s' H$ U7 }9 e var parentNode=node.parentNode( O2 w+ E! d2 U7 X2 F" ^+ k
var parentBgColor=this.getobjstyle(parentNode,"background-color");. i% L5 M- S5 A# F4 Z+ ~; {7 s& o
0 r5 h2 x! i6 b6 @ var isLast=false;" b3 W- b% [) ]1 p' s0 a" T
( ^4 \4 Q1 R* F$ L4 l3 H
while(parentBgColor == "transparent")
& H9 v" \4 V, Z% i {
) }- }& M- u8 q Y- O0 V$ n * \* A0 ]8 m; P }, X0 N5 @
* T/ J; ?6 F& N* s if(parentNode.parentNode == null) ~8 Z! s9 ~% C1 }' C2 O
{
/ d8 X: T6 K# K# c; a; B2 ]# _ isLast=true;
9 M; q7 P0 e+ L1 ?( O3 r break;
3 [! G- s- o2 \4 g2 p1 j" |5 R+ ` }6 d2 D. t: Q! N8 R
parentNode=parentNode.parentNode;' |% G2 u3 y) C1 j; Z
parentBgColor=this.getobjstyle(parentNode,"background-color");
6 P; B( n6 m3 X r" b9 q, E/ O% p" V0 F; ?: ~
if(parentBgColor != "transparent")
& I* u* M$ j" N" z {
$ @$ A1 Z9 g$ `- V% i2 ~& ?! f break;
. b2 o7 q0 s! |, j( J }0 P' \3 x; Q. ^5 E7 U9 ^
}' F) ?/ f/ V5 L$ j! C, T4 Z0 g2 p
if(isLast)
/ W1 D3 p: M$ n& }. ~+ } A5 r {4 F9 ?: U/ J; I6 c$ c' X
if(debug)
1 `0 b1 N2 j" C6 y) T { T u& X5 R; D6 s. C4 l. ?1 f
alert("last!!");
$ w) l( R6 b' U } l" @- U }/ {, U) R1 m- f2 W2 y' a; J
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))% A4 Y. u1 W# B3 B% ~- r0 g
{
$ U- }5 {9 A$ d. i orgNode.parentNode.removeChild(orgNode);
, R& Y: r3 b% O) H6 B/ n }
5 |6 y/ _5 `" D( D$ E }
. v9 \ B2 B& C) A else6 n% R5 |- `+ E" ?! v" I( w2 ^
{7 @) ?4 w: R! X$ T$ y: U+ l" N
if(debug)& w- [% {1 u L* c3 n& T
{
! ?2 f9 {2 b+ h! s alert("compare color and parent bgcolor!");( K- Z# }# M& n, c5 T
}
3 _/ t$ M% x, r6 g/ E+ Z parentBgRGB=getRGB(parentBgColor);9 G, F U. t* w
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
9 ~$ Z2 T, J9 c( Z1 U {1 e$ v! N' y2 K
orgNode.parentNode.removeChild(orgNode);
+ o% B; N9 U+ {+ w+ O8 O9 V& h }4 A- N; L& ^5 W
}
4 u! H8 b: g+ V8 r- }5 w. b5 t }
$ o2 Q, ]7 K4 ] }' z6 O: l7 E! X4 X
}
; c- d# g& _: X# ?. X }. ^9 p/ `/ ]" Y$ P1 ]( a
# h- J0 b' |5 u1 b0 d
, F8 e2 `& Y5 }: U5 J$ G$ H* y2 _ var itemFrames = page.getElementsByTagName("frame");
7 k9 T) F# T* \: J6 V0 V/ C% u var itemiFrames = page.getElementsByTagName("iframe");/ g" s, P! w T& Y
. X7 y" e/ m! ^5 M% |1 f1 c
var frame, iframe;
- |" n; y6 f1 v/ u' M if (itemFrames.length > 0)
3 |1 e* Q9 F" G. W1 T {
/ x3 D F3 }7 \+ l. X6 c+ W5 `. a for (var i = 0 ; i< itemFrames.length ; i++) , _$ ^) ?% J7 c
{
C/ i* ]' c6 p! f- G frame = itemFrames.contentDocument;" `3 ` u! J T" C# g2 [, m; A/ F2 L
this.RemoveHide(frame,objname);
R& G0 d# A9 y% i2 e, F$ b) r! }* _ }
+ r* Y9 ?2 m& r }
" c/ D. Y, I9 u if (itemiFrames.length > 0)
6 b; E3 ?% ~ I3 ] {/ y7 l [+ N. [( R
for (var i = 0 ; i < itemiFrames.length ; i++) I5 `! k5 ?, B$ A
{6 L; F; ?, |1 A8 h! K* A: ^
iframe = itemiFrames.contentDocument;
- x& n* d5 t% x. v# r m! ~ this.RemoveHide(iframe,objname); , D) l, P9 f7 }5 }7 N- l
}
6 P7 j5 ?, F! u7 A4 Q) W }
' M' c+ X2 q$ Y6 H9 E6 J7 C }
B& h# p' E2 i) T* g. Q: J, w catch(e)5 [ V' O! [3 p
{7 a- [( f+ B0 {
if(debug)" j1 P8 l$ J9 F1 [
{: S; L0 F1 ~. o$ y; m& a8 f
alert(e.message);
1 N: |5 {* R9 S+ j }+ P3 V* V# R' Q
}
! g: s& X0 c2 Q8 n; F' r4 D$ ~ }/ `- \: E4 y0 i9 n
- j8 c+ u- x5 F; @+ |
}
8 I; H( w6 I6 r. q) t( N1 @8 `0 P1 P1 B! E. ~9 j4 I+ Z# Q
function getRGB(colorString)# S$ w" _5 i; N$ l
{
- q4 g) p5 |0 ~ var RGB = new Array;3 ?& ?& Q5 s1 e4 X( n% D* Y/ y
var tempSting=colorString.substring(4,colorString.length-1);, H% o0 A, M( n0 K
var tempArray=tempSting.split(",");4 j6 d' j2 o; [& k' g/ D9 y% N
1 o t& @3 `8 u# d8 n" U
RGB[0]=parseInt(tempArray[0]);
# ] V8 I6 i( G, M2 M3 y" T' Y RGB[1]=parseInt(tempArray[1]);
! U! i% s0 G0 O! Z0 ]. i3 F/ z RGB[2]=parseInt(tempArray[2]);" m. x+ m3 J/ ]6 v; s
7 [: F" f, U2 }2 s9 h% c
return RGB;
/ n" ^! W0 |5 H3 w6 s}& Z1 g) r# B* {& M; q
function keys(evt) / ~, b$ Z2 F! |0 Z1 \8 q+ E7 x0 E
{ 2 t5 y5 O! z5 a2 Z- v6 F
if(evt.ctrlKey && evt.keyCode=="81") * M3 k6 ^4 f5 G! Z. U1 U
{ 1 Z, R# ^) H: q6 T5 i, G
CleanHideObj.on(0,1);
1 P8 f2 b- k# P; J alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
( U# b6 v4 {. V5 `& {6 ^ y
0 z8 P) Q4 ]) `% P+ t% _ } / Q+ R2 [5 I7 _+ o0 ^5 }, c
} , |9 c( q+ F# E
document.addEventListener('keydown', keys, false);
. z/ O7 V5 e M8 k& FGM_registerMenuCommand ('Clean Hide',# ^3 c) r2 Y) q8 _" M) y8 W
function(e){
) c5 B# w, G) N& u2 l9 M: V7 k9 eCleanHideObj.on(0,1)- K) p$ R6 g0 H
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");( W( r. `* W$ x1 r2 G
});
2 A" g; i* A3 g; \ |
评分
-
查看全部评分
|