|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 - t A! o& S a4 L' c) O6 e
2 L1 ]' U+ @- {/ y& {% h5 ]. U
火狐插件,用猴子# a# b" o d0 S' u
- q$ O, }3 {- ]0 e- ^
var debug=false;
3 E a; g8 |+ f: A/ ^/ Avar CleanHideObj=new CleanHideClass();! u9 x6 ~5 z6 c; p" p7 C, \- C
1 {; C8 z( \/ C5 E8 q8 T! Ufunction CleanHideClass()
% K" z& n6 A1 C, c3 M{
. I; } `* C2 f+ f9 l: ?
/ n/ T% U$ u0 G9 w) Z, ~ this.on=function(id,bMZ)7 K! e7 p5 s( C' D* K$ U1 n
{8 q* s- r3 J. b; j K
5 T0 \/ B& L; {, e$ _2 F if(id == 0)
# V8 G* Q4 g1 `$ k8 p+ f {8 G0 R8 [9 M: O! Q
var page=/* document.getElementById("content").contentDocument */document; ' B- P" D" g% W; G8 L: O: s* q
this.RemoveHide(page,"span");+ T/ x( |8 ~0 S& ]) ]
this.RemoveHide(page,"font");
9 s( G2 g! N; b' p this.RemoveHide(page,"div");; |7 P! A6 E9 s
this.RemoveHide(page,"p");
7 l' `2 z1 U! E, H% _ : y; }- X. @/ x: W9 Y5 v+ i- h) w( r
}
! m( e9 v9 X4 w N+ F - \# y a, C. T
}
' o% E) ]! C! U7 J this.getobjstyle=function(node,prop)
% s; W* f0 b3 @* f5 u* G2 ~ {- @4 @1 v" [1 g8 F
try( D, x& ^8 n4 l1 g$ [' ?3 `5 X, v
{* t4 P l& ?0 ^. o! ~: Q7 F: e
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);5 t4 M- ]* U- i7 W. L3 a2 p
}
2 M8 P: j. {2 y5 K0 r6 u catch(e)0 a8 k- M0 {2 [; G% h% J
{: {! Z% H6 B" l1 b: N- e* J9 M5 G
if(debug)$ [# ^7 B6 c4 H/ B
{; p# K6 l' L8 c, O
alert(e.message);
% Y+ }' A* [+ Z4 h ~ }
' g3 m: m& O* R* D: Z1 _+ Y ) b% T$ v1 x& u
return "200";
, Q! ~, z) Q: P. P" R2 h9 g }
* S1 L0 K& P j8 B) n Y& a$ s }/ \9 r5 [2 u7 C8 \ r
3 Y8 ]2 @7 r3 [3 z1 ~/ g9 C2 J5 | this.RemoveHide=function(page,objname)9 Q" M6 [! e5 h& X/ p i* e( k; R
{1 o! H- J2 N7 e$ I; K0 n2 m
try
1 r) M$ C! k" w4 @* A {' A# ?4 C+ L# ~/ f. b$ L. Z
var minValue=15;3 g2 e. {- r% J- q# h$ z
var objs=page.getElementsByTagName(objname);
0 N6 A* s% V- T* |- U) v' W+ ?1 f/ [0 ]
if(objs.length == 0) " D2 T, ?: _* \- P: u7 L
{
L. b% [3 y G" j if(debug)
& _' v, g* l7 w" t) @8 C' E {7 ^3 I) M1 P; j, [. o/ b
alert("no object found!:"+objname);
. m1 e2 I4 p& @7 y; j( l8 f3 | n }& n0 ?3 C$ ? z7 Z( K! r
}
; g( h1 L4 H$ W/ H& ]% t1 j else
# b% P! T' C* p/ L z+ T {
+ L# ?) X9 J6 ^8 s$ @+ E) I9 P7 [ 0 D! }4 ]+ [. a+ o
for(var i=objs.length-1;i>=0;i--)
: _8 P/ a" {6 Y4 }$ \5 b {
a, B7 S3 j, c var node=objs.item(i); - H$ q( M' P; b% s, E
8 J1 Q. m' Y* H$ \4 }3 g2 l
, g4 R; C* v% {# H6 e/ `
if(this.getobjstyle(node,"display") == "none" ||
/ f. U: ?8 P* d) \& e" `& E this.getobjstyle(node,"visibility") =="hidden" ||
# f; w% N2 N, t% C! U4 d9 r# V parseInt(this.getobjstyle(node,"font-size")) == 0) $ d# ^# ]- s; J4 a
{
, e1 a, J% T+ B4 [: u5 F. b0 y if(debug)6 L& N. {; s8 u( t
{
0 o* x" F& E' X# d8 a5 y alert("remove invisiable!");4 Q+ g: Q( p0 `5 n( b
}
/ F, Q# q& n& w node.parentNode.removeChild(node);+ V- e" c# b6 k
( Z- \ W: H& |8 w8 z
}' c, a4 O- c4 f. Y
else & V; V( Z8 `4 t7 l' r, F2 z7 M* ?) G
{ k, X0 N( D( o7 P4 }; p/ i
if(node.parentNode)
% D5 Y) K; H8 `1 m: Y {& G9 c$ S- [# _7 x/ @, l+ V8 F4 u1 {: p
var orgNode=node;
+ J5 V* \+ {- T( W# D" Q+ ^ var orgColor=this.getobjstyle(orgNode,"color")
8 Z3 u) j$ \, N/ H. c var orgRGB=getRGB(orgColor); ; ?, I, Y% X" ]( V' H
$ \0 |( C$ `4 u, |' {& V) l5 {
var parentNode=node.parentNode
5 K4 A# O5 _, O, H5 R var parentBgColor=this.getobjstyle(parentNode,"background-color");
- H$ v- U- D1 U9 @ l) M% Y% O" x
" S& V1 N# Q/ F& P' | var isLast=false;
8 _9 ]* ]% b% ^# L3 B" e! j& Q ) q- \2 N/ D, g
while(parentBgColor == "transparent")
4 p; B4 C9 ]; D8 W8 P4 d {
* E4 b5 ~. u8 {2 y& Y
1 D) Z3 `0 j7 F. P4 P$ X E 4 t; [/ s" u7 ^
if(parentNode.parentNode == null)
4 O3 U$ G' a! g. G& {+ f {, r6 d; c: U- f
isLast=true;8 }% ?( ^5 C1 Z+ M
break;
- ^% J& w; C! C4 Y& A }/ |& B. |. l' @
parentNode=parentNode.parentNode;1 G+ k4 [7 W* e2 j* w& a" D M( d
parentBgColor=this.getobjstyle(parentNode,"background-color");, {' F+ m# y7 V$ U8 t
- I4 i# K1 X6 ?& D9 G if(parentBgColor != "transparent")
( { i. E2 `8 P% b1 g- P2 M {
( _7 |' ~5 d( r' ]9 H" d break;1 h3 }6 [8 ~& j# w
}
( x4 s# `" G* f% e( r. h }! O, f! Z+ H1 f6 w# C* [) A
if(isLast)
. ?: Q1 g# R/ f {5 s- }3 {: B! m" P$ [) D2 l
if(debug)
- D$ R' q7 c$ |5 y; L& l {/ D. F, Q: X, U
alert("last!!");
# h9 ?3 ?: W2 w8 |! H }
) T3 f. `( J1 w' o0 W if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
+ _7 L0 F' K g7 j* r2 Y. N {
' D9 J( }9 q) X) `2 g1 j0 u6 x orgNode.parentNode.removeChild(orgNode); ; X/ r. g* h% W- t
}
' |. N/ B% \) {1 h' e }
: L8 u2 e1 p$ V else/ `! k+ D1 N, E+ _& I
{
) R; q# j6 l1 ^, J2 D' Q" O if(debug)
6 V+ a' a6 u' F( y x* g. I {
% w4 b7 D( G u) G1 Q alert("compare color and parent bgcolor!");
" w1 C6 v0 j9 F' y' X5 l }
3 W. s, T0 T( C parentBgRGB=getRGB(parentBgColor);8 @$ U: z! d2 E
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
& I3 ]7 W) b/ J7 X6 [" ? {) P) V! X" d8 m- ]1 a% ~
orgNode.parentNode.removeChild(orgNode); 5 `$ ], {* I. G) V
}/ W6 H! S, h" Q, v+ \/ w
}
* D/ a7 v: h+ [3 P3 e }+ F! {' N( `+ j+ Q6 x$ ]/ e: ~9 I
}
% G: Q0 V w4 p3 Y }' z4 X6 W- i" D( x% y& G1 f
}% F- z4 g1 H2 l, I
, X6 E$ z4 @2 Y' V 2 G3 v7 O, B1 w' }5 O5 g |
var itemFrames = page.getElementsByTagName("frame");
* M- x2 [' x$ F var itemiFrames = page.getElementsByTagName("iframe");' j" x1 ?. `7 e& E
+ H4 F1 r1 P9 L, P
var frame, iframe;3 i" F% w; ~* N" F6 ?# e0 t* u
if (itemFrames.length > 0)
! M/ A& q' h/ F. [2 X7 H6 B {
+ a" m) _& x" ]! d' k( ]* q2 U for (var i = 0 ; i< itemFrames.length ; i++)
8 i+ r& f( e; |8 e! h2 P7 D {
: l+ r8 b/ |! `5 N% L" U1 {- V frame = itemFrames.contentDocument; \' L, b' K1 a6 w8 D8 k8 v' @
this.RemoveHide(frame,objname);
6 ?/ ^% K9 b' k- G- W$ O7 G }
, X2 O7 w( N, u* f: v& r3 R }
; G/ U6 J2 J. [/ o3 R% f9 ? if (itemiFrames.length > 0)* J+ p8 ]0 s5 z: |
{! ?2 f6 K' m* u, b: Y! L
for (var i = 0 ; i < itemiFrames.length ; i++)
' R1 v5 ^+ g6 D( m/ p5 C {2 A# ^% Y2 Z( w! h. D* F
iframe = itemiFrames.contentDocument;
1 o' h! h* m8 W3 f- L this.RemoveHide(iframe,objname); 7 r9 S' d$ b5 D! R
}
8 f8 n. h* ]8 B1 J% i }
+ d) P4 S7 W# q, P }
: b0 c- Z$ S0 ^ catch(e)
1 D' ?; C z; u( w+ N- `- O R {
2 V0 f) H' j$ m" B# e0 A if(debug)0 j1 A2 [# C& S7 v, k" @
{ H" A/ i3 n; y/ a; m9 @, W
alert(e.message);$ Y4 I9 h3 V* U1 m6 a/ G' ^. P x
}4 ` X: h5 s' \! G p
}8 l6 G2 J/ v4 J. v
}, X ?5 X* _ I; o' R0 ^- k, a9 K
3 f+ n! h& X; D5 V, Z8 j( e u
}
; | N! F, l8 p, v2 s7 d; W/ R- J* F# ]% y1 q7 }
function getRGB(colorString)
$ r) U ~, J7 H& I" n/ U{
8 x) W3 s4 Z( B( g7 t8 B5 ` var RGB = new Array;! {0 `4 u9 r# } O, i7 {/ U S+ S
var tempSting=colorString.substring(4,colorString.length-1);) r, }' C8 t7 j) J3 |
var tempArray=tempSting.split(",");
) e+ M9 T( M% s- i! v, v
/ S# r" b" v- \0 Q/ V8 G RGB[0]=parseInt(tempArray[0]);: ` Z- ` A2 @, R
RGB[1]=parseInt(tempArray[1]);
3 q. Z2 S0 S* T; z RGB[2]=parseInt(tempArray[2]);
* J' b% c7 {6 P1 J/ t $ Q( S! m |5 M+ m' [
return RGB;
$ p9 _, N4 N4 s6 M& W; o+ ~( _}, }7 S$ M a4 {# i6 b
function keys(evt) 3 O9 J+ ?, D( R8 F: h8 D
{
8 C, a: d9 e/ @ if(evt.ctrlKey && evt.keyCode=="81") 3 |8 F' f( ~% c5 I. w6 C
{ 9 |4 ~- `! H2 p: P2 [
CleanHideObj.on(0,1);- q7 L+ ]6 j3 N/ c- V+ L/ G! _
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
. x, D1 O+ |6 v( t( Z
( B/ T9 L( A; U: J8 D } 1 k& @5 y$ k4 [) r1 a* ? P& o
}
% ]2 P4 @4 V; _* Qdocument.addEventListener('keydown', keys, false);
3 W$ c0 _7 W3 \7 ^GM_registerMenuCommand ('Clean Hide',4 T: D, K/ Y% _5 l: q* Q( V8 I
function(e){* v8 J Q! y, q0 s. e6 {# s' i2 |
CleanHideObj.on(0,1) D; V( L% O- g5 a% U) F7 x8 f
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
- y, l& R. w0 v* R3 R R1 o4 V});# u2 F" j8 r) d& |! S2 s Y
|
评分
-
查看全部评分
|