|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 4 E( Y* Z/ A: w
) x6 z( |% m s+ e' C- {, w火狐插件,用猴子& h$ J( U$ F$ m' V
& _$ A* d g ?
var debug=false; 4 [6 |/ x$ ]1 q5 q" o: q! u/ |
var CleanHideObj=new CleanHideClass();4 S+ q& |" v O6 a+ b$ r; h
' _: f/ e: \* `6 W7 r1 m( _% S- S
function CleanHideClass() ) `' V; k3 [; I0 E- d$ \
{ : a: E' M5 ]1 g7 ^, r2 D8 T' U
4 z$ [7 T6 z- q8 B: i1 P3 T this.on=function(id,bMZ)3 q+ O" C' O5 @. e6 k# M( F% w
{
7 w# ]. g ^7 O9 q# J
2 {& O' G% m ]$ j if(id == 0)
9 N3 E2 @$ H9 F4 {. L w3 o/ D {- k# D. o8 l$ C9 C( e( U, s, u
var page=/* document.getElementById("content").contentDocument */document;
3 [4 g c3 }7 M4 H6 W7 [' i this.RemoveHide(page,"span");
" B9 ~8 D2 A$ f4 S! W% W4 J this.RemoveHide(page,"font");
1 X# D+ p$ L0 a$ v, V; C% u1 A this.RemoveHide(page,"div");( \ `6 y# M* A6 \% L: G3 s
this.RemoveHide(page,"p");
& l, _) e7 n5 g. U1 y2 y- q' p
8 Y5 @& o: C: m2 H& L1 d7 g* l* m }
7 `9 k5 q" ]) h$ f* y7 l# i7 K; Y) o2 H * t0 @8 _* O$ V* {1 s. k
}
# A2 v1 ]. C$ s( c) i this.getobjstyle=function(node,prop)- B `5 n9 l6 D" O. l0 l2 t* p7 q
{+ s# I3 i0 C( x# N% K& I9 ~
try
0 M% L' \9 D% s) i {5 i8 Q# V! l. |( c+ {1 h
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
9 T& H, F& i1 u: T }* I. ^/ N' y4 L" X' W' m
catch(e)
) p" Z* H1 V3 f( _8 ] {
; h3 t9 U. b; Q8 I. T( G if(debug) ]$ j- A- r" H$ [
{
7 U7 G: H, D5 T4 s! v6 j alert(e.message);' n7 m! x4 y& ] u1 F
}( i& U8 M- c' C" R; J' k
# J4 F8 s4 P4 E% |1 ~- L# Z6 ~4 z+ [
return "200"; S5 _$ C9 Q5 ~; B9 M3 r
}
! z5 a. j/ X( K6 N }
$ l6 Q! W, r# r( J, K* o ' z9 l9 Q( w4 g) Z6 x& ]3 o' C
this.RemoveHide=function(page,objname)" k) X# C' X+ x [9 J9 X+ g
{1 ~, U. j; ]) Z5 b2 s, Z, S* T0 ^: H
try: q6 k* f1 q5 O5 Z
{
* o+ Z. Q4 t, k# O2 A1 Q; B# D6 O& x var minValue=15;
6 z: t8 N% l' C- ]$ B! }5 t! \$ F1 e3 O var objs=page.getElementsByTagName(objname); ' p, s- }8 t- n
( N/ m- c% n/ }
if(objs.length == 0)
3 O7 w. y6 |- z6 |# }0 Q% O" F {1 R- S! \1 ]6 }( m8 y: P5 e$ q
if(debug)6 w3 i- }; P7 j
{. [- i: ~: O/ j3 N) M
alert("no object found!:"+objname);
0 J' v/ O0 l5 W# e }
, i9 H$ ^$ b; a, c* ~* c }
4 Q, U, [/ Q8 P8 d else
: Y7 K$ ~1 a, ]* x" x0 r {
, n- ^# K5 U" J/ V
" C' C3 ?" v; W& e for(var i=objs.length-1;i>=0;i--) 4 [, s. P/ _4 ]7 B
{, M& t4 J' R6 N1 v
var node=objs.item(i);
P6 I9 R D+ v2 d; z1 \" {
7 Z- M9 S( Z, }4 Y! n3 c( F 8 u* b5 {. G' o
if(this.getobjstyle(node,"display") == "none" ||9 _" Z) {5 y7 h4 l: K/ O
this.getobjstyle(node,"visibility") =="hidden" ||
, s `" ?; ^8 n) u" a parseInt(this.getobjstyle(node,"font-size")) == 0)
$ a) n/ I" y" r2 Z+ K; ^0 W {4 u B# J- L: h
if(debug)
X: Q9 x+ f! f* W( B {
$ g& G& r5 _- [. q$ l' Z& ^ alert("remove invisiable!");8 N7 h8 `2 B$ F% t6 o" |
}
- x- v- i6 D' O: b node.parentNode.removeChild(node);% N M: A$ k9 V
$ c' q/ M6 h: r
}$ J: j! J! h; y M- f7 `
else
, B6 |5 Q X8 h& K/ F$ R {- G9 `) F& |' L4 `0 G% g ~$ |' T0 I
if(node.parentNode)
$ i- Q& I: X- z9 d& _ {. l) E3 s7 @5 A- s3 g3 i+ `
var orgNode=node;0 P# ~" g& T; x! l& L! A
var orgColor=this.getobjstyle(orgNode,"color")
: s+ D; B' S% w9 N, K var orgRGB=getRGB(orgColor); ! g5 P% j% b- a2 Z! S, K
. Y* L( i B) W5 T6 x var parentNode=node.parentNode/ }, [2 z9 _% Q+ j/ }- N
var parentBgColor=this.getobjstyle(parentNode,"background-color");
3 M' }, R2 A1 T/ V, _% I + p# V/ r1 U/ k4 s
var isLast=false;+ s0 P" ]: d- U* D7 k$ v" A# `
- w5 a8 ? r! ?. K! v; z/ O4 m$ f
while(parentBgColor == "transparent") 0 r) Z# e7 q1 {! o2 z0 n
{
$ Z; P v2 }) N: h5 Q8 t+ t$ v ; M8 A" I, \; Z2 \
! w; Y% i( c) E. U1 e/ L) \) J; Z if(parentNode.parentNode == null)- ^1 q- s. |2 R0 [5 R
{
, {& j0 q. ?+ G, v. \" p+ a) ? isLast=true;
3 \* p9 b& k& S8 @$ |- v G break;( h5 n5 p3 u$ o% W! G3 j0 E7 Z9 @
}
/ q4 l! p8 A! D P+ l parentNode=parentNode.parentNode;8 ^9 Z# i* Z- v& ^) C0 @
parentBgColor=this.getobjstyle(parentNode,"background-color");9 [( H( N/ V" @1 v
6 T3 z+ `) T' C1 d V1 e if(parentBgColor != "transparent")
* O: w( E* R6 h ]: w {$ V6 e {9 R7 j0 `/ c3 h
break;+ r+ j/ H4 k2 r/ Y" H% y$ _
}5 A; d' j0 I+ \
}/ V2 G: u; c$ I# `% E
if(isLast) 7 g& D h0 P2 D
{* M1 |% P9 E1 K/ \ W6 A) f. c9 U
if(debug). E( p7 l) ~) M. e' d
{
2 l& s. I6 K2 r4 }/ h+ K/ _4 x alert("last!!");
; @2 v- X6 ]* B1 Y, ^5 r% x, P }
3 b0 M; |2 s, h1 b/ m& ]8 W if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
0 R Z/ ?' n2 V. W) R* _ {
) f, f; J+ T/ _4 ~" p( ?: E$ z0 j orgNode.parentNode.removeChild(orgNode); 6 j( M7 \" H6 T3 t1 O" o
}1 A; I4 p% n0 F0 m* _
}
7 q3 k' D/ j2 t" v' T8 M2 K else% [$ s6 ]0 X/ W7 }
{
$ ]" s: r' i$ h/ w. `3 }( ]7 D if(debug)2 f1 N' Q9 V x
{. `( v, Q% ?" V9 ?8 ?$ W
alert("compare color and parent bgcolor!");
" p% A) u! x# ?5 P }
" z# |; r2 d5 G5 T) C parentBgRGB=getRGB(parentBgColor);: }( W( a: y9 P; H
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))7 r7 t: e" M: F2 J- M
{' ^% o. L) ~5 X8 @! O
orgNode.parentNode.removeChild(orgNode);
+ b O1 z& C d }) _! v3 B4 }$ V" f
}
; r7 s( M: I+ j) U2 B& X& G }9 |0 g- _: ~1 V: J& u
}- D3 x0 s- N8 C* |$ |- s" L4 L4 G# s
}1 w3 W; R9 q1 Y2 @( A0 G: U
}
4 K* q# t; l/ h) v& O % s8 o2 s N. A" r2 S- m' k, P
+ t1 Q6 _2 s$ J& j7 a- K! {
var itemFrames = page.getElementsByTagName("frame");, L8 T& ~7 a% Z) _9 b+ \$ Z
var itemiFrames = page.getElementsByTagName("iframe");
: R5 ~' X/ z. w/ Q ' Y3 q: x7 `% A, j% y
var frame, iframe;# g6 g- B: w/ e3 i: l+ k6 E
if (itemFrames.length > 0)
2 g& v: {; k6 W" o3 ? {4 N. M F$ ^5 ]- p* X, k
for (var i = 0 ; i< itemFrames.length ; i++)
b7 \% x8 a2 } {
9 S! m" U7 X' }- @- R, r frame = itemFrames.contentDocument;, w6 o; d a/ m3 I' @8 D
this.RemoveHide(frame,objname);
: {. \, @ A6 f# ]* n! a- {$ T5 N }( {2 B+ Z# P' [3 [0 d6 t( u
}. f( `# N' I5 r1 O; Z0 _) X- s
if (itemiFrames.length > 0)! _$ j: O" g* j7 w$ g' ]9 ?0 R
{
- \6 e. }% U3 @( E# q0 s2 ?$ ^ for (var i = 0 ; i < itemiFrames.length ; i++) 7 P9 ]! R" G# v; A0 ]
{
! {! G1 I4 b: J. Q- H( H. d: t iframe = itemiFrames.contentDocument;: L" h, x, d$ s+ f7 M( c
this.RemoveHide(iframe,objname);
5 t# Z+ M+ U4 k$ c, M }
3 G) G7 N- t% O6 h }
3 B! c* K" _5 J7 p4 s# z6 p; w }5 Z3 r" {! f- K8 I! \+ a' `
catch(e)
$ L: H9 t1 L- ?! J {
+ x U( v2 J$ R/ H# A. b. c3 G if(debug)4 T. b& c4 P+ I( @& A9 O; `: H8 ^
{! [. F/ a0 B$ P3 C
alert(e.message);+ @- [* T1 P A* N1 I0 u; O8 ]9 i+ v
}
6 a' D" @: F* h3 \4 d }! }; Q E, ]5 \: Q1 S6 P8 r" |
}! {, ^- ?% g: R
6 z, l2 J! P j% t' [
}* s! P/ a7 M1 b: q* D; W/ [% j, a
* K: i3 @: v0 w2 {- b* g
function getRGB(colorString)
' \8 r5 J, m- g" f+ Y{
* S. u- O" P! \: u, D- L. L% { var RGB = new Array;
n* b4 [7 F7 G1 a8 A var tempSting=colorString.substring(4,colorString.length-1);& y) }. B/ h+ Q2 {
var tempArray=tempSting.split(",");
( T) Q0 \" f( S6 _3 w: p
2 d. X8 Q4 ^9 U- n$ G. [ RGB[0]=parseInt(tempArray[0]);9 \. k0 ~6 G8 K1 E
RGB[1]=parseInt(tempArray[1]);. O( ]! f$ Y( E) k) }! S
RGB[2]=parseInt(tempArray[2]);
. r& t& N, s( v4 X' q* j3 h8 z8 G - k/ V) _" d( i& f4 J2 v( F" j. |9 I7 d
return RGB;
; T" E7 y j4 ]# j; F}9 e; g0 l- ]& A4 m$ Q* g
function keys(evt)
0 }7 r1 x* N( U8 n+ E% d9 w {
% h! _0 z$ \6 g3 L- }2 ? if(evt.ctrlKey && evt.keyCode=="81") $ q& o% Q9 |$ N) D
{ ' t* M5 Y+ } p& h/ c6 X
CleanHideObj.on(0,1);
% z* C& \! q+ a! S alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
7 b5 p- @9 G6 P
, G; B: \4 }3 Z/ f4 R }
0 t! l) }! [% z' c2 J/ V) N; G }
* J& k; R0 Q+ O. I" U5 C, T; B, b4 jdocument.addEventListener('keydown', keys, false);
2 ~' E# f, l+ o4 y& l( aGM_registerMenuCommand ('Clean Hide',
* \) M) U5 e. z' r( x8 Gfunction(e){
0 D4 a6 B* i- l$ `, }CleanHideObj.on(0,1)) j, `8 [' f# V: t! e. }
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
4 x7 P! {; \/ i+ r0 t});% ~+ u4 s7 }/ u$ |+ }/ W( x
|
评分
-
查看全部评分
|