|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
$ f3 J+ z% W- c3 N0 H% r, F7 k, T2 |' G1 J3 H" L
火狐插件,用猴子
" K9 T/ A) W3 B2 ~2 G% j& ?' Z5 F' \# h! \
var debug=false; & }! e Z4 @$ C! R' Z8 K. U6 ^
var CleanHideObj=new CleanHideClass();/ P% y5 g9 i2 w( \( s: E- V i; k
# {0 u$ X9 N i3 Y; kfunction CleanHideClass()
' O9 b# ~7 y1 A; O! r6 T{ : }. s, R. Z5 ?) g* \& R* ~
' V1 R0 U/ _; {7 }/ w this.on=function(id,bMZ)8 s% V% n8 i- R7 Y8 l
{
; Y) P" |! Q; }) ~1 k
8 S1 n) o! S* C' C if(id == 0)
* C3 o. V( t, c# A( V; b* y {
7 D. `* w3 Z/ d o3 ~ z var page=/* document.getElementById("content").contentDocument */document; ' v; a! w: X& @1 R
this.RemoveHide(page,"span");
- ?" p* V; z1 s& E' M; d4 M this.RemoveHide(page,"font");/ b$ x6 t& d) |5 p/ e0 q
this.RemoveHide(page,"div");2 {6 f* D% H! ~0 }3 |
this.RemoveHide(page,"p");9 q G& B; Q1 L) N, D
$ n+ G F% p' ]! ]7 f3 L$ G
}% N+ c. C1 L4 d8 b ~( }
) u6 l% \" h5 k3 k2 R7 V }' ]: D7 b, R2 c' K/ ^
this.getobjstyle=function(node,prop)
9 C4 ^/ Y/ n) S& n) f {* ]. b& j# s* T/ W
try# m+ ]2 y7 E! |" W: h
{
$ i2 y* C+ w2 q! w$ c% o- ] return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);9 H2 j) W2 x/ ~5 t% }% A
}
# [. R w7 V/ {$ q6 f catch(e)1 r5 T. R1 e' v Q9 B
{, v: N+ ]* l( j4 _4 }- o/ W
if(debug)( {' u+ V" n. ], N- G7 m
{# M: q5 V h$ j; H/ I
alert(e.message);
/ M+ p2 S d% B% M$ [$ B }3 g# I" e o5 O" @
G/ {! G1 }* c. _5 h4 L- U
return "200";
R0 F8 T l$ `! k& j& e1 S. L }) K9 |9 I# [; D- G
}
: S) s, A6 ^; H) }* r 4 `$ U1 f! [& w1 Y$ g: u9 y. |
this.RemoveHide=function(page,objname)* I9 R" y; G- D0 a/ ]1 W
{
0 p: T; v% v% ?4 K: `2 e try
2 w1 {/ Y# Z& u! |5 d# [, `, u) U {
$ m; ]. s0 i4 X& g var minValue=15;9 h4 R& d# n1 ]' K
var objs=page.getElementsByTagName(objname);
1 N s( Y) ?7 G4 S f+ N' N* L
/ D' q% g4 f0 X- P& ` if(objs.length == 0) 6 |6 g6 f* a1 ]; j
{6 M5 A- N% @# f; G ^
if(debug)
8 b8 @9 C" I: v( O4 m. L {) n$ r- S6 p6 f$ X% ?3 }- M$ w
alert("no object found!:"+objname);- i! I& Y, u0 p! B
}
/ }# {6 @. u3 v a0 E$ B) g }* ~/ |/ y: `0 C! l" {
else2 L% W$ T& G- c8 m/ P7 F$ v. s
{ T! o/ c% i* g2 c w' B
o3 L; i- J; f' z for(var i=objs.length-1;i>=0;i--)
4 L( w) m% x' S {
; w: U7 R* ^$ z% }( Y var node=objs.item(i);
7 g6 P% B, ^. T: V* p0 K # u- k: M: N0 B& E1 a# k9 j' L
+ r. W' r# y0 A& V if(this.getobjstyle(node,"display") == "none" ||
3 t0 M1 D. l# R* r0 _ this.getobjstyle(node,"visibility") =="hidden" ||$ {" X! \! t! {& a9 e
parseInt(this.getobjstyle(node,"font-size")) == 0) ! C# l: [* j7 A$ S! t% B4 K: K4 @
{
# o' X4 e# p" x2 n0 U% }5 J if(debug)
( x% D9 H8 t% \5 E; u5 o1 j! Z {
5 W3 R9 A# t+ w& w, V alert("remove invisiable!");! X7 c4 T1 S: A2 x/ ^ I4 k1 g8 [3 s
}
$ f8 o; ]3 Q/ g+ }2 A: g3 D node.parentNode.removeChild(node);
/ T4 t. G* ], g6 y 0 h3 a4 ^9 L5 l6 T5 x3 B+ p
}1 C6 l& p2 w) c/ { [7 X' S6 I; {
else
. v B1 ]0 m& `& _ {8 s+ X0 u; i2 n+ Z3 H8 x( A
if(node.parentNode) ' D! u& V8 d# P4 `" f
{. P# l7 |+ W+ m. L t
var orgNode=node;2 P+ k: p1 d( @. @3 B& d- t5 }
var orgColor=this.getobjstyle(orgNode,"color")
: S" O* D! ^; A$ Z4 Q var orgRGB=getRGB(orgColor); " Z! M' h( d, O6 `' ]9 N( t- S* P$ R
7 G- V- A( ^0 A: i4 A+ P/ z: ?' G
var parentNode=node.parentNode9 B, c8 l7 {6 b k) T
var parentBgColor=this.getobjstyle(parentNode,"background-color");9 A$ }: E# {3 t: K: V
7 k( D9 `: T- N0 s var isLast=false;7 P4 L+ _3 B/ B+ y" d- ^& g( q
0 A, I! O* e' c v1 w$ l) f
while(parentBgColor == "transparent") % v( O- }4 c* |* \
{
* T v }" |" ]4 i# T( ?6 J1 P
4 N$ K4 b4 |( ?. ] 5 ^& `. C: a( U. T& b
if(parentNode.parentNode == null)/ y: [8 I! i, B* U/ W. `
{
& G& e9 x5 E$ [2 R. k5 R1 K9 A isLast=true;
0 q4 h3 g% y& b1 W! E( z8 n: J break;: t- a) z; O9 L! I; w3 t" E
}! a$ S4 S/ t' ~8 M$ e4 ?
parentNode=parentNode.parentNode;: o L: K$ m' T4 }7 v
parentBgColor=this.getobjstyle(parentNode,"background-color");* U' h3 x# q; E. P4 [ A1 B W
4 E+ s2 s& P, H9 ]" ?
if(parentBgColor != "transparent")
, A- |2 d i$ n R, F$ L1 i( [ {
X2 H6 I, n" u% }4 ^/ H* t2 Z break;
* _% |2 w/ c. f* W7 S, g }
/ N, O) s8 q8 N+ z2 k0 b }* {% U2 F6 q% r, `1 P
if(isLast)
6 H3 \9 y2 \2 H$ p/ L3 x- {% q5 f {
1 J& R+ h, a! K$ S( _; p D if(debug)/ H4 m* g. `8 |( G) Z0 F/ i
{
) p; |: y& O/ {, u% R& A# o alert("last!!");
3 N9 M! n8 |9 V) u) T/ v" h }
0 v/ i/ F7 m9 Z if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
5 A$ m s4 A! w( Z& f {
3 l; R: G1 d: S/ @ orgNode.parentNode.removeChild(orgNode);
- `0 O0 q9 \) Q9 K }
- b1 h5 A# \# U$ h }
; H* {5 j( Z1 Y+ k3 e: R else \; B B" V1 ^' V: ]; c2 R
{
0 ~' d7 B( s+ t: d% h! G9 H+ C" o if(debug)( ?6 j) o4 J `, S
{
& M. N" k- b* V9 ` alert("compare color and parent bgcolor!");: c2 Z, G# g1 T3 j* Q& u
}
6 u9 o, ]7 o2 u4 \3 J% @ parentBgRGB=getRGB(parentBgColor);
6 @( A+ Q1 V; I7 e( Z if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))6 H$ @' `# q' {# I- }, ^8 \ o3 J
{
: h, Y7 J' r" J6 w' k& o orgNode.parentNode.removeChild(orgNode); ; y3 z) x: d. G
}+ Q, j" l( F8 T: z. o
}
2 u* j& u7 s7 A5 R* `* R% G }
1 ?7 Y1 c2 O% G* d& ^! N8 Q7 R' Y }/ C N7 U# x0 [. Y9 ?. }- V
}) C4 Q$ f0 H& ^ q' y
}" B4 g9 n& t. c) k- U. x1 k
4 M# ?) T9 k7 P! Z R* O
; h6 W0 Y, x4 ~5 k9 X1 k% K# s var itemFrames = page.getElementsByTagName("frame");7 X+ J; ~- Z9 A% k& d3 B
var itemiFrames = page.getElementsByTagName("iframe");
2 M0 Y* L0 C5 N* P
A9 p5 I$ Y. U! t var frame, iframe;
' N4 \ `. p1 A# ]7 X8 \+ T if (itemFrames.length > 0)4 C/ b2 {7 m' C8 e1 [3 ~
{: ~! w9 Y3 z2 o
for (var i = 0 ; i< itemFrames.length ; i++)
# A8 e" h' M" l; W, r$ p {+ r6 W7 s! y' ~7 s
frame = itemFrames.contentDocument;/ l* v, H d1 u! S- v7 X2 E& E
this.RemoveHide(frame,objname); $ O' B# |1 x* p) w6 k
}' x, o5 H% \* \( f, V6 k
}8 J2 m# [& j; @
if (itemiFrames.length > 0)
* ~5 \8 Q& V$ ~. ?; ~4 c. g {9 V" P; i% t% l' A; D. j
for (var i = 0 ; i < itemiFrames.length ; i++)
" r: v& ]; O ^ {
, w V6 }5 I. C0 l4 } iframe = itemiFrames.contentDocument; k8 X+ C. ^6 }7 ]
this.RemoveHide(iframe,objname); l; s# P% h: ?0 `8 k1 p- @0 G
}0 c! _) b& y9 R- j5 ^
}$ e* B! L7 V7 j( w" K7 r0 E
}
$ _" X( ?9 h. U2 [$ G- o catch(e)
" a" }* P% P8 c9 A3 n) P) }. \7 D# c L {% S% L9 y0 J& B( s1 _/ f' @0 I
if(debug)
9 z! B% i: Q; L0 r0 ~/ S& A {
T7 P: L( x- o% s+ } alert(e.message);- G, l; @* F1 B! \5 G9 k% g
}0 A w o" L8 l7 X
}
6 B6 i) w( W4 x# d6 p# n }* i! t3 c2 _3 D' _& H2 x7 F
: Y- c) W4 }0 L
}, K5 E8 j& t# s1 y8 }0 y
" v! C5 S/ S3 X( @5 dfunction getRGB(colorString)
$ t5 z& g: d! X" ~+ T{
) W3 _6 ?% Y& N. j var RGB = new Array;
7 z o6 Y) K3 e' A# |8 Z: p var tempSting=colorString.substring(4,colorString.length-1);
, ]: L7 [! S7 R& o var tempArray=tempSting.split(",");
9 v$ P6 L) M8 E( W# P$ H* _) L3 ]1 B' p
RGB[0]=parseInt(tempArray[0]);$ a7 G$ U5 s3 d1 M$ F
RGB[1]=parseInt(tempArray[1]);
% X; _ y+ Z) H9 V0 `4 U4 e4 D RGB[2]=parseInt(tempArray[2]);
$ {5 I9 M9 M4 `# L
% F+ B7 j6 F/ b! k return RGB;
# |2 G% v5 f7 y4 S1 q}5 d( H% I, X$ q8 E( B- X" U
function keys(evt)
, o6 S% Z) g6 e& G: X" W: G { 9 `; {& h5 Y7 C
if(evt.ctrlKey && evt.keyCode=="81")
. h: O' k {! @6 ^/ [0 E7 T- Z {
P) l6 E7 m5 s R9 H( N CleanHideObj.on(0,1);
( s/ c1 W" t* k e. E alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
) i# j# k( W3 ^' \
9 Z( V5 l' h2 A+ Q# f- j; O5 v }
: h* a$ ^! V0 j } 8 R- k. d3 t' m1 V' b: K
document.addEventListener('keydown', keys, false); / v' ^1 l* X* [4 `
GM_registerMenuCommand ('Clean Hide',- \. D g9 [; c8 x+ u6 A# [, D$ O
function(e){# i; t7 z8 ], V ?. l" ]
CleanHideObj.on(0,1)
$ g1 u: K8 K! L C2 Kalert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
( l8 l% c: S+ C) V- o});
4 u- s2 o0 K0 B& q |
评分
-
查看全部评分
|