|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 1 A$ u3 o# i; u0 s
" e2 T" I& k* u$ w" j- U) a; Y; m
火狐插件,用猴子
`/ o0 I8 F) |: O( A
8 V F5 b/ i& s! \, I+ i2 T: jvar debug=false; . T' G* G9 Q+ @& [. }9 ?! t
var CleanHideObj=new CleanHideClass();4 O3 I5 w1 P/ @9 B/ z7 V
# m5 q: l: M, [% o! m d
function CleanHideClass() $ N+ k a/ e+ x4 e* _1 `! f: @2 G
{
* e" v9 x. B) }5 @' c$ K
+ G% c8 K4 Q$ p3 C1 J7 c this.on=function(id,bMZ)
8 p0 S5 h( n3 R6 \+ [ {
- E, B; M/ W0 }1 X - z4 R `( J E- p4 a
if(id == 0)
" l8 M( u0 B8 Y1 R# ] {0 ~ H3 t$ f- h+ w6 f M' ^' P
var page=/* document.getElementById("content").contentDocument */document;
$ K2 O) D) Q/ \& L! O6 x- S' P this.RemoveHide(page,"span");& O( Z! U" @1 i% _1 @
this.RemoveHide(page,"font");( u" C- c7 F' t6 k9 i ]2 b
this.RemoveHide(page,"div");6 b1 j$ o" A9 E; C" \
this.RemoveHide(page,"p");
A# e' q4 R; R' z- J) i( o( v& w
a p& i; h$ A6 ?/ Z/ d0 ` }
: z* |1 [4 n: V2 l- j $ u( z0 l0 J& p, N; E
}# {+ h3 z" A% |' K
this.getobjstyle=function(node,prop)/ O. W: R2 P3 H, R
{
8 H9 x1 s* p7 Q# I: ?" x& D try
" n+ s1 _. C# A/ t5 O+ z% _ {
4 ?1 _' v6 m7 w4 |3 e3 t* i return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
; ]0 t5 `* H- g! A, F }7 N) v$ R$ ~8 T* G- i
catch(e)( f0 K- b( T2 t' w, o( K# X3 y
{- }5 f; p/ S( c# B( `0 y1 E# c
if(debug)
9 \- i" K! _8 x% Y& c! a9 L, _0 Y {/ `, q2 n( {6 [# |
alert(e.message);1 ^6 I& b4 U/ s8 Y' W: @( j" X4 n
}
, c7 V$ Y5 b( u$ H+ k6 s% O
; h5 e4 Q& y# c0 C2 j3 K return "200";
" f) y5 B1 x4 b& @3 s0 h! u1 g }1 M) ~5 q$ c) m+ F' F
}
' s, L6 S6 V G1 I
; x: V9 ]( W7 ]% I4 J# w this.RemoveHide=function(page,objname)
: u) {$ S3 r. o: \/ k w {
' \$ U6 M' \* r9 c1 \& i% J: Q try
% m5 Z8 L9 w8 v5 R# U7 S: ~0 j {
% d6 F& x! K+ h& M var minValue=15;, T! e D/ W& j/ ]
var objs=page.getElementsByTagName(objname);
# Y# m. g! c# s" E- s
/ j3 [' w: d% I if(objs.length == 0) . A( F/ K4 P, G6 ?
{
7 V) x* f0 G2 }4 C L if(debug)
. \4 ]& F# Z2 h7 W2 n {
; a( N( v# X8 L' {1 f, p alert("no object found!:"+objname);
; _& o! N6 ]# [+ w }
+ |' ]7 D }% A6 H3 ? }$ l- k# ~& Y t7 o' a4 t1 c6 e2 X
else
# |/ ~+ @+ t3 K: U4 c3 s {
/ ]0 k7 g; T0 W. w
[0 B2 D7 B4 ]' E P& i for(var i=objs.length-1;i>=0;i--) ) K% f" V) j$ S
{7 d! w1 p$ s2 i; P: q
var node=objs.item(i); 5 m1 v. X6 }4 Y1 ?" f
! L% j$ s7 |' B- L) ~' X
2 @; Z, d; Y& d+ V6 x3 i$ J if(this.getobjstyle(node,"display") == "none" ||
$ u8 S/ \& m* T, P9 [ this.getobjstyle(node,"visibility") =="hidden" ||
X/ l) n) k% c' \: Q! O* w8 A' _ parseInt(this.getobjstyle(node,"font-size")) == 0) 0 k. [) R2 c+ H9 |9 A% o
{% s& M% g5 f+ e& Y: t/ f$ L+ b
if(debug)
' c3 V8 V% T. R/ d1 }/ p {
" I/ z% T, C4 C, u3 m alert("remove invisiable!");# K7 l: _0 B; e1 r" c
}
' K7 `+ m' W& y: u$ r" o4 V node.parentNode.removeChild(node);; g$ h: z- z' U h Y5 j
+ X7 c% y9 |) d& [; k
}
; E% G# v1 @6 s6 n' Y else
G9 ~& g$ U4 t {
0 [+ t# n& n/ t if(node.parentNode)
5 x; X0 S" Z; y# J! e {' U$ x8 {4 ]' O" O5 G
var orgNode=node;" X0 l2 i# B D) Z# [% t; Q" V
var orgColor=this.getobjstyle(orgNode,"color")1 o1 Y6 S4 w6 d+ G4 o
var orgRGB=getRGB(orgColor);
0 ~7 t, E) H5 _: n! @4 ~6 i9 ^ ! u. o v1 H9 B( C/ {- b. \0 C' {
var parentNode=node.parentNode, c C0 J0 q3 S- n6 t2 n: ~6 `2 t
var parentBgColor=this.getobjstyle(parentNode,"background-color");
8 i# x$ I( y: O4 l7 R6 J0 f 8 b# }; i& N- V9 _% u' w
var isLast=false;: X9 L: F, @- o5 g( K* G
B6 t9 X) c2 q, I while(parentBgColor == "transparent") 4 {' |/ [" d! e
{+ V0 @9 U$ o' {4 d/ g
. D( H( p+ f s) w' b9 |8 U
9 k5 Z) |9 E( d! }+ u; p if(parentNode.parentNode == null)
2 o* S1 R9 g# K8 ?7 x {
0 A, w0 ^: @; g+ o& Y& F1 T isLast=true;
( |6 @2 r0 M) D+ q break;3 u: E0 w5 u8 ~; H8 z$ P
}) H/ e* z# b7 e! F$ H: t
parentNode=parentNode.parentNode;" u6 {% B% ^0 h( Y. F
parentBgColor=this.getobjstyle(parentNode,"background-color");: c& i/ \/ `" _5 H9 e7 _
: \1 N3 B7 g0 {) g if(parentBgColor != "transparent") ! B+ C. M3 I% {8 ~% M7 H
{, P% R9 C. `$ G8 F) o
break;0 W0 r) x* m" D8 i
}
: b, C- m: o; q }% h, V# b4 `4 s6 \
if(isLast)
/ R+ v; G) O9 z1 Y+ a* ~6 R7 @$ [ {$ D* m k3 P& o8 ?) g6 {
if(debug)1 j( f$ X: F% Y- p! n2 B, k
{
" `3 o* z+ U6 |9 v+ r0 [6 q# _ alert("last!!");. q% Q0 ^3 ~$ c9 K
}6 K; X% p0 r/ |6 J3 T4 Z' D6 d) Q
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))/ g: s5 \" i) e7 H
{
# Y" M. @* Q/ R) Q3 u/ n orgNode.parentNode.removeChild(orgNode);
- `) K5 x# n4 x }' }6 `& O3 a8 ]4 b: Y9 i/ w( m
}
5 |. l/ H: o0 c4 ~% V: e4 x/ f else# b) \: B. }0 B
{0 r% P; O6 X6 [+ F& T- U$ w
if(debug)
2 }2 W: A6 a) P8 J6 M" @' w, y {* F2 b0 p0 ^9 B" N( e8 r
alert("compare color and parent bgcolor!");2 W! _$ V8 B: b* X+ {
}
% T1 ?( v/ \- ?2 \ parentBgRGB=getRGB(parentBgColor);$ R! x A$ v; m1 g! J! m
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))' w4 J" G( I! N/ H) u' W0 i5 v
{1 m# C r( u" f2 L/ {) k
orgNode.parentNode.removeChild(orgNode); ' b( r$ R/ m/ V5 A( i* `, o5 L
}" ~+ h1 Y$ C5 G4 N! V
}0 a+ Y- ^! y$ D, j! N( B; e
}
6 @/ o( h+ g+ I/ H* M" k }
' Y5 W/ Q. \$ ]- e }& m2 i- b Y/ Q6 n m6 q; s, `
}
4 u9 _2 s5 q$ m2 o W; E% R( m 0 ?1 U1 p# T; @: Y
/ w+ U- g; O+ g0 b# I3 ~- U
var itemFrames = page.getElementsByTagName("frame");2 ~! [( l W" t i4 G( ^
var itemiFrames = page.getElementsByTagName("iframe");% I" r% Z* N0 I. O2 U1 V! O. D
2 z. E* @! m) Q
var frame, iframe;
. C% ?2 r# {. Q7 H$ q if (itemFrames.length > 0)
2 o7 |! d* e8 N {
& J: M7 Z/ P" A$ V7 u for (var i = 0 ; i< itemFrames.length ; i++)
" o; x. b C. \. A+ V {
2 a+ \$ e( M7 O0 B2 u( z3 | frame = itemFrames.contentDocument;7 o' S8 e. h+ [8 d
this.RemoveHide(frame,objname); ! Y* n h9 C1 E. k) @
}
0 f8 l0 R& T. q }
* Y6 m+ P" G% g/ m* k if (itemiFrames.length > 0)
( ^1 `: Z6 K7 G! J$ N {2 G9 t/ }7 _/ ]1 g! D# M2 x
for (var i = 0 ; i < itemiFrames.length ; i++) # M8 |- q- R) L" o2 N+ |$ l0 x
{ v8 k! M# O+ b; N/ A* ?6 c
iframe = itemiFrames.contentDocument;
3 C- N- o; O; ~7 E this.RemoveHide(iframe,objname); ( G s' _: @. Y2 I( `
}
' w! Q3 f- l5 z7 B }$ y& N% H9 h9 I& x
} F6 \% f! O: ?" m# y4 I+ }' o
catch(e)* x# P0 W6 \- V* z5 {
{
/ g, v3 p) \9 c. i# t! }' B7 l if(debug): M6 s2 z/ u1 C2 o, R
{1 B0 N* m* M1 e2 k# P. s' T6 r
alert(e.message);
' _6 ]2 w0 `+ O4 ]! K, C: O }; s8 L& [ t* w! ?% }* z/ h4 z
}. _9 ^) Y3 G& U" D+ V! Y
}
. S0 R l- \ c/ Q& y/ { i& j
. g# M% D# ^3 {3 r' {) B7 j}6 q+ ?$ R( E" d6 F6 R/ L9 ?
8 @" N/ W4 i6 r! z6 T) _3 r3 ^
function getRGB(colorString)
" D$ z1 p) O8 _2 s' v{
4 z- i* v% ?3 u# E var RGB = new Array; m7 [3 `: {( {) B+ X0 J
var tempSting=colorString.substring(4,colorString.length-1);: J% }* Q, v1 A' m y4 S3 ?3 T
var tempArray=tempSting.split(",");+ w" T: M6 @+ m9 d. @1 h
0 q+ x7 q& |3 T: H$ o$ V D& C
RGB[0]=parseInt(tempArray[0]);6 {- o% v) |2 e" p* c
RGB[1]=parseInt(tempArray[1]);* e$ J5 }* ?# E* e
RGB[2]=parseInt(tempArray[2]);8 P: M6 Q& m/ j7 D" U! H
0 i0 _3 B' e0 t$ m6 ? return RGB;& h7 L' W' ~, N% g- o5 \9 f
}
3 f9 Y) X0 w5 ]8 f* R2 M& H: Nfunction keys(evt)
6 s) Q) C. |. B$ C { 6 V2 U+ {. b( G- M
if(evt.ctrlKey && evt.keyCode=="81")
) d" A3 L' P/ `- y1 { { ( L2 ?, {7 i( D# W1 L! m
CleanHideObj.on(0,1);
$ G) U$ \% R1 D: A! Q" a8 M* y alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); * L, O" x" Z* s4 n8 v& c( P
6 u2 T6 ^* x9 o; }- l
} 6 h: M( J7 a; r1 ~
} j' `+ `0 R( C, F% z; z. H1 i6 I. F
document.addEventListener('keydown', keys, false); ! {% h: m4 J( i; ]0 b
GM_registerMenuCommand ('Clean Hide',
$ L% o: F# e/ ?' Vfunction(e){* S2 ~9 S5 c2 @0 R u
CleanHideObj.on(0,1)
9 q( e$ s, r- A) s, nalert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
( J6 ~' H5 s, J+ I: {( i});# u' C9 H8 n, b3 J9 L E; m" u9 [* [
|
评分
-
查看全部评分
|