|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 : ~) k4 H. q! U
7 V1 Z( N4 \6 M H6 z% V( n火狐插件,用猴子
! u6 w% B }9 S7 c+ E, s3 @, ?; j Y; h& y& U b5 \: U8 `% K
var debug=false; # c2 ~" q; O: B$ L
var CleanHideObj=new CleanHideClass();
5 K3 q8 @6 e2 s/ p c0 j$ a2 O1 R9 ^: L; f% Y. F: [8 [& A
function CleanHideClass()
9 J7 x6 W8 |6 u9 v$ i4 c{ / D7 N$ t" Y' M5 v G; C5 V
E( n" ]- @- ~ q7 ?
this.on=function(id,bMZ)
# f) \* [8 H% ~* b# f {( d1 R4 s8 S& F! \% T
% L3 s6 Y" P" p1 i. { q if(id == 0)
# y6 b; }7 q! s# j2 Q {5 l Q1 |0 H/ m1 R# j% f; h1 f
var page=/* document.getElementById("content").contentDocument */document; / {5 a! W, ]6 I8 \8 k( m
this.RemoveHide(page,"span");
6 d, N7 R" p) M5 |" c0 K this.RemoveHide(page,"font");
9 M# r( d* U x this.RemoveHide(page,"div");- ?( a2 i3 V2 i4 O4 _1 b
this.RemoveHide(page,"p");
; N' e& f( n, H/ d# O8 Q ! s( z. P* t3 Z9 t: c" M& o+ L. l& Q
}3 F$ \0 w9 \; Q, {: _% X
% s) N4 q1 n N7 B }
! N/ x# W$ p5 |8 ^ this.getobjstyle=function(node,prop)
; i, e; i5 f' i0 ^8 t. G {
3 ]. n) I2 X4 u' {3 n3 g, h try
- ~2 F M+ ], t( b* f& M% ] {
; Z# b2 Z+ c, o$ V* g return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
9 e+ K: H1 Y4 J$ v6 J. M* g* L } i5 u4 D$ z0 Q0 ?8 J+ h7 n) I
catch(e)0 C W) O9 C% M! p6 p5 d v9 R
{
9 h4 n% @, C1 Z z) { if(debug)
/ o, z7 E$ o* @, } {
* m8 t w3 Z& ]$ B alert(e.message);
. K3 X7 b- [0 f& U3 e* N* z3 X }
. L: T! C3 U* ?; E( V) C `8 q0 ^ . n# ^( U4 J1 ]( Y7 O
return "200";
3 Q! x: ^7 N# e$ |! O$ R& N }7 a( r5 j( R1 n0 l
}+ [ @1 v: S" R' W1 r/ B
, I; h6 u! L+ @$ U- _ N* a
this.RemoveHide=function(page,objname)
" v" a+ z" F: P/ M {
+ n2 r* i* o+ Z$ U try* a9 W' }9 y. N S
{& h @9 t* f/ O( [: p4 i0 o0 B) F
var minValue=15;
; R6 X6 g0 H; t @0 P var objs=page.getElementsByTagName(objname); : M3 ~7 P' B9 e1 F" `9 i, v6 a
9 m, p/ r0 T" I$ N1 {! I if(objs.length == 0) $ X2 ^% t* [, m, S9 S
{
1 E$ ~# E; Y/ m5 B. \% A if(debug)3 q5 Y/ Y9 t3 Q! b2 t7 P3 A
{' @( V r. q/ y9 l
alert("no object found!:"+objname);
: U: n" } p/ U. f. m8 r }' J- C4 L( H. ^5 R) h5 n# v" Z
}
# C; [! v+ y; q4 ]8 Z) ~; X else
8 f a& D' Q5 F% c+ e {1 k# E4 a) E% Y) O
' `0 X( ~ J j( L& n# z for(var i=objs.length-1;i>=0;i--)
" l% a- l+ I; d* K1 F) | {, X& t7 \6 I4 [7 y
var node=objs.item(i);
: O F' i1 {/ \" r7 V* ^% H- W - v! S$ S |9 Z/ `1 l! h
; c7 R. g* m" ^( u$ R G: K3 d if(this.getobjstyle(node,"display") == "none" ||
3 N9 a8 G. I1 h B this.getobjstyle(node,"visibility") =="hidden" ||/ p5 B& P4 y. o
parseInt(this.getobjstyle(node,"font-size")) == 0)
( t) C+ I6 c1 G" Y- K F* _: A {
" K. o6 N. S$ W( s' H if(debug)" a8 X, [4 Y1 t. `/ m
{
# Q. T3 U- H h( n. g alert("remove invisiable!");8 B3 f, ]- ]/ D9 N
}
- F$ u; B2 e1 y node.parentNode.removeChild(node);1 w) d% e( h- y$ p
; O, R: u$ F: m) ?" a
}" T& |8 G) t x9 {, S
else 8 o, c; ]! [& E8 V
{8 W# n2 [/ A l# n6 _9 P4 _
if(node.parentNode)
+ ^$ h \' t8 V4 p$ s0 }0 W' e$ b3 m {4 W* p8 F$ o# R4 o0 V& u& E, G: |
var orgNode=node; G/ x0 b. e2 C8 \/ P2 T0 ~
var orgColor=this.getobjstyle(orgNode,"color")9 p" Z7 @ ]4 o0 X0 V/ d0 X
var orgRGB=getRGB(orgColor);
$ S. R, _$ h A. I2 B, l
3 R8 F0 C* g- N Y var parentNode=node.parentNode
. f% W) a: Z( ~) ` var parentBgColor=this.getobjstyle(parentNode,"background-color");0 J: V. Y* j5 b/ R
% [& y o$ k z. `/ @
var isLast=false;
# e$ `( u/ U) c7 p # B3 m- k/ c/ x3 h9 N$ H
while(parentBgColor == "transparent") $ o1 g! L: M+ H3 D7 J7 O4 [' Z8 h
{
" g( j, T' I( o: Q3 c7 _ " d& W: x" ]5 M9 G- Q
2 p8 N& E. v- N$ \8 a! q" z
if(parentNode.parentNode == null)! V: \3 O! {, V% C7 Z4 A
{/ W! j+ @3 @# x0 x; A0 Z( m
isLast=true;( J+ ~9 n0 j% _, T& p7 F% K
break;0 C2 v6 n1 a. |! B' B$ R, P
}
' A9 ?+ w/ d) N parentNode=parentNode.parentNode;
: _8 p3 M8 {9 }; Z$ N4 o j% K parentBgColor=this.getobjstyle(parentNode,"background-color");
# H: U* G+ c* S# C# u, W, n& y/ g" V$ c i3 A! E4 |8 E& d
if(parentBgColor != "transparent")
! l/ ^" f; u. K6 w2 ^% R: n {
( v. Y: H1 s( c* V* P7 z7 R break;& @! j& V/ |: g5 |3 i" l2 Y% g4 q
}
# `+ `2 g. N" {3 }" l }
/ X3 K: c5 G# r if(isLast) , Y. B( F' ~, w7 I
{- }9 G" F: ]3 X2 x. z: B: A: u
if(debug)
" b, B7 Z) w0 ]- o" v {
( V* ?. w4 T3 n! s alert("last!!");2 {6 C$ q2 \& I% W: O2 Q( t# K d
}/ d2 }+ b) v# y& o7 M. Z& C- X! z
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
' P, K2 W7 _4 K" r0 Y {
9 ?: [6 f6 x, c orgNode.parentNode.removeChild(orgNode); % b) r7 f5 {( a; W9 S- a3 _ m
}
+ Z" t& Q4 {9 J& u8 I }
3 B7 T' f6 y- ~, I) Q- q else' m7 h8 A7 O: l+ U$ c
{
. f6 X; N# c- ^+ D/ Y if(debug)
9 v1 J$ a, i/ V# c# Y- ]- \ {( S$ S7 r0 t9 X
alert("compare color and parent bgcolor!");& l8 p0 J1 [+ V9 D% o
}
; t Q, g& S) P, a! B parentBgRGB=getRGB(parentBgColor);2 X( I: I4 b# M% S% b9 B5 d
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
8 U, w; [ b9 B {
6 _7 i5 q# v( b X: M orgNode.parentNode.removeChild(orgNode); ; d7 L9 }; h0 S r+ h
} Q. k- d- Y5 E2 P
}
8 w! ]9 h4 K" v7 ], ^# V* c }/ B9 i/ ^! P% K2 w2 p
}
( v4 J9 [, L) A* [# A! G }0 z6 c# x4 I; o/ P3 p7 ]
}
& W: T0 g7 k5 v0 \3 _ % g& o& c% ^" R2 B' M
/ [/ R) K! P- }" t* W var itemFrames = page.getElementsByTagName("frame");
( X s- {5 T& d7 h1 E var itemiFrames = page.getElementsByTagName("iframe");) _6 O* u6 H* X# n
* \* b- _9 {0 [$ @' L, w. j, }/ @4 E
var frame, iframe;0 g2 ]9 f1 ^ q3 w% _8 s, s
if (itemFrames.length > 0)
$ j2 I; `, x8 a, f" a {1 G; o- z/ S0 O
for (var i = 0 ; i< itemFrames.length ; i++) 7 w! F* ~9 m" J. b. y/ v+ f( O
{
( ]$ I; K2 r" F* X frame = itemFrames.contentDocument;
# U$ h3 @+ j- N; { this.RemoveHide(frame,objname);
. o% t( t( T! V- o# y }, w& ]' h- C; x! t$ F
}6 w8 I$ g% ]( \7 d: b
if (itemiFrames.length > 0)
/ y4 z! c y" K" X i: R5 y {. _! ]6 n: X1 @& a- @
for (var i = 0 ; i < itemiFrames.length ; i++)
( p* w3 L& u5 H3 k6 t3 t7 K {+ u, p# K, D/ z% R& O$ Y
iframe = itemiFrames.contentDocument;
, U5 }# L7 N, v. y this.RemoveHide(iframe,objname); " K* f n1 W8 B& V. k) F6 ~
}7 Q; m/ }2 P" V6 d- R" [% h; T: j
}$ [& a7 j& \! _- G! [. [7 u
}
# _- Q/ u4 F- \& j5 H* ^+ \ catch(e)* w7 p$ b# d2 m
{ T) ] @' }. T/ @* g% l+ E, o
if(debug)2 Z# C1 ^7 ?# e5 E- k6 q+ [
{
, |! `. e8 {' ]. Y- s2 f( W6 t0 K4 x alert(e.message);
' J' z! n/ y* Z# L8 i }! U% a0 D. b. F' s" h- {4 ]; M
} F! ~, A: U2 v4 Z% r2 C
}
4 H- X0 o; D" X2 H
6 D/ j4 Z3 f2 T/ T}$ I/ _( l/ w; u
. S0 w a* K' l5 r5 s: mfunction getRGB(colorString)
. b3 Y5 B6 h+ @! x{: \+ l [! [9 u K" F9 ]; T
var RGB = new Array;8 Y0 Y1 u* ?- K K
var tempSting=colorString.substring(4,colorString.length-1);
6 y+ H8 y1 j' P* e+ N$ Z var tempArray=tempSting.split(",");
/ t' W& S7 H* j$ g: Q# n/ B
4 `$ K. t( l8 r2 G RGB[0]=parseInt(tempArray[0]);2 P a; b0 ]8 i* N% J" M7 d
RGB[1]=parseInt(tempArray[1]);
2 O' Q6 J' e& P RGB[2]=parseInt(tempArray[2]);
( o) \" Q, I. z- r- C, c$ ^
6 b+ G3 i, ~3 \. Z: q! A4 x return RGB;. ^; _; ?/ Q5 {) @6 j' d2 j& v/ E$ `
}
; |' c' j9 `7 _function keys(evt) " x) P. I4 ]8 O: z7 L- z, e9 s
{
# R+ o1 q( S8 K" F8 K if(evt.ctrlKey && evt.keyCode=="81") 7 v5 x. R+ y$ a6 L
{
& ~! _' _$ `% M) R3 H/ I$ P CleanHideObj.on(0,1);
, Y9 P) C! K- Y1 V+ L alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
) g/ W, [& K$ X5 G4 a; [# l
9 ~5 P" ~; d: j } 3 D4 S/ u M6 `; c- p4 x" Y
} 4 S/ s* }+ }, w: e6 k& v- U
document.addEventListener('keydown', keys, false); 6 R. \6 Z* ]% y' b; e. r0 F; m) h; W3 i/ Y
GM_registerMenuCommand ('Clean Hide',7 |0 ^: G9 q+ m6 `; Z# H* B U
function(e){
' C* r. _3 c3 m; F$ ^$ j! }CleanHideObj.on(0,1)
& ^: R1 d9 |3 J) m9 Palert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");2 y3 A: s6 y/ F; o8 E
});
" r+ R: F" m: Y |
评分
-
查看全部评分
|