|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
, }) U# Q( y! |7 l6 X
4 t6 E! w# S. p" A( S! K5 O, ]1 L火狐插件,用猴子
* e+ @% b+ |, I6 {( Y, b% A4 p2 B- F' H- U9 U8 B
var debug=false;
; y& V3 \) [, w& b( i1 Hvar CleanHideObj=new CleanHideClass();4 m( J( h& X2 \2 q! A8 X
, F5 G* S- c/ {; ^; Z# V) P1 Z
function CleanHideClass() : W% R9 {4 a" P0 c/ Z
{ 8 M3 z2 D1 @6 |' h( d
& x% ~- p+ j! o4 M5 m4 a
this.on=function(id,bMZ)
' \: S5 C e _, P# F9 ] {7 m2 o$ t/ e6 k6 ^
# d D0 a2 J" t. R3 d' a if(id == 0). J6 k) }0 y2 l3 |
{! ]# N% @7 k; P( ]
var page=/* document.getElementById("content").contentDocument */document;
) S" M. x3 \) k9 h4 q# S this.RemoveHide(page,"span");- ^& f2 X: \% Z. L
this.RemoveHide(page,"font");0 h0 E3 Y+ q- B: Z5 Z) S9 M4 b0 b
this.RemoveHide(page,"div");2 `' J3 ]$ E- C! X6 y! E5 a
this.RemoveHide(page,"p");9 ?! f$ i3 o1 ^) P4 v
/ l" N2 m+ V" X& d& s6 I8 Q
}
]1 ?+ F" h" ]* g, z6 R , V* |! i/ W: _+ D& i
}
8 \3 ]3 H2 ^* t/ q3 d( Z7 v this.getobjstyle=function(node,prop)
" N, A7 c/ l5 z$ H- l9 F' P {
6 }; }3 |' S" M# L try
: Q/ t% s2 s/ }8 p$ E4 D {
: a( X7 p& W2 l) s; [ return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
! s/ N: ~4 a h1 t3 c- F }2 n. z# b B. \4 \ C
catch(e)# E' ^0 J% [- ~% f( i! r; I) d1 E/ D
{" g% t" d( f: y
if(debug)* ^, g' B7 j- ?5 V6 {
{
! h% ~/ i4 X% b* ?) |" a alert(e.message);
. _ U C9 l$ d4 m5 L( F/ l8 e }6 o F% W; V7 Z! y6 R0 ~
' L$ J( C9 L1 p5 _7 W
return "200";
- y3 u) x" T8 Z1 q( M }1 a& a1 E. f% Q2 v
}
' S- q# ]5 C5 J( o" g " w2 }, I+ a' q1 q
this.RemoveHide=function(page,objname)/ x6 `1 L" O" ?( ]
{
9 c/ s* H5 W! B1 P0 X s% _ try# T6 Y4 E% h$ L" {2 q
{" {& g1 y! b: o
var minValue=15;
9 V1 }7 m+ u& C. z/ I3 m var objs=page.getElementsByTagName(objname); . s2 F' [$ j; G% _+ {( p8 `
$ Y4 l X7 F8 v if(objs.length == 0)
5 s9 i; f8 s! }3 |3 R: O5 F, A {9 I7 I; ^1 R' k4 t- ^% N6 ?& b
if(debug)
2 r! ?3 X2 v. G {
; P1 X. H! D! o* H. T* p/ j; T alert("no object found!:"+objname);
, P; W( a8 D: s! H* r& h }
# D, u) A& O* g9 E. d# c; l }& ]; H. Q' p4 _. X; c n" D
else8 N2 i5 @1 V) Z/ i
{
% H9 U1 z2 m* C" [ O
5 e+ g% p |$ J% E/ \- s for(var i=objs.length-1;i>=0;i--)
6 V3 w1 N3 E9 N6 n9 i2 q7 A {
3 C( g0 v0 e: E/ ]$ K var node=objs.item(i); 8 s% t+ f$ J& u% U3 w ? i
" C" G+ f8 M% _/ z% C% B" Q/ v8 T ) [* |- g7 e/ e; a; S# ]
if(this.getobjstyle(node,"display") == "none" ||
: m) O1 P) o" k* _3 P: X this.getobjstyle(node,"visibility") =="hidden" ||
0 p' m( ~. J z: F1 S/ @1 m% W parseInt(this.getobjstyle(node,"font-size")) == 0)
+ Z" o @0 J- e( o {
8 f! |' H$ z' O O2 ^6 |/ j if(debug)
+ G \( }9 u9 _2 ^% d4 b {) ?1 ~' ~8 I6 t# X* k, [
alert("remove invisiable!");
1 Z( D$ t& V7 L% K/ ? }
& m! C' R9 {# G2 ~; s) r- ` node.parentNode.removeChild(node);8 p6 w* u3 K; y6 O4 `
4 Y& ^2 t. k" y1 W8 m }1 T% M5 K" O5 f0 J0 K3 F' ?
else
, H1 n/ d/ m; M. m9 ` {! z& P% b' d" }( ^& f3 x
if(node.parentNode)
2 P3 {; R5 K d' b: ~ {
7 G$ j$ W# Y$ ]& U& k8 k% e1 P" F var orgNode=node;' s& R* x+ ^6 H v
var orgColor=this.getobjstyle(orgNode,"color")$ b# I5 m3 t* k8 L
var orgRGB=getRGB(orgColor); + K+ {. \8 [( l. B9 h7 R% c
G+ b5 J! C, K1 g' d
var parentNode=node.parentNode: c; {$ n) p3 r+ i
var parentBgColor=this.getobjstyle(parentNode,"background-color");# s, l6 P$ P) Z& n Q
+ u. V0 x( }/ f. H& L& ] var isLast=false;
( H y+ a. |7 u4 W% A, P) O7 R
- H! o7 @0 E! w. O0 t; g while(parentBgColor == "transparent")
5 H# j" _; Q9 `! d {0 y, h5 v! U. ^4 \* C
* h" @; S* X, C
! d$ ~( a- Z: ? if(parentNode.parentNode == null)
2 i1 w. R* [9 I2 I {
7 a6 c. X5 ~' V/ D# t% I, i isLast=true;8 N/ b" A y+ A0 N
break;
: G% c. z2 u$ S! o6 H }. b* y* W/ G1 ~
parentNode=parentNode.parentNode;
2 M8 L* |3 y9 S parentBgColor=this.getobjstyle(parentNode,"background-color");& V2 c- z3 }1 d: }" i: n) M( k+ p
: \2 J4 N9 d g9 U `; I J
if(parentBgColor != "transparent") 7 P3 X3 ?* u" a
{: n5 \! @: k+ N/ M
break;
8 T9 u! i) Q( t+ G }& I7 D4 n6 B0 `* C+ j, C
}
9 V' q- T7 R4 ? if(isLast)
/ g6 ?# \4 J- k$ @: ?' d {
, X9 |/ `+ T* Z1 W: J, G% q* u if(debug)4 `. R" b" H5 D
{
6 i. e' J l* o alert("last!!");
- M7 ?9 w7 K, K( Q8 g, y/ E* Y }
/ |; c9 l" l; x2 B; H if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
0 j' s; ^- q3 f( h4 s0 L {
4 D$ c) v5 t+ e7 _' ]6 ]9 p: M0 U) g orgNode.parentNode.removeChild(orgNode);
- H3 |2 h# ]- X) |5 S' z }
3 p: s4 j) k" C( d7 X3 U }
/ `; a; B" F; u" s0 \ else$ V+ g$ X% `# o1 d, b( `
{
a* A+ S7 z+ d( n! V* P3 A if(debug)
# z: `& v2 G7 [, t5 F x5 Q y {
8 c' R' [9 e g" ? alert("compare color and parent bgcolor!");+ [( i, z0 C* u9 F
}: e! I+ \( ^( j3 n( S
parentBgRGB=getRGB(parentBgColor);
1 ~% E0 @+ H9 x5 E if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
2 z4 U9 ~( {, h. m {/ N9 `( `/ v" Q2 S) u
orgNode.parentNode.removeChild(orgNode); 4 I' t4 p$ b5 j3 o' @. }8 g7 y/ z; N
}
B- m$ s3 D! z; A" D }; A8 N, U" k1 n$ U. [
}
& L/ d: t5 y4 j' A/ _ }
- [, z! F% u9 a }
. P7 a# H6 p% w; S* [ }
1 b1 ~6 @; ?( p! Y & a' ~" M; l" q" W; Q
0 C! T6 L, A! f8 o* ]
var itemFrames = page.getElementsByTagName("frame");
8 @ x1 I$ U: ~# _8 n# x8 f var itemiFrames = page.getElementsByTagName("iframe");. `. c9 a3 {. ~1 ?) b) \' |
: ^, O0 e! A3 l- O var frame, iframe;- @3 F2 P" G, B0 G, D
if (itemFrames.length > 0)/ n6 `* a+ ]: i4 C: {# S
{; ?4 [# ?- M/ G* O- T3 N0 R
for (var i = 0 ; i< itemFrames.length ; i++) 6 m% T: N {& O0 V _
{
# u. t: Q7 W3 m frame = itemFrames.contentDocument;; d( K) t( S5 z
this.RemoveHide(frame,objname); % M5 p4 k% G" v6 f& F2 v
}
! ~& ]6 H6 Q6 Z( W- I. R h }. S' T% }6 H/ p8 V8 f' d
if (itemiFrames.length > 0) i& r0 U3 W9 u6 N
{& v6 b7 }" O+ L& ]6 w# z
for (var i = 0 ; i < itemiFrames.length ; i++)
$ e% D2 Z- Q) u+ _/ [' X: `8 ~ {
, {- r& V% @; O1 q3 W5 ^ iframe = itemiFrames.contentDocument;' G8 {/ r# H/ j- r: V* g
this.RemoveHide(iframe,objname);
! s; d! l/ x- P9 [- m2 M5 n }% D6 [( ?! C9 [7 {
}
$ |: p) m0 b/ @4 ~+ d }
8 A1 P9 F3 u! I V+ w catch(e)
* r" J! l/ Z) H' Y* [9 s" r5 `6 ? {
1 z7 s, ]8 j) L, r& K+ B if(debug)/ \& n4 s7 q# o" `( A
{/ o9 V/ H( r" \6 Y, A
alert(e.message);
# L4 m* m+ V2 p$ j) B }
# \5 |) T% u2 _9 s( |% h }7 x' S! ^$ {5 `) t; ?+ \! ?5 @& A; r
}) a8 h) y2 W6 _- V( }$ ?" d
6 e. W+ w0 e# M: e& j}& l7 |) H+ J3 [: U$ z
& \, M3 t7 L* y& C
function getRGB(colorString)# T4 U' O7 A9 P a+ r( o* S) k
{2 B7 u4 I m8 r4 W# _. _" J
var RGB = new Array;7 `: F: K" M- f* \5 _ w& ]
var tempSting=colorString.substring(4,colorString.length-1);
* Z. V2 j5 K6 f) o6 j6 s- B m+ m var tempArray=tempSting.split(",");2 X4 t' m7 z3 @9 c q4 g
! H# \$ R$ R0 {9 ^; a0 L RGB[0]=parseInt(tempArray[0]);7 ?+ ^- b6 l" e: v$ Y' g
RGB[1]=parseInt(tempArray[1]);
6 J$ b+ m4 [, Q o RGB[2]=parseInt(tempArray[2]);
( R/ H* Z8 ?7 A S L; v" ^ 9 ~+ M) x" d( C+ b
return RGB;
$ k) P; M" ]5 `7 P}8 i V- f) h C+ S- k) ^& r
function keys(evt)
4 N" n7 i X3 H& X4 J G3 u* ~: S {
1 i* M1 L/ L$ e$ o( h if(evt.ctrlKey && evt.keyCode=="81")
5 r9 l$ w* k. k6 a, g& V { 4 C' c2 J* S" U4 m o- n* J. W
CleanHideObj.on(0,1);
+ {6 J+ h2 W+ o, c5 e! J alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
2 c" A$ u' _; \
9 e0 V6 k2 ^* E } ; `$ |3 @5 f; E( z M! O4 n3 ^. ~
} ! V6 E9 ^% |4 K6 R
document.addEventListener('keydown', keys, false); : ? v( Q3 Z9 d/ \
GM_registerMenuCommand ('Clean Hide',
) @- N1 a4 |# q4 l- s8 c( s; Zfunction(e){$ M; u. B4 A+ \: U
CleanHideObj.on(0,1)
. Q) Q4 _. A: @+ U! B ~alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
! I! x/ ^4 Y2 x9 i- ]& U});
2 Y; g5 A: `+ b2 s8 A( S |
评分
-
查看全部评分
|