|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
$ s% Q( h$ K% P8 k H6 |! s T9 ^2 V
火狐插件,用猴子! C4 K8 s# g6 Q( R6 ?/ @. `
; p- v" b! r( [: ]3 hvar debug=false; s" O5 V: r! R- y' D' W9 m5 t4 c; w$ ~
var CleanHideObj=new CleanHideClass();
* n- {) u6 L$ U! J) m
- D; F- M# ^/ p& q& B: V% v# f/ Jfunction CleanHideClass() " x( X0 o( i9 r1 C9 p
{
, |$ A( U9 [2 h# Q. k- p$ B + s c C9 J( B3 |9 M
this.on=function(id,bMZ)# }/ k: o! C/ v2 D* S& V
{
6 e% `5 w A* O - P& A. g2 `. a
if(id == 0)/ C3 \/ u' ^& Y0 j, E; `1 A
{
5 l: h4 f! B) u% n5 N var page=/* document.getElementById("content").contentDocument */document; 3 o# l+ m1 D u0 e5 M7 I
this.RemoveHide(page,"span");
t: l- `& m5 e8 T x; e. l4 H this.RemoveHide(page,"font");
, r; E& Y( Z8 F0 h this.RemoveHide(page,"div");8 a% F- ]& ^& _9 H4 G( N* n" @9 D
this.RemoveHide(page,"p");8 {$ [5 R; g" T% X# `9 x. U2 a
. K5 M& T' e- ]% N. s
}
9 \% G. {4 }6 }# e( N, p# s 6 @) _( R/ w9 t/ M% X5 Q
}
% c- g" D5 r0 m" i: A: v this.getobjstyle=function(node,prop)4 J1 Z% ] Y: T% J! J
{
. G; J, h. P' `8 R5 l4 G try3 c! I* O0 j) v; l" X8 A: x
{
2 M& v- g/ I" u& g" i/ ~. W3 _ return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
" C& G+ e+ |2 N7 Z8 V1 i" i }& e$ m* l4 d9 y
catch(e)
' Y* O. N8 i) I: h, e {5 Q) P/ _! E, H$ g& s
if(debug)
! w$ X" t( s, L# @ {: D- u" d, ~: S+ h' W
alert(e.message);2 h4 j. C8 a2 T6 c( e+ C: t9 \
}
5 ]% E0 S: q% a F. p% P H ) S3 D1 u! k+ R7 x, h3 w9 a
return "200";4 {1 G) L8 R9 c/ |( I- S
}
, m1 I7 o$ v, n7 e) P }
& C! ~5 e. c' l: y+ l( z
! C, Y' ]4 n! M, P4 J this.RemoveHide=function(page,objname)
, p6 _" ]) o( \- J0 z; A7 A. D {. _) `6 V( X* u9 a
try
7 o7 `5 V# R8 ^) K {" m) K. x! m$ a3 D; C8 u9 Q2 p7 {
var minValue=15;
8 ~8 g/ w# H+ T3 W# x var objs=page.getElementsByTagName(objname);
r7 T+ h! R7 j; s/ L; H+ [* M) q, a- w
if(objs.length == 0) ]8 h+ T6 V3 c# N
{" x' P( b8 [2 t# G. X4 h
if(debug); w( a$ o! `: R3 R! G3 O& R
{
7 q" y4 o1 o: `' w alert("no object found!:"+objname);/ p3 ?( J4 ]8 e- m. L( p6 K( l
}
5 }& L) H, l) s. `* m Q! G1 F }
7 t5 A b; u) L0 Y9 Q: z } else9 y3 u2 u7 V7 ~* Q1 b
{' i/ w6 {9 B" p3 `
7 f" Y4 b# X$ B+ |7 z1 Z& H4 @
for(var i=objs.length-1;i>=0;i--)
! ~8 y. S; K6 Q0 r6 [! j {' J! i$ @. L; f4 j: x9 @: H( ]
var node=objs.item(i); - ?* b- J1 q+ w, t& u
$ M) R! r9 `) P1 K& l
" M( G5 S. A# e7 R* } j if(this.getobjstyle(node,"display") == "none" || }, G6 }; b% O# S9 o
this.getobjstyle(node,"visibility") =="hidden" ||
* y' }, t+ q5 M2 ~1 v6 H* B parseInt(this.getobjstyle(node,"font-size")) == 0) ! T- j- T4 Y- H& y# P& c+ `: M6 \/ Y
{
X& v5 ^2 r) }$ g! m4 _( ] if(debug)8 e+ u8 s h2 b& v1 c
{
2 Y. E4 t& x" N" C6 u* _+ b# _) d alert("remove invisiable!");/ \+ F( u1 n6 i* L9 U1 z$ j. Q
}9 I+ n. N- u# {
node.parentNode.removeChild(node);
' t7 v- L5 J4 x% Q3 k+ K( R2 b$ T
]0 W# T# @( \5 \( y* z } `) u9 b9 H- p5 c
else ; [1 e* w. }1 c
{& t$ h8 {, h" Z2 q8 h$ |3 y' F
if(node.parentNode) * ?9 c7 ]( }! _. V) G" _5 m% V+ x
{
: t. ~) l- L# M- ~ var orgNode=node;
+ O6 {2 j# u* b/ v D' R var orgColor=this.getobjstyle(orgNode,"color")
Q" |7 K0 V- d X" N var orgRGB=getRGB(orgColor); : Q( z- p% J3 `* U5 z% p) S
; I8 I7 U" L; W, ?0 v- ^* ` var parentNode=node.parentNode
; }: `* \& U: e5 p' I var parentBgColor=this.getobjstyle(parentNode,"background-color");9 R( _) |; ^0 r3 d, L- F* N/ ~) l
3 i$ B1 a ^8 l1 c var isLast=false;4 s( u5 H7 T! ]- m' [+ x0 c- v
8 {( k# ~1 c* ]- K
while(parentBgColor == "transparent") $ h5 |6 P' J7 \! }& k- E
{
9 e0 B" g5 G/ [" p
8 ]0 h% d+ ~. U: a; M; X3 [# }& Z ; y) a8 B; n, C$ S4 I$ c5 C
if(parentNode.parentNode == null)
7 v6 ^ [5 d, a$ d+ }2 v {8 L& f) o5 |9 s- x3 M0 I
isLast=true;. a" [ \7 D8 `% \/ O% m
break;/ V7 h2 R1 P' X- c% c7 s3 a' z Y
}# ^7 J2 N& _) j& u' G$ I* V) G
parentNode=parentNode.parentNode;3 d# H: ~1 O' K* S" V
parentBgColor=this.getobjstyle(parentNode,"background-color");. Z5 m* d5 G! N% s
! @! V( N+ r/ y/ r0 [ if(parentBgColor != "transparent") . X J. |8 \" U
{
; [% d! J Z; G6 O' ^/ `1 s break;2 ?. c' z. s! |/ P& P; B0 s1 C7 T
}
/ K7 _, w$ p P% p }* S0 M2 W! d# [ f/ V
if(isLast) 9 i8 z9 v* E/ s c$ S. u* a
{& P# a6 h' D- V. ~, L Y' l
if(debug), L. q! U5 m: [7 Z) L% g
{! O% j( Y g# z5 |% k$ Z' \& k9 }# A
alert("last!!");
7 K5 x. t. ]) X( [6 U+ k }' |6 r8 u3 J& I) W; S) i
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
2 K% E6 t2 Z5 B, ?7 g4 f6 T {
7 Z! B- w% r, F+ d+ s" M orgNode.parentNode.removeChild(orgNode); + d; F; Y) J1 P! W% o' R {
}
7 J8 ~: y& U; a* c, a }
1 T9 C/ |) T2 L0 t3 V else
2 m$ V6 C5 A: ^( S, X& M; t9 _ {
6 E/ B+ Z, o7 U if(debug)
2 _7 Z2 t3 W/ v1 {8 j {, l* }( _1 R4 C
alert("compare color and parent bgcolor!");5 B9 V- V) n- T- s8 o
}
3 w; \; q; ]+ C0 E/ B& c5 { parentBgRGB=getRGB(parentBgColor);( {/ r+ ~3 C" ^6 P0 @! O' K0 U
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
8 M( h/ O: p: ~ {& K) I5 Q1 v" i. R/ v
orgNode.parentNode.removeChild(orgNode);
9 B9 p9 k* Y( o ?7 i# o }. |. y3 S- I" L; Z# d8 X
}
1 X( i! C% U: V$ b0 y" @ }
3 S+ a5 c, I4 T/ Q C }
# d5 ^( f8 o/ R% a$ ? q: `1 d }; q7 v( B% F6 {
}
8 R* ]* l: n8 d1 f' a
+ h! p3 d3 p- a' f1 J : f p( a+ O, y4 \+ d+ @
var itemFrames = page.getElementsByTagName("frame");
7 d/ o' K( ?' w1 j; M( n var itemiFrames = page.getElementsByTagName("iframe");
0 J8 V7 [9 y# a- X
* Q* c8 }/ }. d: t% T; c var frame, iframe;, C8 a2 i6 F4 N" j: M+ a2 F0 a: z
if (itemFrames.length > 0)0 x2 T) L* {2 n( {
{
# s% r, o% D: i4 p6 a for (var i = 0 ; i< itemFrames.length ; i++) 9 B. |. V7 ~' k! p% I
{4 Q- L6 Y$ x3 k, K" `
frame = itemFrames.contentDocument;1 T8 n, y6 Z) l. W; s
this.RemoveHide(frame,objname);
- A6 w: M* _) \' W }- V9 j8 f S) b4 \* q& m
}- _3 f2 O5 [+ I1 {
if (itemiFrames.length > 0): j: l. Y0 ~8 e1 Q8 ?* b& h
{
2 b4 D1 `% y$ i7 u9 ^ for (var i = 0 ; i < itemiFrames.length ; i++) 0 a2 f' k+ B8 h% X$ Y# f
{
7 d) P3 I3 u: s0 |9 c iframe = itemiFrames.contentDocument;
1 U H- k$ b G2 Z) U; K( M this.RemoveHide(iframe,objname);
7 a$ c8 A9 g. p0 Z$ Z" q }& f" J1 X) h& \# g
}
8 t' O" f$ C! L; v: L* r2 _# f }
1 i+ I% e1 n% n1 y6 B* ` catch(e)4 y9 I9 C: g( z9 \. _
{' `/ |3 M9 ?' D% W" m
if(debug)# ?/ K: x4 s3 {8 a# t
{
/ D u. a3 L% j, Z$ Y0 p6 d1 D8 B% E alert(e.message);/ x1 B! S2 A$ C7 N2 x. F
}
# z. g) @4 N: u, D$ Y" x }
1 q+ d; j* G, h }9 P: @' l) H' w5 y
9 r! f- C, Q B2 w Q}0 g; p5 n+ S; y% q) L
' X9 P( d7 Q; a6 T* Zfunction getRGB(colorString)- W) o P3 U4 E6 d$ r0 j5 E% z
{$ F' ~4 j; `+ j0 ~1 ]
var RGB = new Array;
8 g7 R0 d+ ~: _) p" I var tempSting=colorString.substring(4,colorString.length-1);
% D' E; h2 J9 p# b( U: E+ I4 g var tempArray=tempSting.split(",");& F7 d6 v: r* z% u" J7 J" Z
8 K3 F0 J+ {. n3 |
RGB[0]=parseInt(tempArray[0]);
+ F1 ]8 C- ~# @ RGB[1]=parseInt(tempArray[1]);
. d) z( K5 |9 o: B RGB[2]=parseInt(tempArray[2]);8 Y8 C! m$ |6 H% x _$ W
8 [. P7 i$ {& {1 e. l return RGB;
# ~ S* R5 O/ l! y}
% t3 S! V3 K* Q( ]: Xfunction keys(evt)
5 K! n, n5 I- D: m) | {
3 g* I3 b0 _0 E3 x; \ if(evt.ctrlKey && evt.keyCode=="81") " K$ n2 C+ u: ?- O7 i# q
{
/ i& L) a8 I/ I1 { CleanHideObj.on(0,1);% v, M5 C6 ]/ d, |/ x9 M3 P4 U8 W
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); ) g: A$ x* M5 c/ R
6 d3 s1 A- ^" n' o
}
" }+ r4 ]% H( Y" I& H% l }
: o$ _4 B% w# j+ o6 b6 ~document.addEventListener('keydown', keys, false); 7 g) M( V5 N6 _5 E8 L( C) L# p
GM_registerMenuCommand ('Clean Hide',
% s1 R F1 W. { U# ~function(e){
( x% o* a- I# A6 h; X# g% \CleanHideObj.on(0,1)
5 y' x9 ^& |+ ?/ Galert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
* }- M! \3 ]6 h$ W});: c3 z. ^# f& W, a) `
|
评分
-
查看全部评分
|