|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 9 s' r# c" o k! [
5 Q; P1 l* Z2 C4 p火狐插件,用猴子
4 h6 Y1 ~2 ^6 _2 j% Q) h* J9 b; `5 B. T: `4 q
var debug=false; + D, f' \2 A$ s. ~8 q
var CleanHideObj=new CleanHideClass();4 q" E+ d1 S+ u. n: a/ M; X( h
3 O1 t5 g' Y5 B" A1 b9 Y: K" r3 s
function CleanHideClass()
5 h) D* S' c5 \% F9 O( p m, D{
" b L J( W7 T' H
. Y! p8 `3 K! Z this.on=function(id,bMZ)
# G2 I! A$ b1 m( H' Y/ p {; g+ R7 U3 k- U$ ]" y0 B5 H
. [ ]* G5 B$ z
if(id == 0)& {8 [* g" Q Y% P l: c
{
7 a6 U7 ~) Y& O3 K- x var page=/* document.getElementById("content").contentDocument */document; 2 Y3 J4 n# c D8 ?3 |: a8 E/ w
this.RemoveHide(page,"span");
@- L0 f2 h3 I) R. b) q this.RemoveHide(page,"font");# Y- }% X3 x, f" P7 G9 V7 J
this.RemoveHide(page,"div");3 s/ e; Y' l, t: z) C) H" l. y1 P
this.RemoveHide(page,"p");
# S, x7 P6 p/ g+ |" |8 _
2 u2 ? H5 T2 i: J3 e }
8 v/ e5 Y* L/ d" S7 _3 x! o' }
% u, \( G* A* G" ?, m }
" S: D9 B6 @) R* x9 d3 N% z3 H this.getobjstyle=function(node,prop)! a4 t7 Z$ Y5 l" ]# b
{
( C3 L4 a+ _$ X2 ~8 H try i: H( A6 r: m5 g) a' K6 x- o
{- S1 g3 ]" d* S
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
0 Q) K7 t( S( L }( A8 y: W6 ]) |
catch(e)) `8 e V/ n' R1 [) D* G- Y5 x
{
6 C' B# H0 y4 F6 G4 U/ D) U if(debug)
- c* k6 L H0 I0 L& ~& c2 { {
3 Q5 t' e, I/ ]4 ` alert(e.message);; X5 ]! y- t1 F
}% Z) C0 R- _- H7 }/ p
3 o& A9 z4 {: n* b% _4 ^4 l
return "200";
0 U/ ~. ?7 f* {0 R: I( r0 O5 O }5 ^/ V+ f( L' G
}8 U# E- X. |- W4 C- v# P/ f
% D+ A8 k7 ~( a. H" z( n- P, \" O this.RemoveHide=function(page,objname)
' V" N( i' a8 V: K" w {
/ |2 y' k6 T/ i k! v' R. t try
! n x [% A- l& ~! u4 O5 G {, p8 i3 X: \& P f5 z3 y
var minValue=15;
4 c4 }8 s8 m( P/ o var objs=page.getElementsByTagName(objname); & W' X: r" T, c5 e! `+ |
9 v8 W6 A) y) l( x3 Y6 Q: y
if(objs.length == 0) 6 p9 E2 m7 u, Z
{
0 }! f* d3 U2 Q& w if(debug)5 G& a3 |: G3 P. ]3 I
{# ?# d% H1 V( S' H6 {% a
alert("no object found!:"+objname);- F7 h7 k, _, n) p- o5 q
}
# S( E% v$ U! l; M$ {1 F! T& e8 x }5 A" \4 K3 }5 ~2 ?. n e
else9 K- q: y0 a, V* {
{
- c) e/ U5 G. I# G% I( k
1 S u6 |% t# M) H4 P- Z for(var i=objs.length-1;i>=0;i--) 5 r3 y1 E1 F" [. c, I" z) V. Y1 O
{4 g/ f; j6 i4 u* y* ~
var node=objs.item(i);
" H8 M" |& Z; D, ?% V4 S. s+ ?! w7 |
6 \( d9 H4 Z1 @" Y6 S
+ J5 j" M7 v1 L3 i0 ^3 u if(this.getobjstyle(node,"display") == "none" ||
( I! }! {+ ?8 v$ O, w3 L this.getobjstyle(node,"visibility") =="hidden" ||
5 }+ |, _/ k; L( n2 p parseInt(this.getobjstyle(node,"font-size")) == 0)
+ N; G7 M4 E2 m" X5 W. M- v7 D2 S! J {. N, a C0 |+ O) ~7 \. A
if(debug), d. Q7 p- k2 c) p% B6 K
{
- P6 v# a9 v& T# f0 ?3 Y& h alert("remove invisiable!");
, x6 Q' x% p+ \8 E- c: X }& R; n) X4 F) u1 X9 P/ i# ]2 o
node.parentNode.removeChild(node);
) a9 V3 J' g l4 H7 J0 w % k7 A U4 y, H
} a+ h4 i3 t, B
else , \3 L$ @/ ^ }
{
8 \ e, }) J- \+ S& y if(node.parentNode)
$ u$ ~% m8 ?3 c, p" n8 n {
4 B, K/ ~5 v, I2 ~: c6 H, n* Z var orgNode=node;
* }* A. ]0 A! ?% ?! m( t( Q var orgColor=this.getobjstyle(orgNode,"color")5 h" j, \! q- Q1 k& I
var orgRGB=getRGB(orgColor); e3 ~) h4 a2 I" r7 I4 w: Z
6 _6 [0 P9 i0 t% ^ var parentNode=node.parentNode
/ g* O$ B7 a- ^$ ~: V q var parentBgColor=this.getobjstyle(parentNode,"background-color");0 \: N& I) h, W$ I, B; S
. u% i! g& a, a" q) `
var isLast=false;7 K0 w F: N$ N/ S
$ m. b5 P9 w) ^6 g, v5 S- B! N while(parentBgColor == "transparent")
9 [7 ^- q/ J9 P: ]. a8 O {
+ w$ a: l2 E$ J$ [6 L $ [: r- F& W V2 W
! E5 p7 z3 F& N) V7 \+ }" u
if(parentNode.parentNode == null)% x0 v$ H" l5 @+ g: i6 ?
{
9 C8 j/ j* J, Y8 i2 ~9 m; b8 V isLast=true;
6 A' q$ c% X2 E; A3 _: F break;- F/ w: ]3 Y! {% d' t
}# d; @ W1 Y% g* \8 ^; a1 x: [: Q+ _: m
parentNode=parentNode.parentNode;- P3 t# @& a% L1 k
parentBgColor=this.getobjstyle(parentNode,"background-color");& g, k9 v" T' f! {( {- ~! j* b
- y5 `0 Z" H1 V/ {9 | if(parentBgColor != "transparent") ! m3 A3 c: w/ \" z* ?8 J. j
{1 r3 L3 N5 o. p/ _0 ]9 q {6 @: `7 m9 F
break;
0 L' G( _* _! ^0 [ }. j) P! o& ?0 M: x+ O1 t9 s/ @0 ?
}9 F- G$ p7 o% m! p3 T* Z# h
if(isLast) 1 r, U7 p2 A9 v. w
{
4 x( l$ ~2 X7 j0 N& E, L; I* w if(debug), G9 r1 s1 V7 f# ?
{$ d5 q3 o' u3 c+ F! `
alert("last!!");! b0 W6 O6 [. K: l4 a6 ]; J
}# F; G, G. g* I! t- E
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))( V3 w( G2 E! Z. c) x
{% ^/ w/ l! y; k
orgNode.parentNode.removeChild(orgNode);
" V) S- z' O9 z) Q G0 u5 [ }
7 v' {, y ]4 `1 @% U+ G* p }# o# i/ [+ r7 a' b) s
else2 T1 M" Z6 d1 s( {1 w! f
{
: n. l/ _3 Y6 W3 m- x3 M; z if(debug)
* {+ x( I* }/ t$ j# z {
4 f2 h4 q( p0 I( A! ?2 { alert("compare color and parent bgcolor!");
; C% ^1 ?1 u0 g$ G& {% g }
w! d/ j" r. E parentBgRGB=getRGB(parentBgColor);
: e: u7 T2 J. L$ C4 O1 M, R: S, ^ if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
& n0 W1 H( ], O% o! G: F {
+ n) U% _0 B# [! c0 _1 E5 b orgNode.parentNode.removeChild(orgNode); 8 t( y& Q N& f
}2 \ Q6 E& s% Y+ ]. C6 ?
}
( E8 B6 N" U. ~8 ~% _ }
+ J" h& m; B( W4 S5 m9 `$ g' q }9 Z+ l ?( \, G+ X+ l- Y
}
, N+ D5 y3 s s( {0 z3 i }) \9 S6 l2 E9 U' c+ q
9 u: M. w( d8 b" ^* X8 z! i" }
9 G9 ?7 o2 @3 F; k# ]) s! ~/ w$ a
var itemFrames = page.getElementsByTagName("frame");; F2 Q! q- u U# e% U! {5 r
var itemiFrames = page.getElementsByTagName("iframe");
/ m4 O7 A% c X8 F* e 6 n- N& [3 |8 c; J. H( f" @, L
var frame, iframe;
# v% b: f4 Q$ S, U, R$ | if (itemFrames.length > 0)2 V8 h( N9 Q; o+ f
{
6 h8 [/ U0 ~% u6 N+ k for (var i = 0 ; i< itemFrames.length ; i++)
e# l; m9 v G {0 _5 M0 w8 I4 r+ ?8 ]7 C c0 C8 h
frame = itemFrames.contentDocument;) r. s% p( F% | q% E; s" h1 ]
this.RemoveHide(frame,objname); : M! }! A. L2 R9 L- F& e8 J% |
}
/ m/ E) X4 d8 l) Y& \5 I }
( S7 v4 h! W7 g. |5 L0 a if (itemiFrames.length > 0)
' Q$ o- p4 c k {
" U, Q* o6 W# e$ C! Q2 T) \. H for (var i = 0 ; i < itemiFrames.length ; i++) 1 O! l! x9 [6 t3 n/ I( H g
{
$ c2 Y o" y% I9 _; p3 x iframe = itemiFrames.contentDocument;" L$ g" u5 M x( v8 A
this.RemoveHide(iframe,objname); % S7 d Z3 Q G' H$ s: w$ t
}) l/ H8 X& V; y1 j! @6 R; |
} Q5 {8 F; x. C3 ]0 C/ G9 _
}
1 `, p/ W3 b% @ catch(e)
9 f6 ^0 T, {# q0 V2 { {
6 I. \1 ?4 {/ r+ ? if(debug)
, _3 C; k4 N! Q& r, Y0 @ {
) h* D+ B. D# d4 K! T$ {$ [* L alert(e.message);7 i' \& X: u9 X0 Q: a f9 o
}% D/ ^; b+ x$ O2 ~, e
}
) n$ y6 s' d) F" g O# e8 L; \ }
' V4 Z3 B; @& w, v$ @# z
4 U c& {" F/ u- e3 v$ J}" A8 I$ v: N, y3 _
6 x' f% G/ X6 ~) C8 c/ mfunction getRGB(colorString)8 m( C' i5 U. x: y* X6 K
{
: L: h1 J# R3 J% _ var RGB = new Array;* U9 U( X9 Y ~- X9 ^
var tempSting=colorString.substring(4,colorString.length-1);4 Y3 Z! p% ^) n! C- `
var tempArray=tempSting.split(",");
3 U5 q- z$ H/ T1 p8 i% {3 D: S+ {9 z% t3 {4 u
RGB[0]=parseInt(tempArray[0]);2 I% Z, V% S- @& R9 h6 ^
RGB[1]=parseInt(tempArray[1]);8 D2 F6 n. E$ V2 X' ?0 R
RGB[2]=parseInt(tempArray[2]);& _# U3 h: H0 n% ^& }4 T% R
: G, u$ n5 i' e8 Y$ X
return RGB;
+ T- |& g0 f; c}5 J, s" v; h3 W- V& n; `0 Q, C2 L, W
function keys(evt)
! R0 [: k- H/ x# O$ n {
4 |# s, t0 v; o/ }+ c3 V) { if(evt.ctrlKey && evt.keyCode=="81") 7 i% D1 h' R. @6 a3 k+ x3 m' F. N
{
2 [" q& b3 t/ b; D: t CleanHideObj.on(0,1);- x' t- F6 H5 z" R: u
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
, K: U [5 I$ m
# @, ?5 |/ L( V0 } } # }* @* z8 W* ?' A1 x' d) f% j
}
2 `9 b |4 `/ |! V. cdocument.addEventListener('keydown', keys, false); 2 s% w0 _+ V4 c! H$ j( `6 R
GM_registerMenuCommand ('Clean Hide',- E8 r: M. ^8 M
function(e){$ k3 t) ~" w f& t9 ~' L
CleanHideObj.on(0,1)
! {$ ~4 ]$ _/ a/ J6 Y/ l8 Salert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");. C/ W1 U# S7 O5 ~2 N; |' Y3 k
});* L, C# ]- t3 Z! l" [
|
评分
-
查看全部评分
|