|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
% h5 } o" f/ v2 z: }5 h, t8 x
' L2 N5 n' F# g: ?" m4 `火狐插件,用猴子
{; q5 I# }! m2 y. `1 r- ^0 M7 B+ ?+ w! X4 A; V6 q" J/ U( U
var debug=false; 4 |1 P4 H1 ]* @' ^- x6 d
var CleanHideObj=new CleanHideClass();
# N. ^% @) B Q y" ^3 P' F% o( H$ K4 f6 F* _' Z1 v1 ?6 _# [
function CleanHideClass()
$ Q. j9 |: `+ Q/ _{ 8 z- _0 V( H' n9 X
; u1 t, I& [" m$ C! Q% d
this.on=function(id,bMZ)* ~# |) H) [3 ^8 ]' R, J
{
" i* a4 s' `; B# J* b G& n& F% c 6 a, R M' e; e7 m
if(id == 0)6 k# [5 Q% a) p. E7 v! W: @
{
; t' H+ M+ i3 e6 k% r/ [; ?1 V/ ~ var page=/* document.getElementById("content").contentDocument */document; 7 B( e0 d5 C7 H8 h! U
this.RemoveHide(page,"span");
9 {3 J& h5 R( }- C this.RemoveHide(page,"font");( ~& Y. b3 _% g" @6 D# E
this.RemoveHide(page,"div");/ G/ O# P+ n& s k* X
this.RemoveHide(page,"p");
& N: }% N: R+ M$ @1 D . ]6 P' W. M" |3 O x+ F
}
9 `3 d- _! ~" K9 I
6 u5 G2 B5 }; w$ S: D8 @ }
9 |! J* h" Q/ z5 O, }" h L this.getobjstyle=function(node,prop)
. @' u7 C1 @6 j' g0 e/ P0 F+ C* K) c {
, G2 ~: t1 ~- `* T e; } try* |3 W7 _/ `/ N Q& F
{
, n' P2 j Q+ w6 D1 |* H; t return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
7 P! ^- f2 W- r }9 ] O9 N* ^9 S5 u4 r/ b
catch(e). ~6 @5 r7 }6 u( U
{; _3 j9 P% I8 u8 z0 \' z% f
if(debug); @# P" l; c6 N' | ]8 r
{
* I, s* h% r- a2 _) q4 X, v alert(e.message);
+ \# z5 m! X! @9 c6 g8 o9 n5 C: m }! d6 w1 e7 s+ X3 w3 t0 H7 W
! k& q9 D/ v' g! B return "200";
0 L! ?9 v0 w5 \+ e* { }
5 y( z4 |8 \7 I+ u }
* g1 ]9 E* d5 \) V E
6 ?" V, x( w! o4 O# j3 ?# b) J this.RemoveHide=function(page,objname); s2 W& _9 s$ @( i: E7 s! N
{# a# ?9 @# B, j, e8 p0 z
try$ O' `& J( c$ {, {6 N2 Z
{
- }* Y0 e) B" x* e6 [ var minValue=15;6 {1 I3 k7 b- S. J5 R1 `
var objs=page.getElementsByTagName(objname);
1 E1 u5 ?0 M! H \. N7 K6 y' P4 r T! i7 M- }
if(objs.length == 0)
) n& s/ F& x* Q; ]1 R5 Q {2 d, W; k4 q2 U0 i
if(debug)
: A2 o* N% m! K0 z {
M& E8 n1 J+ I5 q7 n! i8 G$ H. |8 }* s alert("no object found!:"+objname);
/ K4 L9 D% q# I* Y; d }# n6 |& m- u7 S
}7 z3 D( y" d. n) V" t; K
else
- K! G0 G2 g1 w0 |6 J, k" ] {; E! ]" n6 F6 L- H3 w- W& ]9 s
, `9 D0 l V& P3 b
for(var i=objs.length-1;i>=0;i--)
% ?4 s C$ O2 h/ l, R& i( ? {
% R# w" z3 }" P$ l var node=objs.item(i);
( p O4 y8 Z" p
* Q* q8 e0 g9 R- d ]
) w2 ?; t( e1 \) k, R if(this.getobjstyle(node,"display") == "none" ||
, g4 L O! g3 M Z# G this.getobjstyle(node,"visibility") =="hidden" ||
2 }/ M+ B0 p7 B% K& } parseInt(this.getobjstyle(node,"font-size")) == 0) ) T6 ]3 p# Z& n# {/ e) k; w
{6 w* S7 O, q& m) @7 d. _; m
if(debug), |; {& y# e- r
{
! e3 c. l3 a; r7 ^/ l2 A alert("remove invisiable!");: N1 C* g: g. G; a \! O
}
# [# Q% p+ Z, M y& O. E node.parentNode.removeChild(node);
2 G% I% b0 [" |+ E* Q. U / S1 M6 E) L. d1 o# S
}
2 w0 U i" l. y/ D, f else
, I P! y3 ]& p& w r {
/ j& ^# @8 J3 J! `, O if(node.parentNode) " z; r- Q. w) j) k$ @
{
! s/ u0 R: l7 q( u2 S( h/ X var orgNode=node;
5 I$ g- R% J. h var orgColor=this.getobjstyle(orgNode,"color") O/ e) t; k- T4 B8 A" d% t
var orgRGB=getRGB(orgColor); - ?8 J/ s. s6 `5 O2 V6 k" N1 J
/ v8 E2 N0 B! N var parentNode=node.parentNode
5 C. |9 G# u) t, ^ var parentBgColor=this.getobjstyle(parentNode,"background-color");
0 G% C) Y4 M5 l. G . {$ J7 [" S5 m: n/ b2 f
var isLast=false;9 }$ `. E2 i! m1 B3 a4 P% \- Z p7 v* F
" A7 Y0 M5 }* a while(parentBgColor == "transparent") $ x7 N& l- w% V5 T3 i
{
" `; @2 p' t) k5 U7 _
^) A7 g3 d- S/ u # ]! ~ O& x1 S+ |% c
if(parentNode.parentNode == null)7 p8 N+ _1 G W- Q/ z
{
* \9 w" v; J X+ W0 X isLast=true;; z- t4 ?. b8 H6 X1 p- D, `' a
break;
# Q( N8 d, {) H2 @+ r' A) u }
3 Y; }) i8 W; Y' T3 ^8 A+ p parentNode=parentNode.parentNode;3 s" [3 ?% w" r, ]" I
parentBgColor=this.getobjstyle(parentNode,"background-color");8 A x0 [* O) y
( o9 J+ e) x1 a% Z9 l+ h9 c
if(parentBgColor != "transparent")
9 L3 D& i, H4 S# p$ L: w) I, l {
! c' U5 J0 b9 G% D3 ]& ]' p break;2 ^7 N) c2 \$ M# n8 ?
}" p9 I4 N- h% ]0 Z0 C6 j4 u- C
}. P/ X" X. |) s
if(isLast)
% V5 B* k: C* @ {) `: j8 f% L- [; N" u- X, C) H, o
if(debug)! E, ~) s9 S! k# G5 Q4 N, C
{
" H+ U; y$ q; z, P/ W; d; D: `5 v alert("last!!");
- l% Z9 {1 s3 M7 P) i' [3 r }$ u+ r6 a1 K& y, A2 f% x; K% g4 L
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
5 d- Z( {6 Q# `: b {( S5 ?" Q& l V! @) J5 u
orgNode.parentNode.removeChild(orgNode); 1 |# }1 ~6 ~. f P/ `) Q
}
: g) L6 s: [; h; b# h+ {, [ }
0 M. f8 p7 n0 o }6 ^! }5 v) D/ ^ else
9 V; g: `1 W. q' h. U( b {
8 S( j5 L H1 ?2 J. e3 z if(debug)
* [! q# L' x( F6 S; k {: g& u, _& |3 V/ N1 M+ X- L; B. X
alert("compare color and parent bgcolor!");- ^' E) x, t, b
}* O( S* e9 N' E
parentBgRGB=getRGB(parentBgColor);
) e" c6 w0 l# X7 G" A4 g5 a( j if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
/ f: }& ^% K# a$ B$ Y1 s {
7 m* F% ]3 k8 ^7 q4 g) J orgNode.parentNode.removeChild(orgNode);
. K2 O2 p0 U- w1 V, `+ B% x9 w, p& o$ J }
" {* L2 Z) S- h }8 I2 U/ Z3 U6 ]$ t4 v
}
1 @6 K/ U' b8 }' I! p7 b }. q4 i: y: t, i+ O& _; T
}
2 l- A; ~7 W z" u3 I3 A3 D ^, y }* d2 d* Z: N* p
; H$ \2 @% U4 w& g4 d
) @) k6 Q# f# H var itemFrames = page.getElementsByTagName("frame");/ U2 ? i6 y4 P( _+ i- T6 @
var itemiFrames = page.getElementsByTagName("iframe");- m# _2 d7 S2 f; b0 t
! B. f1 E, P4 x( T; C
var frame, iframe;' \8 S4 M- M0 w: r$ ~
if (itemFrames.length > 0): }4 j; o' o+ }
{
+ p, Y* d8 q5 p+ z for (var i = 0 ; i< itemFrames.length ; i++) $ E8 N& |" c# g- ?
{; }: |8 J1 @1 n# n/ i
frame = itemFrames.contentDocument;: |$ C" Q! {) O
this.RemoveHide(frame,objname); " L8 A! S$ s, g( F; k6 ?( T
}% I6 z: x+ Z# @; k7 s$ ]! x& L
}+ ^ p% C }3 Z% |2 J6 c
if (itemiFrames.length > 0)0 l6 q9 X( [3 |5 I+ u
{
1 F5 b& }2 M1 ~2 J& N( W8 l for (var i = 0 ; i < itemiFrames.length ; i++) ( X* t1 U6 X7 ` e$ Z( `
{
1 [) J1 c2 }. u1 y. a/ N( i- I iframe = itemiFrames.contentDocument;7 U) C: \$ c7 \' X `' z, n
this.RemoveHide(iframe,objname); * X% Q: d$ X6 T: I
}5 ]; ~( X, G. h: v
}
4 m1 f$ `3 n$ s3 u' p6 y. ? }5 X& W2 N/ s& G) ]/ {! n
catch(e)+ A* o- ~/ a c/ _" I
{
2 S5 n8 e. C6 A' G) H if(debug)
1 }/ D$ C. [+ O0 W {: [. T' _! T& W( S9 Y# \
alert(e.message);+ [$ M# o l& H6 C8 f3 Q+ c5 y
}2 d, Y0 I3 V8 t) I- j: n& Y
}
4 l, O1 Y e! P }
8 }3 Z" K# l! M( E# l5 x 2 u' T) M3 D0 r
}
/ ]( w, C- \/ b: z) N- }
( u+ g" {# K; A: rfunction getRGB(colorString)
5 E {* z* g+ Z" ]0 k( K* w{1 X4 B7 c6 Z- E- Z- `5 r
var RGB = new Array;2 J, D7 w) U! A0 i1 a
var tempSting=colorString.substring(4,colorString.length-1);7 h5 j. H7 E3 x. J3 _
var tempArray=tempSting.split(",");
7 F+ l% H' g# o
7 C5 Y* Q: N4 c& G; G' n. m RGB[0]=parseInt(tempArray[0]);$ q* R8 q: {4 `* t4 B
RGB[1]=parseInt(tempArray[1]); h, c1 W0 s9 }" M7 J" M1 ^
RGB[2]=parseInt(tempArray[2]);
+ d6 l: n# E7 m# J& m/ } 7 r7 I9 L5 t% w" Q! h! j. W# F1 c
return RGB;
! d+ R) f" W6 A: n& e; |}' U+ W% ?4 ~& z Q7 _
function keys(evt) 1 O- l, E* |2 h
{ & W5 Z0 m) T+ @$ I
if(evt.ctrlKey && evt.keyCode=="81")
8 o. L2 u i9 F {
# m. e' t2 a1 R& ]+ H, }% d- T0 R CleanHideObj.on(0,1);
. S( T. h8 p. l* n: m) e2 { alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
b8 B2 n4 _; N5 F: K/ q9 F# p/ y
8 B4 @2 Y& ]$ n# X" d- Q5 P# ] } 7 Z& @( @# F) K" e
} . |0 E' R6 R1 }* t# z5 Z# V& x
document.addEventListener('keydown', keys, false); - {4 i! _3 `7 V1 a" d
GM_registerMenuCommand ('Clean Hide',, {8 j7 |" ^. g
function(e){
- K& I. ]( z1 u6 \% o# GCleanHideObj.on(0,1)% D4 w, h, I" T- r0 d$ g% c: _; L
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");/ t2 J8 D* K+ g j- a2 b5 h
});
# G) i$ `9 E8 F J F/ k5 u& D |
评分
-
查看全部评分
|