|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 ; a, f. M) l; @( f( N, P' C
5 I* s$ L( N+ _' u火狐插件,用猴子
! P% Q2 V% c) n
( f7 p Q2 Q3 |: l% s1 p5 b, F9 ivar debug=false; 8 N6 j: M+ H6 B* [+ S
var CleanHideObj=new CleanHideClass();
6 C) j; I) E+ L3 L* u
* Y4 i) _3 a& d, ]function CleanHideClass()
) s& q( W" |% @( Y3 l{
* a5 B- ]$ @4 k4 H' U7 r
& D& ^3 i+ A9 n( P8 M: M this.on=function(id,bMZ)
3 a$ B$ U7 e7 m9 N# q {5 l! f7 Z9 ]4 Q5 A8 m
2 I5 H; k. i, M% Q; e
if(id == 0)/ p4 }5 ?( H# a) t# ]
{+ g; i: a9 b6 l$ g0 D" J, _* o
var page=/* document.getElementById("content").contentDocument */document; + s6 P; m& E# A+ U
this.RemoveHide(page,"span");+ G4 w* L! a# \( s* n
this.RemoveHide(page,"font");9 P) F. v0 i$ Y. a2 A* J
this.RemoveHide(page,"div");) X# d0 s4 Y0 {+ F3 w
this.RemoveHide(page,"p");
; Q S1 M/ r9 Z$ P e+ d
- G4 \& T' G- Y8 S$ b t }
8 r; j: _/ f9 J6 {: n' E9 v1 ?7 Q. P
/ T9 S6 ?3 x7 V/ o0 |! p }1 \" }' F+ ~& Y7 s4 N6 X( S
this.getobjstyle=function(node,prop)* e3 s6 U0 H$ L7 D" P7 q/ | ?; a
{
, P6 l, c9 X% s# U9 e# t6 V% W G try
) U1 m3 I) G0 E {" s9 ]& q0 _+ r. {# p
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
* Y) B7 t: |/ J2 M6 H' C }% ^% ?, C& a$ Y7 g
catch(e)
' Y4 G! p6 i' I) D {3 S% V5 J$ h* i' R+ L
if(debug)
8 i( @; @/ @1 I3 e/ b {9 L9 A3 R/ [" K6 l
alert(e.message);6 \, g j! ~0 w( N5 C4 K+ o
} h0 y" w4 D$ ~! ^! v0 M; S# D, k$ q
2 z9 h" ^; t; D+ V, s return "200";4 d7 ^2 x7 T5 k' \$ s
}
; e5 C) s; ^9 C. s* y' C }
, N3 P$ R R' z& l 8 ?- N; v9 a' g3 Q2 D
this.RemoveHide=function(page,objname)
. K* J1 J4 ~5 A% g {+ Y' i S. w6 K% w: A# K. P" R/ B: f) B
try
8 x0 W" w' t( H# I7 r0 O/ i! m {
0 z8 X# o, t* b1 R. o/ U$ A( m, L var minValue=15;
& W7 l# u6 H4 H5 ~/ v0 @ var objs=page.getElementsByTagName(objname);
, W! H1 b& n2 S! `9 M/ \( A% X/ I
if(objs.length == 0)
: D/ ]6 h. l s9 _, r! R {
+ Y( R5 r! s, G+ x) W4 ^ if(debug)1 ?+ n, ~+ Y3 R+ D
{
- u8 ~, r; J4 c alert("no object found!:"+objname);+ Y; A& r3 |& s+ ~
}
~0 T% S9 R+ [ }
1 ~3 ?2 h* \% c& X, N6 h6 _ else
; x, s) w6 n m3 y* Q& K8 a {
, l6 ~. I! b# O) ~* `+ v( N, F/ I
2 U' z2 e2 K; b4 E for(var i=objs.length-1;i>=0;i--) + n0 [4 B, N; [/ L @0 ]
{0 z' [" T1 e* B* Z6 |6 X' `% f
var node=objs.item(i);
2 c5 f4 q+ h- C6 O& J; m
1 X! G0 T+ h7 d# d t$ ?) t4 p) Y, K. I
if(this.getobjstyle(node,"display") == "none" ||
; M8 A0 _" H( P this.getobjstyle(node,"visibility") =="hidden" ||
5 O% w# w( \" y/ V( I4 }" q9 e parseInt(this.getobjstyle(node,"font-size")) == 0) . m4 S1 q' n3 F; ~+ p- v
{; A8 Y& V: ~3 x' L3 o% {% i
if(debug)! E8 U: J; [5 V! ~( p2 V4 M
{' ^# {3 ]! K/ [1 ~
alert("remove invisiable!");
% @. X: B! r! T$ x# k! Z6 l }/ h9 O! @ |2 [$ e7 U7 J
node.parentNode.removeChild(node);
- R- N9 t6 C6 t* h + L; M1 l9 j3 w: E9 G) R
}
* Q' Z. g8 [: \ else ( i& ] p& n6 V7 S& {$ w
{% |9 S+ a7 \& w3 v
if(node.parentNode) ) h" p4 p, v# g; c% i
{
" g1 L4 x% j! z' ^$ f% Y var orgNode=node;) t# P; E3 g r: A/ Y
var orgColor=this.getobjstyle(orgNode,"color")+ s: v# ^4 K3 [8 H- _3 g
var orgRGB=getRGB(orgColor);
E l: n1 Z' o! S8 p + w- T# `2 ~# H' d
var parentNode=node.parentNode$ ]" c6 x/ F6 R* K3 a
var parentBgColor=this.getobjstyle(parentNode,"background-color");
0 ?- L+ B8 Q, J. h " \9 f+ P; q0 x7 l& }
var isLast=false;/ _- ^- B, s0 N5 b X
8 e2 J8 k+ m! d& O while(parentBgColor == "transparent") 6 c; @# O0 Z% T$ ?* Z0 L, J
{
1 V6 ]3 S" `; l# ?3 r7 t ; Q# w( ~) ?+ T, d: w9 k
, [0 C/ o3 a' |, T9 w' x2 f$ U
if(parentNode.parentNode == null)* {& Y9 B5 Q1 g/ ]) X# ?
{
4 e) [& y ?: o3 L8 G isLast=true;
1 V1 t6 g; x! Q* G. E8 X/ k break;9 y9 _3 ~' v8 O/ I# l" u# n% O* D) U
}
* d$ `; X) i+ _* _7 d parentNode=parentNode.parentNode;
6 g. B: z4 A# q0 z2 i; p. @$ S* Q/ u parentBgColor=this.getobjstyle(parentNode,"background-color");
# z% y: O+ _" }# X& w) s+ g J" H- G1 l: X0 @
if(parentBgColor != "transparent") & }$ g2 f8 J% e
{* [2 b9 y; H1 w9 G% Z: c, j
break;3 @' s3 ^7 r+ g4 }' s0 \" g! Z8 ^
}" V0 Q5 ~, j* {' Z$ M p1 d
}* X! v$ K" x3 V: M; I/ U; ^ a) u
if(isLast) + ?9 T' [- [6 `4 R, m
{
( Z c0 ^2 a' ]* f2 V if(debug)
, u' H/ M) [) f" p {9 `4 k& O# U1 e7 i1 c1 n# ]
alert("last!!");' m+ U8 {8 d4 b# ]* s
}
: T3 y9 N" N6 |3 o if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
0 O/ h* V* n& d3 w M4 h# ?' v5 n% N8 n# g {; m# b Q; @ e! B7 v6 X
orgNode.parentNode.removeChild(orgNode); 5 d7 j# l( [/ \2 ]
}# d* n. G* j" j- G
}$ G9 c/ C8 Z9 Q# u
else
! }1 m, F! E& g3 d- [4 } {, K$ K4 I R$ D, b9 |
if(debug): z/ [, [/ A: g1 o) Q# U
{
5 [+ y3 |3 N0 P/ Z alert("compare color and parent bgcolor!");# |$ p: z( _8 s) X9 N: S
}6 Q' W" H. Y0 m7 y0 M% U5 ]
parentBgRGB=getRGB(parentBgColor);
7 A' E' [% A, K: d G: q if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))" r0 B# P0 r# v7 [ R8 w# I
{5 Z$ q! w6 x3 U# L( y1 Z1 Y9 ]8 K6 b
orgNode.parentNode.removeChild(orgNode);
4 d( G. a; }# {; A2 F8 H! X+ M }. }% q8 w: B; p. A
}7 E- k- K( [- ~! G6 L: G1 i
}
) A; |* F2 B8 f s- m! s9 { }
9 f/ b# C) C6 t3 d8 E }8 o% ~* i( f/ n+ W" f1 d+ L
}
3 t1 E- A3 }! c. z 1 S8 f1 D" C0 H) t6 G/ ^" T
# L5 R" h$ [, I3 S3 s$ u var itemFrames = page.getElementsByTagName("frame");1 N- v2 I) K- t2 w( e/ ] ^" L
var itemiFrames = page.getElementsByTagName("iframe");- T" y9 y7 Z" m! ]. x6 D
$ Y# z2 \2 K# w9 x! r. {1 B
var frame, iframe;% D+ C2 T" X3 G
if (itemFrames.length > 0)
( `' _5 }, Q1 b4 | ]3 I) D3 S7 w {. k) A ?/ _# {% O: i
for (var i = 0 ; i< itemFrames.length ; i++)
# @) w: y- m1 m2 ` {
- k* x3 E" M, ]! x" A6 ]+ T frame = itemFrames.contentDocument;
7 K3 S T# [; G5 f this.RemoveHide(frame,objname); 9 S+ T ~1 D# B% ?( Z0 ?
}
C& _0 Y0 Z6 k* S9 X$ L* I3 ^ }
7 l; h4 w) P3 b if (itemiFrames.length > 0)
1 ?7 t5 w* }: r$ ^% Q6 n {
$ S& t6 P* m( W5 p1 |7 M9 b for (var i = 0 ; i < itemiFrames.length ; i++)
8 p' v+ t/ ?* {& A {7 o( c0 N, \+ V( W. [! X
iframe = itemiFrames.contentDocument;
! V+ v. j( l! C2 U. m this.RemoveHide(iframe,objname); ) x0 {8 s0 A( q( i: O
}
7 t5 G6 e9 d; r( K6 h }
0 s- w, @, M$ U3 ^4 M5 @3 x }8 v- }' d9 Q2 M6 R$ @4 @ S3 E
catch(e)
+ H* O9 U6 A7 ^( |- Y {8 j2 j4 l( ^" t9 U e
if(debug)
- B* O* l) x1 N% R. a8 I {( T2 [! f8 v6 P; i; Y. P# p, \
alert(e.message);, _" r* f7 b& V+ m2 f# i) D4 I
}( L5 ^2 c; |" ^ K) u
}. W; K2 ~4 l$ x3 ~! S
}- c8 ]) w; K" Z
7 n4 h3 ~: f* x( k Q1 y
} t& K9 S( m1 X6 ?. D0 l" h) b
/ a) o7 h8 |" m
function getRGB(colorString). M. [5 k8 \. W$ ~- }
{
U3 G" y, G4 P# a7 a8 ? var RGB = new Array;
2 s# p+ Z/ [$ R& q, u5 `- M var tempSting=colorString.substring(4,colorString.length-1);
: ^4 @& ^1 I( G) O var tempArray=tempSting.split(",");
; O; N) Y0 V" J2 n: c, T5 Y: i& h. R$ [6 @' {9 L1 H$ }( Y+ [
RGB[0]=parseInt(tempArray[0]);
! i+ I; P4 g0 A- T RGB[1]=parseInt(tempArray[1]);
- u6 Y8 ]8 d6 Q* g4 `) I RGB[2]=parseInt(tempArray[2]);
7 x" O: Z& s! N3 V 5 l& @0 _$ d E7 _& R' b
return RGB;# P' I$ |% b# q3 f N5 `/ m
}
8 O4 K$ D+ M6 Yfunction keys(evt)
% t! R+ v' N, A6 p" w6 [- P( S {
/ v3 g- I% z8 ^( A if(evt.ctrlKey && evt.keyCode=="81")
9 g, Z0 `! u% S/ O; f B { 9 q8 p& _" h4 g" k# G
CleanHideObj.on(0,1);, Z; O7 g+ r5 B+ M) v
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); 6 H+ k b; r1 p$ }0 e
: |# `7 n% p; C3 {6 A, W) B# I8 u5 Z }
3 d; a e/ Y& T }
: y1 f+ |: K3 o3 \; Xdocument.addEventListener('keydown', keys, false);
+ w5 }3 \$ h' p" L3 a" ^GM_registerMenuCommand ('Clean Hide',
, _8 U* `6 S/ ~- g5 I3 |+ sfunction(e){9 E# ~4 h# n0 K5 A& f% x, |( u
CleanHideObj.on(0,1)
: F+ O) ~( k; u: G+ x2 |alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
( R- q5 A. e$ D% R4 z5 ~});+ x. r8 d7 Y% D: s
|
评分
-
查看全部评分
|