|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
f$ H3 O3 Y0 U- |' d( e% x* }. ]6 X d+ Y5 e+ }
火狐插件,用猴子8 }3 L0 p! J& g. U
I# r) _ J" @' a d
var debug=false; * e9 o: f9 v: O3 ~3 m4 e
var CleanHideObj=new CleanHideClass();
) Z [$ T; v1 j. v: G9 }* p
2 }1 i$ o; o5 `% j4 U) @function CleanHideClass()
3 }* ]( v* X' e- B% W: H1 |( b{ $ n V9 O1 v! y2 i/ m& L) @
O: k# n2 N# W3 C3 D4 V this.on=function(id,bMZ)
$ }% g9 [" Z5 t( X) I4 w* L/ | {
6 O! f5 X# m# d N& ]! p
, o/ O0 r2 S5 _( u4 J4 D if(id == 0)0 k- [6 L; l. J: e; Z S, \1 a/ y
{
6 }6 K5 Y8 \8 Z var page=/* document.getElementById("content").contentDocument */document;
2 u2 p. [* s& Y4 `3 M9 I: n3 g this.RemoveHide(page,"span");
+ h1 }- Z& ^, g9 L2 h) O8 P this.RemoveHide(page,"font");* f9 [8 _* L4 L
this.RemoveHide(page,"div");
" }; h% L% h: j# W7 }2 N4 c+ b this.RemoveHide(page,"p");" b2 K8 S, C+ K, _4 b% _$ y
# F2 e/ r, [% h* L
}
+ T5 }2 T% L- e% G' V% q6 Y
! ^2 n, b0 @7 H. K. I! B. I }
! g T6 \$ g& W5 L, y9 \ m- T+ }8 W this.getobjstyle=function(node,prop)
8 j3 I. z! o3 u5 L9 K. C {6 @2 |, k, Z0 H
try/ E6 D2 }9 k! ]1 g
{, |7 p. B4 }0 _& |+ W
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
* Y/ a) {1 s4 T8 } }
1 l3 u$ Z, ] H0 a3 ^8 g7 x8 U) J catch(e)) u `: P; `6 }& k8 R4 \+ Y
{
' j5 M4 h4 y4 _5 b+ E" M if(debug)# e2 ~4 L- K! E) Y% Z/ }
{
* X a+ E( b" Z- c4 { alert(e.message);; f$ G0 v2 f1 o, v+ E
}
4 ]9 X! A. J- [8 S! j7 _9 N c0 O
9 ~ g3 F) f# R2 C- _, E- \ return "200";
( x9 N& u! N4 J, B# Z }3 k1 B+ a' p$ s4 y, K b1 w
}
! i9 ]" S6 D8 W5 { M/ h$ _: f6 k6 N1 u
this.RemoveHide=function(page,objname)/ U! N% J' F: l0 _; g, n
{
# u3 [7 p7 R+ p try) j6 ~0 F% _; p, w+ t8 q* Y5 F
{! D1 a- |* ~" P+ \) X+ h
var minValue=15;
" J1 f1 l' p# o- Q3 V# W var objs=page.getElementsByTagName(objname);
, |) {* v, @8 f) o4 D4 n
7 k, p% |/ C5 F, G7 _& ]3 p a if(objs.length == 0)
* _! b: c. U+ ]7 m) }( g; ? {8 F+ f) t1 d/ b
if(debug)3 E* o0 H, N& S% Y% {
{
. o4 J+ `# x& W alert("no object found!:"+objname);
4 R* S- A1 ^2 E- H2 w) D }( \4 @" Y6 P9 {! U
}* }/ X0 t+ d* |; z
else' i* z* `9 V% o4 P9 f2 u! g4 i' X
{
. y6 K. t# P( Y/ ?% K4 x$ m
3 _" J& S0 S. C for(var i=objs.length-1;i>=0;i--)
' C! F( e o% t0 j+ }: o$ B, { {. s2 |5 j4 p& H' U5 A
var node=objs.item(i); ; j5 H. ^# H& r
0 y) m! m+ }+ l+ w. ?: w1 v4 |* | 0 _) K- M% Y" C% Y8 F5 Q6 e- [
if(this.getobjstyle(node,"display") == "none" ||% o2 F5 O& @5 j- y( T; d
this.getobjstyle(node,"visibility") =="hidden" ||3 ^" Y v, I4 b' {% x3 N+ g
parseInt(this.getobjstyle(node,"font-size")) == 0) 1 f# Y0 ^) P4 D9 E% f# o
{
4 J8 b; Y2 p" J6 E0 ~/ _0 \ if(debug)2 _: V3 d. _& g* O$ z$ K, A
{$ x1 M5 I5 h6 h6 }3 t) K
alert("remove invisiable!");
, b* C' x' Z( g* O+ I) _ }
" o; Z7 z0 N' D' j node.parentNode.removeChild(node);- Z7 a$ l& C3 [: d: |! O- Q
% v) c. I1 W, g3 f- }0 U }9 W* d* ?2 j# ]
else & v' @4 ^5 @1 j8 H
{
: x2 \# e) B6 Q* n) }" ^/ r if(node.parentNode)
* B* `+ X8 I2 |: `; z& ? {/ P* Q2 s) U+ @ X6 D7 X
var orgNode=node;& N& ?9 V1 u8 v
var orgColor=this.getobjstyle(orgNode,"color")$ h7 W& o4 F0 M
var orgRGB=getRGB(orgColor);
4 H1 z! d! c& D; t5 o$ b
" J( \6 A" q3 ?! t$ I, g' r' h1 b var parentNode=node.parentNode
. J! K6 Q7 N2 j5 ` var parentBgColor=this.getobjstyle(parentNode,"background-color");9 y* G* f. ~, U" ]
: {; {: o$ C0 K H) S) [' Y
var isLast=false;3 E% W6 Y$ D8 f7 }0 ~4 F$ ]
5 b, T% B4 a( Q
while(parentBgColor == "transparent") / V, |* q Q7 L( a, O+ F% G* w
{
/ E/ z6 h2 N% U1 [! h7 C : {8 F8 w" q) ^- g% [5 a- E
/ M: K& W7 H7 s! a if(parentNode.parentNode == null)
8 R5 E) Q: k `4 L, W {1 j6 X1 t' ~- t! G
isLast=true;
1 C3 J- }" l. _# ?+ P3 H break;
6 l, q0 q# t3 j6 I% A7 [# m }7 w" k/ Y4 K* _) d V( o8 x: v( m
parentNode=parentNode.parentNode;
6 p) n W7 s: q9 |6 C; d M8 Q parentBgColor=this.getobjstyle(parentNode,"background-color");( t( J/ s4 D- P* p9 [( V
6 l: @2 Y1 @& ]* \" g5 `2 i
if(parentBgColor != "transparent") 4 \ l# M8 \1 Q" R0 [5 I
{8 g! t1 K) M6 X' S s9 \3 `
break;/ I9 C1 R" M1 _5 D2 \7 S
}) b. Q' j: O5 W( p
}
% q* q& u# O( z9 C3 D5 J0 h8 p if(isLast)
) I. D7 I5 r& |. R9 U* a8 |9 g {" g2 t$ O0 a* d5 j; X
if(debug)8 N$ e- j: i1 v; O) { E
{
* ^- C0 M1 V( S3 y alert("last!!");
% p! }4 j2 S) F5 F% Z& g* N }
) O c4 `3 n$ m$ M' _ if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
% `5 [, s# r% p) d* a/ F( P {$ L1 {( l+ s7 ]5 ^2 Q6 t% n, A) j
orgNode.parentNode.removeChild(orgNode);
: z; c; }% N l+ W }2 j! {( h% E1 Q
}
5 A2 E. S0 e# G- |, o, t; Z' x else; r6 G/ L' x7 E
{4 `( r: Q) _" ?1 x
if(debug)( ~! B8 ^) f7 {! U3 N
{
# \* e1 t& [! y alert("compare color and parent bgcolor!");4 ?$ m6 Y C. n" B
}
+ a) W6 J- n" t6 O: H# b$ g parentBgRGB=getRGB(parentBgColor);
8 ^! T) N+ h7 u8 C0 ~ if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
9 }6 U7 L+ |, F6 d: E; h- x) T { I! _; |* J v% @* ^$ B a
orgNode.parentNode.removeChild(orgNode); ) |9 s. ^) ^, g3 t( M# v2 t
}
1 T9 {: f- M1 B& x" H6 h. u }+ Y/ k' S/ D# o. n, B3 e7 }9 h+ ^' u
}. L1 X/ M8 r5 c$ t p7 T- N
}+ i! j1 Q. Q3 A7 D0 f2 [) `
}, Q$ v2 ~, _/ i7 b- P2 _
}* N2 u5 {9 [: l5 R: i1 W/ F
5 ~+ A; {! Q' k$ K% ]9 e ; _; \! ?4 |# _3 Z1 n
var itemFrames = page.getElementsByTagName("frame");
, F/ e4 R* G. E+ @8 K- A- X var itemiFrames = page.getElementsByTagName("iframe");
" @0 E. s9 C" H5 z7 [0 {
5 B7 T( C" K4 C6 N var frame, iframe;2 G9 K1 R4 W$ P: F1 I/ C
if (itemFrames.length > 0)
. f3 r, N* l! R' ^+ x7 O6 a, w9 x {/ B' z2 Z" A9 z9 i2 a' P* o
for (var i = 0 ; i< itemFrames.length ; i++)
- a3 D. N$ k- s" z {- g2 e9 N" ^3 x7 N
frame = itemFrames.contentDocument;
+ j, Q8 W1 `! g* K' E; _& z$ s this.RemoveHide(frame,objname);
]8 E8 D5 I% x8 t1 B }6 o. k) T+ [$ ~0 e) A
}
+ C2 U* B! y+ ~, _2 B if (itemiFrames.length > 0)0 X5 P7 E% ?$ z \ v: K
{4 k" \1 I# P" \. F; f3 n6 r
for (var i = 0 ; i < itemiFrames.length ; i++) ; b6 o/ h( |" ^! H. t1 y& {" E
{
2 c" I% O& Y) h1 x iframe = itemiFrames.contentDocument;
b9 |5 e! H$ M7 o# f6 Y' g* h this.RemoveHide(iframe,objname); * n2 ^6 Z l' J6 N7 z+ G: N$ ^: L6 D
}/ |4 V2 x' \, ?4 W. }( g7 L# S2 f
}
4 ~& b n8 o8 N1 Q }
4 T# i% G. C2 x3 a& O6 M& I9 B catch(e)+ v9 Q( d& G# F5 i o
{/ K. Z0 r9 T: m1 a+ [
if(debug)
/ `( u- A6 Y) @" B$ Z3 ] {/ i; H; B& @: n# g, }/ m. n7 b7 E" P
alert(e.message);
+ K% y# f7 d0 A4 ^. C) ~! N }
4 P9 \; B4 u( v0 _8 J }
3 v. u& n" y% y. f% o0 s& B6 f }
5 h# D8 n4 C' {$ O8 M |1 d
* _; c) g. v# r* _}: ?, P+ r7 C, {- Y7 R/ B. N$ t" {
7 c! T( P9 W+ \2 C# I. e
function getRGB(colorString) t4 ?! Z$ E' e2 h V, F/ Q
{0 t) O3 w; K, C+ S
var RGB = new Array;
+ L8 m& r& c1 K5 A# N8 i2 M& W* V var tempSting=colorString.substring(4,colorString.length-1);
! o0 ]1 T# C$ C0 H% l var tempArray=tempSting.split(",");
. _8 _8 w L, W" T. ~. b& x. [% Y3 z# |2 o; L
RGB[0]=parseInt(tempArray[0]);
4 [8 E9 _0 B, j- ^ w RGB[1]=parseInt(tempArray[1]);
' a: A7 w4 l# P+ `1 x8 G# F( Q/ B RGB[2]=parseInt(tempArray[2]);
. i, T! ^$ o: U' C+ a
# Q+ W1 j/ P# y' z/ e: | return RGB;
/ _3 a# t$ C" P* p0 i}/ G# a3 g& F; A2 \5 k" U( z) `8 L* E
function keys(evt) % H: l4 H c1 ]5 ~0 Q
{
# j8 @/ y! ~+ F, \% s if(evt.ctrlKey && evt.keyCode=="81")
5 K: K3 f: o$ a+ s { : ?5 {; c' G: l3 x y
CleanHideObj.on(0,1);7 Z0 X; d& f+ h, @3 P% {, ]
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
+ T7 e/ @0 M6 R3 w% }
4 ^; g- D( v, ?4 H* {( P, U }
! q$ L5 ?6 j$ d% B9 w6 J2 x } ; Z6 i1 M3 @' g# j- B
document.addEventListener('keydown', keys, false); 6 M' E' N" Y# s& I; ^ C
GM_registerMenuCommand ('Clean Hide',5 Y5 @" T2 A, b. C5 ]* O
function(e){
+ P! w" b+ a. [CleanHideObj.on(0,1)3 K' G7 P7 F' ]) ~0 \
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
. @& ~% l8 _+ N9 Z});! t5 m$ i5 U4 \9 C- J7 W, n
|
评分
-
查看全部评分
|