|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
1 K, L5 s2 S' A
* F4 k' B2 t3 z6 z) Z, h5 ^火狐插件,用猴子) a: S2 a4 g* _7 q% |" `2 }
# d& K9 V! h# j$ U
var debug=false; 4 h0 `! Z: K G4 R& U9 P& y
var CleanHideObj=new CleanHideClass();
# ?( N8 O8 F+ E: L& u( q
* [9 m7 y C" K8 [function CleanHideClass()
; @+ N! b8 U4 R5 h{ $ V# b6 D* v# n4 v' S, H b
& [" l% N3 M; r) E( V this.on=function(id,bMZ)4 d& ]& |8 ^0 f: V: k. _+ v/ c
{$ V, @$ B- H" S' ~" c- R
' x+ h0 G7 w \5 H( O& v5 N if(id == 0)
- M5 p( e% ~5 Y: I( U5 G$ x {
1 k6 ]8 V! C) L# N+ G$ D5 `* @3 ~8 Q var page=/* document.getElementById("content").contentDocument */document; / x) E$ v& |5 O/ F: ]5 b9 c4 n+ [" I
this.RemoveHide(page,"span");
- ?8 Y4 c# o5 h Y5 }: x$ V this.RemoveHide(page,"font");
5 K. H4 W7 e) ?! t this.RemoveHide(page,"div");
; y! u: b6 s: x( H( J+ t$ O this.RemoveHide(page,"p");$ }7 h3 q3 F: o$ h1 P, T
6 n$ G! m# R3 d6 i, C- | }
$ O O1 f0 ~4 o% d/ a% D; _ 6 r3 w% ?2 `9 o; w, v9 r
}
5 K5 |1 f8 R- {8 [6 A& F- @/ Z8 q this.getobjstyle=function(node,prop). x3 n3 z/ c( Z9 b
{
+ m0 ~' E5 ~2 }3 b$ P1 M try( o0 _8 N' y. N% }7 O6 v
{
: N+ p5 u9 }4 x3 e return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
# x4 S" Z2 x1 |$ Z" y/ s }! ^4 f) P; F( V3 w; h
catch(e)7 k2 \1 G& u/ x4 P
{
3 _- y1 {* S/ a' m0 u/ j if(debug), w% Y" c1 r2 V8 n) K0 \
{
]+ L$ r E, L* ^$ w) o8 ?5 J" m* M1 j alert(e.message);
; q/ q/ e; V* z) u }
+ I# {4 X" Q0 G $ D; ^9 {' X& `+ F$ x: h4 z3 V
return "200";9 t3 ?3 B" O3 \- j: `
}. ]2 M/ V: Y6 g: L+ @7 ~3 C7 X
}; ?. l% ^* D: Z& {: \& _ q+ `0 j5 V
2 W- N% W% z- r! c" P
this.RemoveHide=function(page,objname)
* U9 B* s" ~# I r% ^7 w) m {4 V$ e* o1 S' }) f5 F
try3 R7 E& q& M8 W5 w
{) j) }' A- W4 A, ^7 i+ [
var minValue=15;
8 t) a, v2 ?+ u' U5 W7 r) O9 P var objs=page.getElementsByTagName(objname); 6 T* B( z6 ]$ [- E9 }8 J7 Y
5 j0 _' T9 r% K# H' }7 _ if(objs.length == 0) . g; X* _3 i* T+ y2 P- [9 U
{2 p0 e/ D J: M! V
if(debug)# U) C. r* s: ]0 V
{
' n1 G+ f, b: e. c8 }3 v( e/ } alert("no object found!:"+objname);2 i* u/ |8 i, l! ]: {8 _ Y
}5 j) U4 W2 A+ S3 s% y& ^
}
" d1 y. [% ]6 _6 g6 @ else
8 i4 D, S, e5 P) l {
4 K2 f7 p- O1 \
; q$ p6 c: V# t/ S5 a t3 u* U6 M4 h for(var i=objs.length-1;i>=0;i--) : W) h2 E) W9 d* K
{% I* l! I+ F- G, L
var node=objs.item(i); * I/ B9 S2 T/ j8 z
. @& m$ [9 f. {0 M0 @: e, g! H
5 F( ]1 ?! \, J8 y( G if(this.getobjstyle(node,"display") == "none" ||
% `' R, R5 Y9 j* _ this.getobjstyle(node,"visibility") =="hidden" ||
2 ^5 i; |. k; @1 q parseInt(this.getobjstyle(node,"font-size")) == 0)
8 n$ g3 a1 S5 @" O* M5 n+ M7 y {
+ u4 [9 H) h$ m% C+ j* u if(debug)
: H6 Q r9 v# P! c {
* h- d% |- n* i4 {0 J$ q, M alert("remove invisiable!");
; v) F7 L) ] W+ X# L+ w }
( }2 Q y! y$ Q, p0 q5 q node.parentNode.removeChild(node);# g& ]+ X/ @1 x$ l6 `
: R/ r5 U/ ?/ V3 O& ~ h
}$ @5 m2 B; e0 i0 Y
else
( ]9 s2 c c. K7 K+ f* i% y( F$ A {
4 n8 ~7 x& o. s; C) p if(node.parentNode)
+ f5 Y5 {# F+ z: q4 \8 Q! F/ x {& Q& e% _' M' P* V+ z/ O! ]
var orgNode=node;
$ j2 Z+ u: H9 a0 c Y- [ var orgColor=this.getobjstyle(orgNode,"color")
. _/ a, ?' Z0 g$ J9 S var orgRGB=getRGB(orgColor);
' R: X9 c) p* G4 ~& G p . E0 |0 \1 r8 i- o! T- f$ Z
var parentNode=node.parentNode, a. `* O' m) O% f8 a
var parentBgColor=this.getobjstyle(parentNode,"background-color");
, n6 V: n# K, l- E$ C5 x
% U( s0 |8 X; E, E5 r0 q5 y var isLast=false;
% L4 W( c3 e- e/ g8 }2 S; M
3 b4 z+ X( ?- i while(parentBgColor == "transparent")
4 E8 Z8 ~9 d8 O' A* p5 h+ [ {
% N9 @' ?' `" t, f K
: `! b. L( r: N2 s
1 S0 l% I* m7 `0 z if(parentNode.parentNode == null)
8 b8 M- D' ?, I% N( S {
$ `; C, f# W, N( O) c. t isLast=true;3 s. [6 M1 }1 ^( e
break;
1 g* x# b# M: f( d& G0 J }
0 ?, S: g) a9 ?2 N parentNode=parentNode.parentNode;
5 {: v; c) a0 Q& _) m8 h parentBgColor=this.getobjstyle(parentNode,"background-color");
9 h U0 U1 p- @7 n# S5 a$ b- z# H9 a( F% a% W
if(parentBgColor != "transparent")
4 @; q% d1 V% e. Y0 }- h6 P2 v {& E, i+ l- n) i2 l$ J; w8 b+ Y
break;
5 q" b {6 }0 {, a5 G8 w" {8 N! l }1 U0 z0 @; `/ {: } X
}8 J @, m+ B" Q l
if(isLast)
: J- B" d8 z4 Z, P {
- C$ ]2 {5 B' g+ A' I. B6 M R if(debug)1 v. Z$ U) ]9 V3 t; p9 }4 W5 k
{
1 P# {# h3 F3 { O+ A- w& G alert("last!!");
; l' x+ {3 `( \2 @- Y }, j* ~7 A8 ?" c& U
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))9 z( C* X, U# m( K
{: i6 [6 E) E8 W4 a
orgNode.parentNode.removeChild(orgNode);
% L7 w9 s3 h: T' T& d }$ T0 m$ w7 n2 \# [6 ~
}
U# r M& q9 W1 j$ D else
, F9 D9 ]) E+ q8 j8 n4 V F: G" J {. D( p/ u1 z7 [: k
if(debug)
& ]8 X8 q: @8 A0 r( W0 ^' L {' S2 G2 d( V1 u' O
alert("compare color and parent bgcolor!");
' v9 X. W$ ]% S- ] }5 t4 c! l( g, \4 q
parentBgRGB=getRGB(parentBgColor);0 ~; j2 E& P' t( _( ]( C; [+ |
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
* n( g& L) V- @: f( c6 p {
# ]; A n1 h$ M8 O5 _2 F" G orgNode.parentNode.removeChild(orgNode);
/ E! _0 R p2 r& h }
4 N3 G6 l$ U) | }8 g/ e6 F) Q1 o
}
. \; @5 S/ R+ a }& b& N# P: \) z6 c1 p
}3 f. p1 _6 Z) y" e6 m9 a
}
; S5 V$ E E# }8 |6 ^' r6 s
0 A' g7 F% d( E! u+ Q6 ]6 f# }
! l( X+ U, D' p" h- I var itemFrames = page.getElementsByTagName("frame");) A, X. d6 Y3 f$ N2 |! c
var itemiFrames = page.getElementsByTagName("iframe"); M+ a6 K8 R9 e; }* J; z" A K% ?& R
" q. ^: l' p8 N7 V, m5 i
var frame, iframe;
$ X, z7 f! V. C' `3 ?+ d# f if (itemFrames.length > 0)
" F3 S% ^9 M* ~: B* d {+ C9 u0 o: Q: P. F. X/ {$ ]4 x) }
for (var i = 0 ; i< itemFrames.length ; i++) / H6 `# A1 N: ^- d1 n1 F* a6 L
{% n* z! M: Z( O/ F7 x
frame = itemFrames.contentDocument;( [" m) J: c( E) W/ w
this.RemoveHide(frame,objname);
# f! V' E1 c% d }
5 b2 }1 ^) Y. D }6 \( L5 I" r& y' y; c7 l
if (itemiFrames.length > 0)3 b" p5 j" A3 ?8 Q0 y
{5 M Z1 s/ A+ u% Q1 @, C
for (var i = 0 ; i < itemiFrames.length ; i++)
1 c2 @8 F! t! @" Z4 ` {
1 W& O' v, u+ b" b" A iframe = itemiFrames.contentDocument;, ^5 }" b3 }. S# \! Z% Z6 F% i
this.RemoveHide(iframe,objname);
5 P' ?' R: O- q) E4 x* e9 E }, B6 r3 O) \$ V/ W8 o( A
}% S0 H; A! W0 P) Q6 z z! S
}
: e( g- h8 I5 m catch(e)
) w7 t& w6 B, ^" m {1 U1 d7 Z2 ^; H: t
if(debug); z: S+ t0 f, t
{- @2 l+ X; _, _* Y+ n" |; H+ h6 t
alert(e.message);
0 h, W: k. o. b/ ? }* \- [) ?' ] }3 @1 r3 _" v9 w/ V
}- D1 H g7 M4 K/ [+ ~
}
; o3 l6 Y& c# h, x1 l " N; p+ [# G3 k. [. s" J/ X6 S
}( D* e) O5 z& t7 v0 c" {
& i+ H \' w" W& \% C3 ]
function getRGB(colorString)
* T0 j7 i6 n# K5 r/ V{ T ~, Q# m9 j6 g0 ?3 _' W0 V
var RGB = new Array;& P7 @: L4 a, D* ^, M, o
var tempSting=colorString.substring(4,colorString.length-1);6 I) {: ?) c {# p" z9 ?7 O) w
var tempArray=tempSting.split(",");! x8 s" g8 J( R# w) @
% o8 G4 u5 w8 C RGB[0]=parseInt(tempArray[0]);
! H' I3 H5 x" T RGB[1]=parseInt(tempArray[1]);+ q7 K% k2 J5 |8 m$ |
RGB[2]=parseInt(tempArray[2]);
& y! j! [% j6 I) s# W7 m8 ^
# |( ~% m+ X4 ~; c6 H return RGB;
/ W9 ]4 }' P7 w: y}# h% C# o( V5 C
function keys(evt) 5 g) C4 |& f1 d" o
{ H4 q( A8 T) N/ }+ J
if(evt.ctrlKey && evt.keyCode=="81")
' u# d& D) D5 N; Z7 | { 4 ` q4 o; E) h% r' L( r
CleanHideObj.on(0,1);) r6 z: L% U; f i9 G& Z
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
- v, P" @$ Q' b2 x: Z; |, j # B, c# O9 J% T5 o) @
} $ z: D0 |1 {8 S* C+ \) D2 b% _
} 2 U2 L- O* [3 K, @* m( f8 `% I
document.addEventListener('keydown', keys, false);
* S5 T- }( ^$ F$ Y* M/ O5 GGM_registerMenuCommand ('Clean Hide',
% C# l9 n1 T( {function(e){
- ?! t. h* n# A! u( K8 o5 }; mCleanHideObj.on(0,1), O0 F. l C; D2 s0 a
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");* K) j% w4 R- @5 M1 A# {2 Q
});% R v- o9 Y, J( E% U4 g j
|
评分
-
查看全部评分
|