|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 4 A9 e; y+ a w/ e
; }4 ~, B3 s7 G& ?% q5 p0 o8 q火狐插件,用猴子
# u+ O$ U1 J* g' W0 T# P
. o0 V1 h) X: ?! T/ k bvar debug=false; 0 S/ P N3 r1 E2 e. r* b1 s
var CleanHideObj=new CleanHideClass(); b0 c: K' }' ?2 L) y, r
% W% X! g. q6 T0 J6 N( efunction CleanHideClass() E" U6 g2 q# \% g
{
! J: B$ Y! b- f 2 o2 z- N* g/ t+ ~
this.on=function(id,bMZ)1 I H1 K+ _: C# D" {$ u- d; c
{
% G3 |. O D) t2 D
- e t, K& A/ w, E% s. ] if(id == 0)
" ^( M( C, N' a% N* J2 L( l3 Z7 G {7 ? n4 c7 b1 M1 z0 B
var page=/* document.getElementById("content").contentDocument */document;
) ]( \: X7 O! L' N2 ^' @ this.RemoveHide(page,"span");. z1 I8 `6 ]8 {" ]0 K* ^
this.RemoveHide(page,"font");7 Q6 d3 x! A; T# d
this.RemoveHide(page,"div");. v: _7 i5 `% N8 S8 R
this.RemoveHide(page,"p");2 ^$ j- J1 _, h/ f& Y) W
! v1 `# C9 ^- r6 j$ L+ J }7 K% l6 ^- I) ?% d3 |* h
9 P2 ?# v: u- W! j' ]( L }
. W3 ?$ }# }0 f5 N' m1 Q this.getobjstyle=function(node,prop)0 Q# e! z: ~" D2 Y6 x9 \
{
% Y% I# |5 N0 ~# }0 Y1 ]7 d6 U try4 m/ v$ x8 _- [, K( S( y9 p
{
1 A$ ?4 h8 z* D4 C, X( |7 C return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
# b+ c# r, [/ [% H2 \ }
* B2 q7 k2 t( _$ ~5 A0 f3 n catch(e)* N! X/ |4 o- Q4 Q7 J3 [
{& G; j; x& V9 M& m- X4 s8 t
if(debug)6 b8 ~7 q# y& s; \7 f! g8 b8 ~
{
; @+ A& \4 }' i: g( a! a4 C2 V# _3 e alert(e.message);
) T' s$ U0 u s9 T7 { }3 ?$ I$ e8 O8 m4 a3 k/ F" b6 e
4 o6 b* s( L3 _
return "200";2 K, k8 ~; b6 T
}- L: j1 X- @+ u' d m& b1 Y
}
; ]! {/ x; u$ Q0 f- v. E
) f) l/ j+ ]& U2 J this.RemoveHide=function(page,objname)6 n5 u( z2 N& D2 {+ W5 w9 C
{
- m8 ^& ^3 r% m+ v) ?9 Q4 a try
( ^* m \- ~/ W& ^( V0 _ {
" h; v$ T5 ~5 B1 F# H" E! M var minValue=15;5 ~7 F0 R- G3 M6 g
var objs=page.getElementsByTagName(objname);
2 W" p7 K' C7 q" T0 V
1 q* ]" \. L* ?/ S9 `0 P if(objs.length == 0) 9 x, s( f( j! ~. |
{
7 M( @5 |, t1 T; \ if(debug)1 U( [2 r% _) x# K. e
{7 d M6 k) N+ @0 _7 u% L, _
alert("no object found!:"+objname);. Q; F& Q9 T4 p; b7 p+ X) y) O" \
}
" f$ T: Y$ _# A1 q }
& U& P/ k+ J. u2 ?) K else0 F# a5 N( ]( J9 \9 n! o* Q
{
3 Q ~$ ^7 s$ l, Y/ t* v3 f7 L5 U
* R' K: o* t; k: | for(var i=objs.length-1;i>=0;i--)
; G. W. V- N2 ]+ x2 I* D {
- ?3 w; }! Q1 j" l S, G var node=objs.item(i);
7 m' r! v; v% D3 j u $ X! ^7 R$ [3 j" a7 x1 ~+ j" k
& J- f) {# m8 a: u# w2 W- R. D
if(this.getobjstyle(node,"display") == "none" ||, R$ ?/ l! a. i6 B5 z5 I
this.getobjstyle(node,"visibility") =="hidden" ||
9 O) `( f; s! f1 }( k0 u parseInt(this.getobjstyle(node,"font-size")) == 0) , E, j$ M2 o* ~: A; b9 ?
{
7 p1 X4 ^& I; p# I if(debug)7 _. P$ \% x5 ?' U0 O
{1 o7 Z& Q: E4 t/ u
alert("remove invisiable!");$ `) H: K# |+ W- t* G: K% H4 a& n
}2 M, d7 r1 X% J* B* q8 F
node.parentNode.removeChild(node);" K) O: x4 T; Z, K* g2 W
) q9 L: e! T, N }
$ @7 | W% m' f6 F' X else 1 s9 s# u. v: w) U+ ?8 G K; B
{
) W6 \# K& x4 m3 @0 B! f: g0 q if(node.parentNode) H# F, R2 J0 w' ~. o& I' w
{
" d8 s, @) V7 \/ J var orgNode=node;! O6 ?2 ?6 ^5 @7 g% k$ O# }; O/ W# c
var orgColor=this.getobjstyle(orgNode,"color")+ D/ h* l- b& ]6 ^4 n, v
var orgRGB=getRGB(orgColor); ' f, {0 S1 d* w q/ ^$ C
/ h4 T' S( F; R! q. H9 I var parentNode=node.parentNode8 W1 Z+ r" O4 W5 Z Y% V
var parentBgColor=this.getobjstyle(parentNode,"background-color");3 W C4 ?7 f+ N I1 {5 G
|* Y% @/ `1 X( W( ?! L var isLast=false;
- r6 l# K2 I' P* C
" C& i7 D' H0 d" F while(parentBgColor == "transparent") & `+ A% m$ J9 Y5 G2 {1 T
{) w, f+ m+ c7 w9 S, v: x' s
# ^7 j9 {: s) r
3 w0 [+ Z+ M9 s# ~ if(parentNode.parentNode == null)
0 O f; o! r8 W3 L1 s {
, [/ K( t4 G- H; s+ x( k isLast=true;% G3 T5 }' P5 P% _9 W" c/ [
break;
) O# \. |4 y3 ] w4 H9 L- h' B }
- Y* j; R; [9 N5 s parentNode=parentNode.parentNode;3 N) d) F! y6 ^' N+ E$ T
parentBgColor=this.getobjstyle(parentNode,"background-color");* G6 x- u+ i; F# K) u
& p8 T* j$ t: O! B4 G; l! ] if(parentBgColor != "transparent")
% @* j$ ~# x5 y6 x s1 o" y6 r {7 m3 o' x) m* F% H$ S6 w$ _
break;
& h. x: p; R* R% D. D! }+ @4 g }
4 D7 P0 T$ }' | }, Y' k$ U3 @* i7 l3 d { e
if(isLast) 9 e- S+ [" r" U* i r
{0 B6 h; H7 V! i4 D
if(debug)
6 {$ O" x7 s. R! E- p `4 m* G& Z {" x, N, v, y0 e
alert("last!!");
- r) |! q4 X: K u+ X }
: ?" U W% \4 t5 H" `3 t if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
" L% n4 s' x- i {1 p) _. a t! Q2 b- }9 l
orgNode.parentNode.removeChild(orgNode); $ N+ c. ?( y3 C# q
}0 ]/ a- T$ o' J- @$ S
}' n# h# Y* g; B" q6 a
else1 K$ G# D) J$ `- b+ F/ t
{
' R1 s5 _; n- K, e5 W; k if(debug)
8 u0 R9 L; w6 W4 ]8 u; ~1 P+ N- B {
: P# o/ y \# G* \+ Q alert("compare color and parent bgcolor!");
% E0 C8 J; L: \$ ]6 { }& B6 v# Z( a$ K7 X+ y9 E0 y
parentBgRGB=getRGB(parentBgColor);5 H4 o7 g7 a. `2 e6 U9 Z f. j
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
! M& t, K# d9 B, S {) c! n: ? T& c' b9 ~* |& M! [
orgNode.parentNode.removeChild(orgNode); ( q. W# e M3 @8 ]
}" Q3 F$ } M; a3 U
}, n4 B- z* e6 m
}
' h, s& m1 U2 ~2 B L2 C7 [ }6 u0 U1 ?4 w- M
}
4 c- S. y& d, ~+ ^ }: v5 M3 k, B9 o" m- U/ C+ E! d* v3 |
+ ~ `0 j0 F/ d( s( P
! X# y! x; Y4 ~0 U* @9 O x
var itemFrames = page.getElementsByTagName("frame");
; |! m0 _4 v6 U+ g) x' d var itemiFrames = page.getElementsByTagName("iframe");& q5 n+ t0 ]4 ], g
8 h' W) N- _: K3 Q4 C% @
var frame, iframe;' h5 K( k- P0 _0 Q+ F
if (itemFrames.length > 0)
. C1 j/ y# _0 U+ o1 S3 i9 B {
6 u9 h+ c8 I1 {+ a5 w for (var i = 0 ; i< itemFrames.length ; i++) 4 I8 D) o5 v% n, ^: ]9 i
{
; X) y/ R2 y- U# `, V frame = itemFrames.contentDocument;6 |2 J% G: N# O; r1 `9 C
this.RemoveHide(frame,objname);
) B' w' i4 ]/ f5 m" D/ L6 G5 r }* S! H. G4 |0 P8 N/ Y
}- Y$ P& ~, Q, l+ O5 V4 T8 B1 ~
if (itemiFrames.length > 0)
- z9 v" O8 Y9 m0 p" |: L) K' t) \ {8 ^. \$ [2 H# x
for (var i = 0 ; i < itemiFrames.length ; i++)
0 C& ]3 h5 G- x9 Q. O. W/ k {# q+ \% y6 E; e* e) {& D
iframe = itemiFrames.contentDocument;
) Y5 L1 {& i* j this.RemoveHide(iframe,objname); ( h& }8 s- I+ g8 r
}% F% l2 H7 W w l7 u; ^: G
}+ n- ?* q" G9 |9 A0 o
}
4 S9 i& z" R- x( [' h9 f catch(e)9 j5 W9 G1 p0 s o. N6 z: c
{
, b2 r/ V5 `& Z4 v1 `0 k if(debug)3 G4 Z$ E; O+ f2 A7 h5 @
{! y- N) b: }5 ?# j4 G2 h1 C
alert(e.message);
5 P6 [; g! M/ V, F1 t0 r1 ^) F- F }% |' h6 i! W( s1 ~; R4 v4 U$ W
}/ P! D7 q4 P4 K0 O
}! {; W) [- J$ V7 Z. I
$ D& n, J6 _6 E5 c m}! f5 \% v9 y% t
2 v% S# {1 s' S6 I" ofunction getRGB(colorString)
2 y) C- E+ W* G# e0 z{
. g3 M* |3 k- `& T( }% G9 ~2 R9 m5 @ var RGB = new Array;$ k& W" q+ M' p8 ~3 G$ Z( b
var tempSting=colorString.substring(4,colorString.length-1);+ @1 y* H% t3 k5 G8 S2 L8 q
var tempArray=tempSting.split(",");
- V9 s7 Q! M, V+ @2 J! y6 z5 N1 F, S5 p
RGB[0]=parseInt(tempArray[0]);
% m2 J) h8 A2 R6 _0 ]7 O RGB[1]=parseInt(tempArray[1]);
9 U& R9 U& W; Y8 v* t' p RGB[2]=parseInt(tempArray[2]);
! p. Q0 S* F9 a ]2 P% R: [ 3 P+ n$ p; ~* z" D; ?
return RGB;: X& B" x* V% O% k* d& l- l
}
, ~0 v$ @4 A& M. qfunction keys(evt) 7 g) Z. J9 q9 ^( k
{
& g+ g6 m! ^/ D$ i: e+ r if(evt.ctrlKey && evt.keyCode=="81")
$ q0 V# ] t# m' Z { 6 K! I7 S# G6 u3 ~* a! ~
CleanHideObj.on(0,1);# J' m, v+ Y) u$ m: A+ c
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); 4 f8 u9 |* V& L# E
* u# X2 @) b* C0 q } 5 q/ B; Q: N# g& V1 l7 l
} ; F& d/ P+ a1 z7 J, M% h' G
document.addEventListener('keydown', keys, false); ) y$ W0 c/ l6 O2 b
GM_registerMenuCommand ('Clean Hide',
; R3 {4 b5 `# pfunction(e){
1 G) d/ G% O9 Y7 A" e5 mCleanHideObj.on(0,1)
& d$ s' F* _" O& F9 h; e7 ]+ {2 t- Galert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");7 g# \7 M0 e" A, o3 e
});5 y7 M( J- n, j1 G g
|
评分
-
查看全部评分
|