|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 & \4 K Z' M) H x$ b" B
5 s2 J t4 g' i6 s7 [+ p4 |
火狐插件,用猴子
, p- F. I: h9 J# q" r% J
/ t; ?8 n' u0 E4 D6 N. R# C' lvar debug=false; : v! e$ H5 X7 q; V+ k
var CleanHideObj=new CleanHideClass();- k) Y. t& R& J$ \$ H
, y6 o1 l0 F9 O l: |
function CleanHideClass() 8 K9 b4 }$ K2 W2 D% ~ y5 C
{ / j! P3 D7 y0 U- S" L. j
5 E7 N. c: ^. P; q- I( y this.on=function(id,bMZ)7 m. q) _ g- r7 f9 f) E
{1 `% [) ^1 V7 D1 R) j9 b8 i
5 v/ ^/ o" v) f" X k if(id == 0)& ~# n" {6 J! v+ \$ ~' \
{, D5 V6 l& o$ J
var page=/* document.getElementById("content").contentDocument */document;
0 U: T( J9 z) M* C7 }8 K this.RemoveHide(page,"span");# Z, \0 `" F/ m( d; ]# P
this.RemoveHide(page,"font");
* u8 L7 i0 v/ F this.RemoveHide(page,"div");; M1 p- N4 b+ x4 r
this.RemoveHide(page,"p");
9 v |. N+ {; M1 d: X$ H9 i8 j
+ e3 N# P9 t6 ]% ~) O4 ]0 E }4 e. T" }9 A, e* `+ y8 C; I% g5 c
& ?4 D( u% t% a) ?# y( S& n
}0 W9 ^4 P6 A( l% m+ Q0 R
this.getobjstyle=function(node,prop)
& A2 @6 k% P6 w, Y4 O {
- Q# ~' t- u/ H7 u M, D/ \# q try
& p3 ?: ?) g! s! l6 h {
$ a1 S3 e, ]2 b- P5 g return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);, U& [' C) I& w" K8 z" J! C1 v
}0 ^: X% j$ P) f! u: ]) n
catch(e), m8 e9 ^" h$ k6 A, x
{
: w+ L* W) h# S- O6 k% G% ~$ U6 p# S. l if(debug)! P* G* o- E, q' j! i
{, F5 [4 v2 r0 G2 A. O" I
alert(e.message);" w4 f1 r# D1 Q% O2 i
}
/ m; V4 I" l f7 |$ ]0 A* W9 g- D 3 I) f" l* z4 j7 E% g
return "200";; [ ?6 u: y5 q1 Z2 d
}9 s4 P- U3 g+ C; z$ F
}
$ r, \/ j3 ]4 x f7 I% v2 t6 Z; r3 l 8 w4 I) D/ J" y9 x
this.RemoveHide=function(page,objname)
/ j5 k1 k1 b% W/ `0 a {! q! R0 s6 M( R8 ?# ^+ }& h; I: H
try q3 C/ ]2 K1 r: c
{( }& X7 @$ S* H$ ?7 Y9 E
var minValue=15;: z# B B4 K* v. f0 p
var objs=page.getElementsByTagName(objname);
) Z7 v c7 L6 A, p* R& _+ a
5 j m u& y! w6 l$ A+ y if(objs.length == 0) . K0 X+ k0 p- {# M S
{! P1 i: V" U/ t9 S+ A9 g
if(debug). p6 o! n+ G/ Z8 y+ n1 n9 ?+ m
{0 ]* x3 j" k! Z# Z& K" z; T2 N
alert("no object found!:"+objname);, z5 A" r6 i3 T9 [" v
}
9 @, k/ Z6 O: W% O% t4 D! W$ n }
. P7 v8 t% {" z; E2 P else
( a" P% Q2 z6 T5 T8 Q( r {
% q. s& n% }0 e* T f( L
8 M' k" t( \; I' l) D3 y for(var i=objs.length-1;i>=0;i--) 4 |+ F7 _) k- U* j. Z
{# G0 I# b; _2 s& b2 v7 I! e! d
var node=objs.item(i); y+ M4 A4 a+ W0 a+ C* ~: L+ d+ L
; ]* R3 ?( R5 x
2 L: h2 t! m' @% \6 j3 T if(this.getobjstyle(node,"display") == "none" ||
: V5 N- C0 z. \ H: s this.getobjstyle(node,"visibility") =="hidden" ||
8 H( |( v' {# A+ g( }* B+ a parseInt(this.getobjstyle(node,"font-size")) == 0) * ?2 H1 W8 J2 \( l4 D: t, g, z
{
6 T& d2 m2 M" E8 ^7 ], ^1 N if(debug)
0 ]* i) s( k, U# {6 s {$ M# \) U# a1 C) {" a# ]/ L. T/ n
alert("remove invisiable!");/ B& q+ D7 S8 W9 ?
} w, q$ b$ G9 F+ d+ B' P
node.parentNode.removeChild(node);
: b. K) M* h( C- Y7 Y
( n: d1 e1 P' b9 f }
" S6 D5 g# `5 D else . g6 U) s4 G+ h' H4 @# J3 }
{
3 ~7 I' k; f1 I6 c3 V. \7 a" r) j if(node.parentNode)
5 X8 ^$ ]/ O$ R- W% S8 \ F {/ S8 ?5 q) M! K, r7 @3 ^
var orgNode=node;
, B! B0 a! m! V var orgColor=this.getobjstyle(orgNode,"color")
" s8 ^9 C, @9 z9 l var orgRGB=getRGB(orgColor); + n! j* Y+ W4 M: h! G
/ r% p( M! i$ l# s: ?. c7 f
var parentNode=node.parentNode
" B" h8 ^# @* Y+ g5 m var parentBgColor=this.getobjstyle(parentNode,"background-color");# M; d+ z7 ~7 X
, `# ~5 y' T9 C1 }7 ?) `- O. O+ W
var isLast=false;
0 U7 }# r5 [- U/ _, \$ l+ `
. X; N2 N1 }; }0 o while(parentBgColor == "transparent")
4 q6 L+ e. e; C8 S( ~+ O {! k: X7 z( f! U/ t0 }3 [' M _
3 l7 k2 t2 k( }
& Z0 z! S0 I6 [ if(parentNode.parentNode == null)
4 [& {- z8 F: n. |1 E {, l2 V; G- G/ S% K
isLast=true;5 M! |& |, Z# p- P {; n6 q( _2 t
break;6 o" I+ M8 u2 m" N
}9 X2 t2 L) z7 [- Q2 K; C
parentNode=parentNode.parentNode;
3 u! ^' l6 N# y9 B% F% d0 G parentBgColor=this.getobjstyle(parentNode,"background-color");
- J$ h; V5 ~% [" H! n9 z
7 \0 u) ` }+ F8 a, i if(parentBgColor != "transparent")
( @1 i3 Y& P* o& r- v {1 X3 J K+ y2 K% o- @
break;
5 ^$ D7 C8 Q1 |4 C) r: g }
+ f" ~) }2 I- H! C- |1 l }
, @6 l m8 F- r( c# j* N2 |" e if(isLast) ) ~' ^ s% F: P o% _& F- e( V
{
" N. |/ H! K0 L5 i2 t# h* F9 i I if(debug)
# S `- n4 d; H% Q _: K+ }, c% | {# x* s; R* r: T0 r- O9 |8 F
alert("last!!");
' o Q( E; @5 q }
, |4 O5 N# f0 H. `( i3 F if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))! A! H; z, [: c U! [! ]2 o
{! N! i0 W0 ~- i- @
orgNode.parentNode.removeChild(orgNode);
( u) I$ Q6 I* Y4 N1 s }5 d$ Z0 U r3 P
}% e% h& X; ?! ~6 P: j4 V
else
" G; z) p. C! k- c9 J$ H% ~ {. \; G7 d, z" V3 @
if(debug)2 G4 u, Q F; k4 N4 O
{9 {8 I- j( r5 m3 l) |0 r
alert("compare color and parent bgcolor!");
a- j+ C# v9 g% s5 R! `9 M }
3 s2 X( j" V4 a& o# p+ l# ?' _ parentBgRGB=getRGB(parentBgColor);
% h- \ f4 t% C" X+ [7 |$ e2 G if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue)); q% h8 e5 q- ` n/ M
{
3 U7 ?+ v) C2 U4 |, |2 L orgNode.parentNode.removeChild(orgNode);
- T/ x# u5 A5 l5 f" g }2 @' U! q3 _% @6 G
}: x$ @ K u$ Y* l" j0 S8 h; y
}
" u* B8 T; n$ q0 e" x }
e8 D0 I7 Z4 Y5 e( Q- [ g }
- Q# i7 p4 j6 a/ l8 h K/ Q7 D8 A }+ K: @. ?0 {! a' l4 t, P" D
0 H( u9 D* f+ M2 y * p6 I. ^0 J: V% T( O) ]
var itemFrames = page.getElementsByTagName("frame");
" w) T/ l' P8 F+ _9 K5 K& R ~ var itemiFrames = page.getElementsByTagName("iframe");4 z( c3 x) [6 q$ @0 H, {
f! _! z! |6 p# _$ F2 C var frame, iframe;$ i' p4 l+ n, r
if (itemFrames.length > 0)
: q% c1 s- N) }' [! I! K5 ` {4 i F# b$ c6 ], V5 [! m
for (var i = 0 ; i< itemFrames.length ; i++)
) g- n" U7 H7 s# A) H) s8 p {* {: i: r. S, @; Y
frame = itemFrames.contentDocument;
V6 _" A1 \( S. K! {7 T. F this.RemoveHide(frame,objname); 1 H0 ]9 q# F3 J1 e8 u+ u/ k
}
3 E$ T I7 u- Y) G5 t } J1 D" E2 D% T" ?! V# {+ X% }
if (itemiFrames.length > 0)
6 u+ c# e# L* \- [0 p* ? {& C& p) x& b8 p5 S8 V- j
for (var i = 0 ; i < itemiFrames.length ; i++)
$ y: S1 m4 W7 c6 u; \ { F2 ?+ ], Y# c, `5 q+ O7 D
iframe = itemiFrames.contentDocument;
; M. U3 [8 U' Y9 Z, h this.RemoveHide(iframe,objname); 2 }# m5 A! S: X8 b# C3 F) _
}3 }3 x0 a' w9 X
}# T- s4 Y& Q _8 o
}
$ Q7 b+ |- z- t+ }& V% `7 a6 C4 h catch(e)
/ C# _* P) H2 `0 N. \: \ {
2 S I3 l, z. d$ h if(debug)! s9 i! R) ?! F. Z' T' N* d# \
{
+ x# y" T) K3 s. U alert(e.message);
+ j/ x0 n4 V: b4 f* C; a: ^1 k8 `! f }
* h2 ]0 W' Y: [, c' P9 I4 j }
" V3 f" p, W4 w }6 ?9 t! Q, U, X* _) m
( {; S* a# [/ C/ |$ [3 f}
$ m9 H6 f' _9 P ~9 k
* l4 s9 w6 b0 d6 ^, N# p& M0 g, _function getRGB(colorString)
9 Q6 s+ Y6 P' E& v{+ y8 s: g4 L% \' g
var RGB = new Array;% z3 }$ J4 A8 ?! n4 W9 |1 k9 B) Q
var tempSting=colorString.substring(4,colorString.length-1);: B6 O2 ?% s8 A; D, M
var tempArray=tempSting.split(",");
7 g- v7 n- ~2 V1 h; Y6 F& V
5 l1 c) Y% l" X, D* _ RGB[0]=parseInt(tempArray[0]);
' S7 Z" {1 j1 d. ?" g4 n RGB[1]=parseInt(tempArray[1]);/ J, o! y# X6 K6 E B
RGB[2]=parseInt(tempArray[2]);5 A$ z+ \4 u7 ?; w
2 Q3 R& U0 t3 ^ D3 n9 Y return RGB;
+ h v2 E# t1 T; o5 K! v}; p6 m4 U2 W+ r8 ?, \0 @
function keys(evt) . N# ~; R1 a( \' Y( m
{
4 y) G( U4 p: q! {9 X, w: l, G. g- o if(evt.ctrlKey && evt.keyCode=="81")
6 \3 n! H- y8 n) ^ R { " G3 H9 v& x9 W0 n" }) G
CleanHideObj.on(0,1);4 O+ v9 w% ]# `- \; Z8 g
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); 1 y# X; F. T$ g" S( [. V+ i8 s# _- d
* x. W- v0 h2 _. `0 X2 L, _- `
}
5 ]2 s/ P% b% c& e, A }
0 H4 S( `4 q2 n6 u9 `document.addEventListener('keydown', keys, false); * d4 H& @5 Y2 g, {# h2 f5 r' ^
GM_registerMenuCommand ('Clean Hide',
3 i( V" R) h1 m M& sfunction(e){% V- a8 T* M. w# U
CleanHideObj.on(0,1)
6 q! a& ^" y. J- \$ Valert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");( `) ^* @. C9 p" W1 d2 L1 x" ^1 I
});
. p7 t- _# l; F* A- A |
评分
-
查看全部评分
|