|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 $ g+ s. R6 I! _" q; I0 R/ K
5 V7 f& N0 v! j- W火狐插件,用猴子
, a6 M7 l& a6 I3 a a: O" h4 V8 v8 E
var debug=false;
0 m8 F) x, ]/ `var CleanHideObj=new CleanHideClass();1 _& d! B7 g: t) u! |' X6 e' Z
6 f5 d$ G0 `0 O. s
function CleanHideClass()
( f4 n6 k" [" q6 V$ M{ 9 L- l3 o3 G6 ~: T! L
1 H3 g) O1 s H2 D; q0 h* G this.on=function(id,bMZ)& A8 v) ^0 X8 }) B, i0 ` T
{: F- N! f/ ^6 W _" f% {
9 X* ]) h$ S; m8 c9 f' D5 [% {( E if(id == 0)
9 i5 Y6 k3 A) ~4 G$ N {+ m; K/ M+ Q3 h8 ]8 T
var page=/* document.getElementById("content").contentDocument */document;
% w7 Q* j0 W0 l+ C6 f* A6 W+ E this.RemoveHide(page,"span");! Z3 Q F, i1 ]& G2 d3 R3 Y
this.RemoveHide(page,"font");
( r9 z' V' D0 y+ T# t4 B this.RemoveHide(page,"div");
% ]% A6 m3 R& }2 t/ j9 Q. } this.RemoveHide(page,"p");
- v! K+ Y. n2 A5 V" N
, a( [# t) }0 s3 z/ B }
- a# N9 r* r. v& X 6 a; y2 K* I) Y, c/ y
}
- ] m0 |5 @5 b" A i) n this.getobjstyle=function(node,prop)5 |, f- X* R$ t0 l. Z7 j! a
{$ s" u7 ~" d& P, Q# j: W% t
try
3 h2 k& O/ u- {. ^/ E {
! v5 ~1 ~' Y1 q: x- k2 C return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
" q2 O" A, X; A& h' Z }% g8 |& c* R1 g1 A+ g- s) ]" M
catch(e)
" J" u# ^& I; U5 m I* n. @ {
8 S/ \, ]6 z8 Z, R if(debug)& M4 V( _8 O8 x; c. V
{
7 y# b# Y( l" {5 V alert(e.message);. J# m% x; q0 z1 |, m8 H9 c! h
}
( J) V: @$ {% N/ ?/ Y" c
% m' `) _. O/ H0 r8 p7 X return "200";
1 ?3 I/ _) c* f/ G& ~6 m }- @9 O3 O/ _4 f5 n: c% F1 u; a
}! |/ Q. ~) n2 J0 n: h. H3 s
, ~6 R/ r; P! V) @ this.RemoveHide=function(page,objname)5 W' H6 k+ z! x3 |9 I
{
3 T* ?1 g5 x5 Y- I3 t4 U7 P try
' ]0 C$ U8 q+ Z: E7 u3 G {
5 D- z" v" ~# I+ R2 T% I var minValue=15;; _ @, O. ]( X S& {: I
var objs=page.getElementsByTagName(objname); 2 G n# s! b3 [0 B
: B- W9 O ?7 d& i( _* x if(objs.length == 0)
2 a0 h) g* m" ?: c9 Y {
) W$ L) H! X2 J0 w/ k3 E) l if(debug)
( R8 b# t( H" Z* m1 @! j% j& A {
+ @' ?& `# N* C alert("no object found!:"+objname);
" N$ U1 Q+ {0 M/ g* K5 u: O# B }8 w0 D9 I6 p' A# e7 o4 F/ r% f8 A/ P
}
+ y# A' C7 D$ S. C7 k else
& Q) ~, a1 R+ h( [ {
0 ]" z0 |+ t9 D$ K2 f: U3 d9 N ( R3 v: J3 s% k+ p
for(var i=objs.length-1;i>=0;i--)
8 C0 o. J7 B- @2 x {
3 Z( X% Q$ `1 s& G var node=objs.item(i);
% f; i- N- U; R5 ]
1 Q& o9 ^1 z; [5 }. g ; w9 |( [+ |/ z) s
if(this.getobjstyle(node,"display") == "none" ||7 g9 Q7 R# l& j: ~6 l& u( G* Q4 X
this.getobjstyle(node,"visibility") =="hidden" ||0 P, E7 z1 [; n+ }( S" |# k
parseInt(this.getobjstyle(node,"font-size")) == 0) 7 `/ c5 V! l! j: Y( c
{$ x* u3 ?$ g/ N0 \! P
if(debug)
+ ? t9 u2 }1 g, j {
" X9 q1 T& T; Q G4 O alert("remove invisiable!");
9 q' l0 F4 o& E e4 r0 e }3 T @2 A4 E' I
node.parentNode.removeChild(node);/ d1 y7 j5 S1 n+ U- ~3 U
4 J0 i& d7 v6 Q8 ]# p3 L }
. L0 m2 f+ D* Z+ N; n$ A+ f* r, E else / f n$ R+ q/ Y0 Y# ]4 h: M6 J
{% k/ d$ C5 B% h/ H, L ~" m* x
if(node.parentNode)
- ?3 `1 g8 {$ }3 Z$ \6 Q& ? {$ T; y Y* P# g
var orgNode=node;6 y% m1 @- g _* _
var orgColor=this.getobjstyle(orgNode,"color")
, t) a2 F, Z7 J# s' e, r3 m var orgRGB=getRGB(orgColor);
2 O2 c& n$ H L2 B
. t: g5 Z3 I! `/ @- e$ K var parentNode=node.parentNode5 Z$ J" o7 K4 O( l1 ^! u. P
var parentBgColor=this.getobjstyle(parentNode,"background-color");; w7 \: Z; o2 T
7 l% g( I; X7 H1 ]0 D- `) k var isLast=false;
, t/ k1 t& R) Q8 ?( Q; C
& t% S6 _6 a6 ^" f7 t while(parentBgColor == "transparent") % ], z4 x5 c1 o6 a* L- |3 }: n& F7 O
{ X3 r9 N0 m0 w$ f- d) P/ {( F
" ?! j1 a: M4 N 8 M( `9 d. v0 {: q# K
if(parentNode.parentNode == null)
l% U* R3 N# \5 K {
4 F, k8 r" D. _ }! | isLast=true;
; i) l5 H: H1 W2 { break;; O k: w' x$ @9 v! j) O
}6 K5 q* V- |. o. }
parentNode=parentNode.parentNode;0 R/ z3 Z4 ~4 _. u) L1 B- k
parentBgColor=this.getobjstyle(parentNode,"background-color");& B$ U$ @: @5 {, K
$ j& { a6 f3 q* f# Z, ]: h; v if(parentBgColor != "transparent") ! i( U/ V' l" l1 r E% m- f
{
- m8 a" X, R% B+ m% r( N# { break;
) N" q# T6 d! V o- N9 N6 F }% k/ ^( S* _$ Z Z
}
+ M# y. ]) R8 R) ^) e if(isLast) 0 G* M1 P9 x; I* j( m+ z
{: _/ W; t! J2 Y) z. \9 b) T1 V+ |
if(debug)6 z3 o5 r: P* I( q+ H- \/ j- A
{. W6 w6 M/ i. u# v! c5 R
alert("last!!");1 W+ R8 ~8 E3 _; P, L
}$ \: W( ] j5 H1 z
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue)) {% U' A) q& |% B! a8 I" x9 h
{
& B2 D% z2 B7 i# x1 E0 ~ [ orgNode.parentNode.removeChild(orgNode); ! B! v1 ?9 z6 A6 z$ M& ?- _
}
0 X$ P, y- D7 X$ s; U }' k' ?% O) ]2 b& b* g b
else
1 q! \' u c4 m {: R3 y( k* n: S4 j9 T
if(debug)
+ P' S x& |# A {7 |+ E6 ?. I2 A2 L$ S# @
alert("compare color and parent bgcolor!");
! w; i& K, p' h* f+ p& x2 N& q }( [% F3 W# I, W
parentBgRGB=getRGB(parentBgColor);
|1 W5 x. i$ d( b* w# ~( Q/ n# H( _ if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
# P3 I* z% d3 v [& N; ]" _ {/ g, U0 t5 e# w+ d
orgNode.parentNode.removeChild(orgNode);
7 y: F2 X$ `# N& W6 g8 h8 L4 @) M }0 L+ F* i, x# W/ y) A
}
; Q; |5 s z: {+ l }
; @) o, D. a$ H- P0 W& N! S }
7 J d; j U4 n7 f. E% y }
0 C0 D1 k; Y5 Y" j. c0 `8 H }6 l# Q3 o% n: t6 b2 P- `- V
# H( _- O$ H6 j* g- [: c, Z' Y
8 k2 o* a. q* j( Q8 A1 m1 A var itemFrames = page.getElementsByTagName("frame");
+ T0 G/ [) W( ?) e var itemiFrames = page.getElementsByTagName("iframe");; g. [( I$ ?3 e% w: q4 i2 I
5 n" G9 \0 X; F2 Y var frame, iframe;
1 |4 |3 k$ U" ]$ j: D. H0 r$ |5 j: e if (itemFrames.length > 0)
8 \) C: t( d: k p {
; f& u" }) l. B) J& Q for (var i = 0 ; i< itemFrames.length ; i++) 4 |+ |/ P, h' S! n$ h
{
6 @* F3 O/ t+ P/ u! X& w( u& ?8 y frame = itemFrames.contentDocument;8 ~% K8 \6 _& h: J8 h
this.RemoveHide(frame,objname); , m& V# q$ J* q
}
0 R9 X! r7 y1 _' D9 X }
1 w1 ~8 s7 E& ]6 c" h if (itemiFrames.length > 0)* Y2 z- D6 N7 r$ q
{
$ s2 z5 k6 e* d9 K# P1 k' ?" C for (var i = 0 ; i < itemiFrames.length ; i++)
1 e( R! g. H3 P2 B1 [ {
# v3 G& n* n* j- c iframe = itemiFrames.contentDocument;* ?4 \8 K7 e7 D
this.RemoveHide(iframe,objname); 0 T1 d# Z# m. j, ^' n3 h+ ]0 q9 p
}
" k, g! _! u* w4 j2 R }; C! H* A$ ~- ]2 y% ]- i
}! G) T( ]; B" o( Z
catch(e)
; V/ M: E f9 \" f. Y7 C0 J {) f% l& U! s+ O# W1 P" r* w0 x& o. S
if(debug)) x0 g1 ~1 |0 H- i0 n
{
3 ^4 X v9 h1 B$ Q5 } alert(e.message);4 p3 X$ b7 D' { u
}5 I2 i0 w, m5 b0 o# Q! Y
}
2 V) ]$ V0 L8 z6 J/ C }
+ N3 D- n2 |- G9 n7 M! ~ # N7 Q3 W* L6 S* C% y" l- I
}* A+ a6 @+ I1 i1 v" q
3 {& m$ Y7 q/ D* D9 ~9 O& K* l+ |6 Qfunction getRGB(colorString)1 J& w% t# D% k/ l
{, {8 t4 Z9 D D% p4 T7 r' W
var RGB = new Array;
0 Y/ H+ z( P) S7 W var tempSting=colorString.substring(4,colorString.length-1);" z. _# U: B& ]/ d/ h
var tempArray=tempSting.split(",");" U0 ? B! n* q2 F
! {0 ~! h u Y6 E7 w S- r6 g1 w RGB[0]=parseInt(tempArray[0]);
9 c/ g5 ~8 i4 u8 {3 U: T6 s/ i4 P RGB[1]=parseInt(tempArray[1]);) b3 n/ y# Q) z' Z# u
RGB[2]=parseInt(tempArray[2]);
: u; S# [6 o7 M- F' D+ ~ , c# X* d: r" l1 D: D, I6 e/ u
return RGB;
" j2 \( S$ |) [/ W. M" A, p}% O. _4 u' j5 j6 X7 `% k
function keys(evt) : J' n, a- w8 b: q3 K
{
& Z; f) `7 ~+ t) F e if(evt.ctrlKey && evt.keyCode=="81")
. ~ ?5 U5 x8 s { ( ? l9 ?6 C( c* r% G
CleanHideObj.on(0,1);
4 X0 O) |* h) S/ R5 M alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
+ z0 H/ d2 [9 k - ~$ p( o; k) V0 ^
}
4 G# y& L( x. \2 G) i, y }
- F, I7 d f( T- V4 [document.addEventListener('keydown', keys, false); * g1 _( |' V6 Y G0 j7 N& r& F( Y. C
GM_registerMenuCommand ('Clean Hide',
) e+ A9 R \8 T& \# rfunction(e){
, r7 k( J* v+ D4 S5 N. \" YCleanHideObj.on(0,1)
, E1 H( P0 j1 _6 d" F, z% B, Galert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");0 _# g& @6 L5 I C4 n" \4 J3 o
});/ c! u, L# V$ |
|
评分
-
查看全部评分
|