|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 0 i& I9 ]$ J6 R8 n0 s9 y! v1 \
! {- N( B+ c7 `! ^1 z- Z火狐插件,用猴子8 W' ~; a1 B5 y( O
! a0 E: @. e! O; A Hvar debug=false; ' c) c: ?( y" x' V8 Z2 P- ^
var CleanHideObj=new CleanHideClass();
: F- e" l* O2 [) T; @+ g: j1 a# ]+ a8 n$ e, e% c Q
function CleanHideClass() 0 w4 J/ F$ `, u" u- T1 v, r
{ 9 n8 F2 N9 M; A* U" F7 a, R; I, N, N
: p% y2 l# F$ G/ W
this.on=function(id,bMZ)
9 J0 x. M! `3 f* ^ {
0 j2 X8 P- V! b$ l4 y7 W4 W) Q
Q; Q& M- O5 ?) h- P. Q) j if(id == 0)
8 I# J, a+ W; Q' U7 ? {
( \2 Z! [6 r( ?- ^8 H( V7 x var page=/* document.getElementById("content").contentDocument */document; 3 f9 n3 p! H6 \9 l2 O
this.RemoveHide(page,"span");
2 e/ s" p( D7 o& w( ] this.RemoveHide(page,"font");0 `2 ?0 a2 Q, s
this.RemoveHide(page,"div");
8 B; k1 V& @3 }8 h% i/ ^7 l* J* r this.RemoveHide(page,"p");
) B2 l) C' [$ H% d: Y / }$ ~/ j8 w M$ C
}
% r7 I' j" q$ S5 O6 ?: k7 ]
- q8 x# l% m+ P# i. O$ N! g; G: K }
0 m- F! m7 @4 \, Y+ d# q0 ` this.getobjstyle=function(node,prop)
u* m3 E8 }* y( ` {
, E& M' J/ a0 j. U! [ try" K' d" s8 p+ G
{) x1 W7 }7 @; N; t" K% z4 v6 Q
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);* u% \2 B8 J1 j# `$ j$ A) n
}
) ~6 Z: m/ k1 _7 P% t* l9 q catch(e) }, o% v/ O2 M' r+ n
{ m: t4 ~) C1 d( M" ?
if(debug)
' T2 ~) w- S4 P* ~+ `2 U; } {7 T0 e' ?' Y2 G. Q
alert(e.message);
. Y( k% r% [0 d2 d3 _ }
' W7 w& }' K" Q8 j) j1 O# ^* _ 7 l# f' _3 c) f% f; W# ~
return "200";
* R% J, W% V& X( M }! c4 A0 m8 a: K; n f- k4 @: {2 r/ C
}# A1 V. Z8 ~ ]% A& d& A5 G+ ?
$ h3 `, e# W8 m( W( Y- z: r5 l) ~
this.RemoveHide=function(page,objname)
! i4 Z2 ]. c: I2 y" u. E {
5 a% X1 j2 E: L7 Z* ~/ x8 U try3 J( {) U$ v+ ^3 E- Z# X8 n
{
# O% y# {: D+ k' J var minValue=15;
7 } f+ N' U2 k, X+ T5 ~ var objs=page.getElementsByTagName(objname);
% Z/ p5 K) V1 ?+ f" D& k! J4 j/ ^. Z9 {; O4 i
if(objs.length == 0) + o' H7 F! h" A8 l# H( [
{
- E$ P7 p4 I* h- z: ` if(debug)* g4 [2 _2 \8 c2 Y8 l
{8 S9 o" k1 t( a0 u
alert("no object found!:"+objname);. P. R; A9 c$ J1 f$ g! z1 Q
}
) m' F1 v/ p9 _! H3 d0 Y l }- H' {# `7 `+ I8 L+ Z
else
. B& |/ R4 s7 H6 F+ S {: j0 G {
$ s- `/ o" z1 L5 e2 r/ \5 } K3 x & ?& \, e5 @# Z# d
for(var i=objs.length-1;i>=0;i--)
. C. M. @. S* v/ m; y {/ i9 _% ^5 ?( g
var node=objs.item(i);
2 f0 x* o! d; h 8 K4 e) s T% w) Z$ q2 [, R% n
) x. q7 { k8 p! ^( I if(this.getobjstyle(node,"display") == "none" ||. z5 N6 p" e! c3 D4 Y$ z5 s
this.getobjstyle(node,"visibility") =="hidden" ||( R8 s1 M$ c) j+ _, a, o
parseInt(this.getobjstyle(node,"font-size")) == 0)
/ v# Z. x0 h: z+ `) R {3 y" [/ b- ?/ C3 b+ b; [$ f6 ]
if(debug)" Y- e0 K P* ?5 W
{( \& P& V2 J' c5 D% x8 }
alert("remove invisiable!");- E5 ^ n( o/ J
}0 q3 q/ ~$ I& x
node.parentNode.removeChild(node);, ^2 X5 f6 E( b. C( x
! d" V6 g( Z( v1 u) z2 G }7 n1 l+ Q' O( n
else
9 @1 v) u7 x4 _8 {- P' o- Z {8 D% ~* [, s# s/ W1 r+ ?
if(node.parentNode) * g. O/ h1 D+ k
{
& K% ~# B; u4 d6 p6 \ Z3 \ var orgNode=node;
0 `4 k7 Y0 p9 x var orgColor=this.getobjstyle(orgNode,"color")
* G/ f- s; o% m" n! Q7 Q0 }: H var orgRGB=getRGB(orgColor); 0 x1 z! F& L( f0 F7 |, q/ H2 C" n% F
1 ` g/ T% Z2 Y- F
var parentNode=node.parentNode
8 c7 Z4 M, e; D2 A! V var parentBgColor=this.getobjstyle(parentNode,"background-color");
) R! m. g# v+ k1 x2 T
& {1 ]* v' p7 b6 l var isLast=false;/ b8 M. C) m: W
' {' _# K+ }; F1 \# ^4 H while(parentBgColor == "transparent")
3 w- N+ E! T: } {: [( K* V+ R" o6 ] L8 k k+ @. W
- n! T" z6 Y8 V) T0 V/ v* x3 O4 O( O
9 D9 w8 W7 k2 Z; u Z if(parentNode.parentNode == null)+ K! x6 @' _! q. D; Q8 v' A
{
8 o/ |1 l) R, t7 z- ]. L! U isLast=true;
. F& _$ s) }* J8 o- _% f break;
9 q- z; h2 t, I J4 p! l7 | }8 z- N4 i0 F4 q
parentNode=parentNode.parentNode;/ D& h$ x5 A& J! N
parentBgColor=this.getobjstyle(parentNode,"background-color");
: g! t+ B& G$ c- I3 H3 g9 c% q& h' `
if(parentBgColor != "transparent") / y9 i @# b' B# p
{
6 g% _* L! y- }0 t% w3 t N break;: e/ w5 v0 A4 E3 D1 f
}
) ]* _, ~' p {3 p% n$ M! v }
: M) j; E5 B0 A1 E) F' k" z# b% F if(isLast)
+ ~, f q& ?* h7 t: i. p4 a {$ D5 c8 f3 f' D4 Y5 t
if(debug)8 v* u! ~9 p. J1 _) J
{
2 W$ w# I) |" V alert("last!!");
% z& j+ [% q9 s, K7 y2 K }/ X. j" E" q G! Z
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
, K, P. Z$ b& m$ I+ i4 l& _# x {
: }! i& B" s2 E' p orgNode.parentNode.removeChild(orgNode);
8 I9 d1 L" ~! G1 B" o2 p }& |) q) \* b6 K. l* y5 w
}& D* K9 U5 O& q1 p: @9 ~% k
else
4 X" q8 A! }/ Z% V; L {. n" t' J* F4 p
if(debug)
$ Y- H* h) }' ~* c* T {
/ z- X u2 ]1 S2 R' @# U2 b alert("compare color and parent bgcolor!");
4 D6 L& c9 v3 x! w8 C. R }# e- B1 r0 v, j# w& k0 h5 p, V$ `
parentBgRGB=getRGB(parentBgColor);
* K8 w2 Q6 i9 S0 e2 K, n! ]2 _ if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
! e8 \/ I' P+ u) b {" s" b* i6 a8 p( ]# D/ O
orgNode.parentNode.removeChild(orgNode);
0 b# h8 H, V. ]4 U/ E$ U }. X4 r) f. w6 @% Y; w, u& F! q: ~
}; s% C2 G$ b* Q6 p6 g y
}
* G: H# p v3 n$ e0 W }
9 T9 ?/ X5 O( z' U* K }
0 n' g9 [1 B1 Y( @" n& j }
, X; n! o9 B: m* d$ {
2 I8 w- I. _0 K
1 V# d4 a& i& r( g1 Z4 E7 G var itemFrames = page.getElementsByTagName("frame");6 b! x; q2 C; `
var itemiFrames = page.getElementsByTagName("iframe");
7 {* K- r; p0 e; r! u& R& k' P# f
O9 a% c( j* K1 {( ?. S; p# g var frame, iframe;" e$ {, f' o# ?4 W" B5 G
if (itemFrames.length > 0)8 y' O7 n8 x, V8 k$ s# Y
{3 Z8 r8 U4 |* P8 m/ k! ]7 n
for (var i = 0 ; i< itemFrames.length ; i++) : L& \7 J# ^& r8 S# E
{
, B9 y7 a* s6 k( `; b$ a frame = itemFrames.contentDocument;
1 i3 N" z b2 z& D5 i" q4 e( j this.RemoveHide(frame,objname);
Q& Q& X! C/ ^5 c$ { }
8 ]' F2 h4 U$ p9 D7 U }$ h" ]4 ^# J# N5 C4 y1 z$ u% M( _
if (itemiFrames.length > 0) L) ]: z4 ^! U0 U- K
{
6 O. u/ L, y1 r3 S for (var i = 0 ; i < itemiFrames.length ; i++) 6 M8 d! m) K3 Y' Z. Z: }1 Z- v
{& c, _& `) _1 C+ M
iframe = itemiFrames.contentDocument;5 F" q* A$ o, {+ A2 z, F9 ?8 d" o
this.RemoveHide(iframe,objname); ; B9 a$ e, x0 d8 t. p
}+ A1 R. m6 U3 z
}" R5 j& U6 e# m2 X$ w' ~
}
! {- ~' N6 S, ?% h catch(e)
; S' }2 R, B! j5 ]6 E- e {
/ p: m- f$ H$ E) I0 T V6 L# H if(debug)
" t- V" f9 [1 `" x) b {
8 F+ c0 Q' s2 r3 {: s alert(e.message);, ]" B' K3 }! }# y0 S; ~6 h+ Y3 Y
}
0 V1 M7 H" l0 _( a% E8 x0 Y }
6 c* i; M m, t/ @. S! v }/ q% X9 I9 \* `1 \$ ?
" a5 c9 C8 f h8 c' \ _}7 I# M% ~6 b3 n- u
$ Z, R: a/ Z+ J. sfunction getRGB(colorString)
( q8 ~1 l/ d6 t6 L. x0 ]{
) @$ u% p) {; Y- O% w" } var RGB = new Array;) [9 R, A5 B: a3 h5 a
var tempSting=colorString.substring(4,colorString.length-1);
# }8 L+ e) T7 f) Q9 O var tempArray=tempSting.split(",");
: [ X6 T" ?: L) H( m& m; e# R, u. L1 V! I, _0 x
RGB[0]=parseInt(tempArray[0]);! u6 @) q" N( o) B6 @' m+ G
RGB[1]=parseInt(tempArray[1]);
6 ?! _3 a+ q2 Y4 W RGB[2]=parseInt(tempArray[2]);
2 ], Q* }* t- M7 g; D4 I* f 0 Y6 |& E+ {0 S
return RGB;
& d# B$ ]5 o. x2 v}4 o" ^2 R0 @, y3 a
function keys(evt) % I& ^! D/ @& _7 d# Q- T/ _6 t
{
" B+ X; {& x) ^3 \ if(evt.ctrlKey && evt.keyCode=="81") - B! u/ O. @; @% s1 m8 @7 S
{
% ~/ R+ W. C" p CleanHideObj.on(0,1);5 L# a" f! G2 {# X! X' m
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); % ~1 ?; B- K& }3 M- }$ b
* ], w a0 w* a! _
} 8 g* `( E) |2 Q* x
}
- M7 j; y/ Z5 T- ^( H. Pdocument.addEventListener('keydown', keys, false); ; \; J5 M; H/ [# o% D1 n. i- z0 g6 W J
GM_registerMenuCommand ('Clean Hide',
' J1 @( Y% z% Tfunction(e){3 ]$ u8 q9 T0 ^$ C. i `& O
CleanHideObj.on(0,1)/ l3 i8 n, U( g2 m7 O* H
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");6 F; ~5 f) l/ q$ o6 N; X. K
});* T& T9 @$ ?! _# }1 f. G0 ?
|
评分
-
查看全部评分
|