|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 ; \9 g- o1 f, V, z8 [2 `
. v+ S) i( x" X* I
火狐插件,用猴子
% w! S) T4 H" r; ^& W5 E, L
! _8 L( u* U. ?6 |1 I* d- ^var debug=false; % z2 m& u+ P6 N* a: k k% L; l6 k
var CleanHideObj=new CleanHideClass();' T! E2 A* y1 g! r7 Z2 s7 f1 `
( v/ @! Y# J/ w% qfunction CleanHideClass()
1 t$ N) q$ m6 h: |{ , T7 {% A- Y* Y0 g* ~$ d
% A8 P$ r8 A2 ?9 `' J" f) e this.on=function(id,bMZ)
# P% [8 f! R) T' ^# E- H {" ?6 ], n$ \0 W3 N. Q) O7 Q
, K2 P- p( R2 g: V" E/ m. O8 ^, H if(id == 0)' y, `. g, Q& b, l' s
{, k6 J6 @; w& x
var page=/* document.getElementById("content").contentDocument */document;
3 _2 `' @9 c: X+ w% f5 j* C this.RemoveHide(page,"span");
! b. J7 o0 {+ I8 k+ q! a3 A- p1 p this.RemoveHide(page,"font");$ e; E. q% f6 _
this.RemoveHide(page,"div");4 c" f/ w. G$ Z
this.RemoveHide(page,"p");# |( S1 {0 {9 {! J; _
% V5 X9 S) a% n( g8 j- {) a; R6 M
}
4 n3 U2 i, l2 u' g ) j. z, S" L% I
}7 a6 l& E$ _) l6 J
this.getobjstyle=function(node,prop)/ W' Z9 |! o7 E1 V+ Q& F
{
* U' {1 U" P6 A0 ` try
6 I& A" f( r" d8 A% k9 P& M {* @$ b4 w' d2 e- G. T# `- p
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
: t/ H: v% C+ J- f. e! Y+ c3 `& ] }9 |" m2 O, y/ _2 a- K" p
catch(e)8 C+ C" i' P$ L: s4 O+ z
{1 k' d% H) x" |9 P! L
if(debug)4 i. @4 ?0 }4 A- U% u% e( _
{
/ J6 w2 ~* i' Y# w7 @( @0 s6 ?; ~ alert(e.message);% w2 y- E @( }. N* x/ d5 b* @! Q
}
5 K+ K5 b! C/ _
, ^& K, M- B; X8 i. d return "200";
" K% N' ^0 }9 n, `4 \ }) A3 w, k" {% o, k% M; R |6 x$ I
}
; X* |" `4 H9 J& N ' ~+ }+ O& a' t+ D5 _
this.RemoveHide=function(page,objname)
2 i! c* a, g" h" Q X5 a# j {% P+ ?' D& y+ I+ @+ R y9 `' ^
try% P! F3 |+ [, t
{( H& P; }# w- M0 @0 O+ a' V
var minValue=15;4 q$ \9 K+ }# `! H! ]0 n
var objs=page.getElementsByTagName(objname); ; T. d) G! A# s6 D9 p$ G) B
) f2 {- r- o/ W4 B1 ^; j if(objs.length == 0)
1 l: U2 W" J7 x, X' P, q {
# p$ O I$ w6 V4 w* d if(debug)
8 U4 T% u2 R; F7 v# H9 b {
) `; Y$ F, L1 \( Q: ^$ @ alert("no object found!:"+objname);- t6 j8 z8 g7 E# ^$ q) k) R
}
0 Q6 [* d4 v1 G8 w! y4 Y }
' F, D. h: Z O else
" [% a6 o2 _* |8 e {
# c' @: c+ \$ O D1 v4 \! L4 H
for(var i=objs.length-1;i>=0;i--)
( y* d, t; E+ i' a$ i0 G {
3 {4 ^; q* L3 P8 Y& @$ [$ E0 g var node=objs.item(i); 9 a! f' @) \2 L; N& r) M7 ~& Y
8 H/ ^/ N8 Q3 P4 f: ]( B8 B! R
: M) N% k/ d, J: ]& \" z: v if(this.getobjstyle(node,"display") == "none" ||
2 \- H) W, A; s% T) B this.getobjstyle(node,"visibility") =="hidden" ||
% L. H( C. h7 X1 m4 ` parseInt(this.getobjstyle(node,"font-size")) == 0) % D( ^4 b H7 {# J) p7 V8 q, U
{: Z7 W, ~1 P9 z! s1 S
if(debug)# ]3 D9 r* ]% [. j$ J* i6 @ \8 K
{
% f: {3 `# N, p( J; Q& z2 T alert("remove invisiable!");1 j* U! m8 J) m r Z% \# F3 U
}
g/ T2 Y5 \# H% Z/ t0 D node.parentNode.removeChild(node);# _; ?7 Z1 b7 i* l6 L
5 s, P8 m$ q+ N! E$ Q }
( j+ M1 Q6 ]* D+ E2 l, U k2 E else
3 q9 q4 |" y: a& [ {, {9 B, [$ p/ S+ h2 \3 l
if(node.parentNode)
K, z$ @3 t2 G {- l1 j, _& ^ z( a# Z' t* H( N
var orgNode=node;5 c8 E _# c+ I# I- Q, e+ [5 O
var orgColor=this.getobjstyle(orgNode,"color")
7 i8 K% P. `/ J4 l5 Q4 x% y1 } var orgRGB=getRGB(orgColor); ; R' G$ s% b" [8 V. r' a. c" b4 I
: A& B4 S) l0 @& [" Q var parentNode=node.parentNode( _3 Y5 t6 C; Y' `1 v' a" U
var parentBgColor=this.getobjstyle(parentNode,"background-color");$ @5 ~' H" R! y/ `8 T5 h$ }0 @5 R5 G
: |) f* y/ B9 [: h# N; s; g var isLast=false;2 x& l; j6 P* Y4 v" f% {/ X
4 o: u; d7 C; ?- h4 @1 y+ m while(parentBgColor == "transparent")
( ^ d- @: [. V0 P# T {: z; U5 y9 {0 |) Z+ z
$ A7 Z& \3 S+ N" z! P! t
0 Z( d6 z- z! x& C" \2 U: n! w. M! z; o if(parentNode.parentNode == null)( n0 c, g/ f, K, v2 Q
{
- O& s+ ~/ `0 V9 d8 T# g isLast=true;: l! B5 I4 L6 H2 }
break;* o8 v2 v% R+ e, d% `( O
}
0 D2 R" w" t7 F( ?- T" B6 p; a parentNode=parentNode.parentNode;
: s' m( z3 K- w: X- ^+ c parentBgColor=this.getobjstyle(parentNode,"background-color");
8 v7 F* O. D2 W8 w+ m& u
( m8 F, d$ K9 o- }4 p, j5 Q) o if(parentBgColor != "transparent") # e9 g2 U8 Y1 I) R' P4 `8 d
{9 b, P+ d5 e: I! D" f( N+ h
break;
9 h% I/ T. k2 p$ c }
/ t3 r& M& k8 p1 L }0 l& r1 N" x+ B- _. r; F3 X0 f
if(isLast)
3 A7 T5 b r7 a! l' e3 ^/ R- x {/ M* g- F' F% y( Q8 N) W
if(debug)2 m( z( c) O h1 B; \
{/ r" I V; D8 p3 [, y. T
alert("last!!");
. i9 H) y! l/ W7 T- [- Q }7 ~" v) a: V: X2 ?; F9 w
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))6 i4 |- }& ?6 U( U
{
; I+ g5 O' j+ F$ z orgNode.parentNode.removeChild(orgNode);
1 c& [( N. Y0 ^: G( |9 J }
& s8 P( }$ [: p2 h. } }. c, h" i5 d; I4 ? m$ L- \7 |: S
else5 g6 W6 Z' l0 @. a0 \ i: C
{
% C4 j. ~" l, W S! h if(debug)% V( d. y+ x! q% i1 L/ a
{. j# T6 t9 E: e# M3 u% {- f
alert("compare color and parent bgcolor!"); [5 c+ S% @" F1 R
}3 `; |- }' V' [1 y. D, Q1 D
parentBgRGB=getRGB(parentBgColor);
0 l( o9 U. T4 D& p* q if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
9 R" [. e$ T, \! |5 W {
! J8 V! `2 b% U/ D* p9 S orgNode.parentNode.removeChild(orgNode); " G1 P9 [0 p( [3 @* w( k" k! }" L
}; K! A6 v0 ]& t' H4 X/ E0 q
}0 _9 d( I/ k2 q5 O) C
}
% L& N3 D; D4 n) K2 q% E }
) b/ ]# A4 N7 Y# \( k }
, ?* z% Y- U# s( r }) M0 z* ?8 M$ v) G% D! w5 V
. a3 l) ]" J- O: z! G4 E0 Q: b
" M% b2 J9 N7 ]: R$ I var itemFrames = page.getElementsByTagName("frame");
m/ s' B' @3 F, D. G. _. h var itemiFrames = page.getElementsByTagName("iframe");8 r/ |) ]& \; }$ J; q9 y: G3 u( Y
! j2 T/ n3 c7 E' P
var frame, iframe;8 g( [: N$ m; p* C7 M$ Q) [
if (itemFrames.length > 0), V0 o. H3 {6 [' b* }! d
{
4 W9 H0 }$ V$ T) y for (var i = 0 ; i< itemFrames.length ; i++)
9 e P% @9 |4 H3 L {
; d" g, J7 {1 p9 i& \4 V frame = itemFrames.contentDocument;1 C* ^: ], a8 n' M% N& |+ g2 s' ?
this.RemoveHide(frame,objname); ' h4 |* z2 r' C5 W% z: }' G
}
: s- O* h4 _, \' z }6 b2 e1 b$ w' `0 {7 I; S, M* o
if (itemiFrames.length > 0)0 \7 p+ Z. n. b& _
{
7 N( b7 g8 s4 Q3 ^/ X) F/ g for (var i = 0 ; i < itemiFrames.length ; i++) ( R2 k8 ?1 Q) q0 K! c
{
3 V5 @: G& P/ J5 \ iframe = itemiFrames.contentDocument;
3 }# a. \* [& ~5 x9 p- x7 @! D/ _ this.RemoveHide(iframe,objname);
+ U) E" H% c1 b3 U1 G ^' J }
; j) @: L( Y" R. e% x }
9 I$ N" i- L6 W- q' D! x; L }8 _2 E& i* {1 e5 r/ x
catch(e)
" N3 q( p* T5 u8 g {3 u3 m2 {% _+ c) [
if(debug)- r7 l. p7 D4 A& ~& {/ m; q
{' W( z8 s9 V* l) `( c6 e2 j
alert(e.message);* s! T) B6 w, u2 r6 o
}
2 i' e, y' Y, f& P" I* S }' X3 a+ `$ ?* h
}0 v: n. D& C+ a/ b$ a2 \! S6 w
# s! q- i0 Q2 |
}1 |& B }- q& Y7 R* D
3 M0 i* o2 b3 N5 h. _( W3 yfunction getRGB(colorString)/ }0 ]0 ?3 N# J! P8 Z8 \+ M
{' {- G, O' I$ Y4 Z( w0 d) f
var RGB = new Array;
|- \% H+ c+ P, f3 Z var tempSting=colorString.substring(4,colorString.length-1);9 p# @2 F) s. w
var tempArray=tempSting.split(",");
2 A9 s+ v H$ a+ N3 Z
% f6 N* d; U; j5 w0 }! |4 a RGB[0]=parseInt(tempArray[0]);
) i& q9 S& i" H1 z6 \9 J RGB[1]=parseInt(tempArray[1]);: R7 F( O/ u) h
RGB[2]=parseInt(tempArray[2]);
( f! P; ^6 ]: \. ` c; H + g7 d/ |, l* q
return RGB;
6 k& ], d9 j4 x( l}
/ m6 X( f5 J) {2 `" f# Qfunction keys(evt)
# E* ]+ Q# V, N& u9 k { # H5 U6 T1 \" e1 y t. K
if(evt.ctrlKey && evt.keyCode=="81") + @( H2 d& y! b
{
" M8 h: H! Z+ ]2 U0 n2 U CleanHideObj.on(0,1);
* H1 @( ? T6 m9 Y: ~; N8 a. _, v alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
; S% c, M& Q; P# z
" @6 h1 V% h9 v, N# a6 g) | }
1 P4 F5 }' l$ s* V, K# i }
9 o' q* n' `* Z+ O: Y6 Wdocument.addEventListener('keydown', keys, false); f7 N- y4 O6 L" ~
GM_registerMenuCommand ('Clean Hide',6 A( e: _2 S* x! e; i6 p
function(e){
0 y3 a' C4 W8 Q" dCleanHideObj.on(0,1)! J8 s7 p6 W, x8 P2 t5 h
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");+ a1 w6 g6 y4 X, b/ o' m+ o
});& v6 x6 C7 X' g( M( a
|
评分
-
查看全部评分
|