|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 j" L7 E- L3 L' Y+ f4 O8 j
! u8 i* k: ] D4 ?+ ^
火狐插件,用猴子; g1 r, U3 Y0 ` h9 _
2 w2 N# j" H0 v$ d- lvar debug=false;
5 K3 y7 I# C0 C/ ~# R& }var CleanHideObj=new CleanHideClass();: X- T5 W/ ^" B' Z- C/ \
1 c' u0 r+ L S4 Cfunction CleanHideClass() & @; B9 g3 ^; G( n
{
. g' }/ V7 A9 q% C 6 V q" a7 {% n' ^# m
this.on=function(id,bMZ)
" T+ o) w& z; g( u( L {
" b. E$ F2 O* P3 R, _: N 8 x1 Z; ~6 T1 u) p
if(id == 0)
! f& J4 r5 A: ` {
5 W; S7 Y5 i+ N8 e3 B4 n* R# l" w2 P+ B var page=/* document.getElementById("content").contentDocument */document;
- }3 F. z+ X& [4 r, r1 p this.RemoveHide(page,"span");6 g! q; v1 |# W, q3 K7 n4 Q
this.RemoveHide(page,"font");
b/ m r) |0 a3 T3 ]3 C3 X this.RemoveHide(page,"div");0 U% S' T% C6 ] g' x- I
this.RemoveHide(page,"p");2 g5 d; Z, G6 x$ \% C1 J8 j' u
- H* i" { a8 L6 y) m( Q' v0 v
}0 X6 E8 m% H9 F1 ^7 e4 E; v
P' S3 z1 M' l }
( h h' T! Z) s; c* O this.getobjstyle=function(node,prop)
0 Y6 g( V- F3 ]# \" A4 K {
" K3 F; ^- I5 j; @: g try/ s/ r3 x* y4 ]- |/ j/ O$ }
{
9 X- W8 @, y7 @9 Z8 v5 P return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);7 P% j# x: Y7 H9 T' w& y
}5 d% t; [% `6 y$ @6 Q
catch(e)4 ~5 |9 k' H9 o7 x9 ]: R7 e
{2 _, o2 U/ }0 s* z: n4 F
if(debug)
$ N1 ~7 F- d0 n. _# }2 h G5 |- P {
% D/ G! W$ ]5 C8 h alert(e.message);
% o& Y, G$ O Q7 e0 O# ` }8 y1 Y7 C2 o- Z$ }# }" s
8 X- o3 T3 L/ `; }/ i; | X
return "200";* j& B, @. Z- l: B
}
[9 W' Y* P/ O1 [$ l }
( L {" x$ p' `! y# a( n5 w
: V# y7 G# z1 R. o this.RemoveHide=function(page,objname)
% s& L, T) P( A: z, o* P. `! X {) J: H5 z( c$ }2 m3 X
try* ]/ p( r$ A* \ e0 L" i+ V% v
{' I( N/ S; n8 w9 V4 Q- J
var minValue=15;) H( H4 s& o( d
var objs=page.getElementsByTagName(objname);
2 Y; X# d' z; Q! ?4 G- g9 d, n/ Z! R/ O4 v1 l4 y, Q
if(objs.length == 0)
! Q0 B* o! }5 b% j3 Z$ V {3 P1 K' ~8 K# J* R1 w% ]# ~. G7 Q# u4 a1 Q
if(debug)
( h& M. ]* I9 ~! s" H {
0 a, F3 e1 c5 x, C* q' [7 E4 L alert("no object found!:"+objname);2 k$ t( t- K9 t3 a
}# O( W$ u) L7 |8 Q
}
; G0 f/ Z' I2 x1 |0 R else
# e* {' A9 b1 F a' U* I {* }. O& Z, c1 X$ H# H
& Y( F$ j- B% E4 O P# V for(var i=objs.length-1;i>=0;i--) & H: ]% x5 z- Z, U' |
{# v+ _) i* H: o; H" W
var node=objs.item(i); S, i( E$ g7 g1 a# w
3 I: Q8 w4 b: P; {
8 C W+ A& D7 K1 y3 P0 ~7 d! e6 o
if(this.getobjstyle(node,"display") == "none" ||
$ t% }8 T s4 l; y8 o: r6 G/ m this.getobjstyle(node,"visibility") =="hidden" ||+ G% D* k6 V) _: |8 Y: J
parseInt(this.getobjstyle(node,"font-size")) == 0) , o1 j9 g; i# K0 I2 q6 p: ~
{9 J; J$ `7 f2 C1 W3 G. K
if(debug)
( J9 i* m, A) B {
1 Z. a5 D9 v0 }3 n) R- R2 a alert("remove invisiable!");# b3 L0 L- X+ c$ ]1 h2 n) k0 v
}
( Y8 \$ Q6 d Y9 v( Q node.parentNode.removeChild(node);
- N# z% v+ N+ W3 _3 x 8 B. v% `1 y( l
}+ [6 q5 ]1 y7 Y: Z/ y! w. ?. X
else
1 R [0 Y1 K( Q# i& o. v {
& k2 C# q' I5 i2 a if(node.parentNode)
) g$ k" f+ y2 _: I4 ]! A$ _2 j {
' H$ x, c; y+ G; ^) g) P/ ~ var orgNode=node;
+ m" F! \( O Q var orgColor=this.getobjstyle(orgNode,"color")
: ~5 }: g. g8 B var orgRGB=getRGB(orgColor);
! @; `- f2 L1 d8 V0 @5 J0 \ B
1 q) `* l4 A5 [# |+ a* B var parentNode=node.parentNode
! e' T$ n; b& E( H3 y var parentBgColor=this.getobjstyle(parentNode,"background-color");
" A" j' n* d4 | 3 N7 `! _- l3 ?6 s. v0 l
var isLast=false;5 O- ?+ V& ]) @; w
- r" m0 Y0 |$ A" k6 G while(parentBgColor == "transparent")
8 A0 U1 L( H: R {
+ n3 e8 F- D/ b" m; a ( Q; E5 e5 D& C! |
$ L" X) t l3 {1 G) o! W
if(parentNode.parentNode == null)
. M- Y0 S! _! H. }4 x3 Y {# T6 G5 U9 A- _9 |
isLast=true;0 k0 D6 W1 a7 B! R" |/ j+ j
break;
1 P9 j [$ @, [% M2 t- h }
$ i% m3 v: y0 g parentNode=parentNode.parentNode;# U. V% R# O2 ]* O) x2 C8 ^4 k
parentBgColor=this.getobjstyle(parentNode,"background-color");
9 J- p+ _6 d0 ~8 u- A8 v; J3 J& K. q, z* u1 L9 n6 D @! n8 ^
if(parentBgColor != "transparent") * ^2 T' [* b o5 ?9 \+ a$ J! w7 G
{6 T; _( Z P& |! c! Z
break;
o' |2 J3 P/ x% \7 f, p }3 ^) |* Q3 Y( Z
}, y5 j5 |$ ^, F% S4 o0 W
if(isLast) ! H) }1 o9 H( {# A V* C/ ]+ C/ Z
{
z/ A5 y! \6 z) Q, g if(debug). o/ P/ u% d! {" F/ W
{% `/ Q( N. q; Z& S8 R6 u& A; Y1 m
alert("last!!");
: ~5 R3 n$ v& n }
2 n2 u1 i. ^0 Q; j- c) z0 ]% }/ f if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))6 p, h& E q$ T. y( q1 I
{5 H- j: h( H2 J( D/ Q. a
orgNode.parentNode.removeChild(orgNode);
% K8 l- g( Y+ Q* S, c1 w }& T9 P, E" p" ^4 _! j3 p/ O
}
2 k' u) f9 R) n1 Y- V- ^9 n8 t a* Z else
# {3 H) C; E. s7 a1 ? {
& b1 s) K8 c/ |/ z& R if(debug)+ F. x& x5 |- n" `# y
{
; o( K1 I, a% R+ e% g alert("compare color and parent bgcolor!");. i" ~/ T( t7 |9 R% |( x
}
) Z. s1 h+ K) W1 s1 M! v6 {2 d/ K parentBgRGB=getRGB(parentBgColor);
9 H% F; Z- u, _ if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue)): z, N" c" A& d i
{
6 K; B9 h2 A9 x8 M# y0 t orgNode.parentNode.removeChild(orgNode); ! h0 u' p3 F& R6 t/ j7 e% D1 e( \
}
8 F' g; u: W8 I6 D# ~ }
! U8 v' A$ X5 e: m: J* N$ i }
, p" U* V3 i* T( p }
} D2 J1 j# E; Z. N2 R }
6 k3 n# o% }) h' |7 {* H( c8 l }, _1 x3 t; t- M3 D. l4 Y
! k+ T1 ^: F/ j9 J: h0 y% V% |" r! b 1 C& ]1 A9 ^$ X" y3 W
var itemFrames = page.getElementsByTagName("frame");
# U% g+ F, W( y var itemiFrames = page.getElementsByTagName("iframe");
0 ?, [! l1 A. M+ {
: f4 l( I5 n: ^+ ^ var frame, iframe;
1 o- U. Z3 m& A! [ if (itemFrames.length > 0)
) z! x4 D, ]) Q1 u {+ V& m6 z. @" n% |
for (var i = 0 ; i< itemFrames.length ; i++)
3 b# _* S8 `# @! ^) ~ {: i+ J( ^4 I& u# }) C8 m+ {
frame = itemFrames.contentDocument;7 H4 H' [) B+ G7 R1 s, H0 y
this.RemoveHide(frame,objname); 6 @+ S9 J# x. Y" Q0 U; t- s, c" @; {
}" [7 H8 N7 K, o' j: a w0 ?2 O
}' w8 \2 S t! u0 n- ^2 A
if (itemiFrames.length > 0)# j% k/ x6 J3 Y7 }
{6 g7 i( u1 z0 Y1 g
for (var i = 0 ; i < itemiFrames.length ; i++) ) d" J6 V b6 f" n
{/ R9 ^. C+ [7 L; X9 A! W
iframe = itemiFrames.contentDocument;
F. L' a, s! f7 s9 V this.RemoveHide(iframe,objname); & a6 E# X( o$ d1 Z6 V! ^; o" q/ B
}' c; G7 `8 A& E# F/ b
}; N U- ^% s1 A
}
x! X" o* ~* D9 V catch(e) O2 w3 V, k' p. V1 z! ?
{. g7 u; }" d! J) F; \' K
if(debug)
4 V. `6 i. b. T+ T- P {7 S3 g9 V8 Y0 m0 L( O$ n- J# \
alert(e.message);5 y3 t& z3 S8 \/ c
}
8 J+ b0 R& w4 X }
) Z1 t! n$ o8 S* |7 ^ }1 F( t3 e1 S( D) n6 J
# U+ h) _- ]6 _7 O7 H9 @
}
4 [/ y* x6 c9 t/ c2 @ Q7 a' ~ n
function getRGB(colorString)
, k( d1 X2 K! @5 h6 C& ]$ ^{. c: n) i' G0 d3 s; }1 |! M
var RGB = new Array;
6 f6 g: s# a3 [ var tempSting=colorString.substring(4,colorString.length-1);
) [; c0 s, p6 _1 ~ var tempArray=tempSting.split(",");3 Y$ w. W1 L9 v7 Q5 r
7 Q6 v% h$ U+ V9 \8 O+ L
RGB[0]=parseInt(tempArray[0]);
' L6 H# g, Z! ~ RGB[1]=parseInt(tempArray[1]);& {! c0 E7 t% u; E0 F6 q- }
RGB[2]=parseInt(tempArray[2]);
% f/ A6 }5 P/ O+ S Y2 z
5 f4 r. ]2 C! v. }1 |9 t2 G return RGB;/ E7 U8 X/ R+ Y2 I
}
1 E; ^; ~' v& _ qfunction keys(evt) 3 s4 o% u& ~, q9 w% V1 R
{ , H5 X$ }! q: y C) y: {2 M. O( J# H
if(evt.ctrlKey && evt.keyCode=="81") 8 s, }' c. ~+ T% v/ K) J. D2 w
{ ' H, s( i/ ~, l! d# T, V5 M4 V
CleanHideObj.on(0,1);6 d: \; F: ]; X; M, A7 c) u
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
% S$ U/ j& D4 Y$ @7 A9 s
/ n" h( y9 G. k } ' N* }9 F5 O5 i
} ! B% Q6 h- @5 W8 f# n9 h7 u8 `# `
document.addEventListener('keydown', keys, false); / Q! R, V2 ^0 z1 v; t9 }$ V
GM_registerMenuCommand ('Clean Hide',
: c* }$ x1 ~3 w2 z' Z0 [function(e){
" w" n+ {" G% U+ n. O1 kCleanHideObj.on(0,1)+ ^+ P. b1 B) u
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");* L- \- n+ J& H1 W% `
}); z# R! r) y! @# j# {
|
评分
-
查看全部评分
|