|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
* F) z/ J( M% D' F4 [( [1 H/ n" ^- k0 n8 }0 |
火狐插件,用猴子
5 d0 ?' c7 E1 u- w0 d7 N4 N9 l( s( t" A/ a5 R
var debug=false; " k! c. L; T, n2 B
var CleanHideObj=new CleanHideClass();
7 X1 g2 M0 y( V j2 g& _/ B! v' U) A* y/ o1 z2 U7 n* L
function CleanHideClass() 9 R" P, M4 x" S- C! \; {
{ 7 x' k% l" o# N! ]0 G
* ^7 H2 h) B6 j; H: _& d
this.on=function(id,bMZ)
/ f; _9 Y# }. e {) ^0 }% S) g' T6 i! U, y) T, }4 K: ]
/ |5 l/ t% k: d0 |& n9 V- d if(id == 0) M4 F/ ?' m. e* |/ {/ L6 s
{' w1 |# W6 Q1 c- D
var page=/* document.getElementById("content").contentDocument */document; 3 \8 v" L! S0 O3 b! [# I
this.RemoveHide(page,"span");
8 Y' X, k$ f$ Y0 P. S+ ~4 E# w this.RemoveHide(page,"font");
, f" B- Y$ L5 W: G! n% v this.RemoveHide(page,"div");: r0 }% Q& D0 \
this.RemoveHide(page,"p");4 T' j/ o6 ^2 {
7 _3 V m8 [+ ] }, o0 F: t8 N2 B3 I% {
5 P" [$ G$ B4 Q6 w5 d4 Z }
" x, L* |; x' q) e3 v" e2 i! R this.getobjstyle=function(node,prop)$ R( q" j# E- \& l$ T5 \% K# G
{
# S/ I3 M7 m, C0 Q: _ try
6 _" u9 T s! r6 H {
) L0 h- I+ y, @1 ?. V% j7 q/ S3 s: D return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop); p, O* r6 U' l
}
' [" w0 z1 K9 S1 @: P: Z2 y catch(e)* l7 g: e6 M( {1 p3 o
{
6 ~% c; k2 l a% O9 \# X if(debug)
5 [ a: \: m4 M5 {/ o2 T {8 M" S$ L( W' W( @3 |9 b
alert(e.message);+ V" Q5 p5 V6 j
}1 ]3 ^ K5 r- f) ?/ A
& q8 N; V9 `9 l8 E
return "200";
?% Y0 v+ `* J; w6 s }$ a( m9 `* A: a( x* B- y
}( {# L$ j, n( w" A: x
- U3 D, j! |5 r" V; V this.RemoveHide=function(page,objname)
( f/ f, u6 x& t* g; j( o+ j {
8 [" M" G. Q; s; o8 b6 `, o; G try
e' E' u, U$ i0 @+ n/ N4 x {; S+ N) q% S! q, m7 e. k
var minValue=15;' s1 G! e T% L6 H2 m
var objs=page.getElementsByTagName(objname); ! n! O( } I. j: Z
/ S8 ^& r/ y# b% y* G
if(objs.length == 0)
3 y+ X% {, b0 |& |( o, q$ e- [; f {- Z0 A, _. `; q; P# f3 [
if(debug)
9 E* S' S) x+ k& G" n- V9 V% e {
) F. M/ N5 l0 Y$ s alert("no object found!:"+objname);
! H5 ?6 b9 I. X( v( K }
% _! w! R7 R6 C( E* y! l }' o$ p: a" d2 l; U. w
else
: W1 G$ ?/ j/ d2 | o2 m {/ h1 d2 g4 U( q3 m
+ l! r7 o; z' R( K& C$ k for(var i=objs.length-1;i>=0;i--) ' D' ]0 `* e& s
{4 \0 `& w( U3 g4 Z2 H
var node=objs.item(i);
: j# Q) l- M* n, w( l9 R
; D3 L7 s5 @& F* j: @/ x q, ?
- S" e# I8 H8 k$ `1 U+ z# H9 n if(this.getobjstyle(node,"display") == "none" ||! N2 m" d8 m$ ?, J: N/ f0 P# E
this.getobjstyle(node,"visibility") =="hidden" ||9 z" T( {- I* D# a6 r/ C
parseInt(this.getobjstyle(node,"font-size")) == 0) - O4 ~. f I' k$ ^1 U5 e
{
* Y( Q" U' H# U" b& ^5 B if(debug)
, T( O5 U0 u$ ^! }( q8 q {
1 v4 l* n% }8 p' z$ p alert("remove invisiable!");! x8 D. Z; N1 o
}
& I/ z' p4 S# u/ h node.parentNode.removeChild(node);1 P3 G. g* ]2 u+ s- ~
3 l! o( l% y8 C# b+ x }9 Y5 u# o8 ~+ N& ?2 M5 [/ M4 O9 R% l
else : h( o* }+ y4 ]1 x7 P3 M2 q+ E
{+ S! z9 o( k+ Q) R$ p, L5 `% I
if(node.parentNode)
9 o! N- d* X) b J {
) }+ M( A( ?7 |% c% o var orgNode=node;. _: A8 h7 y/ V+ |
var orgColor=this.getobjstyle(orgNode,"color")4 J; A6 W# W* _4 {/ G5 t) b
var orgRGB=getRGB(orgColor);
: l" S7 D9 N9 u: N2 w
5 u/ W# s+ C" ~" d var parentNode=node.parentNode
; ]% ]5 q, M7 E8 U var parentBgColor=this.getobjstyle(parentNode,"background-color");
- w2 x% p( O9 d( M
3 D8 ?3 Z; }; i- Z# Q' m var isLast=false;$ u# ~ W, Z' U3 ?6 f
% f/ Q; f q2 O' k3 N% X5 G; c1 J
while(parentBgColor == "transparent")
* d x4 V' P! _+ z {
, U% b3 B+ V9 q L, n: ? 5 Q$ h5 {7 B+ B3 y: F8 Q9 _
0 G. R- R- K) n% V% z! H; J
if(parentNode.parentNode == null)4 U$ l+ M: r( }9 J V
{
' V, ~( c3 C/ f* Z M2 v4 L0 V isLast=true;
, g T7 p Z1 S- {- n) w& C+ ^ break;" s4 F3 l0 U0 w& b8 L' H/ g4 A7 u
}
, b3 H* @ ^( T; ~ parentNode=parentNode.parentNode;8 U" d) l) g k5 h1 c' o T
parentBgColor=this.getobjstyle(parentNode,"background-color");
! Y) R( w2 n/ q. O
: j9 X9 ?6 r. V6 \* T- T& F if(parentBgColor != "transparent")
% s1 q, O9 ^5 ` {+ ?! p+ F6 o7 h/ B: M2 J3 u" ~
break;
4 Z2 X1 w- U1 ]( Z }$ X' j/ Z. ~. {; `& n' u4 J) f1 ~
}
# K* T* Q4 m5 F% F" H9 B$ \ if(isLast) & \- T: Q. \! K: ~2 ?9 p
{( i5 ?& K. F& ?
if(debug)
1 F/ Y( l( p4 K, z: [. U2 {1 u5 ] {
" r- S* P4 _1 |3 T R# } alert("last!!");2 J! L6 n, f C4 M% E4 s
}0 w! r1 E8 T. e& V1 {& o. T+ q) ~ {
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))) H5 f2 Q3 b4 ~2 g
{
2 d. I& `: Y; G- L0 }; h$ k4 u orgNode.parentNode.removeChild(orgNode);
$ `- ^' q$ P* Q8 O }+ D6 X0 z a; A
}
! O4 b5 ~! f* P* S# I2 ?5 Z' H else2 J8 r( l6 K) x% Q# G& e
{
5 v% w+ o8 H/ x9 c if(debug), L3 z3 i6 l" l+ n4 ^( } s/ m, X" g! z
{! \3 O% Z* O. E3 g4 R! O: E
alert("compare color and parent bgcolor!");
8 I) }- ~5 m& u8 g+ } }
- h" A* i! F/ `* K. s2 ] parentBgRGB=getRGB(parentBgColor);, s& f* }5 E/ W7 H- D
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))" L+ q1 ~* k/ m# g
{7 H7 Z/ P1 K4 t# L9 m f; t
orgNode.parentNode.removeChild(orgNode); " h: N7 t' s# {2 g- ^" H- D
}
% ]7 Q% Y' y4 ~ }+ J+ }' U4 T; C9 j5 A* W
}1 x& k+ k8 s j
}
$ k/ W5 X" J! [' P }8 P7 J* \6 P# J; d" ^) c" }
}
# A2 ~/ u n. F
2 W$ b, Z9 j6 C$ P% j4 b0 y : _: A$ M2 V+ {, S# Z
var itemFrames = page.getElementsByTagName("frame");
; p$ ~ q; A+ Z0 K& x; { var itemiFrames = page.getElementsByTagName("iframe");
7 M0 a. s8 \' }$ z
' C8 G U& z. j/ f+ ? var frame, iframe;
w& w0 W- L3 H( S- i* H0 D if (itemFrames.length > 0)
3 w+ w0 ~1 P; e: Y& [ {
% m6 J$ Z6 |4 I7 s, j& i for (var i = 0 ; i< itemFrames.length ; i++)
& N0 G' o1 V1 @; F# D; O {
; Q/ X6 a- x" V! S) p8 P7 P0 \ frame = itemFrames.contentDocument;+ b% F0 f1 [4 ~3 o8 J
this.RemoveHide(frame,objname);
! U! `' Y) b/ v. Q: ^3 O* f }9 b# s% W4 R: A/ k6 t
}
9 a3 X* W% g$ T1 F! F if (itemiFrames.length > 0)1 o/ i. M5 A) U9 X
{
# W2 _& ~) r8 ~4 a for (var i = 0 ; i < itemiFrames.length ; i++) + `; f) a9 n! k; K
{" v9 t1 y% Y% b- T0 }0 k" R9 U
iframe = itemiFrames.contentDocument;" N. M7 [ x2 Y6 X+ E' F/ K! Q
this.RemoveHide(iframe,objname); + {" _! A4 n" h5 x0 Y
}% I4 }9 r4 C9 x* n( n
}
! t6 d/ t s6 h- c$ l2 q4 T) R }7 Y- e: ?, d% t/ d- W6 U
catch(e)' o7 D9 r' z" |- [6 ^
{
9 z$ r \' {9 N& O y if(debug)5 W; ~; t5 O( F( j
{
8 f. q5 g( q+ `* C6 e0 C alert(e.message); h( D2 m K9 K) y; D* ^' e
}/ p5 g7 [$ ?% a9 K6 P H4 {2 o
}( {6 S* ?. s$ I) b5 H" p8 i- M. {
}2 @5 I" _2 N% `: L' p+ P A1 M
; c; H/ q8 N% O1 F0 F: E' ^}
) R9 V. ^! k- U. s5 K
" V. H# g$ D# V8 h9 c2 {% ufunction getRGB(colorString), D# }8 e. l6 D6 y% W0 `9 }
{; P, r. @3 ?' i8 x3 m, h
var RGB = new Array;
. Z5 n% G+ i# e, i1 L! E3 I4 P var tempSting=colorString.substring(4,colorString.length-1);
8 s1 S, y* y1 U( u var tempArray=tempSting.split(",");: C$ V4 E6 ?8 e7 ]( B
, _% |* W$ w. k# G6 ?: X, k: o! h
RGB[0]=parseInt(tempArray[0]);
8 |- z4 {/ ?- J$ G7 M; ? RGB[1]=parseInt(tempArray[1]);
. {. @8 g' `! m1 P1 {7 \$ _ RGB[2]=parseInt(tempArray[2]);
) x, q7 m8 Q0 o$ C
' W) h" \/ z4 z) X return RGB;
' n$ _; O( ?- ]' ] ^4 t; n}
; U% U' Z7 B* U- r* xfunction keys(evt)
, }7 [ A6 J5 W" }# _ {
; L0 L- @4 P3 |$ S$ P5 E, y if(evt.ctrlKey && evt.keyCode=="81")
) ~' ^$ a6 m3 H. i1 ^) u' M/ Q {
: n* t, S J: J! x/ V$ u) Z- {/ ] CleanHideObj.on(0,1);' E! S4 Q' E' q# v5 _( J/ @7 u1 b; `
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); ( ^. ]9 T# }$ ?2 \# N: {9 d
9 m5 ]6 X0 E i5 Y5 s% }. t! |
}
6 P4 _/ K, L; U* o }
! C0 B' W3 v. m+ Pdocument.addEventListener('keydown', keys, false);
a- d* y$ Z/ m1 }& FGM_registerMenuCommand ('Clean Hide',
' k. F, h/ W/ f) F# Zfunction(e){' o' y7 B I( B# u/ w. c4 y4 _
CleanHideObj.on(0,1)
# a. R1 A$ J( V5 \5 E4 C) Calert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
8 T, l, s( C3 G8 [ w+ X& X) }});+ {6 `) }/ a: q' @& S, f# o% d
|
评分
-
查看全部评分
|