|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 5 P% \: r% p: w# R/ h
- d* {' S* `0 F火狐插件,用猴子
! D" L& H3 B E$ V- m
' k& @ G O b4 Yvar debug=false; 4 a5 T; N& I% J i: \
var CleanHideObj=new CleanHideClass();, A& X \) f0 y$ d. S
0 ^8 Q) j$ h- ] W
function CleanHideClass() 2 F2 M" z6 S( N" u
{ " }) ] U4 O$ l, x) H, y$ \
& Y5 O# M M1 A6 ~$ ?- C3 m; k4 c0 C$ S
this.on=function(id,bMZ)
! |0 j5 ^/ o8 g7 A, P: F {
. I( x& l% }* Y' O
! s- ^; P5 q1 c- ^, P/ X if(id == 0)
* I' e; D& e; W F; }- a- R' X {( e2 p: O. z* d# X/ `3 d, P5 a
var page=/* document.getElementById("content").contentDocument */document; # x& `: ?# W. r( a' F
this.RemoveHide(page,"span");& w$ g6 z) z! z8 T6 t7 L5 y
this.RemoveHide(page,"font");
/ X9 }2 j4 C- Y* M this.RemoveHide(page,"div");
) a/ U# u+ |, K j; v this.RemoveHide(page,"p");( [5 O# A5 D% C6 t
( W' @& C/ r1 j }
. \: p; a" w! t, Z
5 O# A( N. ?0 c4 x* k2 ^! t% D6 f }4 ?0 t8 w( J/ U0 `+ [8 J
this.getobjstyle=function(node,prop)$ M! y* S% D8 A$ y
{% R- ]. B; v& N7 g' q/ Z" v# e& n
try
* c; O# G# B* ?1 F0 w. A/ M {% f/ I. [9 T3 X- W# p2 U" D
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
; ^5 a' `* [( x }! t G# _, w# Z f
catch(e)
7 W# L) u) K2 L0 X' f {
7 g( n( Z; P2 |0 B. H if(debug)
( a# T9 _% K) G0 Z6 l% S7 o {
]1 \7 Q) r6 j' ? alert(e.message);
5 Y- g# ?2 P' i( z, z }
! ]3 i$ f+ n) a }% z5 B r3 \ 1 I, p4 g* `3 x
return "200";- b7 y, s' f* k3 i7 W- ~
}& D/ Z3 t1 U) X8 U' @
}
5 E% L \$ s1 {9 `: x% S $ p2 s5 W* _3 z8 ]1 @* Y1 H8 M2 Y
this.RemoveHide=function(page,objname)
$ k; P0 y, f& I {% [! p5 e- s. J1 U1 S# @; y
try; ]+ |5 g' U) k' I
{
, m. c7 L, U3 S( J8 E var minValue=15;' ^$ E* T6 V' n4 x
var objs=page.getElementsByTagName(objname); ) i4 z& q( [# s7 ~: V0 V$ ]5 U
& @' C7 N4 t2 \/ v9 Z5 s) @ if(objs.length == 0)
5 T1 n& |5 i; W {5 Z* [3 \, W$ X5 g) [' d
if(debug)3 Y2 ?% y A9 F' j9 p, \7 o
{
; H3 q7 P& A+ t6 r0 w' b3 e n alert("no object found!:"+objname);
6 G( ]! [: _" ] }3 ]9 V. p9 n0 K4 \ z8 P& T
}
6 p; z- @ |9 @( j; y; i else
* s0 ?4 f: @0 @/ w+ Y( ~8 c {
$ o8 ~( y6 G& L- h" d( f. c3 r$ M
( o9 H# ?* q6 B for(var i=objs.length-1;i>=0;i--)
9 ~( W5 U: p( w# J* o {
( e) q. F2 K* ^7 o* U$ r+ W; Z var node=objs.item(i); , g- e i) @: [7 \: @5 p
% L3 v( y( `) s) D/ r7 X
# ]8 N S) k z8 I' c5 n if(this.getobjstyle(node,"display") == "none" ||* t' e9 r4 O" m& k ^) Q
this.getobjstyle(node,"visibility") =="hidden" ||+ g: l6 `1 |# H" n0 y6 V1 W1 D: T. e- U
parseInt(this.getobjstyle(node,"font-size")) == 0) & v; W% x. ~" c. {6 n9 K7 j. [: L0 i
{! l! B# ^0 p4 X( N+ g4 F
if(debug)2 ^: w) V: | i/ ?, m+ s
{
( K4 B3 ], l3 q) m alert("remove invisiable!");
" {- D2 \, }3 {3 y- S }4 X- x' u$ U' Z/ }2 z
node.parentNode.removeChild(node);
- }3 p8 S8 w- K* d0 w 0 \+ F% J, @6 H) N8 a
}& E8 {1 Z( l3 l; {' C5 X
else
3 [6 [: B1 V1 D- X3 G% M; Y8 z3 ^ {. |0 r, p Y0 u, c1 ]6 T) `
if(node.parentNode)
7 |- X. E W* _1 |7 F: X! Y3 k( e {5 w' B9 o% V8 y' S! d' C
var orgNode=node;
5 m" n0 Q7 F) i6 Z var orgColor=this.getobjstyle(orgNode,"color")
5 ^2 K. H4 a$ D* E9 S. D var orgRGB=getRGB(orgColor); / G( |7 \; v) A' Z5 r5 T
! X. P1 J, d8 L4 e+ W
var parentNode=node.parentNode
% N- n. ]: g; @3 y" K5 B6 _ var parentBgColor=this.getobjstyle(parentNode,"background-color");
" D( k+ r& i0 q+ C: ?+ X
; O6 y' ^2 h* A; I var isLast=false;* C4 F1 z# I8 J( I S
; |" [0 D( j$ a7 r while(parentBgColor == "transparent") ' u$ u; s9 }) J. U$ y
{, D! L6 [/ L3 u2 |, N, z/ m
! Y- _, d: @5 F% Q# u7 S
4 c7 J V; |7 \4 H o
if(parentNode.parentNode == null)
3 {9 a6 | J2 Z {
, d v V% L: Y$ o isLast=true;
% p2 o( y0 q1 Y& b; c- w break;
s2 P* Z+ m/ ]. ] }
3 A+ {; H5 }* d" |: v1 U: R3 M. r+ m parentNode=parentNode.parentNode;
: H0 d: T9 u8 s4 E% o parentBgColor=this.getobjstyle(parentNode,"background-color");
8 l! j6 \. S- Y
7 J& Q g: `! P if(parentBgColor != "transparent") # R1 K( ?: q! o' O4 X5 X
{
& d, _! B' p9 _, j& c6 ] break;
5 u+ G- V, X1 O, d/ m& U }
( n: J2 p+ E' K a: \" z* o, @ }3 I% \, D. [# E
if(isLast) ! M6 y t( Z6 O! X
{
2 g; a- k' a) i' H) k5 W if(debug)8 g. R- M2 n+ @8 \
{! b' _% K2 c; N
alert("last!!");
2 F" V/ f5 E2 D( z+ z; V }
3 e% m# `' P8 C if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
% H% b' e6 y, c1 {5 E! O9 A4 C* L {
0 \- u% F$ \" w* n orgNode.parentNode.removeChild(orgNode); - A) C+ p% r0 \8 I
}' U X( U9 i J8 O- q
}
) X3 g, u- y* H3 ? else$ E- h7 v7 l' O5 ~
{; j9 k+ {5 f% o' x3 b% ]
if(debug)
+ `4 _3 c. r5 k# M4 j# G {( p# U9 a! n- T9 C8 n* b
alert("compare color and parent bgcolor!");: G8 \/ r e7 ^- Q, Z
}/ m9 X3 v8 {; K' p6 S1 { l
parentBgRGB=getRGB(parentBgColor);2 W% _' t f% w6 V
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))) T" f1 I' p h8 ]& j# J
{
0 }3 m( |. O: u% Q. j# s' U orgNode.parentNode.removeChild(orgNode); ) Z- g4 s6 s/ p$ }0 m
}; |7 t4 f2 \ z M6 O: ^
}
, ]1 n! |- [; a2 F- v: T9 X4 \ |$ ^0 u }2 m% N' u7 [. M5 o) U( a/ D4 @
}6 H& Q9 u6 m% b5 x* ~
}/ e6 t1 u8 \* F* ~6 o G% ^
}
! \) E) N) z& l* I0 d$ V
* O& f; b p& o( \
+ s; |3 ?6 G5 r! F var itemFrames = page.getElementsByTagName("frame");$ u5 y& |5 E/ D* v C: M8 `
var itemiFrames = page.getElementsByTagName("iframe");0 D' v. }) E1 L3 K3 L, x
% [$ @5 y8 I" @& A' c { var frame, iframe;& C- [- C# i! w5 ]5 }
if (itemFrames.length > 0)% r' @) R& \1 t
{& Q& T! B: c$ O, L) O+ d o
for (var i = 0 ; i< itemFrames.length ; i++) 5 U( c* ?; E$ d" P
{! j5 C8 i3 o7 v. H+ Q8 M! T! H! F) @
frame = itemFrames.contentDocument;$ s# Y5 i# }$ {! J
this.RemoveHide(frame,objname);
$ y! g# n1 v, m6 z# V }; N; s& X) c! m4 V' Z
}! Y$ F( w- \1 P8 H+ d- m
if (itemiFrames.length > 0)* b3 g( U5 q5 A9 |; g' E& G/ v
{
9 M4 z; S6 _0 R4 o9 ` for (var i = 0 ; i < itemiFrames.length ; i++) , U$ D, B6 k: _; ^* d
{4 A, p& G8 q+ K- S
iframe = itemiFrames.contentDocument;
2 l v$ E4 y" R+ [ this.RemoveHide(iframe,objname); 4 a/ O% x) D9 J
}
7 ^2 O4 m, M# B/ I, t7 S" A: V }
0 f. i( N4 l# l* x* Z5 p }% | D& C0 m$ [4 S
catch(e)
. t% k2 s. k' F" J {/ q0 N$ N$ q" z8 j- X t3 K9 }! K
if(debug)+ K |4 C! P. q7 [ s& o$ H7 t4 H
{
1 y* }& N/ ^$ ]" R, f: J4 g n alert(e.message);
# D5 x' i" k0 A0 G8 J }
" {1 v3 k# U5 x6 T2 L. Q }
1 o0 c% s; ]2 _, n# F }
% {$ L, {6 Y6 L# m) Q- _+ @$ x " t7 q* W/ Z4 w- w4 c
}. ?- a) }& ^; @+ k! _* G
+ ], W, O2 `! A0 O; {5 m1 d
function getRGB(colorString)
( w+ b$ s9 s5 d2 X{
% r P+ U/ W* V* |( W. M var RGB = new Array; N' A" i8 B/ I+ u0 e
var tempSting=colorString.substring(4,colorString.length-1);
7 c& f$ r* [! X+ j var tempArray=tempSting.split(",");
4 \. `% q7 [, r- e$ j' I9 n. S" `5 e! n0 D' `1 u9 h8 H7 K& U
RGB[0]=parseInt(tempArray[0]);
( w4 J, U) J a# z RGB[1]=parseInt(tempArray[1]);3 P* F4 x: p$ B; A' }3 ~' I
RGB[2]=parseInt(tempArray[2]);1 T+ V$ `9 ~% v7 T, k
6 m$ g) y0 g$ u: W3 ] return RGB;
! a$ E7 E% v8 n N}6 @9 M" m" G& u2 c" H! Z3 C- v( e
function keys(evt) , P5 [% M6 b; |7 ~& g, M1 x& V' H
{
% @0 V* b4 T1 c if(evt.ctrlKey && evt.keyCode=="81") 6 p9 [+ x) _& A" A. z
{
* ^, {0 G: H- g: L CleanHideObj.on(0,1);- N! p$ a2 v0 v- _8 }
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); + z2 J. i. J! P7 }( q- T; D: G
2 i( i8 z6 t! U( U( L, r
}
! \# V" ^$ f( U: y+ {+ z# w: c }
8 M' t# ]' y1 K( b& z7 l" s1 fdocument.addEventListener('keydown', keys, false);
3 K) X3 ~9 l( d: Q9 C3 mGM_registerMenuCommand ('Clean Hide',
+ T$ f6 ?3 E# Q4 n6 V4 Rfunction(e){
% B& V; I `+ W. B6 k/ eCleanHideObj.on(0,1)
5 e9 h/ a8 r0 z, m. l% Galert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");8 w, M) e& c3 z4 q
});
5 a# |& k4 U/ B; n |
评分
-
查看全部评分
|