|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
' b' F+ S. _" D' p1 `3 R9 B8 I: d* C4 Y8 L: t/ Y/ q
火狐插件,用猴子
`, S2 \( R0 q/ K5 ^+ F6 k; n- O. N$ d+ A; H* b
var debug=false;
) C0 n, D2 R$ c2 Fvar CleanHideObj=new CleanHideClass();9 f( k6 K- r" H- e' I. I. _
4 a: H" p( O( x6 |+ l# q; T$ R9 h* U* e2 `function CleanHideClass() ! o& ^$ X: h. `, ^) U
{
1 v6 P1 s G' H& R* W9 o5 y 5 _# {$ y7 o1 s) m1 M' A5 M
this.on=function(id,bMZ)
3 P: ~) r/ V1 t2 G5 n2 f) V q {
! ?% l t) {8 x# T! R
8 k) w) b2 q# Z. O" E: l if(id == 0)5 J# S$ X1 D/ I* z* Y
{. T' I* y5 o# G# w4 s' J
var page=/* document.getElementById("content").contentDocument */document; " i. l) U1 e! x4 \, t" k1 _. Z
this.RemoveHide(page,"span");& y8 R, u$ U. U" Z0 J
this.RemoveHide(page,"font");. j" h% v% b/ V$ v# _, k; m
this.RemoveHide(page,"div");
) L' J% t; h6 r2 F p this.RemoveHide(page,"p");
& B V# \5 |0 r, x/ Y 9 s( S" x( O6 U3 C9 k6 [
}
4 o, I% N- o) @ " B# q+ Q* |# C8 R! U
}; `- P l4 C; T
this.getobjstyle=function(node,prop)
% H& P) a/ k5 k. J5 T- G. z5 L! c {
. U2 u! L: v: P7 @ try
- R# i4 v5 T6 c0 c+ w8 ^ r) s" n {
! [" Z) s& }* e) E" m return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);( D/ A8 m: e7 o- o6 R1 I3 g j9 B
}& F( }8 M3 i4 ?/ r, d
catch(e)
_2 c. b9 ]5 _0 M+ B; D {9 o0 T: s0 |6 R# B8 P1 I- y7 `
if(debug)
- B+ C; G# r! T4 U2 F {
5 V7 Q7 z" P) s& P: j8 h alert(e.message);$ H5 p6 f% w, D; h7 B/ V6 P
}, L8 K2 ^4 y1 j
; C. ?& s( e% R* |% K, e return "200";
1 X0 S- G& y6 i8 C1 t% J }
0 n: n& K6 D. ^; Y }* ^! N0 z- R. w
1 @6 y% A, g/ q, n this.RemoveHide=function(page,objname)
5 P& g" p" \0 q; z" A" ]0 _' x! b {
3 S1 ]$ R6 f1 ^% _% N5 @5 | try' {( N7 C, u8 v
{
2 J/ R+ j2 B9 t" S/ A var minValue=15;7 }7 s( O _1 d' w8 y
var objs=page.getElementsByTagName(objname); . T' ]) T" I# W' x" G8 ?& P
& j; p3 P5 ]/ E! v" b# Z3 k
if(objs.length == 0) : @9 ]# }$ L/ k: E) \8 M
{
; \ W e" V. |1 T, F if(debug); a+ G- I! v% c8 L% `0 K
{
4 m# b/ S5 V$ g$ M3 Z2 o7 _ alert("no object found!:"+objname);% a* r" y! m( P+ C
}
# O: \" c3 M9 U/ d$ o; S3 G }
! C& q3 s9 z: a& z4 A else
* H6 u# b, N4 m0 l {
( z+ R- _; H1 Z( H( ]1 E5 ` 5 r; R9 ^7 B; c7 T) o3 o% U( ~7 C
for(var i=objs.length-1;i>=0;i--) 7 [/ f" \) s6 |0 Q( H
{4 _) B- q* ^( p: _' A
var node=objs.item(i);
7 \- `$ c. U! \4 v. c7 {, a & S! D( t, }/ o0 G9 n5 R# u- }% L
5 L9 n0 `1 U1 K( J3 }; w! ^
if(this.getobjstyle(node,"display") == "none" ||
" c9 h4 z8 K0 c+ b+ k& D this.getobjstyle(node,"visibility") =="hidden" ||8 O0 l( `. d0 Z- M8 |6 u
parseInt(this.getobjstyle(node,"font-size")) == 0) . E6 D+ M! R" S- N! V0 p
{* L u' j6 ?8 Z3 {6 b
if(debug)) d5 t3 @4 k: x2 _
{
$ D8 c0 |. R+ {3 a alert("remove invisiable!");
' _$ ]& Z2 U# G) `6 _3 ^3 a }$ [- a8 h% O4 H! F7 q% ^2 Z
node.parentNode.removeChild(node);
( |. E0 r9 S" R+ z " }/ H8 S4 K* B
}
% c" B d0 {! B else
/ U3 f& F0 o+ ]5 N; y) f! x {" h4 Z+ j- {1 Y% C6 n/ g. X x
if(node.parentNode) 2 m+ C( o- m) ^# M* |
{
& X$ u/ `2 R4 R! X var orgNode=node;
8 P# [' b& R( H A5 |* ~. w' F var orgColor=this.getobjstyle(orgNode,"color")6 h4 R, K' M9 E# Z. q$ w
var orgRGB=getRGB(orgColor);
5 E0 x2 h& M& S ! w- F, I x1 `/ u8 p4 c5 o
var parentNode=node.parentNode' }1 S; i+ B c7 l( j7 r4 }
var parentBgColor=this.getobjstyle(parentNode,"background-color");
, r) t+ M, A0 @/ T* J# H & @# @* n% o; c" q' E- K& k
var isLast=false;
' i- U; J6 g; q5 G( w6 S , T Q; J& q L9 P4 j$ w+ _/ D
while(parentBgColor == "transparent")
& @% p0 G5 |, ^5 L {
; A, C3 {' J0 I- g# w& d' }( a + l- ~& x7 h% q* }+ H# n+ ?& H
# I( v: w# I3 @
if(parentNode.parentNode == null)( {" @' P5 `0 o4 l+ |
{
" V0 l( \8 j8 W0 m0 ?1 h9 W isLast=true;/ U' T' `- x7 J
break;. b, Y4 T9 M3 @. g+ }
}
: F, f, i* ?# D- \ parentNode=parentNode.parentNode;4 i' r9 k+ C3 y" A
parentBgColor=this.getobjstyle(parentNode,"background-color");
4 t, e- y" @* m1 b$ P) }" j; x) S v' G) _9 i% E
if(parentBgColor != "transparent") 4 L H7 J' m+ Y
{
% v- R1 m2 F0 B# f4 d9 c, U/ X break;
( I4 d9 |0 ]/ n1 f/ n }; [" U1 v: l+ }# N
}5 w! p+ o/ W' ]; G: J' m
if(isLast) . ?2 r& J! J4 q& t# e6 m6 a* q4 K
{8 Z4 }- {- H- V/ h$ O: f# t
if(debug)
- {& f& ?; Q% u n, J9 T" J {
& F! N9 N- ~ Y. e alert("last!!");
' K& ?/ q, g& i& ?3 w" S }
5 |8 x! D Q" m/ F1 i; s0 u) ] if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
+ J# x" _* ?& v7 U& u {
0 V' v( b$ E8 ] orgNode.parentNode.removeChild(orgNode);
( g6 K+ ^+ u; ^/ D0 }6 @$ x, i- ~! F6 T }
) J) j% h! _1 d% X ?, b }
' T7 v/ |1 ]* ^/ j) \2 q else. j; `/ s6 r$ K, y
{6 e4 l0 l7 A6 g; H5 w% E. |2 n( s# X
if(debug)4 ~4 L# I5 o$ d6 W+ }) G
{) z1 P% S" t, E) T( P- X3 }' o
alert("compare color and parent bgcolor!");
# s" a; G( Z7 B% \! _ }
6 u+ E* S H3 H: c1 x3 f$ K parentBgRGB=getRGB(parentBgColor);& m. o1 N/ i- w
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))) b4 ^/ Y: L. y/ @+ |) i% T
{# P* `+ u2 X# R3 n6 s- d
orgNode.parentNode.removeChild(orgNode);
/ B( ~) V7 T& R5 b, v }
3 V% ^4 `. N& a; `5 [5 c }8 h, [6 n/ N9 V- ]- e. }8 B" |
}
- `0 C3 E9 ^" E9 M- A- B }
9 [# I3 w7 A$ ]; e }- ^8 v2 M$ J# ?! R
}% f. o9 m) Y) Q" y. J
% s7 h6 \3 b' I5 }5 ~6 | u
3 X" E: a( y5 t/ B1 }& o/ d
var itemFrames = page.getElementsByTagName("frame");8 N: H! ~) \% O) R6 M' p
var itemiFrames = page.getElementsByTagName("iframe");
. w5 v6 a- L- Y4 q1 M; U - o- Y: I" j8 Z( O) m9 A, R
var frame, iframe;! j, r6 a; p y* f2 G- v1 D4 s
if (itemFrames.length > 0) z& w- d! h" |" ]8 Z$ G* R+ A
{
# R7 \9 s; q1 W" D; B S3 N for (var i = 0 ; i< itemFrames.length ; i++) % x* m5 O. ^9 s2 D- t$ m% J- F( H6 i
{
( m1 R2 x# M# ?$ Y% i frame = itemFrames.contentDocument;/ ]* R( d% M' k. ?9 K" `8 y, E
this.RemoveHide(frame,objname); " @* w! q2 z, H/ b
}
% [; a2 I+ I' m! l" ~& j8 f }& o" S. H' s; s0 [
if (itemiFrames.length > 0)
4 p. y9 l" P; h }: E) t {2 C: u+ L8 u( O
for (var i = 0 ; i < itemiFrames.length ; i++) + n" h: q) c0 {1 h; T4 Y& C$ w" e7 x
{
( `: y: i: W: q: @' Z0 J iframe = itemiFrames.contentDocument;. r4 l1 N" }4 n' L# x6 F/ h
this.RemoveHide(iframe,objname);
+ G' {, G5 V/ ]3 k. l4 m9 r- J }- d6 n2 s' T: x4 `
}0 K! k9 y" V; U5 D7 E' {
}
* L4 T" C; c& m, R catch(e); r2 ]0 _# U8 |- y. o
{
( \* U3 R7 [ S+ }0 [& F- N if(debug); J2 N$ G1 L' h% n; l5 q' u' a
{
! H) a. |7 e6 ?( C+ s6 G0 ]$ s alert(e.message);& Z; V G v7 N
}4 t- E+ U8 [, H
}
# O# o' N d% y" ~$ N5 K }
$ H7 ?" h; b% T2 h1 x7 W
* M; u0 D; N8 c$ v# v' ?) y2 a}1 k2 E+ u' \6 t' O4 J1 s
, l9 Q. g b1 s( K1 [) `function getRGB(colorString)
0 {, o! o4 @: i, @{, c g8 H2 e# q: R- S- l( w5 X
var RGB = new Array;
z9 B5 {; @+ z) R: J. {) ]4 u var tempSting=colorString.substring(4,colorString.length-1);# ?9 @. u; S6 B9 L' j
var tempArray=tempSting.split(","); K8 x; m+ H4 l) F; f5 T' ^, O$ w
/ @4 `4 c8 ?* {: v+ {' h
RGB[0]=parseInt(tempArray[0]);' B" I( N! o' \, o, A' {
RGB[1]=parseInt(tempArray[1]);' c# y5 h0 }" y2 s2 {
RGB[2]=parseInt(tempArray[2]);5 f% c$ I& Q+ G3 r q
1 v) Z6 f3 y; [# P S1 a. `% { return RGB;, b1 w" ^5 s d( f! s
}0 d( N4 W: k. ~
function keys(evt)
; b! Z0 @; v/ k: e7 n {
. c! l! S- ?0 U* R+ I if(evt.ctrlKey && evt.keyCode=="81") ; I7 [" ~. q1 L
{
6 T; D0 T# ^# y) H0 T2 b# b; p CleanHideObj.on(0,1);
H# [( m- F) P. x& t; u alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
6 x( u: _9 M+ {1 r
; D# @! w; w+ q }
/ x4 n) }' Z: \; d }
5 Q3 i: j; ?( F' e- Ndocument.addEventListener('keydown', keys, false);
- o, m" f, o( D0 J& y9 JGM_registerMenuCommand ('Clean Hide',
# l! H) {! ]5 i1 _. cfunction(e){, ]9 B6 u5 u2 g f- I/ }4 U
CleanHideObj.on(0,1); O9 {& t; A$ l
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
" C. m8 |$ W1 X, s, y});0 U5 P) @7 t9 h% f# p0 \- e9 d* A
|
评分
-
查看全部评分
|