|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
4 m9 \8 C1 H8 a$ H, J2 A6 X8 w/ G; n7 l6 `7 [( N% N2 x
火狐插件,用猴子) }3 X5 Q8 u# r% d' z
0 h# u, z8 C( _ E- ^
var debug=false; % s+ k4 c# V* v/ W+ O1 S
var CleanHideObj=new CleanHideClass();
, u5 z8 t9 k# P/ C, Y! u* g2 U% Q, [
function CleanHideClass() 3 b- Z( _9 M& L: X# M1 u
{
0 k8 C! |% D8 R
& w8 |, Q! |0 ^6 t this.on=function(id,bMZ)
9 @ W7 F: \% ]& K0 Q9 n! _- F( r {( k" c4 v2 d/ W) t1 W( n$ o
3 Q: `6 Y+ z( Q+ C& w* Z- L2 _
if(id == 0)
. ^) c# K+ [! l+ }) `" t {
3 n) C8 |! y- ]& o var page=/* document.getElementById("content").contentDocument */document; 4 y% F: Z& P1 } E
this.RemoveHide(page,"span");2 m, j1 y+ R6 b1 Y3 p- c) k6 g- Z
this.RemoveHide(page,"font");2 S% c. ]2 ^& h- _7 W" [ ^" Q
this.RemoveHide(page,"div");- J( e0 R! C, E2 f% c% V
this.RemoveHide(page,"p");& R2 Y( P+ K- g1 I. `; D8 q) K
w: a8 s% Q9 T, M3 @% J" g }2 k: O7 b' K) K/ d$ ^ I, V! K
0 E+ w% ~( O# A; t( n# H) M
}
; p& i& U4 Z* j" w/ |- ~4 _ this.getobjstyle=function(node,prop)$ |. S- z: ~8 v
{
6 R+ [ K4 v) _( `2 p, p6 p try
% F; C9 n) J8 i8 ~, k {0 |: V! {1 A/ u- ^' i
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);* e; r C+ X. E7 W7 \. T, m
}) u3 E# Z, V' q2 k5 k
catch(e)
% z# q o! l5 F3 p9 O1 C {
- a, t& Z" j" n. z0 Z' [ if(debug)
& `% B8 W8 p2 i6 U6 O. z1 ? {
1 j0 @0 u9 u/ ^% F% z alert(e.message); h0 i, C$ [8 }8 \, c: ]) e
}0 r: k0 L% d+ z( S
3 X3 Y% b1 b4 j3 l+ Y" J7 A' z
return "200";" P& n8 i( @1 S3 R2 J
}+ n- j6 H! O7 a# H+ c
} f0 Q; K0 p, z
2 F& n1 `/ c0 X. R7 R
this.RemoveHide=function(page,objname)
- b$ u+ H( V) }2 d {; h$ y- W- ]7 }' Y/ v7 Z' i
try7 x, p+ ~: `, I. l4 E5 e0 k
{! r0 Y: L5 D& R0 `# L3 Z
var minValue=15;+ C! A! B J9 X! V, P0 _
var objs=page.getElementsByTagName(objname); : @; R5 a$ Y& V, a) \
/ |+ @+ F4 I% B; N7 v0 P6 Y if(objs.length == 0) - \% U, L6 c- M3 m
{8 \5 Z! S) P. J& @4 x( @* w
if(debug)
6 E' C+ e6 P& g) o( N6 x3 b {
) u9 N, V" L/ Z- C, c alert("no object found!:"+objname);! `% V' U* X$ _0 P; O! `; n, O
}
) c+ {5 W L" L* u! j& `' | }5 A3 M% I$ B( B# \
else
" E2 t9 v" b. i, F2 H8 i2 @ {5 D' ^' L+ z4 r6 C
1 I) r# }& K: Y, G9 L. r; l4 o
for(var i=objs.length-1;i>=0;i--)
2 ~3 T$ H9 g) t( }7 S# V/ L* s {' g# r6 Y% ^' I) Q' _
var node=objs.item(i);
% x/ h; ? u" g5 c1 \ 0 L) Y+ o; i% t4 }
- D, B- m9 v t. f4 S4 ~" R if(this.getobjstyle(node,"display") == "none" ||
2 t+ {- d2 \5 F" r% _( Q this.getobjstyle(node,"visibility") =="hidden" ||
. H. S! P; G0 j; E2 x5 A parseInt(this.getobjstyle(node,"font-size")) == 0)
1 _% Y+ q4 _+ w3 p4 q {
8 ~& P8 `5 ^3 p9 ~) R if(debug)2 ?- ~! z% |) S. B
{5 G i2 X0 p6 z S
alert("remove invisiable!");
' M3 B* S$ d3 G/ ^3 R9 r+ l }
" ]3 ^% v1 U- c& V7 P) p node.parentNode.removeChild(node);+ h9 H, q1 e: h: c C7 {
' \5 y7 N" \& }. f }
0 ?& {& b) n: h+ l6 k else / n+ ~; D- U% E# f5 g) N% s0 ^3 k/ S
{3 x" m' _$ w* r
if(node.parentNode)
$ k- {" V' g/ q! u% V {( t" \, k0 N- z3 \* e5 }/ N7 i
var orgNode=node;$ Y# v' {1 }: W0 f. t! f( A2 M: p
var orgColor=this.getobjstyle(orgNode,"color")
8 @- K3 f, l, }7 E- O var orgRGB=getRGB(orgColor); ' s" `2 |* |- [3 _# z
) x, e, p, Q% ^* H4 f' X1 O
var parentNode=node.parentNode
; y) y5 |4 \2 e# z var parentBgColor=this.getobjstyle(parentNode,"background-color");' Y `1 i- q. S' r
& N+ X- R9 x0 @' ~* F& ?) a var isLast=false;
, Z0 Z) N' ]/ k! p7 y. w L
0 g1 H! _8 ]- z2 Z. Y( |8 t I while(parentBgColor == "transparent") Y& T6 j w# Y, p. x+ {/ s0 X
{" d( x2 w5 E) {2 v# t* G) G
0 g) ]( L# ^: e9 A ' v; {1 z3 b: d7 o& B: M! m$ [
if(parentNode.parentNode == null) ~$ J& u% T; ~4 ^. Z5 e; U
{
g( C4 I" s" C1 F' V isLast=true;3 Z: _4 h* _* d# l6 `
break;. {+ d' J+ u ?. Y$ h! c
}& P9 F9 J5 ?" r9 r. ^. b% s% d S
parentNode=parentNode.parentNode;2 o) C! R5 ?7 y. }
parentBgColor=this.getobjstyle(parentNode,"background-color");
& K8 w* L- X: I* H9 ^2 s4 A1 m8 l A; ~0 J0 M- \
if(parentBgColor != "transparent") 4 K* M2 y# B7 Y+ J0 I
{
8 A1 V7 Q$ E# n+ q break;
5 X- K* k# ^" c* X5 O* P }
4 z( t) Q/ y' y" D" D$ s p. D }
* K2 q+ f' Z( H* b/ }8 w if(isLast)
! ^8 Y8 v' M/ F5 o. h {; ]+ s& w4 y9 n1 T+ o4 j: h
if(debug)
) X7 T5 x7 y2 {4 e1 K _( W# M2 n {% ~% ^! @+ J, u+ V/ ^
alert("last!!");$ D9 e0 p1 A2 a: `3 @: Y/ [$ K
}
$ X4 A' @! r+ c. N1 ?$ G if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
: ]0 ^/ S4 z1 z: M {, u( p' `- j7 _- @; K0 A: S( A
orgNode.parentNode.removeChild(orgNode); + }# g: V3 s1 s% J, @& b% }) Y
}
' a+ H; o/ M/ i+ y: S, T" [* s }
6 f9 t. z6 |% j! g/ _$ E6 x else# R) Q9 A0 K% q0 Z; J6 |$ e
{9 A5 g( u' d9 r3 D0 r5 `
if(debug)7 K% W# K, g9 d6 U0 f, @7 D7 }
{9 `/ X/ q5 w# L7 L
alert("compare color and parent bgcolor!");2 p& c7 y" }* q
}
7 m. `+ e e, [6 C! y parentBgRGB=getRGB(parentBgColor);
0 F# I$ v& z5 b: J5 ]! C- | if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))* ~3 ~5 h3 R! @% n# z5 g5 F
{
3 e. `) e5 j: z! _9 w+ T6 H orgNode.parentNode.removeChild(orgNode);
, @9 l0 ^& q( u& s }
$ e( R4 l$ v" a }$ S& }0 _/ a; B
}
( _! v; N7 T8 n! |+ Q |& | }2 p9 _! N5 V7 ]- w" R, d
}. ]5 I k: h2 A6 H: O3 s$ [
}
: {, c' v w0 y4 ?- c* {, T3 c( R
7 k2 u ^8 A7 O0 d# P! u: T 5 t6 z9 l- I* [; A
var itemFrames = page.getElementsByTagName("frame");. v/ G4 ^! N2 T
var itemiFrames = page.getElementsByTagName("iframe");
! N- A0 l# M4 [" s
" a( D- J9 v* H2 ^& x& ?- u. y- j var frame, iframe;
3 ]' ]% r; B8 q if (itemFrames.length > 0)
" H: ?- D6 Y! U9 D3 ]# A {
3 A% F2 K2 ^1 z+ Z8 Z+ j# g" n for (var i = 0 ; i< itemFrames.length ; i++)
\' A0 j7 F* N4 ^5 I' X, i$ ~) l; _ { X, ]) |% A' z1 H
frame = itemFrames.contentDocument;! W% g: g* B) D/ l) ?0 |
this.RemoveHide(frame,objname); 0 [4 i* V& X& B% `
}
% l( x/ |! b5 p7 p& `" n1 y }6 r7 T8 D7 G# _
if (itemiFrames.length > 0)+ C1 u. Z* h8 d2 b; o3 I
{
, t: U4 {( e) | for (var i = 0 ; i < itemiFrames.length ; i++)
& f/ \& W+ d; U+ W: g4 u8 w* o) n {
& r( S" V: N( q2 A* `4 w iframe = itemiFrames.contentDocument;6 P3 E8 h% ?1 @8 R
this.RemoveHide(iframe,objname); 5 C- y& l: y; V$ _$ S1 M
}
: F- S% t0 A5 r' t }
4 @2 V4 G f3 E }
, r1 B6 q- h, x0 ]" g4 K catch(e): U& {& f( |0 o* d1 d8 J
{' m) L0 V- i: c H0 G
if(debug)8 j; g$ v, b+ _9 p' s
{
* G! k! I' m1 Q" u8 F alert(e.message);$ K/ _. u" \) t6 i! P- l* t9 b# r9 Z
}7 u2 _5 w$ P/ g9 w5 I/ B
}
' q/ F2 s! | t) ]% J }
% V ?! ?1 e! \( i o5 x- d& V l 8 X' G( f& |% m/ c
}
$ e. i7 y: z) Y) y
, \* ]( I7 r* z' Zfunction getRGB(colorString)
: v' }. d2 g+ Q) _{: l! }, @! k& K1 h) D
var RGB = new Array;" G* D- |. S. a+ c" n
var tempSting=colorString.substring(4,colorString.length-1);
( Q. n5 H9 \+ O$ [% w var tempArray=tempSting.split(",");
; D' L4 c0 w% d6 S- ?$ N b) J3 x8 y; w; e4 @9 A, X
RGB[0]=parseInt(tempArray[0]);
" @" d2 j% e2 ?( D RGB[1]=parseInt(tempArray[1]);
" c. Y, d; g8 F4 ~* V! | RGB[2]=parseInt(tempArray[2]);4 V; v& D: l0 D
5 X+ U8 R |( m: D
return RGB;. a0 `; J+ [0 g# t( g6 D) }
}
5 b- R9 n" c7 Q1 E; z# a$ Jfunction keys(evt)
3 o! f, A! u' ~- I' j! s8 P { ) [5 @* s+ m; f- f* M7 Y
if(evt.ctrlKey && evt.keyCode=="81") & o. W* z$ o* C& w9 g5 J
{ $ e4 ?9 Q9 ?# H3 v/ R/ X% y, I
CleanHideObj.on(0,1);
! x0 ^. j8 x1 D alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
& r U1 h. X3 S- v: w P , p2 h5 v& T) J* j+ K- y) O
} ' w- ]& F) {( @; S, t, ~6 g
}
5 ]' J! y" h4 x( b4 }3 v* Kdocument.addEventListener('keydown', keys, false); , H* E2 M K' c( Q
GM_registerMenuCommand ('Clean Hide',
) t: p1 I" I: s. D; D% z% Ffunction(e){& l% q7 V+ u( n+ |9 Q- n/ G
CleanHideObj.on(0,1)% y! r1 N, S! m- n) ?1 I+ d# ?# J/ u
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
$ W' w- s. y, g, I: V});8 K6 Z6 F- a' o3 z
|
评分
-
查看全部评分
|