|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 ; C- u; C. c$ i! S. y# x, q
0 I3 L/ Z# s, Q2 X* e0 b+ s# v4 O火狐插件,用猴子
U: a; ~: R$ I8 t- H- a0 ?2 W9 @" d/ `7 Y2 _8 J; ~
var debug=false; 4 P/ O8 v2 S) Q7 [
var CleanHideObj=new CleanHideClass();* K8 a# z. {7 o6 ^$ e
( f& y& v+ i, w- l) x" T3 u
function CleanHideClass() 8 {& @6 ]4 [+ r# u
{
$ ]. s8 H! ~) R. ^+ ~
+ j6 w8 X, y A* z* @1 V this.on=function(id,bMZ)
( }1 x/ m, j$ }; f0 e6 w {2 g7 y+ m0 `# C# \3 w2 P2 v
7 [0 c9 V6 [" @+ C5 d if(id == 0)
: {% B: [6 A9 A/ ] {& ]7 M+ Q( K/ X6 S3 t4 Z- Q
var page=/* document.getElementById("content").contentDocument */document;
, U4 t C7 f D S+ O% f/ A this.RemoveHide(page,"span");
: @ ^, Z4 P0 Y: w! i$ [ this.RemoveHide(page,"font");
) `. r/ r P7 `8 T; [" I5 A e this.RemoveHide(page,"div");+ G( \: t2 I4 F
this.RemoveHide(page,"p");
$ J" s0 b8 z n/ q 6 A! ?. J# X2 V' F/ L1 Z
}
' {; G7 s2 E# T- }9 d, a
' r; H- T3 A/ h- u# W ` }
8 ^& N: N2 o+ K1 S) R; t" N this.getobjstyle=function(node,prop)* ~7 m/ Z! k5 V# m2 n0 y
{ W1 z) B! I+ h# l2 h/ I
try
; f, ]' p) u& \ {
0 n& r! i: D$ W3 f( l& `4 L return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);4 T3 f- L- c+ b
}
1 ~) H) O/ ~4 R) v; I: W n& S catch(e)
: n' y+ o9 s- U0 v0 C& ] {4 @+ K/ \' }' B$ K/ P. P) r$ m1 o# @
if(debug)
; y% F9 Y( g! k3 Y {: I$ J5 c- g) Z8 Y( L
alert(e.message);; o6 [/ L. d9 ^, p# u& D6 S, E9 t
}
2 m* \$ Q2 b1 H3 B6 Z
" a) w8 _7 Z+ Z) ~5 \! G1 d' z return "200";! L T- J B m; J3 i
}5 J$ S+ T p$ c. {6 d( g
}
/ _4 I$ w! Q* h' Q: C- \$ R
; y7 g- u, `0 O% N this.RemoveHide=function(page,objname)- t1 I1 R( T1 G v" _
{4 {) U4 Z( c0 H& ~- V& X
try5 F; ^1 S: v) w
{7 p# Q' a' Z$ m# K8 Q
var minValue=15;- ^$ M5 h4 A) M- _2 o* o
var objs=page.getElementsByTagName(objname);
: t1 h3 D1 |/ U3 W" W0 u( e( U2 W. V1 c" V, |- r
if(objs.length == 0) : k' v5 f$ x# L, W
{
; N2 N1 y( q3 S- @) |$ c if(debug)
( s# w; e& `$ \, F/ t) T/ t) E {9 `- y- u% k4 v
alert("no object found!:"+objname);
$ ^9 x3 j4 G* c! b. d. p }$ r! Y" ?( k. q; r1 Y( e0 O
}
" _- _' m6 z1 s: Q; J6 T* W5 j else1 W# y4 p( [4 E. K! A
{! G5 Y" l6 ]" E. @$ v L# ~/ ~
4 x P$ V5 z! S) v2 B1 ?- y
for(var i=objs.length-1;i>=0;i--)
, ] F0 T+ c2 B" O {
( y( [: I- a; b& l var node=objs.item(i); # B. _$ V, N. [; p
8 J& c: `% L$ ~* X# I; q- d . |, {4 x, R0 P& G( [
if(this.getobjstyle(node,"display") == "none" ||
, L# }+ ]5 j; ` this.getobjstyle(node,"visibility") =="hidden" ||; |7 E E. }5 a" J9 U
parseInt(this.getobjstyle(node,"font-size")) == 0)
: @2 b* R. h! z( }0 H {
& F! j! [& B* N; i if(debug), N, T7 L# T& z7 {! {
{ y# y5 l- x# a- g" I5 L( G
alert("remove invisiable!");6 i! `9 Z5 T# k+ ?& I' J; H3 ]' a
}8 O9 b5 B* T* l9 c( v* l: E* M
node.parentNode.removeChild(node);' ]! A$ Q. m0 |4 q( J
$ B# \7 W8 N( Q6 `# J }! {% G/ |1 {3 A( a5 i) ?
else 3 |) B8 J }" Z2 O5 R# b
{5 \5 H5 B3 i- U
if(node.parentNode) ) W3 o H/ w# k0 O
{. h* [. V: e L! T2 J& q3 S
var orgNode=node;; T$ Y2 D' n) t4 F6 g3 j- c
var orgColor=this.getobjstyle(orgNode,"color"). ~; l+ J) u3 ]: s, e2 K) [# ^
var orgRGB=getRGB(orgColor); * @' I9 u6 S8 U
& [1 W+ i' J" z3 _( T var parentNode=node.parentNode0 J& e0 n: u6 a8 k# X
var parentBgColor=this.getobjstyle(parentNode,"background-color");" S5 N& |: e; C l, b" u/ j7 U6 w
" \9 t& V2 J0 _; C var isLast=false;
& P2 z& O9 I) L* @& N& k ! \% S. \& H* o* p& ^" |2 Z
while(parentBgColor == "transparent")
* I% w; G) ]+ s& |( X/ V$ C: T, z9 H {- O; G* ]* e6 K) ~) G2 c5 G
6 J) ]; h/ q R3 B
8 g' A# T. K. x9 q# O if(parentNode.parentNode == null)
' c. Z8 J3 J' g {- U( t/ k" `8 b8 W
isLast=true;1 H \& ^, u1 O8 M* [/ j
break;2 d0 t9 _9 z4 J+ y9 l5 v6 [; c
}6 [5 y$ q, J- S) S
parentNode=parentNode.parentNode;* _0 Q [9 i$ C( `' Q& f9 f2 F% u7 O% D
parentBgColor=this.getobjstyle(parentNode,"background-color");' P* \4 r B7 @ w% }, O& l
: S# o* \, d; ?. J$ _ if(parentBgColor != "transparent")
( z" g: e& J3 R4 ` {, e9 i4 p# d5 \4 K2 Z
break;
. O. L6 [3 v( ]( w1 E) I" w }* P. H# Y% d5 M% g6 ~* U
} c) v" f. q9 q( T: y0 t7 H
if(isLast) ; h- c) r* }9 I3 P
{
, V& u' _, t1 o7 A# F. H if(debug)
- C0 p, s3 E; v: i) U {
9 M& m! a8 f; ~ b$ n8 ?4 b alert("last!!");
' ?! `# t# g1 e# T2 R8 ] }
. m, ?# [$ I4 l* V3 ], \% ~ if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))7 F- F3 W" H, K. O9 E
{
6 ` g% }. J9 Y0 C orgNode.parentNode.removeChild(orgNode); 2 u: d7 `5 S( c5 ~
}% ]/ F2 l( O) a6 Y
}$ v, h3 k! O; D, H2 R8 a4 J
else
9 M9 \$ d2 S9 o. f* N {
' N/ c) ~# X: L( T" C6 ? if(debug)$ I8 R5 {7 N, Z9 A- l
{. ^* a3 ~$ n& [! Y; q/ T8 k/ e
alert("compare color and parent bgcolor!");2 n& L" b2 g' B# b0 V) R
}
7 q1 ?: d) K% L4 e) L- j! ~$ A& L parentBgRGB=getRGB(parentBgColor);
3 o* P# Y5 q9 N1 h if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
7 d1 M t6 m9 X; J( A5 J {
" m. Y1 u) M+ G orgNode.parentNode.removeChild(orgNode);
0 D9 w! R/ C" o } [- j# k' U$ R( ~7 i
}9 I9 I" A$ b c
}8 P7 G4 i# ?# G: i. b
}
; m! P- c) u& L9 C }
X8 g- B p% b; b% M' @' a3 W }; C; R+ f- M2 [4 s/ P8 m
5 M: ]3 Y9 ?3 q& {3 V& \
- v a2 S' ?0 p' S var itemFrames = page.getElementsByTagName("frame");+ n G |% Y: d2 T; n
var itemiFrames = page.getElementsByTagName("iframe");1 u# s2 y3 l5 n# z0 u7 P
8 w; q& G& x T4 \
var frame, iframe;! O9 a8 ?+ Z; Y/ @
if (itemFrames.length > 0)
@; H7 d9 x. ] ?/ { {
5 G( b( D( A, C, v7 K9 @ for (var i = 0 ; i< itemFrames.length ; i++) 7 H9 H6 f$ t5 U. ?
{" {+ w4 r# {% D/ L8 \
frame = itemFrames.contentDocument;+ h3 H# r( P% `
this.RemoveHide(frame,objname);
: e+ j' X6 r1 b3 }5 d }
1 q$ z1 M: t7 L( `) c4 w1 v K }/ r5 ?# X/ C: {( u) C, _
if (itemiFrames.length > 0)' I2 W& B, X7 ~, C3 c
{
6 Y/ \% w% a, D3 T9 N for (var i = 0 ; i < itemiFrames.length ; i++)
8 a a2 G* ?' O; D+ K/ {: u% A {
1 S% u3 W0 ?, s& s# g! j iframe = itemiFrames.contentDocument;* `$ c1 S# M# _9 x
this.RemoveHide(iframe,objname); / }: w8 U, s4 J# w* X
}
( ~! q6 ]4 q9 F. Y" r }% T n* P# v& v3 n; x$ @
}
8 ~7 K% ~+ e5 a$ H0 a catch(e)* E, z! w7 ~/ E# |# Z
{2 P! j% t" {- j( a. I! c2 }
if(debug)
# A5 g8 b% {( X$ V4 S, ?5 ?! ~ {$ S/ W P; m4 r U+ B$ a9 u
alert(e.message);
1 u' C) ?6 Q6 @4 P9 y0 I# v }
( e, ^( f. E* Q }
) v( R( j. K! Z- y+ \' p2 a. g }7 y$ @0 y6 Y7 l7 G# c
& m8 @# q4 B- a% `5 Y
}
* ^! ^* z. ^) {1 Z* H
$ c/ u6 O" b' ?. dfunction getRGB(colorString)
: {/ c8 }, l# ?" C; j{) \4 o! i \0 [+ H5 q
var RGB = new Array;
2 g5 u% K+ n4 R& M t G" e# ` var tempSting=colorString.substring(4,colorString.length-1);% m r& ~3 F; e; [
var tempArray=tempSting.split(",");) X& g" \* B! U
/ r/ ~ V5 S6 O" j# ] w RGB[0]=parseInt(tempArray[0]);/ \& K8 t( p( L8 \# a: Z$ F/ t
RGB[1]=parseInt(tempArray[1]);
& m4 k: a% M# ?9 H2 B RGB[2]=parseInt(tempArray[2]);
& M5 H l; Q3 Y & { n/ `& c6 z1 }
return RGB;
/ ?* q0 C$ W$ W/ Y* \}
$ y, {3 X* g; R$ V3 Q! O% b# f( ~function keys(evt)
+ |! k' ` m/ j& ]+ p { / f2 s K$ v9 o/ ^, {4 v8 l
if(evt.ctrlKey && evt.keyCode=="81") 9 k9 |0 f' \( L- I" J
{ % j8 _( d- r* [& u: T' K( V9 w
CleanHideObj.on(0,1);
K4 G: C" K$ j% S alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
$ f5 @, p/ y5 x% f1 b ' z9 e0 E1 |0 |2 a9 d8 S
}
; P2 |2 j5 J8 U }
; T: K3 u% O. H; n+ xdocument.addEventListener('keydown', keys, false);
6 y* d! S- J4 f2 M, b* H- l( LGM_registerMenuCommand ('Clean Hide',4 o- Z- o: D7 a2 r6 p- F. P
function(e){/ [1 B. \# J; w2 x
CleanHideObj.on(0,1)
: g2 J( L9 X2 Zalert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
" s2 r7 ]* s5 t# S0 l( @/ }});' {% I0 s' m0 H; R: x' j+ y
|
评分
-
查看全部评分
|