|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
. o2 B7 y9 U8 u. w1 x
: F. d/ U8 c* r7 j- G火狐插件,用猴子# ^. f0 E( }$ }! g6 N* S0 K
}1 y' ^ E2 @/ R2 }' r- a7 L
var debug=false; 9 }1 M' K! ]* n' D
var CleanHideObj=new CleanHideClass();
" D6 ]# F" u' ] l! r6 M2 N0 \2 H) W* t% [" b- J6 r, m5 Z; K8 f
function CleanHideClass()
! y' C7 J9 R! G7 ]) {7 U) B% u{
! X1 r* a$ E2 D- c2 O & h) p3 p( r+ b) @- T2 K
this.on=function(id,bMZ)/ b0 ~3 o# _, y
{
- t0 Y* `8 A- V* G5 z, S
; B3 {% P% @4 [& F if(id == 0)5 F2 h8 T& N! V- i! V3 W
{
; G, O2 [& t8 H% ]: E. ~ var page=/* document.getElementById("content").contentDocument */document;
. T! T- U: o1 F3 Y5 N this.RemoveHide(page,"span");
% s9 s, R) r) o# ]9 r H. g7 N" Y this.RemoveHide(page,"font");( \7 `% ?7 o" S% Y. {8 m
this.RemoveHide(page,"div");# c) u$ b. L9 Z; m: `9 |
this.RemoveHide(page,"p");
" E4 N, S8 q* ?: K9 {% U 8 Z# X. z' W" D( Z) \) Q
}
( A$ F, M% V: `9 H! E8 r
/ T+ V7 A3 b" {+ G( I/ H1 D }
9 H% v ~/ `! p% f6 g2 g4 P this.getobjstyle=function(node,prop)
# J, y* p) K* C- n {, |: R) p' C+ e2 Y' j/ d6 _- h
try
8 ^7 o7 [* ^; c2 M0 i4 k$ | {
8 f& ]1 v; K* i5 t6 x9 l; i# N: D+ `- ^ return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);! Z% B5 U9 S0 J8 v2 y3 d3 r
}1 ?0 \: {6 S5 [9 H" f3 p
catch(e)
4 P8 w) H X4 k" }: V {
+ _+ q" o6 C0 u$ x% V& L if(debug)% C4 U5 _0 F" @4 Z# X9 s5 r& G& s3 x
{
5 k1 s2 g" m M; H+ E alert(e.message); L6 q/ `) `7 a, D1 @
}% [# A( M. }5 f7 ?. |
% |, {) m6 {( T1 @9 r( {, ~
return "200";; L; g* F- [6 o! ~4 y# @8 i3 Z
}
/ G3 L. i2 E+ t1 q }' \* |$ f4 f, s% r; J$ R) _5 w
, Y4 d) D& } z. C" l/ @3 | this.RemoveHide=function(page,objname) C' r2 Y$ f; ~! W
{
' F. V0 S' ~) t try
$ q/ Q e( s1 e% G7 ? {& b9 [. C3 k1 ~- R; T: o8 @
var minValue=15;
; s0 z' X( |2 I' g var objs=page.getElementsByTagName(objname); + r7 J: L4 Y- q! S
, A8 f: W7 E3 q+ G
if(objs.length == 0) * X3 V. ]. V4 l5 ]0 W& s( b
{
* w' m. y; s! A4 H& Q A0 X& | if(debug)
5 B( G9 o S" t& b6 u" ~# o. n4 m {
! R0 O4 [! f6 I5 x8 Z3 H0 _ V) O$ i& J alert("no object found!:"+objname);5 `# z3 l" e6 b, u2 K" c' ^
}
: {7 e% \2 [" C7 d% I }* R/ W& n, |/ c1 }$ ~7 P
else" `8 S/ i2 u- U2 c; _: s
{
' Z2 x m( T. q( R
7 E0 U1 I8 U- Q1 H9 h, K for(var i=objs.length-1;i>=0;i--)
# y0 G5 r+ w% P( s% @+ A {8 @: L9 m6 g1 j4 A' T; x; Y
var node=objs.item(i);
& H7 ]6 H2 Q v" U1 h* J% t: z2 L 4 q* B8 _5 `7 t4 L0 Y! Q
, {' j$ j3 a0 o2 H- O if(this.getobjstyle(node,"display") == "none" ||4 h" L, g, O! o( `: W* D# \4 q! p
this.getobjstyle(node,"visibility") =="hidden" ||9 `( K! d/ ^; R0 J/ t3 ^$ l' a
parseInt(this.getobjstyle(node,"font-size")) == 0)
2 B1 C& U' j) O3 w( i {( D* k. T* ~' R5 @$ e0 ~
if(debug)) ^7 _# X e! }1 V9 `
{
. r; ?$ Y$ D1 L$ C6 X4 U alert("remove invisiable!");
2 [. }" \$ t, u }
2 u+ g4 i& P7 U+ Z node.parentNode.removeChild(node);
j* Y' K. s, ~4 q; F- }; t
: C! U; ]; b; X' U8 ~4 P }
/ y& L% B( i" q4 A else
4 ?3 C9 S' _9 |* J {+ C- u, A& T8 l; _9 l8 S- \
if(node.parentNode)
% ?8 e4 k: r; X: E {, l+ _ f8 A: ]) t2 A* K, D
var orgNode=node;: W- i+ g( ?5 A: E% U+ o
var orgColor=this.getobjstyle(orgNode,"color")4 _* x0 M7 ?+ [, U$ D0 l
var orgRGB=getRGB(orgColor); % z" y; m z3 i4 t
9 s0 p6 q3 P* c
var parentNode=node.parentNode
; c# ?, [ L, ~ O var parentBgColor=this.getobjstyle(parentNode,"background-color");
$ W3 u( ]/ \5 a" x0 b, ~, _ 1 g- p. k& |& S' d5 w# v# y/ ~' J
var isLast=false;
- }. K! }, B! X7 Y; E, r ! H0 K' K. e1 |1 K+ o
while(parentBgColor == "transparent")
' [ O- ~8 E% i5 S# M O {, [1 y. p, \: `5 V0 o R
5 n& b0 M# ]$ |7 r+ t% N9 J6 h: V2 V
`% [4 E3 h7 Y; b/ E+ a2 S! d if(parentNode.parentNode == null): ~5 ^% L( ?2 N$ g! Z! l
{
" m2 n* S/ i& h- c4 W- r isLast=true;" O8 j" f5 N: M6 V8 w1 |
break;( x4 k; G r* |0 ~9 E
}
: N$ T0 c* v% U! |8 |$ v2 w; h2 i parentNode=parentNode.parentNode;
" I) @4 U$ Z1 d8 q9 [ parentBgColor=this.getobjstyle(parentNode,"background-color");" F* |) l- x& z: `1 Z
/ q R6 j; i# x( z if(parentBgColor != "transparent")
, d6 ^$ w: L+ ~2 p7 X {
+ ]% K' G% j% C5 a+ i2 v+ V break;
4 `5 X7 s6 n j# [) m( K. c }# V/ t9 ~0 p* o* W3 v' A
}
% E* k3 x6 p; E( @ if(isLast) $ j0 O* H! k8 c* F7 Q
{
. L P% b8 z' Z; o9 I if(debug); k( k5 ]4 L/ N; b
{
7 X# d) x0 ]8 u' o alert("last!!");' b4 E# V' h+ X! y
}& [% r6 L+ s" z; t
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))) g) I l' t/ {8 h) c
{
: g4 @3 D" T, o orgNode.parentNode.removeChild(orgNode);
' Z1 e; f. g% I: r }% N( U' ?' P( j) @9 h. h
}/ ~; r- b ~7 t( `! {6 o3 ~% q
else0 I+ U% q. T. o
{2 J3 T% E, k5 _. c' k, F
if(debug). A' d# r- y9 l: T b, w4 T* D- F/ x
{
7 D4 W% P$ E$ f& _" W3 s0 m alert("compare color and parent bgcolor!");
f% a8 B: {+ E% p: h7 R" O& p+ z } o c' T' Z8 A3 P9 L. x8 E4 X+ p
parentBgRGB=getRGB(parentBgColor);* s; l0 \8 b( y6 x& }" ?
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))( B' L/ {3 F% A- V2 Q
{
5 r# q' o+ Y* F" I- m orgNode.parentNode.removeChild(orgNode); , ?7 x1 d% `6 _* q
}% D; A6 D* @" v+ k+ r+ W1 v& z
}
! ~4 D: h; k" ?5 z }
, U6 e& Y$ z0 y: p9 i7 T+ T4 [2 U }
, ^( q+ w! a& o4 U! G }
+ t: J" h' s) m" C- y* M' U/ ^) Q5 i }
" [5 B$ p: W1 [0 {/ V% g
% K% f: C9 U* B: K# L
$ F, I9 A, F- g& v* j var itemFrames = page.getElementsByTagName("frame");
* P+ C* G0 ]1 h' U6 x" k& D! ` var itemiFrames = page.getElementsByTagName("iframe");$ p' m7 N" I2 S5 O1 u, y
3 E( ~, t! B. B1 G0 l
var frame, iframe;% z' z6 [' A% A+ G: U4 I6 X
if (itemFrames.length > 0)
( w; c$ R6 ~& j. L9 H3 F {: i' {8 _' j5 K O0 [: |! j
for (var i = 0 ; i< itemFrames.length ; i++)
( n7 T1 u& j5 q8 P# ^6 t {
( C& _7 E8 E5 s/ k3 ~ frame = itemFrames.contentDocument;
! ?* O9 q3 ?4 X y6 s0 | this.RemoveHide(frame,objname); , u d+ I) ?. X) V3 I4 o
}* {9 \, R0 F# V6 h- R( N+ ~* Y
}! M1 H! B y; }* Q1 L$ f$ s j
if (itemiFrames.length > 0)5 P1 M F' u- Z3 Q% p) U
{
! O9 J @% ]$ J8 v for (var i = 0 ; i < itemiFrames.length ; i++) 1 F3 X( D& b: `! N" k: J* t
{
; _$ X( K, O, R; W/ n. v7 |4 [3 E iframe = itemiFrames.contentDocument;
) q! B& R5 m- a5 @8 G. j, [ this.RemoveHide(iframe,objname);
+ P P& k0 K; f1 ~: I: o x }/ C4 L% e7 q% s6 l% D7 @* Y
}
4 }1 r( e }& s" I) T }9 @( o N! X# S! f+ A8 S
catch(e)" }/ J$ h4 T# m" e+ G
{
R2 a$ F |" I8 [& X6 H0 {; H if(debug)
; u) \) d4 Z; E% J' |+ ` {5 S6 V0 U! D8 d* j
alert(e.message);/ v! x4 J( m& n' j0 ?" e& e
}
* @! Y' l7 A' Z( a+ U }. N i( M- z: D( v0 ?& j9 W1 c
}
1 A9 v, K+ h c3 g6 h9 Q y; i ; \" a& u0 Q- S& i
}; R* o! {2 ~8 k) |
$ d7 b% \ u; q/ J( b0 S+ `function getRGB(colorString)$ ?7 r8 Z% ~ I. o* o& p
{% T8 k# ~' e- W; H
var RGB = new Array;' t0 T; g" i; e3 q, j
var tempSting=colorString.substring(4,colorString.length-1);; p+ N2 j+ v( D) d, Q `2 K
var tempArray=tempSting.split(",");% G( i+ b" h0 [3 C) i
$ x1 B6 ?+ \& M+ o
RGB[0]=parseInt(tempArray[0]);. [2 A4 _1 e7 W
RGB[1]=parseInt(tempArray[1]);1 ]+ q% F7 c/ g0 C
RGB[2]=parseInt(tempArray[2]);1 E6 J) J) k- n/ F
! K$ q$ L" }$ V' l8 t0 e# u
return RGB;
" X3 v& r$ P/ D3 u6 |}
! Q* }7 M. H% i9 |function keys(evt) ! l' k( O3 J4 I: G
{
( Z+ ]' h7 L# N9 `/ @! L) F% E if(evt.ctrlKey && evt.keyCode=="81")
2 c, f( o( E% X; o6 q1 e {
q3 K ]) M& i CleanHideObj.on(0,1);. |( Z3 I' q r. \* k M. `( D; y
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); . W$ L$ E9 q& v4 a) {. I0 ?
- O8 E* l4 j0 g) r. X8 d5 |& r
}
1 r" o: F! G2 ~2 g; b. P+ l }
; I' s% W' `+ Q+ G: n5 z0 Z+ Odocument.addEventListener('keydown', keys, false);
* Q$ w: j3 K/ x6 S$ a+ I8 tGM_registerMenuCommand ('Clean Hide',0 C* d$ I* E! Z5 m1 X
function(e){9 D0 J) `) M) O/ H0 }* [
CleanHideObj.on(0,1)# @" r9 u0 P( R; v9 z' l3 T
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
8 N0 p! C' }+ X' F3 E' ^/ [});
, t$ I4 z4 N5 b) N |
评分
-
查看全部评分
|