|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
& _; J& V! e# f1 o. W; f& [6 }9 ~* b' \4 D1 l+ S) c3 O5 Y
火狐插件,用猴子
& H( R/ z' Q% n* Z8 X, M/ v& D
0 V* }8 U! I2 s3 A9 p& evar debug=false;
8 x$ z! {% X2 u. i8 z; gvar CleanHideObj=new CleanHideClass();2 C0 H. S9 @9 p* @7 F
* F$ l2 P( W5 S2 k, Z2 b( i
function CleanHideClass()
6 o% M' Y- R8 q% Y1 j( K/ R' T{
2 y0 u0 Z2 ]9 q
5 i( F; D3 a* b7 B1 r this.on=function(id,bMZ). e: d( O1 h& D1 Y; M; j [, P
{
4 k! f0 l! j- V6 l2 Q1 H/ v/ d& Z
1 I, U3 z% y) i8 {. g9 B7 L if(id == 0)' ^! ~7 f. @ D, M1 a: I
{. ]8 y- U' A+ g0 C C, ]
var page=/* document.getElementById("content").contentDocument */document; 1 G- |5 p4 \) Y/ e2 e0 R5 A8 Y7 V
this.RemoveHide(page,"span");
! z3 W( _* D6 L: ]8 s this.RemoveHide(page,"font");6 s; d& k9 S# w) j$ u9 H
this.RemoveHide(page,"div");. }2 r# @2 L8 B$ e% y8 B0 k8 U
this.RemoveHide(page,"p");) R7 n+ S( X( R4 t G
: V0 y9 d: L' c
}
& @) L* R' G. d
& I, e# y0 x' [6 T# q# b& x# g }
% B% c5 L6 n( `$ V3 g this.getobjstyle=function(node,prop)/ C& v; j6 c, f2 U% ?* _2 }
{
- G" {! X) a u: J! K+ o1 O try
, ?% ~6 U% v* N' N s {
9 J% ~- n) Z8 G4 d' J( R return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);4 P* ~3 ^( m3 I+ a
}
3 Q4 p( F: W/ F$ I8 G catch(e)
1 ?1 D" k& W" ]' I, a {0 w6 v i' k' t+ ~
if(debug)
4 r) b( y/ c. y0 C' S3 ?8 D/ W {
; Y# O z# t, S; T4 l9 j alert(e.message);
& N, |. A0 K8 R& a6 N }
6 H8 x' a- s! ^) i u : E0 {" J" W% |4 _
return "200";
- c# L0 p& A" }0 K7 c }
W9 N3 ^! E' h4 I) r* h' u8 ~ } k" \2 @. i/ {0 d }9 x
% i& Z9 ]2 Z/ |3 u5 J
this.RemoveHide=function(page,objname)( F. H- p; {3 z, f4 \5 q4 t! F
{
2 x( i6 K" @" j0 R* u try r0 n# b+ ~# e! f2 i& x0 u# A
{7 E4 @7 Y3 g; N& H! q) }
var minValue=15;1 b% i: D: i! [! s. j5 Q
var objs=page.getElementsByTagName(objname); - o. o6 @6 q. X+ N
4 n1 F+ y5 D1 g" I' K7 E/ s" P: q0 w if(objs.length == 0)
) |0 m& S5 M; p8 I" u5 D {
, J7 w0 k6 H5 A- n8 t4 t3 d if(debug)
! |: I: i) \- g0 J4 s( ] {6 r C5 E' h7 \8 g& ~6 R
alert("no object found!:"+objname);
# T5 Y- |* N2 d* c" r# [ }' Q I; i& x6 t* [* H
}& V! ]0 O0 M0 U0 ] ?' R
else
5 y6 {: p* V! W7 i3 H4 P( T {7 q+ x3 Q5 g* {2 |, {7 v9 n3 X
2 _6 R9 T2 c/ K. b8 H; b6 C for(var i=objs.length-1;i>=0;i--)
0 o( ?' g# V& G$ y& v {
1 J d7 c3 A9 v3 s9 N var node=objs.item(i); * U5 Q1 D) F2 a+ A) c; u. t# p- X" a
& {2 }6 g- i% _9 c3 m
# ~7 i3 I$ `3 `' r
if(this.getobjstyle(node,"display") == "none" ||0 @0 U5 x+ Q! J
this.getobjstyle(node,"visibility") =="hidden" ||; h+ P$ @& w1 I% Z% x* Q& Z
parseInt(this.getobjstyle(node,"font-size")) == 0)
X9 w5 s) h# b+ F {
# n4 i- w p+ W$ Y9 W. x0 N if(debug)7 W5 {, t3 }5 C* y+ y; P" B8 e
{
5 x! d: Z; r" [: X5 h alert("remove invisiable!");
- ]! ~! h* z Z; [: K& O/ U% Z }
K6 u) G3 q) {3 ~0 j node.parentNode.removeChild(node);
5 e2 k- ^! c. M% Q! p8 V l. }
+ R$ I- |. Y$ [ }
* [" s3 M" g5 Y- F7 d- M else
7 f4 L0 K2 L! d9 {$ y: a7 k# d- p+ a {" f U7 u/ q4 \' L
if(node.parentNode)
8 Q5 A+ g' f3 }$ \4 a) l {9 N; C# d1 B( s9 X. J5 w) G6 t
var orgNode=node;. @$ G# K ?- y
var orgColor=this.getobjstyle(orgNode,"color")
' a4 c2 r' @+ b1 p var orgRGB=getRGB(orgColor);
2 E% h: N+ p" L& g0 e0 s% J5 {" s6 |
0 y0 g) Z0 |; ^ P+ B var parentNode=node.parentNode
( [! f3 L1 R# |. c var parentBgColor=this.getobjstyle(parentNode,"background-color");
1 b+ l8 a8 @- }8 c; M( s: x' K 7 @8 w! o6 F7 [
var isLast=false;# u. D+ X" W- l) `$ [8 s% I( p
* k5 G6 K" r% a' Y) `9 d while(parentBgColor == "transparent")
3 K3 Y1 j, j6 K. `& T$ e- [( Z {
5 K- k; y7 }6 Z; X# B : D1 i* K$ V- W0 f0 k8 L' ]' d. }: k
( C/ Z& G G! B7 f7 U6 ^0 q7 p' d4 H# R if(parentNode.parentNode == null)' M; H$ X. E) S- w# O& Y# P; B+ s' X
{# u. Y0 ?% e/ [1 L
isLast=true;% [5 m3 f& q0 k: _- L- V9 M$ m
break;- ^+ b5 T* j: r1 H+ O" G
}! ?, o! ^: F# u1 S& K" O
parentNode=parentNode.parentNode;; ~8 t8 S' O4 `
parentBgColor=this.getobjstyle(parentNode,"background-color");7 ?- s4 U, ^8 \
5 J9 u4 i/ R- c
if(parentBgColor != "transparent") 9 P4 y# A# E& ^; j9 u* _6 O- t2 q" n
{7 m: x: u* J$ B
break;
5 b( o+ A$ ~7 b+ s T3 T }
+ G# c- N8 y( \1 x/ J1 Z }
- }+ h+ v) u4 g) o- Q; C' a if(isLast)
8 Z% ^$ j4 q s. c( P1 B {, V# t7 t3 L2 K5 h
if(debug)# ?1 P c, q2 `- H U$ A
{
" w% V c6 |1 t% e alert("last!!");
! D6 \2 Q' @" A- i+ {6 i }% f' f; l! Y" j) j% v6 V8 P9 y
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
: _; |' N( f, m; ]4 o {
; w/ B. I% K3 p- D' d& o" q orgNode.parentNode.removeChild(orgNode); 6 `! u1 a T" j$ O8 [" \& v
}
* S# R, y& t6 Q+ M' v4 Z0 ~ }
2 B' @# f$ |# M7 U$ q2 e else
5 X5 J( N$ Y5 U {
1 V, G. X* X) s) j9 k1 q, M if(debug)! B( C. x- X A" D; f9 l" @
{
# ^" Y- s1 U5 a* R3 W alert("compare color and parent bgcolor!");4 P8 ^: a# ], e9 r+ r4 _
}
: p( E/ Y2 n) i& z! q: { parentBgRGB=getRGB(parentBgColor);; N/ A+ [. z1 \6 a) [( Z, I
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
9 _# T5 r! M/ [" f2 O* L {5 L: Q: I! ]$ x3 L
orgNode.parentNode.removeChild(orgNode); 1 K! R% E+ b4 F/ G4 a
}
/ R5 d9 ?8 f1 v1 X( e% z }
* r' A& G3 `. }* k5 Q( D7 u }
: E, i" | _1 K }7 Y( p; L5 I3 I3 S% z
}5 m, ~- i2 k' t
}
% n9 ^1 @4 r7 m* ~& k; j* C: h 0 f* m) A* V l5 c0 c
. j2 `9 f7 l: a4 R3 L var itemFrames = page.getElementsByTagName("frame");( k' w7 g- f1 B0 w6 C
var itemiFrames = page.getElementsByTagName("iframe");
- u" U; b! d O + \1 Z, G( `+ H/ \
var frame, iframe;# ~8 R1 B! b) m$ b; \
if (itemFrames.length > 0)6 a6 U" E: t/ |
{
% p0 C# A' r" X; v4 S for (var i = 0 ; i< itemFrames.length ; i++)
! D# | ?6 x" n3 k7 v; N {8 y( Z6 Z) h1 I0 i9 D
frame = itemFrames.contentDocument;
, J* @4 l: [& J- B9 E' a3 ? this.RemoveHide(frame,objname); 2 x5 Z: q* s+ @+ i
}0 a# `$ i" _$ y# A
}
# W7 ]" @$ \1 m0 x if (itemiFrames.length > 0)
" b3 r0 r4 e$ O1 G {3 N1 U" V3 f5 I6 l
for (var i = 0 ; i < itemiFrames.length ; i++)
2 l* \' o( S; ^. B6 x/ r3 | {: s# C3 S* `: ~6 P* J
iframe = itemiFrames.contentDocument;
8 H j% W3 V' F4 G1 Q. H+ g this.RemoveHide(iframe,objname);
7 j& ]4 P6 A/ k9 Q1 \3 `& o }
/ {7 g! N0 F0 r% q }
! W: \/ u7 y2 U }
5 I z) {8 B- j5 \' E$ c. M0 ] catch(e)
C0 ^% B% D! F/ g& S- H" i {
- s: R0 |: T+ v5 m% d if(debug)
: G! o: H: ^3 r) ] {7 a3 A' l7 g' B( z' u# A/ Q
alert(e.message);2 d0 F3 P4 w4 f* x0 Z. P% d
}& k& w2 M- ~/ f
}1 i$ m, \6 c5 P
}
% W* G9 X' P% h6 B [9 K* M$ y& w 5 f, ]4 S t- _/ ?+ U
}2 M$ F: l4 r" F
" a2 c4 y* S: p- f) S/ m
function getRGB(colorString)
: [) F5 \8 K7 }( t8 h! f5 {5 x7 Y{! U. k1 q- p" x( m7 u: H
var RGB = new Array;( m( o3 }; ~) _. g
var tempSting=colorString.substring(4,colorString.length-1);
4 y/ q2 }8 w! Y var tempArray=tempSting.split(",");
! f* X ]8 D; i" \/ y9 o
$ b6 q$ g# I7 A$ o8 q: X) B; |, _ RGB[0]=parseInt(tempArray[0]);
& C& F) B2 ?% U0 }. w RGB[1]=parseInt(tempArray[1]);' g" _2 _7 U, G2 }! T
RGB[2]=parseInt(tempArray[2]);
6 {: g3 S" {: R5 }
" x$ u* F' k0 x return RGB;' r* D5 J: F$ J/ x0 W/ N* P
}
$ a2 T$ y$ j& ]- Qfunction keys(evt) 9 @/ U. u. Y% F$ k1 e1 M
{
3 U* w* m6 F0 ]0 d4 k( i if(evt.ctrlKey && evt.keyCode=="81")
: g9 l* n0 `9 J8 J5 g" @! [/ ~+ B {
1 A3 ?3 U3 R5 {3 K( k: \; M O CleanHideObj.on(0,1);
! l5 e7 x& F% O$ e! r6 v alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); ( ^& Q! h& W! e" z6 O" @9 t) D
) S8 J! Y7 E! J }
2 {5 p; i0 X8 @ }
4 `* \" b8 _' F' \2 }6 j$ `document.addEventListener('keydown', keys, false); ' b1 Y& U- Q7 D$ I/ s; C
GM_registerMenuCommand ('Clean Hide',
% N- E2 v! H2 }7 u. V: t( @, vfunction(e){' p+ c n1 O7 ]
CleanHideObj.on(0,1)
3 P, w& \& m2 j( e4 T) Aalert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
+ E' ^2 Y& ?) n3 m" h});
% U& Z0 t9 d8 ~7 C# |' E |
评分
-
查看全部评分
|