|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
2 p( p& W! ]! L+ K; u- [
; c, }0 l7 \$ |% L% O火狐插件,用猴子$ O6 }8 k5 X9 q* F$ Y
4 A$ {/ i! r& Yvar debug=false;
7 d- m5 t }/ \8 ` _) Hvar CleanHideObj=new CleanHideClass();! @8 N% c+ c8 ^7 D/ H. e0 X. k+ ^
* t: r$ C% C9 {+ c; O. @
function CleanHideClass()
h, R3 I9 b7 i2 k{ ' ~1 h2 k% |" O- q
t5 ] [5 Y5 C this.on=function(id,bMZ)
4 U+ [) w- J$ ]9 V( I {9 F9 `0 {( i. X6 C8 N# r5 d r8 L
$ ^, p5 B- b& T1 U if(id == 0)
4 C- F7 F# K" J. G2 |) |6 T( p { w; u t* D+ k% ~6 l2 v
var page=/* document.getElementById("content").contentDocument */document; : P7 K( o2 B- k( F1 i$ v0 h! |
this.RemoveHide(page,"span");
" ~* d |6 H" I. b3 y1 F) d9 m0 n this.RemoveHide(page,"font");
6 t5 H) m8 i8 ?- E6 w& w this.RemoveHide(page,"div");' a0 c( P. S" k; R& t& ~
this.RemoveHide(page,"p");) d0 Z9 T* E2 L) t' ?$ ~
" V: H( u7 L& n5 [, O* a }) Z. W& a3 O; ~: S6 b$ [ l; a% r
) ~$ A0 g3 a. K) P4 E7 ^ }
0 p z/ a1 N7 P8 f+ @ this.getobjstyle=function(node,prop)
5 S$ ] Z) D$ f5 o {8 D% j N+ S1 {. K3 ]
try
3 e: j, R9 ~' l0 A9 S {7 g$ L& l$ u% V) d9 L
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);( M. d8 \1 K+ p5 P7 B* _- t$ A
}
4 K1 K' g+ o8 l2 D5 A catch(e)7 S6 x& d9 {0 l0 n
{9 m4 `! C O+ E. j
if(debug)
& \. E' f; o. W {. i! n4 f N9 A) H1 ]
alert(e.message);# b. D2 x2 o/ M
}1 j% U H9 }4 N7 J/ Z) Z! I2 X
/ D. r e4 Q3 n/ u2 ]" ?, C
return "200";
- l% _$ R; u$ F- F }
0 W1 R" B. ]0 }+ F. j }) d" k: `6 A- S5 E: G7 v; G
2 o8 i7 O* ~% G6 H* B8 I this.RemoveHide=function(page,objname)
, u4 ]" S( V2 s/ c# P7 @- H" x {& h. a5 X: `! R/ J3 q
try
7 K" ^7 j$ ?5 Q {; w/ Y# D' y! O6 H
var minValue=15;; j. B' V" p5 U( Q
var objs=page.getElementsByTagName(objname);
/ R' l. c0 U5 e5 e# v X* ?6 Q( R, y' @1 w
if(objs.length == 0) ( C7 ~4 z; R& P
{
- ~3 K |, F) h/ J8 ?, I: H if(debug)4 P4 ~1 Z$ B$ m3 v% e5 Q7 V2 Z* E
{4 x) ` h8 \ t0 G* e! H4 O
alert("no object found!:"+objname);) |- x+ a) V# ?9 d- ^
}
% {% Z% F- v9 e' G$ ? }
; O, F* h6 y0 o else
8 r/ f6 [3 ^* ^' N' K. E {
# z- `& |, t7 }# }( e. k7 c+ j 5 `) Q) I9 ?) M( t# ]! c5 ^
for(var i=objs.length-1;i>=0;i--) 9 o. U2 q# h! J" v; T
{; r9 R! @3 X* h( B$ U' `+ y" G0 v! y6 @
var node=objs.item(i);
9 q, C% d' j" x4 S# `: Q/ f* ]
! b8 {7 S7 S( _* X, Z2 z
9 L7 Y! o: S6 B& F& | if(this.getobjstyle(node,"display") == "none" ||! ]7 B' S* ? K) a
this.getobjstyle(node,"visibility") =="hidden" ||* X) `7 Y$ Y% y* d( z
parseInt(this.getobjstyle(node,"font-size")) == 0)
9 a' t) D& ^& Z2 N4 k' S% B0 y {
# Z v M8 L9 ^2 w if(debug)
+ A6 Z" V$ j0 K; | {
: f" k v& S" P+ X5 f alert("remove invisiable!");" J/ B) p" g" G. M
}( q; T8 n+ Y. n9 z
node.parentNode.removeChild(node);9 I3 I% g+ Q, u
) W. w: k' g8 Z9 D* z9 _ H }
2 l$ t0 i7 m. q9 K5 y! y G else
z8 X0 X. D7 P {
/ [$ W- g; Y1 w if(node.parentNode) 8 G6 m! d; p2 a* H( m5 |/ x- ^7 @
{
! X2 j( y1 T! u& l+ c# \ var orgNode=node;0 i5 c/ Q9 B# ^+ H/ C9 T; o3 N" _# W u4 J
var orgColor=this.getobjstyle(orgNode,"color")
5 f5 G7 E( k+ J5 |: [ var orgRGB=getRGB(orgColor);
- c9 s# Y! I# [# A. A# X3 f
' d: y+ w- P* J8 } var parentNode=node.parentNode% N5 x8 l' R0 P
var parentBgColor=this.getobjstyle(parentNode,"background-color");/ F9 D, j( b4 i1 q7 m* P
( ~ E4 Y1 e" ^% q* `- z' g6 A var isLast=false;; o! E, l8 T# y5 c4 G+ F
. ]: D" |( X# o, y, }& E while(parentBgColor == "transparent") 0 T% K& X$ n* A" ^6 g% S
{6 F% C o& t; A+ f% P' _# H
7 D: O8 _) O5 t+ e# ] i
7 r, i8 w8 T/ K
if(parentNode.parentNode == null)
8 ? T } q* N9 J {
+ l g7 }& L4 j9 G: G. U* ^8 j isLast=true;
9 Y$ Q) \ ]) Q+ Z4 X- s break;
6 P% j4 S. R* p9 M4 U3 I }: U0 @8 Y% `# v- Z: f$ ]
parentNode=parentNode.parentNode;0 }. |' b# b" f% I, p' O
parentBgColor=this.getobjstyle(parentNode,"background-color");% P; r4 v4 m" Q3 }" H
7 J& j* ]/ C1 @2 y- d
if(parentBgColor != "transparent")
5 W7 L* F d* u" I, c {
' D6 b* R2 a- z2 U9 W break;
* | {) e$ x. q) L2 N. {4 z0 P } C3 P7 W3 u% z8 B; _
}! J; \+ u9 p* X/ y! |
if(isLast) $ K! N6 u9 m, W, b' l' ~! H$ v7 ]
{" x# e& R: i$ _
if(debug)
: N9 ?0 e7 w* O2 M# c4 z0 m! i {* n9 {: w( }# V0 d- |* L- w% f
alert("last!!");1 F. G$ j# _7 y- R( N; N
}' U, S5 S" b( e% L, ^; V
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
8 I4 Y6 C6 y5 ? {
1 b0 W# o( C, J* \, z8 G' w& O: E orgNode.parentNode.removeChild(orgNode);
5 j# k- w9 x+ b# T' ? }
6 m& v; D! B) a4 f) H/ G }
2 C( V$ ]5 f5 Z- [ else* O, X+ X" d6 W5 v( _* P
{
1 n" j* q' _0 c' o" Q if(debug)+ T4 _& `7 D* x/ A: _& e5 L0 n9 ?: z
{1 ?6 {, H9 j {3 R
alert("compare color and parent bgcolor!");- v) L4 b/ y1 ~6 e0 a$ X
}* a9 k# M# T% N( b, c0 j6 F( k, W
parentBgRGB=getRGB(parentBgColor);7 P; h; X; c b6 c8 }* z
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue)), H* R6 B3 @5 [" U
{
- t# b0 c/ g: D2 y7 ] orgNode.parentNode.removeChild(orgNode); % _6 h c. w4 O' }
}
& S5 n7 I* T. ^3 q0 \5 | }
9 s( ], s6 }( y; S* o; w }
' M1 p+ E8 ?/ p. e }/ r; E! Z0 ]4 x: l0 P
}! S! S- o5 k2 n0 Q% k8 A) c
}
$ N+ k" a0 E% `; n 4 [* \' N# H7 z) t
' B3 J& F" X" @ var itemFrames = page.getElementsByTagName("frame");$ l' ~9 z* \5 k( j1 \) ^3 } Z
var itemiFrames = page.getElementsByTagName("iframe");& d' E8 _8 u: l1 D- k/ H; w
. s- w. w, O# c, b, i var frame, iframe;) Q# w" f& m5 H
if (itemFrames.length > 0)% G5 o# H+ L( S, C0 k9 U
{" o. ]1 x* A( d; s
for (var i = 0 ; i< itemFrames.length ; i++) # s U1 r& C! _4 Z l6 x- ^
{
8 i/ j" f1 j. H frame = itemFrames.contentDocument;
1 g4 n: S: M+ J! h7 c, A$ b5 p this.RemoveHide(frame,objname); ; P7 L. t. {, O, a
}* ^1 O( x i& t7 I' p! _& ~
}
; U8 K' a$ }- h, z8 ^% x% s if (itemiFrames.length > 0)
7 n( y& ]3 D: g7 v1 J7 Y {2 q/ w2 S, L# O9 a5 a! }
for (var i = 0 ; i < itemiFrames.length ; i++)
+ g9 F! W( j- A7 W {
4 M6 F5 m: g4 R9 l) s! Z iframe = itemiFrames.contentDocument;
( U. W# S6 n. i% C- \ this.RemoveHide(iframe,objname); : q" g6 M7 [5 m" \
}" N% T3 i2 p. M; Q* a0 Q1 \
}* i* e* y9 l, D- @$ x7 ^9 y; |
}" z$ a8 Z6 K$ E4 r5 A( p9 n3 X0 q
catch(e)
6 B* ^! F- F- V& @8 N2 ~" @4 s: E {
0 @5 b$ F# u" _' I5 S( O if(debug)
' y' z+ n$ Z$ \9 q! x( P { E; `: B5 k3 t3 d8 h8 K% E
alert(e.message);
0 x8 u: C# b. }2 A }
" O& F' w8 H( \! ?2 [1 @ } a# N1 s3 Y/ |2 S" U" ^2 j
}( E1 c$ K' S' [8 \; l
6 ~2 X( j2 l. Q}! X4 B0 t0 h+ U7 m8 _
% F2 s# @- V' U& m% N4 k% zfunction getRGB(colorString)! ^) \- Z/ y" I9 N/ r. U- q; \( w
{2 `$ b8 e; g: w* }/ L% r
var RGB = new Array;# t- Y5 l7 w' [. |, R0 [
var tempSting=colorString.substring(4,colorString.length-1);
& i- j; Z8 q" L# V5 f# l var tempArray=tempSting.split(",");
5 n" I. _& E( p0 }+ O; g/ U
1 C' s% ~) H. K9 _* O/ _ RGB[0]=parseInt(tempArray[0]);& ?" g9 |+ X1 u2 e" N ^
RGB[1]=parseInt(tempArray[1]);
7 m& v j; H' g2 B+ n+ ?& d RGB[2]=parseInt(tempArray[2]);
$ ~% x6 {) q# q# V
* x, H! ]. r$ g9 _ return RGB;8 }+ P* s* r7 e( z/ `
}
2 z/ O) _% k9 `8 _. rfunction keys(evt)
! T6 R1 R2 {$ x, @- V H4 w { 6 {" T3 w5 G* k" c
if(evt.ctrlKey && evt.keyCode=="81")
, V2 ~4 L v" f7 \; c8 e {
" F) i( f" e+ U0 o* P CleanHideObj.on(0,1);
; s* k# C- }% O' M alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); # r9 x/ R, g! D* h5 H& P' m
+ l# V+ J0 Q3 e( B1 ?( o# g
} . z4 O9 U% W# ?* N+ {
}
* R3 B( M; h9 I7 z( ?document.addEventListener('keydown', keys, false);
- N2 X' k7 T7 f$ Z! {( qGM_registerMenuCommand ('Clean Hide',
4 @5 {6 g) @: Y/ j: X" w# Hfunction(e){
* e* P! q+ R& K. o) v! t( WCleanHideObj.on(0,1)
7 i3 E- y& L0 |7 b7 }5 s7 Ralert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");. k& k% y' r2 d; w+ g2 p. a' E
});
5 x9 ?9 W4 w8 H: S- H |
评分
-
查看全部评分
|