|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
8 m- h, U4 U2 K, j4 O& }
3 ~- N6 y" z( P+ K& B1 E; K+ {7 o火狐插件,用猴子
$ ]) V$ S1 S" s! T7 |/ i7 S0 w8 Y" V. W" O3 a* i t4 T) `+ w( X
var debug=false;
3 P/ U5 k6 ?2 q: V5 P/ B* ]var CleanHideObj=new CleanHideClass();
, @2 s, y, u! V0 e3 e- \+ q- t0 E# y) v% T, c- G0 W% j
function CleanHideClass()
! M. K1 U9 E: k$ R8 g- l% o{ - y; A! P; O, I5 l! x: _
9 z& C- @ B2 Y# s this.on=function(id,bMZ)
& o: `! v, Y5 | {
y( W4 E9 L6 v% D " B: |0 y& [# w% p9 k1 c
if(id == 0)
$ I! S* _( v5 ~& P# Y e4 h$ D {
c1 V' D" c+ K. N$ L3 L var page=/* document.getElementById("content").contentDocument */document; - |# J5 k, j! ?8 Q. x! q6 j8 p
this.RemoveHide(page,"span");5 E( ~) r- n# X4 y
this.RemoveHide(page,"font");
Q) H% X, z: k: A- i# T3 g this.RemoveHide(page,"div");) _3 a% q3 S, ]
this.RemoveHide(page,"p");2 X ]3 n! }& c/ W [. a6 O
- Q/ B: o: N( l; t7 b( F$ c }) p: k: V! R% C1 N# ^- y
?) `, ? V9 p }
/ t- m, L4 w# m, X( L& F6 ?6 C this.getobjstyle=function(node,prop)
9 |+ L/ Z `% u9 ?! r {- r% p7 H5 j0 d4 z/ T5 c G
try5 s# q0 s. _* X
{
0 ]7 J) L( _+ L8 Z return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
1 D, J* B) q1 ?: o% z+ @ }1 j0 B0 R+ V# N: }# }/ j
catch(e)
3 K4 r0 _2 w; c {4 S4 j+ l1 k9 M+ _7 ]+ }
if(debug)+ V8 ~' z: y' F
{
( j/ z, t3 _, d- d% Y3 W3 S alert(e.message);3 f8 l$ ~$ S% K; T( `4 A
}
0 Q" v& ]$ Z* l" l7 B 3 e' M0 _( V, `" g! s5 B, a
return "200";
) {8 \1 I+ Y( ~ }
5 D8 f& }2 q% U) {) j: Z9 w, e }
* J, r" @5 x0 }( S) K6 X
7 H0 A( U Q: Z. j4 _ this.RemoveHide=function(page,objname)
! ?. o! j7 D5 F( g2 w$ L {* @0 S4 U+ Z9 x6 F% }
try
) E7 u6 C4 Z" a$ T! M. H p {0 I; p0 r* F$ Z
var minValue=15;: x- ~5 l; a; P% G; n+ f8 k0 Q( u
var objs=page.getElementsByTagName(objname);
1 Q1 a# Z& D7 D: J' A* f) N: t j/ `& D9 k! P' b% c% k
if(objs.length == 0)
7 t& {, K5 @! F( s0 V5 @% r {: ~' Z; Z5 U; S6 l2 y5 y7 E
if(debug)
( l1 A0 I: M' U% V; _% l; M. F {
6 r' `9 u' @8 }$ k, S alert("no object found!:"+objname);
; R1 \+ d7 m) X; S5 l) D- n; D' C }9 J" H/ j$ \; Z+ }0 M/ E% t
}% a4 a% r& w, i+ B, }# Z+ m o
else2 }# k! ~( b0 F9 f
{
% k+ r3 A7 b1 L8 t
, L: Q! F& X* o% Z. o0 y2 l3 t for(var i=objs.length-1;i>=0;i--)
& x- `' ]' T: O, T {+ }4 ?% ]/ G3 X. w
var node=objs.item(i); 3 L" y( p( I' D# L
/ j* f, _* g& u
) W. T# ^- C* v if(this.getobjstyle(node,"display") == "none" || t# H/ k) m! Z$ N
this.getobjstyle(node,"visibility") =="hidden" ||. M: y7 O7 k; ]
parseInt(this.getobjstyle(node,"font-size")) == 0) 4 ]' `; _' \! w8 T0 Q
{+ n# U) U/ R4 K0 o4 Q
if(debug), u7 t5 ^; g8 T H9 M
{7 q. r- ^" N9 a( Y5 s* o
alert("remove invisiable!");! @2 F4 r4 i( h3 R% o+ \
}. g; c7 X9 | L S# L$ U1 g
node.parentNode.removeChild(node);% k9 g3 R, W& n( m5 h& E& _" k- ?
7 I0 m8 T& ]. K0 r" U }
1 _8 @) O6 D8 }# L" `+ W/ p S else 2 n1 j3 g4 f% u" a& F
{! {* F, K2 ^8 N/ [/ n" s) O
if(node.parentNode)
' i9 [2 q+ R; Y {
: ^4 u l' U; g9 I; C9 r$ G. C var orgNode=node;
) G; @( M! D9 t4 u2 Q2 U& e. ` var orgColor=this.getobjstyle(orgNode,"color")
- r X+ {: R7 D/ k' r; L' E- m: K var orgRGB=getRGB(orgColor); * V: i7 e: p! f3 s7 g
- F# c E: Q7 Z1 p3 h& q" e
var parentNode=node.parentNode, I. x. `5 W- G2 s* a$ o, b
var parentBgColor=this.getobjstyle(parentNode,"background-color");
/ @' U: h% {/ u& A, U1 A& E c' O# [6 O7 ?9 d3 H, j
var isLast=false;! u" f) W& L# }/ r! T( G- C
$ e; y$ V$ D* K1 Y' u% @
while(parentBgColor == "transparent")
& z. N* N0 Q- Y" Y% Q7 t {9 L2 d9 a. L3 v
! {- [& U4 h0 u
3 f2 S+ c, q# B/ }- q if(parentNode.parentNode == null)$ s, S9 h7 f* C! g5 p
{( @$ |* B2 \4 ]
isLast=true;- i% h- g7 ~/ t _5 E! ^% x
break; ~1 p8 t9 B8 |/ k0 ^- Q: O' M# o
}
2 \$ R/ X: e t9 {6 Y& `% ~ parentNode=parentNode.parentNode;
$ q) d9 `4 e5 p1 N- e% c parentBgColor=this.getobjstyle(parentNode,"background-color");
" ` m+ [# @+ b8 o$ p1 |& B" N
: ?5 f! q9 H0 w. X" {; ?% H if(parentBgColor != "transparent")
3 o& |' ]6 r: A9 s1 x$ p {, T: t; R5 D$ T# v' \
break;
' g5 V5 g) B! _. `; v }
' l" D6 ?; g3 T5 f( P' h }; p, M6 M* B$ D9 z2 R
if(isLast) / J% H( {0 K: \' `( A8 y& k, g$ n
{
& T. P) ?: g& d6 p( p if(debug)
8 b* F/ S1 S H% Y {. J2 O3 B& I g' ]! N; p
alert("last!!");
6 ?6 j2 P6 }1 E: Z } [4 O9 Z- B4 M) z0 W5 A
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))! Q. O" K$ P# f! x) i
{; p' A. Z0 c( W! ?* h" D6 n! W
orgNode.parentNode.removeChild(orgNode);
! c9 ?& B1 p7 Q) ^ }
3 x6 ~! \6 q& w0 d }
2 A3 m$ \" s% O else
* W( K9 [- X2 H! ~/ x, y {" [ t5 k( [8 w* y
if(debug)
; U' s* D0 i1 S! M" V1 l {5 t% f; t* Z, C+ {$ m
alert("compare color and parent bgcolor!");1 U, J9 t2 w6 b9 R2 w
}
) s! U1 z4 c5 h$ T& m parentBgRGB=getRGB(parentBgColor);( v4 a" c; Z' C
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue)). c6 ^8 G. X) M# u# Z! e
{6 m8 C0 y8 ^8 t0 ^
orgNode.parentNode.removeChild(orgNode);
& W" u/ R J. A9 E: y8 k s6 E }, T1 G7 |% l( y+ S8 z
}* b L4 K! n* v1 _( G! W8 d: Q) D
}
. m3 H9 A. r" _: m }& A9 Z. F1 c9 f* l" g
}7 U4 V+ ?2 h# H o
}
( V" m. d9 Q" \+ b/ d 3 ~, }( n" s6 `
9 r$ ^) Q. ^% s& k& m$ {8 k. A var itemFrames = page.getElementsByTagName("frame");- x) j. _6 L5 H- z' L
var itemiFrames = page.getElementsByTagName("iframe");0 K" B4 l2 G+ J% ?
* h- b/ e7 r: s5 c# Y( O- H
var frame, iframe;
( j* m( b y" ?' V1 S% { if (itemFrames.length > 0)
6 ?# w& r; D+ J {0 O2 r( I" V' ^
for (var i = 0 ; i< itemFrames.length ; i++)
) g N" E" e9 |! x) {% Y {
# e8 N6 G1 j% O( P5 c frame = itemFrames.contentDocument;3 y _; e; S0 ]# O" Y
this.RemoveHide(frame,objname);
4 G) p+ B$ a( [1 Z2 O4 M }
! O1 p) l' I" L( _* B& | }
d7 S r' c2 Z7 g1 g if (itemiFrames.length > 0)
+ W, M* a% P5 W% C: l$ G' | {
8 t4 `; u5 O) S2 n# R for (var i = 0 ; i < itemiFrames.length ; i++)
7 o: ~1 {# `" N$ B {
% i3 p4 A4 M1 e/ R7 H iframe = itemiFrames.contentDocument;* F8 V& e: P$ K: r* z5 E
this.RemoveHide(iframe,objname);
s! f. R4 `9 N, ? G: O. J }2 X6 F/ i2 Q: j# W8 n2 P/ D0 [
}4 @$ g& g9 S x/ z. M$ p( v
}( M0 Q4 l, n% E$ W D9 z. {
catch(e)! _" x2 V+ w5 M$ W& b% q; Q
{8 s7 b; _5 T2 }5 m* l0 J
if(debug)
9 X, |* ^- d8 e0 Z! l# j {
5 O; J$ N5 Z; M9 E, ] alert(e.message);. R" u( L5 S5 x8 p: t% ^
}
2 X$ U( U: b9 @& C- g# @8 [ }: K- c3 M7 s5 Z& d% H3 P
}/ G4 X% O7 R) I' x g4 f& Q
# a! |$ P7 U& @" ]8 m. p
}
7 W! g( W+ Q6 v; K
7 p- [5 q W9 V1 Xfunction getRGB(colorString)6 J7 e' ], s+ R5 T" ?0 ~
{
' G& P C( H0 n6 ]* G- ^ var RGB = new Array;! y$ L7 V2 e- S4 b) w) e) U
var tempSting=colorString.substring(4,colorString.length-1);
/ t7 d4 p3 K* g; t& @ var tempArray=tempSting.split(",");% Y8 n' y; F: G
$ p6 s7 d5 p3 l @% E
RGB[0]=parseInt(tempArray[0]);" c6 x$ K8 z8 R* ^ x
RGB[1]=parseInt(tempArray[1]);% s8 N, m% X$ ]+ F* h9 q5 u
RGB[2]=parseInt(tempArray[2]);: P9 E8 B; g# Y4 V1 u9 e; _
: O! r# }4 ~4 m0 u' h k
return RGB;) g9 K1 w7 G3 e0 i% q
}
+ m0 N. K" ]: N' tfunction keys(evt)
# P5 n# A9 M, h( l6 P {
0 J2 K6 a5 d7 c/ n8 X: J if(evt.ctrlKey && evt.keyCode=="81") . Q& C% P( N" ?2 d' u& ?) p
{
2 h6 i9 @8 n8 O! Z2 t9 m CleanHideObj.on(0,1);
3 D3 ]' \: } l! e8 D alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
9 c; O( P4 r J2 S: \ Z7 S3 j
, h+ ?4 j5 _5 A } : P$ j6 j* a5 `2 ` V
} 6 ?, F0 A8 t% s
document.addEventListener('keydown', keys, false); , h1 y* d: U8 E; I$ n
GM_registerMenuCommand ('Clean Hide',
" p5 q) \$ F+ c2 V) i. [& t- rfunction(e){
4 t! x. H5 {& k, [CleanHideObj.on(0,1)- t! w& A2 [) @
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
4 x7 I& W% \, \, K});$ F2 o5 r( B+ ~" R8 E
|
评分
-
查看全部评分
|