|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 3 Y8 D2 S3 E5 L/ S# y, O5 H
# \0 b$ P9 Q) J$ S2 U' H: L/ L火狐插件,用猴子. o8 Q- }+ x' g6 L
4 `& K1 `" N) }+ ?: {; Pvar debug=false; 2 p3 Z3 |, [. Y. J* Y
var CleanHideObj=new CleanHideClass();
: e Y7 _# y' f) Q5 K8 C" v0 H; D! s3 W S7 d |$ N5 B0 t
function CleanHideClass()
- Z! L R0 G" D{ + z# l x; V0 l+ j- \5 w
! N0 |$ J3 U9 d& p/ Z5 J this.on=function(id,bMZ)/ v5 X8 T) j' ^8 b8 T$ J( k6 i
{
/ o: _ n f H; R4 `/ }% S ' T) L; C w; h$ z6 Y X) ]" X
if(id == 0)
! \8 `0 E6 C8 n3 k3 j/ M( x& T* b4 Q {" c/ P$ P; p% ^% I% d8 A2 F; y
var page=/* document.getElementById("content").contentDocument */document; c w) X: k" a: ~+ x1 l) y. ~
this.RemoveHide(page,"span");9 D8 G/ T6 G0 }/ d$ O
this.RemoveHide(page,"font");& m+ \$ N1 i, ^( `
this.RemoveHide(page,"div");8 l' E+ b3 J# D+ t
this.RemoveHide(page,"p");
" c. O0 y* {8 T% D( B$ _
# Q: k: ?' ]* K8 j8 S' D$ F0 o }
! V6 h+ e, e# w$ F/ L3 U
/ I* Y8 @% _" j: D" _7 H% d }+ v% i- u- N2 p7 J3 t! ]# M3 H8 H
this.getobjstyle=function(node,prop)! s" e- m8 V- K9 u
{! m1 v5 m& i% |+ [/ g1 l. o6 z
try n: j/ O2 q: C) ?. m/ c& t
{! ?. K- Y6 Q& { a `* c
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
" C3 U0 w# C- M* ^: d }
0 [$ e4 c6 Y; p: J& F( H catch(e)3 k- P: l5 T: g4 `8 A
{
3 s9 P/ T6 x* A- h% F* v \ if(debug)
/ \/ }+ N/ c1 c$ g {
! H* D9 C2 _8 M& \, L$ k/ [ v alert(e.message); ~4 L( l5 U; M9 p) `
}
( C+ z8 v( w/ [0 z5 U" n
* Y; e2 Z0 s' y2 U4 P return "200";" G2 y: U& n: m- |( x2 y7 ^
}, W- ~# ?2 H" z% H$ h. h
}4 t7 ?1 _; q' p5 K4 Z" D
$ ^+ X1 n/ p `4 Q+ X) m this.RemoveHide=function(page,objname)
- W$ s! `5 o" l+ m2 d/ N {
( S' F! s7 U) E try
6 b+ K; N- L4 l3 o {
8 e+ n+ v) V( M; f% ? var minValue=15;
x- K) U p& I+ i& s var objs=page.getElementsByTagName(objname); ' e1 {' t0 P' u
$ Q" Y6 A8 q* Y7 N
if(objs.length == 0) " v; |1 [( I* t6 C `, w! m
{
" F; P! |; t; x if(debug)
, @0 S/ u+ S/ w" x1 D {, S6 z- t8 x4 o" }+ c! c4 {
alert("no object found!:"+objname);
' j C% O/ c0 G; J }3 a+ g( X) ]+ ~ H! A! `! X1 c9 B
}
. [% N. s( e& M- `5 O7 q else
0 k% h5 _& m4 I# A0 W* | {
' s' s0 j/ p9 ]8 k- l0 x 5 D8 z* P! N& {* g8 W3 {) }
for(var i=objs.length-1;i>=0;i--)
8 g* ^/ ^. I3 H) F" P" Y5 U {
5 X7 Q5 J! v1 l6 v6 X var node=objs.item(i); ' \# M+ V; z% |* W4 Y
+ l9 E+ `' R0 \4 | 6 S1 Q) x$ r/ ^; s: ~* r* D
if(this.getobjstyle(node,"display") == "none" ||
' |- l- D6 L2 G" ~. x this.getobjstyle(node,"visibility") =="hidden" ||
6 F7 T! Z1 t1 |7 d( F$ C parseInt(this.getobjstyle(node,"font-size")) == 0) 6 _1 \8 T- t8 X5 X+ D# ]5 A9 M
{% P% k. E2 ]9 B& T7 }
if(debug)+ @0 g# Z ^1 V8 E0 o
{. A \3 }5 \; ?, s8 p
alert("remove invisiable!");
5 W4 H9 @$ T. C& [4 n6 v. y# c }" b4 ?( _2 [: ^; e& g/ X
node.parentNode.removeChild(node);& A9 e* _1 `& o; B7 s" L
& ~5 `( r3 c- M7 n- c }4 T @+ Z4 c: X5 |" J
else
9 }( `, F" k8 A+ J {, J; h7 U" O3 b2 f; \- k+ ~
if(node.parentNode) 0 c+ _; F- p+ S( ~ }1 s$ y
{4 C' _$ o& E, f# M# y/ X% F6 v2 a
var orgNode=node;
# \1 K$ B" A( u# h var orgColor=this.getobjstyle(orgNode,"color")$ |( ^" e# }; Z! |) S8 l" T
var orgRGB=getRGB(orgColor);
- v/ R7 x- i+ |' J) ~
) {3 O& f, e9 }8 p8 d) v var parentNode=node.parentNode: B6 V# P8 ]( z# ~, a
var parentBgColor=this.getobjstyle(parentNode,"background-color");- l! C( g$ Z; D1 ~: s
! A8 X( } l6 y2 b4 p7 t L
var isLast=false;
* S; ~1 b: ~( e4 @- G
6 r: o" q5 Y( J, Y" m" M7 D while(parentBgColor == "transparent") 3 y* m) `4 O" i( `( R" @3 L
{9 J- b: s6 W- y. t. a9 Q6 V
0 n. q/ K8 g& K. p" P' ?4 n
: `! I. p+ x7 a0 U) {8 _ if(parentNode.parentNode == null)
2 G/ `. \; B! k5 v) ]; w/ d ` {* W. [8 E- ^2 Q, `- v& P
isLast=true;
4 O6 a5 d. m2 C/ _4 ]0 H3 X break;
2 m( c( V* N$ E0 B1 h4 F }* F2 B7 M( x4 d$ {
parentNode=parentNode.parentNode;
% P6 |0 O( h0 G- [- ] parentBgColor=this.getobjstyle(parentNode,"background-color");5 o% C; S" E0 M0 h a6 o" `3 A g
) v. k2 w- h$ x5 ~' `( h if(parentBgColor != "transparent")
5 S+ ], L8 V$ z6 y {+ e; ~3 [/ L! B' `
break;/ B; S2 K5 [! j \$ q
}5 h; O1 E5 s1 j- z$ s. A0 y
}
9 j) r5 H! ~' m- W" l# D if(isLast)
0 k7 n- }, B( |7 U/ a, {( a( y q6 l {* p& l' \, ~6 |
if(debug)
& u' Y) T; i4 ~# v# g! a7 H {
! g% S* g; y$ F2 { alert("last!!");
0 S! e& Y+ \& |+ B& \0 {7 l" }. m }9 |7 ?9 M/ v3 G+ J5 A4 T
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
# m9 f; q4 O1 o9 E7 }, H8 h {
* d/ g9 n9 f# p8 i9 J orgNode.parentNode.removeChild(orgNode); 1 ?" z1 c* @" Y# `0 [
}0 D1 `1 {$ Q$ a' K
}, C; _7 P, w9 h8 l+ d+ z! U, [( C7 W6 ]! x
else
. q2 S9 N0 M* B# b5 j {: n5 A" B' Y/ [! T! N0 N# Z
if(debug)
' a: u- [* p3 z# d3 z {/ C) t3 I+ I; b. V0 g, T" K: ]5 }
alert("compare color and parent bgcolor!");+ I& W2 g1 y9 K
}' z7 B$ B% ~2 `4 y4 l
parentBgRGB=getRGB(parentBgColor);
1 m( }0 L. X7 [& J, i if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
8 `6 i# D( ?9 Z$ K n1 o! G5 _ {
8 [/ }1 L, G2 F& x orgNode.parentNode.removeChild(orgNode);
0 J. F6 V3 l1 B+ X8 n$ z, G! l }
1 P4 m) _& _2 g }- z# o& }) J: B% {3 W6 N& U! ]
}
2 o% p; o6 R) ?- S6 q" ? }+ H+ d7 J- Z. y1 D u6 X
}
& V% m6 F6 ]" W# p# V5 n* Y }
9 [! [% o* i# G' n8 Y 5 C& f0 y \4 ]- F1 h% v
5 \: q, P% F! K2 o/ \ var itemFrames = page.getElementsByTagName("frame");
# K8 k: ~8 F' L5 X4 \* g var itemiFrames = page.getElementsByTagName("iframe");
" D( E, m% l0 o# Y4 t6 W . m2 s' \8 c4 Z O. R6 O
var frame, iframe;
0 k! y) ?; p# n' ? if (itemFrames.length > 0)
: x/ F$ w3 }% r2 `! H2 T U {
4 ]- [* r# e* r/ O: g6 e5 { for (var i = 0 ; i< itemFrames.length ; i++)
4 w- J E3 y- h/ O5 w0 k! w {* F9 k4 n4 ?1 \3 g; o* q
frame = itemFrames.contentDocument;
( d6 ~4 K# o0 M this.RemoveHide(frame,objname); $ n; }3 B3 i- k; U) X
}8 b2 M/ e$ Q8 f7 ^7 @ Y* Q- G+ ]
}
. a- u+ \: f( E. J if (itemiFrames.length > 0)
! V# H8 y9 I0 P* ^3 s {
7 k, ]5 @$ E: s) J( h7 ] for (var i = 0 ; i < itemiFrames.length ; i++)
' ?: O) r# P2 e% E8 ?- I {6 `) x _" J6 F
iframe = itemiFrames.contentDocument;
* |' f, A6 d" k7 C, S5 S" Y% B this.RemoveHide(iframe,objname);
+ T* ?' m+ G J8 w" }' e+ i }
9 m9 _- B! S$ E& S J0 S8 d7 [ }' L$ @8 R2 L( v4 p V
}1 z. Z% H' y6 a# H5 m) o" w, @
catch(e)
+ h/ X* e# L5 H" R0 F {
, V# [9 x. q; z" U5 D z if(debug)
3 h( A& _4 X* D: b8 A" ~ {
, O1 h: ~( ]9 k; U alert(e.message);
/ b) ?- i" D; _, r6 k( Z) x% F }: T" k& d% K0 X- h' r/ s
} q. s8 J+ h. T) U' R
}# A# w; G8 {' n8 ]! A* m
( v7 H1 U+ V( k3 y/ F, r
}2 n4 x; ]% J& q6 P' }$ J
* I& J1 j8 t+ ^7 @- \
function getRGB(colorString)2 N5 j9 t( R# {+ @: i; o
{6 G2 H5 M% z$ s4 t9 k7 B
var RGB = new Array;
- ?& ^0 S* W% l5 G' K var tempSting=colorString.substring(4,colorString.length-1);
0 I2 v7 B3 H% X( |$ j var tempArray=tempSting.split(",");
; v' U5 C" b. L& ?' g5 A% g! l. U. _+ \8 B" J2 Q7 C9 _, R
RGB[0]=parseInt(tempArray[0]);: G+ z, Y/ h# U8 a
RGB[1]=parseInt(tempArray[1]);
Z$ z0 \! L' b8 ~ RGB[2]=parseInt(tempArray[2]);7 Y' _3 P4 b" a- {/ K9 A, u2 I
6 J( o4 m1 X1 W0 X) k
return RGB;
- P6 F) A, D+ B0 W! W! I}9 g* f; V y9 e$ l# ]' J
function keys(evt) 4 F8 D B8 U7 W* u7 w
{
- F2 X3 L- a$ G( d) j0 J if(evt.ctrlKey && evt.keyCode=="81")
, g( U3 w2 y7 i4 G7 e { 5 V% K0 ~1 e' Q* T
CleanHideObj.on(0,1);/ \: {* ?6 W" h* ~7 ~
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); - Y& c" G Q! ^0 c3 w ~& d/ w2 |
/ U- t7 {% U( X! F } ' r1 x2 i, j m! P( I# q6 r
} $ C) V9 K+ @5 L7 ]9 q2 C, R
document.addEventListener('keydown', keys, false); $ ]; D5 {# I, n9 T4 b' P6 p
GM_registerMenuCommand ('Clean Hide',
2 q j1 B5 ?2 k! ffunction(e){1 g1 |+ E, _1 |' `% @
CleanHideObj.on(0,1) v' z) W: N9 `0 `3 |6 F6 m
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");; r$ a; B. ]* m( d5 Y
});
+ @$ m8 Y5 B. m# `6 R |
评分
-
查看全部评分
|