|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
, p8 _8 d3 ?+ X# b% {
% u1 _; E8 Z/ b火狐插件,用猴子4 m6 a7 M) M9 X. @0 F7 U. i+ k
0 c, @ H, Z; D" A2 m, \
var debug=false; 6 _9 b% w' W5 u
var CleanHideObj=new CleanHideClass();; _& O. {9 W# q, D, j4 f
7 ~/ N! a5 A) U& T. L* x( p8 J
function CleanHideClass() - V; s% P+ w: h, B
{
, |! E% k. W& g4 S
. V7 |9 \. n$ ^) Y. @2 z( s; ~4 e) s this.on=function(id,bMZ)! X, Q4 W) L, x' x6 G* X
{! R3 p O( N/ H1 [* @ r2 @7 h$ q
8 F! E( P( e) u: Z8 l$ W5 t0 y( w: N1 l if(id == 0)) @$ r% V7 C& e7 S: I5 H0 h
{
2 m/ L" U) Q4 {; | var page=/* document.getElementById("content").contentDocument */document; * H" b! w9 U% a. ]) }- L! H: F
this.RemoveHide(page,"span");
, W& V) I* M' d( v: J# Z3 e! A9 q this.RemoveHide(page,"font");
5 ]) c2 g& |) }3 L6 k. m* R this.RemoveHide(page,"div");
+ _5 w2 r! \% a% E this.RemoveHide(page,"p");
& O ]2 K. S8 }, U, a( j / e0 a2 T7 H7 G" u
}
6 N' ]2 c* n3 X/ A3 P3 | $ f9 ?7 L T- U0 l0 c3 D; W; |- a$ H
}5 x' @& [% M5 e2 D5 q1 ^; C& C
this.getobjstyle=function(node,prop)$ m2 Z+ v! e% N2 Q) D L- L% C
{, e0 N& {$ g2 S* g0 W
try4 w8 U; a# y1 C* Y
{2 E% `1 D+ j8 i5 k+ U
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);8 u0 I$ P' \% W. v7 _
} g( v) b9 k% y( u; q: R
catch(e)4 U* k1 u# F1 m* `
{* m; W9 ?. r7 B7 S0 W+ W
if(debug)6 v+ \9 V0 M$ j8 C# L# Q! R4 F5 F
{
" K$ s4 M8 e. m0 | g alert(e.message);
' I7 Y- X, G; f4 n! x8 M8 } }5 S0 L3 W; {. D
1 ?" L2 S I( N. a" W return "200";* ]. H) e" F$ G# a5 {" y: D9 T( t
}5 n" N) T d# f" C- A( o# }
}0 E' [( f- p, j0 y1 {( B4 Z2 [
9 d0 n2 a# W$ M! Q: R7 `, J" K this.RemoveHide=function(page,objname)
% q) Q6 X1 C0 g {5 M. a2 z2 C/ k, w
try' H6 }0 L/ q4 d- ]4 B" v w
{
+ D8 y" o1 B Y. J6 o' G+ c var minValue=15;
: d9 }9 K8 z5 A8 Y var objs=page.getElementsByTagName(objname); 8 ?5 V- k5 K+ r# S
1 q3 Z0 K$ p$ N6 b0 [8 i
if(objs.length == 0)
1 Y! a$ f" P9 Z( [3 K {
' X; P) A4 ?: \' i( q6 n if(debug)( L" c# L4 i0 C/ q2 ^
{
: ~) [+ u0 b m& p9 x1 c' g4 z6 l alert("no object found!:"+objname);/ W9 n/ i" q* v$ m7 w1 e
}0 \8 e: N' A# ]" u* @
}! G5 Q& w5 H6 f0 q
else
6 S. O; b9 `) E2 U1 q7 e0 m* K- W {5 z& P. g! F5 j9 }7 G
! m. O. b# y5 M9 {7 ~& m4 g for(var i=objs.length-1;i>=0;i--) * Q( k/ v9 V% Z. U
{4 S& N% \/ P7 c; O. X% z) l
var node=objs.item(i);
* \- A9 D( m! P# E. | % U/ x' D4 {: U2 _
) @7 h' W2 b. w h' l6 ^' c if(this.getobjstyle(node,"display") == "none" ||6 _, }" U% h, u' L7 x; j
this.getobjstyle(node,"visibility") =="hidden" ||( c1 @- o9 m/ k/ m& z" {1 L% s+ N
parseInt(this.getobjstyle(node,"font-size")) == 0) - [6 L" J% M7 S! \$ t3 q
{
K$ S$ Y4 r+ o if(debug)
& Y! M) N- G% N+ c {+ U1 P3 g( G4 N4 z3 T; N
alert("remove invisiable!");. S6 W* i7 d d
}
% V% v& o s% y; v \ node.parentNode.removeChild(node);
' r9 k/ _2 K Q+ o5 a) S $ u2 N T0 J) g
}5 A) R" ?0 O; H- ~9 N! M/ a5 D: W
else / H ?7 \" D, T7 f$ M4 S& p
{8 p0 m! u, T9 N6 B" D' X0 e
if(node.parentNode) , @( d+ a/ L7 S6 D2 g
{
0 O7 ~: a& S/ E6 b1 _8 t7 ` var orgNode=node;4 S0 X( _9 g8 q1 ` @. p
var orgColor=this.getobjstyle(orgNode,"color")
, w9 L! R6 s! u2 m& [ a var orgRGB=getRGB(orgColor); ! K5 M3 }' j+ v
8 s- M7 r- ?" s. G* ~4 M var parentNode=node.parentNode
1 I j1 {4 P6 }9 o a var parentBgColor=this.getobjstyle(parentNode,"background-color");
8 [- M% X3 y& k6 g7 q& `( l) _$ i
8 k6 @0 {: W. {" e, K3 n& W2 J. @ var isLast=false;
( B( V- k9 z' T [) k3 [ 1 \- v8 T0 ~) T9 ]- i' G3 D
while(parentBgColor == "transparent")
3 D6 c6 s- a: X( r% D! v {
8 l$ P! f; ? B' g. s y9 ? ' V9 w9 c4 a8 G1 n
( D+ T% h% P( r5 d if(parentNode.parentNode == null)
- m B4 c: e5 r5 N5 g7 i {* g0 s5 v5 T: a f- Q" Y1 A0 O
isLast=true;
. D+ j1 l+ e0 x- B" L+ F) m/ s break;+ h. {6 S* E% m$ v) S
}
: M2 q7 K( B: J4 S- { parentNode=parentNode.parentNode;
0 _3 Y" A1 ]! I1 H parentBgColor=this.getobjstyle(parentNode,"background-color");$ y$ ~6 m6 o" l( G" h" P
) t& n. H1 J/ m0 o9 l2 { if(parentBgColor != "transparent")
! M [; ^% v& L6 Y- M {
/ W+ h. E4 c& B, e | break;
, q" D2 ?3 N3 @- f# l4 a* F }
) J# ^, Q! L0 j% x; R: S3 Y }( M5 z: V0 _$ i% k9 v# Q, N
if(isLast)
3 {# U$ F8 R& M {
) O- X9 @) `* ^ E/ a* Q if(debug)) I* l& e6 ?0 p! l" ]2 X
{5 F2 B4 `) f" v# R, M( Z0 q
alert("last!!");2 d; y1 I3 W& D! l9 h
}1 r3 U0 E6 b9 \3 u/ u& `- p
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))2 B+ |- L3 [! f" U8 ^2 ]. t9 |
{
8 b5 A/ U' b) o orgNode.parentNode.removeChild(orgNode); + N6 y+ G; k/ O% A2 \) Y: ]
}
9 ]9 e) r# |- ~ } s4 I: Z$ X. e& D1 i. v
else, }8 k* N, }; t8 _
{
* e. D, _( N, L2 b1 d& e( D7 \+ R if(debug)' a+ W* q7 I& V- ^
{& I7 [6 h, k: \0 {4 u
alert("compare color and parent bgcolor!");/ ]: V# D+ W' | u) A( U6 x$ ?4 V& U" Z+ |
}
! y: t" W$ G7 c) ~. C# g parentBgRGB=getRGB(parentBgColor);
x/ Y p3 q- z7 P9 w if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
% Q' \4 Y9 C, d+ q9 Z! [ {4 b! B* g: H! i$ l/ Z! c
orgNode.parentNode.removeChild(orgNode);
7 \1 E% Q1 c, f4 H+ o# R# Y } g y# H( P* Z! k: `
}
4 t" |* u0 J7 t8 l7 W# B: z, Z8 U! H }
4 S5 Q- i( C% T9 u9 j8 \* V& f }; U- `. h% o$ V# I3 a+ u
}# j0 p' {: Y! S5 p, {) U( W
}
# a' e5 C ]/ x4 g5 a8 h/ P
" J( b/ q h9 e; f4 C- c, m
' [) G- [- N8 }$ O( W" ~# I3 B var itemFrames = page.getElementsByTagName("frame");
4 @& b6 Z6 x5 }2 t$ |2 i5 t var itemiFrames = page.getElementsByTagName("iframe");
: k' w0 k: C, F% H
) T! M. h1 F0 J" T var frame, iframe;
/ v9 @+ a/ Y( g/ r* |* Q1 d if (itemFrames.length > 0)
% ^8 j% k% B* [& e {2 T U, ~$ R$ |9 J5 U; ~4 ^: {
for (var i = 0 ; i< itemFrames.length ; i++) # b8 P7 M- @+ Z1 R( v
{( v+ B8 J' a w' M& }
frame = itemFrames.contentDocument;
: L4 F1 m6 t/ W4 P, B* X this.RemoveHide(frame,objname); 6 `, l6 `! T. C/ Y/ _5 k
}' R/ h' s. t& p8 K. h
}
9 L- C2 J: {6 b7 `; R$ b' @0 U* z if (itemiFrames.length > 0)
$ s( F7 g2 ^" l) d: C {
5 i s) s' B6 e/ z; M# j! M for (var i = 0 ; i < itemiFrames.length ; i++) ! f6 N o& j, K2 b0 o+ [7 w$ y
{
3 F# x! f3 F2 r9 D iframe = itemiFrames.contentDocument;$ @7 h6 G' H+ z# S3 E
this.RemoveHide(iframe,objname);
3 H0 M) s# W, x# B- a }' K5 N0 w3 r3 e* g1 U5 M% Z
}
- F) s6 u8 P0 j: Q9 H8 r }" u. U6 z1 t% ^% V3 j- q; S
catch(e), E$ Y g: w! O& q
{
! v6 Y6 y/ u; k' J if(debug), X" |2 _9 q0 L/ n# m8 m, l
{4 C5 t T2 M1 e$ |) K% l2 U
alert(e.message);7 p% E ]0 ]8 `
}
: |4 j" T4 h# \$ R }
4 |6 r! B4 h: a3 _, q }
; `4 |* H- h+ ^- P8 j
, S! a# z: T# O! j( p" \}9 J5 T9 v# E. ` B" u
# x" Q: _3 C0 v% M2 Z
function getRGB(colorString)8 \& l% ~( N5 F* A0 v
{
# ]( i f7 }) r9 ` @- O var RGB = new Array;
2 J3 c% s0 C+ q! j4 e2 I var tempSting=colorString.substring(4,colorString.length-1);3 k) o% d) n5 C. z( p3 v" t3 H
var tempArray=tempSting.split(",");1 Z0 F! e/ f6 N, h2 X
7 O) a7 w- B1 B* r7 c RGB[0]=parseInt(tempArray[0]);+ s: e+ | _. @3 _
RGB[1]=parseInt(tempArray[1]);
b& o8 {4 A& q9 h RGB[2]=parseInt(tempArray[2]);, F9 t: d5 }& h
! q5 _4 \! N) R$ a7 K+ K( f# u4 ]2 y
return RGB;
7 {; A: F: c0 h0 t& l}' l# Q- y6 d4 B; K g% k+ u
function keys(evt)
: [1 b- h8 }( C' U0 ?: w* u5 U { + V. r0 e% y6 y8 }1 i# `
if(evt.ctrlKey && evt.keyCode=="81") ! U7 @: ~7 L' q/ k
{ 4 Q* d- T G6 T. j: e; ?
CleanHideObj.on(0,1);
8 s& b% D' L/ T+ v alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
! g- H7 G. j; ~- Z1 Q4 A& B* f! @
" e: V9 o$ Q3 F! u6 J% H0 |# y }
, o: D4 C2 S/ g* B }
( E1 B" w0 M+ V! x% `! ddocument.addEventListener('keydown', keys, false); 8 v2 F `- R: |" j& f
GM_registerMenuCommand ('Clean Hide',
2 Q8 R( N! F4 G+ R+ W& T' Sfunction(e){6 P0 t' A7 Z0 E9 f# u h
CleanHideObj.on(0,1)
6 ]5 z, D7 J: V, L5 z4 ualert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
4 @- o& @- ^- m+ l5 Q# t* y5 j});% K# l2 ]# S8 B6 @2 @, l y( L
|
评分
-
查看全部评分
|