|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 ; I$ P+ \: a% w% y, ~) Q' |( ~2 F
. _2 g I2 r% T7 p7 d, Q; I, D6 ` g火狐插件,用猴子
) ^/ ?! F* |! G" E: f' n$ \" F3 f; z2 f# V. ]
var debug=false;
u. T+ p" W/ A3 i1 t" Ovar CleanHideObj=new CleanHideClass();+ x7 G1 G3 Y/ i7 h( Z3 F" i- N
+ I, _# K8 q6 q1 bfunction CleanHideClass() 7 U, ?5 \- l8 ^5 o$ d$ W7 `% J* R
{ 9 ?4 O3 D& l5 A/ Q2 C, P9 N* X! ~
8 J' L( R3 N2 f$ n5 X6 [
this.on=function(id,bMZ)6 u1 E! w P& D8 [) E$ Z! D
{
; s, I$ o3 f) i# H- X7 B2 s& I ' s1 O4 ^ M+ o# H0 m9 W
if(id == 0)" }: x1 Z4 I1 N. \" _/ |8 z/ O
{+ ~6 l5 s) q! l" m9 C
var page=/* document.getElementById("content").contentDocument */document; 8 t. z0 V+ A) a, g
this.RemoveHide(page,"span");
' S' ^# y9 {# d0 f C this.RemoveHide(page,"font");9 C( Z8 _* l. [# |
this.RemoveHide(page,"div");1 ?+ o* ~+ ~1 _+ |/ W. a
this.RemoveHide(page,"p");- q6 r) g" C& R2 h5 J4 Z- T
, r! p$ y& F) ~* e! x" B
}4 S! d3 m' }& O- i
5 f1 |' j$ X L }0 f' g. `6 H! Z7 N
this.getobjstyle=function(node,prop)0 u+ b' C/ F+ Z1 m! }; `4 E& V
{+ N- H/ I/ \& N
try1 l: t5 s# ~+ a6 \; ^7 s3 z
{4 b7 W6 _) E; l' ?" k
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);! N" ]8 W* U3 h1 b
}! p% l" L7 d. o5 j2 Y7 _9 V+ p& F
catch(e)( X. H' Y1 N1 J: G
{4 ^$ ^2 m- r. b2 `- I
if(debug)
+ u; b/ T0 R: a {
1 v' j j( z& L+ |" l: ^( ^ alert(e.message);2 s: ~9 }0 Q1 |
}
% B, K+ }1 e: e. d - h+ c" t0 Y5 L$ s
return "200";
7 U2 S i2 P; _6 ~ }2 x. W! i* ?" K# L* T0 s# h3 i
}
" n+ Z1 U0 |, a" @) W6 V + \" h" S& y! e
this.RemoveHide=function(page,objname)/ W/ M0 Z7 B/ {+ N8 ]8 c# |* L
{4 z! V9 [0 `/ P9 l4 d
try
+ ]4 }& e) Q! {/ k7 p {7 M4 \: E# \6 L# ?& |( k
var minValue=15;% _% k7 F5 M+ l0 ]) s8 K
var objs=page.getElementsByTagName(objname);
) ]8 Z6 } k F ]! l; ~
2 _6 e( n! V6 F$ Z! _4 ] if(objs.length == 0) . ~# A6 R3 i- h8 y5 B6 E
{8 U' p' _: f; [ c. i. N
if(debug)
' W# V- \2 G$ A! O4 I {- \" M' t/ }5 g, a- L4 G) E4 O
alert("no object found!:"+objname);$ a5 g2 {# n& g2 }* L5 @1 @
}4 T' R9 X3 ]& |$ c5 I. q
}% T ~& y4 m$ f$ Y( O: ]
else. q: c5 N4 `- d7 I
{% A- J. X z, k. A
0 v: t: f' |- n5 e" \ for(var i=objs.length-1;i>=0;i--) ) i% ?( [+ @ ~6 `! ? I
{
6 N. N, _3 B( v) W8 o3 ?# x var node=objs.item(i); ) {* ]$ K, ~9 _
* l- A: S2 r, d, q % k) f/ ~ W% p/ B' S1 k0 f) j; `
if(this.getobjstyle(node,"display") == "none" ||* {3 f4 @1 V1 L! G
this.getobjstyle(node,"visibility") =="hidden" ||- z7 d0 a0 {- E) n) G$ k. w
parseInt(this.getobjstyle(node,"font-size")) == 0) * }- y% h: [9 E& |
{& p# e3 z# a5 ^, l9 Y
if(debug)
5 ?% t0 a, x" ?1 V7 i6 o/ h0 c* D {
4 D! X4 n0 @- k0 w alert("remove invisiable!");) y, b6 {% O8 e' k
}- W/ T7 V6 P4 w* y2 E: I: y
node.parentNode.removeChild(node);7 G( Y! {& J4 E3 I
6 @! Q% a( O3 G: s6 H! t
}
: k9 U( H6 @- w$ J' f' l4 z else 5 a! a+ v. d A5 j, n
{" h7 Q) d: o7 ~7 ?
if(node.parentNode)
# R/ v# u) \/ U5 B: R1 C/ x. Z6 P2 h {4 G8 S$ _7 z+ @' @0 V% O
var orgNode=node;8 Y& \$ Q0 {. B1 j
var orgColor=this.getobjstyle(orgNode,"color")2 P/ @ U. B5 e `# ^2 Q
var orgRGB=getRGB(orgColor);
" J! V( O- q% k7 ?' j( q 9 }! M, x) U7 k' Q0 T# e! B
var parentNode=node.parentNode
$ s' M2 L: M' K3 M var parentBgColor=this.getobjstyle(parentNode,"background-color");. {0 q4 b/ @+ Y" e. D5 I
: c! z; }1 N) X var isLast=false;8 d- a) v* U, }. t
6 T0 V" `; D; r* _
while(parentBgColor == "transparent") $ q; J' e$ x" a; D% \1 P
{
2 }$ }9 s/ u# v5 F# K+ E
& z9 m8 k& v& j# i . @. Y: M% f3 I; q7 z" I
if(parentNode.parentNode == null)& a1 P% b: R: C; R, J) J
{9 L" i( l6 H: n
isLast=true;
6 b4 E/ b7 }" z* M break;! h0 G' T! P y7 M8 @) c
}0 Q: F* b' B" J4 v# M
parentNode=parentNode.parentNode;6 d, z; Y0 |; H. J0 u {( _
parentBgColor=this.getobjstyle(parentNode,"background-color");' r% K: U$ n% `- @; a3 V! }
% C# v! ?+ w9 g& a( L if(parentBgColor != "transparent")
2 H5 L/ \! H$ R {7 ~# [, p$ ^! ^* d2 n
break;7 t8 D) u h; p* T/ `
}
7 G) y) M1 E8 S- q }5 b% k2 u1 a1 }$ p
if(isLast)
( s+ Y& I$ C+ O: v& b {
& |$ m/ d! T% v2 W B if(debug)
c4 v& \0 R% l {
- M6 u" p. Y4 H" Y; s& I+ f# A alert("last!!");, V4 k; j) P. h9 i& V! @/ B
}
( u2 d* l$ O/ k( {2 T- @" {& ~% R if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))3 w! _ y( \6 y+ @1 w5 _
{. o3 Z0 ]5 D5 [# Q
orgNode.parentNode.removeChild(orgNode);
( D' V1 [0 k9 z P0 j/ ]- e }) G1 t8 e7 K$ F& j
}
) h. h7 l' ~/ M8 W' S else7 T6 Y C' C6 w, t& r% Y" V4 Y
{1 c" k2 t# T( C% P
if(debug)
+ I# H1 Z; P7 V0 }& ~, r {
5 p: N. \; c! E5 D* \; E alert("compare color and parent bgcolor!");9 H: G: ~) w' [ F+ a% l* V9 P
}
! d, Q# h) Z) E- l parentBgRGB=getRGB(parentBgColor);
0 i* o- v' W( M+ R& o, H7 L4 n7 O if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue)) ?. `/ O i; U: S1 n4 N! Z
{
2 l, {& I1 D Y$ ]* s orgNode.parentNode.removeChild(orgNode); : N9 |+ n: s5 I! H4 t
}
8 [+ B- t$ B0 b a5 f0 r }
, \% i' X1 D) \" g }
; u$ k2 q3 E: B$ [# b- G6 Z! V }
. I# o( g+ j. B* j2 w }
) a o5 y% q: G/ u0 A }9 g4 C4 _6 y8 f6 ^* ?) a
- v/ G0 o( f9 E f
+ {2 k9 d* l2 y& M% ` L var itemFrames = page.getElementsByTagName("frame"); U: n2 ~" U- P- |8 v% y
var itemiFrames = page.getElementsByTagName("iframe");
4 z1 p3 B2 `( ^( Q' A3 m: B
# D5 x; d5 Z8 l" g7 ? var frame, iframe;# v r3 L) q3 ^# p; h: a4 c
if (itemFrames.length > 0)
0 D5 K; X5 o% P+ Z' i" w { n3 X( y- P% C. [8 k2 T8 Z
for (var i = 0 ; i< itemFrames.length ; i++)
: Y8 @* c8 i1 E! }3 W3 V2 g {' f- X' o& W$ ]- d/ m
frame = itemFrames.contentDocument;
8 I3 H5 [8 W0 N9 i' n' \6 s this.RemoveHide(frame,objname);
* Z% S9 K5 ^ R7 t8 z: W }
4 {4 X! ^1 r' s; `/ e2 s }
. ?9 ^8 j. ~3 ]; C( m) |4 _ if (itemiFrames.length > 0)
: |% L/ `$ Z/ Y1 \0 r {
* T; O: o) c8 R! p, p. D: l7 z3 @; d for (var i = 0 ; i < itemiFrames.length ; i++) - n( q" Y, O+ r; G% E( b
{7 C) R0 E6 g+ A G9 Q% \
iframe = itemiFrames.contentDocument;
2 `# y# Y+ ^2 X% N% H this.RemoveHide(iframe,objname); , f+ W$ Y) w! r6 |# D" B* H
}
- \ _9 n! e7 h }
; E9 w( C% B' b4 \ }
, z4 ~ X! {% a) g7 u, {# n catch(e)
( H! n3 d) Q0 F {- Q0 @* ]- a/ d: m) c( Q
if(debug)' \: C$ f1 u$ `4 p0 ]
{; W, n4 x& g. A( S
alert(e.message);0 |% }+ ]4 s n. f+ |
}+ l; [" L( p! v8 W& U, v/ x
}2 C) g' g' w/ W
}7 E0 V- }9 b. F+ @4 t
( k9 i3 h8 f) j* o
}
; ^; [6 }' ~* A* }- M
0 u t) Z0 G: M1 d7 A! _7 z9 |function getRGB(colorString)# m8 ]4 X; Z* Z
{
1 x- U& }* L6 `, C% A5 Z3 l, y var RGB = new Array;4 B( C8 `# [ _. k2 E
var tempSting=colorString.substring(4,colorString.length-1);
3 s& D9 l% T& c; ^$ w var tempArray=tempSting.split(",");5 Y/ y: g5 N7 J8 g/ H7 [
# ~* J5 E( \& h3 c RGB[0]=parseInt(tempArray[0]);0 ~8 c0 R9 [" M; f
RGB[1]=parseInt(tempArray[1]);
2 n2 q+ C' E$ d RGB[2]=parseInt(tempArray[2]);/ }6 K' ?2 B0 s% x7 c3 h
1 B, g- Q: y. p/ M6 d) f4 H
return RGB;
7 V9 q7 W4 _8 A5 p( o" O}& g' C$ c4 L( f! C: T
function keys(evt) ^- g/ ?2 I, Z9 \7 V# g
{ 5 L5 o( `& e7 h# y- G
if(evt.ctrlKey && evt.keyCode=="81") 9 J4 z! v, K3 e9 W8 d
{
5 ]1 T. H# P: d, v CleanHideObj.on(0,1);, ]2 L s& Z! Y/ K) L
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
0 ?8 d: z9 E2 k6 s
# H" |2 T: \/ W' ] } 3 L" R3 J8 M. e! @0 ?7 C& G
} " _& B, h) P' B; i0 m6 |$ c6 J
document.addEventListener('keydown', keys, false); # @; I5 t: m' W& E M9 W4 ?& c0 V
GM_registerMenuCommand ('Clean Hide', \) S9 q& Q5 ^5 `6 l0 Y, w
function(e){7 c5 D, V, Y& T" |+ C$ V% ~
CleanHideObj.on(0,1)
; C+ @; V; w% B* F+ ]alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");/ U+ p, ?' h: Q
});
) @" y) @2 d+ j- d3 u) N$ M |
评分
-
查看全部评分
|