|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
* M" s, D7 B w2 }6 F! _: d- L$ J2 ?0 {6 S& v
火狐插件,用猴子
" Q) P- _8 E7 p1 M$ Q' p! \
6 U" y7 B3 m2 p6 I- Y$ Q! _% D9 @var debug=false; 6 c+ l) E3 P8 d8 S. r7 T3 x( |
var CleanHideObj=new CleanHideClass();
8 X3 B [* D* i/ }/ c& a! F5 K3 w+ l, \% v4 M# ?* g9 Z
function CleanHideClass() E/ p; P+ m2 Y
{ 2 N, e# i. B8 P* A+ U; }- a# t; W
- f- t/ s% z! F this.on=function(id,bMZ)/ U+ X3 H# v( z
{
/ w3 O ^# w+ h2 Q4 \" ^) B3 d: ?' K 4 A3 O1 `2 h* E& F
if(id == 0)& g$ n/ i$ g' g5 q$ d
{
) X3 q' O0 I+ H, d9 j var page=/* document.getElementById("content").contentDocument */document; 7 d* M) U" g( w# W0 g/ H9 R1 B1 S
this.RemoveHide(page,"span");$ D) U4 W) t" q+ v9 D9 I3 R! h0 h
this.RemoveHide(page,"font");
: E" H% }7 G, n4 i( B+ d this.RemoveHide(page,"div");
$ b5 Y1 p2 K. l6 k0 [ this.RemoveHide(page,"p");
; h/ e1 q5 O7 T% w! s8 ~* H5 A' Q; s. }
/ X1 k' M/ k' G$ J }9 z- }2 K& V7 `9 W- N
: x: `8 j$ t) ?' |! U: `* i
}
$ [7 V! ?* Z) _4 e7 z this.getobjstyle=function(node,prop) k, _8 J' i' \9 D9 l, h( }
{7 S+ A% z, ~6 V. B' [
try
) w7 Y% a2 ^) z+ q {
9 U( S# \' S' S$ r return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
5 B) t! g; ]6 w/ d- n }
: D3 ^% y5 w/ N! F! J catch(e)
2 ^. v+ r3 G% V' E: u {
$ f6 g& s c+ X2 W, o if(debug)% ]/ y" m. a, {, i- c6 |0 A; T- ~
{
% r3 S/ d/ j: d9 i2 Y+ n) l: k' N, n9 Y9 p alert(e.message);
/ O9 ?$ p' M6 B, N* ` }0 }, K1 `1 _1 g, L
8 y; R/ }3 M1 m1 z5 A9 ]/ {0 o return "200";, A" s" A0 e9 R& G$ m- Y
}
$ f" h! A( B4 M, M0 T | }$ {! @/ }9 S6 X
! U0 u2 A, E% y1 ~5 P2 d N% B Z
this.RemoveHide=function(page,objname)" s+ w7 [+ n+ ]: `; D
{
. S$ n2 k: H" b% F' I- W4 f g try6 K& a* S4 X$ g# V8 h8 E
{
/ j6 }6 w6 ^3 F6 x1 Z! |/ o5 H var minValue=15;1 A; h |3 r! v9 a% R7 F
var objs=page.getElementsByTagName(objname);
+ O* o. {; V2 y5 \
' {$ a7 T% V) Y* s2 `3 Q if(objs.length == 0) # h: |" I# `& f6 j+ Y' x8 p5 y8 \
{- X6 i8 y# B' h0 m$ f; v, C
if(debug)/ w& p3 l" c) S7 k: `. a
{ u3 w" Q5 w% {& i
alert("no object found!:"+objname);
+ R. T6 o$ p+ s/ \8 z7 G! S }
4 A6 i/ Y# N* @ }8 v7 P1 n1 z0 c: _
else
0 L/ U; _4 _8 a! w: l& X# }5 w% X {! x8 ]: D2 W4 M& Z4 K9 C- w
& f5 Q$ q7 A F( |$ ^ for(var i=objs.length-1;i>=0;i--)
~2 X5 o6 E7 @4 l, U$ z+ V {
9 @, ?" R3 o& |5 x) a3 C6 ~' V, N/ f* v var node=objs.item(i);
9 D( `8 Q3 \* z5 c
$ o) w4 ]8 K; |3 x2 W
/ J4 q) ^ D' M! y, D/ Q5 J, ` if(this.getobjstyle(node,"display") == "none" ||
, t" \0 m0 Z5 ]/ b) t, b" ?* M this.getobjstyle(node,"visibility") =="hidden" ||6 N& W% q+ L& P; y5 _2 d. `
parseInt(this.getobjstyle(node,"font-size")) == 0) $ W) k$ \: ]; z; J& |- J& }
{, {# v0 }2 E2 f+ X
if(debug)
: g: c# R6 Z9 \. m% a {$ R+ ?1 ^: Z( D B% B) Q
alert("remove invisiable!");
! t$ P& Z6 Z8 m' _/ x: w# } }
7 l) |! X* d' L" q" I0 `- C node.parentNode.removeChild(node);
9 n: W) l; \, X4 D9 l
) D% h0 |& X' y% [; o4 x C" m }0 Q0 ?! n( e o3 }8 a0 Z
else
7 p, ^! T, D9 t) ?' Q P! V8 q Z& q {
% v8 o) S1 Z% P- p2 E if(node.parentNode)
$ t# L6 _& O! q% k) e+ w; C {
. x. {3 N' x0 W var orgNode=node;
Q2 a4 e% C- g: w* V# w) q var orgColor=this.getobjstyle(orgNode,"color")
: X+ I5 ~5 t. |& F var orgRGB=getRGB(orgColor);
2 v3 G% \+ _* }" L2 v/ q- ]0 z7 i9 { " p7 U# V- ^: ~3 M7 \$ N" r
var parentNode=node.parentNode
s9 R( S. k# E+ f8 i& Y2 s& H ^4 m2 h var parentBgColor=this.getobjstyle(parentNode,"background-color");: g, }2 w2 X: A% d2 `
* d1 x9 H+ V/ v3 U) h& g# r X var isLast=false;
9 n/ ~8 Y1 A% A7 L% g
( X _5 ^. A; e3 V: g while(parentBgColor == "transparent")
" \7 g5 N9 v; k& t B" b {0 Y# X R0 B+ j( j8 S0 D% O$ H
, L( Y5 m( d7 S- R( O
) F+ {* W. T9 b4 W2 }
if(parentNode.parentNode == null)
! J9 W1 T& f( F. h- y v {
) T5 `5 _+ P& `" b5 V& t isLast=true;; I Z. J. I& C+ c3 `
break;" h. f5 V, q: \" ^$ `
}
- }/ |7 i' T$ O7 ?, `( k4 n3 V parentNode=parentNode.parentNode;
' r: o: P3 t# z5 | parentBgColor=this.getobjstyle(parentNode,"background-color");
- W' o% {5 ^1 @+ a
4 B d3 H6 B9 `5 Q `1 @- ` if(parentBgColor != "transparent") " d2 s6 n: U# T% Z8 K' [
{
- h5 E1 T' X$ h Q* j q8 b break;- u. l- S3 ]* Y: F1 F
}
+ t* S+ J, W, B2 y4 C/ i }8 e! B W* h, W# @& T- Y" V
if(isLast) & l0 u+ P+ r" r' @# H5 i
{1 H" S, r9 F! v( j5 V6 a& G, R
if(debug)
% v1 {2 a: U1 Z7 M+ s- [2 j {& H% H' X' V. s2 p
alert("last!!");( R: V0 G& G" w5 V; M3 I
}
0 O) z! V7 a1 N9 f4 v if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
* z6 d& K& n- S% x# I% V7 E {- ?# q5 V, k& }3 D2 e- B6 z* t9 i
orgNode.parentNode.removeChild(orgNode); # ^: ^+ |0 _/ x+ A
}
2 O6 l+ P$ b) c! Z8 w4 m0 S }/ H k1 G) ~# y( `: w6 q/ Y T% u2 l
else
: U" v1 |& B- v* X5 w {1 o& `: @4 O0 Y% \
if(debug)% s( J, w6 ?8 N& U2 ?* h
{
& l" _1 |' P5 g3 r8 x7 ~& x- I alert("compare color and parent bgcolor!");
+ { F. M# E& j, x }* n' I2 W; }3 ~$ F$ g
parentBgRGB=getRGB(parentBgColor);
- _3 K) S2 G. N1 ?4 E if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))8 v0 B V$ e5 Z9 O: Y
{
' H8 Y8 _ d7 H orgNode.parentNode.removeChild(orgNode); ; B, c/ n9 z+ T# R
}
! n* @0 w9 l; y8 ^4 g }1 y* O1 p% V2 F7 y
}0 g6 t0 e5 g; U
}
8 N$ _ @. h# J$ p }( Y2 o9 w+ Z6 o. y
}
" p7 v6 ?( A2 \ `) M% I Y
) A$ V/ w6 `( N* W+ R& U* J * Z; D! S/ z" ^/ @
var itemFrames = page.getElementsByTagName("frame");- {! s, O7 {0 `4 Z/ U/ {5 D8 b
var itemiFrames = page.getElementsByTagName("iframe");
, n+ F: ]6 p- f2 r b
0 F: F- q* A$ s" r. C var frame, iframe;
. C. Y( B r4 X6 Y6 ~% c if (itemFrames.length > 0)5 \% }6 x+ N1 ?' c9 I
{
/ s+ t1 K8 ?8 C' q2 T8 G for (var i = 0 ; i< itemFrames.length ; i++) 2 V% D5 X8 d5 S8 b" K% B# g7 U' I
{
; g2 X& [+ p/ v. X9 c7 P0 q frame = itemFrames.contentDocument;! [+ {% T$ f! l' B$ z6 v; z x% z
this.RemoveHide(frame,objname);
0 i6 I; O+ K% c: I# i) g# o }) \7 r+ K2 f) v. ^1 M! s
}
5 x9 W) x* O2 I' b# W if (itemiFrames.length > 0)
' b2 n# n8 m3 V" `! W U0 p. f {9 |$ z7 { H$ X1 o9 h
for (var i = 0 ; i < itemiFrames.length ; i++)
" n7 ]5 A- M2 \, |! g+ P {; g2 s! R0 o& E$ ^. n
iframe = itemiFrames.contentDocument;
( {1 Z% C0 N" v- ]7 q$ b1 A3 x this.RemoveHide(iframe,objname); / N. m6 J, w2 X
}/ i: |# R# o z8 f0 _( c$ G
}
/ p7 D5 ~% M3 n }
' V* b: B2 H$ ~- v. X0 ^ catch(e)
$ S$ I% K' c% x/ V3 e) Q {0 f- {6 J! ~6 u6 M. h! K
if(debug)
4 o. n1 n1 ^1 u, r( a {+ C& y( F7 I4 a# _* o, O
alert(e.message);$ r b% z, X1 k* S7 J9 T
}
( [5 {) \4 o* t2 \6 L0 Q$ `# k }
( q ~; _, q: ?0 }' W) ] }: c8 v; z- W- b4 ?
; R! ^/ Z+ t0 D7 J( i$ \
}
9 P# C/ \4 b; w* a# Z% G) i2 B& Q; F4 N' |! r4 x2 W- |% n
function getRGB(colorString)
" x2 _' p( e. V; R: z j; s1 p{
# `% q0 h/ r: j% V8 J* }( R0 T var RGB = new Array;
, b% k. b, c( B0 S6 Q. { G) A: y var tempSting=colorString.substring(4,colorString.length-1);
4 n) {6 e3 f8 W% U7 ?' G3 f( y var tempArray=tempSting.split(",");
9 R6 ^ z& n- i0 z$ I$ T+ l! f6 {2 s/ s: y) U- d! q- m6 P
RGB[0]=parseInt(tempArray[0]);
5 v, Y. O5 X% l9 C! @: ~% E9 H$ q RGB[1]=parseInt(tempArray[1]);, n' J* p6 \1 D6 ]& P/ }5 t9 W8 g5 j
RGB[2]=parseInt(tempArray[2]);" O, F: P4 l2 ^: P7 @, d
; r3 f- A; { a1 ~2 c2 z. o7 Z
return RGB;4 l# ]5 u# r7 n5 e" H# ^
}
~* y1 H: |; v6 F9 k$ W' P% vfunction keys(evt)
' J1 R' Z; G2 ?/ V9 J! j {
4 N. Z" [7 C4 {4 D3 m2 e' Q' u if(evt.ctrlKey && evt.keyCode=="81") g/ _; _% C; m2 H) a0 c" v/ q1 T3 i, J
{
4 J* t) ] ^' c% g* m# b CleanHideObj.on(0,1);0 l$ g5 O/ n: G% g# q8 e9 B8 G' z
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
# N$ _4 I; j! }. S% K7 J' ^ ) g7 y1 M; X" t' ~
} 5 K& K* b. V1 _2 ?' [, s% ^
}
: S+ C& \7 D/ E: Jdocument.addEventListener('keydown', keys, false); . J! u, i/ c" k0 V' \
GM_registerMenuCommand ('Clean Hide',6 w3 }/ `7 p+ G, A, e2 G
function(e){, V- Z- [8 V2 y9 H* _
CleanHideObj.on(0,1)
8 a! V" q5 |5 j* s X4 talert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");7 t: R+ w6 C3 }6 F/ H: h
});7 \( T; v: X+ ?8 r3 E
|
评分
-
查看全部评分
|