|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 $ w" M1 i! l z, q, s
) D# i* p. k$ I6 ]$ w火狐插件,用猴子
, X8 u' |4 f( x! R2 W% m+ m" L1 T2 W
( Q' k( J3 j0 W+ ?" d) Bvar debug=false; ( V, o+ b! I* Y: b+ O5 ~1 m
var CleanHideObj=new CleanHideClass();
$ J4 D1 i& s% f2 J6 t% g& i3 c. N' d0 X
. W% l( }" \/ _6 m4 Pfunction CleanHideClass() " D' s+ p Z: n5 E2 H/ N8 P1 b1 f
{ - I$ Q" ^1 z. w" V; n; {7 Q7 j$ X
' S- T$ l0 n: S, v
this.on=function(id,bMZ)
; j) p5 R( x2 `% a# R {
; c6 h T7 h2 v$ p7 P; U; S8 A: O / m+ \3 s5 `1 ?( ^5 c
if(id == 0); F; K H6 U/ n4 U) ~3 |9 w- s0 B
{# n" P4 d) B B- d9 G% u* t/ }
var page=/* document.getElementById("content").contentDocument */document; - a' G: z/ {8 P, M, n
this.RemoveHide(page,"span");% W0 T+ N3 J+ ?) g
this.RemoveHide(page,"font");0 `3 b1 T; v0 ]: b+ H; I$ G
this.RemoveHide(page,"div");; z% ]7 v; K" b3 z b# K i
this.RemoveHide(page,"p");
, a6 W: V! y$ D- } 1 d! t% u2 I4 |0 M- Y! F6 Z& B k0 t
}
; @9 j" V- F. n, t+ C" W
1 [, u$ u& I! o' ?$ G# L K }( k: N( K- _: |( f! T
this.getobjstyle=function(node,prop)0 m' Q( t& z5 Y) y+ e
{2 x0 S0 Y/ |3 m& `
try
5 d* a$ i& ~, f" e6 e {
8 q+ s9 e9 H* E) k3 `0 ]& ^9 R return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);- p* E+ z8 t, Y
}) H3 K: x" M- T2 P' ]) M) e3 @
catch(e)6 o8 a+ c( j* s1 V& l5 e
{
) ]0 ]2 n2 U3 [% h6 z, ~ if(debug)7 h* q/ V( [% Z$ z
{
( b' d9 I! R7 `6 ?: K alert(e.message);0 r5 c! g! g3 K* E1 [% r9 t5 ]5 B
}! P0 S9 o0 D5 }; g
* U6 J! W- s3 e9 _
return "200";3 c$ V" f' e2 c" i" A& z6 B% s( _
}
6 N+ [, R) {6 P% k, e+ A$ @6 o. I @; Y }
: R' E' \* V6 g5 E8 u% r! F# s3 o
+ |7 n' c; G W$ ]+ ]8 h/ \ this.RemoveHide=function(page,objname)# u! e+ O+ X: ?
{
+ r' q' \2 |( Y: r! n! f try
' g A; l* o$ W- A {
/ C4 J1 A0 |9 K% U6 r- j2 m8 U var minValue=15;
9 s0 P R$ \( g' ` var objs=page.getElementsByTagName(objname); + m5 z$ `: R0 _% K- p! a. g. H
$ m r0 | \" D |! B- Z _
if(objs.length == 0) 2 B8 I! b/ q- T& s, b
{7 X7 O7 `9 D$ ?: G/ c) Q
if(debug)
) k( I5 W2 `1 I {
/ N$ {3 p @* p8 {# | alert("no object found!:"+objname);
+ a) e& w- L2 [ }4 X% Y7 A; ]) D# s4 s: ?2 D+ X: _ Q. j
}
0 q2 J* R+ s, s+ _+ Z1 A' L else
& p/ z8 _2 x$ N3 s" q {2 R9 Y) R* x+ g% `; O/ R8 M
: a( W, [+ x! H, i* \! _( X
for(var i=objs.length-1;i>=0;i--)
7 r2 D _( Q6 {* y/ }+ z( ]& k {
2 d2 ^" X" A3 V3 ` var node=objs.item(i);
- ~+ }( G3 x4 l" {% O
+ g$ f; n* I; @3 a3 [+ J( h3 J $ T" u; d5 z/ n# g" Y; ]# L) L
if(this.getobjstyle(node,"display") == "none" ||
4 g, u& f2 H6 e! O5 ]* F2 X9 g this.getobjstyle(node,"visibility") =="hidden" ||
8 L& `$ u& G$ _8 H4 X parseInt(this.getobjstyle(node,"font-size")) == 0) ; ~1 a4 y2 b+ N4 P
{* \' w: P% h/ T ^. B: h
if(debug)# d4 h( }# d& G9 z+ P
{ ?- r% _+ U- X! @
alert("remove invisiable!");& |' _3 ]' l- A
}
: u: \" d) y* h6 I5 f' G/ v node.parentNode.removeChild(node);
4 d, S& h( v, I+ a" }0 I i* K ( m5 b. s( c% ?: w' F: @: `
}
) y* }% X" }' p else # S2 o; L5 N; V
{2 m0 o# t$ ]) z) s0 I1 x
if(node.parentNode)
; F* { t# V0 D- U% W {. E( E% K+ s) @- M8 y5 I
var orgNode=node;$ \' k: M& f& [* t: |0 ^+ T" b; I
var orgColor=this.getobjstyle(orgNode,"color")
8 \) V' W |8 E9 w7 R var orgRGB=getRGB(orgColor); ' e: @/ v0 I3 g! M2 I
/ l* @! A3 D4 f3 I% t( m
var parentNode=node.parentNode
: x0 j! c/ z* K- i var parentBgColor=this.getobjstyle(parentNode,"background-color");
0 h H* | @# i" B2 R# _% |9 I 5 C9 l$ d# t& x5 f2 F9 n* G3 x
var isLast=false;/ N/ U" f2 I. d
! }; u5 O1 E! q8 H4 L/ ~
while(parentBgColor == "transparent")
+ c% u# g' g7 g: Y& G. g {( t. R* `% j7 M2 d7 R- w- p! B; A
7 e/ w- z+ x! t( C. X
- @/ l0 R+ ?9 o* I if(parentNode.parentNode == null)) v G0 v$ s% n3 i" r4 ~ ?) h
{
9 g( c4 V- k) M. y6 K isLast=true;
. s+ }' t! x4 u+ L3 ?. U6 v% |5 | break;
* x E9 {- Y$ U5 {5 O& u" s }
( u" E! S: ]& I% ?, h" b; s) F parentNode=parentNode.parentNode;
( W2 _$ b) z, e" ? parentBgColor=this.getobjstyle(parentNode,"background-color");
$ `% `+ p7 H/ S) u, ?2 B
1 Z7 ?. t$ N. N* }0 A if(parentBgColor != "transparent")
- v! b! E- x. I7 g) [, `7 @ {
/ ^, S, k+ {& I- x8 y8 J U break;
2 N; D5 _! k$ G }! `$ Q# a* }. Q* D) v3 o
}3 G+ r: p+ J- W2 d! o; f3 Y
if(isLast)
- J ]/ d% O5 x# e, L+ A1 u: s3 u8 V {3 F5 P' p( R5 `3 h0 L/ b7 V" N
if(debug)
0 D- J( A% s U- l: S {
, E" b" u5 K8 N( a2 u6 l/ j8 p3 z; W alert("last!!");
0 p* _. ~6 G7 X& k4 D }5 ?$ F( q& i5 f7 j+ A
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
/ r# ?& X+ N" `$ Z( Y* q {! o. X. l1 ]4 t8 x3 m
orgNode.parentNode.removeChild(orgNode);
/ O' L+ t$ H1 F: L/ q) K3 y3 ~ }8 b& X+ i0 s2 V: U! W
}
* d& ]% U/ z+ o0 G" R. b5 c0 n {; B else
% X7 I8 j6 [2 b8 B {
L- ~1 r' X4 z5 M! Q1 Y% j if(debug)$ w( J) M8 M; T
{7 k Z2 Q9 q* G2 j9 Y) O8 [
alert("compare color and parent bgcolor!");
. K- F n2 m5 M( U4 T }# ~9 B( C" ]+ A: j0 P& A
parentBgRGB=getRGB(parentBgColor);
$ S4 ]8 S. a+ Z) I$ Y4 r v, X# A* _ if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue)); w: c9 Q) O' y6 T
{
) Y1 E l3 P5 {- z orgNode.parentNode.removeChild(orgNode);
$ e0 k* _* R( I9 o }6 Z1 N y/ P& s- n" l
}$ w! E* n. y! p& p- ^9 x2 E! L5 C& @
}
1 |- ^/ t* Y+ k7 S }1 `" O9 G. u4 S0 A
}
- o& s1 @- H) F; h6 _; I' a }
4 }: w& X | r# Y% B6 G I3 u! B3 K
c* y* e b( V& h; A % b) Q) C/ X( s4 H0 x
var itemFrames = page.getElementsByTagName("frame");3 \- D$ c+ B- F+ V, o7 L# m6 D
var itemiFrames = page.getElementsByTagName("iframe");
5 ~( ~0 ?8 i h8 m2 F; q) w( [% i
& z1 l3 {8 G( s: l! M$ h) w$ H1 z- k var frame, iframe;& u% k' X$ t! n7 D: W! q" w& m
if (itemFrames.length > 0)
9 q5 A e# R5 p E8 R {, U( ?0 O8 H( H7 E. ^# e
for (var i = 0 ; i< itemFrames.length ; i++)
- P! j4 k. Z9 x* c& F9 F$ V2 l {
% S2 h5 [6 J# v1 w& _; d6 L2 i9 Z; w frame = itemFrames.contentDocument;3 U3 f0 V) E5 ~# m; X2 p
this.RemoveHide(frame,objname);
7 j& Q; P7 W1 r1 H G( Y/ x }
% o3 ^+ c% I$ I3 n: x }, [; H, b1 i+ [* [ p! j( ]4 |4 a
if (itemiFrames.length > 0)
! R2 i; O' V( J. P {1 @. S7 R9 t6 T, ? {
for (var i = 0 ; i < itemiFrames.length ; i++)
7 @( V# s3 X4 b3 a P# ?/ t {& h: b( g W" u; ]) Q" v, [1 E
iframe = itemiFrames.contentDocument;# X* H3 d0 @1 u' k( e h7 r
this.RemoveHide(iframe,objname);
0 f3 O k& B! ~* t% Y* g }
+ _( M7 d; |% a, I4 ] o$ e/ Z }
; \" g$ i& n6 S# v! t0 U7 B3 ?" \; Y }5 W/ ^5 s/ h( I+ q" H
catch(e)5 R' k' r1 _$ r/ h! }
{: O5 s- y9 ^; h( d9 R( l5 B
if(debug)9 _. P% J6 D$ \2 I2 n( B! ?
{
' j) W( g" L7 q alert(e.message);
3 }; Y" _+ S0 S* i0 T* r; w, N }
$ C) H1 x1 S( p( T1 @ }
' s! v, v1 d: |2 | }
* y m$ C) i$ n$ p$ H1 r# o \- B) b* T7 y1 H I
}
- p" _3 J- u4 C. M: {& K% K' p& q0 h* n3 ^4 b# }, v& G/ W
function getRGB(colorString)( Q. U2 m6 R7 H; R% d
{
6 I2 y. M4 L7 I1 m1 k1 M3 N var RGB = new Array;! Y# N$ H/ K% v r
var tempSting=colorString.substring(4,colorString.length-1);
7 P9 H& S9 Z$ d# r5 Z var tempArray=tempSting.split(",");7 S' d0 f' L# u( { v
8 l4 d: `4 N0 p4 ^ RGB[0]=parseInt(tempArray[0]);. q% ~0 Q3 {! u) I6 B. g4 ]. n. G
RGB[1]=parseInt(tempArray[1]);
( J# ^' T( x; T3 I RGB[2]=parseInt(tempArray[2]);; ]* s, A) l0 p" Q' ^
3 X& f+ \8 e* ]: r return RGB;% E r; I$ p) t( a# t/ {
}6 k% U0 _7 h. k2 @9 |7 X! W
function keys(evt)
; D4 L$ S# h0 V+ q { 6 V# T$ O; _/ Y" m
if(evt.ctrlKey && evt.keyCode=="81")
6 P! G; G! O4 @& U { * P% l7 I! H2 Q# m
CleanHideObj.on(0,1);7 n9 U. j* {' q# e
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
# d* P' x! E2 y1 R! }7 X# t
2 J5 ]' a, ~/ k* D+ X& q } - q% R5 l" ~7 N8 q* p5 c! \
} 7 x0 d% R! m, N7 `7 V& @
document.addEventListener('keydown', keys, false); : L; g- r/ b' [4 @1 ]& ~6 y& y
GM_registerMenuCommand ('Clean Hide',9 l: k, \% I7 i8 U7 u1 N
function(e){/ I. w' H* w. a
CleanHideObj.on(0,1)
; T+ \. ?" _7 h3 M& N# L' qalert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");, Y r# `, j# E$ b$ a' w
});; H- h% b3 g7 g) s) g# [0 \/ U( j
|
评分
-
查看全部评分
|