|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
" N1 t8 l$ a$ g. }/ [# O7 B' [4 g+ l8 V {1 e# W5 }
火狐插件,用猴子
3 Y7 M* }" v2 c6 K! O) `+ I- {) U+ a
var debug=false; 0 f3 o2 [5 Q$ O( ^
var CleanHideObj=new CleanHideClass();7 d+ t: g; X! C: |7 w% C, o! ]
. V- z/ b u B1 j- s1 i( `9 X! o+ `
function CleanHideClass()
3 F1 O: Y9 K9 L$ f{ - W$ }. Q- \. I' v- S. I
7 B/ T+ j f! q
this.on=function(id,bMZ)
2 s: ~7 v G( ?+ L2 O; p( E {& C% X8 o( l f
& O8 \- N0 P* i/ g if(id == 0). N) y0 {; a7 I# c" E9 R2 T1 x* P, ]
{
# q6 f% u( J+ a var page=/* document.getElementById("content").contentDocument */document; ) _) p0 X9 l7 d) a' F
this.RemoveHide(page,"span");/ c! r5 V& Z! T9 Q4 `& ~$ L D. d$ f
this.RemoveHide(page,"font");1 U# _# ?9 e+ V1 Y! ]
this.RemoveHide(page,"div");
8 n' G& [2 g9 W. s1 S this.RemoveHide(page,"p");) V {2 T% w$ W$ z
k# w0 k$ Q( r7 G1 a% _
}4 I, H; o l+ n$ w1 ~7 b
' Z% `2 B1 t& c! r. M }
* O0 p3 l8 \3 D this.getobjstyle=function(node,prop)- @% z. {2 O+ |4 ]: |
{+ d4 H2 d- O, R* P% m: g7 d# g+ Z9 z
try' ], `3 g W& h J
{7 F+ g: W5 A9 E4 O( o v3 S8 c
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
# S/ l. f/ l. K }
! ]4 h! J+ E5 x! f% K& f catch(e)
# ^$ U( A1 t" k% [/ U) v! F: ~ {1 O- ]2 R0 Z# @7 \% U$ r0 H
if(debug)! ~* V5 R' m: h( C1 Y% g h w
{9 P' m! F; P2 e v& P) I
alert(e.message);; d6 Z# J& o, S0 t) e7 u/ U
}" _; x' j, P/ a3 {
. B! `, M! [3 P7 ?
return "200";5 l, S; c' x/ M# w9 ~5 B; |
}
/ y* o0 Z/ }4 N. u }
8 j6 _ C R, F( S
9 V- P. N) N, H- F) @ this.RemoveHide=function(page,objname)
* P' ~/ F7 z8 g {: b) }& E7 d- x
try
7 l" P+ z2 f, t {0 n+ \( e1 q& n: d7 S I( b( [
var minValue=15;
2 b+ [" e/ y; a9 _4 t) K var objs=page.getElementsByTagName(objname); : C- `2 _8 n1 o
2 y& d n! a7 F8 u5 a1 t* N G v if(objs.length == 0)
; i4 m2 I: F8 M$ b9 c {
( H# L: u# y) d3 U3 ? U9 O if(debug)
9 A* \ s$ b& ~ Q, ~ {
: h" v8 |$ D0 t+ v9 v alert("no object found!:"+objname);: x) S4 K% A5 ~& M' a, f1 x3 }
}
4 M4 q/ x) B7 C2 c+ H4 i) ^3 ? ?1 a }
( B3 |. K6 w* h0 M else! J( R! ?, ~+ q
{ @+ V* J: B! T. }- s
2 k$ p9 H4 Q0 H4 b3 I5 f for(var i=objs.length-1;i>=0;i--)
2 b( Y# {$ I2 `3 ~6 \: O$ W! g {
& ?* V( X3 h3 t, l$ L" r var node=objs.item(i);
& x/ y1 N4 o8 Y+ t5 h + h: X) E' n! S; c
2 B5 \7 g9 c& ]
if(this.getobjstyle(node,"display") == "none" ||
' [! j- j; M# n% L this.getobjstyle(node,"visibility") =="hidden" ||1 C2 u P, y- `- b$ I
parseInt(this.getobjstyle(node,"font-size")) == 0) 1 R& Q, [2 s8 H
{: K+ g) i- H1 f) t' T$ z
if(debug)# [! H4 A1 n+ ^/ [
{
; Q% a) g) E/ N% X alert("remove invisiable!");
; n, Z3 \' J, u! f+ ^ }
, [" z) X. |* e node.parentNode.removeChild(node);1 n ^6 i/ R { S0 | u9 M
9 p5 H, B, B- A: |) F y
}9 G. l1 c8 e* G5 g# F- x. L" M
else
! V3 d7 h. c5 G7 F f0 v+ c- F- W8 y {9 I6 w* Q, B* f) @# e8 ~
if(node.parentNode)
$ Y7 w9 A6 `$ K) E0 J0 a {
5 R1 d1 [- v' K4 D8 Z var orgNode=node;+ P% u1 k" k" S4 K* U t
var orgColor=this.getobjstyle(orgNode,"color")7 G* j$ U4 C1 |7 w7 M6 U
var orgRGB=getRGB(orgColor);
i1 B, y& v$ V' _ b9 i! A 4 g) w. N) L+ c8 B, Z
var parentNode=node.parentNode8 ~9 z, R# S" D' V. k: x3 @5 L5 f6 O
var parentBgColor=this.getobjstyle(parentNode,"background-color");
+ c/ \# P2 t) h1 O- ^ ~ 9 R" |, T2 h% {
var isLast=false;, f% `8 F# c4 B) [8 x7 ]; ]8 D
0 n% y6 U) }: r" { A$ l: O6 S while(parentBgColor == "transparent") 1 Y9 W/ n: g# x( q3 L
{
$ \2 T1 R1 |" Q; p , T d# b6 @9 [ w3 o
! Q# b- u/ _+ Q! ~5 }6 j1 ?
if(parentNode.parentNode == null) s% Y4 K4 h% I" o4 `
{" p$ c! S# k$ X# ]) s
isLast=true;4 b) f& f$ O. n, k
break;/ F; O" m, `$ m1 _4 V, c: n
} X6 S8 ~& K5 ]0 y. {
parentNode=parentNode.parentNode;( J, f1 }7 a+ _" d
parentBgColor=this.getobjstyle(parentNode,"background-color");' U/ g& ?$ Y* ^1 C j, n( x
! i2 S v% y4 |# o: q! W: t: ]& g% | if(parentBgColor != "transparent") ! Y/ |# T1 y; F0 o" F+ z
{4 r/ @, j3 m* {+ b( e5 S8 Q8 p
break;
+ n/ D' f+ w8 g X. z- R5 Q6 g }
$ e/ Y- m- {3 b! F* S# f2 R3 h0 Z }2 ]/ A# f6 z' Y/ N0 w, x$ Q. N
if(isLast)
( [5 F8 J) L; W. B6 i0 G9 b. } {
2 T& s7 H5 y [. Y; l+ _) K' } if(debug)6 c# [; T( E. I* e; {# C- ]8 v
{
* B$ O/ A! a$ V! e" v alert("last!!");
5 t/ e! \/ F9 s" \ }
P& o! e7 h+ {6 V9 F if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
+ W T" Z V6 c! L% r# G# q {
& ?) `! v' I9 n orgNode.parentNode.removeChild(orgNode);
) s8 S: k& K. c# i, R E: i/ Q }& {) p- y" n8 C+ s- Y
}
# `9 G" N0 a4 ` G, p else
# o' A7 K, T3 v# |2 k {" H4 ?$ b- [( o8 N) N
if(debug)
8 K8 L7 y+ ?' G0 }1 L3 P* q {/ } ~" o0 G R5 |5 n( j, C
alert("compare color and parent bgcolor!");
6 d* r% d) L* D$ _ }
! C5 }: p$ A* b/ j parentBgRGB=getRGB(parentBgColor);
4 V- ~+ I" R& R) B if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))1 \( z% q: u% @
{
% T3 Y% S: n9 Q, q2 |5 Y6 H orgNode.parentNode.removeChild(orgNode);
) i& W& o; ]2 _% R; _: ~, K }5 S! `& y( K" j! p7 Y
}+ c6 l! b% F1 q& u
}
( |, x2 J' y0 b5 e }
0 g9 O# J$ ~3 p( |3 |- j1 X' q' b% p }
q; P: v2 Y! V }
* G3 Z* u# u( @ w5 K " m% p: n8 M: L* C
( f2 @ Z6 r s* Z var itemFrames = page.getElementsByTagName("frame");0 ]! J- x9 o a/ k
var itemiFrames = page.getElementsByTagName("iframe");$ Y# E: f* }' `; ~; _( \7 H6 j
& E9 ]! W. ?& J6 b
var frame, iframe;
, }8 M5 R; s( ?: a# k if (itemFrames.length > 0)4 E) G& f2 S& L) x
{
( b0 t" g# x8 Q for (var i = 0 ; i< itemFrames.length ; i++) # ^& z8 o. N$ P; y7 S$ H
{
& s% |! ^1 }- y frame = itemFrames.contentDocument;
0 w0 {9 q2 p' J% X4 d1 k this.RemoveHide(frame,objname);
3 a3 R3 S+ U5 r) L/ Q+ s% q }
% C0 ]2 u. h( T }
6 Z: j% S9 p1 z) U. G5 y if (itemiFrames.length > 0)
% Q9 U, O) A, [( u0 d6 h {. p& Y U5 m# @) o+ R2 }" {
for (var i = 0 ; i < itemiFrames.length ; i++)
/ b- T5 d5 z* _: L {
) J5 M9 w4 J( F& o. O iframe = itemiFrames.contentDocument;
# e! \' m4 b; l) E. Q8 o8 x this.RemoveHide(iframe,objname); [# m1 A% r3 j- K/ R# S u P
}; c" I: m. d; R% k) p/ f! S4 b
}
3 J% d G8 t) U9 C' f$ W* @ }8 p2 p. q, N. f3 |, u9 ]$ i
catch(e)
4 I* U) d, r! m+ F" h8 k {
9 O2 l) i' s8 O5 h if(debug)9 l T0 H1 _: Y0 N; n2 T' s
{
: S1 G( W0 r. R4 j2 G" c9 f& n alert(e.message);
$ s8 @" d) ~0 h% R+ Q3 O }
; J% E/ {8 z P }
( Y- g, o( V! `3 }2 u1 w! o }
6 {3 R7 g, M9 ~ & f% a3 U, m- A: J
}3 H& E/ c2 c8 L
, E: ]- t- K" k K- ~7 |( n
function getRGB(colorString)
( u- M ?: G W5 i{1 P/ X* d& a# R, M1 b x
var RGB = new Array;' H( f# ^& L; j( g' b1 A/ `9 ?
var tempSting=colorString.substring(4,colorString.length-1);- l- j# l! `/ j: [' z
var tempArray=tempSting.split(",");+ P2 t6 z( {8 N# r7 M+ p2 x* ?2 e
/ v% |0 Z, u! F; Y/ N B
RGB[0]=parseInt(tempArray[0]);% X5 t- @' u0 i: X5 K5 i+ R0 K! r
RGB[1]=parseInt(tempArray[1]);, Q% p: f" e' r( G$ ]1 E/ M
RGB[2]=parseInt(tempArray[2]);& u6 W+ y$ |+ C! x
! G! u% Z6 |' Y9 c$ N2 {7 Z return RGB;, s( ~) H9 d7 A
}1 ?2 Z5 }, u6 G) I2 [: G
function keys(evt) + K% q: J# {' c S: y& c' Z" n
{
1 m* ~) P8 I- M if(evt.ctrlKey && evt.keyCode=="81")
) I2 ?- Z# @; G% d {
# ?) C! O+ q! m2 Z/ }& s) O CleanHideObj.on(0,1);
* B# ]* | x% X$ q2 T+ u alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); $ w" R# {+ K$ S8 U
8 V0 E! s/ ]$ R }
( F# m' j4 H% P0 l! V } , W1 p! p# q: R* H, b- d8 e
document.addEventListener('keydown', keys, false); . q2 J" n6 g2 G6 M1 J! V3 t6 M
GM_registerMenuCommand ('Clean Hide',
7 m. o) H- i) [$ ^0 afunction(e){. Q- ?) e9 J3 k K) y% W9 Y
CleanHideObj.on(0,1)6 N: U, W$ h$ i/ j e9 W0 P
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");: q. ?0 J; t8 ~* t$ w
});
+ @7 j5 `& V' E/ y) U( H! q8 @ |
评分
-
查看全部评分
|