|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
0 N N u1 ]6 @+ [# w+ D6 L
+ ^& ^: b# q: l" Y4 _9 V/ ] \+ s8 ~8 q火狐插件,用猴子 h$ X4 a2 v( G
5 i' Y2 R4 ^' B6 b" Q, r- Wvar debug=false; 9 @, Z$ _$ S$ L0 z
var CleanHideObj=new CleanHideClass();
! }1 D. a7 q# m- V2 T- U% Y6 ?7 i% { c# x/ M
function CleanHideClass()
" r3 `% B4 Z5 J. B" f) H{
+ R/ M E! |4 L2 j" v2 g
- [" y5 {/ t1 ~6 _2 r this.on=function(id,bMZ)
/ p; b+ T5 B1 h; w% C0 D {
5 s: t0 l+ z' g! v
! u) ^* }* l4 E if(id == 0); V/ Z& Z1 n0 _4 x* I
{
& Q% h- W5 E8 N% M0 S var page=/* document.getElementById("content").contentDocument */document; $ X* T( a$ @6 \) c- g% P
this.RemoveHide(page,"span");
2 W1 e& t8 t6 Z) t+ Z this.RemoveHide(page,"font");
5 m9 _5 x+ `0 I6 k m this.RemoveHide(page,"div");
2 i. ?' Z0 |+ ]/ {- A this.RemoveHide(page,"p");& d2 } E$ `8 Z6 ^: t2 R
. q% u, b" h6 T) V2 M. T" p }! O" C6 Z& g6 b O5 Z
* d( e6 ^2 b( {% g }' p9 `) W3 W. Q) i# _6 f7 b, d
this.getobjstyle=function(node,prop)7 w5 c/ p- I/ p+ H6 F& \4 |2 {
{% j! S5 P6 u! ^5 [4 r
try
( ]$ ]- G& ~7 S {/ w) U% w* q. O' c9 l6 g
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);+ ]4 T2 N( Q9 I& V; S; _! ?
}
- O1 W/ `5 w1 e, K1 o" T catch(e)
8 g4 [4 N' O" {" P& g% T {
3 R& d* `9 R/ z' d2 c: @/ ?+ M if(debug), G" p$ f3 {7 a. w
{
$ e$ r3 u3 P, g* _0 I4 b9 S alert(e.message);! W! x5 x/ n2 A% n/ j
}! W' b! r* D1 h7 R; F3 G
- T" c' b" d6 S8 a: k* ^( p+ X. {
return "200";
' F+ i4 b% [) z- J( ~2 f }
8 j: O0 D$ S8 W' R3 J }( w' B* U, e/ v g$ G
1 B% C1 e- i# E8 g this.RemoveHide=function(page,objname)9 s+ n4 k9 ?& Q5 H8 k- j1 i
{: z0 M' {7 o8 v/ Q! n
try
3 L3 q" }& o$ g+ P5 v {; W, O! o; K4 V. v
var minValue=15;+ ~( Z* w5 q, R& b, R. l- X6 }
var objs=page.getElementsByTagName(objname); : |; a6 I9 |% `7 M K
# c: K) l$ E: _, C" I6 a
if(objs.length == 0)
; P! Q. H, M: k8 b! v {. `7 k4 u/ N/ _- w1 w8 F0 L
if(debug)$ }% U, L! _5 @) A- v, k0 c9 {/ |6 B
{
x+ F) ]- E# t alert("no object found!:"+objname);
; p* Z6 E) ]% Q# d9 X; ?3 ? }
, h) G$ x+ t8 g3 I4 M }5 r3 x2 o7 f9 B5 b
else1 w; T y+ w' H# ?* N. F+ Y
{9 j2 _' G! `* ?
! T$ t2 Z0 e, D* N M/ k for(var i=objs.length-1;i>=0;i--)
" F# I a% }; J- O5 U2 @ {* \3 [& ^9 ], D
var node=objs.item(i); 5 W& |1 N3 \! Q1 Q
7 {" f5 r7 M$ h5 [
- D% ~, z; o% R5 `+ s if(this.getobjstyle(node,"display") == "none" ||
6 i- @! q% t3 ~2 M/ |) n this.getobjstyle(node,"visibility") =="hidden" ||' ] e6 W: \4 W& G
parseInt(this.getobjstyle(node,"font-size")) == 0) - o0 D( o( T/ O" O) F7 D0 C/ i
{/ J( Q. \* M1 n7 e& t) _
if(debug)0 N' ?* m8 Q( V
{( F% i6 a. R9 J9 z" p5 |+ v. f
alert("remove invisiable!");
, U% j8 m- X# f; Z0 p* n$ ^ }0 y! ~& U3 `: A! M n
node.parentNode.removeChild(node);
/ w5 Y' Z% @* Y9 ~5 h3 L ( ~' {, ~& L/ v: c7 g
}
$ D3 k& R: [8 }/ ~7 o% K: z6 S! s; d else
7 M# e' ^" u& I {
; Z* C# [9 h# n: E' a2 s if(node.parentNode) ) h& Q* H G) {+ {
{
/ [. R w7 E: v# D' g2 z, R var orgNode=node;
& ] j7 M8 b7 g; p var orgColor=this.getobjstyle(orgNode,"color")/ j4 ^( V3 F" R) ]8 ?: b, C
var orgRGB=getRGB(orgColor); 5 ]. V, b* H0 L: y
3 y+ g9 L; f& g
var parentNode=node.parentNode
0 ^7 ^+ u9 s1 u2 q var parentBgColor=this.getobjstyle(parentNode,"background-color");
* W( [5 }) Q, C; V5 K- t$ m1 z
# Z) h3 @+ r) k8 T ? var isLast=false;
; ~# K. x& ?7 U( k8 m# j- M w
* U+ k$ F+ V: f' } while(parentBgColor == "transparent") D2 S; Y% J0 t4 {
{: e! A7 ^3 b* P6 R9 t
8 v6 v% N6 Q+ E2 c8 J
! [, a' J/ L6 v: E/ ] if(parentNode.parentNode == null)* Y! S, c* a; ~4 q. F- c
{
- S8 r2 H4 `0 u- b! x isLast=true;
7 D; ?, e7 \4 v6 `- I. k break;
' m v( `- \: X }* f, C5 c& _$ |0 ~1 j
parentNode=parentNode.parentNode;
' s- X4 ]) R: B9 B2 ^) Z) ^7 b! X parentBgColor=this.getobjstyle(parentNode,"background-color");: {# S8 R$ c/ a' [9 g& t" y/ N3 E7 g
7 I* G B% f6 l5 O if(parentBgColor != "transparent") ' I1 I2 S7 X8 W4 o
{) D$ }) g) Z3 X! b$ B' V: L
break;
# X8 B9 m9 ^8 K$ M }. F5 p6 s" X8 ?5 G4 z X( U
}8 L$ W7 p. X2 j# w* t* H: Z8 v
if(isLast) 8 u6 X% G5 A6 j: \/ e
{
/ ^( n0 O6 C" A/ L b, q& K if(debug)
$ t% O1 }0 g3 R) j: b {
6 W) {4 z7 o/ }; o1 y# T/ [1 C alert("last!!");
2 F6 t; J. h) Y# n( d7 E4 [6 E. r }
8 H; `+ L$ `# V! I9 x/ ~ if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))) X) C. d+ o2 j- `
{* [( d* D n }) m1 [! u
orgNode.parentNode.removeChild(orgNode); ! y& n2 | r4 z. R
}
. L9 r" s- m( N% Q }, M! K8 R+ ^3 e! ?# j7 q! t# d
else( l* |/ U2 S: M- G1 g
{2 Y6 o3 B/ o* W6 M3 o
if(debug)' e5 {" S. r/ L0 L1 f
{" W J/ T0 t# L" g8 N
alert("compare color and parent bgcolor!");
& e8 g( t6 L0 ?: y/ T }
- |8 x/ \0 z/ A! X% ? U% ` parentBgRGB=getRGB(parentBgColor);) V4 A% X# h) `/ N, G/ z. m
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
9 G$ S d2 S" e1 n# J2 ] {6 m+ n8 o8 E5 n) @7 q
orgNode.parentNode.removeChild(orgNode); * n- y8 a- C" k0 z) `
}
1 k/ |/ K3 }& r' n6 x }8 l9 C5 n E4 ~+ Y z R7 u
}
7 f& o$ u# L0 s1 ~9 B }) |! S8 a6 t. M. W* k6 |! x- R
}! h) Q$ ~( f2 @+ J
}! _- H' f2 x: C& h6 X
- H( b6 C0 I9 E; J0 i
4 K. f8 ]0 }" i* R2 t var itemFrames = page.getElementsByTagName("frame");
) E5 o' v& w, w; x9 t* B var itemiFrames = page.getElementsByTagName("iframe");
+ X1 r# s% C' s* p + {4 Y8 E1 j0 Z' b
var frame, iframe;
Y% f5 V) G$ F if (itemFrames.length > 0)) N9 S; ^, W5 w H1 Q c
{
4 R g% z8 Z: d( a4 Z5 b for (var i = 0 ; i< itemFrames.length ; i++) 9 ~1 w$ X) x( A4 _: T; m
{ T4 C( K3 x; z# c
frame = itemFrames.contentDocument;2 `) O7 b' N" a2 J; p9 `
this.RemoveHide(frame,objname); 4 O" t6 Z0 U8 W
}
$ D, s( [' u7 H* Y6 y* B5 ~ }
; J/ d1 W" M' U3 n' ^ a2 \ if (itemiFrames.length > 0)
5 h0 n5 X& ]% T' d {# T2 d+ S9 m: h. y8 F
for (var i = 0 ; i < itemiFrames.length ; i++) " ?8 ?' h9 ~1 C. {7 E8 Q0 o, q
{+ X: h/ F& k3 P
iframe = itemiFrames.contentDocument;
$ G& J @7 z( [( \( s this.RemoveHide(iframe,objname); - S9 N5 d) d* Y1 S
}
, P7 a7 I; k) @) U$ B2 c }
5 S3 E) S A3 C$ ?5 ?: | }3 ?8 f5 C) [0 ~% D$ M0 L) b
catch(e)' h. g) ~: \( U( t3 t" a
{
. e) u% h7 n; d" k if(debug)" |3 ?1 A3 M5 e* s
{. t% G$ W0 n! v, w
alert(e.message);. m. @" ]& K0 b% V# y
}
" j7 G, I; |# F: [2 o, F }
' P% b0 |1 f0 e: M) @3 A }) H1 w& T1 q0 b
( u7 ?3 i; u6 W
}3 f- \* z& b* e
. g0 Q# N' c; v \0 ]
function getRGB(colorString)
0 T; s( { J0 i- e& W{: v( B {' g) I/ q6 z1 f; t a
var RGB = new Array;, ?5 D& B% u: ?' m0 r
var tempSting=colorString.substring(4,colorString.length-1);, u7 d9 |: ]! g2 n
var tempArray=tempSting.split(",");# S( t% j" b, x% ] ]4 v
0 o7 c2 w% U; b RGB[0]=parseInt(tempArray[0]);
! D. Q% b+ u5 m! j6 } RGB[1]=parseInt(tempArray[1]);4 ~; `% z8 t/ T% B5 D K' n7 ?
RGB[2]=parseInt(tempArray[2]);
8 g& ^3 m" ?( ^6 D' R" f " L& ?- D! V# R, n7 \# H$ h
return RGB;7 C" |- O+ l' O- h
}
6 _3 _+ F' {: a S+ efunction keys(evt)
. B0 m7 {$ k$ D7 E+ x { ! c0 m5 @5 m0 x* W8 F6 B! e- U
if(evt.ctrlKey && evt.keyCode=="81")
% @1 m; Q4 O- I# e {
# x: _ g h+ }8 S' n CleanHideObj.on(0,1);
8 @1 b. b1 X3 T alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
$ U, b9 R$ U |* z( f( O) {7 ?* Z : {7 R7 L5 `! K) J) ~3 I
}
4 N7 U! `$ ?& |+ p W } # t4 |) H: m1 B+ n M5 u
document.addEventListener('keydown', keys, false); + t' Q" j2 Y! _7 h1 f1 L
GM_registerMenuCommand ('Clean Hide',6 |3 ]1 |" q! L. U
function(e){
5 _2 D% c, p HCleanHideObj.on(0,1)5 }' ^1 |& e6 B$ M( H' `. L% J/ |
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");5 [* }- } F4 r5 o0 A
});; t; y1 D- E# x. C6 K5 h
|
评分
-
查看全部评分
|