|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
- X% H$ I6 Y1 t7 J9 \- ~- [- _( S
火狐插件,用猴子
3 |. i- d: E% i; @, d$ u; v4 |- l' l2 h9 K
var debug=false;
+ m3 \" ?# A# P- h m7 W+ l6 wvar CleanHideObj=new CleanHideClass();0 Y, u9 u# i6 B; z. a
& s7 G6 r! T0 m* T- X1 ffunction CleanHideClass()
) d0 \& l8 i a+ e% I7 G' w: M' T1 ^{
" \; J7 ^& R( Z( f! x$ L5 F& j
V; l) l1 Q6 g8 @! A this.on=function(id,bMZ)) G# H; w: `8 @% C+ f( F" y
{5 q& J: r$ a& v$ I, H
! C, o( s" g* c! y& G
if(id == 0)0 L* @1 Y( }/ {0 m8 h( k7 R
{6 D0 x/ ~. s }' \6 h) o7 x
var page=/* document.getElementById("content").contentDocument */document;
+ Z3 a( p$ c. l6 ^% S6 O" p9 q/ L r this.RemoveHide(page,"span");0 g! q$ z. B! a( x9 B3 |+ X, m* z
this.RemoveHide(page,"font");
Q. i4 a5 t t) T9 w4 {8 o& [; x this.RemoveHide(page,"div");
9 U+ T7 s. h8 [, z& k, o1 }+ t this.RemoveHide(page,"p");8 R9 @( I5 X' z* K& V7 @
6 ?( }1 d. e# Z, l4 I+ W4 M- ^
}
1 j X' |! g2 C" X# n% U# N) U. A - k7 S, F* q( s7 m0 n
}) r5 i3 N# H$ S! V5 l5 @
this.getobjstyle=function(node,prop)) H: Q7 y4 h$ L) a( _, s) C
{
9 S6 S8 r+ h S& Y$ n6 P$ H6 Y try9 _$ b% P- P1 D
{
$ O( F) C, T2 W9 O9 A# a3 B return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);( k# Z' ?7 {6 B: g! |$ }
}$ |, O0 E) ~) B" m6 P: s7 i
catch(e)
) W6 Q9 U) ^7 s {5 O) G+ ^' @, ~' Z! _5 h
if(debug)
0 k( q. s% A' l" d/ Z5 m) q {" A+ {4 m3 O/ ^/ C+ X7 X5 y
alert(e.message);
/ f* }2 u2 [2 k' j( w }( |) q) [% y) H9 A. \
5 u$ L* h5 z0 s) [- K& c4 D$ B
return "200";
1 @. L5 O/ v- [ }' {3 o3 A- H: i& u& k8 N3 J: [
}
. V( A3 C# e- L9 p* N " ^& f/ N, ]9 l& i5 E3 L/ [( J
this.RemoveHide=function(page,objname). k% c7 V! \4 \+ O5 H' Z
{
4 G' ^/ B ~% x try u7 Q: Z3 S. D0 @6 H# f; v
{
: f# k! G w) F" C( e( `' J Z var minValue=15;5 U5 J! W% Q# ^' e
var objs=page.getElementsByTagName(objname); $ |6 j# z! S/ x$ ` d- P! N
6 F' c' Y d) B
if(objs.length == 0) 5 e! r! f7 v5 `, }/ _
{& c x4 ~$ U9 K* Z. x$ u7 p2 X
if(debug)" l# w3 Q2 B5 R; F; ^4 ^ i
{
q0 J0 W( F2 T: h alert("no object found!:"+objname);
0 _4 S* {! \ }% R2 g }7 V5 C/ L2 J* N5 [, G
}
6 O5 g/ r/ ^: ?" g/ a/ c. ] else
' W0 Q$ Z0 A$ ~0 b {
# W; S0 @0 n& ?$ K$ a- i 9 [9 {% ?+ @8 r) S' P8 F8 E7 ]
for(var i=objs.length-1;i>=0;i--) * N) v) e. R9 M; | _# o& Y# T0 M
{2 o8 E9 U( a$ C1 E* H h% x
var node=objs.item(i); ( K7 u- k8 I c& g* s
4 w! l1 Y2 x# p8 g4 q
3 ^9 z2 m2 \9 F4 _" b3 G if(this.getobjstyle(node,"display") == "none" ||( j+ E% b) l0 l" [2 Q- Y
this.getobjstyle(node,"visibility") =="hidden" ||
% N) q3 A9 t1 ` parseInt(this.getobjstyle(node,"font-size")) == 0) 3 Y R0 c& g4 Y' c0 |
{. l, ]8 V. D: F/ t) |0 j
if(debug)$ `, o! b& m E5 H$ h n) _& _! Q' m
{, |4 n9 m) ~6 [" M
alert("remove invisiable!");
, W. q+ s4 w* M. A4 s& V1 z P9 f }
: h u& L3 h- G8 [- r' H7 w node.parentNode.removeChild(node);
9 D6 |" g2 w9 X
W8 O' [ V# Y) |' Q }( [" N% x4 r, f G8 B
else C0 C9 H8 a2 {# m* [' s
{2 ?" Z6 `1 }' l
if(node.parentNode) $ p$ b( l, _0 T
{6 G+ O5 f+ [6 N
var orgNode=node;
! O% z( I/ p b: v, x6 ] var orgColor=this.getobjstyle(orgNode,"color")
) R/ }: a0 L& X7 `8 a Z var orgRGB=getRGB(orgColor); , O# K% ~; n1 V" J1 b
9 s! u' C8 N% ?4 V6 Q var parentNode=node.parentNode
k J0 j2 L4 @* @9 i4 ?6 r var parentBgColor=this.getobjstyle(parentNode,"background-color");$ ]5 ~. b0 C U, f W
3 ~$ r8 n" t: c
var isLast=false;
9 F3 T7 I; `1 B- B9 d9 d: f
2 U- v% y' L4 A6 B/ T while(parentBgColor == "transparent") 1 ?6 a8 F) A0 @* j) T
{
; G7 I. b% X) B6 m6 D+ A9 _
# P/ f8 d, l4 a$ n- W2 m 6 Q' U8 C% l! g" P8 R; t) N
if(parentNode.parentNode == null)( N! |. w& G; z# B, f J
{* |+ _9 A- x0 d5 q7 h
isLast=true;9 `+ D7 e- a5 v/ y: t* e2 M
break;
* A: v4 ~ j |3 B. e6 v- P4 ] }. V3 R# `" T# L; B" M
parentNode=parentNode.parentNode;
. [0 q0 F# g( s1 m! ? parentBgColor=this.getobjstyle(parentNode,"background-color");7 k. r9 b/ ?" F' B4 ^, G2 C$ F
1 a7 z7 t, Y f if(parentBgColor != "transparent")
, h8 ]3 [7 D9 a+ a! _4 n; o& B' O {
( [. y e. b1 P; ]& j2 C( D break;! c; e |! H+ q2 N4 L" h0 h/ x1 X7 r! j
}" l) i# d3 x' p, Y" ^/ b
}2 @! l! v! Y7 Q# {1 s4 L5 E! c
if(isLast)
" @: u4 X) N, X! ?1 j: @+ m3 d {; Z N, L0 S+ H3 z7 a3 X6 z7 |
if(debug)
6 l: y' ^) X- R. g {/ F% K0 t# F1 v* k
alert("last!!");
7 M+ ]5 D. @4 D% U* W8 R; e; _; A }
) L4 S, X, p" |& @1 I if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
9 a' T9 y# A @ {
8 b! R8 w5 g0 M' l) V" g& h orgNode.parentNode.removeChild(orgNode); 9 G1 U+ P( C" \1 e
}
' q6 i' m. p1 h7 S, M% { }6 f5 ?' E k2 ^4 a' p
else
$ `1 L2 o$ ~! d {/ F l- x4 y: z$ r. t* U6 S1 r x
if(debug)
4 S9 ^9 F. I9 c+ @' h9 J {3 n, L8 s. ~$ ?" y3 b
alert("compare color and parent bgcolor!");7 M" j9 H, V% i e
}6 n. z& s+ x" S) x7 p9 g
parentBgRGB=getRGB(parentBgColor);' ?9 U& h' Z0 N* M
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
; L* m; z' z3 W4 m: X {
) @# `! H* u0 C; p1 Q3 B9 H0 X orgNode.parentNode.removeChild(orgNode);
9 w* s9 q" W8 e }
7 z3 d& M5 I9 n }% K5 j% S- x* i* t
}% z- Y- U9 a! C( m3 ]
}
/ _# K; L6 D/ n/ t4 E }
; T* Y0 V: j, q' m8 E/ r; Z) r% [ }
; }7 v+ I/ g ?( |/ S" B9 P. P % S( Z- B) C5 K3 ] R' C
# v' q2 M+ X: V5 e0 Y6 E
var itemFrames = page.getElementsByTagName("frame");2 S- S2 ^# g( K9 I5 t
var itemiFrames = page.getElementsByTagName("iframe");
6 ~9 n7 t# J/ m: B
3 C- s0 r1 g8 F$ i" h1 | var frame, iframe;6 I( m# J0 J4 h. z7 L. g
if (itemFrames.length > 0)# [- A; }! h3 q; K
{
0 y, w, A5 ]7 E) b1 n- o0 g4 p for (var i = 0 ; i< itemFrames.length ; i++)
/ o2 b- R* S U) }5 D! G {
8 i, q/ _+ v) V" L frame = itemFrames.contentDocument;
+ ~* d! Q6 n# C" E7 c1 o ? this.RemoveHide(frame,objname);
( Y6 n1 m+ l- x- x& c$ k: S }
2 p+ t. M y% ^& n }( h* D8 J. j! N9 x# k
if (itemiFrames.length > 0)
) v D: `5 f) @, g5 H( Y {
$ P- f7 P( l. \: b5 d, K for (var i = 0 ; i < itemiFrames.length ; i++)
5 q; j8 `2 y8 z7 K C {
% {& w3 U u: ^1 T; H/ v iframe = itemiFrames.contentDocument;
: }8 p B- A6 L3 E- B+ J* M: E: l. S: ] this.RemoveHide(iframe,objname); 0 _% L0 n8 ~$ X- I7 C6 {. m
}, D8 d" E- T, p2 s
}
. j. C2 x) D0 k }) t( C/ J# {7 s8 ~9 m8 f n
catch(e)( s* R9 N- @0 l t P7 y7 p! Z3 J/ a
{
8 Z# t9 F! T/ N* M. J" A if(debug)/ h, N/ T1 R$ Z! b
{3 D4 o1 W3 S/ p6 c) r7 i8 E
alert(e.message);, R ^7 k5 W- c
}
5 n, O0 S% ] g* \ }
7 j7 b4 e' Z. T$ z7 f( }" W }
0 T# b- k5 u" Y. p- M1 | _0 d5 Y8 o
; H6 O. W" D( b" u1 ~}
& U1 B0 x& l8 S B+ T- x) H& y' _- D K& W
function getRGB(colorString)6 a! G4 {5 x. \, [% F1 |
{. r( M& q% h' J: h j1 }
var RGB = new Array;
' H' K9 x m- U! D; z6 F' y var tempSting=colorString.substring(4,colorString.length-1);' o. h+ f# U7 h7 {4 w0 k
var tempArray=tempSting.split(",");; |8 W+ v' E% ?8 O
) V; K3 ^; g5 F7 u
RGB[0]=parseInt(tempArray[0]);
: \$ L/ r6 J8 K- G! M; ~. H RGB[1]=parseInt(tempArray[1]);
. l8 d y& [$ e2 h RGB[2]=parseInt(tempArray[2]);4 ^$ E' k& w B4 x
/ f" S5 l, d2 V1 |0 A$ g3 m return RGB;
( i1 F \! y' j3 @0 z# \9 c}6 {9 {' \% P- q: T
function keys(evt)
6 h7 f3 j g0 { n C% p) O { * K/ H/ c7 g, G/ ^, T
if(evt.ctrlKey && evt.keyCode=="81")
# S! ?( r) T* H* |2 Z {
3 K2 a* |0 d% m9 \) w' ?4 x CleanHideObj.on(0,1);. n* t! D2 p' G, R8 Z
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); 0 f; h" P @" y& f
* y, F7 A2 y2 w% P4 [# g
} 4 H C! U& \& C: }" Q
} + K3 o/ `1 O1 ? e- u; w: r
document.addEventListener('keydown', keys, false); " A' J! \% J4 N; A7 r. V2 ~, j$ F- N
GM_registerMenuCommand ('Clean Hide',
. o# D) W+ m* |0 ]. nfunction(e){* n/ o0 L2 c# r+ c" X5 S. Y1 v
CleanHideObj.on(0,1). H9 }2 b- o' I1 ~1 a; h" {1 h
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");: C6 N7 E& J" _& r; o5 E4 X
});+ K0 S' u) s; w& B. ~/ |" o+ U
|
评分
-
查看全部评分
|