|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 : f) d7 Q: r' K/ y3 E
* l5 B: y( _+ ^+ S5 j$ @" r5 e火狐插件,用猴子& `+ J* J# ^; {8 R& G4 {
) w- f# o7 n; P4 Q2 Cvar debug=false; 4 B- F5 M4 U& Q% x' ~; Y: o
var CleanHideObj=new CleanHideClass();, g- v" O6 |: B7 }6 ^- o9 v
! L' b1 T8 i2 ?function CleanHideClass()
2 \' Q) d. D8 x9 I, Z# N{ , @3 F( |3 J3 P8 C0 m( Y# o
' _$ T1 Y! G# T4 ^
this.on=function(id,bMZ)3 T7 J! F! r2 s1 _) o
{
1 Z# ]7 ^5 v8 F1 C3 T- }: [, S9 A0 M' z + O4 A. o8 B- o g" A$ P* d
if(id == 0)$ E$ Z2 [6 s/ ?1 Q3 u
{/ S& x- z0 ?% y2 S, ]" ^0 K
var page=/* document.getElementById("content").contentDocument */document; / i0 a4 w, b6 X) b$ s
this.RemoveHide(page,"span");
V7 [1 d9 B( F; ] this.RemoveHide(page,"font");
4 e8 v) {) k1 a' r5 y$ h this.RemoveHide(page,"div");
% H$ T9 z- Y9 a8 z this.RemoveHide(page,"p");+ a3 M. D" n( H* A' }4 ^) ^, k
8 Q* A! N" y$ y9 y }
" r1 N6 Y* V: A7 {2 G
0 O5 L5 A2 ?/ s! D2 } }' C4 l% o% f R( ^/ ~) r
this.getobjstyle=function(node,prop)
5 l* u: l( \4 O- D6 Y9 u {
3 N4 v1 d" ?. O( G. M% Y+ [ try( I9 h1 i# m7 u' ~6 v% P. R F
{
$ G: G. \# u+ } return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
( x0 Z6 L2 Q. W& ]8 M% j, S, ` }' f5 k$ Z8 H5 K2 }) c
catch(e); Z9 Q1 q0 C+ M7 I$ j1 `& x
{* c) R* U6 ]* R$ }
if(debug)( R+ \$ |' h) `+ }: O: }3 n: p
{
2 w/ M. q! s! u3 r- r/ @ alert(e.message);
: i) r& {' `9 i% f }3 V' [, o$ z! U2 T- ^) U/ z
t# h% g7 S0 L return "200";2 w' q, j8 V0 _0 Z9 R, @' I
}
- h2 D# B& [" s* D }
+ D) h. m3 }, t5 ~- G1 _ % G3 \) C) R- J! S4 @
this.RemoveHide=function(page,objname)
! A/ D- N; p C$ U* |9 l# a {
7 E0 j3 |1 u6 Z3 T& K# ^+ {5 H$ D! v try
J7 X0 \# I$ I1 f {6 F: r+ U' t& S: q C& o( w# e. w. o
var minValue=15;
* `% \- z1 X( u1 w* h' A! J" O9 o" C var objs=page.getElementsByTagName(objname); + \& m; q5 G# W3 o4 c& D! R
; B L4 N, Y) G+ L$ s5 Z p5 a, G) n: x if(objs.length == 0) * Y' r4 k4 N5 f& ~1 G& N1 D: p
{
7 g% u5 q6 B( _. f% h; T' y9 L. Q, h1 R4 p if(debug)! h3 x- ]+ y' j3 R
{
( D. d8 f8 L) L C$ d( B3 e8 P alert("no object found!:"+objname);
1 @: v2 P, q) M, ~" g }
, A, s& o; P( |. C% f }
- i8 {! F7 p$ `. G' v else" f% p; p$ I$ a+ g* {9 u
{
@4 h. D7 J' e$ D7 M- c3 f6 } ! h" b- w0 Q8 K3 N3 E+ l' I
for(var i=objs.length-1;i>=0;i--)
* G% T6 g8 j# h2 I1 W' `6 g {& _1 I; ]( V8 X2 _4 \
var node=objs.item(i);
: ^$ a9 Y: J+ D6 P5 w
0 J, A% _% W+ i3 ~8 R
2 |; Y0 S' o5 X* `' l if(this.getobjstyle(node,"display") == "none" ||% n7 L8 E8 D# H8 a
this.getobjstyle(node,"visibility") =="hidden" ||+ ^ c/ E [* V
parseInt(this.getobjstyle(node,"font-size")) == 0)
( P# H- k7 j) S4 c' A4 _3 a2 I! P {
! l0 R! S! j$ W" x. ]& l2 ^ if(debug)
$ ~2 h9 p x9 i& t' q- [! B; Z { j" d8 i+ d, J( W) Q0 H9 c! V
alert("remove invisiable!");3 I0 D* H0 \. Y% l; B
}
+ D E* Y* P2 J; |; m0 V% @ l node.parentNode.removeChild(node);: n+ y" ~) E x" u
; m t" Q; m& q6 _/ r
}
: [+ |5 R2 Z; o- [' F- j& v: N else - d% b( @4 `. L3 U3 B. t4 y- P
{
2 g* r. x+ f) G' K! x9 F$ }2 Y if(node.parentNode) ; f0 l$ {) }& D2 }. u
{
8 d0 m7 {6 p: s8 c var orgNode=node;
) w% v1 O' b, I) Y' s# u var orgColor=this.getobjstyle(orgNode,"color")
3 q$ ~7 N% X y. s7 f0 g+ Z- G* c var orgRGB=getRGB(orgColor); 1 G3 n+ z0 k$ W P7 N! R! j4 b v
, G! f, X Y4 i: r/ z5 V$ r var parentNode=node.parentNode1 ?. J5 j0 p$ ?* y+ ^: {, j2 W! h
var parentBgColor=this.getobjstyle(parentNode,"background-color");
( n6 f) H5 |+ M8 u M# g0 ^7 T
* q4 x8 M- `% H, ]/ | var isLast=false;% w) Y% J( ?- j- a- r1 s
; B7 b6 Z, _4 i2 B J% h3 U Y
while(parentBgColor == "transparent") # B; n+ n+ W1 c+ J& W1 J
{4 A7 O& n" k- i3 q) J* ~
6 I& A' \! g O; O) C/ C$ @
2 J7 d/ i S2 T1 H+ K* U4 b2 ^3 Q if(parentNode.parentNode == null)/ B! o6 Z. {7 b" |
{# v6 _) M( J' B& Z2 h% Y. N# o0 ~
isLast=true;
' _% V8 C3 |# E3 G. } break;( H0 w# S9 H/ m# m# [1 w: B) Q
}/ a& k1 }& Q% |! N# e8 W8 Z0 q
parentNode=parentNode.parentNode;' I K! v) `. k
parentBgColor=this.getobjstyle(parentNode,"background-color");6 K! i, Q: h7 H) w, i* T, _
8 M8 q/ d! ~) C- r+ U7 H
if(parentBgColor != "transparent")
9 {! F' v7 z8 G! }( | {1 F6 c' N T% b/ K
break;
( s Y+ U9 m1 U! \( ~# \7 }8 S }7 o6 @& I5 J5 i2 X7 J' p! \
}0 {+ x5 T/ } ?3 d
if(isLast)
& A2 p* `! L2 n0 T {
4 Q! K0 M' k# D' t( A9 \ if(debug), x5 }% J' F* c3 ^$ g! T; h
{
" F) D; w9 Z! o6 d8 C$ n alert("last!!");9 V) a. ]/ H2 A: T' e) _1 x
}/ F: I9 n' H( ?' {$ T
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))4 B5 W( I. f3 c3 Y6 p( D6 W8 ~! t
{7 }. W$ o$ H3 \& F3 o* A& ?
orgNode.parentNode.removeChild(orgNode);
- F# @% T8 D) i }% F$ s, Y5 E) X `
}7 m' t8 i# o. p6 R9 y% X
else
0 Y. v+ u/ a" d. O {3 y2 N9 T2 D+ e0 ]
if(debug)
& ?$ ^' W$ N$ N; ]/ L1 x# N { l. b8 }5 y% I5 F: J
alert("compare color and parent bgcolor!"); n- ]; [! ^" e
}
- h7 N& H7 j# K: X parentBgRGB=getRGB(parentBgColor);. {: A2 |4 l4 F
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
( c* b: p+ l' Z8 h {
! d6 D- f9 W4 ?7 B4 ^ orgNode.parentNode.removeChild(orgNode);
4 G* @" s4 J8 _5 ]3 q }
+ v! j& i9 c+ V6 c0 i' `( W }
; U. u0 }/ s- }9 V }
7 Z; z4 P) |2 o4 }, B/ |' Q9 V4 `, ^ }
$ l/ ~% o. ]- U }
' r2 x/ y( F: U8 u0 f& S }$ o; }( I$ G9 n0 A
& l& s$ D3 y2 D% K+ K
! M$ L0 @" ]/ ` Q8 ~5 S7 a! Z0 s% } var itemFrames = page.getElementsByTagName("frame");6 s% _4 I; Q% W8 y1 m- |/ K
var itemiFrames = page.getElementsByTagName("iframe");5 m2 W1 l5 g! r; H0 Y
# D* ~6 t* A# m4 W0 e
var frame, iframe;$ J. j1 K* ^5 d) ^
if (itemFrames.length > 0)
! y# z* B" R w7 j3 B" j5 c8 q {2 \: Q6 I7 I4 D, j: Z! V
for (var i = 0 ; i< itemFrames.length ; i++) , ^3 c* A% F# v; U
{
/ P3 P. N# b: { frame = itemFrames.contentDocument;8 ^5 K9 b& R. z' e# g/ G! t
this.RemoveHide(frame,objname);
) Y1 Y x, j! l/ R" o }2 k7 T7 s- ]) z: P5 R( A# R n# F
}
; n j1 n, z, T2 A4 w$ |. b! c if (itemiFrames.length > 0)( B% @" T7 q: w9 ]7 u1 S
{1 x$ _% ?& r" ~9 ] G, _
for (var i = 0 ; i < itemiFrames.length ; i++) 8 F* u- U% V+ _7 z. s# ?+ t1 Q0 b
{
+ |7 r& Q P. {6 V/ ]+ g8 ` iframe = itemiFrames.contentDocument;
$ |/ ~$ Q* G2 u this.RemoveHide(iframe,objname); $ Z4 f7 L) a" t( a4 g
}
: U: ?$ ]8 M$ } }& {, g" n! R: |: U0 U3 e1 P
}
. ?$ h$ _) j6 l& a' n catch(e)
, c4 h8 z% K: b6 s. g {
) {: h1 [: y6 q$ e% S, Y9 v/ z if(debug)
, y& i0 C& z/ R7 {* S {
, A& Z- O3 k4 B. _) H5 r- ]7 q alert(e.message);: }; W1 b5 z N" Q" t2 [% L, D
}
+ ]$ }. g3 ]% Q5 s }
V# h' X4 R# \1 z7 I8 { }
' U1 y, h9 s+ w) }$ k5 o5 l
) G+ i2 S U8 {5 G5 w9 z& Q}- |: V5 A& O/ U9 Y& \
$ }' |0 j$ t0 ?! l: l: w
function getRGB(colorString)$ O$ I/ _/ e# ?
{2 `! J. ?" i! ^2 _; z$ v
var RGB = new Array;5 V3 I6 g) a6 z) m5 j
var tempSting=colorString.substring(4,colorString.length-1);0 W& c( I& j. H8 d. Q
var tempArray=tempSting.split(",");2 G k( j. [5 X% o
3 X, Y7 p2 L% H4 o9 S0 M- @0 X3 F RGB[0]=parseInt(tempArray[0]);
5 Y! Q4 |6 L9 l$ @9 y+ l' y RGB[1]=parseInt(tempArray[1]);, o' v+ B5 W+ z n/ g i
RGB[2]=parseInt(tempArray[2]);
' z# W1 U R9 _" q3 W
6 W" \# i+ X+ G+ H2 g: B3 f7 G4 Y return RGB;: v5 N9 d3 `+ x9 _9 g A3 x
}
; A% j' M( M! n' y. \2 T% ?. jfunction keys(evt)
2 @. z; S# C- u, t8 | {
* i2 W! t( L) [9 l" l if(evt.ctrlKey && evt.keyCode=="81") 7 x9 S5 r! D: y) A7 F8 B
{
5 y# V" _% p( O1 t% R: j" a CleanHideObj.on(0,1);
) l |; I0 A, t8 G$ S5 V) ^( S alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
% k- x; T& ]5 `' G& p8 |" v2 H
2 E+ a& x0 R/ p } 0 d3 S7 k/ s5 K9 m# k
}
2 ?- w+ f" s) S9 Adocument.addEventListener('keydown', keys, false); 3 Q( I/ x7 J/ Y& _# Y
GM_registerMenuCommand ('Clean Hide',( Y- \0 X& l" r8 H$ S* e4 y
function(e){
- c& r: D8 S4 A# a, s" mCleanHideObj.on(0,1)
- y4 H( V3 V. l5 [ J' ~alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");$ G1 M# U p& i! S
});" q8 K5 Y" Q6 ]. G) L
|
评分
-
查看全部评分
|