|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 ! _5 b# z& x3 p/ F2 e6 ~7 }) J
4 x, B+ g; } i火狐插件,用猴子
7 I: ]- {; N. d) ^
( K4 a( q r4 V' p. ^# svar debug=false; 6 q" G, Q ~6 c& q) C! j6 Q
var CleanHideObj=new CleanHideClass();( X6 m$ G" T7 ?1 S
+ J3 F) c/ D: a0 t6 ?1 l2 h
function CleanHideClass() & F- d4 N4 S" s; n3 ~
{
1 P, g1 H$ U4 D+ s$ L& I3 E0 {
" P" d% s: |8 c: p9 I this.on=function(id,bMZ)9 \2 d$ c! z9 J" t
{
2 b9 q5 [ q& T4 L
$ G- s( z4 q, S \ if(id == 0)1 W; \; D/ }8 t1 L# S
{/ s5 N2 ]. \/ v$ n; O R
var page=/* document.getElementById("content").contentDocument */document; ' _8 }" \2 a! { G
this.RemoveHide(page,"span");
4 x- _4 n, V8 F3 b8 j this.RemoveHide(page,"font");+ w e$ D' Q* q5 c. e, ^8 p7 s
this.RemoveHide(page,"div");
3 t: r% H% Z G4 w7 j this.RemoveHide(page,"p");4 m0 t, u& H- X& e
: f& j2 }) }( o' L0 a }$ h: X6 O. t& B$ d1 L' l" G+ \
* k( S8 w7 C0 l1 E: _8 j }
5 M$ }$ q. G3 N4 s this.getobjstyle=function(node,prop)6 }" u% j/ ]% z# H) L0 I8 q1 v
{3 f2 Q% J {8 S* }
try- j7 Z0 V0 c- ]. k* H3 ]. P5 r
{7 J" b/ X0 N5 l7 e$ n) \$ r
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);# [3 Z$ G2 A; A" J. s
}
: d4 k9 u# g9 l' E catch(e)
* D2 O; ^. o5 p7 u2 g8 \2 k6 s {+ N" s9 d8 t; y4 l) f9 P
if(debug)
* t" ?: f# D, v% s) B Q8 S {( T8 Y+ @+ _* {* C8 A) l; _+ u( y
alert(e.message);
" y" q! @ ~5 \: @6 c }
4 I( y0 w8 ~8 V, b 2 h; P5 B0 {1 t! l; b; A
return "200";
$ I9 J/ C( v: e }7 `6 D$ d9 e7 C$ O+ n, I
}
8 s# m1 Q3 {9 I$ Y! I& m: x, g * x$ L1 u) E; O) Z' R9 _
this.RemoveHide=function(page,objname)
2 U; c' K. k+ |! p- |- {. T* c( J {! c" l. z7 `* y5 J% ]. V# i) Q; B
try+ h6 ?0 z5 [. X" E& I! `& I
{
* ~" u3 w7 b% C9 v var minValue=15;3 S5 H! M- _& g4 ^8 s
var objs=page.getElementsByTagName(objname);
+ @& c; n! P/ A: E* e/ O D N; f! q$ v
if(objs.length == 0) ! v g; d4 U, D8 s
{
0 u/ [1 c5 e+ g; c' e% \. x if(debug)4 _% y6 s# p- m/ f* J
{& v' f4 o D _! E# I. z
alert("no object found!:"+objname);3 u3 N3 w4 `5 b" s3 w/ K* O
}; ^3 u* V' T8 t& ?8 ~$ x
}) Z3 P) N1 R$ t5 g4 f
else# _ T! g0 o3 S' S' _2 G) z6 S
{
/ j. y! R. i1 c+ z4 o
4 L3 \7 p+ w. E0 Q4 V$ }" W for(var i=objs.length-1;i>=0;i--) 6 y9 P8 U: D. q: i
{
' ]) e$ f. a$ t" P8 ` var node=objs.item(i);
! M$ S$ s: P8 I6 x5 k/ i2 [7 x * h: Z. W! Z- `: j: M
0 i+ M$ G1 Z3 `8 @# n" I
if(this.getobjstyle(node,"display") == "none" ||4 P0 N; i$ D' H8 n- `2 v
this.getobjstyle(node,"visibility") =="hidden" ||
# M, r) v( x: B! x3 K parseInt(this.getobjstyle(node,"font-size")) == 0) ! U2 G+ \( q9 A7 `
{5 a- q3 b0 @5 _
if(debug): B9 i6 ?1 q+ K) W0 ~! b5 Q
{
5 F9 W* V0 `- I) E2 Q8 n alert("remove invisiable!");
' D) j b) W; y3 A: F3 [ }0 |9 q& M* ^- W5 ~ N1 V4 b* A; n
node.parentNode.removeChild(node);2 p$ Y. Y: {8 k: W2 {) f
! X% i0 l# Q3 e }
1 i4 h' z4 c/ Q else * ]; O5 x9 |; `9 p% d& X
{0 M1 S- i9 Y* `
if(node.parentNode) ' h" ?' r; m6 F
{
, m2 O y$ c6 i, S, M var orgNode=node;) k' G7 B% u. J
var orgColor=this.getobjstyle(orgNode,"color"). u8 w0 b1 l) d+ v' r) E5 t
var orgRGB=getRGB(orgColor); 5 A7 [+ ^ [6 r( |- [ W$ [6 @
1 p, h& s- {7 {) Y1 s# t9 A
var parentNode=node.parentNode
1 R3 K" k+ k2 k' u; [+ B var parentBgColor=this.getobjstyle(parentNode,"background-color");9 D4 X2 j0 p1 s+ D
0 z8 Q5 B1 r* h) K& O$ y% R/ j
var isLast=false;$ S; X+ T4 E/ V( v. e
% q1 \$ T0 e# G- g3 x while(parentBgColor == "transparent")
l) M5 x" |2 O( Y4 k {( M7 w2 P. W" P) V
6 G6 {8 P( a: w7 p9 D+ I7 e
5 g9 h' k6 L4 I9 F1 f# T% g" M
if(parentNode.parentNode == null)% o( e& w X& ~, Z
{6 A. y( S9 p9 [( l: q
isLast=true;
. i( T/ D% V. R8 D0 |3 A9 c break;
5 s8 @8 |, D) j' o( @8 }9 J; }" s }7 L u. o+ e. e& c" F6 J2 M4 d2 _+ I& X3 u
parentNode=parentNode.parentNode;
% H% v ]4 z: c: m# N* U2 s& M- W parentBgColor=this.getobjstyle(parentNode,"background-color");
, e/ A4 V( c% _5 ]+ o$ o i- h& l5 q2 t$ n
if(parentBgColor != "transparent")
: u+ k. o, p) _" n, A6 G8 V6 S# B {- t( D/ `/ d3 b" F/ ~( z6 h* y5 l- d
break;
, e. R n# N6 u& P. \ }+ c/ v( L# x1 ]) N
}$ R& c: v; m1 n2 c. ?9 R% ^! b
if(isLast) % E# U. v: ]8 y* [
{2 M( U' y2 a, T; C
if(debug)
7 u: \" g% i5 z0 F; c, B$ X {, n5 u+ Y6 ]: d$ I& L
alert("last!!");+ M" A+ D6 ^$ M4 ^% _
}
) |3 ^- i, h& m; a# |& g3 j if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
5 ?+ z$ z$ @0 o. D7 d% O& G {
& s% ~; r# _/ [) a# F orgNode.parentNode.removeChild(orgNode);
N) Y4 U# g% K+ f }: q) }5 j2 j4 [1 h6 m# ^
}8 l1 t0 k. I& c+ _: e7 @
else
- [9 O8 l2 {+ S8 m v {" s; [8 X2 z- u; u
if(debug)9 }1 h A7 ~( d' k
{
5 A% `+ b2 q+ |% B% A$ p alert("compare color and parent bgcolor!");
3 o; Y. W' O( E) y9 `4 D4 z5 a }
e$ e" u I& E4 [' H parentBgRGB=getRGB(parentBgColor);6 n* |1 ^5 v$ C/ B, k
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
7 V) u9 c! Y; y4 y- @ {
# \: N0 ~( p8 W! O' N orgNode.parentNode.removeChild(orgNode);
h3 w5 \2 z& ]4 C. }6 K }
$ x* u s. F. _6 ?+ f }0 g! D0 ]/ G7 k2 \! I1 U
}
9 c9 _( K# ~; S; F/ D* w }
" o) p: \! g% M: I- X4 P( j0 K }% ^1 t* V0 w/ c' B( Z
}3 H7 v; }. s' R% z& p+ X
0 [; O, l$ i, Y1 y " f, Z8 H1 s5 |3 F
var itemFrames = page.getElementsByTagName("frame");6 T J9 }: U: k2 Z
var itemiFrames = page.getElementsByTagName("iframe");3 j- p9 q7 v% i. }. {. p8 M4 ^
* C( V( P) {8 Z2 `
var frame, iframe;( ^4 _. X% ^6 @0 Q
if (itemFrames.length > 0)
* J$ [0 z, B3 r$ n {
. j/ d" i9 L4 H& ^3 n for (var i = 0 ; i< itemFrames.length ; i++) 8 A/ h# F4 V8 N; o9 t
{0 z6 \, i- I( ~; f& k
frame = itemFrames.contentDocument;
p( i# t7 a0 o this.RemoveHide(frame,objname);
. ]& h7 _# {4 V } p9 J; Y6 o X/ s% \
}) [) l$ J# @) a
if (itemiFrames.length > 0)% U$ C: t8 t" ?/ P! w' C$ ?9 F" Z) N
{( n6 A: B3 \4 Y1 t/ Z9 c9 ~" G5 B
for (var i = 0 ; i < itemiFrames.length ; i++) 3 e7 F9 Z) `/ D' ^* }
{5 B9 p5 e: u+ E9 l! M
iframe = itemiFrames.contentDocument;* N4 F, e5 Q4 U+ H
this.RemoveHide(iframe,objname); 5 D0 e' Y9 `& u V
}
, [) l: M1 F) ~+ [ }( U' R' \+ @: k9 P1 w
}
8 L' [. t% V2 M8 K catch(e)' f' u8 N$ M8 c) R5 e. v
{
1 o5 w. O$ S' C. l if(debug)
! L& \9 o/ c" e. G# H) w {; {7 r+ I: F" u: `2 E
alert(e.message);5 H" {6 S- Q# x
}: \9 }: U' e8 V0 C4 q |" z+ @. `
}! k! O& l3 @& l [
}
* F# H! u) \8 [" g9 Z5 U( v
, W. Z2 q& q7 f! T7 k$ [}
6 A) W8 X1 x' o- C4 ?2 B( G9 Z1 u1 \8 P
function getRGB(colorString)
) Y- r" I6 v* I0 J& w. D% r4 Z{
1 }9 _4 t4 f' [! j var RGB = new Array;
8 u2 ~$ t I0 o$ i: Q( I var tempSting=colorString.substring(4,colorString.length-1);
2 _! Q/ W; V% s$ g; P/ O var tempArray=tempSting.split(",");9 A8 i$ b: {' |( F0 O( c
4 z, v1 ]2 y# Z- Y& R+ K; ]
RGB[0]=parseInt(tempArray[0]);
3 b+ _. r% o2 k* H) ^ ~ RGB[1]=parseInt(tempArray[1]);
" t" _4 A! \! _/ l' P \1 o1 @0 W RGB[2]=parseInt(tempArray[2]);
( i+ s" [" |! S# ^ U ; e2 d" T: Z* N: F8 U
return RGB;; n# g- m: ]& K8 E8 S4 ^$ M
}
2 P& e6 E9 s3 b! _6 f9 ?5 ufunction keys(evt)
' O' g; N( X# ]1 p {
3 l& z: s k- I! _, i, V7 Q/ s) w if(evt.ctrlKey && evt.keyCode=="81") 6 t4 A# S$ ]) `% m0 a9 ^' _2 o5 j6 H
{ ! Z9 d, _$ r7 ^5 ?- s0 J+ y
CleanHideObj.on(0,1);- [1 F6 C- w: d8 Y
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); ) e( c0 ?! f# `
- a- A+ E, \% l } 7 j9 ^ d( @& k# {
}
4 k. B+ p; d7 T. Zdocument.addEventListener('keydown', keys, false);
% D! M: i. y9 ?2 r4 ?GM_registerMenuCommand ('Clean Hide',4 Y7 P4 x/ v" q: y, _: Q. p
function(e){3 \/ \8 ^/ A- w0 y6 I3 i" k
CleanHideObj.on(0,1)- m1 C8 [. F( p/ L. R$ d) t
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); t* @0 q1 C% I) C
});6 r& B! ~6 T3 X8 Q( D
|
评分
-
查看全部评分
|