|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
" l$ `( ^/ B# y% k/ N) J. b' F h. Q, I* c* T
火狐插件,用猴子3 V% V8 V* m9 Y+ t9 x6 p
; e# i9 X/ R$ o1 a( T0 A3 s
var debug=false;
+ }, C/ O. f4 W$ i) Zvar CleanHideObj=new CleanHideClass();
' P( o5 T6 j4 i
- e8 p9 M# h- M1 F2 p; r$ b% C) y; Ffunction CleanHideClass() 0 a) q% r9 ]$ ` w T, y
{ 7 C# p/ g$ W* v& d6 u H
# {$ U, d) x7 l+ H
this.on=function(id,bMZ)
3 M0 I9 k; r5 g" z4 S$ b9 U% {& Q1 [ {
7 v! _" G) @- n: \; q) Q 8 W$ j& [& m8 b( Y
if(id == 0)4 q( ~5 q( x$ G. U3 g/ `+ s* `( \0 X
{
8 v; ?/ ]" w, L var page=/* document.getElementById("content").contentDocument */document; 1 T1 R" _. I- p, s, V3 T0 Q
this.RemoveHide(page,"span");, }: L& ?/ {! [2 q
this.RemoveHide(page,"font");
C ~& x* e1 W2 P this.RemoveHide(page,"div");
H9 l# i1 }( Q0 _3 ~. F+ j) y/ o) x this.RemoveHide(page,"p");
! H' }! {( z: L% [* W S, t* Z
, L, q/ s- a3 S/ c9 @) h- n }& q- P3 e' x$ P* k
2 \7 t3 h3 F! J" p/ z8 o
}; b' V: z1 J8 F( y5 u
this.getobjstyle=function(node,prop)0 C; A' y/ \" A& `: y$ t
{+ I; W" ~- ?3 m+ ^( |+ {* Y
try; l" q* \' F: s6 o' [
{4 W; t: V0 N% s6 W* q. N
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
9 B |! r% L3 w }
$ N* K4 s3 A2 c; x8 K( M catch(e)( E7 e4 b+ U: R( ~! [: a
{& w9 z; {" w7 G$ @$ G. {& I9 p
if(debug)
/ b8 A- W( m; H) _& g& z3 n0 @: ~2 i {
1 ~7 `7 |1 L3 ?4 j9 x* A- R alert(e.message);1 B) W) I9 O& [5 j
}
, \1 ]. a# u1 S+ u( Q. W ; S4 R7 @: V: z- @2 ]0 D
return "200";
. L# B' ^- c9 m2 q6 ^7 P8 Q9 [+ ~1 k }
5 k& B) A, r, \7 D, n }1 o+ t' [# F! `
3 j$ z3 q- l7 G& x+ D: U w& a. ? this.RemoveHide=function(page,objname)
) V; K, D/ u1 j6 E6 d {
' H- W$ A2 R& Y; t: h; N5 V; x! j( \ try
8 B4 Z/ b& N/ P+ [1 r B: r/ e {& d9 r6 E2 ? C+ I; B; d6 g
var minValue=15;! s" W# L% X8 u6 a9 W4 z
var objs=page.getElementsByTagName(objname);
, Q$ Y1 |) E! g1 n8 \9 d" H- n# r0 ]+ Z% H# X5 T
if(objs.length == 0)
3 j1 p, j$ @2 V- G) H" I& h {4 L* p h$ P+ Y/ M
if(debug)
" \4 F: t( y A9 M$ t' {* L7 @: T {4 z2 `5 ?6 t& g" m4 V
alert("no object found!:"+objname);2 j+ W7 n7 `6 t; R v
}
2 g& M1 C4 C; t0 n2 R. D }* t. o; Z% v, I' y& Y) I
else
) G6 V+ m" g' }- Q/ q {
% ? {- Q1 g8 s% B# n 1 x4 j: r- `4 {) U8 Y! ?% n9 N
for(var i=objs.length-1;i>=0;i--) 5 k- C1 J$ j) O, f4 H; h9 \& b- a2 I
{; O8 J7 G( \ w' H; m4 g6 `
var node=objs.item(i); % }! o4 }) B! W3 c1 j6 M# M
4 Z: J8 u* |+ N7 G
( U/ s; S. s/ u! q5 i if(this.getobjstyle(node,"display") == "none" ||" i/ j) O+ g6 M1 z$ s% B2 B
this.getobjstyle(node,"visibility") =="hidden" ||7 E' Y4 u/ l* t
parseInt(this.getobjstyle(node,"font-size")) == 0)
' M. Y; M$ `+ c {5 v {) b+ f. D) d; l$ |2 t! k( L" q, J7 t
if(debug)! y( a. y! Y6 u
{
; B# m/ O v. ]9 K6 u alert("remove invisiable!");
/ D1 {% ~/ k8 G5 p8 R/ k }
* V T8 k# H$ a node.parentNode.removeChild(node);
+ `& ]5 T3 m9 a& y& O) Q + Q" _+ l4 R: ?0 M: m( N, @* j
}
$ u. J* b4 g* x# ~2 I9 u7 I else
$ w/ }$ `9 Z8 @' b: n" ] {1 I/ x2 d( o# y- H! Q
if(node.parentNode)
8 u, c% h6 a4 V# | {; Y3 m7 ?0 P" Y [5 V3 y6 L
var orgNode=node;% k3 ~3 e2 A8 b0 v
var orgColor=this.getobjstyle(orgNode,"color")
9 Y' B. p( l4 g+ J5 H7 I var orgRGB=getRGB(orgColor); 9 \3 @9 f b2 g D f) ?, A9 x
% _3 X0 q" z/ D( Y
var parentNode=node.parentNode
3 }. m' k# F6 e2 C8 ? var parentBgColor=this.getobjstyle(parentNode,"background-color");
0 U- m- \! O8 _' Q: |5 g2 K $ E* Y' l5 W5 f$ M* p
var isLast=false;6 a6 f4 `8 Z, @0 n5 D) D
- F! U6 b! q) v' }2 y$ A7 i' L: `
while(parentBgColor == "transparent") # N' [3 e0 @9 `. v8 { m4 T
{5 z) F% V1 ?- _1 X
/ N* n( V8 Q* q ]" K
3 _2 @% @+ X: W7 w: R- _ if(parentNode.parentNode == null)
8 I. P8 w g9 u {
4 T% w8 A$ n7 ~ }7 a isLast=true;
% F9 [$ H/ y( E break;
7 V& r6 l6 M$ z8 i }# w; ~: L; k7 f- n* e
parentNode=parentNode.parentNode;
! [& G# T0 Z# n parentBgColor=this.getobjstyle(parentNode,"background-color"); Y$ f" J2 ~ [& A! I7 ~
' y, O1 Y: T! k5 S1 r! x4 ? l, Y if(parentBgColor != "transparent") 9 I3 u, J8 e" j y. g$ r5 D
{
9 r& z; }' X ` k) Y1 T break;
# c; W# H5 ?. e5 d- f0 l }7 `) H4 [' w3 u' {, y
}7 U9 e5 X$ O4 D) n& b3 e; H2 s( c
if(isLast) - R' T# v* p) t5 h
{" f+ s& {3 K! a
if(debug)
; U; a. f2 l+ m, N$ F {) F1 p" ^" Z- i% o/ Y: \2 V
alert("last!!");
, e: x7 y" Q4 v4 Q. N4 f }/ u0 L4 i' C# Y! u* ~1 @
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
: J. T; n+ n, F" b0 E8 T t {+ O; f7 w, K! ?4 s$ E4 s
orgNode.parentNode.removeChild(orgNode); 7 @! f, w0 T1 e' L; q
}
. f! a( w. m: {2 P+ n' d }
4 @+ m# K% X0 s. l+ }% Z" H7 _ else
& V9 U. G6 d4 ?5 K! y: _5 C {
' m( T' f1 C ~5 c* { if(debug)
5 z! \0 Q% @/ S, m {) u8 z5 {' d, M- c' R+ P4 ]* j
alert("compare color and parent bgcolor!");
8 q2 w" q, B* R }5 D1 y B0 V& ]6 a8 ~9 t- H1 b4 a
parentBgRGB=getRGB(parentBgColor);
0 N* W7 \7 {2 Q) j8 \ if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
3 n! K+ Z7 |3 i {
$ i; r, g+ Y# y6 N; B orgNode.parentNode.removeChild(orgNode);
; {6 W; {% i9 s/ G$ M5 ~" ~ } H& f; D3 t6 o/ ?5 i
}
: I- L) N. I% ?* }) F }7 {. {6 g0 P7 K% @3 o
}- R& l! O* G6 q6 j' e7 P& A
}! N4 n3 y2 y7 O5 Z8 \7 r7 p, r: Y
}! B5 I! n0 u1 j, ]8 M4 x
I- \; ~* {# }6 n6 R/ |
. Z; [9 D" F. }4 |9 s M0 I var itemFrames = page.getElementsByTagName("frame");8 L$ }: |! f6 r- s
var itemiFrames = page.getElementsByTagName("iframe");
1 y2 o; x( W6 s4 b# D+ ]' ~( X: s
# V' M8 ^9 a2 S0 X var frame, iframe;3 ^7 U' q# W- P% Z, |9 e1 h7 I
if (itemFrames.length > 0)
) I; B7 C3 }- a6 y/ J' P; ` {
$ G+ j$ Y' N2 p for (var i = 0 ; i< itemFrames.length ; i++)
5 O/ ?; `: j" q& m {5 E' \! Q7 l1 c
frame = itemFrames.contentDocument;1 S' |5 s+ O" e% q( L/ N
this.RemoveHide(frame,objname); 0 ^- u( k" ~' ^- o: E/ w
}
# P' Y$ y1 _ C) P }
+ q6 A3 `- c0 x" u if (itemiFrames.length > 0)
$ h$ K. e/ g7 N- b {% Z. ]: S4 V) ?0 x* ] h2 l) I; E# s
for (var i = 0 ; i < itemiFrames.length ; i++)
5 E" [- X& g( [1 l% j; y {: `) I. _' u" z
iframe = itemiFrames.contentDocument;
% \# Y" E3 v V- _+ S( P8 L this.RemoveHide(iframe,objname); 6 _) M6 d& S" x' q# D8 b- |
}
9 b% _9 p- U+ W8 y- @% D' u* v; w }7 p E' b" _; E
}# k2 r+ P7 O4 A7 _8 g1 p
catch(e)
; C7 C9 ]* d5 @ j$ R, R; [& o1 |7 w {% F$ S5 }! Q) ?" t- N
if(debug)
; d/ D; c; f4 q- y! T( I W {
% n' X3 z* T& J alert(e.message);
+ ` O3 i& Q Q }
f1 r6 A5 r, N } w! w3 ~. e% f) H
}
' @! c4 Z/ @7 r
8 q3 f% j9 E5 ?4 U" n6 R/ N" E/ J}
3 h* o/ v# z' q& W Y P6 w
+ l2 j3 E: V( K, Lfunction getRGB(colorString)
/ P% s8 T; v# g2 R, e0 q( N; ?{8 z: f, f, m5 ?
var RGB = new Array;+ r: K7 r _$ I0 a- J* `6 r+ [% j
var tempSting=colorString.substring(4,colorString.length-1);# q9 \: U; T x) d2 t
var tempArray=tempSting.split(",");
7 o( ^: u' I2 b, ^
: h" c/ ~3 O3 @3 @. }, d RGB[0]=parseInt(tempArray[0]);# E: I1 X8 p* O4 I$ b+ n
RGB[1]=parseInt(tempArray[1]);( [% L9 K, S+ J$ u) r" X8 g
RGB[2]=parseInt(tempArray[2]);
% d. P6 R/ N Q" `' c; K; ~1 |% T 7 h; M: m! }5 S9 i2 u. f* L% \6 C
return RGB;5 c* Z& g- V- Y
}, s5 ]; F% j+ _) s9 ?1 ]
function keys(evt) 5 @$ z8 ~3 k; i8 W1 ^8 G' a& y
{ 2 J" N- ^# E7 C
if(evt.ctrlKey && evt.keyCode=="81") ; C1 G3 f- v$ w: @$ S; N( |( T
{ * X4 H7 B) h5 j+ t" ?( }- o* b0 l8 _9 Y
CleanHideObj.on(0,1);3 S( g% z2 }7 y% _$ q+ g
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
% o: O" l( I4 X4 i. g `
# k8 u% W( ?0 o; I" k) t3 s$ Z0 Q }
4 c/ M5 H2 a/ U/ R" T1 y } ( t: Y: L0 j7 I0 s5 a, T* V+ Y
document.addEventListener('keydown', keys, false); + P9 C+ o5 ?+ i4 g0 Z2 |
GM_registerMenuCommand ('Clean Hide',1 y! j, L+ N' c' _2 i
function(e){
# y4 P" N6 D! ~' PCleanHideObj.on(0,1)* e# \6 }& s( o1 K4 G9 R4 u# `
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");2 a( Z% j3 z! Z/ w+ j; i
});4 H; L5 e% [$ o+ m. C/ W; s3 e
|
评分
-
查看全部评分
|