|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
7 o% H3 k, U8 |% r' w) P
4 Y3 \3 X% _3 g火狐插件,用猴子
' e2 |# K- ]0 Z, T
8 ^$ v9 f) v* ~ }var debug=false; ' V" S; P9 B: c: Z y6 T
var CleanHideObj=new CleanHideClass();
% H V* O) z+ l4 n. U1 [2 J: ?/ S
4 V" P- O n: P) \function CleanHideClass()
% N; E R7 l$ X0 W6 ~{
* ]! Y2 k/ Q" N# @! J
9 Y+ l* a9 w+ V) [ this.on=function(id,bMZ)
* {/ |" \+ }( W7 I0 z/ _ {
( m4 ], l1 y! `$ j! @' b1 ?8 y) Y
! K. U1 K' O0 H; Z/ W6 i2 o) V# @ if(id == 0)
' R$ W7 k; c1 O {
' B/ z/ h; Z! @/ {, g7 F var page=/* document.getElementById("content").contentDocument */document;
1 ?3 z( d% t, N i; @% w9 y this.RemoveHide(page,"span");. F: u+ Q; I% T9 P% }/ J" B
this.RemoveHide(page,"font");
5 F- J* K) m9 _2 [" i6 R3 O7 P this.RemoveHide(page,"div");
3 E) U- {2 L/ y( N3 x9 h/ \/ c this.RemoveHide(page,"p");
8 I! h* w" i$ k! a/ l: X 4 } ]: y. H' T9 A7 S
}
% l0 N' r* R7 } 8 D: i9 _% {8 I8 U: s
}9 j9 z$ k) e6 n1 N$ C, r
this.getobjstyle=function(node,prop)# a$ z# \0 T- }! {
{7 z+ q6 Z+ k5 n" A
try
9 X; w3 R5 {3 O$ i& i- _ {4 p; g7 y P6 P: n) i( c
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
9 q9 Q) ^2 d A8 T5 h" G }0 U/ M8 \; L/ z; `
catch(e)8 w, E6 V: {7 [' ^+ W9 b1 i. U
{, D8 ^6 e, B0 x
if(debug)
: ?6 K1 U3 T5 r; R1 ^ {
9 a5 X" F6 Y* C( O1 n alert(e.message);
9 O. E4 J6 ]& c }
. {" D. V1 D7 i* s
: N( E3 ]" u; I' V& S, n return "200";5 c+ ?% g8 s. c$ [" I# G
}
8 w- j! s+ V5 _ V- P, z E }
) ~( `9 ?% r8 A3 `4 ] 1 ~# k5 N) Z3 y& t7 e0 r# V
this.RemoveHide=function(page,objname)
9 s2 I9 P( \: R {3 a1 g/ K; G# z. n1 w
try9 i/ O7 n+ L4 ?1 t
{
/ H2 b% P+ e9 k var minValue=15;
5 g* o. m" R$ E6 c# z var objs=page.getElementsByTagName(objname); 8 y5 \ a8 C F- ?0 o7 u1 V
' z8 Q9 A7 D3 {: h. A
if(objs.length == 0) : x0 J# G" [% S1 [0 h; U
{
a$ G, z: C7 T6 C4 ]7 [ if(debug)
: |# d: k$ G }: F: J7 ?9 K/ j {4 \% a- M( }$ K/ c
alert("no object found!:"+objname);
: f. |5 P6 m/ K e" Q. K7 v }
( O d- {/ G6 l4 Z% g3 N4 } }) V! G( }9 c( {4 x3 g) P" t5 N
else; {" g2 X/ R# y0 t3 G8 l' b
{: m7 e8 w) u+ Z$ _
& m' ~9 R* ^& t) A, |) ` for(var i=objs.length-1;i>=0;i--)
) _, d- c8 o% x, \$ O0 ~5 z {
( |, Q: y" {" }5 ^ var node=objs.item(i);
; ?# p4 r/ U' b0 M I% k) ?7 K4 q! ]( S Y
/ F" g: m, M& P
if(this.getobjstyle(node,"display") == "none" ||
0 C/ V4 a0 s, K, c4 H0 V2 S( @ this.getobjstyle(node,"visibility") =="hidden" ||! o+ a. u$ C( j5 @# k+ D
parseInt(this.getobjstyle(node,"font-size")) == 0)
: g. k0 l8 T8 u' x. x {1 S9 s' `8 G! p1 O. c4 B- x( `
if(debug)
8 e1 L1 j9 d3 K i, o B5 U {
" _9 V. a7 X5 v+ \2 [: m alert("remove invisiable!");
5 n, _) P7 y- n; L: j }) g/ N- T1 q' o3 a& P0 \3 F( l
node.parentNode.removeChild(node);) @5 w7 E6 M* g0 B Y" S
) C) {! t# r* [% P% l6 \6 [: \
}
7 ~6 S- b* Q, M% F else " \( [6 e0 \. n% S
{) }$ r6 Y/ t) s0 D4 F% ]5 w6 T; g
if(node.parentNode) 0 C' k8 V8 h8 X9 u3 D
{
% V$ e4 t7 r: A) h2 P8 X var orgNode=node;
8 r" O7 n. U% }9 u+ i var orgColor=this.getobjstyle(orgNode,"color")! q0 S1 W" Q( ]3 I8 d9 ~5 r
var orgRGB=getRGB(orgColor); ) ?7 t3 J8 \4 h; g( F1 K. G
' A3 {, z& l2 |# z: l" z var parentNode=node.parentNode w" \% ?) C& Q" M* {, H
var parentBgColor=this.getobjstyle(parentNode,"background-color");) |8 R9 \$ q% o- h
* Y! ~" s; i- Y# s7 g" w
var isLast=false;
& _9 ?* u) x# t1 y M) J
9 @2 n% s) \6 J: J, U while(parentBgColor == "transparent")
; Z/ ^" p5 q- N( X* U# l1 J$ [1 { {. n! I+ E( g/ p9 @7 |! p
5 f4 U g: `/ W, H1 d
9 n3 T2 k, x. M7 C. ^ if(parentNode.parentNode == null)4 \+ n& A3 `; I x
{
& M3 Q' A; d. Q' m isLast=true;/ d5 K6 j# h3 p) H. [
break;
% L8 {3 H3 f. M9 Z( b1 m. T }
5 w! U& @* _9 ]! h/ O parentNode=parentNode.parentNode;
" r9 }. `: n+ Y& d parentBgColor=this.getobjstyle(parentNode,"background-color");- p' U+ l5 Z. V
, m9 v# s, e: e) S
if(parentBgColor != "transparent")
# @( m7 R0 K3 c" U8 j9 o {: `3 |, r# a) n2 @! U9 J8 H7 p2 G# c
break;& E* I' r: [8 b3 v0 Z
}
1 t8 t& E# @$ u) E- {3 h; k" P( V }4 k+ L& u3 W; l; h
if(isLast) + j6 ]/ P+ t; ^' Q6 G8 t
{: f7 [$ w1 B) c. s9 ?! H8 `
if(debug)8 p! L3 S& q7 o/ _( Y
{8 D- j% }9 o* N( F( _4 j
alert("last!!");
R j( \; B* U( ~0 ` }9 j- K2 X8 j4 E1 R+ N" y
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
- g* Y0 C, D" ?/ t+ D7 A {( \) j7 \$ g+ x0 `& V
orgNode.parentNode.removeChild(orgNode); # k' v5 F" a9 g9 `& Z6 ]0 G4 S
}
" S' J" T' r8 Y; `& z/ `; ?* l }
& o: q5 L. A6 L/ M2 S* ?/ I% ^7 M else3 M% a. ^5 _& c% S
{1 m& P" m! ?- r& M) F& y. d
if(debug)
1 j8 A( ?1 v! i& j( s4 O. Y {" ~% F1 T" ]$ T) H9 h9 c t
alert("compare color and parent bgcolor!");# A2 r# x* G$ T
}- f) E9 M" R% @/ S2 V( H; u
parentBgRGB=getRGB(parentBgColor);
& v5 m) E1 G8 N9 S if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))2 G/ I0 G6 j# H$ Q) {
{9 z% k' T( h7 b' S
orgNode.parentNode.removeChild(orgNode); 2 u; _6 x4 {8 U' k f
}
. K) f, g# w$ v7 ]) @ }
- R0 p3 ]0 S" F }
3 i: I2 }6 q" T ?2 ^/ j1 d9 U }
4 h- q( R+ @* _8 q3 V }
0 R' J' {6 d% U4 I$ ]( j9 A; _- e+ U }
* M2 _1 k+ G C: o
" L# o5 n ?6 p8 P - h0 m6 G; p- `( } g6 |
var itemFrames = page.getElementsByTagName("frame");; ?- i3 B, J4 x( n+ q! N2 g/ [
var itemiFrames = page.getElementsByTagName("iframe");
8 z1 x+ x2 z" T4 Z, v3 s* \
# l* z) ^% T* Y" t8 e/ s var frame, iframe;
/ [' {; |& G. j7 `% o if (itemFrames.length > 0)
7 C- c3 O1 ^; L+ x {/ T' C8 \) z- D
for (var i = 0 ; i< itemFrames.length ; i++) & \# ]4 Z; f0 f; s
{: O2 Y) Z/ }9 Q$ G" B: v8 |
frame = itemFrames.contentDocument;
; p* a: e! p6 n _/ t this.RemoveHide(frame,objname); 2 m9 ? O0 m6 J |6 f* x- v3 }
}$ f4 ]0 B; Q: N* ?) g
}+ ?* P* a5 Q" d; j
if (itemiFrames.length > 0)' S+ \0 y5 b( M- W
{
! ~% F K5 U- c2 G" |( Y5 } for (var i = 0 ; i < itemiFrames.length ; i++) / W6 p/ p. Z5 E) C2 K
{. X! M* b3 M# i4 |
iframe = itemiFrames.contentDocument;5 Y, m8 @+ p/ i7 ?/ _* j( P/ G
this.RemoveHide(iframe,objname);
! w% M; x6 @, e! ?( [3 E9 \ }
* K& S( c' A/ t4 A2 S7 t: X' P; L2 r }, A- n: E0 I" E2 s" A& R/ @6 F2 w
} g$ I2 N' C( J, f
catch(e)
& ~+ n3 ?* w. ` {
8 I3 F* ~& A+ a: `$ V3 Z8 g W if(debug)1 E; H( ?3 ~ \4 A
{! g( c& H+ h% G/ \2 _5 W/ C+ B
alert(e.message);; S' M, W: P/ y% ]/ y2 W$ j
}4 i9 G5 ?, i5 H: K
}
, D* A( ?) s7 [4 ]" S7 l4 n+ k }$ S- w) h L& \6 G
* V" [5 v9 |( l6 x' z
}; s3 w9 m. P$ I( ^9 o
c! `4 X; _9 w: K3 V( ]. ifunction getRGB(colorString)
9 @0 V4 x! Q. C! Q1 N' n9 \ y{1 L/ N* m) N, w, ?
var RGB = new Array;' y5 \2 m) F1 W, j4 K
var tempSting=colorString.substring(4,colorString.length-1);
$ J; t( E( ?: G! G; K; R var tempArray=tempSting.split(",");" J: c% |2 @2 }
- \( c* O2 i. F1 j+ S& C1 \ RGB[0]=parseInt(tempArray[0]);* w1 F, d. n* E
RGB[1]=parseInt(tempArray[1]);8 q% Y! O2 ]& o) r
RGB[2]=parseInt(tempArray[2]);
! T9 t1 q" a$ @# j : r% Y s" p% `
return RGB;
{* u2 @* W# a$ E! O( A}7 ]* E c* r N/ g
function keys(evt) ! a% Z0 A$ K- ]3 L
{
% t& }- y% ^4 s5 c; U' Z* p- x* \! r if(evt.ctrlKey && evt.keyCode=="81") 5 a$ m5 {: m+ @/ _" _ ~
{ : b# d% N$ y2 i! \' f9 n: T
CleanHideObj.on(0,1);' S) I& @1 V7 J% W8 L* u* z& x
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
. P- G' Y, l: Q4 I. p# L" q
C( ?. ?7 }0 i3 u/ [- j }
5 l1 v% j1 v( N. e1 p } # E }5 O* E* L$ y4 w: c- ^3 V
document.addEventListener('keydown', keys, false);
' U5 V7 J& I0 Y( w* a& MGM_registerMenuCommand ('Clean Hide',
8 @7 @ z5 s o4 {function(e){
* \) E* `- A# ~3 cCleanHideObj.on(0,1)
: k% ?5 j" Q. E, y A# \5 H: \alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");* @) a/ b/ Y" g1 [9 { Q5 {% e" S/ B
});
* `5 x* _7 |$ y' ~! r$ Z* r" a |
评分
-
查看全部评分
|