|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
; }4 `# E6 C) L5 `. g7 y+ Y/ i) b3 {
火狐插件,用猴子
m. ~+ T0 T* V- F! }* @% @# u v3 I4 l! z3 I. m- U
var debug=false;
& P6 {# O0 V0 Vvar CleanHideObj=new CleanHideClass();
6 y! @0 B2 R7 t _" ~% O! J2 h
function CleanHideClass() 2 V+ L6 n% z3 ~
{
2 k3 }* m) s8 w& l8 \0 w& s
1 X! v( h$ F/ g. ^ this.on=function(id,bMZ)9 `! J( {+ f+ P$ P4 P
{0 G5 j, D* ` E+ q/ c
4 f' k" h% {: r if(id == 0)
. `$ h" q, u& Y( P h; \ {
5 c8 M4 @! f; p2 J) C var page=/* document.getElementById("content").contentDocument */document;
6 @, k3 K6 w' S0 L- Z this.RemoveHide(page,"span");9 n: r# W0 }/ p! w% Z3 w
this.RemoveHide(page,"font");
" H7 p5 I* t) T" Q this.RemoveHide(page,"div");' g) w; U# ], Q6 ?1 n
this.RemoveHide(page,"p");
2 p9 N) n/ P* R$ e 3 B7 i9 i9 @- Q+ l
}1 P3 ?2 w9 J3 H5 g& l
) e9 t7 I. o6 t6 w8 T+ E
}
1 E* B2 R+ X6 T7 X3 ] c this.getobjstyle=function(node,prop)
. O! v( J! S5 v; N c# o8 D {7 y3 U8 ^3 U% r3 E2 h& I% f: H( l
try
, H6 z# Z, v0 { g* X1 x {8 F {$ B! B" A% X- A8 L9 G5 O7 D0 I
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
3 a) Q7 a2 B. c: Q; r }8 A' U: H# n0 x- i9 R
catch(e)
: ^# T7 j. U. A9 s6 Z% } @' T$ r {
' v' ^1 r* S3 t/ I5 T" p if(debug)
: S5 ?$ a7 t Y5 R {4 w8 ^& l, z# Q5 Q3 k: Y
alert(e.message);! p# H' U; s5 d
}
' }8 r+ {; d5 O
6 t( S0 W9 e- j |( r+ [/ _7 K- E return "200";
) G3 b8 D: u7 E3 o& O }, Q3 l8 e7 s( r+ V9 F5 P( G. n* N
}+ [# _( l l4 A0 u- `: j4 B8 j5 ]
" w5 A ]" G+ p1 U this.RemoveHide=function(page,objname)
! m. Z" C( |8 j* |6 k. f7 P {
}; o- }& k8 j try3 j7 j# X# r# m( L. e( U
{
9 K8 l q K; V- v' m" Q9 W var minValue=15;
4 T& ?( @$ F$ ]( s; Z6 w) L/ v var objs=page.getElementsByTagName(objname);
- E5 D& o/ C5 w1 ]; n7 ], G3 V) Q9 R! f
if(objs.length == 0)
) ^% v9 I( E( `% `3 X* Q' C. z7 E {
7 H3 x9 |- }3 n9 u if(debug)
4 j* T# i# s7 p$ I+ D' \4 U {
+ `8 D6 P) s* { alert("no object found!:"+objname);$ T) s0 e& e' z* ?0 M
}
& @8 d& b% T& {; }; d: [0 \ }
' v, t. D7 I3 m; U ?% ~ else
. x, }3 i3 `! Z* c w2 W# f+ i {
7 B/ n4 Y% V) m" J+ ^# {
* \2 X( I) W i) M! I for(var i=objs.length-1;i>=0;i--) + D* i1 E8 T( Y% K4 Y( s
{
: U9 H" [# q( } var node=objs.item(i);
& W' h+ W- D3 l$ S$ S , j$ f8 ^$ u4 j2 z: Y* y& y
/ V) i; h7 k1 B2 J1 y0 u if(this.getobjstyle(node,"display") == "none" ||1 D( {7 W7 g7 N9 I
this.getobjstyle(node,"visibility") =="hidden" ||3 G }# \5 O1 l/ L/ _% s1 B5 ^; h$ D" j
parseInt(this.getobjstyle(node,"font-size")) == 0)
0 d7 i% x: s! e9 Y {- G X% z7 d! A. v& `0 ~
if(debug)% j( ^: S3 h/ H5 _7 _7 ^: q2 e
{
+ Q. S# c9 q. T( I6 y' Z8 p alert("remove invisiable!");
" m$ ?# ` I6 \- r: U }1 d& F" C# Q/ i7 i2 @
node.parentNode.removeChild(node);
/ p* |* I$ K% h( U9 w1 W : ?) d8 L6 Z. n
}
4 d6 y' x* a0 X0 \# ]4 w3 W. m6 O9 O; Y/ a else - k. b7 R" ]7 }% P2 x
{0 f, m0 [' h2 r9 D
if(node.parentNode)
" K/ ~7 y4 [) T: h# B) I7 s {
~4 j) i1 N8 }( c- ~" l2 G* Z var orgNode=node;) e0 d1 W5 P" Y4 A
var orgColor=this.getobjstyle(orgNode,"color")' c4 y& t0 w6 g
var orgRGB=getRGB(orgColor);
3 E. G* P+ d/ p$ \ 6 \1 a, E6 c8 O( C$ k* t: W$ M
var parentNode=node.parentNode/ e e2 f3 _; Z0 I3 a5 q( b+ E3 I
var parentBgColor=this.getobjstyle(parentNode,"background-color");
9 t' g( I* u( y) Y2 Z- W
# ]8 f4 r, ^3 Z6 u+ k0 r- U6 z var isLast=false;! D; N! C" U3 H( Q! G. ]
/ [" g/ M$ v: Z! x. ~ g; u& G4 v while(parentBgColor == "transparent") A, m& g2 Y# Q9 R* f
{% l- q- c1 J2 z! Z; z' f
4 U- d! n2 R, A2 ] ; t4 K# y, D9 M, R% `( s, s7 @
if(parentNode.parentNode == null)
: T. |' T; s/ b; S8 G {
0 Y4 k* Q r7 Z. Z5 F* q6 S isLast=true;
: X7 A/ o- r( O0 x2 Z L break;: t) n) y. C; U2 I
}, Z, i) H( w: Y3 V
parentNode=parentNode.parentNode;
7 O$ G9 j: I# |3 D+ I parentBgColor=this.getobjstyle(parentNode,"background-color");" j9 |2 w% r8 y
3 m/ S+ v$ `- ~3 l) c# ?3 _& x
if(parentBgColor != "transparent")
! N$ G1 s) ?0 m. v/ m1 y" D- n {5 h: \: }: T9 ]) c
break;) k/ u6 n8 K) U* j/ T/ d
}
; J$ E5 ~. [6 L& i9 g* \ }3 r: e) {' }( G6 G
if(isLast)
2 A+ j% G$ m3 p3 P d. F! O" O {5 V6 ` t4 U o' ^8 Q, a) |5 Y
if(debug)- c' l1 H0 e& _' L4 u" V, t
{( }/ L, r- h4 s, j
alert("last!!");; @' P: H; c- L# ?
}# p# ?; w0 b' Z; z
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))" s6 \/ O$ P& q
{
: S4 N2 k2 p1 f, Y; ~ orgNode.parentNode.removeChild(orgNode);
5 @2 @) ~) z9 V% w' _7 M4 G* E }
7 q( F- ?, S# ?: |& q }
m0 ]9 o/ Q: @" ` else
/ A8 f: `2 X: I% W( d {4 }2 T# k) P( N8 a
if(debug)
; S9 b ?. B/ ` O9 g {
* W, D1 r" M. ` B alert("compare color and parent bgcolor!");% Q# E) ^" ^1 B2 b, ]" [) d6 |
}
6 t- b# ?" j7 r# `! b9 T parentBgRGB=getRGB(parentBgColor);$ _& a- j1 i9 B: H
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
: L& ~, D9 ] k {% W0 G( _' ~ _ w+ A; N
orgNode.parentNode.removeChild(orgNode); + j; {2 [& D# U
}/ s3 Z4 S/ W# X: s* O+ A4 U
}
" e" ^8 q1 x9 F% k8 h }
; B6 P- s5 k7 r* K2 r }9 h& x3 C8 g2 ?( a1 c4 X" q% ^! n
}
2 U; x. K% w4 ^' B( l+ C }
% K: c5 j. u; `0 b: q @) S 6 L: s; y7 D$ b: [
" P w& Z) B& C var itemFrames = page.getElementsByTagName("frame");
6 Z9 r0 D, B0 s+ q0 i8 f& b var itemiFrames = page.getElementsByTagName("iframe");' {$ O1 r4 [- h1 _0 Z6 s
' s/ S6 W/ R5 O- K8 ^' A' y0 ?5 B var frame, iframe;
9 d" |1 [; y. W# c2 i" G7 b b if (itemFrames.length > 0)
2 R7 m5 Y( J9 h* X3 l% F1 j {9 i3 |4 L" b' k( ^ ]; `0 z" T! p" k, k
for (var i = 0 ; i< itemFrames.length ; i++) ; C) E- j/ \1 R% r& g2 {2 e8 @+ f0 w
{ j D$ m+ y8 a9 B1 `- v; I
frame = itemFrames.contentDocument;
/ w0 [" F& K1 P0 ~ this.RemoveHide(frame,objname);
' y! {7 u* J" H3 S* s. k }1 r% @8 M. u- a, k% _& K/ L& s- q
}
! M5 a0 V$ t) v2 m if (itemiFrames.length > 0)
3 e+ q; L2 d$ F. q* K" I6 M { U) L( @# }7 _. j0 i& Y$ y
for (var i = 0 ; i < itemiFrames.length ; i++)
4 A8 a1 W+ J4 o& y {
; ?" J, {" N; B7 r5 W; @7 E" p! { iframe = itemiFrames.contentDocument;
+ {+ G- n; I; o/ x/ {; q) L, J6 a this.RemoveHide(iframe,objname); # g; j; V8 a g$ S, ]# _
}( h. z0 O- g0 R- y+ l( |, ?. J
}$ k4 c! r4 F; B% q
}8 U+ |3 n3 v+ N: e; V
catch(e). X% j2 ^8 Z' b0 @- i; W/ r
{3 n: g5 H# Y$ W+ i3 L' z! X5 Y5 D
if(debug)
% _$ E' {* O& F% [" T0 o6 a3 o; N' j {* D& q; {& a. L$ [ n; g
alert(e.message);# Z6 D9 u/ w, G* W& _+ B2 ]9 D6 z: ?
}
. t- V# e. Y! ^! f' r8 m# B }" m" M( n5 a( F0 F
}$ B* Y, r" p$ o C$ \5 D3 ]
0 f; c. y0 n( `- d* s}
' ^& T7 M7 |( t5 B4 X9 ^2 k) T1 Y, G$ ]8 ^* L5 d
function getRGB(colorString)" c% w9 a0 c7 t% K+ p
{
$ U) _; [, J+ Z9 H% P% F var RGB = new Array;
9 q: }! U+ \* f. U' D4 r var tempSting=colorString.substring(4,colorString.length-1);
8 o( M: x& J7 n# K! M) p) e var tempArray=tempSting.split(",");
& t( X+ Q! C+ f- J- c+ \4 X1 o/ k5 C
$ v" p y! y r7 K8 R/ t RGB[0]=parseInt(tempArray[0]);
* b5 h4 [" m# o8 M4 a7 F RGB[1]=parseInt(tempArray[1]);) ]5 \4 t! p# t( Y
RGB[2]=parseInt(tempArray[2]);
& Z) }4 K6 Q1 z3 ^ _; `$ W ; L2 `! Y& a, h Z4 ?: |$ P: q+ c% x' p
return RGB;
9 I4 E* D2 y" `' h5 U}
# P' P0 o/ x. u* u9 y. ^function keys(evt) 7 i* p! J0 V1 X/ G5 D# u, q3 m3 p
{ 4 _! |+ P- C: ]: ] H6 l; Z- A
if(evt.ctrlKey && evt.keyCode=="81")
# g( Z7 P5 x. Z. S" ^; B2 ? { 5 B9 r. x8 j, I7 Z
CleanHideObj.on(0,1);
! S0 I. t4 s# F9 I alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
, s# c( o/ L3 W2 o. n6 ?( ~ z 4 G& q4 t6 U% ]+ V4 ^8 ~, x
} 0 E1 {9 u1 @* v' w1 E+ M) X
} + Y7 k% ?6 t0 E6 \1 N
document.addEventListener('keydown', keys, false); 1 S) G* W8 { M6 T# Z; a. ~; R
GM_registerMenuCommand ('Clean Hide',
" V' F' b; z9 E ]7 p: b/ ?( t6 t4 nfunction(e){" @ d; q" ~ G$ D( @8 [
CleanHideObj.on(0,1)
+ \% W( H+ c, V7 ]' lalert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
" T. h% v" \1 t; a: T});' w* c- n9 }, y2 p$ i2 b8 T
|
评分
-
查看全部评分
|