|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
; c! q! S! f& }5 ]- P4 `3 |1 u% U( t4 R+ g0 i! Y8 v9 m s6 N2 U# K7 D& M
火狐插件,用猴子
5 c, A) H1 a4 [% w
: o2 M* }* N; l$ H( W8 Gvar debug=false; 5 E# ?1 z J7 N' S3 c- `
var CleanHideObj=new CleanHideClass();
' i5 [4 d6 d* r V8 {# h v, w/ d5 x' E3 f" H7 `
function CleanHideClass() 1 w. R1 \. D. Y
{ ; L' Z" ?( x1 D- D2 \
" h& @& P% O {6 N+ b this.on=function(id,bMZ)- ~% a: Y) Y0 P
{
2 w8 w# F. ?2 ]4 u% P9 a c* N 0 B( p( L7 M* w: O% s2 F I4 g# W
if(id == 0)% X3 _. [- a r5 ]4 ?! j3 i
{+ F& |8 H) m `+ J$ z/ w
var page=/* document.getElementById("content").contentDocument */document;
: J6 M" Y6 T3 ~2 C# j this.RemoveHide(page,"span");
5 L" @0 H# t# f) m; Q* x) a this.RemoveHide(page,"font");
6 R- A/ D' K; n2 ` this.RemoveHide(page,"div");
# ^- R7 _! K+ W: ^2 x this.RemoveHide(page,"p");; c4 T% y; L1 \- J6 ^# c
% `- Q/ w3 _0 k( n( e/ l# } }
# t1 I/ L5 H, j 9 x \- w* \( C) t7 t
}
) R9 g- L& H- N this.getobjstyle=function(node,prop)" T3 ^* F- ^) O6 [; O; F4 Q5 k
{8 w# w9 T5 p& B1 p7 _
try
( ], L8 m/ V" g7 q! e/ ~; j {6 P8 s s% C8 i+ t
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);9 L& {( y# S2 ]9 l1 D
}
8 E- \9 W! k R5 ~8 }: c! b catch(e)
$ [% N, b6 G' k9 G. c {
7 Y8 F7 E* W, P if(debug)
- V' ^2 W9 Q" H+ I {( {) i2 `9 u6 q6 T# R& g
alert(e.message);/ H; f, \9 [/ @8 w& H" b
}1 h# e- d! T; k
+ ^ D; J4 k, k' d: a( L* O return "200"; U- |0 ~, m# I' j9 c
} [7 b, R+ }; q" \( w
}- h0 a, q/ z# u
- u% u: w2 g1 [/ I+ X this.RemoveHide=function(page,objname)- A! F' `3 R, R) ^3 B% ~
{
: o/ T$ x; [( Q; c try d$ u7 P5 M+ ]0 |) P
{
3 l" x0 L& S) I' Q$ p, p var minValue=15; W y( _+ g( q) L s: Z: }
var objs=page.getElementsByTagName(objname);
, A! Z; B- Z8 o" \
% [' x9 Z3 G/ b! G if(objs.length == 0)
8 I- G) _ K8 U* ~ {
0 P6 j& [9 e$ g" b+ r; t# w if(debug)) {; |) Q7 t# u1 ^4 Z- I
{2 J' o$ a) T& I8 E5 N
alert("no object found!:"+objname);
) o( z1 n; i8 d! Y, f0 | }0 I p1 ]& z# J' H
}
( }& }* A7 a- G5 Q else
2 w$ F$ i& {& c) P3 [# p$ V {& m; i# Y$ W' V- V: _0 y8 f8 K% \$ O
+ A+ h" p* Q0 A1 d' ?
for(var i=objs.length-1;i>=0;i--)
9 j* O. |) \# V8 y) F {9 h) ~4 w a+ ]- v5 f
var node=objs.item(i);
) q i6 r& W4 D+ M, K$ E
/ |3 [9 k$ J( v
5 w( A' S' O" `: y: I. K) h/ B; ? if(this.getobjstyle(node,"display") == "none" ||
4 h7 Z" ` j7 j8 L4 a this.getobjstyle(node,"visibility") =="hidden" ||7 Y! }' T3 j' ?, c% h- G
parseInt(this.getobjstyle(node,"font-size")) == 0) 8 j" i! n! }% c& V+ j, j9 v
{, Z- c# r' R; ]7 w
if(debug)4 d Y5 Q% S/ |) I7 f7 r. e
{1 |8 |9 ?8 b7 W
alert("remove invisiable!");; s$ G2 ?- U+ V- a+ {. |! D
}' n4 {! V, t' W2 ]+ V
node.parentNode.removeChild(node);6 W, R" P4 H/ T6 m( t$ B6 Y
$ x4 Z/ ~" q d: m2 q$ u7 E; S }
" q( P* p R7 l+ Y# N else
" t& X/ p/ B' d! z {
4 \: C, a' D$ i2 s6 t if(node.parentNode)
u. `1 D3 y: L {
3 n3 P$ Y9 C* g4 A; J2 Z var orgNode=node;/ ]# x/ z/ R" w* B
var orgColor=this.getobjstyle(orgNode,"color")1 K0 M9 M& u+ f: N- V4 U
var orgRGB=getRGB(orgColor);
' {5 q7 `2 {, U; E- l, ] e9 U3 u 0 y) ]- A9 J* _8 E
var parentNode=node.parentNode
9 a, d; u j' ~' ]% c9 s5 Y var parentBgColor=this.getobjstyle(parentNode,"background-color");0 R9 x3 I7 F0 ?5 q# w( K$ V- m
8 }5 D- H/ X3 y( Y var isLast=false;
7 Y( X: `3 P I# m* N9 H8 Z
, o, N" ^4 a- n7 k while(parentBgColor == "transparent")
! E4 L7 K- x4 a* P: ~: j+ B {
& Z- \ V. p: V " K1 K; T9 A; L( \. [, e7 E
. T& y1 U* N6 e ] if(parentNode.parentNode == null)
" N) A _/ M2 }+ N/ ] {1 \2 J# }* F7 E* X. E
isLast=true;
0 T3 y) ^! `0 w- P% ` break;# \* b5 z2 D' V4 c P
}
- U. [5 }6 `, L+ K$ o. a/ G! f parentNode=parentNode.parentNode;
4 }. q- d, v* E* ] parentBgColor=this.getobjstyle(parentNode,"background-color");
# z0 j, C. B q" u# J/ Z; \( A" y# Q' f6 h( x
if(parentBgColor != "transparent")
, x% a3 D+ s/ x( }+ z {
, _4 l: q2 d- T7 m y" |) q( @5 b break;
: p8 W9 O# `! W, t! y, p% o% M }
/ u+ ]) ?. Y7 v }
3 J) }6 Y# V* F: o& l/ i if(isLast) 3 Z" f+ p1 S* [1 b! h9 d4 R2 Y/ ]: ?
{
' r3 |& b2 U2 H) R if(debug)8 v0 X, H# k* F
{: r* ^9 W" c; p$ L
alert("last!!");
( u3 V3 Y5 q- W4 ?: i$ q( A }
$ a) S5 D( D: e- v if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))( y8 \% X$ }) }
{
. p, ?3 U! {6 r3 Z1 c orgNode.parentNode.removeChild(orgNode);
- y2 E5 x' C4 u( k0 T1 M }
" \8 T8 F m# @7 ~0 U }/ ?: E, [+ d' ]) x1 x# ?
else% Z6 j# _, {2 L6 j @
{! V# W j$ Z; Z. n' {
if(debug)9 f F- l" U4 h: J7 t' w$ f5 l: j# u
{
! q+ r! z4 ~: J0 e, x. z alert("compare color and parent bgcolor!");
9 X1 @0 W3 f/ z& G }
f. n9 O7 Y+ e* ~8 ]/ A: U# l, A parentBgRGB=getRGB(parentBgColor);/ @9 R7 T* V0 {' v. t
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))/ X3 i! z* w+ F- s Q
{
0 `. |2 j. G9 `" @ orgNode.parentNode.removeChild(orgNode); 1 x+ ~2 }3 O5 }% ^; K
}8 J) n7 B6 m# l" y/ A
}
, I- U3 k% C: M" t# T5 q& n7 k }
# [( z4 F$ x- j; c: y( a, s/ _1 V }! Y2 F: D% x: c1 U1 c( N, `# b; u0 L
}
! l0 L% F4 g8 B& b h1 r/ f }. Q/ C. }; [) |- ?. `; W
! A" r* N2 X K# Y2 k4 O
( Z: @ N; [ C3 [' H0 }- D
var itemFrames = page.getElementsByTagName("frame");
# K! M4 X0 q$ y" g, ^& w: @0 `! M, M# D var itemiFrames = page.getElementsByTagName("iframe");6 ?( c8 `! t5 i" o; B
9 B+ z3 N9 S& ]2 X: h
var frame, iframe;
$ o& W; a. H% ? U7 B5 e9 e if (itemFrames.length > 0)$ p" h1 N1 e2 p3 h# t! ^: Y9 }" p- [
{
( u) T/ p$ x( L: } for (var i = 0 ; i< itemFrames.length ; i++)
( A1 j J( b& C& A$ G+ y {
( k/ Y; {+ ^5 \% O frame = itemFrames.contentDocument;
3 A! r* C( j# i$ D& t3 { this.RemoveHide(frame,objname);
- T. O5 Z# {5 I7 x5 p- f% C }
/ {. I! g1 l2 {* o! y }
9 e8 U2 k' x4 E+ u if (itemiFrames.length > 0)9 _+ J8 h3 ~3 ?/ l4 d8 h
{
o/ H" r) h6 |) |$ H+ g( G) A for (var i = 0 ; i < itemiFrames.length ; i++) 7 Y. f' i; I7 v# p* T
{
1 Z$ @6 u8 q/ G; v iframe = itemiFrames.contentDocument;' s5 F9 b6 n/ a6 t: f0 r6 V
this.RemoveHide(iframe,objname); & t! U) b x2 T- _1 h. B- S: P
}- w1 ]* q+ z8 D. n! k, W
}0 H0 X2 Q3 w( {, L& ^% i
}
& F+ |7 F5 `# N S, W" H catch(e)4 I e# h* R. n y/ h
{
4 m7 v' R- G3 u X- Y& a1 l if(debug)
. K. {) v! C& C, o3 Q {1 |) Q! y8 _) L0 \( \; A7 |$ p
alert(e.message);
/ a! m8 }: @* D }2 r3 Z/ L6 C& P* s
}! W: c9 j+ P$ M0 x: ^
}2 O" d& q3 K7 X( X1 _
! Z( r: }: c( U. T- M& u) V
}
3 h" i: h$ w% ^; g @( D, g/ o4 q) u8 Z5 G
function getRGB(colorString)
2 v" o- b4 U0 R* J# c; Y7 s3 a7 `{
) y2 a/ \, D% u! e8 [) A; }+ L9 n var RGB = new Array;
. ?( }5 U1 y- D$ A h, I0 F! a4 f var tempSting=colorString.substring(4,colorString.length-1);* i* t% l$ M+ k' I6 ^# \3 _
var tempArray=tempSting.split(",");! h4 p+ u' y6 F. x/ f S" |& d
P' I0 Z' P+ ^4 K% x3 \5 E5 i+ T
RGB[0]=parseInt(tempArray[0]);( R% z% D2 f/ h' A# X
RGB[1]=parseInt(tempArray[1]);
1 C3 u+ n/ |7 t+ { RGB[2]=parseInt(tempArray[2]);$ O' p6 G3 b" i9 ^9 Z2 |- Y
$ W& s& o! v; E7 p
return RGB;
6 Q3 d. z3 P* w; d}
+ n. m3 r5 i8 ffunction keys(evt) ! q$ Q0 V& @$ u2 v" Y) A
{
+ s0 A" |$ \4 e if(evt.ctrlKey && evt.keyCode=="81")
2 U! N' \4 s `* i6 C, e2 W: [ {
* W, t& l% u& t2 m CleanHideObj.on(0,1);6 }# ^/ ?; e& h
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
. V: b& X' K% r7 k* c) E; E 9 L$ m0 ]; n. c: u8 V) g7 g
}
- ]0 q: e, p* \$ l } 9 r( ^" M* [ Z
document.addEventListener('keydown', keys, false);
# E! O7 m+ [( Y# V9 T" MGM_registerMenuCommand ('Clean Hide',- V" T% A3 V- O4 ~# v- h: n
function(e){" M% w" a8 ~- t$ i) m) b8 j
CleanHideObj.on(0,1)( z9 \6 h5 ^! ?7 N2 ], h
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
; ^# @2 B+ B$ z. T2 \6 `});
; T# E' Z( w2 {4 U7 S6 V" i' { |
评分
-
查看全部评分
|