|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 1 `9 \% ^5 _0 [5 ?
W% x: `9 R" p2 R
火狐插件,用猴子5 q( V1 j" u' q' z7 E/ e
0 N, ^5 l4 A7 @var debug=false; # B d. z- w o( G/ d
var CleanHideObj=new CleanHideClass();
+ y) o, m8 H; v& Q6 ]1 j% f9 ? ~ J
' r# e6 ]7 U p' {function CleanHideClass() - i" ]9 J1 ~2 M3 H% @, W/ ]3 m3 B
{
1 ?* @9 K' e7 `. H ) U m8 F# X" y+ f! m* X
this.on=function(id,bMZ). c: {: y9 G4 X( b; C$ N* |
{! c( D8 v! y- G
3 Y& S- [- j3 O" O0 o/ E" \/ p if(id == 0)) K2 y3 n8 w7 p% H3 I1 {! _
{+ X+ M9 j% N+ Q$ O% L
var page=/* document.getElementById("content").contentDocument */document;
* I8 b' N9 A) X this.RemoveHide(page,"span");
8 X, H. H7 o" S+ d5 p( d this.RemoveHide(page,"font");
* l, q, c( y+ C4 b, t this.RemoveHide(page,"div");
2 S$ i( h/ c2 ~ this.RemoveHide(page,"p");) P g1 g" k& S7 c0 j% Z
0 v% @/ [6 |0 n& C
}
4 O; `+ O; a) B p+ C3 L0 a
2 w# ^+ l: _0 G4 C6 E2 f+ N }
2 B# l; l6 P! ^! k! } this.getobjstyle=function(node,prop)
& T; S! P( U2 o M# E! R+ d {4 A: O9 z& u; t2 p- ?
try
, u$ T+ C% M" O' [; e& {2 ?# R {/ ^" ]- N' V' S; n
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
7 V1 o9 B% E; F8 H4 x3 _ }
g1 X8 f! w9 y$ q' k catch(e)' Z e. e7 `! d Z% M
{
+ H8 T% z8 z0 ]/ Q' M0 p if(debug)
) z2 N8 ]. m* R {6 i4 \8 G" b3 {% j; p: H
alert(e.message);
7 a* M) _. a: K4 l* `4 _ }
$ }* o4 d F6 E1 i- V
: ?0 p' V: }$ O' u/ T- v; w l) b* y return "200";
! \5 l% e' ?4 R0 m, S. i3 K }! f' `6 [" k3 d
}
7 d; h0 X' K2 e3 H5 N( M% p u: x
3 _7 H4 Y( ~) B- i7 j c' W, x7 x this.RemoveHide=function(page,objname)
$ X! M9 G' H) |# t) q% u {
) K1 {/ O7 J$ ?9 n4 j try4 h5 {0 a3 K Z, {8 X& z6 m
{
) b3 a V, x M, Y! P b var minValue=15;
4 Z/ F- T# G! S) s- U2 b5 H l& U. w5 n var objs=page.getElementsByTagName(objname); 3 e6 W3 u/ o3 y8 |3 F
. V3 Y( r% _" q+ d+ V, b# P if(objs.length == 0) % \9 M5 s9 a: G3 {5 u
{. R9 \: p! D2 ^) x y
if(debug)" t) }3 }' G; a! T3 e8 J" Y7 v
{
. b: s0 e: k1 E! o" f z alert("no object found!:"+objname);0 z7 _: A5 K2 @, \% S* D7 L
}
# x) w+ h6 z# \1 i }
8 P; M4 V0 F6 F+ J# \* r else" Y6 \. t. K. e
{$ {6 e: H1 t$ {; \5 ?: g# i: |2 n: f
7 G5 {5 x5 l' }. T. N! f
for(var i=objs.length-1;i>=0;i--)
9 ?2 {. Q$ I( Y5 m {
/ u5 w, _4 B2 B6 v var node=objs.item(i);
. W/ I1 u/ H2 {: y1 B& H. C . w) I9 g9 e6 A" ~! i% T5 ~
! Y5 b: `( [6 z if(this.getobjstyle(node,"display") == "none" ||
8 d7 V i- ?. ?% q this.getobjstyle(node,"visibility") =="hidden" ||6 c' y1 M, e! c' p% q7 t3 u9 U
parseInt(this.getobjstyle(node,"font-size")) == 0) ! g% t, e; \+ C3 `' k; p; ] g
{
( y Z! x/ i+ J/ ^6 y' _ if(debug)
# j! }' `) m5 p; w0 b- L" y {
C$ X- c, ^# n5 e alert("remove invisiable!");
0 c3 F1 |, ]$ n# N }- f4 m4 m- F: Z3 A' Z
node.parentNode.removeChild(node);4 k7 f% e5 R" G4 @. _7 Y
$ t: @1 ~6 x2 \! z8 u }. g2 }5 H3 r6 p% ^ f$ n, U0 j
else * ^- a9 w& {: m" N( _; G7 y& N
{4 O7 y( b5 j$ T( Q
if(node.parentNode) : h" M8 t4 x) s- p+ ^
{7 K3 r5 C( }4 C: T" q/ Z
var orgNode=node;
* l C$ e( b% x+ c% c, u var orgColor=this.getobjstyle(orgNode,"color")) F0 [6 Q" E2 W5 N& J# g
var orgRGB=getRGB(orgColor);
+ |+ k. e( c) X; D5 U/ D3 _# o 1 I4 \; P, W z/ F# U3 }. v0 q! X% B9 _
var parentNode=node.parentNode
2 r# I2 }, N& C var parentBgColor=this.getobjstyle(parentNode,"background-color");- [8 m* [* @0 |3 ?2 k0 J3 ?* B, J
" _9 V$ Y& c$ Y3 k. W( r* e7 V var isLast=false;& A; `" u# |5 A5 b2 X2 N
% \* `/ x: G7 C+ ^. S/ p( @, \: V
while(parentBgColor == "transparent")
- K9 a7 J; T; h8 V {
n) A( v5 B# K3 d2 z0 _% n
8 Q2 l% N( S; J7 t i) n. K 6 y: m& I _/ {" K ~
if(parentNode.parentNode == null)
) c, ^# ]* D$ p. `9 N/ F( ?- V {% p1 T/ m) k1 {0 G
isLast=true;
1 N f/ h- W# l" q5 Z4 m break;
8 ?6 G9 P. S% U9 M9 E& E }
6 k4 {( @" c$ N9 r! d6 { parentNode=parentNode.parentNode;: g: n& L' Y7 b* ~. b* B
parentBgColor=this.getobjstyle(parentNode,"background-color");
7 j& W0 `( m$ l- q( y: s) }, w
& ^3 w. C- R( g' f9 K5 c* i if(parentBgColor != "transparent") + U8 s0 b1 ~$ r. a
{2 \: V# N' ?1 ~' D% r# N
break;
7 p; W; v7 u% c# L! k } }
7 V+ D* h5 o+ K! o }
; h. `' c" s) ^' f' V3 }/ b& W if(isLast)
2 a# I! z/ T) r% Y0 b4 X. m( ` {# `7 Y4 Y. c# R9 g; H, Q5 _/ v
if(debug)! J" M; K3 }$ _) P$ f9 C$ i
{
4 e' W+ E+ H, j( D. M alert("last!!");
6 d6 Z$ Z5 f" {# V. r: q }* l# U# i' D) Y) n
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
1 V9 G3 ], `5 k3 X8 d9 } {
& a9 ]0 t5 A* q orgNode.parentNode.removeChild(orgNode); 9 V* M& M0 @& `, {$ }
}
0 z( l. {( q) {. i u( { }% y/ q0 Z( _% @+ t
else; K+ b. J4 O/ `/ G) ^
{0 l' a7 n" B6 n# P" e1 S* k- M
if(debug)2 _1 g# v6 e- l
{% v8 D1 Q9 k6 K$ I0 E! s# i- z
alert("compare color and parent bgcolor!");; t1 q6 K; f4 {( E
}
8 t* L; V/ c( u# D parentBgRGB=getRGB(parentBgColor);$ E ~- w5 c+ j& F" E% }# `+ C6 o
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
! R+ _9 c+ E5 o {; Z( W7 D& B ?1 }3 X! T* D' n
orgNode.parentNode.removeChild(orgNode);
" @1 P- \; |% U9 @6 {& Z" t }
. L4 `, q9 Y6 X" U" n }7 c6 p7 d; X4 x t- j+ \
}6 C! ~& E$ Q6 m/ E
}
& Z- J. {$ d8 K% S/ Q }& T7 H2 R h1 w% R
}$ F# M5 P' x) X. r1 H/ M! g
0 B; E& ]/ d9 W* O 9 m$ P( S) C- N y
var itemFrames = page.getElementsByTagName("frame");2 w( n' Z. ~3 ] S. T/ {* K$ f
var itemiFrames = page.getElementsByTagName("iframe");: }/ c) n/ t. T: A
2 ?: r# e9 G4 d5 L0 m var frame, iframe;
& u$ R; k7 C2 X) `" B1 x if (itemFrames.length > 0)0 u5 X @) P D" B
{
# c. Z1 {7 v# r0 V! w0 L6 _8 U for (var i = 0 ; i< itemFrames.length ; i++) 3 ]- M/ M2 ]8 o6 U8 w
{' Q$ i* ]5 c3 L6 F
frame = itemFrames.contentDocument;& M2 o& Y) [6 W2 w, K+ b
this.RemoveHide(frame,objname); . E- K' t' w: ~3 J" |" k& X
}" b) m: l3 v. {6 |3 Z
}
" x E$ m& o8 B0 H7 ~: K6 p if (itemiFrames.length > 0)% Z6 Z7 }, F3 X& R
{# K5 a, H0 D' W1 T
for (var i = 0 ; i < itemiFrames.length ; i++)
2 D! C- }7 E; a q. c" r {# U, N( i8 Z7 K1 ]: e: _) i
iframe = itemiFrames.contentDocument;% c+ T/ a0 E/ f: V/ p; U
this.RemoveHide(iframe,objname);
# P/ P7 R9 {* L' q$ X- b# d) y7 T }
' H/ Z& B: d0 z* H }& k3 o c/ }3 ?1 Z5 ?% X; B2 b
}7 G3 _9 b2 C1 j- n$ A: [9 @. ]
catch(e)
2 `* \6 J7 K' ^; O+ Z, x: Q {
. H7 Y" ~ Q+ W+ B if(debug)6 H1 l, j4 q6 ?$ V9 D$ O
{" R% q/ ~' I# {4 o4 R4 ~6 P4 K
alert(e.message);+ S$ l) |' L# d2 G3 S& _3 O0 q
}; s" F. y1 M3 P& W1 e
}+ c% I$ n2 X8 h3 g: Q E) _
}3 |2 x- V0 J6 H) _6 a) z. [
5 P. l7 D) d9 L, |0 @& d
}
: W( x5 }, a3 x! H
# D9 h" v* b6 M J4 h' _: i1 Dfunction getRGB(colorString)4 P8 V# u5 W# D5 n. B) d
{% O! m, w$ g ~" d( b
var RGB = new Array;2 e! j, F6 x8 L ^0 m
var tempSting=colorString.substring(4,colorString.length-1);. F8 m& m8 e: w; |* N
var tempArray=tempSting.split(",");7 z+ E& V% c m* D$ l0 I! C
# K1 ?: q5 J- \0 C4 k0 P+ s' j, h
RGB[0]=parseInt(tempArray[0]);
1 N6 J" g+ X6 O" h/ s: A/ w RGB[1]=parseInt(tempArray[1]);7 e- e; S8 i# W- }% S
RGB[2]=parseInt(tempArray[2]);6 `7 q) Y7 [ u+ m% }0 m% u
( u7 ^: t% ]8 ^ return RGB;
5 |8 X4 g7 f, T+ n5 f}! K+ T( ]# ^$ P2 V
function keys(evt) 2 \! }! f" `. f) K
{ # Z, M: B7 Q* ^. x& g* r& b) ?& w, Y
if(evt.ctrlKey && evt.keyCode=="81")
( v& }& q6 D9 J" G ^ {
5 t! [/ v8 L1 Y% U! {* `, r! q CleanHideObj.on(0,1);% ]2 V# v4 F( M8 j' t: p" U( t
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
. G: d) W' ]) q $ z: _3 A: q2 j
}
5 R3 p: v9 c3 E: W* r# C0 m } 2 J$ d9 S- ]& I
document.addEventListener('keydown', keys, false); : D$ v2 V3 u$ X
GM_registerMenuCommand ('Clean Hide',
# O( Z( G+ }' T& \3 O) W5 tfunction(e){
. n0 W. r- f# v+ d4 sCleanHideObj.on(0,1)
1 M: p" Q0 P! p- B) _alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
8 j2 K3 M! J/ i0 b});
7 h$ b' l7 d4 S) _ |
评分
-
查看全部评分
|