|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 ; f6 W. P# N- \5 S4 p/ `5 h1 n
3 v# `. U: y' x1 T9 X
火狐插件,用猴子
' F- b3 ^/ e8 c$ a
2 Q# k% p) s |5 H j3 Xvar debug=false; ! [* `; j! [* \* b) A- I
var CleanHideObj=new CleanHideClass();
- z$ U' }5 R+ M3 J* d4 I: t9 ]* u+ q2 |# L4 f
function CleanHideClass()
% ^: m+ b" R% b7 b{ 7 e! x6 _: \% Y" d# x+ q: O
+ T* p6 t9 u3 \' J; L this.on=function(id,bMZ)% f$ L* p/ X) r& U7 @
{. P: H6 X0 U8 Q2 F, ]* Z1 [
% n- M' j: q1 d2 x1 h/ d if(id == 0); w: I1 r5 i3 ?6 u
{
, p8 F- r! K# p var page=/* document.getElementById("content").contentDocument */document;
4 D' _- y- u) v this.RemoveHide(page,"span");8 p( c" N' q2 r& h. y5 F( u
this.RemoveHide(page,"font");
: C" f% R# N& _" \ s this.RemoveHide(page,"div");2 e/ q- M Z9 }: Z
this.RemoveHide(page,"p");
. @; T0 N% T/ t& f4 C & }- ?0 Z! j. x& e, o1 P8 ]
}: |0 h' q/ u+ B2 U: S) T
: Z! I1 z5 f: f- }) X! u8 ^ }
( a) N; d0 v# n! t this.getobjstyle=function(node,prop)& ~ q# U3 a2 B) I
{
+ ^- L; R9 a$ c, z try
0 ] n, y$ Q3 G1 r; D: [( S {4 j F" Q% |- F& b4 x8 v6 @ n2 M
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);/ G! |5 g( K) t1 l
}' K6 c. K4 s* ?3 M. D0 h
catch(e)
( W" e" w" V# t1 X7 R4 ^& j' Y {
/ b* \! b* m/ z! g, Y1 V3 F if(debug)
! O* W% h# V& j0 X$ t3 Y$ j { A: K' z& q: Z. I# e- N
alert(e.message);6 z( z; b* b# A2 g9 L
}
6 I( N0 {4 F7 Q; w6 K, ] # y7 x/ }4 O G- h8 ~( k+ g
return "200";
1 {8 P% m, b: ~# @: u4 h7 c* g }
. F) ^" T" s$ L+ _/ A }+ ~. t: U; J! B/ g, L
: L3 n: b4 ?9 Z0 U
this.RemoveHide=function(page,objname)
0 b- H- Z" @, O5 l# H4 h- K+ Y {6 n, F- h9 N3 B3 Q
try1 x, }) j! \4 q' V% D
{
9 M# U4 }- N( x# I/ C, \0 { var minValue=15;5 u2 n: v4 G$ O" u" j }" v# r
var objs=page.getElementsByTagName(objname);
9 I& ^7 ~7 C* j9 D# z" G; ?
4 g4 {% d$ f+ j3 f# \/ j if(objs.length == 0) 5 m- M f6 ^1 u& q% L" ]
{/ C; r4 a- @; G& T$ Z3 q
if(debug)
/ z: l/ X4 I2 L1 ~0 s+ O {6 B! [5 W$ m1 u7 ^( ?/ A
alert("no object found!:"+objname);
( z* I8 I+ F2 z0 {# a }2 ^ {3 a* Q! z3 S( H: b4 B* E$ \
}
4 T) Z& g; @ H) g% e p1 S' Z else
, q+ l6 Y; W! F" x. B3 ? {
: b! u) Z7 ^$ l) P, T X
! g; u" G3 \* [# T for(var i=objs.length-1;i>=0;i--) . y- X) q2 g0 t5 J
{4 Q3 E3 T# t; R$ `% Q# f
var node=objs.item(i);
- |! Q& b0 ?0 J) P& D
4 c G: @& ~, Y
7 Z3 K2 @8 J7 _& ~9 X if(this.getobjstyle(node,"display") == "none" ||& l! q1 w# l2 E( V5 ]; [
this.getobjstyle(node,"visibility") =="hidden" ||
+ W- ?% f' o) Y9 Y parseInt(this.getobjstyle(node,"font-size")) == 0)
! S3 d1 |7 ~* F& O {
- c! d4 P0 K. j s if(debug). K. J4 X" d. ]
{) o b$ A" w+ k) `
alert("remove invisiable!");( H M j1 A' |: c+ M$ q
}' t4 A( x8 \' J2 ]+ v+ B' N
node.parentNode.removeChild(node);
/ u: h- V9 l# G; k- N6 H* o
; w9 |: e! Z' K1 S }. ~( \7 e6 `" R! Z0 A5 P
else
5 C# d7 J' W1 ^) v; A* E {6 h4 W) I m: s2 C' G
if(node.parentNode) V4 l3 o8 N9 E! j
{% v! z, H+ K8 @( T' n2 M* n
var orgNode=node;
1 Q' r; f, P! M. f/ j% S" i0 j var orgColor=this.getobjstyle(orgNode,"color")3 p9 ]- w0 o) N3 Z8 s# V0 _% u2 s' O
var orgRGB=getRGB(orgColor);
P3 E2 F. X* h' } }. Q8 Z
) U# `# Q5 g4 f/ K5 \6 Q4 Y! h var parentNode=node.parentNode
# u! ?! _1 r& y var parentBgColor=this.getobjstyle(parentNode,"background-color"); U& w W/ w4 M5 B0 ^: |, P
- _7 `9 h. A7 \( o# B7 m var isLast=false;
. H1 D+ I- |( ]
' R) P: t- O7 A" N while(parentBgColor == "transparent") ; F4 i, p K% V3 W3 R. m
{
. a1 ?( M! D8 t; t3 t
4 P- X' J& [# N
! Q) N6 L% J' x5 ]% ~' n if(parentNode.parentNode == null)# S0 G8 p" H% k$ R
{
& M& u" f3 e; ^" B& w) y) \ isLast=true;
" f; o* V8 Z* j. u; R break;4 w6 F' t2 S3 U, s
}3 |- {" u5 _0 {) g) O+ r( m/ w/ b
parentNode=parentNode.parentNode;
) ^$ v& Q1 m2 f, | parentBgColor=this.getobjstyle(parentNode,"background-color");
; a |& R8 t2 o6 s: h6 T* S2 R# Q: Y) B: S7 a0 b. U- N, H
if(parentBgColor != "transparent")
3 C3 V: ?+ x" @+ t. R {
1 c8 L. I B. H- N6 v2 k4 b ` break;; z5 D) B% S9 |, w4 d: Q( e
}; o0 j+ [% u9 N9 Q2 d
}
) Z1 T; X' n3 N1 O3 e if(isLast)
: i p3 d5 y+ x' e. X) G: z- u7 x0 Y {5 Z7 M7 k: x( g* _
if(debug)
# Z6 B% U- e, s; X {
( l2 s0 e7 ?: ^' v( U alert("last!!");
7 j; \) }0 Y Y# E4 c' R }
! R" ]7 C) @" @% Z8 y5 J if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))' c% w. V0 W. A$ p
{
$ a. l F( O3 p6 E' Y, `1 C orgNode.parentNode.removeChild(orgNode); 2 f3 ^' W4 O9 d- `7 G0 G1 s
}7 `" ?! z$ [' }9 [, L
}
$ V& R1 ~+ A% U+ P3 H) W( S else
: R: ?$ i5 @6 t$ O) ?- g6 M. Y. _ {
8 K$ I& D! b4 z6 w- p, l if(debug)
- v9 y# d! b/ C3 N {6 m$ U% s9 q2 P4 \, P% w0 o' @
alert("compare color and parent bgcolor!");
7 W- r3 n: j. W& ` }' Z3 T3 @3 f4 L1 C% W& ^/ w E
parentBgRGB=getRGB(parentBgColor);3 \8 @3 }; M7 G1 S. f" t( b1 G
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))+ ~- q- h4 ]# g4 T' F6 }6 _, P
{ v9 f( j) H# x7 V9 ^) S
orgNode.parentNode.removeChild(orgNode); " R- a- y: U3 ?
}
: U0 R9 o) `9 w* K0 c0 B }
" B7 P9 m" [" |. k }
( r: W+ x0 S* e4 e }
: p2 e/ G3 c5 i; t3 c/ @ }
. c/ _( h( a3 z- S/ S ~ }0 S: B: ?5 A. F6 G4 |
( |" f6 ^* s- ^! j1 I
/ p( g+ M% n% f var itemFrames = page.getElementsByTagName("frame");" b6 {+ Z2 W5 i6 t
var itemiFrames = page.getElementsByTagName("iframe");
1 @) G2 n( P* u) z4 Y2 Z, Q 7 x! g/ I. R# G. U1 u' w) e: n
var frame, iframe;
; N0 B5 Q6 c# T/ _' S" G if (itemFrames.length > 0)
/ I) N8 x/ A# M3 S" n4 u7 {+ K: A {% d+ N, o4 c/ F. K2 ?) H; j9 H0 ~
for (var i = 0 ; i< itemFrames.length ; i++) 7 j/ {3 G, ~. Y8 ^
{
1 i9 [8 B4 O0 h% N! p- c- ? frame = itemFrames.contentDocument;3 D* v/ t. _* m3 E3 n
this.RemoveHide(frame,objname); & Y' `+ C* D( n: l
}
$ r! z- K( D8 ?1 z4 Q# n/ f N. {; k0 Q }
2 s, h) \0 u" w3 _' `* o if (itemiFrames.length > 0). n/ d; `0 ]7 ^9 }- |. S2 {
{5 {; v4 e; F2 d
for (var i = 0 ; i < itemiFrames.length ; i++) $ `9 d' F4 B) v* v
{$ O3 Z ?7 H; d' q) c1 N) f1 s
iframe = itemiFrames.contentDocument;5 Z+ b( {& a" z5 \
this.RemoveHide(iframe,objname); / Y. ], J9 n' D% Y1 h
}
- t7 Y3 I6 ^/ a4 p1 g# `' Y2 I }
+ g) h- b; f% ` }
2 y7 j" m1 x2 R' d. e! x catch(e)* V) W9 c/ Y% v( I# @5 A) P
{
! S2 E+ i* ]9 {7 u; { if(debug)' C' _6 V- R, x2 |
{2 J, m# f( R9 G1 j. Q
alert(e.message);/ A! u. q& I0 E' J+ l: `$ I
}$ C+ O; y" G$ g
}
; d; D$ ~7 F! V }
0 a1 w8 S* t1 b I' e2 |
- P9 g" C# Q1 @}
7 w9 G: l/ S$ k m# d# _
4 {# K8 s( i( k/ d4 ~2 C0 Wfunction getRGB(colorString)5 P' \6 U/ x5 Y; P9 @# N: {
{, w& v' M6 e$ c9 l& y5 ]2 h* @% D. b
var RGB = new Array;
; p4 F% ?4 `2 t* t, e& l7 F var tempSting=colorString.substring(4,colorString.length-1);" Z5 ~( v$ l; n) ~" b" P
var tempArray=tempSting.split(",");
& D4 b$ a, U/ \+ z
0 M+ S/ o) e6 Y0 g P RGB[0]=parseInt(tempArray[0]);
9 a" W+ Y; m% o& Y RGB[1]=parseInt(tempArray[1]);0 T7 A% ?" k9 k" Q
RGB[2]=parseInt(tempArray[2]);
+ R% e5 i3 ?/ K+ l* r$ B- O
* f- A5 e7 [( B2 I: A" M8 q7 Q/ Z return RGB;2 k n0 [1 }( e9 K6 O1 A. F- r9 m
}9 \# q6 N; K y. o+ d0 m5 X, {% u
function keys(evt) 8 W4 |/ m I2 z9 I3 n4 D
{
" ^3 g7 x: ~1 R8 J) j+ [& d if(evt.ctrlKey && evt.keyCode=="81")
# H0 S4 D- r6 T' q3 [9 P+ M" [/ Q { ; p. w- F# a0 @
CleanHideObj.on(0,1);6 [- m1 J& u3 q% j% Z6 D
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
$ U+ t1 w9 E' L$ ]% T' i# u4 H9 c- ^
) I& e& m+ E9 J8 P! _, r, R' [/ I7 [* ] } ( u7 m" `9 q0 g, c! y' u/ F- t s
}
c& t3 T1 @. l/ k$ k7 r. Cdocument.addEventListener('keydown', keys, false); 0 y' \. C9 h1 C+ c
GM_registerMenuCommand ('Clean Hide',
% d% t* h9 g8 `! M- Y5 T6 D) o: lfunction(e){
( y- o9 S; S9 ~# c4 A! wCleanHideObj.on(0,1)
$ e* u3 D r" |) w# G9 `alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");& @. D5 G% ^5 [; ?& K( Y8 M
});
; C" Z$ j) [% V7 t5 j. f |
评分
-
查看全部评分
|