|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
! W- w: B3 b3 f# q/ j) f1 T# U1 H
: r: F/ [' a' b {$ r. {火狐插件,用猴子( H0 V* |# t* u7 a/ v
" o8 M7 v1 ?& Uvar debug=false;
. _2 q5 [( K3 F l! gvar CleanHideObj=new CleanHideClass();9 l. ?1 w5 `* b; ]7 D* n
4 g, H, T! m+ e, N* D5 L9 `
function CleanHideClass()
! Y N% p, P1 }) P$ \( F! A$ i{
" J6 C5 K# s: T# z2 k * H2 o) S0 Y& H
this.on=function(id,bMZ)
, Q5 V" f& v+ g" C( Y {
5 e/ e' K% A; D U U% ^/ n3 u3 B3 h
, t! d* j! U/ @7 D if(id == 0)
' }9 m' ]/ m I! g- z! X6 c {
6 Q, |8 t% U- c) g9 S1 m var page=/* document.getElementById("content").contentDocument */document; : P( z' V& [+ S' }( h8 {
this.RemoveHide(page,"span");
* g- m. b x+ `4 ?# G* \4 Q this.RemoveHide(page,"font");/ z5 L$ }1 S& z7 u1 b" X
this.RemoveHide(page,"div");
1 I- Q6 l' m; d: l; B this.RemoveHide(page,"p");
4 O1 T& e- V, t2 U F2 y 9 u0 I: o( I0 H; f9 S
}' O b" S: F+ L: n
9 |# E! `* @" r: s
}; V! T, {7 w. g) Y) x# Y
this.getobjstyle=function(node,prop)
5 U: V: K3 O8 N' W {
, Q" q0 O% Q- M' W0 S+ X( A try
# m& J! s! w$ V( O2 W {
& b( `/ ]- X% q return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);& o' U* M: ]) J5 L" H# x
}
0 ~7 g) @. [+ z# B catch(e)) h) N: r5 _% O+ _9 _
{
; k) p3 [6 N' w3 s; A if(debug)+ Z, e, r# c/ }% r/ ]2 l9 M7 @: A
{
) s* z K% j7 d$ a7 S# o alert(e.message);+ b2 G/ t. b" Q9 t3 L7 B
}' O( v: w8 Q, @9 d% K& G
' q9 o. K4 }3 c6 ?
return "200";
' l5 Q2 r; E& T) r$ {% P$ u9 r, u; h }- d2 H& n1 e1 ]) ^* _) S4 m
}
7 d+ C* U0 h6 l/ g
" X. F' a- z2 B4 k this.RemoveHide=function(page,objname)4 I4 c( H" c" r
{3 x( G% s6 c0 V, C+ v/ r; k- K
try
$ H/ Y( m, W2 o _/ y# X3 D5 } {
- J6 l3 l6 n( m var minValue=15;/ `$ j8 I) a! C, n" ~0 I
var objs=page.getElementsByTagName(objname);
, m5 Z7 I$ W4 m* @( n
Q' h6 [% s% x5 a( @3 P+ O3 T( H if(objs.length == 0) 1 j% E. r. d1 C5 Y2 d1 P- n9 Y
{) O, Z4 _# d& D h# x" s# D: }
if(debug)
3 J- w' h# h& L2 N2 q {
& j( k* ?+ N: ~/ b$ C6 H5 D alert("no object found!:"+objname);9 f$ {" s* _" `
}$ g. B9 X; s5 B" d2 n
}- T' s: v8 c7 F, U
else8 c2 f V' g' a7 X Q$ b
{
" b8 J. l9 v) A a7 J* k# l/ z! c. v5 I ' p! t$ a" Y; i, j
for(var i=objs.length-1;i>=0;i--)
6 D) p7 g# q, G6 F {
0 X( ~" T) E, `9 ^8 G9 L8 b$ U5 M9 B var node=objs.item(i); 7 z1 m3 |8 K9 v. \
; _: l4 g `) Q5 J& U - A3 H' c7 G w" H! c1 u# s* s( S" }
if(this.getobjstyle(node,"display") == "none" ||
. `3 x7 {) x9 z: p y this.getobjstyle(node,"visibility") =="hidden" ||- V4 e$ B0 |7 Q# \, |
parseInt(this.getobjstyle(node,"font-size")) == 0) ' H( R: M# C! h4 r
{; T/ W5 t2 D6 U& k
if(debug)
5 \6 x3 j, t# W4 k4 o- y" t: p* ~ {
4 X0 v; m) s: R" s0 \8 H# G# X alert("remove invisiable!");
# s4 @* d2 b, h/ {, S ? }
) h+ F! [5 [1 [7 B" \6 { node.parentNode.removeChild(node);
& m$ `( q% I6 h, w4 q- M
8 u" f3 ~: k i7 B; a }7 [ i: O* \+ j* G
else
% A/ B5 e( Z8 {/ {8 F K5 z {6 O6 `) D/ `$ n& l
if(node.parentNode) $ A3 b( j$ |& d! T) c1 t
{
2 D3 O* A; Q6 Q& G var orgNode=node;' p* U6 P4 S; S
var orgColor=this.getobjstyle(orgNode,"color")
: G% ?( E/ v5 g1 _9 E$ v var orgRGB=getRGB(orgColor);
( W, B u# X% Y! X; O , k1 m7 c( T2 |8 C& [: H( m
var parentNode=node.parentNode' f+ s- ?' R0 e g( Y* V1 R" T
var parentBgColor=this.getobjstyle(parentNode,"background-color");1 @2 D! H& u7 t/ a! F. h$ |/ c' o9 ~
1 w: Q9 o5 W l2 E% Q var isLast=false;. k" a$ k' {$ S4 t6 E) N( f/ E2 F
1 x9 @: u O' h
while(parentBgColor == "transparent")
: A0 W4 t! S! z. g s {
& {: e4 l# B3 R( D8 T2 D1 ]& A ( K+ D, f; m; a
0 {) @9 a ~! w, D
if(parentNode.parentNode == null). v0 n6 j' Q* u- x2 N {+ T
{
$ D" u" P5 H- N) B2 ^: Y; A isLast=true;
' {1 [' a( ^: D break; \1 Q% q4 L. Y
}
+ e# n9 O2 C' Y( T parentNode=parentNode.parentNode;9 K$ ?3 ^! t) }0 q& p; W3 f
parentBgColor=this.getobjstyle(parentNode,"background-color");
5 _6 ~! R' W! [1 V6 W, m6 D
* _+ b$ a: `& {0 f7 w if(parentBgColor != "transparent")
. ]8 \( m/ o" I: p) U {
0 A( G* x p4 B6 A! g3 s3 ^3 u break;
0 K5 L( A% _/ F+ h/ X8 Q5 k$ ^ }
/ H1 Q) M: ?8 M. k5 ~ }, w) w" e8 v2 f. N* P$ t: a
if(isLast) 1 C6 H0 a' V5 h4 w8 ]. T
{
; F, r# z: q1 n/ G Y0 ? if(debug)' S1 _$ B; \: p
{. [8 `+ c$ S+ S
alert("last!!");4 A2 n2 g* ?, y- Q& @
}( Q2 R& d' P d
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
3 |- F% a! Y6 u3 i* q5 c {
! F% f2 V% E6 ~3 a orgNode.parentNode.removeChild(orgNode); & s, l- h3 O" U$ q: N
}
3 ^/ l! r: @2 J$ c8 D# a }8 u& t2 D: t& w( a
else
+ l* }9 e6 q. |0 _2 t {7 Q4 \( T3 T) c" N
if(debug); [3 L, r5 ?4 _% Q
{
4 ?# x+ B$ ~' |& p alert("compare color and parent bgcolor!");6 B; n2 j- d5 s6 D, I( _: s$ h
}
, i% k& I8 t2 ?4 f* O% F& n O- P+ G parentBgRGB=getRGB(parentBgColor);
8 v8 F8 W: _/ P, c5 e$ S2 _ if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))2 o! G* j' n- q
{
2 {" O# U2 J7 L- [, _ D orgNode.parentNode.removeChild(orgNode); - x, _8 h1 G8 e2 ~. Y( Y' W* c( [
}
$ R2 |+ ~# E, F$ k. a7 S8 [. _ }5 O3 A; y$ T1 ?7 ]& z+ I
}
/ K2 |1 S" L9 o! C c# y }
8 h/ i9 n* Y+ ~9 O: i6 T }9 K; Z( \" d- h
}) o9 L) g1 L: Z) x: r
7 A3 m+ Q- B* P3 U, S) o
* t* c& L" V' Z: H W
var itemFrames = page.getElementsByTagName("frame");5 q0 o- X; l9 W6 ~& t/ v$ y& W
var itemiFrames = page.getElementsByTagName("iframe");8 ?' Z: u( H% V
1 W3 T D/ e- I7 J. w
var frame, iframe;
! `7 B! q% e! T9 V b if (itemFrames.length > 0)
+ Q3 I7 O' p( b {" r) l8 a2 `; y# o f4 \* L
for (var i = 0 ; i< itemFrames.length ; i++)
9 P) S% g7 r, g: I {
3 H8 z( n: s7 l& B: v- a' { frame = itemFrames.contentDocument;
' S4 Z! |/ |; z this.RemoveHide(frame,objname); - g" v" N: m/ I8 K
}
) B9 `! x$ A. \3 Q( U }
/ q( Y; k% ~' ^! u, n$ k, h8 d: L if (itemiFrames.length > 0)( f8 Z) X9 }9 ?# Z
{
O! A0 R+ k& p( u) T for (var i = 0 ; i < itemiFrames.length ; i++) & x* h( _* H9 I9 t7 T. Y' h% E
{/ V( B! m6 R5 O0 D. `9 y
iframe = itemiFrames.contentDocument;
9 L# ^; T# |" p# t this.RemoveHide(iframe,objname);
/ b! s( g5 f* c2 a7 ~; | }5 ^ Y6 Q9 i' N6 y+ I$ Y. y
}
# P, A& w# w3 h8 o }5 ~0 R- K6 ?) ^& L! z, D# J
catch(e)
4 z) T, Q; ?; a! o, a q: j. } {
" B6 x5 S- N& m4 c* c/ ~8 z3 N3 N9 e if(debug)6 `! I; \. K1 E2 n m! S- v
{
w1 I8 O) D4 O& y; Q alert(e.message);
3 z; u- }8 i6 p. x S }
! r2 v% H0 C. t" D }! n# K3 X+ B3 q+ q( i+ P5 Z9 y
}5 h+ ~+ e, I+ ^2 e: Z5 |
8 G4 E2 a3 Z6 S+ E: L
}, H$ ^, _: x8 B' J4 j. j) [1 [( c8 c
$ @% ?. S$ j7 N/ v1 }3 \9 `function getRGB(colorString)) R# _& l- P7 t) H' a- M0 J
{
3 S1 R. n; S6 ]4 s M var RGB = new Array;
& `: W0 a/ K% H0 Z. G- o2 x var tempSting=colorString.substring(4,colorString.length-1);% f& B8 a3 t6 l0 i! j8 ]
var tempArray=tempSting.split(",");
( N( T! U- H, U3 V. a
, X* a( l- k) Y. }$ d RGB[0]=parseInt(tempArray[0]);
/ i8 N/ u7 U* h @+ v RGB[1]=parseInt(tempArray[1]);
1 g5 v3 m7 W9 M) [ RGB[2]=parseInt(tempArray[2]);& p/ T7 J/ e3 f2 B o! d; _' g
E, ^ I$ U' @1 ~$ T
return RGB;7 A2 v' d) U- a( l2 l7 c
}4 g! K4 ^5 Z6 M7 w
function keys(evt)
1 _, T( f* Y8 o6 \, m; r { * T7 D* t" `/ I# h* h- c
if(evt.ctrlKey && evt.keyCode=="81")
* Y; Y# h6 _/ Z { ( L' V$ j1 ^ ^5 z1 `
CleanHideObj.on(0,1);
* [) {3 z! U' ]6 p2 C alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
3 z. w: @6 C' }/ D- B8 U: P3 F7 q) K! L
g; \' y) E. G8 F }
; M7 H9 y- t9 I6 T } ( t9 V% ]) `6 P9 G1 H
document.addEventListener('keydown', keys, false); $ @& g. d8 M+ ^. v( {
GM_registerMenuCommand ('Clean Hide',7 q) X3 s/ p5 p+ l$ ~" g9 K8 w- P
function(e){
! [) v1 V- F1 h6 o1 TCleanHideObj.on(0,1)9 ^/ M$ Q t8 r) z( C/ ^
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
3 O4 R5 T3 L: x' z6 @1 J});
V4 k, c, K( M! O& y |
评分
-
查看全部评分
|