|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
$ v4 n3 F- b- K! @! o, t7 V
8 |' q3 b' W7 y7 d( ]4 R$ {: {火狐插件,用猴子
! U6 R& H+ d6 Z9 z8 U2 z- l0 j( f4 W. ^' n
var debug=false;
; s7 I( g2 v0 ~var CleanHideObj=new CleanHideClass();7 T6 K7 M6 x$ f
( B h }: f5 x
function CleanHideClass()
+ e! `5 X) N4 }) G) d{ 3 P! I- d6 A Y8 U9 Y& [- q7 ?
& L9 a+ ?5 p( n
this.on=function(id,bMZ)' a+ | A- r4 t4 n- U. n: M
{
) q, x9 P# } J" X4 }
4 I/ `# z; y# \4 U! l; M if(id == 0)6 e# _9 J; g: f8 G7 ~9 K2 \
{- \) J0 ^# A- E! c
var page=/* document.getElementById("content").contentDocument */document;
$ {1 N0 N K( i5 g" B7 J. H this.RemoveHide(page,"span");
) X% h& @2 c8 {/ B8 M6 v this.RemoveHide(page,"font");7 s+ u1 ^. h' T7 t0 h3 M8 Y0 e+ \
this.RemoveHide(page,"div");
( [2 R" Y0 v( j: ~. Y; W0 t- d this.RemoveHide(page,"p");
$ O6 o4 a5 D9 E* N% ?! ^( t1 ? ' L- T$ j- R8 t
}
( L* h8 K8 C% n$ F$ w) p2 l5 R
" M7 p6 {+ J! ]7 v8 e5 u) [ }4 v+ n, ^4 q' H9 \! w, Z( c! C3 g
this.getobjstyle=function(node,prop)
% @% k! P/ p1 d {. N; s: ?" V, e" q& O/ g+ H
try
0 k4 I% G0 N- I! ]* E {
9 g9 C" Q9 I: }) d return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
& j# s* g. ?" E/ u* F+ l3 r }
, a. R6 K) e6 j3 F4 b4 }1 [6 e catch(e)
u1 j6 ]9 G$ Y6 V; L7 l, V, s {( ]- Q& k8 t2 Z8 \; h
if(debug)
4 O# ?$ i# s! X5 y& J. _ {
- b7 j5 q9 |- c( ~0 u alert(e.message);# U# @" n; H+ T3 Z4 Y$ h% f
}
k0 N ^4 ~" x- j( a/ g* \3 Y6 K 2 T V2 s5 T4 Z. r4 i
return "200";9 T1 \) W4 |& d, X) z# `6 U, b
}% x1 Q! s. V* {
}
$ \: c/ n: x( e
5 @ ^: @$ ? Y1 s8 u this.RemoveHide=function(page,objname)
( h2 J& f P2 G. L7 j9 t {# R: P- O$ F+ A' d W/ t- d" K: c
try
1 N1 E, y2 f8 h% n {9 q, b* g1 W& Z+ u7 [4 y+ ]
var minValue=15;) N* q+ k8 {7 Q0 {1 V& v: K
var objs=page.getElementsByTagName(objname); $ c$ a% Z) ~8 f1 r" V# a2 N3 I: N
) [7 [! ?, D5 ~$ Z) b ]
if(objs.length == 0) ) z- F( u9 T1 v
{9 f" Z, r9 l$ O ~$ c
if(debug)
2 [/ \& o6 j5 q% G, F. }8 | {3 K& Y L7 g5 l+ _: d8 s
alert("no object found!:"+objname);' m4 M% y$ R8 ~* I1 W+ ]( p
}8 K* j- _0 A% W( X7 I
}
- A3 J0 u' C0 u! d2 w. d else( Q( ^ E: W* D! Q
{
8 O4 R) U4 N' o0 Q# \ c" ] ! C; A) Z6 g) V! z# b2 B Q$ Y
for(var i=objs.length-1;i>=0;i--)
2 I9 V7 e$ K6 [ {' W& t+ s" q+ L. z2 [5 K4 X
var node=objs.item(i); 9 g3 u2 s* [7 O# l' }
0 h7 D5 c3 e- x* C
1 q1 ^' g( Y; Y6 E if(this.getobjstyle(node,"display") == "none" ||# w! x0 L( _! M
this.getobjstyle(node,"visibility") =="hidden" ||
$ t( U5 u# _& Y3 ~9 l" b parseInt(this.getobjstyle(node,"font-size")) == 0) # E/ H j; T/ X8 X5 ~4 B2 w
{5 P3 l& U5 W6 x! @. v" F
if(debug)
# I n6 M: |! F$ s( [# L {
% [ e& c' E6 E- o# L alert("remove invisiable!");
5 U+ B( H% l' i, ^7 b }( V0 X6 L4 J( X6 Y; N6 I1 ]' t0 y, n
node.parentNode.removeChild(node);
3 u; M$ ^# q( j" x 0 ?) h/ \* t/ y* a: U" P. ?
}
' w- [# {! \# N( d9 \6 [' T2 `! t8 S8 F else & f \; o7 \$ A9 I; T X, Y
{# |9 f: r8 {5 o) a% Q) \
if(node.parentNode) ! o$ {* e2 n! W. f% S" f
{
5 d p3 L4 f( \& [2 A var orgNode=node;
! K* J- C' _$ A! w( c9 T! ` var orgColor=this.getobjstyle(orgNode,"color")
3 {3 W* i: Q( V/ s var orgRGB=getRGB(orgColor); " q, N2 a4 ]5 }' X- M# U
( r4 ?+ Y3 ]" M& @
var parentNode=node.parentNode
3 Q/ p% ]5 N8 f$ T. v" Q var parentBgColor=this.getobjstyle(parentNode,"background-color");' |( A# A. e: [& `
* F8 r. J/ p( L2 S, N- z
var isLast=false;: y3 h2 n+ n A6 V# c2 b
# ^3 o/ _6 ?1 @6 @, X+ b0 x7 u n
while(parentBgColor == "transparent")
# j* Q1 @. k, t, }/ }2 h7 a {
$ ?; T% c3 A: R7 Z( ?* \( {( {& Y / Y$ o7 \- G8 T9 b" @; n
. p1 Y$ O. y5 u2 _& Z# N if(parentNode.parentNode == null)" X+ A W0 t5 Q, a6 X: o
{
& W6 s1 U1 a/ o1 d+ D4 d isLast=true;
1 ~, U$ n) ]( o; Q/ S, ?; |- X. h- @9 g break;& S+ i3 V# K: J3 l
}
3 {/ s4 N* v3 H parentNode=parentNode.parentNode;
4 S' \: I5 z, G& t( b2 @/ S parentBgColor=this.getobjstyle(parentNode,"background-color");$ Z% A% z$ j! U- \6 c6 @
1 q6 M* {# x- ]. i, @& T6 K: \8 ^
if(parentBgColor != "transparent")
! g: o- J r1 t& r1 }; b# t+ l {
o% x% p0 _ N: ] break;- X* I! R7 B' h4 k$ ? I
}& A( X D& `4 r; H
}
+ s% d6 ^& Y! e& j1 k if(isLast) 0 f' B9 c/ f5 w( w" e* X
{
% C" }1 D8 ]1 j if(debug): a8 {: [' ^( s
{2 f: n0 K. R O3 q, E
alert("last!!");
# m1 K+ C. M4 j( k. d) k; z }
) o$ D( C: n& I" w: U9 a if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue)); A. l$ l6 A% i
{+ U. v8 G/ O3 H, o1 E4 @9 S
orgNode.parentNode.removeChild(orgNode); ) _6 C+ z R, z+ P6 ^
}
- o9 j9 s0 y. H }
: J1 j( J: L* J% T( [* Z else
* J Y, `2 [( G7 H2 N {
" K4 Z( h2 G( E' ^/ v+ G* A; N' B if(debug)* R7 `1 S N5 M' p/ {$ y. Q
{+ I* r6 x. d( X( q
alert("compare color and parent bgcolor!");
- ]0 K3 q D: s5 k R' Y } e0 K# ?! n% q5 ^/ }& z3 m8 G; ~
parentBgRGB=getRGB(parentBgColor);& z4 |! d7 n2 c* B( X
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue)); B% X P. L' \; C4 v8 Y1 q
{
' y% N" n- X9 k U7 p/ A" c orgNode.parentNode.removeChild(orgNode); . }* _1 {; G8 `" E2 q
}4 S2 X( `8 b, d6 M3 O
}3 ?8 H! s+ M" g8 A/ p" k# I
}3 u1 _6 f) I+ {( {$ X7 I
} {7 t" q: l% P
}
; T4 [: S2 u* p+ t9 H1 q9 S }8 ?- Q) ~5 w" O. G- f
2 M/ D: \7 H, z" i1 s: J
+ ?+ ]) g* l' J; B- I" J1 d
var itemFrames = page.getElementsByTagName("frame");3 o- s+ w! ^$ x3 I) P) z
var itemiFrames = page.getElementsByTagName("iframe");. x( H, }) j* s: f. L0 \
! Z8 u1 N: H0 P; y: t5 n2 g8 x7 N H var frame, iframe;
7 T* c: d4 q. u4 o X if (itemFrames.length > 0)$ N: t4 _6 j( d: c
{
' k: q% `# D5 e& b3 b [ for (var i = 0 ; i< itemFrames.length ; i++)
4 @% X6 ^! p0 g {4 X& y; s. N# `
frame = itemFrames.contentDocument;
; Z3 o1 U# B8 Y' [0 z this.RemoveHide(frame,objname);
* v# t! H. {# h3 D" x6 I( L }& B+ v% u; P$ V- e. }6 ?% O
} {# M& l/ E- T
if (itemiFrames.length > 0)
; X4 ~1 h$ j0 r- s( U {
: m. Z+ s+ N5 j$ k5 E* H( i9 c for (var i = 0 ; i < itemiFrames.length ; i++) 2 h" T' B2 E% N0 V6 m) W
{
% B& w5 e; p8 X" ]& ?$ M/ p iframe = itemiFrames.contentDocument;
# o( C8 U4 c: a$ q0 a this.RemoveHide(iframe,objname); 2 |3 f& p4 Z/ ?& x$ B4 i( T5 n
}
) x5 Y) e$ A& v6 X% {+ g1 h2 N, b }! y6 P6 G+ e* h! [8 x
}* r `3 D# [% g, s
catch(e)
; n: b6 h6 y) u% L: s2 J: p3 o6 e/ n {$ ?6 b' I( B; i6 o1 D
if(debug)/ J- J4 K" @4 V" r. d5 V) F, B
{) Q$ N2 h& l8 n8 Y6 M: l
alert(e.message);
6 h: S$ I* t- i }, I' }# T4 n$ F6 }# w
}
1 s) I, N$ d [2 b }
8 U: u9 S- r, @% z& ]) {
; M2 n$ Y, n# W, U7 h) E- H}
* g5 j2 g- r* _5 w2 i4 y7 z
: o7 S( P. A$ U" V' b0 c: R( rfunction getRGB(colorString)' b7 w. K, L5 y! l
{- |: K2 c+ S3 d* J2 W
var RGB = new Array;: k& f, B# D+ Y3 r% _+ N0 A/ ^
var tempSting=colorString.substring(4,colorString.length-1);
, T! G+ A H# t2 e( @: Q, Z var tempArray=tempSting.split(",");
9 v% j3 F. z. i, G
/ n& a2 m8 {6 k- Z5 Q4 n RGB[0]=parseInt(tempArray[0]);! S" P+ b+ ]$ O3 t! V- b0 e
RGB[1]=parseInt(tempArray[1]);* A# U: ]* h" w; ?7 T
RGB[2]=parseInt(tempArray[2]);- l8 R0 h3 J3 k/ E, T
# S: w9 ]! {1 l5 `
return RGB;
, k7 Z0 m7 C6 i}
1 P9 }5 F/ {4 ~# R% ]function keys(evt) 4 {- d) ~& C6 ]4 D4 O6 p0 K
{ 1 `& j% e r. a0 }2 {% X- c# s
if(evt.ctrlKey && evt.keyCode=="81") ( _4 N6 J8 F* k2 w g# `. }
{ N c5 j+ Z5 |4 p/ X5 w
CleanHideObj.on(0,1);
6 L0 a# e7 W0 ]0 N& u alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
7 L% M3 Y0 s& N% u& F2 ?8 N 7 f6 b: O- u5 N) A$ L
}
5 C$ w5 w+ L6 s4 i }
4 a: t2 I' f1 C/ B* a5 rdocument.addEventListener('keydown', keys, false);
- k8 p( w0 l `GM_registerMenuCommand ('Clean Hide',
7 c y/ c i" @+ x6 ]function(e){
: ~( B& z$ A* e( a- o9 z* A+ CCleanHideObj.on(0,1)
" k3 M/ F) H. E- }+ galert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
4 c( v* J( R2 F/ G K7 L});$ Z% o: s# d' j
|
评分
-
查看全部评分
|