|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 1 b L# I$ }$ @! r
" G6 r) R9 E9 M! z; `火狐插件,用猴子- E% Z/ n/ `3 p [( u
+ @; Y' c7 X, c3 J% I) \var debug=false; 9 V( w5 A/ H2 n- J6 N4 a( [
var CleanHideObj=new CleanHideClass();
' \1 A& ^4 L" M* C8 n
2 x+ {4 t# X1 }( ]% Ofunction CleanHideClass()
9 i" ~0 m% a) k2 W) A6 l* p{ 0 a0 x- F2 [ [# E$ Y
" r7 u) H! `4 P this.on=function(id,bMZ)1 F3 i) u/ M/ W9 E" r- I$ M% Y- }
{
4 J! X/ L8 x' N1 V3 e# z8 [7 e$ q
: _7 ?6 K% i: m! `6 f if(id == 0)
0 a/ Q, C' ~& R& C {
& \* \/ R z0 f }9 d6 M2 D var page=/* document.getElementById("content").contentDocument */document; ) D1 {4 R7 b6 g- _5 M- N& x" x& o
this.RemoveHide(page,"span");
6 y6 k" n5 ~, M" { this.RemoveHide(page,"font");
6 r3 O6 `# O# T* Y9 Z this.RemoveHide(page,"div");% s5 u2 B: H z! n# J. X9 ]
this.RemoveHide(page,"p");
7 [8 ]6 f! U+ k5 F
- ]/ S# Y$ l$ d0 R }
/ f4 e- F( N- e* c/ W# K( @
+ b2 ]3 N" c, S }
7 t! H' T9 @# e4 \* F$ q- R* L this.getobjstyle=function(node,prop)
0 i1 @6 J- e7 o$ e: F {7 M4 [3 E1 D& w- k1 t
try; Q( ]. Z9 K0 y8 O" d9 R
{
- B; {* V( K' s' S( r( v! \) q return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
5 ?# \: Z; j$ b) ?; m2 b1 \ }' v$ F. _9 S* y0 k# X4 s. b
catch(e)
8 Q# g* n% K6 r) o {% t9 F) J5 [7 ~6 c% E
if(debug)
- O3 I' K: K3 t0 k" s- @4 Q {# }. c: i1 w+ e6 @
alert(e.message);
& \0 t* j' y! [2 [ }
, V m0 b. [- N2 x7 e 4 J L8 J: g3 f# B# q) G4 {
return "200";! @' i% T) v3 Z# B
}+ C3 H* y7 ?1 u1 |8 }, f
}
- h5 ~8 k. r- K% K7 l' e- ?0 a
5 W- Y; K& j! _, ?( w3 B this.RemoveHide=function(page,objname)
% o1 }& O3 i0 N {- R3 H$ k# }6 d2 M/ d; }4 \! B0 E4 U- h. c
try c/ m) V, x1 N
{
+ n5 t* s% n3 m9 ^ var minValue=15;
% B+ V2 l2 L: U: B3 C2 v W' h0 t var objs=page.getElementsByTagName(objname);
# N6 k" Y% O" w! ^( X4 Q
( I0 g9 Z8 m( M- h: O if(objs.length == 0) 0 j' }4 G( G- Y( R- J% \
{8 s2 z% ]. O, i& \0 S
if(debug)5 c* M8 [# @0 h4 _/ k. @9 Y- r' t
{
& N0 H* z! b7 o! n alert("no object found!:"+objname);
6 [- ^2 v6 o4 v }" h0 o3 p2 v' w9 r# N6 t$ ?
}& i& X; h& _8 I8 p, E) P
else5 R" v- C0 o, [' V
{ \% }# O+ _7 C# w# q0 ~; y
; p, u% j9 v2 K& }' }5 r* \
for(var i=objs.length-1;i>=0;i--) # L# x0 h7 ]+ v5 b5 A6 Z
{
' X% }0 e2 j/ S2 V& _ var node=objs.item(i); 0 S+ H" u; Y% ~3 F& c( h. J7 x- e6 r
" I* P3 m0 W5 ~4 V9 p4 a . d5 u2 }# r" A, T
if(this.getobjstyle(node,"display") == "none" || T! m g$ a2 P( f! a3 C; O
this.getobjstyle(node,"visibility") =="hidden" ||
+ X; |* E6 r( {4 T/ c7 ~ parseInt(this.getobjstyle(node,"font-size")) == 0)
! i" J1 a( e5 h" U4 \- A {
5 | j* q* ?+ {, l5 } if(debug); q5 B) e7 G. b. {
{
4 O1 C. u" F8 f6 q. l alert("remove invisiable!");
$ D- B& N/ M6 C } _8 Q2 m, H# U# n2 ]
node.parentNode.removeChild(node);2 ]; s7 M# `' z
8 }# X, m. d" J' t& S/ K$ a; J" L }
# Z! F1 D( D; x/ P else
+ Y) U1 H, b7 `7 A4 O% W" U {
2 e$ R4 d0 d5 N* Q4 a a if(node.parentNode) 1 Z# ]8 i8 v3 A$ @/ \. _* h, d
{5 R: J# c0 W+ \0 z' I" E
var orgNode=node;
" [1 P4 _- @' k. d+ Y+ i" A' f var orgColor=this.getobjstyle(orgNode,"color")5 `1 K* ?" r7 ~
var orgRGB=getRGB(orgColor); 5 ]- D+ G$ D2 |
6 k* |) A& e. H8 h2 {
var parentNode=node.parentNode
# J3 j, e$ t! ^7 ]0 \8 u7 e var parentBgColor=this.getobjstyle(parentNode,"background-color");+ X5 s0 e; A5 _7 p9 f! z
' z! y# Q0 L" e4 `) t: j' N var isLast=false;8 x0 E4 f& l- X6 ]0 Y" B
8 T# c) N! e8 @4 N
while(parentBgColor == "transparent") $ c+ c* w. P: M+ E. B" X8 x$ T. z
{
+ d6 e: p( Z) X! _
6 W- i0 Q" D: |, Q( U
6 D1 c4 A0 |) M( w# J& g: M if(parentNode.parentNode == null)3 N3 |4 A$ b: B( p( m/ w( `' ?0 S9 H
{) k6 W- d; z0 ]5 R5 m& @/ ^/ p) Y
isLast=true;
8 u7 f! f9 L# \ K, ] break;$ A8 j [2 f7 @/ X% V2 o) c3 q1 Q
}
3 _4 ] a7 A) @" n8 e parentNode=parentNode.parentNode; A# i5 L) _) f# m- o& M
parentBgColor=this.getobjstyle(parentNode,"background-color");
9 [- ]7 N4 B. e2 d/ T( E$ @" j8 J% E6 t: Y# K! V
if(parentBgColor != "transparent") + L j7 X3 s+ z8 ~! o
{
$ V. @6 C! ~* K0 A break;
5 z, g+ ?4 @ g }
) Z7 P5 I2 S6 t% z7 A) T( V! } }
( n ]( q# P; `% a+ O if(isLast)
7 Z9 j# W! [9 P7 d% m7 O$ P6 B; I {( }! v! j- B/ u' f$ `1 ^+ y+ a1 r# F
if(debug)4 ^0 R1 `$ V; I5 a. r" j* O6 D
{# t5 Y o/ g# G9 C- \: H/ d
alert("last!!");
7 P! \3 _1 a! Z }& Y$ f- V2 h9 x8 w' x0 y9 j, i
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
; k. \) S b- k: L {/ H# N1 d9 W6 S: h1 h* G1 O
orgNode.parentNode.removeChild(orgNode); ' z& H. }' j5 z
}
6 q( x/ P5 w- @8 Q% V2 Z }# ~2 Z+ {. l8 k
else
8 |+ g3 E7 t! l% I0 l+ k8 Q2 M9 d {1 c2 R$ J$ I- r9 z! H6 h( d1 R3 j
if(debug)0 g* x6 j. l7 s# F) J. x
{
0 X$ g# S/ I4 L alert("compare color and parent bgcolor!");
. N/ m. V% M$ V$ G! U8 n+ a4 m }
" V0 q7 M$ {: A# q: Z) E! F) U parentBgRGB=getRGB(parentBgColor);
) R( r. c" I- o6 g( _; `5 } if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
* [ V4 [* V$ r7 a$ ]6 n {6 o: L0 R x& Z5 J9 v
orgNode.parentNode.removeChild(orgNode);
% b7 t" V8 k( e }
! a" F6 A9 v" W r% @ }7 b* v$ \, H" g; I4 v) t- F
}5 U/ T, G0 e0 T8 h8 J9 N: }
}
& r3 l! X9 X& ?. S8 h2 v- E }
% [# j5 z6 c, `0 c9 m$ k }
/ H& }' E6 B, U3 F9 X
$ L9 y$ [* ?% C; D: ^* r1 A 6 ~/ k- u" j& I. \
var itemFrames = page.getElementsByTagName("frame");
' W e6 z% B0 H* p( t& D var itemiFrames = page.getElementsByTagName("iframe");
( W4 @. M1 q$ X1 j* j9 P 4 P' i4 B# J1 `3 P$ c- w6 k$ O
var frame, iframe;: s; @) x5 j( ^; Q' f/ M
if (itemFrames.length > 0)
2 Q4 ?( q# L6 K2 u8 d: v2 U {/ ?$ R0 g7 W3 O) \: V+ n
for (var i = 0 ; i< itemFrames.length ; i++) - n* r8 Y; I$ [* w
{
]0 P! {( O% D7 {& o frame = itemFrames.contentDocument;
' i7 v7 q7 S( l7 T this.RemoveHide(frame,objname);
" Q" w: `: ]9 j9 A4 Z' }8 j5 j; e }
- N. y) m) c$ j5 j }$ a- h9 r: O+ s
if (itemiFrames.length > 0)
( c) b$ W. x/ ?. g {
4 `& A! D$ }/ q( k% s( c+ n0 c for (var i = 0 ; i < itemiFrames.length ; i++) , E# w3 z" t: B( C
{; c( t% l+ r, w3 x* n% F: p0 I. I
iframe = itemiFrames.contentDocument;) t2 M- d6 B1 c/ @1 F
this.RemoveHide(iframe,objname); 7 Y+ u3 K& t. g2 t4 i/ Z7 V
}
/ }! i5 T {( F9 c% O3 p& | }2 d6 A" W3 Q+ z5 J1 e
}4 {3 z" [. }* }- C
catch(e) y8 ], V, G2 t/ |, r
{
: C7 @; B. ]5 p' l- w if(debug) x7 B" [. P+ F( E
{
% ?7 t8 f0 x7 A# g! A }9 b alert(e.message);
3 M5 v" [+ x t }/ _8 E0 u, s( }
}) X1 k: M9 z& j5 ~. D% M' O
}
* D& f: x) ]# p; Y% P
! d7 q! M; Q: E}6 i# V# g1 s q. |: v: {
4 Z) s0 }, ]" o( g& B
function getRGB(colorString). |& B, N, A4 H' G2 z
{( Q7 r4 x4 s! r" ?( K8 ]* q8 C
var RGB = new Array;
7 O/ n4 J+ f7 T4 B9 e var tempSting=colorString.substring(4,colorString.length-1);
8 V* V! }( r, x var tempArray=tempSting.split(",");
9 T8 Z" u1 [+ h* M
) d* [- z7 n( P RGB[0]=parseInt(tempArray[0]);2 z0 x( O: X7 f L4 R" c/ u1 Q
RGB[1]=parseInt(tempArray[1]);
! ]& Z! K$ s% t RGB[2]=parseInt(tempArray[2]);7 S8 c" m5 N* C8 m
' f( R' C! A: p! _% T return RGB;, E3 f( D$ [7 p6 o3 Q
}
; t+ z: l4 s, |# d" s' a1 @/ }6 gfunction keys(evt) 3 _9 d9 K/ J4 h( d. n% F# E4 z
{ : A. c3 H7 ]' G8 g2 |
if(evt.ctrlKey && evt.keyCode=="81")
# a& T3 r# ]! u- F3 M { . e! l: s$ }/ H' N
CleanHideObj.on(0,1);! Z- F3 W- P: s
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
3 y8 S! ^! e3 W# j! n; l' K- X% h: V
% i( S- j% M M; Y, C+ L& e2 f. M' X } 7 M3 |4 B- r! x9 M4 s
}
' M( v& c E# k3 |) C5 [4 c' {2 Qdocument.addEventListener('keydown', keys, false);
" e0 P# y# ~1 M" u2 ]9 U( tGM_registerMenuCommand ('Clean Hide',
/ p/ u+ A! Y/ M! T7 R7 p+ Z" P) Tfunction(e){9 t* U* V5 H% E
CleanHideObj.on(0,1); o( w# Z8 F3 E9 ? ^
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");/ {% h7 u+ K n: K6 c
});
8 I( ^6 q9 u+ K1 W2 |3 ]$ w |
评分
-
查看全部评分
|