|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
: i+ e7 A7 X' k( m) M1 [# `# R: C" i3 ~* x& Y) w
火狐插件,用猴子
. ]* o& Y; O2 B$ P5 `9 M! j( J' u1 M
var debug=false;
# X6 I; r1 {1 f, u. w9 Svar CleanHideObj=new CleanHideClass();1 I6 f4 B" Y/ D F4 V4 z3 F
- d3 w. A! {" T& k/ I |5 m
function CleanHideClass()
/ N( y/ c. Y% _2 A. r% }: x{
+ P$ p1 d! O( B$ L/ N* D7 T
3 W$ ~7 G3 j% h8 P6 P3 t) I this.on=function(id,bMZ), j2 w4 B, B9 S5 j% p# I+ B, x
{% D! j* f& J8 k3 P3 a' N6 y0 b
9 ?, _/ F# L( Z8 L
if(id == 0)
3 M* n' @& I( E1 v' {5 {" G {! P9 R1 g+ s) N# z5 j. |
var page=/* document.getElementById("content").contentDocument */document;
h, o. i0 p6 D" |- x3 }* t this.RemoveHide(page,"span");, w( j* X2 o6 b8 K( M3 c
this.RemoveHide(page,"font");
: \$ ^; q S, |* X- N" s, |9 p this.RemoveHide(page,"div");
& L! L' C+ k3 P' b" B! g' `7 o this.RemoveHide(page,"p");
6 g1 V' C i- Q( q% k2 u4 P
9 c8 f/ s1 X) r1 a }
2 ], ?. ?4 Q9 B$ S( S
) w3 h4 `( M# T }
7 t% q1 c% a8 U3 V this.getobjstyle=function(node,prop)) `: s# `6 t5 c i
{$ p d" u" n3 g4 f/ R' ]! Q' r! k' A
try
7 B9 I# M8 w* L2 z7 ? {
% G. r5 m, o8 F- u% x) { return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
, j& \! b1 `2 Y. y }
- ?+ W' ]8 D) u3 F+ z5 X' o catch(e)
4 D% r; M" M- b G9 G( Q) I {
+ q+ B8 X1 i+ x/ O2 C# d7 r if(debug)5 o+ v5 D+ B% n
{
} L6 a$ V2 R! o& K alert(e.message);# a+ H Q( ^. J# X9 X$ v
}% Z2 `% c" d. W
+ y0 y0 z2 K Q1 e return "200";
! O+ D" E! v6 ^9 ` } J( a* O. y& }) e
}5 {/ H7 ^7 _' g D
, m9 k; n. J/ {% h: ^! |2 P
this.RemoveHide=function(page,objname)# L) K: v3 @* l* S& B& h( q% n
{" ]# G5 Y/ `8 w) w
try+ ?* p$ H6 Y+ j$ z* M
{
' H# t$ e8 z1 z- X1 o) [ var minValue=15;# Z9 p. j) ? M
var objs=page.getElementsByTagName(objname); 1 q/ X& K. f4 Z! l, L6 }
) k$ D8 L1 l6 l) ^; u1 S if(objs.length == 0) ) J. |3 L/ ~" @
{
: K" E) [* }: r# R0 X if(debug)+ V4 [2 r8 ~8 q- a) U3 p$ Q
{
/ N# I! `" x8 z X" ? alert("no object found!:"+objname);
; `8 L* S$ H1 A8 [; c' i# }8 V }- P* W/ j+ E j, l. f6 W
} R3 _' D/ V2 V% ^ P
else
8 r/ |: x% n* f; J+ I5 Y/ O {
( m, ~" k" T4 w$ T/ K
# ?6 W% K. O$ j: Y5 _" r) L for(var i=objs.length-1;i>=0;i--)
& s6 ^5 x/ X7 Z/ H( @ {
; E+ k& g; S* j+ u* _; E6 H& E3 x2 _ var node=objs.item(i);
" f( r" p {4 x5 X5 v3 e, }. U8 L ) V' k8 F1 d$ c7 y! T1 V2 C! l4 q
. @: {! A+ x- \ if(this.getobjstyle(node,"display") == "none" ||
2 f. \6 \+ l1 e7 D4 _0 p* b this.getobjstyle(node,"visibility") =="hidden" ||
: X3 A- h8 V5 U* U8 S# }# n8 d6 ^ parseInt(this.getobjstyle(node,"font-size")) == 0) % R4 U; Q) u6 S: M+ {0 [7 k* Y6 a
{
3 {6 J. u6 D/ |$ |$ F8 B5 `5 o( U if(debug)4 p' [! _, o3 D& P& N; U
{
" V4 P% h0 B# n9 t alert("remove invisiable!");
2 E! k0 j; G; U% Y4 S }9 s6 R" t+ T# U# d$ D7 o
node.parentNode.removeChild(node);( k1 C2 Z& Y0 X: o
?. @' h1 l0 N2 v" w0 Q' W
}
9 ~" i. a# i6 M3 V1 ^9 T9 M else
6 c+ H( {/ z" ~ {4 a/ N2 f. g, M; v
if(node.parentNode)
! j: } [/ w% _$ q$ A/ p) K {
. ], V4 q- i. X; X! F3 i var orgNode=node;
$ L9 ? A( _" p3 z# w0 `" y var orgColor=this.getobjstyle(orgNode,"color")3 F, V; O' e, {
var orgRGB=getRGB(orgColor); 0 ~1 l+ _* a5 H T
( Q0 K& G( U3 m- P% _
var parentNode=node.parentNode
% S1 Y" v, K J0 P0 u5 [+ p, i var parentBgColor=this.getobjstyle(parentNode,"background-color");
* V% w: r+ K" o$ f" y. S . K0 s; E7 V/ p9 _; m& V3 W
var isLast=false;
& v( X) Q' \* K5 i3 Y3 B- {: H R 9 A: }) |3 g, ], L8 b
while(parentBgColor == "transparent") 5 J: T+ V8 G! o
{
_0 ?7 ]( c6 n* a5 ]. t$ a8 _$ X
2 `& e* z B! a, @ ; i+ T$ _& v6 r) V# a
if(parentNode.parentNode == null)1 X$ K- O* @: W% l2 D1 `
{7 O. I5 M |8 v/ O0 Z
isLast=true;- F$ q) ]0 p: f+ X( [/ g3 ~
break;5 \; z9 x" ?* V: q
}$ A1 [: F0 v$ V/ B8 \6 X. e. P, t& b- f. A
parentNode=parentNode.parentNode;! a# i2 v) h2 l( y: A0 C
parentBgColor=this.getobjstyle(parentNode,"background-color");! Q; U% K; W: H
3 ~/ ^* S. b) [* C8 G \1 H0 D if(parentBgColor != "transparent")
2 H! A: o+ _) ~ n0 X% H {
" y# {9 Q% }$ N. n/ ~5 x3 H0 v5 o9 h break;
3 V5 ~8 L$ y& e. b7 _) e }
' D% f9 `: g- w+ w: v* S# j& S }/ p% K4 K$ X+ o+ m! O' H
if(isLast) , }/ W6 g% O5 d! `' P8 _
{. I/ L3 j. H; d% I7 n* Z- C
if(debug)
9 X' ~, Z, G- b {& N8 B9 u* i0 w. O
alert("last!!");3 Y& C% o9 r6 `# Z
}
! f2 {. U3 g+ M" ~5 c" p. U if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
0 n6 {$ T: q! x/ i {" n; h8 l+ b5 t
orgNode.parentNode.removeChild(orgNode); " l. H; S ` l, P; W6 h0 S. z
}
! O+ S' u: @+ k7 ?' r7 G }
/ e* M: x& l$ q else1 B; L1 s" G+ d# K, s* {0 k/ z5 B
{) e6 y( z: z& [: T/ w; c6 A/ A
if(debug)# L K/ g' M1 u, S: R
{% F& |! ~3 E1 Y) K+ t9 p
alert("compare color and parent bgcolor!");% ?5 w& |. b3 m& w
}
( B; M. y; t4 { parentBgRGB=getRGB(parentBgColor);
0 \2 v* Z: p' }# ~ if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
# C0 d$ U* {. g% b {& w, X/ W; g. C9 p
orgNode.parentNode.removeChild(orgNode); ! {( e* k; }8 J
}9 k% g9 O X; S3 C, o
}
" Y5 @8 `. r: c1 z9 S }. F, m [7 t$ w& [9 H# y
}
+ p5 g" K# Q# o) A* f }
4 c: Y7 Y; L/ t+ u- Q3 ?. E1 z }
( l2 r9 b2 w1 C* O
5 {8 K+ t! @6 F+ |3 u+ c ( a: g B& V+ ~9 i/ N
var itemFrames = page.getElementsByTagName("frame");6 X/ `$ G6 m- L: M
var itemiFrames = page.getElementsByTagName("iframe");
% G0 J1 U p9 P" K! J7 t1 N / A( h X5 |7 R* C/ Q! s
var frame, iframe;8 d7 |( r2 S( X0 i7 j- ?3 N
if (itemFrames.length > 0)
/ a' ^9 G# y# ^1 I) X+ m# F0 x {3 l. h+ K3 V. r: R4 T9 P9 K& u& [& e
for (var i = 0 ; i< itemFrames.length ; i++)
7 O: Y& x) V9 O) k6 H- ?6 O {
* r' Z0 Q/ W+ f0 i9 ?$ U! f0 o9 ? frame = itemFrames.contentDocument;
7 ?- L# b& a- u2 H; v# h this.RemoveHide(frame,objname); ) _ j. {0 _% \4 R
}
5 A& r! ]0 z; C: Z2 L }5 S4 g. E3 B: l5 W2 ]; v5 b- \. G
if (itemiFrames.length > 0)
/ _0 _2 _ p# m" B {
3 _6 C9 H; e2 f. r3 H for (var i = 0 ; i < itemiFrames.length ; i++)
! X7 {; K B2 H {7 Q% n# B O4 ^! ~% n
iframe = itemiFrames.contentDocument;+ p: `8 W* ^6 Q$ c8 z# Z k. g
this.RemoveHide(iframe,objname); + A$ O* I, T* l+ \3 t6 d0 Y
}: s7 Y$ l" d$ q+ J1 G* s u7 k( {
}7 c$ T) N/ ^4 o* O
}* U8 y; X' l; {- d9 y
catch(e)1 Y# e7 t9 V" {- s. t, \
{; Z4 g0 v( c" \% j* Z5 r
if(debug)
3 h+ }2 C- z0 f- H: z$ } {
3 L: ^* @3 D4 E5 }' f/ P& i alert(e.message);1 f& G0 ~3 l; C7 A9 ]
}$ |& X# B h5 L( K) G3 {% V
}
, m e) t4 n3 z0 R9 W; V }
. x% C+ T) @: d
# b4 @# M1 g% o}
( ~& j+ `. b1 {. p% J9 K3 L# i" K. d4 M, ~1 Q1 w% D5 c/ ~
function getRGB(colorString); [* ^- f( E! o# @
{
7 l r' K+ n/ x9 t& {2 a var RGB = new Array;
% r) A1 |: ?# \' M% |( I" b% q1 G var tempSting=colorString.substring(4,colorString.length-1);7 F, I) c; M+ L
var tempArray=tempSting.split(",");9 A& A) B! S7 Y, C, Y5 u3 D
6 m9 N" `% y5 P' ~4 } RGB[0]=parseInt(tempArray[0]);+ D7 Q0 ^% P: U/ s! O
RGB[1]=parseInt(tempArray[1]);
# z; O) v4 y2 {% C RGB[2]=parseInt(tempArray[2]);1 g3 z7 T. t7 n7 g$ ~/ o
) u8 C, G/ _& N$ e) i return RGB;
~8 v3 ~' x' g' F}+ O' v0 f: l; H
function keys(evt)
* X7 u, H R) o* ~6 f/ ] { 6 d, F, k% B9 U, J7 Z- l
if(evt.ctrlKey && evt.keyCode=="81") 3 ^/ b9 r: L5 B! J
{
, C. T$ M5 w8 z CleanHideObj.on(0,1);
4 n- n, c. G& s3 n+ l alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
" D' `( N9 [& y' F; a% B
9 w' z, U; o: C9 K } # s: B" b6 b' ]5 I
} : J; ^: u6 R1 X' J) s* f! X
document.addEventListener('keydown', keys, false);
3 |9 F0 b# l8 U8 g6 c( `4 DGM_registerMenuCommand ('Clean Hide',
( p7 f. g( X# y, i9 Rfunction(e){
! i+ k# C7 r! fCleanHideObj.on(0,1)) d, ?9 q& |: t/ u" \2 T
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");( k. u; m) I7 g: e
});
" e2 b) p F. h6 w& T W' |9 ^ |
评分
-
查看全部评分
|