|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 ! ]9 t7 o; ~) x a) J, R) Y- u3 I
. ]+ {0 t- N: L( ?3 {. C$ i
火狐插件,用猴子
% j& s; W# y2 X4 L$ _# W9 s" { t. g- d9 F7 L6 P6 V, z4 N
var debug=false;
4 \- K; C* A0 @6 w$ \var CleanHideObj=new CleanHideClass();
& O' F) o. m! f* ?: z R# N+ e) R2 D5 R. U. a+ C# L; M" H. T
function CleanHideClass()
+ F2 |; z; e8 m/ b& Q) ^( a- R$ l{
]% y* A/ Z* D: v0 v! i7 S: T# r
) y2 U. }4 [& ~/ N/ r, O5 Q2 a this.on=function(id,bMZ)
' n( ^& c" m/ p9 _ {
2 {2 Z1 @* t! _/ Q , W0 F1 u8 J/ ~4 | v, |
if(id == 0)' N& x s0 T# d! F. ]4 ^
{
) Y( b( \* J" f: Y var page=/* document.getElementById("content").contentDocument */document;
! A2 i! G! h- a this.RemoveHide(page,"span");
' F/ U, X* n' n0 C% A! @' _1 V! `4 P this.RemoveHide(page,"font");
( p6 {9 v$ m) n, w! h this.RemoveHide(page,"div");; l, r2 [* c6 ^( h# t; D
this.RemoveHide(page,"p");
! |9 {+ U# |- q X. g# k
/ f# k y( E: V3 t1 e }
" d* H' o0 e. [2 j7 C4 L4 a # S& m# q# D }9 c6 O# r. ?- ]
}
: q) u' N) P, F' X* H this.getobjstyle=function(node,prop)- @9 r7 q( g$ O: Z c
{ d A% _7 P8 M9 R+ q( I
try6 {1 _; z$ t9 y* I: C
{9 O: z. e& Q/ R1 d+ [
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop); _+ A. [: s! [3 D
}
7 J) a7 e) t h; Z) W7 e& h+ _ catch(e)
6 Q8 D9 N( s. B; p8 F" v6 w {0 x, p* D4 p8 r& d4 ~. w
if(debug)
) m" o/ m' x2 Z% v; h {) H* h: ` P) a# g* L1 E/ S# e, t
alert(e.message);
4 X& D) m" W- |' u }: I8 ~7 u9 z2 s$ J0 U4 ?" v/ H! z2 J
1 t5 O a! K3 U& l9 F
return "200";
$ K4 J- c/ x& u$ I }2 m7 s$ a# Y7 b% c4 b2 ]& x
}
( ~5 x; q" Y" ]4 t * C! G( X- P$ r
this.RemoveHide=function(page,objname)8 w) t& p/ ~0 a% l k9 b
{( e8 ?* l9 o2 C
try: m3 M, Y. S( Z5 h: c% y6 M
{
4 v) q4 e/ w* {& ` var minValue=15;8 Q7 ^; x0 V( R9 l: C
var objs=page.getElementsByTagName(objname); 4 R- v. u* x3 t8 d+ J
% a# S2 |3 r; h5 U7 g# n! t
if(objs.length == 0)
5 @$ L N" L# M1 `- } {* c; [, ^* G" U! p. ^! H) T
if(debug)
1 k* S" Q* a8 R/ G9 N {
- M1 k; ^& q* V alert("no object found!:"+objname);$ Z8 [6 a4 s T; h$ h
}
+ @$ p; O: @+ A) f }
3 R6 R! |8 G# n% T* m$ X6 I+ E else
& U% I* T; c* |/ h9 s2 x) A {
}- m3 u" |; M1 _% i" i1 p
$ U$ {4 t, r% n7 f! b- ` for(var i=objs.length-1;i>=0;i--) " t- L( Z. m# B+ `% A
{
; r$ D- k7 H/ c+ U/ G5 J, p var node=objs.item(i);
6 m9 Z7 R/ ^. W( s & h d( C2 q4 b$ d0 s
+ ?5 t( v0 V0 L( w& D
if(this.getobjstyle(node,"display") == "none" ||
7 g o+ p' Z; q9 S" { this.getobjstyle(node,"visibility") =="hidden" ||; ?" h B+ `5 o& g, k- T/ n. w9 K6 S
parseInt(this.getobjstyle(node,"font-size")) == 0) " X8 T: _1 G A, K! e! }
{' Z8 M9 h% }$ M/ c2 K2 E; t$ P; Q
if(debug)
/ V6 w3 C/ s7 \; O7 X$ O {
9 w4 ?0 f4 t! L& e alert("remove invisiable!");, O5 w9 J. j/ F; t. b; u3 R
}" f9 Z8 y1 k6 T q
node.parentNode.removeChild(node);
& R! _) w0 S: p& r+ r 5 n! n- }! h) i3 s& [
}
# t# @/ T0 t2 D; E else " ~. E# r l+ M: U& f6 r
{( Q0 Z8 z9 \; G' }2 ?1 e! r
if(node.parentNode)
( Q" {, s; \: i4 ^' O1 F2 B { o8 t6 \' A$ b/ E3 z
var orgNode=node;' g6 q) h+ D' }5 S$ ]
var orgColor=this.getobjstyle(orgNode,"color")
5 W9 s4 v; c% e9 j9 W+ J* X var orgRGB=getRGB(orgColor);
/ f8 g( F1 N' ?" J9 @! v! r * \+ R, |- Y/ l1 b3 S
var parentNode=node.parentNode
8 A) G+ N& r" G+ w var parentBgColor=this.getobjstyle(parentNode,"background-color");
, O9 d( V) f+ v- d , T Z' s `$ L" }! S
var isLast=false;
5 x2 m# a# m% p9 c1 D6 h # b/ m* K" M0 C$ i. i& j; H' i2 L
while(parentBgColor == "transparent")
% `; q! b+ j1 _ {5 V3 Y( a6 g; b+ l; S
7 g4 E$ x J4 `2 v; O" K
6 S% O0 t9 R7 H) V& [ if(parentNode.parentNode == null)/ w. L0 [* }% A X6 S5 Y" ^& s
{
# ~0 |4 k {( E2 k* r isLast=true;6 A9 k5 S) Z% h7 C m" R
break;- n, `/ A3 f! M. K# S* {
}$ Z6 N# G$ X! m
parentNode=parentNode.parentNode;
5 {5 l0 m$ k! `* A, m4 }* w1 Q$ R parentBgColor=this.getobjstyle(parentNode,"background-color");6 I4 k1 G6 D* T6 {3 X
2 J1 j6 d, U" Z4 m( L/ ^ if(parentBgColor != "transparent") . V: n4 w2 y" m$ y
{1 `) h+ ~9 h$ O2 V# U
break;$ p# r+ v4 z3 Z* b& ]% f m
}, N* i, d* P; b) X) i% E
}/ F$ L. G V, A9 F- M
if(isLast)
: e% T0 G, W% P* u% U( ^ {
: x+ F8 A8 O: A5 p: M, J4 @5 G if(debug)
; T6 B. @3 V. r1 T4 B* K {
) p" O* J4 n7 J* Z! _ alert("last!!");5 y6 g7 X1 u& O: j* I7 i
}
, _$ U# U0 m% r: B& q if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
4 W( |- @9 N. l" q& ~! v {
8 f L2 y. d6 r! I9 z orgNode.parentNode.removeChild(orgNode);
. S6 j0 t/ {' l' R }+ j( M8 V0 \/ w# ^' z
}4 L/ |* K+ B( T& ]5 h
else
8 d6 _: [, z. r+ u: b6 z/ L/ S {
$ A% {2 D7 i) x* Y& ^) X+ V if(debug)
, J6 e) A Q, H% n8 h {
; d7 I8 P- `6 |, y1 J2 x+ B+ \/ k alert("compare color and parent bgcolor!");$ }& w. e/ r; k# f$ L! ~
}! R( G) E8 R5 S# e9 R0 q
parentBgRGB=getRGB(parentBgColor);9 t2 N$ \; {/ Z5 Z2 v Y( C
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
2 o9 Q6 [" l) M( _0 F/ c m {
6 u* E6 c k9 b8 _; T0 Z7 W( d) K orgNode.parentNode.removeChild(orgNode);
$ j O) `" h$ o- E, U- { }9 T+ h1 r8 g' ~! x$ {' ]. B* H
}+ A2 [5 I0 Y0 i; {" Y% O A5 b
}& n! j# K( N5 f$ z5 }* @
}2 i: h( J: w/ G1 H# D, D/ w5 _ s
}
; T: @5 r$ f2 }% d/ P }
+ _0 R( T9 z9 z! h7 w% Z ( Z& A' p* @# h( M. r
4 q2 V; T0 K9 |% P% Y/ P
var itemFrames = page.getElementsByTagName("frame");
0 I' w- l, _: k var itemiFrames = page.getElementsByTagName("iframe");$ F+ F" _# t* L
, C5 b G' u) J5 e; u5 a, w/ W var frame, iframe;, ?+ ]3 T6 w" {6 K3 t8 {$ B
if (itemFrames.length > 0)
# [) ~ i6 A4 a {' q$ `5 w3 j/ b3 J; r* u$ B
for (var i = 0 ; i< itemFrames.length ; i++) - H( [) s! U: h4 M( Y$ x
{
. B- f7 w/ k2 X9 G- t frame = itemFrames.contentDocument;
! e" j" @2 k: T) q; `5 }! T this.RemoveHide(frame,objname);
/ y! h$ C6 ~9 @& e+ c4 S x% z( ~4 [ }
8 |6 A3 o( P) y# K, C }8 M- f+ y% _4 W' C* T& R4 b4 q
if (itemiFrames.length > 0)' c, b+ M" M5 d5 z0 n6 x
{
- F8 E3 }; x% Q3 w9 \7 u6 z for (var i = 0 ; i < itemiFrames.length ; i++) 7 M+ O: H3 r5 z/ L
{
! \: l4 Y! [& a* o2 w) l" { iframe = itemiFrames.contentDocument;' X: \$ r* B: g# |4 g
this.RemoveHide(iframe,objname);
/ s5 B) u. `4 e4 r2 ?3 u }3 } W: w. d) S0 ]
}
. d0 G/ ^5 R- N2 L7 \$ |9 [' u }
6 r! a% N2 s' O& c1 i+ c6 H catch(e)
2 u4 P" M$ P- B1 F# v {
$ G5 z# F6 ?& f7 I _6 A( ^ if(debug) G; U E+ x; n
{3 S& P$ k' C$ f `. V3 Y
alert(e.message);% ^/ F# s4 P! k* m: J9 w/ P: C n* |
}
. q+ I! _- ~8 I" U( P2 m# C3 I }
8 p& I. C' }- k z- C! E }
. E2 N: B" d9 t2 l" N8 q 7 M0 i1 `# ?! Y- d! k
}2 V, L& @1 R' K" d# d* {
- k5 u! \3 F* y M9 @function getRGB(colorString)6 ~( f }. o6 X% I* z G; M& g
{
5 A- V, x4 F. v/ Q$ c var RGB = new Array;
+ R% L! B9 v; }. B+ O, Y3 D' V0 K var tempSting=colorString.substring(4,colorString.length-1);
) \6 j4 s$ b! z9 Z, j) Y7 ]% F var tempArray=tempSting.split(",");$ Q5 V, V( q! h
1 k" j) t, u' h) J! x- E' z
RGB[0]=parseInt(tempArray[0]);
7 K0 s4 z4 `) j7 a6 R, K/ z RGB[1]=parseInt(tempArray[1]);
" @+ B3 ]4 Q' k- ~" b RGB[2]=parseInt(tempArray[2]);% E. ?' j! }; K/ |2 q
1 t) {: ^& e) z: o% u- H return RGB; s+ j: _0 m- f; V+ h, {2 M" p
}7 Z+ A5 k/ a5 G7 ^/ b( d+ T! U
function keys(evt)
! o& ~$ n8 e! S0 V* v# w {
" z& T9 j% r; d- w% g+ C if(evt.ctrlKey && evt.keyCode=="81")
4 ~. y. T* f' `" y2 C _ {
0 q8 }9 E; R* V- g CleanHideObj.on(0,1);
1 n8 A2 T! p5 M3 ~0 L alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
; }4 \# q% q, R* L ( z9 d: C3 O, E% b
} , L. M1 u) M, k$ Q8 K
} % b' ~3 s5 D) x$ X) _& L
document.addEventListener('keydown', keys, false); ! q" ^. G, r) l. Q& l% z
GM_registerMenuCommand ('Clean Hide',
0 H( U4 {4 i) |: j; J$ rfunction(e){9 s" @6 _ i' j, Z, y- ?! t
CleanHideObj.on(0,1), U" K k/ Y! Z, @8 c
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");0 x' y2 z1 M5 O. t, S: e" y
});4 F' K7 J0 {/ [) K* v+ A
|
评分
-
查看全部评分
|