|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 4 g0 w7 t h: Z6 M' F
3 A6 S2 _; V1 U- N2 s1 t3 v! V
火狐插件,用猴子
$ _5 b& Y. ~) Y, y# b% J5 t& O+ D" d3 K& m
var debug=false;
% z$ a b0 s- Ivar CleanHideObj=new CleanHideClass();
7 a1 c4 _2 }1 }) {- K7 n0 T! H' @: L9 n) f5 J R. v: ~1 r& |
function CleanHideClass() . I7 t: B, \9 v$ B: a3 X
{ " V: z' ~6 \; i
2 Y3 ^% G7 S- X/ B. _$ N% k. Q; t. `
this.on=function(id,bMZ)5 O) b# l& F7 Z+ E0 F1 e
{
' v( z: K1 d6 H/ i0 s/ c 4 n7 K& t# o/ y# w D
if(id == 0)
( R: e2 h* k! N; _/ F: w$ G {5 L" u( u( p2 s& M# f
var page=/* document.getElementById("content").contentDocument */document;
# p- v- }$ G% z9 O this.RemoveHide(page,"span");
+ K# B# `+ x9 r* ^" u3 o1 z this.RemoveHide(page,"font");1 X; G8 Y( P6 i4 I
this.RemoveHide(page,"div");) z+ J4 J+ j# m1 q" y3 k9 e
this.RemoveHide(page,"p");& m2 M" ^, K k3 z% n! R6 n9 ?: a
# t4 j/ L/ q' s' j, P( c% @
}
; a4 V+ _1 h- L! F! D3 Y 7 @) u$ S; h1 ^
}6 L c+ z j$ l- T# ?
this.getobjstyle=function(node,prop)- J5 c. P3 Z) q+ `8 L; C
{- H4 `+ Y. p# y7 G4 A! q; n
try
! a8 d3 s8 q4 a6 Q) W {
. D$ N3 J. [, B" p# \ return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);, q' c& a, \6 A$ X7 @+ n0 n
}" X5 ]3 N& F! q& A1 A
catch(e)* v1 ~% w3 R" X$ ~. a; R" P6 ~
{
8 i1 m$ l8 r+ p: u8 \* ^: q if(debug)
5 q+ U- U" N5 H5 y& x4 M {; @/ Z* b. R! R* |2 _# o: n! x( a
alert(e.message);; K Y3 X" ~9 X
}4 z: b7 Z$ n- ?- {3 c2 e, f
4 i" _2 u- w! |( h4 K: p return "200";
: N: K3 H6 G: H, ? }
: k( `0 q9 I" D& l. a/ Q+ X! p }
8 C; ?( g9 m! X6 x T, X
3 L7 w" B' p7 R' b& H. H2 ]+ U, U this.RemoveHide=function(page,objname)' u }$ _" z C$ c: n0 T. y
{
" Q8 f: r( K! g7 S try
2 R3 _9 ~( O3 g2 t+ n {
8 x8 r9 w# P) o( A' i) M; x6 x var minValue=15;
0 P5 q( | Y N1 N. L8 S var objs=page.getElementsByTagName(objname);
o# n+ T1 u! ^* C% B
8 `5 y# P# a, A* x if(objs.length == 0)
$ I9 J% j/ u! Z+ p# ? {
% _3 m w5 y2 J+ R" e6 t! t( Z5 b' ] if(debug)
/ j! @5 ]% F. V+ s {7 ?) s* x6 _ T0 s$ g) d2 ^
alert("no object found!:"+objname);& {- p5 S# [- u o
}! I* T/ S0 e/ Q; [6 E
}# Q0 s# r8 p7 w$ O' y8 g) h
else* n6 t9 M8 p, l) C* h; ~( O
{- _. U/ M; }$ q9 F& R# q2 F% q
9 d! P% D( f! a8 t
for(var i=objs.length-1;i>=0;i--)
; ~6 V% j4 l- u0 N, T9 ~8 U {$ n! P( |( l5 C3 ~" n' p
var node=objs.item(i); 6 H& _+ r- _8 C9 U
1 E3 v! [9 r6 |- {. F0 W6 t% X/ Y
0 q. i) O# r' Q if(this.getobjstyle(node,"display") == "none" ||* D- a. _* \* Z h; ?* q
this.getobjstyle(node,"visibility") =="hidden" ||6 K0 y( U: T. p9 H9 l5 O' M! p
parseInt(this.getobjstyle(node,"font-size")) == 0) ! ~1 R5 m" m; h2 Z+ v, E
{
; c+ ?6 G4 n# \% m- r if(debug)/ O( a$ \4 B N# \; k: Q
{
! G# S# \4 w5 G; z6 H) B) ]0 R alert("remove invisiable!");$ D* e9 j6 E, p! ^- Z
}5 D4 n" S% f8 b r6 f4 w3 z7 k
node.parentNode.removeChild(node);
: _- x/ ^4 e' {! h % l; E% c# f+ o. ~! S; R
}! R: y8 \3 E0 N- h, L
else
& @: F( T: X0 s6 D4 I {! P$ e: o$ ~7 a) M; e* h
if(node.parentNode)
' \% b: |; \- C# y$ r2 V {
; Q2 d8 |. p; X- q+ y var orgNode=node;
4 T3 f- S: p) o, V var orgColor=this.getobjstyle(orgNode,"color")
. \+ d# O/ b* Z; @ var orgRGB=getRGB(orgColor); ( ]' B& D- n! n I: I, P
) t; r/ V! T+ u0 ] y
var parentNode=node.parentNode4 D( @2 F/ H7 C3 v
var parentBgColor=this.getobjstyle(parentNode,"background-color");; J, N. [) u/ v: a+ r+ w+ d4 P1 M
' I. \. ^. R4 e' G5 O var isLast=false;( @6 E* J# P# B" F& L7 R0 u. h+ W
* G j) v$ _+ `& j2 q1 x- ^
while(parentBgColor == "transparent") ' f2 C4 g( _$ H7 C2 {5 x6 E
{
( E/ [: t7 M2 ^4 ]' n! K
7 R i1 `+ j+ w" w8 k! F% n " ^1 T4 a. q! l3 D% {/ p
if(parentNode.parentNode == null). `; I K1 P2 |0 m% |
{+ F5 A: {) Q* @. `7 \; Z. ]& [+ o) m
isLast=true;8 I- y/ a: v) }( p' \
break;
! L1 |- P% T8 z! _ m6 o$ J! y }9 _# ]/ F% H+ {( T
parentNode=parentNode.parentNode;% m- X. `3 A: O5 P
parentBgColor=this.getobjstyle(parentNode,"background-color");
6 X& \' T+ Y5 `6 O0 t V2 B( L2 |7 \; {2 @1 c/ _
if(parentBgColor != "transparent")
% Z9 X g" C2 f% L+ n& i' z) a {
% \, u* `3 U$ \& n; k) K/ r: w break;
% V: @' [( I' D) P }
8 M" Q) K/ g' y; ~1 b }
/ V4 }+ g$ k7 n' r; V; A R if(isLast)
1 K5 e7 L# t9 s. V {$ u- X& A( V2 |) H: [2 h$ _
if(debug)
/ I. N8 i$ h3 F, S* F- M( q* _ {' j& I/ P) K6 U( g* Y" I
alert("last!!");
% k+ f$ [: ?& @' g+ h }
0 v( `: L( ^ ]& ~3 L if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
: |, g" V# t# Z8 }1 }* `" o/ M {8 x* E: M& Z' v
orgNode.parentNode.removeChild(orgNode); ' z- S" F8 }& h# y6 l
}
/ u0 J/ [$ P- _. q: W+ t! _. S }- X: w5 _2 N. g$ {# y
else, @: J* [# ~# b
{8 M" S$ V4 `: c3 q3 d: M
if(debug)
* M) X; H: V S+ N R- s1 o4 j {
% V+ R4 _" ~1 j alert("compare color and parent bgcolor!");
- l! f0 T, t2 V3 K2 W }$ V2 ^# v# A& u) d1 k8 q! u! s9 I
parentBgRGB=getRGB(parentBgColor);
6 f; ]4 a* J6 n; @4 c) [ if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
1 I$ x9 a! X0 l5 U5 {# o {6 K8 L9 I; p Y) J5 m
orgNode.parentNode.removeChild(orgNode);
! X7 G6 C7 k0 ? }
6 q" s. ]' e2 I# X }
, k/ y" J1 s8 n% ]0 S% C }
3 c+ W& d/ t7 F" X }
! K" C* ^- D/ J, w0 {2 {2 A }9 m; p5 s- k- Z# n+ O3 G
}! c% N( f* A1 B9 ]
( D" Q' N; ~0 P* V9 t( d
' {. _' V4 j5 g% N var itemFrames = page.getElementsByTagName("frame");
$ w% b1 \; S5 i$ M var itemiFrames = page.getElementsByTagName("iframe");; E O2 t: x7 o3 J
. x% K6 e2 T- P5 G/ \. j% n: D var frame, iframe;
' A( Z3 R w$ e Y# d& Z. ? if (itemFrames.length > 0)- ` M$ d# i& `8 A. q, y$ w- s
{
* k1 k$ R9 t4 P; a0 D# X2 W+ K for (var i = 0 ; i< itemFrames.length ; i++)
; y% W! c% O, t& ^0 P# m" p, ~3 U+ r {
, b. a( Z5 C8 G. M frame = itemFrames.contentDocument;7 c M, o/ i$ _" k4 N( r: f2 \( x
this.RemoveHide(frame,objname);
2 n% e! h& J0 v9 I }, X, r# P! J; w' }$ H" F" b) v
} ~ f$ v3 G e" w# F
if (itemiFrames.length > 0)
. ^6 r; o& {( Z9 r( o {
# Z! G' i2 b3 e G) n for (var i = 0 ; i < itemiFrames.length ; i++)
( m& ~* B8 |0 l. U9 X" [7 e {
6 ]7 [+ g, w1 B- o iframe = itemiFrames.contentDocument;
' a* W$ p8 s; p. V/ U: z4 k1 u this.RemoveHide(iframe,objname);
8 [+ \/ L8 l5 C7 d+ Z3 _' L }
' B" j1 e1 C; \+ J% `! \2 O }; V7 w9 K9 V$ P5 \( E* J
}2 F/ |6 c) R# [9 W: M! l/ G
catch(e)
: {% n6 A0 @8 a8 l' _ { R4 ^! q0 l# {
if(debug)
. E8 |9 z& L5 u. y9 f: `( J {
" r4 h& z7 \" l, k5 ? m' u( @ alert(e.message);
- ?" {* g5 |6 F- `( v9 C9 O }6 V' I, {! T" d
}1 i* J7 P: q$ d0 Q4 q7 w5 U0 j
}
0 L5 s9 A n1 \/ b " R9 Q) y3 t! J- ]1 i
}" G9 K0 h1 M0 j1 y% U
: f; q/ u1 F2 t3 ?. t! P# y+ y7 lfunction getRGB(colorString)
4 S+ i$ p! n- f5 }! ]# Y# w{. I9 R: t- P# z
var RGB = new Array;
# b, I/ e& N" B5 f4 J$ d6 g7 L* R var tempSting=colorString.substring(4,colorString.length-1);- X' H! \5 h4 w" g l G
var tempArray=tempSting.split(",");4 @+ |/ \) \3 p3 L/ d
; U* r/ y' P; S ?3 p& O5 f RGB[0]=parseInt(tempArray[0]);
. c( `. n* j7 l# l! U RGB[1]=parseInt(tempArray[1]);+ d L2 _ V, a
RGB[2]=parseInt(tempArray[2]);
" ~% h' T) U! ~, _) l% O5 Z2 P
, \7 D3 y- ~ {. f" A8 s return RGB;, I/ l, T* I7 `) b: n( C/ g
}6 T' \* H, f7 V
function keys(evt)
4 { p9 X( U0 |# a3 | { 9 O& ?4 N" L, N% H' K. p
if(evt.ctrlKey && evt.keyCode=="81") " Z1 M1 M" O4 |
{
0 o) J4 H" j9 T/ L) i CleanHideObj.on(0,1);
9 n; ~( W6 r, e* h( Y alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); $ j# Y2 o* Y1 }% P" ?0 @. J
" k$ K. \" ?: W" ~) f% p' | }
, u" z8 W2 m- _* S0 I } " S2 A8 k- V+ C N$ a' k. L
document.addEventListener('keydown', keys, false); 2 K! T; A+ V, _, \2 |. V
GM_registerMenuCommand ('Clean Hide',
2 J0 }0 S _1 m' P) l* i E7 sfunction(e){
# F3 c8 k) x# Q+ j0 b" w: wCleanHideObj.on(0,1)
. V* I& M3 U# V6 calert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
$ J* m3 q6 G/ X& |! s3 N});: \* e6 n' e4 T( U# m; A
|
评分
-
查看全部评分
|