|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
( I/ O4 r) V# u+ }5 ~" G" w9 h# _# l+ ?) Z- l- G. r8 j* q) z
火狐插件,用猴子
, ?$ c( E$ l# F( f8 s; k6 @" y$ n0 j. A" M
var debug=false; # K( y. @8 D5 l6 Y
var CleanHideObj=new CleanHideClass();) S2 O# L) I. \) s. d4 ?
8 N4 l4 N1 T m: [; V
function CleanHideClass() & W( g% ^4 ~4 k$ k9 e/ @/ }* W A
{ 6 Q) l: d, W5 G9 I
* v6 R. K6 }5 S8 Q
this.on=function(id,bMZ): f# x; Q" J m9 Z) Z0 |6 s
{- H- {( |! S( d$ D
5 K8 ~8 c( K2 {" z9 D if(id == 0)/ D. K: A: ]4 D: v/ }
{
/ M* B; P3 T, J: y$ w: ] var page=/* document.getElementById("content").contentDocument */document;
/ `4 `9 l7 m3 p# z! y7 @0 B this.RemoveHide(page,"span");; j, |& r# v8 r! I5 w5 C1 t
this.RemoveHide(page,"font");* g! a C0 Z# d& B
this.RemoveHide(page,"div");
+ F/ x/ Q2 m8 n' o' _1 X this.RemoveHide(page,"p");0 _) [4 }' l9 T
/ P+ v6 S7 t1 s; t& V2 p
}
7 l) G8 F' {# e7 e' V4 i
# Z2 d* S- J1 h2 @ H }/ {9 g% P8 N1 {! v
this.getobjstyle=function(node,prop)2 P4 Z, w. }5 v+ N- A# C0 ]
{
. p) W4 o- A; d+ v6 s4 Y try9 q* u! l3 }! o& H% I+ g. }
{! N: n @) U" `8 s! n- p. d
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);1 B1 ~2 ^6 _9 R$ _& m
} y+ U; ~; _( s+ w2 g
catch(e)" U4 C! m, H2 L( z
{
, d( v9 n0 p) O8 }; A5 M0 O if(debug): ]) I. N( m, q% Q- q
{
" g" \3 |3 e; u: q9 U- j0 }' z alert(e.message);1 `- G; D m4 D" D. c# f. r
}
0 a8 } C1 }* K- M! x0 Y
: d. q6 G( U$ O5 }& K/ L return "200";
' q9 _8 F! ]8 B6 C4 y }
0 ` z* V6 l. X2 r" A/ W3 J% k }
/ R6 X8 U; C8 ]1 k, ?) D7 i 0 T, |3 o7 M' ~/ Q
this.RemoveHide=function(page,objname)* u' E) p) l# S1 ?2 J6 m1 A
{
3 H7 t' Q$ ~: s try
0 b" g4 x) L) h/ P0 @ {: y' r% Z8 R% I1 j
var minValue=15;3 D5 n% v0 f8 H8 b
var objs=page.getElementsByTagName(objname); 8 v3 Q1 v ~' a4 O* _9 ?- ^- M6 ]$ R
5 C/ z3 `" t: p% i+ R) ?5 d+ E& w% g if(objs.length == 0)
) B f" g1 ]2 u6 Z {
" z H7 {0 ~8 n( @! y if(debug)& V' y6 J& {. Z4 V+ j
{
" v- S9 k% ]7 C. x% f alert("no object found!:"+objname);. W4 p+ t4 t8 Z5 G
}
6 N, i9 o% Y6 w6 q7 \ }9 j4 Y2 F, w( ~
else- K$ r0 V/ u( b }
{' H& a$ a) Y0 t, q
5 M, f/ H1 u- |2 a# r) ~ for(var i=objs.length-1;i>=0;i--) . s/ D6 X( p: m8 H- O+ l0 j4 h( v3 _
{/ k: Z( F. m( G! ~
var node=objs.item(i);
9 i8 m4 J# d0 V1 z2 U6 B
3 g: U, O) b; J) k* m+ W/ L
& m5 ?: \# R/ P$ e2 C if(this.getobjstyle(node,"display") == "none" ||% I+ }) L9 K8 t' F
this.getobjstyle(node,"visibility") =="hidden" ||$ @0 e8 B% ?/ |$ o( R. _$ u O# Y
parseInt(this.getobjstyle(node,"font-size")) == 0) , t; |6 s& @7 F6 p6 K5 X9 y. I
{5 o6 {6 P% C# y0 d! j
if(debug)
) N4 L) U1 C/ z0 C- U# z) T; J( ~ {
2 E6 T0 S W1 n2 t9 P! e1 B4 d& f" c+ H alert("remove invisiable!");: y/ p6 r, E" |1 T
}, K' T' v% C! k8 \2 g$ G6 Y1 s
node.parentNode.removeChild(node);
/ Z! j8 T7 ?- \. i. P 4 V& Q( j/ H. q+ F7 F. a7 s \- H Y
}% |; J3 V1 m1 m9 k( [5 S( m
else ; w0 t; H" v& N" q* b2 ?
{
* L9 \1 l D6 N# ^ if(node.parentNode)
: K) C! c6 t- n, P9 j* U0 ] {
' t- ?/ i3 `/ }1 T5 V6 k var orgNode=node;
2 \0 {# K! t2 A0 K var orgColor=this.getobjstyle(orgNode,"color")( X+ A$ w7 u N$ ?$ A
var orgRGB=getRGB(orgColor);
( h0 ]# D+ D$ C% N
+ D1 l" @ \; v4 K7 e var parentNode=node.parentNode
6 Z4 ]5 W# C8 E: g3 s/ ` var parentBgColor=this.getobjstyle(parentNode,"background-color");
, ^2 ?# X8 A4 t' V/ U- E 1 |$ e" z" C* h, J' r
var isLast=false;/ y" r& v3 J3 J: c6 j
# Z9 }4 N' E. [, T2 j* T; G while(parentBgColor == "transparent")
! {% V9 ~) T {9 J4 ~ {
9 u1 N$ M& Y! x
' K2 G, u6 r$ W+ W6 @" Q* Y6 r . b& h0 k- J$ c: b
if(parentNode.parentNode == null)
. f3 g' P: h: e' o5 u {7 U7 ?9 |. Y% t. Z, V. G
isLast=true;! e# n& E5 G* L+ g2 [5 g' ]
break; e+ H4 L4 } R
}
0 O" ^7 R; g% ]+ I# m) ] parentNode=parentNode.parentNode;
; m4 {5 {) p- r. X: [ parentBgColor=this.getobjstyle(parentNode,"background-color");: H! F0 Q+ \$ ?1 f9 S
+ L* c' Z. u7 O* L. \8 }- k
if(parentBgColor != "transparent") 9 ]/ k3 J& W- G$ M) {; O8 L
{
% o" \' i$ w% S1 w; j5 P( \ break;) T6 \* F4 y& I, H; I+ b- r
}
2 f+ b6 x5 k' |; V3 L+ P/ u }
- ~/ A. c2 j0 ^' G0 j) e if(isLast) ' S2 {- T0 {5 B. g1 d( J
{( ], Z# m# | y7 f- U
if(debug)
' n% |4 k: E' I {
! M3 Y) _$ ?; B: b alert("last!!");7 ?9 h7 |& S: c& E2 L2 _9 I
} z4 o7 f' Q; o' R5 z
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue)). m. p6 B# P7 F1 X8 F# `
{" x7 o! h4 p( A) K% k
orgNode.parentNode.removeChild(orgNode);
% Q4 \& u0 D" H7 n; A }/ P4 O8 x8 O8 d8 i, J
}
6 [; n( N6 I( W, c+ o; R# P else( U# g. Q4 S* U6 I: C) V, J' ]
{# B+ k) \6 w1 k8 Y0 q; v
if(debug)- F: y# c1 d! S# D+ T7 \1 ^0 A
{
; N6 S" f, J0 ?9 u! n5 t alert("compare color and parent bgcolor!");' t0 R: `4 j u5 V( k5 W
}& L1 V5 A" O2 B1 v
parentBgRGB=getRGB(parentBgColor);
, D1 j& V$ J/ T$ o5 m if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
9 e. n2 J' W3 A9 w4 } {$ H) V: X, i: D3 |2 D
orgNode.parentNode.removeChild(orgNode);
- K, z, w; P/ B+ o% V+ q5 r }
0 ^* P6 O% x, w w2 _, Y }
4 {9 q8 N4 w+ h8 q9 | }
* Q- ]. A2 g& @# q3 Z1 x3 z3 p. w }3 K7 _: P p1 s& h9 v
}
+ z- |& I) b5 _1 ] }# Z* U5 M' e: m+ i3 h+ `
8 U! P9 t7 n$ R
! a& O: B5 l6 ?7 c; g% p" A4 ~4 A var itemFrames = page.getElementsByTagName("frame");4 ^4 \" C9 u; _ E( L0 y7 o# y9 g" [
var itemiFrames = page.getElementsByTagName("iframe");
, N/ F, p4 V$ e2 C; S* R 5 |. ]$ x: q$ E( a. F, ?
var frame, iframe;& \5 R: y8 ]! ^9 t \3 t/ I
if (itemFrames.length > 0)" {2 v* M3 I0 p _+ L p8 ?7 P
{
1 n V6 y2 Y# R/ k) H9 N+ z for (var i = 0 ; i< itemFrames.length ; i++) ) c N3 y' f" m8 Q9 b
{$ B$ |; P; n( X$ X* w( I7 S
frame = itemFrames.contentDocument;8 J- x! y* J( j* { v* N
this.RemoveHide(frame,objname); - a, e4 j' @% T* [: u( v) t2 x
}
' m" Z* G# O. t. b M' n( B }
9 m# `9 c6 [: x6 W( V# Q$ k if (itemiFrames.length > 0)
9 x" A# W8 }/ \/ j7 c {( c3 @3 a" G3 `- w5 m: D! l
for (var i = 0 ; i < itemiFrames.length ; i++) X m# M6 y- ? S
{' L& S% [; k- L( D+ o8 D
iframe = itemiFrames.contentDocument;$ G- V( J0 Q8 ^; W
this.RemoveHide(iframe,objname); ; ^6 `; c v6 V
}: e" p/ e" D& f2 Z+ h9 j! z
}
3 ?- Q# I5 T, `+ y! F; }6 p }
7 e \4 x( U% y2 b( s catch(e)
- p; k: l- p+ a$ A2 K0 @2 p. g+ b {( N) H% U7 u/ e$ J V1 `4 Z' j' x
if(debug)8 O" h* V4 r% |
{
3 D" I4 y, f$ L. W' y2 r alert(e.message);
- o6 Y0 M8 W# E! o" N+ | }6 y; M- l/ _* ?
}
7 s8 b0 I) a" w) k5 U }9 r) g# n% L% y/ |& l
! b7 z4 F' [2 W) g7 i5 y( e
}5 V+ }4 t- _: f# [: T9 @2 m% o
& T$ b2 g5 f4 R# a; D
function getRGB(colorString)- f9 W4 p: i5 Q
{
8 M% f) M; O/ R: ^+ }( a- a# c var RGB = new Array;
, z5 \" U( L: E) r: r var tempSting=colorString.substring(4,colorString.length-1);% J- c$ e" q, r! p! h) ^
var tempArray=tempSting.split(",");
; Z' ~* q1 M# t, V! m' N
& d; x% o& ^$ N RGB[0]=parseInt(tempArray[0]);
4 F/ D9 n6 E/ y' y. w6 {$ P RGB[1]=parseInt(tempArray[1]);0 A8 r% T$ m# H3 T
RGB[2]=parseInt(tempArray[2]);
8 _8 t# U+ i4 r2 J% j
' e: {0 D) r* A* o% |4 x; j return RGB;" o" [: Q8 h3 F% H: H
}4 E$ ]8 X/ y" E/ O8 M
function keys(evt)
% [0 Z6 D, s6 ?4 L( w { 8 U' B5 ]6 o4 s
if(evt.ctrlKey && evt.keyCode=="81")
: A3 V( a0 w& g3 A1 w, t2 e {
( }+ J1 }% i3 m4 Q CleanHideObj.on(0,1);& T! O( M: g) s) F' N% n
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); / K, m! y& W4 T- \, l- A
$ q. m4 G. u+ k1 l! k5 N. R
}
. ?' C# O* p1 c& t' n H9 s$ | }
) n5 K, E; n ~$ a7 rdocument.addEventListener('keydown', keys, false);
4 f+ p# f1 C! [8 S. H# LGM_registerMenuCommand ('Clean Hide',
2 L+ T. _( J5 ^function(e){; k5 l. f: e5 v3 G+ K' Q
CleanHideObj.on(0,1)
" k2 z1 i* F- |: J% ^) malert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
k- `8 |+ j! A; t});
8 p7 z1 {: R2 `/ H% x8 P |
评分
-
查看全部评分
|