|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 ' F/ i1 D/ s. s
& j3 Q9 Y5 I! }% t
火狐插件,用猴子; T$ o( w, E3 o- H2 O; m/ A
0 @- ^" ], a+ Y! e
var debug=false;
5 I Y2 i# r6 N) \; y* w1 Mvar CleanHideObj=new CleanHideClass();3 t# I% y C! w/ h( H8 E
8 B7 [1 b) a6 o. G+ C! Ufunction CleanHideClass()
* @5 Z: ]- B, P9 w; u{
0 _" |$ U$ @/ H7 `5 V, {9 O% h
* [# E% h; ^' |0 ~6 }* | this.on=function(id,bMZ) i/ z% w1 y0 S% |+ }: l* _% R' G
{3 b- n1 Y" Q, W7 y+ ^
7 G/ d' V8 Z& Q: m K
if(id == 0)4 e7 T' A/ s' r% q4 v7 V$ u( u
{3 _$ G" r" c$ x4 u& _% u# k2 [( [
var page=/* document.getElementById("content").contentDocument */document; 6 C$ D7 Q& h! U8 I# t' e% I
this.RemoveHide(page,"span");0 Y1 R ]! m" ]6 [
this.RemoveHide(page,"font"); E9 I$ Y( w2 Y0 F" e
this.RemoveHide(page,"div");
0 Q; v. S; j4 B7 r @ this.RemoveHide(page,"p");- G' P7 R6 Q( k3 k
; Z6 [! M+ T3 s5 R4 K; A2 j }1 r+ `' Z4 L) T/ i3 M( j1 X8 ]
5 S2 O9 W/ u/ R1 u# H }
- ~) ?' g; u9 p- w" w this.getobjstyle=function(node,prop)
! f7 M; O' q O9 s) I( c: h, i G {$ m( }; Q: t5 }
try5 C9 @5 `# K# O( R, h- r+ t
{
% i1 S) D) i5 L2 r [/ R5 q8 B& T return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);( k+ R$ Q: w M
}
/ Z- G8 K ^1 y# t catch(e)
$ \0 f& {% t' j9 T/ R {
`' _( s. {$ k1 u( X if(debug)
0 @$ {/ |# J; i( j {
+ V6 p" z; l) I2 ~7 |; S alert(e.message);' }" K+ c1 m# L) a4 Y5 S' u
}4 ^9 h h- A' V4 L, y, q3 n" _
9 R1 n$ c$ w# ^
return "200";) u1 D n- a$ d0 E% h1 G; @& Y
}3 m: r$ H& F* L: g1 j
}
* l& U! s& @ a* y+ e( N 4 P- G0 o. V+ k; P% b- d# u
this.RemoveHide=function(page,objname), K" I9 p. D/ }+ c: W6 z6 X
{9 S, j- D' d) J' G4 d# Y
try$ [) W4 Z5 D4 d. z0 O
{
! p! j# k7 Y8 H( ]+ r8 h p var minValue=15;
. D: p& C" j& |* j9 u var objs=page.getElementsByTagName(objname); ! O, h# a8 H) {' L
% s ^* |( Z- y- B. X* f if(objs.length == 0)
# C' C% v2 A6 l* r2 l {
4 g* w7 m2 c) e if(debug)1 I# V5 e( B4 i$ z8 F' Z2 L
{
4 S2 `* b g# M2 \ alert("no object found!:"+objname);1 G5 R; M2 o0 t: J
}. ]( a3 o. d) G3 ~0 e
}
# l) n1 d1 V6 y5 u; c else6 {! u8 c. S6 ~' |2 n( i
{$ y! D: {% h# O- S: E
% @/ J1 p* X- d3 z$ E1 r for(var i=objs.length-1;i>=0;i--)
) h: m2 G8 O( V- y {, s1 ?- |# {7 \
var node=objs.item(i);
# c; A+ ~- e3 k6 V, { 9 o; R: S- O, n
6 @9 u- L: j; u& A: ?- n if(this.getobjstyle(node,"display") == "none" ||$ ~9 ^' M2 r" N( Y: d
this.getobjstyle(node,"visibility") =="hidden" ||- i, n& r- P5 `2 j9 S
parseInt(this.getobjstyle(node,"font-size")) == 0)
: O$ o1 d/ j) M% h ?" a {
) T0 I" I+ I: U1 c6 D" j& ~3 T if(debug)1 x4 f9 v- y6 z% H" F
{
) K5 f! f( Z, b alert("remove invisiable!");# o( n+ d3 L" O
}
6 s: ~& X8 D0 o; D0 G node.parentNode.removeChild(node);+ Y- x+ a; y L, d, ]
. g4 i4 u+ I w" N }
`2 w0 _7 t% O ` else 1 d2 D6 s+ r' r! c6 B
{
c0 f" U" G/ H z6 I- L; _ if(node.parentNode) 6 }1 \* f8 h' D8 p( N
{
0 J6 m9 A& T+ {3 d7 q( N var orgNode=node;
! x* `2 H4 E% z( i5 c2 } var orgColor=this.getobjstyle(orgNode,"color"), L2 t5 m2 R. l! X
var orgRGB=getRGB(orgColor); " D- S1 w r) C. _7 {! F
, k2 H; O" l, _6 i+ y
var parentNode=node.parentNode
4 z! ?+ |- K7 b var parentBgColor=this.getobjstyle(parentNode,"background-color");0 L1 B5 Z4 a3 J0 H. P {
7 I7 ~( A$ @! M7 X" s7 f% T var isLast=false;
9 L) y ] z' _8 Q; |, l & S2 G0 s3 y) o
while(parentBgColor == "transparent")
' [2 L, I5 e: f! L+ M {
6 C( A7 ]$ N9 A% I + v6 o6 V: F3 ~
# N s0 d7 o1 E" _
if(parentNode.parentNode == null)
+ P* I. y/ c1 N: z) G& `) K {
% Y$ B. J/ Z" C3 d# b+ |7 n isLast=true;
# P9 h4 Q, ]; H3 U break;
4 @9 b& Q% ?+ d& W$ ~6 `9 t6 t }
; a0 o* S! Q- G2 U& N+ |! U2 ] parentNode=parentNode.parentNode;
5 b. `* t p ^$ }* ^7 i/ L4 s9 r parentBgColor=this.getobjstyle(parentNode,"background-color");6 s$ e4 L! C8 ~8 U; q( {
. w; w e& p6 D) r4 J if(parentBgColor != "transparent") % H1 G/ X; W* [5 K1 l8 `- F5 i
{
! r- B' R; ?9 {; a% {9 D5 t, h" a( ?/ e break;2 S+ w; h' T" J1 x" a% m; x
}
" K. {3 S P# R& `* ?. m( p }
/ k9 H ]1 b* d8 d if(isLast)
" f; l( v7 F5 W' R7 U {
# ?; F2 A3 h9 B- d3 h" [ if(debug)0 q2 N8 E; }3 ~. K/ T
{* f% r1 ]. R- b% k# k0 ^
alert("last!!");
7 e O+ K. |; A6 B/ V& R6 m6 o }
/ v6 j& m1 t2 ~& D6 h6 A3 ~ if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
9 y* }! s9 O! R! f) b% E {4 E4 i4 b7 o1 K, f+ T9 ] H* ~0 ]
orgNode.parentNode.removeChild(orgNode); 8 D0 @6 }; \3 K5 @
}
8 ?6 |' r( j( i K) l }2 z6 H A( X5 S% B0 S) e8 J" Y" |
else
& O$ [* q9 p1 x8 Z3 [# ? {
/ C$ z: j" w3 r" m# x `% {7 C0 d if(debug)
3 o: d- X: q" b5 h2 Q3 A0 a& q9 v {, p6 D) A# P) ~. q& U8 r' e% _
alert("compare color and parent bgcolor!");
* c, p4 H$ P' V' S3 ^$ W }6 {" |. g4 Q6 [6 z' e
parentBgRGB=getRGB(parentBgColor);0 d$ A+ i+ |: O7 [7 c. R) z. r
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))* \$ l2 Z6 E% F! J1 V
{7 P5 K1 l6 _- {% z
orgNode.parentNode.removeChild(orgNode); ' d9 Z. f$ i* l
}4 N1 w* a3 y0 T& n ^
}3 \ G$ Z' X8 p6 o, _ q" m Q
}
# a* W. g9 l. N- g0 d }, t3 M1 G) g/ p( f' C3 |
}' y9 m/ z# l" s6 [+ i: C/ k4 L, {
}
6 z" e5 X3 D( N, o 6 p- d% D- T8 v2 E, F) o( ` A
3 C0 [ c' H, g* y var itemFrames = page.getElementsByTagName("frame");; F+ b" Q( I! l7 k) h1 _
var itemiFrames = page.getElementsByTagName("iframe");2 \; H) a9 M' }3 j% Q
! h1 m+ x: \( G) v9 M
var frame, iframe;
6 M# Y; [- ^- M8 k w- u0 [5 O if (itemFrames.length > 0)8 y1 ~5 |4 G. p( }, z1 j
{
7 _; A- T/ X$ g& ] for (var i = 0 ; i< itemFrames.length ; i++) 1 `6 h* \2 e5 Q+ o( h6 ]
{
* E& D% T! V6 G frame = itemFrames.contentDocument;0 U4 h0 r! e! |7 h, @; y. S
this.RemoveHide(frame,objname); ! P$ i2 V* \2 Z: |9 r' @" Z( ?
}% u& \$ D# t/ J- m2 U& I6 z, \
}
0 ?1 Z4 m! u; h if (itemiFrames.length > 0)& l" i: @+ a2 }# h, X
{7 z( V8 k# N" L/ `1 j; u2 a Z: e0 x# k
for (var i = 0 ; i < itemiFrames.length ; i++)
4 ~: i q% n2 c/ D5 j. ?* C8 d" ~7 k {' }% O$ N- E$ @7 G
iframe = itemiFrames.contentDocument;( o4 e( s5 v. g, F" c4 {( ~. v
this.RemoveHide(iframe,objname);
3 b2 D2 z2 W" u4 L3 p) C }* @6 k9 e5 `# |& z8 o0 l. }: l( Z
}
q" B5 P2 \, ^2 s' c }
5 `% q* [1 j( X& t5 r3 }" k$ X catch(e): A; a/ I# G1 Q7 Y7 ~1 v' i
{+ b# a# O* v( ?& z. s2 y
if(debug)
9 ^/ Y! p4 E1 w: Z {& E- o. C7 `: z% O$ g+ E/ e
alert(e.message);7 l+ C* q9 V5 J6 k b8 Y6 ]
}
4 U Z" D& Y% Q2 Z }; r( |6 p: s6 T, e5 K4 t7 Z# j4 r
}
/ l: H% T2 [* s k* d. E , Z. m, y; J* R X% R2 q
}
6 d3 m; k' n; X/ ~3 s; z2 p% Y* h5 M* A' f9 Z( ]
function getRGB(colorString)
+ j6 j4 ^' A. C8 \0 e2 @{
, ?' [5 Q4 A3 ` var RGB = new Array;1 T" v7 y3 t& c( o9 X
var tempSting=colorString.substring(4,colorString.length-1);2 u; v( a. D2 r7 Z& A5 k0 S4 H% U3 v
var tempArray=tempSting.split(",");- C3 Y* s2 H% x5 \: j7 A/ L
2 Y, o) [& [# }
RGB[0]=parseInt(tempArray[0]);, E: p' C7 w& q+ @
RGB[1]=parseInt(tempArray[1]);5 X5 A8 s# `# R3 L
RGB[2]=parseInt(tempArray[2]);5 l5 `) i+ R! g. m0 W' w
% q# _# l7 \9 m5 N# b( v8 ~
return RGB;, L# e0 ~; U x5 ]+ L
}- t( o5 \! C3 Z
function keys(evt) - V9 c! G4 L- T; u# O( [# P& r A8 Q
{
# D& R' \6 `: ~0 r' [ if(evt.ctrlKey && evt.keyCode=="81") 3 I& V# r5 ~. K$ l* ^- L+ R% h! M
{
2 ~* T/ b: ]! n* J& _. V% T CleanHideObj.on(0,1);
0 m1 \: p% [: i6 U- w, I alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
( i/ D" c# m4 w$ f- X
3 F1 F: @2 \( V2 m1 t } $ V8 I, M( x+ T% t2 `- T4 c2 \
}
1 u5 f( z7 ^7 i4 D; s! R: vdocument.addEventListener('keydown', keys, false); 8 g2 A! _' U* A8 R2 W) ?, E+ }; C. E
GM_registerMenuCommand ('Clean Hide',7 d9 K% a b1 F. f+ w+ u
function(e){
, ^; R( A, w5 A; r5 L0 t( D$ j& RCleanHideObj.on(0,1)
/ O; m: T; A% \alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
0 c/ ^; t* x; l; S* C* ]' x});
* \4 B" G3 Q; z |
评分
-
查看全部评分
|