|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
- m7 g6 m9 u4 _: R% g6 d8 M" {/ R# G3 m! }# _) d9 x$ e. X
火狐插件,用猴子" Y- ^! z) D, N; o4 v- k% F/ N
( Y0 @$ A& v' d; ]var debug=false;
3 r' c2 B) e4 `% W. ~$ Evar CleanHideObj=new CleanHideClass();
( j5 A3 ` L; c2 P7 g
/ m) a9 {: ~! m% n1 t! ?; mfunction CleanHideClass() 3 \8 i: _" r5 [; \$ k
{ # P/ k7 o( t. e) g6 z G/ l
: H7 d* S4 E. i M: b
this.on=function(id,bMZ)
2 r4 j% w6 C# Y, ~ [ {) `4 ?8 }' {2 X: \# ]4 W
# v3 c3 h8 g8 O+ ^( b/ _6 N; Y' H
if(id == 0)
, p6 L, Z- e# V! i2 D+ ^ {
" x2 C" J+ i+ W var page=/* document.getElementById("content").contentDocument */document;
D* r, ] [9 [. _ this.RemoveHide(page,"span");
$ [8 h7 g& M: @$ Z" l this.RemoveHide(page,"font");
% r& ~' C3 R; W$ {. s( c this.RemoveHide(page,"div");
5 ]6 k* Y5 L3 ~7 r this.RemoveHide(page,"p");" T* z8 I& n( s y
( s- S E$ Z+ d9 x }
7 @: c& ~5 \) ? m5 W
, G6 h! f* v0 h+ R& h q# v }
! j+ ^$ Q. V) ^8 M, n+ m this.getobjstyle=function(node,prop)
. {+ W# l+ ]% F7 H {4 _6 C9 Z1 k, C: f
try2 z2 e/ H+ \2 L1 |+ b: m2 |
{
8 y% x* m( r+ v) n+ ]' M: I return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
" R" ?# d0 U8 j7 T- c% T3 b6 H }
8 S! L& U5 T9 Z, v& k! \ catch(e)
/ y+ j) A" O5 [, }" g1 B0 a# H {
2 T' X# E: B9 P if(debug)
1 p7 P! m# y2 r6 _0 u {
" a6 r/ F3 X& c9 W0 i alert(e.message);
# M7 |* d0 K( A1 t3 r$ x }9 Q$ I+ D7 U% Q4 L5 t7 T, N( q
/ q' W0 h3 c9 F3 {
return "200";
+ g" o4 B5 v. E& l4 [5 N5 u& t }& `) D- n3 c$ S( z0 P
}9 B# S+ ?' Y9 H a# x) Z6 f3 `4 v
! T5 @0 M& v' Z$ B$ [5 G# a* Y
this.RemoveHide=function(page,objname)
% B+ X, _: U/ c$ L6 b {
. ?7 |: p1 X! l9 u try [# `6 ]# O$ r5 c# h/ Y3 v
{8 |- ~/ M3 Q1 F- Z# H
var minValue=15;
1 U6 Q' H6 {3 Q+ a& p9 g/ [+ a var objs=page.getElementsByTagName(objname);
3 S, y7 C6 u5 T# g- K: h/ T
, S1 ]( d5 \/ B% |' j; w0 [- M if(objs.length == 0)
8 B& ]$ T* T' E9 b; x' k6 Q7 m {
3 Q, Y# r' _2 Z( K- b if(debug)
8 S' ^6 C1 J4 [ {
# k$ S! e* J8 H! G" v: z alert("no object found!:"+objname);# n% p+ N) \# N" N! e3 b( x
}
0 I/ E& L+ g! D& V: m3 ?. h% U: p }
' u* H$ c" d2 M else
+ T2 w W, L2 p' B8 c {4 Y% h) D1 T" P& `+ G0 K7 s! p* J
1 c( ?( w; N% N4 H
for(var i=objs.length-1;i>=0;i--) + h- r/ H0 }0 I3 W- Q
{- J3 k! l& Y7 ]
var node=objs.item(i); $ S- y& v$ L% W n2 N, \
: c6 m' [0 ^% s. [0 t
) p* \. o, @3 O3 s& R
if(this.getobjstyle(node,"display") == "none" ||2 S7 ^& m( P0 a7 G. C8 k
this.getobjstyle(node,"visibility") =="hidden" ||
, z4 B( y4 H: ]! C& B( u* ^/ q& H4 E; [ parseInt(this.getobjstyle(node,"font-size")) == 0)
; T- k' K% j/ ?( G {
$ O9 t: k/ W2 {3 d' V& F if(debug)' K: O2 o" F* F* p' C# J
{( W, V+ m: ?# F. c! d. e
alert("remove invisiable!");
5 D* r7 n: ?7 G7 `, O" V } }3 q+ ], \% c9 s& j, z: R2 M2 W
node.parentNode.removeChild(node);/ O2 {) h! D; n; d0 e. V% r) Y
; ^6 H' _3 t* h& a }
9 z- o: C1 o4 w+ V. n: l else # v0 o/ ~# U7 K+ w7 {# a7 |
{+ p" t& B% y: j
if(node.parentNode)
) A, W F" W. R) X) m {
Z1 \( C7 e9 q# g& K' e var orgNode=node;
# \ k9 \1 [2 t: e var orgColor=this.getobjstyle(orgNode,"color")2 f6 `7 ?& n9 X
var orgRGB=getRGB(orgColor);
' m/ [0 r1 \+ _, }" k. `( [2 }5 p1 E8 L
3 l) x/ @; E7 D. h& r6 M6 Y var parentNode=node.parentNode# h% _, @6 e/ |3 k, e
var parentBgColor=this.getobjstyle(parentNode,"background-color");7 a" H! Z# j: ~3 Q; Q
' W- P/ U1 N% e0 R
var isLast=false;
6 {( s% {: `- a2 R3 a5 j : U6 z& K4 H( w! q, Q' B
while(parentBgColor == "transparent")
) l% m* E9 R; X3 L1 y+ b$ t1 n {
! J- s1 q( n" _. v$ l8 ]9 a, O 9 q: U4 ^1 P4 r Q
3 ]- N3 D8 l; r( n" I# w if(parentNode.parentNode == null)
6 W6 E% `& d0 E6 H, O, c {3 \0 c& S8 O' L2 Q
isLast=true;8 c1 c- `% i9 _1 k
break;
0 X# O p2 u( A* W: y, w! a } i% p9 [2 m; r7 m
parentNode=parentNode.parentNode;
9 j6 g0 } M0 _9 ]0 m+ R parentBgColor=this.getobjstyle(parentNode,"background-color");
. H! u. y% J% w5 v4 c7 z
, y" o R( K- C+ G H$ g if(parentBgColor != "transparent")
4 G* _& S. s! l4 y; o- i$ c { {1 a# v+ T7 L& t% _7 @2 u! p( n. i
break;
# g( ?! K* V' b/ c8 o }
4 Q/ T; C: l ?0 E0 C" P }8 d) T* a4 Q J2 g' n( J
if(isLast) 6 c) I( p1 L1 M6 V9 T
{! m7 d; j& f* _6 x
if(debug)0 F5 ?8 f" h. I$ o/ N
{
- ^* U: S, L8 i! F: ]) G alert("last!!");4 g' q' s1 q: j
}) c, z/ T f& q' [) h* N
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue)); U) D1 P' C; n) l0 I% F
{5 m/ v5 E! V: `* b! Y5 n
orgNode.parentNode.removeChild(orgNode); , Q3 X ^; C* L: P x
}% L8 x# b. Y4 l& E+ B
}. }3 I6 l( \! a4 ^; ~( @2 y
else
; ]& \& M- k( Y: i2 b9 _8 T; N {5 ^; K1 [4 H; e2 }8 ?( X: w2 V
if(debug), q; k' y! K* @6 ^% Y
{
: S: S* W" T8 z; F9 f9 b alert("compare color and parent bgcolor!");' H" M2 d1 l* P
}
; L# Y6 ]. d- r! d n L( s parentBgRGB=getRGB(parentBgColor);% `. i/ A4 G, p0 e& a7 i4 V' N3 t
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))$ T# P4 x; U3 ?$ m" @
{7 h. `' f h) I5 m% S5 \1 w
orgNode.parentNode.removeChild(orgNode); " }4 c1 L% ?' z2 W6 C$ a
}
* T1 M" ^& K0 Z }
+ d; s$ I5 d0 {0 t }
$ }/ B% _; X# u! D' V: D) C- w }/ G5 g* O0 l- z; y- K1 F
}& f/ }+ J3 d+ L* i3 H2 n6 n4 M
}
! J. a7 m8 o2 w! W. r( S
8 y& ` [$ E$ Z+ P5 K& ^( ` 0 ^/ w" n, _6 r. J
var itemFrames = page.getElementsByTagName("frame");
; s" y. r7 U- E var itemiFrames = page.getElementsByTagName("iframe");% N' s& ^0 d9 r- z: l8 L; j) d
; |4 {9 E8 e' S x2 i1 i. [ var frame, iframe;
# [- F* q; }. z8 G/ Y* L" x/ w6 C3 K if (itemFrames.length > 0)
6 Q S( ]; d* H. m {
( a: v- s' A8 U( q0 ^ for (var i = 0 ; i< itemFrames.length ; i++)
1 F) F5 n5 {/ D2 k. m" d* K5 N {
. {" S0 ^) R# w ^6 n frame = itemFrames.contentDocument;' L2 v+ `) r# e1 {( u. F7 a
this.RemoveHide(frame,objname); 6 U1 p7 V" n4 }, @8 O
}) ?: ~ E# \+ x% z* i8 a& ~5 y, Q
}
' i4 `/ E+ A) V& X, P if (itemiFrames.length > 0)* M7 X1 }/ f: V
{
* C! b/ `6 q8 A# Q2 F) @; n for (var i = 0 ; i < itemiFrames.length ; i++)
! p- A" z# H: H& t3 N/ L9 O8 n {
% j& z/ Q( M R8 ~& Q iframe = itemiFrames.contentDocument;
1 R: n7 T f9 v8 J+ d- K this.RemoveHide(iframe,objname);
- R7 T% o& q4 a, S O% W q) u }( [# a$ E' d0 F0 J h) H
}
+ G# a! r+ h3 L1 d, O }
% Q, X/ f3 W& f9 I/ _& M catch(e). @( w& D; M4 }# L+ ~- u: e0 W
{! f2 u8 H( L" S2 l
if(debug)
2 Q# t8 N8 s$ O1 B! j {) Q0 Z& V4 R. l* Y# i) t/ g
alert(e.message);( f* `$ f @8 m+ o
}# t$ Q- e" |8 l T! x5 L) b! t
}
" |) Y4 Y4 o+ O" R3 R0 `) S }
' ?' W, U6 P9 {+ L. J5 k: o ) m0 t9 H" R; e) \% S
}
, m: B& w: k n. N& ]7 x/ t9 D
+ q# V( g1 m' g2 pfunction getRGB(colorString)- e5 e+ s4 V( t7 v2 q' O
{4 c7 ^/ I5 T& W( |
var RGB = new Array;6 F" d$ C% u1 F# ^* s: g1 v
var tempSting=colorString.substring(4,colorString.length-1);
0 B, V% T# a+ l0 `, t var tempArray=tempSting.split(",");# C7 v$ c: A1 n# s. {
, H3 H0 k8 }7 m$ I* f% n. m* e
RGB[0]=parseInt(tempArray[0]);. F1 m* Q# d e) K& A! E0 W/ o
RGB[1]=parseInt(tempArray[1]);9 d3 g$ u4 g* @. Y* x" |& B. M/ T' W( L
RGB[2]=parseInt(tempArray[2]); P! u0 X. q) O4 O; Z! s, W3 ^
. Z" D( h6 J. i& h3 x return RGB;
# T/ P4 ~' D. r" v7 b}; I% Z5 A- v: K0 h
function keys(evt)
! q+ p( [, N3 {$ D+ H9 W" g# n {
7 `+ e Q4 [. v' u0 W: X" Q if(evt.ctrlKey && evt.keyCode=="81") $ N2 Q$ z3 z- p% P
{ 8 w7 ^' r1 P. P2 R0 f
CleanHideObj.on(0,1);( h, s9 j2 X( q7 v9 r; E
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
Q; X8 o# r9 G! A9 t
6 s% t7 s8 [0 u% h } : ^5 ^- l, M3 I" ^. I3 A* P3 W
}
9 I! `# d, v* [) y% R' gdocument.addEventListener('keydown', keys, false); - m6 {1 L$ I- o( Z$ r- F
GM_registerMenuCommand ('Clean Hide',
5 ^ {- g5 M0 s* M$ \- V/ Pfunction(e){2 m4 {9 ]2 ]6 x7 ~
CleanHideObj.on(0,1)% c* E* Y$ d# k5 u( z* \
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");* d9 {! C' Z7 r# I: \# t7 a
});
5 K; h$ X# X" L4 X j( [ |
评分
-
查看全部评分
|