|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 # s# L" y! `, K$ ?
/ \0 [2 U9 V- I
火狐插件,用猴子
" M+ X2 O% o# X0 `* B" o9 x% Y8 }: G6 Y
var debug=false;
, {6 v: A5 B; ]8 L7 q5 q |7 evar CleanHideObj=new CleanHideClass();
: U& c9 U; M J& f
9 b" M% ^4 }4 j( {$ G% Ifunction CleanHideClass()
# ~/ z* [$ B) M' I4 j% a( r) X{
" ]9 i8 k$ C6 L* ~
/ `$ l3 a' y9 ] this.on=function(id,bMZ)
N8 S$ p. c* y* } {$ g7 L- y% I9 b% ]2 d9 P
# o. m# O; | ?0 M& A4 | if(id == 0) }, c- U! U3 E! j' l+ i
{: z3 }; A: T6 W( }8 @4 a6 j
var page=/* document.getElementById("content").contentDocument */document; 6 o3 `+ \: j( c4 {3 P. I! Y0 V0 M+ S
this.RemoveHide(page,"span");
R* T1 F* k3 a& L6 p' m( ` this.RemoveHide(page,"font");
5 Q: i3 y2 k( Q! A: B this.RemoveHide(page,"div");
* `, H, j# ?# T$ ^6 |% G; W+ _ this.RemoveHide(page,"p");
/ T! S# O2 x1 I / }, d2 y, n; e6 L& ]7 h8 ~0 @
}+ H" s( J/ j# ~& T: W- s4 r) k' i
n+ R) i1 v" |+ ?' I
}8 V, {- S" u8 H
this.getobjstyle=function(node,prop)6 X, s" o1 R" z4 p$ w
{$ \+ G/ y) w1 W9 C2 k' C
try
* o4 e: e: o3 i+ z' w" o- f {/ }' U7 `7 A. H& S) X
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);2 V. r' R7 g5 l3 O* l
}
, }" j M" s/ F Z# A catch(e)% V) K; v8 G; j
{
! F& a' p; D+ ^3 P if(debug)
! P. s2 I3 H1 i- E {
* T* X6 R# R( [7 ]* a9 P: I alert(e.message);; w3 W) P: [- F: m% g
}8 z! ?1 f9 v0 ~! w" L) A) v; T5 x3 |
/ _; z f) v0 O6 }# E
return "200";6 v3 ?* g, }- [" R
}
8 z5 ~8 g, w" w. T% W# j& \ O }" F* w7 V" J, z5 t* }, ~3 `
* P4 }. ^7 d/ z5 |3 c
this.RemoveHide=function(page,objname)
1 p5 I4 V/ \0 ?: D) T {
) c5 c1 a& a/ ^, ` try
5 |- f/ b' O% Q7 V7 N2 j; b5 Q {
/ g- @3 r* a3 h) _8 f var minValue=15;
+ E* r- q; h: _+ E2 o) R var objs=page.getElementsByTagName(objname);
. A0 y- m) @/ b: E/ f# N: C! J# x4 k4 n
if(objs.length == 0)
7 I( D3 [; p% f+ A2 b {- E1 I5 \- Q0 R, K* Z2 M
if(debug)( ?# Y" J' O8 |5 e- j
{
9 s* w/ W; m7 k5 g4 k alert("no object found!:"+objname);1 q; U5 }$ V* }4 P# r+ C& h( q
}9 R, U. E- K6 O
}3 R- P$ [0 E1 J: @; ]/ B- p
else+ _. ^5 b) R- h
{
* N w0 B# S8 H x " H! w4 ?+ l/ e2 P
for(var i=objs.length-1;i>=0;i--) . s4 V4 d6 n8 u1 k9 P4 {. ^( k2 Y
{
# K. I+ c1 ^3 E9 y5 R var node=objs.item(i);
& f% X# [, Z3 q* h2 S: i & I- C9 r u: J- V
# [' E2 c0 q. ]( x: ? if(this.getobjstyle(node,"display") == "none" ||; W5 A$ g; k3 [4 P2 Y
this.getobjstyle(node,"visibility") =="hidden" ||
& g! N. P2 L% z/ D9 S% O8 h parseInt(this.getobjstyle(node,"font-size")) == 0)
$ | _4 E" O( Y0 \& y {- X3 }5 H% _, ^
if(debug)
: ~# ~5 y: b6 `0 C% k3 ?7 n {5 K3 E1 O/ K' q) x4 t
alert("remove invisiable!");7 {2 I) }: S, ~
}
) @' \/ d+ ^6 G: q9 Q: |- Z8 o node.parentNode.removeChild(node);& `7 Q9 M( s4 U8 c
) a- [ q2 Z- N0 h9 E1 f" P } S5 m! Z: A9 m% [& m
else
. z, d K4 ] c; P& Y& ~) Y {+ q, q% M+ v) A& |" j& H0 f! H
if(node.parentNode) 2 Y* @2 i* h$ q, G7 s: E5 C1 k
{
7 `7 o3 W; |9 H( k var orgNode=node;! a0 V- f% E3 [* J) t% k! I
var orgColor=this.getobjstyle(orgNode,"color")
$ h" K) m6 X4 @. a0 G5 O! v9 W var orgRGB=getRGB(orgColor); + N" R F, H# ?
9 h A' I t5 i' W5 P3 }( H" h4 X var parentNode=node.parentNode8 |/ u; B4 m! k7 J! W* X
var parentBgColor=this.getobjstyle(parentNode,"background-color");) ]# i* X1 f8 E* B) D. Q/ S$ \
9 C; A8 R' R$ e! M var isLast=false;
8 v9 X/ ]3 W! n # X/ U7 `! Y6 C& o" S( U* P1 K
while(parentBgColor == "transparent")
; o9 r K# _, z& j3 p {; t6 c* x& x. H, {7 I; _1 M
( j& e2 u0 m+ E! x7 Y
, Z' h$ h9 L' n$ c if(parentNode.parentNode == null)
# X5 D; }4 T i) c4 m2 ` {1 Y/ V4 a2 W2 b l4 N' B
isLast=true;. O% g6 s4 d, P$ s5 I9 f0 g8 m
break;
& v9 Q0 r- R! o/ i P5 p }
" P4 q/ j* [8 y. y! y parentNode=parentNode.parentNode;; Y2 v8 J F* p/ a' Y! U( p
parentBgColor=this.getobjstyle(parentNode,"background-color");( e9 V {/ _3 G- Q' q: b9 f
1 R" O J' J7 D' A' @ if(parentBgColor != "transparent")
1 X% {/ D3 \" u$ c. } {
- }; M8 x5 T) l) I& K break;# |" e( m$ }2 `* N
}
" J% Q4 i3 Z( S }
r% K5 G ~# I0 D- y7 ^$ Q if(isLast)
) w: z e' X E8 g5 {4 S" ? {2 ~! _' ^6 I8 p$ I
if(debug)
* L! Q! a, k. p/ w/ q$ ? {
4 ]& q9 L+ J8 V y5 w$ ` c alert("last!!");
6 V I6 K7 x2 m* O' z5 f }! v% X& g) Y6 \# R
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))3 H$ I6 d" } ~( i
{
) {( M8 K) O0 G- o+ [) s orgNode.parentNode.removeChild(orgNode); & O2 i3 Q& \5 D% R; g
}
4 z5 M: D* v3 ~: v& g% ]7 l }
6 Z! ~& ~% `$ u7 Z# u) q7 g else
" N# c" @9 I+ m" B1 D3 H h3 k {
; _$ q6 Z! G7 c7 h- j( p$ T. d if(debug)1 j3 B% c. C; q2 Q
{
$ t/ I6 [0 F1 ~: \& g alert("compare color and parent bgcolor!");0 e; ~, K- j5 H3 v7 b
}
" L& c- x; e8 ]" S+ C parentBgRGB=getRGB(parentBgColor);* l/ t# w7 u& D; x
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))/ a# V. D: E' i7 c2 E
{% F) e% W( L9 v4 U4 |& e+ {
orgNode.parentNode.removeChild(orgNode); : H* Z+ g8 o* E9 X
}1 A9 d" c* [ ]8 k
}
b" t( {. K3 a. w& `/ L+ h }% m/ ?6 n8 Q8 i) C$ o: y
} ~3 Q5 h+ x' n- r9 R
}
) r3 v/ q+ K; }1 D }4 W$ Z6 G9 ]- p5 z. D
; P# d' a. D) g 8 {9 ]: ?4 D! o* H3 ?4 t
var itemFrames = page.getElementsByTagName("frame");
3 i2 a. E4 i% K v var itemiFrames = page.getElementsByTagName("iframe");
0 n: {6 |: ?( k0 p4 r 5 I! i0 R4 h1 u$ b2 F
var frame, iframe;
2 L( r" E; Q0 w# ? if (itemFrames.length > 0)7 ?) G& w) a1 r+ s" Y
{
$ ]1 k1 b0 ^0 X! O9 g, V' `! k for (var i = 0 ; i< itemFrames.length ; i++)
( J/ C% c8 G8 t9 x2 |# j2 k {% q1 ^4 s( h x, q& T" W# i$ c
frame = itemFrames.contentDocument;( Z) i1 u% ?% d* ^/ m3 D% ]
this.RemoveHide(frame,objname); - [5 F2 X4 `+ r O% D6 A
}
0 ^6 G! i2 c8 {, \/ _1 n; }+ }4 Q }6 ^, {( ^9 J) o, c* `; Q, b
if (itemiFrames.length > 0)
9 g. S: n+ S: {7 g {& c6 h, W/ x" t$ ~
for (var i = 0 ; i < itemiFrames.length ; i++) " k! t' ^& {6 M6 q* ?
{
& s& O) T _: n7 |! u0 p( X" N iframe = itemiFrames.contentDocument;
2 S7 A' O5 h& M+ Z& o# d this.RemoveHide(iframe,objname); ) _' l7 [& d8 C/ B* y
}
& \, k3 A5 Y- h4 {% v Z' x7 ] }
6 e1 O; R, W; j, V6 I, ]1 h& d& H }! i, U& J2 ~; g& e2 F/ ~( {
catch(e)9 q/ b/ n( u6 s+ q, j
{; @% O: `3 t: r; B, @
if(debug)
( z* ?4 I. m/ ]3 a2 E5 O1 K$ l* t/ j' J {2 l5 c5 e1 s. w" o" N
alert(e.message);1 z6 a4 r: U$ I
}
, }. p" C* o6 g }
1 G" I D I" M |9 v0 o2 b, j }
2 M X5 R) K8 y1 t: \! `6 a7 J1 g
6 i8 g* |% h2 @, Q1 Q. F3 C* {}
0 m- o7 M, L" _3 X' l; [. F0 j3 D' e* d! g( F; {5 d1 e
function getRGB(colorString)
0 S* i4 l# E% M, _2 g{& { ]. Z- K6 w! }' _
var RGB = new Array;
: j. o* v' ]+ B var tempSting=colorString.substring(4,colorString.length-1);3 x/ {& }7 F4 @. a8 H' W7 ]
var tempArray=tempSting.split(",");6 n$ z$ g) H; P; F& o2 u
! u% Q% Q. E: m7 Z- v
RGB[0]=parseInt(tempArray[0]);3 h! |1 C- {7 e* {' U1 \/ O! J
RGB[1]=parseInt(tempArray[1]);$ H$ i) D& b0 S1 Z# F
RGB[2]=parseInt(tempArray[2]);. K8 Z* A2 y/ ^0 S( N( P) a$ Z
6 b5 m$ H& L- N2 L ? return RGB;6 g2 K0 F) g! L
}' {' I4 @0 h0 I# j3 F4 t; Z' E. Z
function keys(evt) l0 j1 V, V0 o3 f; V) ]5 g
{
! R0 `, ?; A2 y$ G1 N0 y if(evt.ctrlKey && evt.keyCode=="81") 9 u# M- g+ {6 L% r4 J
{ : e+ g: ` J5 s! w0 H& o' u6 \6 B
CleanHideObj.on(0,1);
# A- q( J' o. `2 L: Z: D, [ alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); ' l! d1 Q7 | ~
' \* p* U7 o& ~ } 0 n. J9 `3 y8 H( l6 }) G2 ^
} 8 |& k* ~7 v* _; m
document.addEventListener('keydown', keys, false); - P/ E" ]! _1 N6 [) T4 |
GM_registerMenuCommand ('Clean Hide',& G/ W5 y' Q. f1 q1 V
function(e){* W, P2 t, y* N2 p
CleanHideObj.on(0,1)& A! M: x. L, C3 a
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
( ^3 V4 A& R4 @ E' r9 M});4 c" w7 w( c/ D. o
|
评分
-
查看全部评分
|