|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
3 V% I' t, |# O' [/ T; @% K1 G/ i; f: E- a4 e6 I6 @$ n
火狐插件,用猴子" m5 e; ]# O" g+ s
3 A& `* M+ F2 E* X& l8 F
var debug=false; " q6 h& F0 E/ b; v; F: X6 h/ _
var CleanHideObj=new CleanHideClass();( J2 N! F/ z0 J
. O7 `$ u* f+ @! v: L0 S, s/ B( B, [function CleanHideClass() " i4 n/ i; Q+ v# A0 w
{ % w8 W* C/ E" [, p5 S4 V4 p2 S/ d/ u
8 C' b# @/ a5 O this.on=function(id,bMZ)
' ?2 w' ^' K5 S! N8 e: h [: T3 F {
0 v5 W4 q' {6 U, G/ w
1 G1 d; a, i9 B' @3 {9 ` if(id == 0)
. ?% n. T; {8 G" r% o5 E- \* e3 y# b {8 I! A) K! `: y/ [
var page=/* document.getElementById("content").contentDocument */document;
9 }, N+ w6 n, n. [ this.RemoveHide(page,"span");+ i( s% |* e' X/ l
this.RemoveHide(page,"font");
+ D% Y! W% h5 y8 z1 O this.RemoveHide(page,"div");
! }% y6 z5 L7 Y& F this.RemoveHide(page,"p");& f) D6 c* U/ \: V3 w
; A [" t9 J6 I" o% D- ` o& n }. E R$ Q6 H A
' b* I: U: y+ C; Z }- @. [- n7 L% e, L
this.getobjstyle=function(node,prop)
0 {6 p1 C) i& ]5 [) x# H) X! P {
6 t% V' `" L l3 @& h$ W3 e try
, f( h# a1 l1 _ { M( T* j( k7 g$ C
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);- I$ O: \2 u4 B. S+ |& K2 ~
}- i$ Z7 y# ~* i! j, {
catch(e)
) S% G7 a- \ d {- o: I+ s; n/ {
if(debug)
) x9 p7 h1 T$ N; Q( b. z5 B {
1 Z( T2 c+ c) z7 u2 \5 \7 B1 V% J alert(e.message);0 r) n5 O+ X/ }2 [; F
}8 N& I+ a. p* I; |
! b0 y) C6 \7 A% M
return "200";
" @# X; b! o# C- Z" [3 ^8 z }
2 o' W' k2 b; b1 b2 j/ S }
) o$ I" J1 s! A; j
" z7 A: Q7 f O# C5 C6 | this.RemoveHide=function(page,objname)
, D% A6 Y& J9 Z+ L7 Y [5 d1 k) O2 E6 W- \ {0 ]) ]$ I) w4 E& X
try
0 r# t( Y, i- K {
0 k" p1 a. ]- Z9 h var minValue=15;
5 A' T; l$ _2 \4 C) q var objs=page.getElementsByTagName(objname);
A/ c; u/ B! ~$ ^( s" ?! g& L6 X7 H# \1 y, \
if(objs.length == 0) " b0 @+ b3 n8 q1 t
{
4 P% c+ J* A! l7 _# B if(debug)) V& `% t. p8 k g' ?* g X# @
{& o, o- ?7 Z8 q
alert("no object found!:"+objname);7 T& b" y6 J/ K& f3 _- d4 Y
}
3 }. t# E$ x) |: n A; g }7 k. O8 V+ a% I2 b2 T5 N+ a
else
2 ^+ W. y! L- f5 E- w& p- |6 f* _ {
( [5 X# P8 `/ w# @; M
% E& s) w* A/ E. A" W for(var i=objs.length-1;i>=0;i--)
) g* C' @- q' X- v* ^( a {" R/ X$ |' z# q- a( K
var node=objs.item(i); # p/ q+ z7 p1 M/ q
6 F! O% Z: c* T- p- n" H / W, ]/ \+ O @, Q" k
if(this.getobjstyle(node,"display") == "none" ||3 m( O; L% r" \$ u% N5 J0 K
this.getobjstyle(node,"visibility") =="hidden" ||
: B) O. b% _* s1 C4 A7 o8 v$ L parseInt(this.getobjstyle(node,"font-size")) == 0)
- P7 L+ U5 O+ B& ?& l {. ^5 W" t8 H+ l4 ]
if(debug)
# b# t; v t! R {/ X+ |/ w- y. s: }" d( U5 k
alert("remove invisiable!");
' I$ B4 Y" z1 z5 o }
, c" n" R4 x! Q9 {- I$ x8 h Y W0 S node.parentNode.removeChild(node);: z/ T) o2 D V! ~! m
4 |" w& M) u& ^9 u/ k8 k2 |% O }
8 R0 ?- x0 v7 ?& L6 R else ; F, Y" a8 [5 L- g
{+ z/ T/ L& |. L: T, d; x
if(node.parentNode) / k6 @+ Z6 s# ?
{
: h; n5 F- u/ ~% z" i+ v. w, Y var orgNode=node;' n x1 B3 u2 {8 m3 X) `' H3 H
var orgColor=this.getobjstyle(orgNode,"color")
5 L: A3 k {6 X5 h( a var orgRGB=getRGB(orgColor);
) ^) n/ A4 S! a6 `% @& H. R 8 |! e' j0 V4 ~ K
var parentNode=node.parentNode9 N# Y& X+ A8 P+ j: A6 s- R/ l
var parentBgColor=this.getobjstyle(parentNode,"background-color");
6 X0 D9 M% n8 p; I# L
9 M5 o8 q# j# U var isLast=false;
) H- t0 Y2 v8 S1 N( w8 d
4 Y7 k1 C2 [5 C, a4 n4 J8 k while(parentBgColor == "transparent") * F' K: g, T1 C* w% N& X, N+ j
{
: p- d( o. H1 M3 E/ w( K ! { z: |: M! \# w
0 n1 }0 }% M6 F2 t# I; \# \" T0 @% ^! H
if(parentNode.parentNode == null)
2 N/ D2 I! O3 e3 D4 D {
2 U. T2 |( g3 Z isLast=true;) W3 Q% m& ~& C$ C: e
break;
0 e \9 }3 a: {/ q( Y0 ] }( x) K+ Z2 o2 x- V# r
parentNode=parentNode.parentNode;
/ X4 t8 S6 T6 ~; [& Q. k: {, R parentBgColor=this.getobjstyle(parentNode,"background-color");- M4 K5 ^ z2 Z) @0 y, s% x
' P6 w7 _ c* Z: ^
if(parentBgColor != "transparent")
& ~: P2 X+ A9 g7 ~# n" m1 O {
7 d' c* w5 n4 Z$ a" `/ z8 W break;1 j7 @9 W- |1 \: g
}7 _7 M% F$ o2 U1 w0 x! Q
}
- z% R$ L8 x3 I% u" l' N; p if(isLast) ( Q: A z6 K+ K/ Z- g6 q0 C( Y
{3 N Q! y K' x! g
if(debug)
4 C i" g. p% L) A {+ E) t7 `; W1 `$ |
alert("last!!");
C. I& K$ W& o6 a }
9 P& F& L1 ?5 Y5 F6 H if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))) i' h* ^! u/ L6 p* q
{
, C' ~5 t: R) m" }, u% ^% L. D orgNode.parentNode.removeChild(orgNode); + r$ b' P2 K& t
}0 C$ Z& V4 \$ @6 c
}
, Z/ \7 y1 J W) p% X, o( V5 E, h else; ^5 S" S% N+ e) B# Y4 Y
{0 a; j/ E. Q f9 h- E
if(debug)! D( j( [; U+ s6 y, N
{/ A# Q. w5 t5 f5 A
alert("compare color and parent bgcolor!");+ S& w. b- V' D2 [# ^6 K% H
}. A b; A. j5 w6 R# f' P/ v% v) W
parentBgRGB=getRGB(parentBgColor);
. Q& T1 T6 a1 y! h) g if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
6 v. `" B- P1 n3 \, X' I {
0 z4 q8 V3 j2 o8 T- G orgNode.parentNode.removeChild(orgNode); ! f7 u$ t. |3 D v& a- W2 `$ B
}- s) k& u9 G+ \+ Y" N. i0 h
}
7 r: _* a z, ?9 \2 ]3 n) B5 Z1 D }
6 V" V j/ [4 X }
^. R& W8 i; u' Y }
3 v" R3 x4 H$ ^' x0 T7 w }4 Q$ [, k" o2 K& m9 d- n8 B
. {# }- X N' q5 L
6 D% \! v+ a( { s. |3 o9 Q4 x6 n& T var itemFrames = page.getElementsByTagName("frame");
' g3 J* o W2 l var itemiFrames = page.getElementsByTagName("iframe");' B. Q% ]! B g! |/ A; H
3 f$ K! Z3 f5 r8 `9 S* E% _/ Q% G
var frame, iframe;; t# {1 E6 V+ ?2 r
if (itemFrames.length > 0)
* @! I; c' ~- q7 ~ {
6 r7 \' h& ]! l0 ]" Q! i2 w for (var i = 0 ; i< itemFrames.length ; i++)
; V' L) l! a$ ~, K$ u; H% i; v {
, e# W& h; ] H- f- @ w- D; d' O frame = itemFrames.contentDocument; `! V) F7 L4 t1 B1 w
this.RemoveHide(frame,objname);
/ V, M8 T1 f7 `3 m# ` }3 I7 f& D6 V/ V: v7 F; X
}! [. t: ]- X& E# x* R% q' w
if (itemiFrames.length > 0)
+ D- O* ]5 F5 I0 M$ X$ L {+ n1 t3 `6 v( X8 M7 O* v
for (var i = 0 ; i < itemiFrames.length ; i++) & r: l I2 T( {( L1 r; I0 c; b
{3 C% x1 [) ]0 W. Y) q3 M+ s+ M
iframe = itemiFrames.contentDocument;" e* r' E( a6 g& b5 f- t+ q& U
this.RemoveHide(iframe,objname);
: S, q4 F! \+ i# V. e8 U/ R/ | }9 x1 n: G* R# |) t3 w* U* B- Y
}
, M k7 R$ S! X1 j8 c }
: p/ Q6 x d: r9 ]* N1 @* Q8 P. e catch(e)6 [. R0 p( u; A0 n# }6 ^
{
# R5 ?+ f8 I' P3 {/ p$ S# V# j3 ^$ B if(debug)
; o7 Z1 K& Q: U' q5 M/ L* ]0 q: R {+ |9 i% y- `- X
alert(e.message);
0 y0 n5 N& G6 i$ z2 c6 P. P2 o }. W6 } f: e* ~' D h" r+ w9 ]
}
/ M) }4 ?) l! K& E; h, _ }' b; H0 N. N6 i5 K
" }0 h' b/ X( w" _! |}
8 i9 @9 t/ t) k5 s: ?2 b0 M' ]2 A
function getRGB(colorString)7 F# z- T' \. T) L8 C& Z' K2 H
{& \4 {' D4 K2 q. }7 B& l! d/ d
var RGB = new Array;. K7 M& q* G9 A' a8 k
var tempSting=colorString.substring(4,colorString.length-1);
% R! T) c- g H$ K: ]- ~9 d# _ var tempArray=tempSting.split(",");
! r( L6 b& i8 a' K# d+ o, I; G
) b, X, S+ c$ J/ c* Z+ ?( G# B) h7 L RGB[0]=parseInt(tempArray[0]);( |! y- u$ U1 T
RGB[1]=parseInt(tempArray[1]);! z j6 [0 W R$ Z) c9 [
RGB[2]=parseInt(tempArray[2]);
4 g0 R' D* D& e6 x' Z
0 `% H4 r2 ^# Y+ J7 E S! ]/ [ return RGB;
. R$ j: c4 \/ }9 j; U ^" x/ T- O" S}! w. U$ }% O& P* Q" h2 r. ~* W7 J
function keys(evt)
* i I0 J n* n! e3 B {
6 [2 @. j" P" c3 ~, e$ O if(evt.ctrlKey && evt.keyCode=="81") 9 q: r$ V1 E$ T9 X6 j( p: e5 W
{
) D/ m6 Y& x$ K& U3 f CleanHideObj.on(0,1);- m4 V9 ?* {. v
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
0 U0 F# p. j& j7 K: D
! e- C+ u, l% S( K4 w9 Y" k4 H, { }
- ^9 q- W; I6 P5 ]+ ?6 B1 O }
6 P; q! V$ P6 Q2 A$ Ydocument.addEventListener('keydown', keys, false); 8 p6 w$ Z6 N' g5 W3 J
GM_registerMenuCommand ('Clean Hide',
% ^" a+ H$ `& b5 [# b/ X# jfunction(e){
+ d( U& h7 K6 o7 G0 e5 f, w* y, U+ OCleanHideObj.on(0,1)5 Y0 B$ n% U( T/ }% s( D
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
5 F. @ a' `0 Z. N) s4 L});& ?5 n' ?. w& O4 N, l0 y
|
评分
-
查看全部评分
|