|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
' }, q$ C1 m$ [6 u
) Y: c+ w0 t% D& h1 D/ ]# X火狐插件,用猴子 G$ v4 H& M7 ]5 l- [0 F8 ^& g
* o! l/ E; \- tvar debug=false;
n1 F y { ^var CleanHideObj=new CleanHideClass();* Z, r7 @. P/ {, R4 E
% Z+ k- L, g7 _6 s0 a) L1 R
function CleanHideClass() * G9 n! y# K: \$ ^- N
{
( Z+ r! n/ Q) k! b' w$ d
' v' ~* O( I9 A/ }+ l this.on=function(id,bMZ)2 h; ]& r) |: K5 v0 r3 F/ a
{
E7 N" ^& o; j+ q! K; X
0 T2 ~+ R5 ]0 c- N7 y if(id == 0)2 K$ C' p' A: O: Q) }
{
9 ~- u" T5 Z$ @% I H var page=/* document.getElementById("content").contentDocument */document;
' e; L2 @3 ?% p& k this.RemoveHide(page,"span");
: d- I8 P- v8 P this.RemoveHide(page,"font");
' @' t) j/ J, n N) S this.RemoveHide(page,"div");
' l* F$ B2 Y. M, m: h this.RemoveHide(page,"p");6 Y0 L j$ g- v. G
7 Y0 x% S) v/ T0 \/ c
}2 e8 i3 ^1 M* _* y
- G& Y0 o: M9 s5 A) h' [ }
4 I& F- {- R* H) G this.getobjstyle=function(node,prop)1 Z0 h K4 j; o( K
{5 M1 |6 b# s) ^2 B0 j' m
try4 U* W) z: _- z/ z
{
, B* l4 L/ |8 ?5 p* E4 D) m$ n return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);4 S% T( G1 J" V; p! [; k ^- A+ w3 w$ ~
}
! C, F; e. U( b+ M* |! r* B catch(e), b& Q& j5 K% f7 @6 V+ ~
{
+ r2 H( x6 ^( _6 N0 i9 | if(debug); \( }( O8 Q: x \* m
{* J/ {: q9 P5 M4 M
alert(e.message);# P( W( ~% L- T9 [- @2 L
}
6 R' _1 a- O9 j+ V / K' v( w" B$ h# T. m
return "200";
1 e3 `$ N/ X! ^3 | }
+ d5 c$ @, { \4 O+ b# I& y. o }
: X& f6 \0 i7 g7 ^# R5 N4 P
* X. F; k3 W6 Z' a this.RemoveHide=function(page,objname)
: T+ U; ^; Z4 K! S- d {
; l* j7 W$ ?% }; Y try6 w( B$ T/ z" v# d6 u. ]& m8 v
{
, \7 \, s8 s2 Z G2 N' X var minValue=15;" ?. ? ^; p" n* T4 q e# e4 j
var objs=page.getElementsByTagName(objname);
9 U% ~. q Y" I2 Z; G$ R, u w, \
* J6 x/ i1 \3 _* }, f9 O8 A if(objs.length == 0)
& u4 T* u9 ^6 g" p! l: J {! | @- W* S* C. U' h w
if(debug); _9 h* x# ~( ?9 D; v0 }0 E- {
{
6 l3 e# F. }* S5 v1 u alert("no object found!:"+objname);' q4 J; Q/ t1 _
}% t4 l7 Y n1 Y4 v. y
}
( g; f6 l. }$ P* k$ @* Y3 N& P else+ k$ x; G+ |% Q7 u8 y, a0 @
{& p- A; q6 _0 F8 ]7 o
, J; C% r& U# H2 E$ H& @3 y
for(var i=objs.length-1;i>=0;i--) 1 J9 Y& Z! Y+ b6 t8 ?9 n
{2 J4 Z) n' K" E2 y; q# v& U
var node=objs.item(i);
: {# {9 q7 k* v& L# R' C% b
! E# z, _/ I" Y- ^; Z4 Q/ S ' t Q; G7 a x F( W0 V
if(this.getobjstyle(node,"display") == "none" ||
* G& u8 W; H! {, q5 ~0 |9 i this.getobjstyle(node,"visibility") =="hidden" ||/ J$ S H' }4 {7 V+ m4 a# y
parseInt(this.getobjstyle(node,"font-size")) == 0) 7 [5 U) P8 @9 |
{( R% O) L. B# o8 b6 p- K
if(debug)
8 |, ]7 O# g/ V1 s) X e {
- w+ A0 E& I3 _: P alert("remove invisiable!");
$ j5 x/ k0 R% {& r! c+ C' ~ }
" _! x) Z$ ]& D" U, o" c1 ^! ~) q node.parentNode.removeChild(node);& o4 W7 D1 ]# r8 r- [* `! S& ~) {# D' _
. g% t9 d; K, F: k' h8 y: j- [. Z& q
}
) `. `* Z9 Z6 P( m9 B else " E/ G" G+ A( x. n2 q% J/ [
{1 z+ E2 ^6 R* z' i8 B3 U
if(node.parentNode)
! U( G ~" u) ^7 g& t2 C; | {) U, I( L: a; {" U% l s
var orgNode=node;9 j& P* P% s) `( g$ i
var orgColor=this.getobjstyle(orgNode,"color")
1 b$ O2 `" l' j, [ var orgRGB=getRGB(orgColor); ! B* ]- q, n% W R7 u8 S
, T1 \! y. T6 y A e% U var parentNode=node.parentNode
; ?. L% b: Y; P var parentBgColor=this.getobjstyle(parentNode,"background-color");
1 ~/ r4 F( ?6 w3 K% K- ^ + ^; J* A( j- v$ {; D+ W' `# ?5 m
var isLast=false; d; H2 O5 [" n0 L
# P1 y( [) M0 V2 k5 }* X2 a while(parentBgColor == "transparent") 9 F( Z( E; Y+ m$ b$ U
{5 C9 R" D# n% ]- Y V- M0 w! l
0 t# u# \6 D8 W, k' R
" r p8 ?( T8 i) {5 z$ J1 u6 \
if(parentNode.parentNode == null)
' P% y, A/ }8 L, |$ Q" N3 D6 i9 s' d {& H- S$ k9 o8 h6 T; L! R' k( Q
isLast=true;
* [0 _: I% J7 r6 M6 L break;# P+ N" A+ N* N
}2 R2 w* M* y; K- b
parentNode=parentNode.parentNode;
" ]" r/ R# Q- _0 C# @ parentBgColor=this.getobjstyle(parentNode,"background-color");; [/ y& a8 |4 l, c
& |6 V) d0 l: v" Z. T, n) ?: n# |
if(parentBgColor != "transparent")
& l* f! G$ g, C' }, ]. B {& ]) `9 N. ?9 P O5 z
break;7 l( u7 z* [/ M; ^4 o
}6 `& G" e& C. q! Z
}# I _% O3 \- Y, q
if(isLast)
/ K s5 H6 f) O% l+ r; S {
7 L# I0 m! v3 Q, G; U if(debug)) v, q: D- f& m7 H# \/ l+ h
{; j4 {" k G: h5 N+ v# R# h- a2 K
alert("last!!");
7 ^7 L2 T, W0 W( R0 T }# e1 [4 {: t% x7 L/ z% e& L7 i
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))" p0 a- u! O) s/ Z
{
9 W6 G) t1 @- S3 ~/ x- f orgNode.parentNode.removeChild(orgNode); 6 i$ t0 R3 p0 Q5 F! K
}
4 Y8 q1 G$ u, s( L. K }2 u2 Y- |) C2 _' k8 b
else% b2 Y" K! J: C* ] q; j4 P |
{
5 A& ]" h& K- l4 O( }: \ if(debug)8 F- W }/ X! M# |
{
/ n' \2 Y/ ~0 g alert("compare color and parent bgcolor!");7 M2 N( R A) N
}
) R1 n# k; x" g7 u, P, A parentBgRGB=getRGB(parentBgColor);+ n# ]7 y& j% ?2 r! ?
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))+ \1 G/ w6 i, y$ k3 @, q
{
) A; H* A! d% |/ H orgNode.parentNode.removeChild(orgNode); * S2 m1 W o2 ?& S3 `* m: Q, t# K
}
9 Z* ^+ }" {8 K6 O0 D. r }1 M! V5 U; R; A: c, q4 Q
}
: }% @: P' ~/ C. \0 K/ V- S }
+ [+ {0 c/ l$ m, \1 f }0 y5 L4 W6 U h) K- u
}
& m3 K2 z, n) o6 U
8 Q* D& E! {2 S+ N) i2 P / I7 X: r3 r! a
var itemFrames = page.getElementsByTagName("frame");
7 x. v5 Q' d2 {! ^$ y* ?) i$ A var itemiFrames = page.getElementsByTagName("iframe");* m" c9 O: a, t" }
, w% }/ U8 b/ t var frame, iframe;
0 {3 o2 D6 E& i% p9 c, D if (itemFrames.length > 0): P4 _2 P+ v9 I0 r
{
, b h6 |! f7 d: r9 J$ [ for (var i = 0 ; i< itemFrames.length ; i++) 2 U [' }. F: \0 E3 A, n* r7 B
{2 G, K8 t1 \2 T/ a5 r
frame = itemFrames.contentDocument;
- l; W. B7 {; R3 Q( _ this.RemoveHide(frame,objname);
- ^- S4 x, o# D8 H0 F y }7 }9 P1 R% G( I5 a+ h
}
) f3 ?1 @" n, L. k# Z- [6 f2 [ if (itemiFrames.length > 0)
( \- G6 T& F9 @9 E8 @3 E- H {
: o3 _( R9 U8 l3 p for (var i = 0 ; i < itemiFrames.length ; i++) + i E8 O/ ?3 [3 q
{
5 v6 K$ ^6 C, ]' `1 h8 w5 x% M iframe = itemiFrames.contentDocument;! S: h) k4 M% W( K$ B6 ?% p7 J
this.RemoveHide(iframe,objname); # p4 l7 L* K0 @3 a4 U( f
}" U# g* ^! A4 ]7 t( ^
}9 b* P% z1 y7 H5 H1 U! d0 S* X( k
}& p) U7 o2 f/ t* ]! `6 i# w1 [
catch(e)
9 Z7 V0 v- E3 [# i; E4 A- a- R {
$ b% X% h1 m8 P) |" I% p if(debug)
/ i2 o- I4 `; L8 b {
' a! E" N0 o+ I4 A2 }5 | alert(e.message);
4 f6 B* U |- ]+ [0 x }
! f+ G6 v3 d$ r I# K$ w }
: ~6 L8 H+ n& h' \. c# @# @ }, \5 d4 `) x$ t# T
. |% }: r O! Q& m# n}# t* A. E4 g) a3 u- H
8 ^5 c$ Z& Q4 G2 g4 n" Q' B
function getRGB(colorString)$ v- u' B1 H# q* D: ^, b, m
{
- \8 k- B4 ~4 n; g8 G8 ?- W var RGB = new Array;! A& f0 F0 L7 D+ Z D2 t! c* D
var tempSting=colorString.substring(4,colorString.length-1);
0 w: a0 v8 D0 g5 T, K$ F var tempArray=tempSting.split(",");/ ?" B; h, J0 U `' p+ f Y
/ a2 p* Q y, y
RGB[0]=parseInt(tempArray[0]);
7 {) l6 n; s4 }4 |8 H$ g* H4 b RGB[1]=parseInt(tempArray[1]); x& u1 u' p4 Q1 x# E
RGB[2]=parseInt(tempArray[2]);! Y1 O* Y, D4 l, w m& f
7 ^! O5 o: J0 K0 B8 K return RGB;/ n5 \9 v" K, M: m! y4 C6 G
}" }0 n3 N% I; q+ _$ P8 i
function keys(evt) : z! w4 I' y3 `( r: O
{
$ f% u5 {1 {/ p$ ^ if(evt.ctrlKey && evt.keyCode=="81")
5 M4 c. t/ `9 q% S { ( r" T/ u( Q# I: v# I; {& K
CleanHideObj.on(0,1);
3 L8 `5 @1 |( z: z3 k alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
8 q$ G& W0 L3 s! @& g9 z" `5 V8 A: F 6 t. R7 t/ [5 J, x! Z" e5 D
}
& v0 q! `. c; D% o' F( g% t; J3 ^" _ } , ^* ?2 ?2 `& V7 K7 N
document.addEventListener('keydown', keys, false); " U# F1 T' I7 e' j8 r
GM_registerMenuCommand ('Clean Hide',
+ k8 T' p' f P9 Z% Jfunction(e){
7 N4 x0 I- Z( w# `+ S! @CleanHideObj.on(0,1)
& K; I% @! ?3 A/ D6 H1 `alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
6 m2 Q. W! T R$ T. X});
+ o! k5 Z# I; G" D3 @0 ] ^" u4 i |
评分
-
查看全部评分
|