|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 2 `1 r: N7 P4 ~8 D: o0 w! h9 B1 K
3 {6 G* L1 X4 K" l
火狐插件,用猴子6 x+ p- r) X; V2 d4 e# o$ B
, |9 k2 R7 [9 }' \6 g% i
var debug=false;
" p& p4 H) o- o: kvar CleanHideObj=new CleanHideClass();/ o' d! t( t* _$ E8 v
* u# N5 Q% V0 P% ^function CleanHideClass()
! ]9 S+ {$ K8 Y+ R{
3 f5 ^5 w+ R+ N: y' C
1 ~ H) x. c( `% s this.on=function(id,bMZ)3 {5 B4 |! c& D5 l
{
/ I0 P/ A5 R* }" N$ Z$ n
$ V6 @5 R1 j9 J3 Q5 }# p! V if(id == 0)
- N' a4 t( j9 Z4 h8 i {4 f/ S' c" G$ @
var page=/* document.getElementById("content").contentDocument */document; * ` k0 P2 _ {% K
this.RemoveHide(page,"span");
. u# n* A* g$ _8 d8 Z) M this.RemoveHide(page,"font");6 |$ X" Q9 c/ I
this.RemoveHide(page,"div");, d9 p; \/ D' Z5 u' x1 w
this.RemoveHide(page,"p");1 S- E( t1 ?5 b# J( d9 t( H
+ v' ]* x1 H4 P/ g
}
/ ]% y% V* N6 ]- e1 `6 X% M p, p
8 M! i- M3 b. K. p6 d- B- v }. x& G9 J. b$ o) Z
this.getobjstyle=function(node,prop)9 H. Y; t( o2 m8 a9 w! ~# B/ u
{
% K& u0 H, V3 i% v+ m1 b2 E try/ b7 h. F8 H) _, f' B0 ?1 d
{
# r* B/ x5 Y3 L* s: u return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);* R% f! ^" P, ~ ?. Y7 y1 u
}
, N- B; ~( k1 j. C6 i& U: k4 b) b catch(e)# _+ b$ ^! _, Z: b/ n0 B* O4 {
{7 _) X5 v& n$ a7 `
if(debug)
: w. U# j( Q2 @' q {
4 x$ K/ H! Q# n1 D3 A3 j/ F alert(e.message);2 z: w; Z- Q+ Z5 U! L+ f! Q
}
8 x& I) z- _5 G/ g! C# g
3 Y/ K0 d4 w) @2 B9 Z# I0 S6 d" f return "200";
0 ?- A* _ G" [6 `4 R# ^ }
& ^1 P; b, V, u+ D: Y' @8 ^ }
! h8 r7 N- Z \+ Q6 F6 ^7 k9 ^ ' n2 N3 s5 v7 Q
this.RemoveHide=function(page,objname)
9 S. r# t/ j: n( P+ o; H {
* k, j8 p/ A8 M; }" [! ~7 h try
) Y9 K4 F4 B; O+ Z# U% N& f) e# z {7 `9 I; N4 f- t: Y
var minValue=15;. @; ~0 X8 [9 C7 Y/ D. |
var objs=page.getElementsByTagName(objname); / p; j5 n( `0 H
& d$ |( }' P: l e) F if(objs.length == 0)
; Q. L. @6 U5 D9 m7 h6 `7 [ {/ r X `) g6 S. N2 [% v
if(debug)4 N k* W) b8 d3 ?
{: w/ p7 L: E. D' r3 w' k! a
alert("no object found!:"+objname);
# ^1 Z. P1 Q D4 X+ y/ A+ l" m }
/ s1 ^2 U* K3 R1 j' H }2 a' y$ l$ E/ }) u P
else
: B+ `4 P' ^3 T3 G6 m {* o7 e( P- [, {) Z L
# x" Q6 S# A4 s; d8 r
for(var i=objs.length-1;i>=0;i--)
) s- j0 k" U$ _, w9 ^ {
+ g2 x; E3 z1 f+ L/ x var node=objs.item(i);
; g* O3 [( \' U( r1 C. {- P
: ^: Q' s. S! m6 |0 ]( h6 k2 M
9 g: @& V$ S0 U, m) u9 i# j6 V if(this.getobjstyle(node,"display") == "none" ||# t( M% M( g: M) t- f
this.getobjstyle(node,"visibility") =="hidden" ||! b) h# O! w4 k, u9 `
parseInt(this.getobjstyle(node,"font-size")) == 0) * T' I2 H7 l0 b
{
$ I( t1 d3 `& f8 U8 W4 F: m if(debug)4 s5 {, w/ ]5 I
{
7 O7 U9 _; f. g1 d0 [4 `. @ alert("remove invisiable!");
) l5 b2 N, Z2 t0 [( `# K8 o }
0 O ]) |- `, c2 |" x1 a* b$ t/ [ node.parentNode.removeChild(node);" P# I" d `! V
& I& ^; }: z0 T) O: d; d- R; {! X }' Z' ?8 j: z6 U; l
else 5 s7 i& n6 r! \! P u
{0 L" t6 `( p1 n' v
if(node.parentNode)
0 X" k$ E) A. Z {0 p# }! d( z" ^
var orgNode=node;
$ O3 k) C$ G; G4 ^: E* b, P var orgColor=this.getobjstyle(orgNode,"color")
! S( ~0 t2 G$ B var orgRGB=getRGB(orgColor);
: l2 \+ V' [( Q# U! v$ e/ B( `
0 z- t! a# y6 O! t2 } var parentNode=node.parentNode
5 E" P8 k- o9 x6 }2 F! P var parentBgColor=this.getobjstyle(parentNode,"background-color");
2 ~2 _% E$ ~7 Z( y# p2 E 7 {8 U! t6 i$ _- ]5 W" o2 r$ h+ H
var isLast=false;
! c$ K5 O9 t$ E' i8 U5 R, m, {
Z7 `: a7 q* W$ b$ U% h* O/ z while(parentBgColor == "transparent") ) B8 R) g! E3 C1 @9 o) U' E* C
{
- T6 d; ^: M# S! y. r# p8 ]
' x+ S5 Z+ m8 H6 A
* f- ?* Y, [6 h: B7 i% A1 F if(parentNode.parentNode == null)
$ ^- A) @6 v; _; V {
5 q, \, K" `- G7 n5 Y" e O ~ isLast=true;& I5 b6 E% C. C, @0 c3 C
break;
& u2 R7 x0 o9 I) |0 K/ F1 T }
( M/ @, x0 e" N& K parentNode=parentNode.parentNode;) q _ ^% Z( C
parentBgColor=this.getobjstyle(parentNode,"background-color");
+ b6 i0 Y8 V( I9 O# Q6 V& q' T+ V$ w' R1 ~( O/ G' `0 g6 B2 \+ K; z
if(parentBgColor != "transparent") % y% I1 f, l1 v! [0 g3 K
{
) z, h( @0 g8 Z4 g* ^ break; t& r% G& m- q0 u* {
}% `" j- |& b& N
}
4 x+ }8 o' Q* l* f$ G- V if(isLast)
5 f& \2 Y2 D; W8 k5 M {
- s) `/ ^. N1 J( _ if(debug)% b! ?3 w, e6 j5 P7 X
{
% q8 U& v+ J& Y+ k6 m alert("last!!");
$ V0 ?8 U+ b! P/ b% M3 f }
7 @8 B* B1 ?4 s- ? ?- v$ W7 t# F if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue)), [1 J# a" q& h
{- P3 c/ o8 \8 R2 L
orgNode.parentNode.removeChild(orgNode);
/ H* _: W& C, N }
! w- }% i* F& L4 q! z. s/ m }% s8 W' I8 F5 f1 f1 m" S6 `
else
, i9 P b, d* r2 d& W {
. t! q% |( q5 @5 m6 o& [9 H2 V if(debug)
5 X0 @- s0 d* q {3 _9 w" ]- @* |
alert("compare color and parent bgcolor!");
- I9 a7 h }- K+ o/ y; U- E }
# f( w5 I0 X9 L, v) u, `( l parentBgRGB=getRGB(parentBgColor);
4 j- y( w5 z7 a+ ?5 ^ if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))6 E) q# }' U& T" R% {
{
9 ~& W/ N4 |, F' S$ w7 L orgNode.parentNode.removeChild(orgNode); $ @9 t, n, c( O9 G
}# e/ G$ z, t: V& e& Y& I9 L- [0 f
}
$ l2 M1 @" `" J; o }& v: P0 Z. J) {
}
! A/ T; @0 s; E }& R0 ^& U/ [* D% C/ Q' J% v0 r
}1 [1 x- d* n7 s1 r6 W
6 ^: c$ W m% g$ Z0 M
6 h% e. f l4 V: s; K4 J% E
var itemFrames = page.getElementsByTagName("frame");) Z# f% k6 ?( Q" w) S5 q' p# A; b
var itemiFrames = page.getElementsByTagName("iframe");
3 G b! j$ m$ d: `: {; P
9 y- j) y" K9 \ var frame, iframe;
+ R: r) {, d) ~3 p if (itemFrames.length > 0)
; I$ @2 f( T# U( ?5 y. o {4 O: `% w/ X$ `: d& o# ^
for (var i = 0 ; i< itemFrames.length ; i++)
/ g' P9 M# ^+ _6 v# X; ^3 d0 E {" t2 x$ x! j4 x; }! y
frame = itemFrames.contentDocument;( P8 T# j! w0 T- P# z5 G) Q c
this.RemoveHide(frame,objname); ! A1 c" ^: X5 h
}
1 D1 r' |* P* l: _, y8 u! w }
; o# e0 l3 }. U if (itemiFrames.length > 0)
# Q5 g* a% V" |# S2 D# ]0 V! V {
" A: F% {6 R$ n* n6 I) }& ` for (var i = 0 ; i < itemiFrames.length ; i++) . P) W; J! `0 i* g, `
{
, m) J0 K& i' M iframe = itemiFrames.contentDocument;/ ?$ D1 Q- [0 ?" U2 h. _
this.RemoveHide(iframe,objname); 2 a3 c3 i- F2 X y# F( A- ^7 A. v
}" K6 r3 l" |% ~2 a/ a) f) z
}
! o o) b5 _7 ^. g& [' M }
7 u! x% M3 V0 `# r! d- ?/ L catch(e)
- Q- K& ~% g. N }% c {
+ d; {2 X7 R% L6 E D7 M if(debug)
0 A! C, F( j/ h( S) [6 X {: J; L/ ]) F5 ^5 z, ~
alert(e.message);* \+ V; \+ G# D: I; n
}
0 g! u0 S. ~* s9 _ }
+ V# }1 M) G: T, Q8 I+ U, G }
, B6 E5 ^! m/ g) G- S- l2 R2 V5 a
, F+ J4 X6 \5 }* l5 K! T}
8 ^8 C: l0 L, {' x f
. Q- L1 e) q! J7 ?function getRGB(colorString)! Z9 }2 ^- A1 R/ B' s- _
{2 a! |; B- w8 ~* P- k* R8 j
var RGB = new Array;1 j% A/ _) }, A7 A! d K( b
var tempSting=colorString.substring(4,colorString.length-1);: c# U2 y/ O, k- @
var tempArray=tempSting.split(",");
6 [$ y# [2 P3 c
1 C7 X9 a0 E9 z# K9 Y( I RGB[0]=parseInt(tempArray[0]);- M3 r- b8 [# x3 v6 v0 B/ H( w
RGB[1]=parseInt(tempArray[1]);
; q) f5 p* P' \ RGB[2]=parseInt(tempArray[2]);
' k$ n/ ]7 P' J" h# f7 |
: \+ }. Z; {' l9 {# v2 H" N: i* J return RGB;
I- O% S" D2 I* B- g* V}, z& C$ Z' z7 X, r+ x$ [
function keys(evt) 7 W. B) d/ I; W* R+ c1 Q* K A
{
2 y' O6 ~' N" A( U9 R9 F if(evt.ctrlKey && evt.keyCode=="81") & f9 _* `1 b/ K1 }- o
{ 6 ~2 c% g: i. p2 a1 W3 F! P) S7 h
CleanHideObj.on(0,1);, M' H0 o! e0 k, S
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); $ M: G8 s! m( V: ^$ Q% s J
+ r7 c1 N0 S' i. {- O
} - j) c; Y0 N! Y, b' t& m# q
} 2 S( B4 g/ V2 U4 E6 B8 O: F8 c
document.addEventListener('keydown', keys, false); 7 t/ ]! E1 w" K0 U8 I4 {
GM_registerMenuCommand ('Clean Hide',# G$ m- j; l' s
function(e){
; p3 h; y! W4 {3 q( Y/ g5 }CleanHideObj.on(0,1)
1 d9 r/ B9 c3 R d& d0 ualert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
2 k8 k: I. ~% C});
# Y% k- u3 n6 Z$ b+ B+ g' p; D0 a |
评分
-
查看全部评分
|