|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
3 k p& M5 o- G: F, @: { Y( Y4 A7 P: }8 y8 O
火狐插件,用猴子
9 u5 V1 ~7 u: J D3 b6 \- _5 R1 s9 C7 n9 h% w3 n* k G, C
var debug=false; & [: R2 C0 K* n7 M0 x* k7 i
var CleanHideObj=new CleanHideClass();
2 z6 K* d- G3 D5 w; }$ r R& X
, u& _0 H1 z% e: e. ufunction CleanHideClass()
8 `7 S r" `: _1 t6 R" E C{
3 m4 J+ g: M j. @6 g/ K5 D7 U2 P
) C) Z' _2 N4 F this.on=function(id,bMZ)0 u1 D/ c/ u* w
{- @& `- i0 }: y1 D! U2 k
F' C1 p+ U S# f if(id == 0)
$ K7 |: w( A) E- ]' r. q) X {
6 S0 U, @0 b8 n2 {/ c' N+ ` var page=/* document.getElementById("content").contentDocument */document; 3 t6 X* U9 r) A/ {
this.RemoveHide(page,"span");, G6 G R$ Z( w7 n0 }8 n" M
this.RemoveHide(page,"font");) ^0 }' h& f! z8 Q1 m0 V; ?
this.RemoveHide(page,"div");5 {3 h9 O: k4 E7 r8 v' R, f
this.RemoveHide(page,"p");
1 [/ J& b# W* P/ z0 ?+ h2 L
Q; K1 N" y3 a" H& E% A* l2 _ }
: L# D. z- Z) U / `5 Z/ ?6 j& D- \" W6 Z; f k. p
}8 w3 P' c% e- l/ o3 s. f l& X' K- C
this.getobjstyle=function(node,prop)$ W; \# V ]6 r( X
{, v& `4 s( m. c7 k5 E( R6 n; |5 p
try! l! _! Q5 R1 ]
{- B8 h e1 }& n- R# }+ ?* }$ V
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
2 f }5 s3 ~' |/ Y9 d( g5 ^ L }
4 D2 V6 \' h% [$ j$ { catch(e)
( O8 [, Q9 c5 h4 g1 z# ^ {: E! |9 k$ E9 j& c. y. G n
if(debug)
7 ~$ q' a+ ~+ \! ` {- @& T5 R- H2 G$ Z/ j
alert(e.message);
+ Z8 S9 Q7 Z& L( N3 ]) n }
3 [7 P* C9 J5 y1 ~7 ^$ e( u6 M
, e! c# ~$ K; q4 {4 I return "200";
9 Q6 m* p7 N$ |' i% j2 ]$ ^ }
, t& p% l7 X# S4 M }
" y. z9 f$ ^( I% b+ l( _* O
# \# A$ [7 V6 b$ F1 t7 m! D) W4 w this.RemoveHide=function(page,objname)
/ m d/ F, Y, L3 {4 d# R {* u6 u/ I! X; O2 g' t/ L* Z
try
! s+ z2 A! v4 X2 | {2 t: F! F# P" `/ G9 l' ^
var minValue=15;, k6 f1 O2 `# E: ` F" B! Y- h
var objs=page.getElementsByTagName(objname); - R1 n) N! u( q" N$ B
2 H' E5 U0 E% Q1 ~ if(objs.length == 0)
0 M/ ?% m/ |- |/ T8 b: f; i* [! ` {1 e" n7 k$ s; k1 v4 g
if(debug)
# a H+ H) T# t { G8 H, O$ X) w* K% }! g
alert("no object found!:"+objname);
+ S3 ]6 \* ]7 }! a! |& Q }
! | r& T7 ~$ B( o- k- D }) Y9 f9 n. r/ f1 `9 _8 M
else d6 a: F% ^4 E; k1 [, d
{' b* Y# V) y) e: I. {! y% A" m
. d, L3 [) {- ?6 Z. `) | f$ V# h for(var i=objs.length-1;i>=0;i--)
) q( a+ [* U, s- h3 `; u, s& B* p {6 |! Y: Z' f4 S; b
var node=objs.item(i); - i% Q! r. ~& Q8 b! Z1 v( _2 ~
7 z2 W+ y; d2 F* {
8 `8 T& @( n- G2 B7 L3 D0 Z p0 R/ W if(this.getobjstyle(node,"display") == "none" ||
2 d/ x' V# A6 T' r/ F1 y this.getobjstyle(node,"visibility") =="hidden" || i- n8 c; z! ^- s( ?
parseInt(this.getobjstyle(node,"font-size")) == 0) , p# Y4 w7 O. H) T" T% z9 E* L
{+ I/ q4 P0 T! |4 ^) S: d2 N
if(debug)
# H4 }8 C7 P" ]! v, h( t {( n% P; O* _* D* H$ z8 K+ R9 u
alert("remove invisiable!");- d# v( x0 R) [& {4 A; X* J
}1 V, W# _6 [ Y! l/ J9 w+ @
node.parentNode.removeChild(node);
0 C. m! W! i; {0 W! j/ _ D. S: ~3 V $ ~8 W7 P; a1 g& w1 a z+ X
}
; ~) W( p) x$ D: f, w0 @& f8 W1 U else
% `1 x0 E8 A# t$ q8 ] {
1 j5 _# y& m4 N# k3 W. i) |% a if(node.parentNode)
2 W+ T7 X+ h5 h8 @) u7 Z: z8 `. ` {
6 D( k8 p% h; o3 D3 a4 I1 M var orgNode=node;
9 B) v/ \* m0 q( v2 H$ S- J var orgColor=this.getobjstyle(orgNode,"color")' g) X, `$ s( q0 X4 z4 [
var orgRGB=getRGB(orgColor); . t$ N( r7 |+ N% @* I+ u
4 C8 z4 J! Q9 w
var parentNode=node.parentNode
* z8 \, F7 }: p% `: V7 Z8 r var parentBgColor=this.getobjstyle(parentNode,"background-color");7 z) N' u: t w: N5 d2 ~- u2 f
9 \- b! v8 E* V" K" H# c, s
var isLast=false;. L9 p) S: n2 U* B3 t) \
; w, B0 T2 k# _0 D4 t while(parentBgColor == "transparent")
8 s7 r2 @( E8 `( ^6 s7 Z. @2 q {
1 S7 V( J/ e+ k2 b # |! Z0 ^% Y6 Z" g- a
6 G. }. r0 [- J# z5 o9 @' S if(parentNode.parentNode == null)8 u+ S U; u8 f8 l! A; K
{
# T: w8 @) h$ l8 h, R) u isLast=true;: e* u& P/ N4 O3 H5 [6 a
break;, G6 S/ Z$ P0 h" }0 {# t
}
4 P( y* F5 k' ~$ `7 f parentNode=parentNode.parentNode;3 A/ d. k5 |' i5 o' t4 u! W
parentBgColor=this.getobjstyle(parentNode,"background-color");
. `7 v9 A, l4 c
9 d E: d2 o& p$ B if(parentBgColor != "transparent") 0 ^' a/ D, o! a }
{
8 A2 w, y* h' s# U* | break;
; h3 ^ ]. V# E, u, ~1 \2 |! w- ~ }
: I B( v) K2 T7 g }4 d( l5 c) V, X( d/ T6 k* ^# Z
if(isLast) # B& g j( E8 N( P J- Z, s+ D$ z: ?
{3 a, C! g( v* ~; p6 \5 M
if(debug)( w, _, y( e4 `$ p8 Q( z
{& e; H" k/ G( z: L* ]. W! |! E% ]7 }
alert("last!!");4 Y1 I) E* h( F' _2 p
}
3 f6 o3 h ]0 s) r9 U if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue)): I; l1 [2 g: a7 t- M0 v' v
{0 R4 Q7 x; `* Z. ?
orgNode.parentNode.removeChild(orgNode);
8 ?; O& R2 { c2 f% V% F. ]; v _2 H }
" k+ B5 D# ^ ]+ t }
3 t. C( R9 R! X3 t else
( T* V- O6 A! G( _) X {) O' ?3 S% r# g: y' e
if(debug)
8 H/ i+ @3 T4 S" ~* O {
3 m! c! r5 [; o c' @8 x alert("compare color and parent bgcolor!");
- \* I i0 Q" r; k& ? }
6 {( p/ F$ O1 B' z0 ]5 {" N parentBgRGB=getRGB(parentBgColor);% g `5 A; \) P- Y) K1 B
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
6 `# s# A) r' c {
3 z- v. d* s9 U orgNode.parentNode.removeChild(orgNode); ( ~ b% B" @7 v; f; {1 w( N8 n
}
# D2 M& I S" [5 Q& Q$ \ }
% n% G/ J2 e* ? }; s8 t' f$ O( `6 @; f+ l$ W4 z
}
( e9 A+ _- }1 Y5 ^; M& @1 C }
+ e. J% D; l! x4 K9 Y; B+ X4 b }
4 H4 t7 q" O& |0 ^1 e7 ]4 l; l ; S, k8 F0 m: R" A' V
c2 C1 H# Y3 D* b
var itemFrames = page.getElementsByTagName("frame");# U. s( l- O) v& f8 e4 P: d
var itemiFrames = page.getElementsByTagName("iframe");
8 j2 X+ w/ D. _; O9 H! R( P0 a * K# i2 P5 I$ U: p, ^' P
var frame, iframe;
9 {6 H; T* k% P if (itemFrames.length > 0)
/ A6 _7 W0 w5 I! w1 H* d {
! M5 H" G- | ^: r! w0 Z+ q! K6 D& ^ for (var i = 0 ; i< itemFrames.length ; i++) . L( O7 s$ Z# |0 v% b+ x( |( B9 B
{
6 _- B2 o# a1 g( v frame = itemFrames.contentDocument;/ A8 E! t" U/ y# m) _4 b' X
this.RemoveHide(frame,objname);
0 D0 R. L' p- r3 g }; t- C& y/ U% G2 d7 A% ^
}
( d6 d$ S+ z" b9 L3 c if (itemiFrames.length > 0)
/ q ~+ |$ O6 `/ A$ U, j) X( k {
4 e8 G; j8 H$ [1 s4 M) ~8 W for (var i = 0 ; i < itemiFrames.length ; i++) 6 _( q6 R7 M! C0 b8 ]* V8 i+ ]
{
: D& W4 V b" B3 q6 t: d1 s) E/ d iframe = itemiFrames.contentDocument;' I5 I; k5 C9 p: m* N7 n
this.RemoveHide(iframe,objname);
! p$ D' U- _4 c' ^4 ^ }- r9 t; p- h% Z' B$ R
}
g8 L" ]' ?$ H }; @& d- U& ^6 V" ^$ d
catch(e)
9 \* z A' n- Z1 \& t- I {
, T. |' ]+ J- E* K- U1 o# j0 k if(debug)4 `6 K6 b& \2 @5 o I; O& t
{
$ P: [9 y+ l. C! J; ^+ W alert(e.message);
" O9 T8 A, k6 Q7 x }! T& z! M$ }+ ]3 I( E6 f
}
3 e- k8 Y& K: \* Z6 x( x }
& E( X- h$ g1 S; t
, _' v. j% @& k3 ?. Z8 b}! ?6 A1 o* a& @4 C7 D) o
4 i2 Z+ f* ?+ w( K! a. z
function getRGB(colorString)9 O4 P/ M/ f9 X- N
{# a3 O3 U' e5 Z: X
var RGB = new Array;
& ]3 f# b: X6 {5 i* r var tempSting=colorString.substring(4,colorString.length-1);
2 H) c( z. {3 ]% ]8 ?# y var tempArray=tempSting.split(",");& Z( S @6 H; h- M2 v9 p$ \' Y
; L7 R0 V5 k- X, L* P( _$ j
RGB[0]=parseInt(tempArray[0]);) a2 P) ` d- e: \+ u( T
RGB[1]=parseInt(tempArray[1]);) N1 X6 U% _5 M. c( J0 h
RGB[2]=parseInt(tempArray[2]);
$ n) U4 x5 a1 d( g; Z$ P+ H ! `! ]$ M/ ~$ V
return RGB;
1 Y: H" F; }8 p3 y1 B- ]3 b}
8 M' d8 P0 B: Nfunction keys(evt) 6 B' U$ T/ {4 m3 r# B
{
- x0 S; {$ A# B) L+ M. K if(evt.ctrlKey && evt.keyCode=="81") ! @' u+ y! h0 E) T3 j+ `
{ " i5 {& Z) F# l* ?! o
CleanHideObj.on(0,1);6 H! W( ^. O' K x
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
' V# H5 I/ o2 R' S3 `$ z0 H 5 m& y B4 W6 ~1 m- k) x
} ! o$ a9 k& \2 A0 p) w# o" z9 o
}
0 V" o0 V- E# L5 Fdocument.addEventListener('keydown', keys, false); - g* D, \1 {% ~3 I9 @ `0 N
GM_registerMenuCommand ('Clean Hide',& I% R5 j" S: H+ U: r
function(e){) k. n4 O4 `9 Y8 F0 j
CleanHideObj.on(0,1)
/ Z) N0 v6 `, g0 Walert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");" p& W/ S9 |* ~
});
" W* t { H, L- T" N |
评分
-
查看全部评分
|