|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 ) p) ~1 X! V. n$ C5 w) v
$ ^7 D& U, S0 ]7 s
火狐插件,用猴子
' E+ u6 e+ r$ Q' u% z1 j! N. ~: m: o' d
var debug=false; / F v8 c i M
var CleanHideObj=new CleanHideClass();
: [/ g' H+ ]" C1 Y5 r0 h5 C0 W+ e
3 e x( X' H ~( n1 ?' ofunction CleanHideClass()
{& n7 y( y- q9 Y2 [( X& A8 j. `2 h{ , G" r/ w! U& g( g% @: R9 r* @0 l
; ] z7 C" E# d9 o8 k
this.on=function(id,bMZ)
% [& U/ r8 `; D% d {
0 H5 I* r2 @, r! [; P, ^9 Y B
. m, y: E& m2 A7 h if(id == 0)
) i" @( [. ]& }/ ^8 i* V* a$ v {
3 Y+ D8 J T) f! P* r: f var page=/* document.getElementById("content").contentDocument */document; ( _8 R& I y: f5 y8 I; Y, f9 f, [, u
this.RemoveHide(page,"span");+ _/ o: x9 F \( v- {/ a4 C; H
this.RemoveHide(page,"font");& H/ V5 H1 l3 c# s1 C( A- d8 o
this.RemoveHide(page,"div");4 w" X' L, `+ h" Z3 a/ G+ G
this.RemoveHide(page,"p");( f2 I: j2 j" c6 `6 D( S, T/ ]7 N
, D4 R" {; m3 `8 N }
4 }0 {! Z$ e. ^: V, k ; r0 Y, v/ r+ ^0 A9 i
}" S* `. g9 @6 W1 A* Z
this.getobjstyle=function(node,prop)
2 o4 J# N. s$ t- k% @9 n- Q) }* W {, v: l' \8 e% M0 u# p$ g9 [0 ~. C
try9 p$ R' L5 C0 g3 b8 ~: K
{, p) |- j' [/ n8 m9 T! W8 }6 l7 K
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);" U1 c ?, Z, _& u1 \% g9 E; r6 ^
}
5 H( P c3 ?8 @9 E5 m catch(e)& W) ?$ D# R/ l, t
{' j0 n2 n5 Z# }) \
if(debug)- E5 i+ _0 W7 }7 L1 W0 M" L' a
{
+ y( `7 [" b* @4 g! [1 D2 g alert(e.message);$ d+ p6 [- J# H, `5 U/ u& T; f
}9 E2 Q; O- n2 `( F6 i5 f
5 R! i- k$ c" P" a
return "200";
! g& d+ ~- u) O' s' K' ^, L6 Q }
% b" x) G4 N+ k$ \- { }
9 l& @. G, V) d$ ^2 f+ _3 {( C $ w6 p) f! p7 ^
this.RemoveHide=function(page,objname)
" T4 q1 W9 f" m0 g {
/ b3 k% o7 K/ X* h( Q5 I5 ]: \$ @ try* }# Z& Q8 z6 X" ^) y9 A
{
8 l' v# g: K/ I/ u$ M; g9 S8 q. u var minValue=15;4 e R6 V; q) ^! |, x2 O- V+ J( J
var objs=page.getElementsByTagName(objname);
8 j$ ~( j' k+ }8 H
% N6 c( Q/ ?! R- ` if(objs.length == 0)
9 S. g: L- ?4 w" S+ B- l {* S" q2 T4 W# D/ w1 q( f8 m% ^
if(debug)7 U( G5 V+ z6 Y* O5 E
{
' X& c+ p5 D8 U8 s alert("no object found!:"+objname);7 X m/ Y: @: M0 v5 u5 H
}6 _4 B* {, ^8 _8 r
}
2 l+ j. p( g9 O! B& c0 g( i% \1 x" U else
0 B% v: v7 Y+ [) p' E { p" i( b3 A& }' ^: V7 s
- Z1 A4 |' z; j% W8 n. g3 p for(var i=objs.length-1;i>=0;i--) $ h4 q6 n& G4 t7 z
{
. ^* P: ?+ P/ d% P' Y! k var node=objs.item(i);
4 O1 G* e# @1 G, D3 ~) L$ N4 E 4 c% j$ z7 b3 a" I& |# B
' u* J: l% _9 A* M- ] if(this.getobjstyle(node,"display") == "none" ||
! x u9 j: r) m5 q! N/ A this.getobjstyle(node,"visibility") =="hidden" ||
2 q) ^ M# c' U9 `* _5 e parseInt(this.getobjstyle(node,"font-size")) == 0)
d- g4 j& f- \* ^7 ? {
; _4 x2 z3 B6 x, s if(debug)
; Y8 c/ O5 X, [8 M* E; C {5 v5 T. u4 h; a
alert("remove invisiable!");
, E Z7 X# F0 M( Y$ Y, j, f! ?; `3 V }
2 B" g4 G5 ?! o$ N9 n! \ node.parentNode.removeChild(node);
/ w: e" ~+ z n7 E ( Y, \" S4 k5 \5 W
}
6 @& g- [7 M0 N8 u$ ? else
! [* u3 [: W: z {
3 I/ h# b) C7 `3 U5 @ if(node.parentNode)
$ g6 S) ]5 [2 O& z* D {, k7 B. M# Q& u5 s6 C
var orgNode=node;) L7 F g( L( e) h |0 P: [+ T- L
var orgColor=this.getobjstyle(orgNode,"color")
& g2 \. w6 Z3 m$ e var orgRGB=getRGB(orgColor); $ O5 D: c: W" @1 U8 h) G
6 I, n% ^4 T8 g- h var parentNode=node.parentNode
( [- v; A" q- B* i var parentBgColor=this.getobjstyle(parentNode,"background-color");
% c4 b. h4 D8 d% u
- M2 P8 T2 o6 i& } var isLast=false;
+ x7 e) h/ f9 E0 ^
9 O& ~! J5 q# L4 f while(parentBgColor == "transparent")
, c+ ~: {. F" o7 c {
- F# s" d. g: c$ Y2 P4 ~0 H7 I ( y9 s2 y! Y+ Q" P; K
5 i# o7 a( {6 t$ p" [
if(parentNode.parentNode == null)1 y0 m9 Y* o' f. A
{
! j5 A' I @5 \1 K% ?" H isLast=true;
- _1 O9 j9 M7 t/ ~3 W' q$ } break; w; ]# h+ k1 S; D
}
: @. o4 l- n' h% \( c% g/ J3 Z parentNode=parentNode.parentNode;
( c! T( P' G( Z, b* g$ ~# k4 d' E parentBgColor=this.getobjstyle(parentNode,"background-color");
( x% _6 S* e$ {/ a- S" g$ k
W" ?3 T: P" F! C& k+ K if(parentBgColor != "transparent")
$ Z+ k# I3 j% l+ g8 f( R {
# U: q4 A6 A1 J' B% V2 _ break;
4 w' d( ^$ j4 P( J }4 j2 t% ]. d) h/ m7 v3 ~
}3 v# M4 z y* T) C6 O! P: v
if(isLast) 2 ]* |1 U) _4 H
{) D% m. D; ]6 E0 O1 ?! o' j0 ^
if(debug)
4 d W" N+ y0 \" ?1 l- c {
. K8 V4 F6 d* E# e alert("last!!");" r# E, w/ C: L7 G5 W/ V7 m! G
}
. K7 z; C6 P2 d1 W) d: ^! F if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
+ Z" |" J2 \; a- ~0 ] {5 b! D0 X! K5 {, U0 ]; a
orgNode.parentNode.removeChild(orgNode); : `3 a# I( B, h! I, s8 Y
}: {# _. b% D; k, s
}9 R" f# S. R/ c3 f/ o2 P5 U
else% Y1 z6 y' X7 K3 `- f) a7 k
{
, X& H& ^$ C- W3 U3 ? if(debug)
1 i8 }4 ~. R `! } {
9 R% B# @% J) w alert("compare color and parent bgcolor!");
0 P: u, ~- R/ ]+ k }
: P5 V( f( I8 D6 I# N6 F parentBgRGB=getRGB(parentBgColor);' H7 s* D) d+ t; U& w
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))/ j6 h' [( S: t' O
{
9 A3 U7 o( [/ Z' O% V orgNode.parentNode.removeChild(orgNode);
5 d; P1 g( t7 b; F* z3 \ }0 m* I8 \; \# k. W* m4 _$ L/ Z
}
7 e+ w- v9 V$ F4 u- y, v- s( y- e }
+ w' F- F! w8 a/ n3 q2 l }7 I$ Q6 O F0 J# p! ^% q& I
}" ~) l, T5 q: l5 ^" m
}
5 e( r* L% Q5 N/ B* a! B 3 f6 n9 g( q2 N* z5 E/ U
/ d6 A& M$ D- C( k# t& d. T$ @2 x# ~3 g) Q var itemFrames = page.getElementsByTagName("frame");
- _; N7 r5 A8 M3 V9 o9 R3 X var itemiFrames = page.getElementsByTagName("iframe");
. n c8 d( P# E% i 8 P! S1 P8 Q+ `
var frame, iframe;
/ a ~- k, N6 A c if (itemFrames.length > 0)
# @6 ?8 I9 s% s: u* g {
8 P% }/ u' }2 b; d/ o& H- o0 I for (var i = 0 ; i< itemFrames.length ; i++)
9 D. F# w& i! M3 ]3 |5 g- q {/ Y: M( Q- N9 G% z. ?, T! J/ W( Z
frame = itemFrames.contentDocument;+ y: i) \4 Q! O3 C
this.RemoveHide(frame,objname); # D4 @1 y1 f* E& v, X
}
% T( n8 p" C0 I% J* b, [$ Y }, x3 Y+ s* o8 ]) R+ U9 ]
if (itemiFrames.length > 0)
/ A+ U% W7 d( a8 Z {; d6 e- j* t! [, l' c
for (var i = 0 ; i < itemiFrames.length ; i++) 0 L! F) w7 ?8 D
{. s6 a1 F! O- j6 g* |# j% f
iframe = itemiFrames.contentDocument;
! Z6 h& U$ i- c( ?7 [, @, r, [ this.RemoveHide(iframe,objname);
9 s1 Z' q: E5 r r% a; B, ^ }
5 r! t2 w1 {! |0 {& U0 O$ O$ D }
d, Y! f1 r- I8 z }
& e9 b; U) @5 v3 ]$ F catch(e)6 H( l' H, v# N/ e2 X0 C
{. M) Z+ n0 b i& N' a+ M( E
if(debug): a1 G6 ^% r$ D0 V- W& x
{0 Z/ N$ t2 [# v9 H% _! _
alert(e.message);( k; n# c& D2 U0 H2 F' e
}
7 D: T: o# |! q# a }
% a9 q. x. f5 j+ ] }3 t- B, ?" {9 l/ T H
. j0 x/ n: }9 h* s
}
8 ~- `: R5 M4 p0 y' I; U- e- ?+ N2 p% I% m0 I
function getRGB(colorString); I3 I; @- ]) S% q' U1 j
{
$ D9 S/ k% p* R0 W var RGB = new Array;
R) h' d9 w8 w" W7 A var tempSting=colorString.substring(4,colorString.length-1);
! { [2 Z( Z" Y h var tempArray=tempSting.split(",");5 `" E! i% ^9 ~* }
' p- c3 d. k9 L8 X RGB[0]=parseInt(tempArray[0]);
* y. u* q* q4 ]/ {' ? RGB[1]=parseInt(tempArray[1]);
. C; h5 e# d; E; u+ `" b RGB[2]=parseInt(tempArray[2]);
" w1 B ?3 U4 Z( w0 J4 J7 f 5 a* f2 Q! `* M2 t
return RGB;& l: r* A+ z8 R; [$ q' H
}
: n7 v) h ^7 b/ b: c' I) T! ofunction keys(evt)
7 t; }; R: N0 v$ w: z% D {
" `6 Z, ?8 e U; U) ^ if(evt.ctrlKey && evt.keyCode=="81")
# L. @, V c; q6 M; w/ V9 M {
' D; N0 c7 I0 c9 l v6 J: e% N CleanHideObj.on(0,1);3 J- H2 r# z/ j( X5 V6 m9 x& A& u+ G) w
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
7 F' C$ Z- l( l, f8 R, `
( s$ [' L5 J9 e# L* T/ q, B }
R( D8 s5 |! u, w }
w3 t0 P( y! ]( Ldocument.addEventListener('keydown', keys, false);
7 a% i) z5 N3 t( p% p' K0 bGM_registerMenuCommand ('Clean Hide',
0 [( U2 e) s. X3 I/ a9 t8 ~function(e){" a* F* w3 `/ T# q; b: x
CleanHideObj.on(0,1)( z" \" o4 t! b) Q: o
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");/ l: t$ p) P4 e# O% ]8 s
});2 w# w+ s0 C$ C* A' ]7 z8 X& Y/ m% Q
|
评分
-
查看全部评分
|