|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
- c& ? B- A! _% o+ b* A
8 V3 l8 q5 j) W" Z% @! G0 _) K火狐插件,用猴子& |% ^8 v: ? o8 R
P4 m! U1 x" I. U
var debug=false; ' m( s5 b' @4 p% ?3 T
var CleanHideObj=new CleanHideClass();
% j' q" p1 [& A6 O
) t8 B! v, j' ufunction CleanHideClass()
: X. V7 H' q0 S& H3 D4 N: D{
! {7 W p0 W" Z& w3 i S
8 ^3 y1 b# H: _; U1 d$ x7 N this.on=function(id,bMZ) b3 C! F8 o+ F1 b+ R2 K% V
{6 o% D7 l, D. B# i9 e$ B/ n5 ?
2 {& _) b. t% I7 e8 W1 [* {* l4 C& s" h if(id == 0)) u# R" Z; V) e3 L# N/ t
{
. ]4 e; g4 e" D( j# r2 `* x& _, T8 ? var page=/* document.getElementById("content").contentDocument */document;
7 U0 V( j, d5 w this.RemoveHide(page,"span");
( o5 P- U- a! A3 J/ O/ _8 F this.RemoveHide(page,"font");
: J% x8 E6 D% k w this.RemoveHide(page,"div");/ g" B+ u+ G. m, R& M# o* h
this.RemoveHide(page,"p");* O5 S3 _9 `2 I) q' d( g! R
: L9 _& H C& f r6 ?& Z! Z
}
" S7 D$ J0 g6 I & }! X7 Z3 [/ A. @: b
}5 U$ [1 p) Y/ E9 Z+ u
this.getobjstyle=function(node,prop)
6 v) G2 f9 V+ y& e- \% L$ @ {
! o8 E" P) }* }% q7 ]9 e: {- I/ G try% O1 b1 {! {2 [3 U5 V; T( i
{
9 _! W0 b, X" I% a: T6 w: B return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
7 A) P4 R7 q/ V& b/ X }1 \% h: _" b+ D0 V# `; Y: V. @
catch(e)8 q( f0 z+ f" A: u5 w5 M- K" w2 `3 c% A
{
$ ]/ E4 a, A* P if(debug)
- x$ ?% D( G$ {& b2 O, N {! m2 D/ G4 O4 J0 c/ e! X
alert(e.message);
# u- e( l. b! x' |$ y: ~ }
) k! G G- n5 P% I0 g % W& i( K5 n1 U
return "200";
! c/ w. }7 s$ y$ v$ z }
* R& q5 W8 \% g9 s! r) ] }
( n7 L7 f- m3 B; p & B! @1 [# A$ ~9 ]9 A
this.RemoveHide=function(page,objname)8 m {& O. M6 K M* O
{
$ [' V7 K1 t) w0 y8 s try
. y! t2 [0 W9 {% s {
. y+ X3 c4 o5 j7 a9 E# I2 N var minValue=15;
R$ X- h( N1 \9 S* u! ?* ~- p var objs=page.getElementsByTagName(objname); 4 n1 t" i7 d$ R. [
/ @# ^( t* P- e6 D if(objs.length == 0) M! P5 a% }; I
{5 T9 j( J& C1 e& p; D) S
if(debug)
2 o: Z" _/ f5 N& J$ d7 _" s {9 s) h# z6 P2 ]6 }6 I1 \
alert("no object found!:"+objname);- B* n& Z- |1 b! ~) Y6 C& x
}
7 ?3 i8 T9 d5 [3 F }
. U" d3 }5 ~ L' O+ ~* H+ P else
1 |* t) c' C5 A ^ {; @- L& h" r+ z2 [+ T/ ^' e6 k' L% t- z
" G P% i# i# c/ ?9 s+ z
for(var i=objs.length-1;i>=0;i--) " q' m* Q, N, d" ?& L, N
{
5 m8 g3 A+ z; C var node=objs.item(i);
k, u- i1 ]% [: {! x9 B
; ^& o) a, u. a& ~1 S
, Q- D2 S7 j- S) n/ J+ i if(this.getobjstyle(node,"display") == "none" ||8 X! h8 y/ F4 M! Z9 d
this.getobjstyle(node,"visibility") =="hidden" ||0 K, B8 n- R# O2 B% U/ ^$ Y
parseInt(this.getobjstyle(node,"font-size")) == 0)
; s. d1 W/ H$ K0 U/ ]/ x {" G; Y! M' a, |) f/ K M0 [
if(debug)
5 t2 f& U5 `# m" @* m$ c {
8 |; n! b8 t" |! j; ?. p: O4 m/ n' M# S alert("remove invisiable!");2 { T3 D' `6 R% c. L
}
; ]9 p, _" k; c6 T node.parentNode.removeChild(node);
5 K) x! v ?% {1 H3 c & ~$ Y7 [" ~: O$ H k- B
}5 u3 W' h0 J- E# ~ M, G/ h4 N
else
" i+ V2 W0 C y {* n5 l. G1 p! i& n
if(node.parentNode)
4 _% `! z! w, {' L5 E7 b+ X: {7 w {
) B% e+ S$ @8 u. _ ^, g& e# ] var orgNode=node;
. |1 Y* B0 {( x. A2 [ var orgColor=this.getobjstyle(orgNode,"color")0 R7 _/ l2 n% }5 O
var orgRGB=getRGB(orgColor); ; d" c! I0 {1 u0 X3 G, v
: ^4 q' {2 B6 |8 Y5 B
var parentNode=node.parentNode
; U; y/ s( ^: x; g* }8 x: `6 e5 R8 f- ` var parentBgColor=this.getobjstyle(parentNode,"background-color");# L; X- A0 X* \: M
( t! l. ^. ?5 t9 t9 Q; U# W var isLast=false;7 B4 g( L9 K4 l8 o" ?8 u
, P0 m, b( y( F# Q' i& h
while(parentBgColor == "transparent")
0 y4 `6 s3 x) D+ ~( D {
& N2 t w2 W2 L }5 o {1 z4 H ; @0 @: I( f# l
* M* d, t& A1 r6 S7 B) }2 K: _ if(parentNode.parentNode == null)& h% B6 ]; g+ u$ {& g
{
- c' j4 Z5 c+ i v" h: Q isLast=true;
/ H' M' {1 N* M( P0 }7 L& E break;
+ Q4 q1 G! ]. {# M- f6 l2 u( P }
0 t# O8 m( ]9 c7 ~% z parentNode=parentNode.parentNode;) t. r0 X1 k5 ]! q) h: M
parentBgColor=this.getobjstyle(parentNode,"background-color");
. a" f- f3 T4 z1 ?7 g) P
" x9 y+ h( V& b; h7 Z6 U& f if(parentBgColor != "transparent") 1 @1 V, T1 e% P x; X. m6 f
{
0 Y# b( p( j+ K- S break;
) A8 d4 k0 h; j3 S }
' S) T$ }) i7 E1 `/ _$ H9 F }
# j6 c% a/ d( D6 G if(isLast) 3 I' S! F8 P1 v V
{
% C! N/ ~8 L) C7 |( ]* ] if(debug)$ w' @& @: ]1 Q6 Z; l
{# k; n# {0 n1 K, i1 D+ b
alert("last!!");# ^6 Q; M! t! G3 O
}
" K' S3 w& M9 F if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))3 X" k. {/ _* |5 f O
{. ]6 } F2 u! l9 K# t
orgNode.parentNode.removeChild(orgNode); ! m6 g" S! H0 i0 e8 ^" m* G
}9 y. i z5 M( K \) Z5 m
}5 X+ B, `# r8 L( [7 M
else+ y- H) i3 `( q8 C5 v
{# X/ o+ A+ ]$ Z( `$ t; j
if(debug). k6 j8 z+ N" M" u4 Q8 A+ a
{
! H( E% {% D/ J8 m9 X- e& b alert("compare color and parent bgcolor!");% l/ d3 r1 B; M6 }1 p- @/ n
}$ r6 s, j5 J' L; ^, q7 X
parentBgRGB=getRGB(parentBgColor);
, C* s1 W& v& n& x) s if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))! N6 \6 y9 a2 P3 P( \- ~
{
@0 u( z9 L4 ?' } orgNode.parentNode.removeChild(orgNode); 1 Y+ Q- b- a! O r
}, M% E% T5 y: }4 Q
}7 Z; N. H+ L6 G# v# ?! y
}
- F6 H# J" p# M, V+ ~6 k$ O& P }, h- S3 x$ W( c
}0 V& P T. t6 r) _
}. A u0 ~0 d$ A* Q
6 i6 @( Q8 b6 ] Q i1 w % c+ {: O ?, e
var itemFrames = page.getElementsByTagName("frame");2 Z. I3 W# o- r. [$ \
var itemiFrames = page.getElementsByTagName("iframe");0 T1 O8 q: |, b* t
A! l$ w9 h k' J var frame, iframe;2 Z! f, ~6 }- b: y
if (itemFrames.length > 0)' o3 N1 x% [6 ^5 ]/ n" G
{
6 m8 d8 \0 N- }2 D1 I$ P& U for (var i = 0 ; i< itemFrames.length ; i++)
% `) y4 u* Q0 u7 E- } {
6 ~( T4 N1 M6 A0 ?( P3 M% J# { frame = itemFrames.contentDocument; `# T' ^ t6 U+ ]: \
this.RemoveHide(frame,objname);
; l# a& i+ u* I# ]5 W }$ g0 c: H1 U! m& {7 Q
}
. ]; Q& ]3 W9 v6 X8 h* M8 U if (itemiFrames.length > 0)! D( \+ `8 v! I F. D8 B3 T' y. l
{. X2 }+ S( ~! W1 X
for (var i = 0 ; i < itemiFrames.length ; i++) 2 g s% n: M, k7 l
{
$ G9 k) M; s4 ? iframe = itemiFrames.contentDocument;
% a+ {( b. A: M) o# S this.RemoveHide(iframe,objname); & z7 w2 Z0 ]9 Q) B5 f. w, h3 L
}
+ G# I) d2 |5 G# g$ _4 _ }% K7 E- Y+ R+ N( Q
}8 K3 v+ h( m; L; Y
catch(e), W& t$ m0 h1 l* x+ \4 r
{1 W% B$ l4 L2 _# R' G. ^( b. @
if(debug)
3 d, G+ R5 g& b! w; D! f8 ]( [" O {9 o4 m" B9 z4 Y* m$ J) b, F
alert(e.message);0 r6 [) d3 c4 n) M; E# D. a
}
: _, a& H0 z) X& O9 a0 H7 p+ J" |' n }
: Z9 M$ k: N2 q }+ z5 }4 F1 z7 l8 _- g
) J' i2 W3 q4 j( N7 [
}# A! W! ^- c5 I& R
* i4 \: S/ D9 I$ V/ s* K5 O( w- lfunction getRGB(colorString)6 b8 Z$ t' j4 j* P1 q# {4 ] N* J
{
& _" j1 M/ Q5 [& F4 x, B# t var RGB = new Array;4 M1 N( N, h+ j2 h
var tempSting=colorString.substring(4,colorString.length-1);2 P* l) C% P6 k0 m
var tempArray=tempSting.split(",");# Y+ Z' R! b w. g p( r
0 l$ u) p* M& e RGB[0]=parseInt(tempArray[0]);
, u) l; d( i7 c$ J- J' Q RGB[1]=parseInt(tempArray[1]);/ [* Z8 O0 t7 \; F( e7 m
RGB[2]=parseInt(tempArray[2]);* F k1 S% S5 d J
; G. W2 `: {! m; c2 G/ w# b2 F
return RGB; A3 r& h, U, ]
}
! X( G9 X5 d/ j5 @( _function keys(evt)
# Z9 M" V. }- X' @9 m { & H; F- L1 R& Z0 I! D- O! a
if(evt.ctrlKey && evt.keyCode=="81") # e$ W# q) q# g4 l# e* B# x
{
2 R; s4 Z; n( a: b4 D: M. y4 B CleanHideObj.on(0,1);
5 a2 \% b2 b( B alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); ) L8 Y' O) g# K& k. Y8 A$ S
' r/ U' `% I. S) y } O- T/ S# g( A$ g( j9 k( _
} 1 u- Q7 z2 _% m& p
document.addEventListener('keydown', keys, false); : a0 z$ I/ E1 ~ [* l7 h- Q
GM_registerMenuCommand ('Clean Hide',2 f& z" K* O0 G6 ~/ ^( @7 Z3 H
function(e){# M' ~* h) V% k- n0 f& u
CleanHideObj.on(0,1)" M* C; b9 T0 O: b
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
7 @5 t7 `2 g; s5 r% ]. e- }! c});/ p( i5 M; |( I$ {1 z' U
|
评分
-
查看全部评分
|