|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
! @& k* t" Y- `4 P( y3 T' \% N+ F }* Y) _3 v
火狐插件,用猴子1 r0 E9 m; C9 F" ^$ [; U! X0 E
1 |, N' v j5 z1 |) V' m
var debug=false; 7 ?7 t% i- Q' [/ j; ~
var CleanHideObj=new CleanHideClass();
! \) P- F9 R& ?& j* }( q9 f! g8 z+ o I- G
function CleanHideClass()
# u! U" g& Z4 g5 z+ s" l{ % U2 }3 l* K; C5 E. F' f8 B9 v
7 J ~2 ^9 E2 ?- q% k
this.on=function(id,bMZ)) e! ^, F& A' W" M! h4 e
{
# Z/ ^7 m, J3 d : [( [: o5 [+ {. }% z
if(id == 0)0 h4 z' k- O! d7 P% e# Y
{( Y, {% ?" a) e2 K5 d
var page=/* document.getElementById("content").contentDocument */document; , @, h/ w: {/ K7 b
this.RemoveHide(page,"span");( `3 g U% `; ~& O, `; w+ Y6 @
this.RemoveHide(page,"font");* V. q; o e2 {- @
this.RemoveHide(page,"div");
) t" D7 }9 Z& G9 H! f: p; l; O this.RemoveHide(page,"p");' X1 Y9 k5 z$ h
# q! ]9 b! _+ B& ` ^ }
?9 F% }/ @1 l
# j& c/ a. b" a4 u+ C: W$ | }8 F$ ?/ w8 T9 b
this.getobjstyle=function(node,prop)9 `, B% Z5 s+ B, |8 k* x" `
{
9 V% ?' a2 b* u try
$ j8 a' Q' G+ w. [( O {9 a }3 {5 p8 y) s2 Z
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);9 _7 \( I4 c' U W% _" W
}
/ Y9 S* I4 t/ `4 x catch(e)1 Z1 u( Z% i) d' k( {5 _7 a; @
{
3 L8 C4 }# o/ V! f if(debug)4 r0 c# R4 {; f, Y q* `
{
1 N; @5 n* ]. |$ H6 n alert(e.message);
2 o" n9 G. }- O G }# l& I y3 e) p4 g* M3 e
$ b, j- E" S7 c* J: i
return "200";
0 n+ S: h+ {0 z0 Z }1 K5 p8 T; x, V$ {$ u$ v& [5 T
}
/ }+ Q b% G6 d 2 y1 C. W$ U/ d" b4 i9 G
this.RemoveHide=function(page,objname)
2 P2 p4 z: i5 ~! t# b3 a {- A2 O0 w |, t* m) k; h" q
try
# F! v( |* q$ I! E5 C) O {/ X5 x9 Q' | h. ^5 [9 z' i: C
var minValue=15;! j9 T1 D g+ T+ Z6 W
var objs=page.getElementsByTagName(objname);
) W; [6 z, R5 M1 N4 j7 \; j, ?
' I. |7 z! Y- @ if(objs.length == 0) % q2 W O; n' \5 Z) B/ b ` E
{ a! c4 x& [+ p3 b- J* [* }, [" Q& P. p
if(debug)
9 Q* u6 p V/ [* F {% T' n Z3 u2 s, u5 i. w2 t
alert("no object found!:"+objname);
: V, Q% j2 u8 W' H. w l }
u/ h+ i( `" c0 z- C @ }
$ F+ j/ g0 S( ~0 n else+ Y9 X; B% e2 x: {
{
! T! D- c( e( M: o0 F& w
6 j' W$ z3 |% I! Q+ T9 b$ X for(var i=objs.length-1;i>=0;i--)
( G. `3 `2 N! \$ n6 c- [/ _ {
7 F! K( X6 b1 n: `4 H3 t9 M var node=objs.item(i); 4 @' Y5 T: r Q4 ?: ^
( z9 \/ f' T5 j. d
, K: B1 `) g, w: J9 E h if(this.getobjstyle(node,"display") == "none" ||) d" O( W. r' j v
this.getobjstyle(node,"visibility") =="hidden" ||
4 m/ E& {0 ^1 y$ X; H parseInt(this.getobjstyle(node,"font-size")) == 0)
5 ]! P6 L2 G } {2 S8 r4 a T1 z2 D% Y
if(debug)
4 e' \# N1 T" } {/ m( Z" w, I6 q0 N+ A* W& T
alert("remove invisiable!");; [6 `( R: D& s
}
5 c- L* b: R6 f0 Z node.parentNode.removeChild(node);
7 S2 Q& s$ F, n" E' J
# {( a# `% B0 O& f) e }3 e) y- c: w1 y
else - R) |7 _/ ~0 Q' T1 h, _
{
3 y5 m+ _! K/ w; F- L if(node.parentNode)
! @+ R9 r: n' h; ^5 E {* n& e0 U- m! G) S E; H
var orgNode=node;8 J) M7 X1 g8 A1 G
var orgColor=this.getobjstyle(orgNode,"color")4 P6 h g* Z1 A9 c& U8 e. z
var orgRGB=getRGB(orgColor);
" S3 u- @7 K! a% d 2 U5 A- t: {6 D& x' j+ @
var parentNode=node.parentNode/ P. v- B- ]! r! g- {( t3 G! a, } p
var parentBgColor=this.getobjstyle(parentNode,"background-color");8 q5 ]- T% ^( F' X' a
# |2 j z0 z! @ var isLast=false;
# h2 ^" j& u: q$ r+ w * M* N0 A. ], L! Z9 |) _( z
while(parentBgColor == "transparent")
+ C1 y9 V3 ]1 x. N( a" q8 ? {
- X8 n% I4 C; B' ^) T0 o * G* O5 Q4 I( u+ ?4 {" I
% ~5 |( L+ u( x4 Z$ F3 [
if(parentNode.parentNode == null)& ]: V* W+ S4 H1 j
{2 t: e* T, l' A3 O9 h' l$ ~
isLast=true;
# ~1 g7 y4 d) A, I0 B7 y0 V- A break;- n% `/ V& u5 `; x5 V# E
}
/ s: _. ~4 y6 T, i parentNode=parentNode.parentNode;
! [. p( {1 j6 q' C; q parentBgColor=this.getobjstyle(parentNode,"background-color"); p. h9 ]/ g8 I& Q
, x4 }7 |6 z1 q/ f0 U if(parentBgColor != "transparent") 0 O" b1 y3 w3 }+ e1 v1 }
{1 i5 k4 I7 r- c2 Y8 K
break;' @! b/ }7 f$ b& ? H1 D" ~+ @% L: ^
}6 y- D! O. b4 v
}
2 S L& C+ u" T6 y1 N7 W if(isLast)
8 e7 U2 w% ^) R' N; P) a2 J; n {4 a& d$ Y1 ~ }" b, m0 j
if(debug)
$ Z; \+ ], |8 A8 r {
% g" ~4 e( E! L) L alert("last!!");
+ a5 S5 Q% |( u U! y; b, Z* p }+ S9 x& {. h% B) V4 \9 ~5 n
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue)), M" B5 @4 v2 r
{
0 E& ?! ^0 Y0 A) c$ z: v orgNode.parentNode.removeChild(orgNode); . F4 b4 n7 T. \2 `
}
7 j4 X+ ]# K+ ~0 N% Q( ^4 t7 ] }
& A4 g/ S& |# f0 E9 W8 |$ W. i, P else) ~. t; _2 n" N
{2 F0 q5 q- y: z2 e
if(debug)" B# `: A8 x7 i- h6 w3 \
{2 q' _" H& ]" J! A1 W
alert("compare color and parent bgcolor!");
* `4 a$ n8 N) D4 e; r& D } Z, t/ _6 ` K% o! y f& M. u7 H/ J
parentBgRGB=getRGB(parentBgColor);; F! m: Z' j: W P" ^; h* \0 f7 S- Z
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
) ?4 v+ n( g1 q5 w% Z, d4 m {1 |/ t, A7 L/ V
orgNode.parentNode.removeChild(orgNode);
8 y- B3 C# J- {) }8 |3 u3 c }* ~) I& U# w! F
}+ p# T0 h! s1 W2 a
}( O9 B1 E; Y- K U
}
( J4 A% Z* y/ F( X" E }) B; \; X4 T: ?" X( Q$ C: H
}8 }+ \4 m' E( y' w+ m
$ N2 [8 L) J8 E- q ! Q6 O t6 t/ `2 y- J* W8 E0 }3 y
var itemFrames = page.getElementsByTagName("frame");
0 H" q- ?3 ]/ q, n& e2 C) ? var itemiFrames = page.getElementsByTagName("iframe");5 t1 W* \+ S, v' p9 s
& J$ n1 c( {- l) i8 E( K5 K
var frame, iframe;
. W' k4 V, V1 F7 y+ e; G+ b if (itemFrames.length > 0), m' q( O% o" S& R& s
{+ U n: @3 W- N, Y; B3 ?
for (var i = 0 ; i< itemFrames.length ; i++) + y$ S) T, Q7 }6 g2 L7 M* @7 r
{! F4 ^& m2 @! Z) w& }( S
frame = itemFrames.contentDocument;/ Z5 B; V/ d0 n" j' I- t6 o
this.RemoveHide(frame,objname); 8 n' @4 {% |/ f9 [
}% a' X, d* W) y/ ?( u3 Z
}
, d$ [& l/ L: L O4 ^; H5 I$ s& B if (itemiFrames.length > 0)
- v; O+ k5 m' ~8 T" V$ k) W {
0 L" t7 {$ O {! E3 x' Y for (var i = 0 ; i < itemiFrames.length ; i++) + Q1 r) H" ~. m/ ?" }0 s: a% V
{
- q: B9 \" t- S+ G iframe = itemiFrames.contentDocument;- c# A: i( l3 p; M7 Q+ f
this.RemoveHide(iframe,objname); 4 l1 Q( i- i; \, {% V+ N6 c6 h
}* [, ]6 F4 l$ `& B/ X: m1 @8 H* `
}1 s8 Q; i: f; b5 U( b
}6 U1 v: K( J$ n1 {' `
catch(e)) ?9 ~1 n8 S8 _' R6 V8 L
{7 w I; T/ S3 Q: U
if(debug)& B3 ^8 |" A7 u2 H$ B: g. n2 E' I
{
8 e; A# R: @4 ^5 L0 t alert(e.message);
% u4 W& X2 y% G8 f }
, G- Q( @! ^" ]% J: }" q: k" H }7 s6 f( n5 z6 N4 F. `, R
}
( e% c2 w8 H) _9 m5 T- G
2 H* K( k" y$ r# L}
8 K( E: m# n& O u- I
$ I6 t0 |4 y0 l4 G# ^: ^/ Zfunction getRGB(colorString)
- b& z6 n# Z3 d{% {& K& |9 r% L2 J7 U- `; T; N1 o
var RGB = new Array;+ [3 }1 b( M7 J1 N+ a; |( s
var tempSting=colorString.substring(4,colorString.length-1);
0 Q( U% b0 W. F8 m var tempArray=tempSting.split(",");
# B. M( i& x {6 ]0 F, {: |! w7 h' `6 ^, c. s+ {# e5 \
RGB[0]=parseInt(tempArray[0]);8 x5 b. p9 y, o( r
RGB[1]=parseInt(tempArray[1]);+ A! C2 z, Y0 o8 X, n \- G1 t! R
RGB[2]=parseInt(tempArray[2]);$ V6 x1 S( d3 V: j: D# t. K/ ~
2 R. `6 b8 e. e$ Y. }6 o; | return RGB;; B2 E& A, ^% g1 t1 v, g2 D7 W/ N
}) U0 o2 q2 ?) Z' Z( r. j" r9 Y
function keys(evt) R* x: H9 t# K) A
{ ' m. k* `) x. z
if(evt.ctrlKey && evt.keyCode=="81")
8 @% A& I7 m4 P( w# e { + v2 b7 `6 Y1 g4 Y: O
CleanHideObj.on(0,1);
; Q) I. K" B2 g/ ~: ?2 a alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
. E% {& U4 @4 Z
- @9 a, w. G8 }9 t }
* S' R5 ~( t: I( ]! Z- K. @ E9 C } " c2 @4 S* Q! z
document.addEventListener('keydown', keys, false); : _$ s& T7 T: Q
GM_registerMenuCommand ('Clean Hide',; o7 j7 V2 k: z9 z
function(e){
E& C7 w* E- uCleanHideObj.on(0,1)
" o! |/ R$ ?' `alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");( q$ U4 N7 Y0 ^& C h
});0 ?" [* B; P. Y C/ A
|
评分
-
查看全部评分
|