|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
; |8 A* b* P1 q( K& l# c G2 g' Z/ f- W
火狐插件,用猴子
$ b/ u0 b; Q8 Y8 N$ M, B: C8 r2 m* o- s0 E! p8 u" _+ u$ U3 F
var debug=false; : v) C. t6 x. }- p! D" u* f8 c: {# B; N
var CleanHideObj=new CleanHideClass();
% |( E2 @& C y0 b8 D. E, F* t1 }7 R" J) a
function CleanHideClass() " t( m8 H! O; ?% E2 f1 o
{
5 e$ b4 n3 P2 w0 H6 K6 V$ m$ f& u " \& o7 V- T( H8 l7 f( ?
this.on=function(id,bMZ)3 N& ~/ f3 D2 {0 z( e& }$ P
{% h. r8 q, Z' i/ Z
T+ ]4 f9 ~# H3 L+ T if(id == 0)& X Y- w9 A F2 N
{7 H6 C1 a x0 w- i- P& {
var page=/* document.getElementById("content").contentDocument */document; & Z+ [% r# y" I A5 K6 f
this.RemoveHide(page,"span");! o9 @9 t, z; v' _9 \5 H6 s5 E5 `
this.RemoveHide(page,"font");
5 S% D% f8 h' C0 N( J+ ?- r this.RemoveHide(page,"div");7 P* u) Y6 \- D1 [, n" A
this.RemoveHide(page,"p");
4 O; y* b: O4 \ c- ]3 E1 f/ F0 [
& ^1 C1 `; P! i U8 q6 v6 r0 L5 N }
; j. n& M+ b" V* M- |
) i U4 H6 B/ N3 Y) e# j }8 M B$ e# Y- [3 A, G% f& m9 \' A+ r
this.getobjstyle=function(node,prop)& l- v: T) X! R3 E8 C2 }) c
{) q0 ]' s9 x1 I! y. C. r1 i# i
try
7 {, x' s8 e( o9 \1 \9 N+ q$ _ {
. R1 N# I" s+ p% Z' P return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
5 D, j9 d! R$ I) S }
- k8 Z7 @# f9 F; V7 t catch(e)
5 [* h/ l/ B; m5 R8 C$ h {
- t- B- n% Y9 t+ u if(debug)
& d/ G4 J$ I/ J* L" o& e) h5 k7 a {# u) ^/ V% F; x# o4 D" k" u
alert(e.message);: M6 Y. i' M' L. X
}2 _; E" X" l5 Q* s1 Z! y
8 a4 q' q$ J P! I% f
return "200";) W$ X0 N4 E6 T; {" {
}" |6 x. [' c \1 Z$ B9 E
}
) S/ L7 X8 _( d9 G' |" | / A9 t; }4 N; R" c0 g* ^
this.RemoveHide=function(page,objname)
2 i) N8 Q" K2 Y/ [- H7 \7 h {
- E; o* N Z' V/ i9 S% I try5 t. o7 \$ c+ C6 A& X/ r$ C# a k- z/ r. h
{
' |/ i4 S$ v+ D; t, ` var minValue=15;
% ^+ d2 w" B7 G var objs=page.getElementsByTagName(objname);
! @6 e, e( G& D# M) {) V- q- ^3 V; n' o5 _% @( I0 L
if(objs.length == 0) + M3 M1 Z- o+ V8 r. F& V
{
4 Y/ c! j) F; m$ ]7 g* M2 q3 M2 \2 |# f if(debug)7 B5 I2 a( _ I6 B
{. l4 Z5 x4 W- h0 J q
alert("no object found!:"+objname);1 Y' t$ z" x1 F) C; ^
}9 m' w5 ], |' S5 u
}
# W' }# g- z& ?+ Q' |4 R8 r/ x else7 V. }+ g2 E/ k1 p
{
7 j5 y7 U% O& U: W5 W Y6 W, } + O+ e: B% C7 }" h. a P
for(var i=objs.length-1;i>=0;i--) ) n( b3 Q; X0 q/ k
{
. c0 r( E) F+ i; ]- F8 F* ^, w. C) p var node=objs.item(i);
4 U, q1 Q1 o5 v( G/ a 0 }: W+ m/ V3 N: |3 k
' m; N+ ~% V- ?( J. U8 h, x0 k if(this.getobjstyle(node,"display") == "none" ||% ?! |& p1 \0 c# F9 H2 O
this.getobjstyle(node,"visibility") =="hidden" ||& Q- I& W1 X# |
parseInt(this.getobjstyle(node,"font-size")) == 0) 0 ?* \( k- K/ C2 G" U! b" v9 T! j# k
{$ R9 u. b0 B0 v3 B- n. H4 `, L
if(debug)& l5 O! e2 i% h3 g# i6 V
{
: ]+ h6 |) w- I! |3 @8 I alert("remove invisiable!");
& u& m$ n7 S- b2 X+ Y' @ }3 d% _' `5 d$ n5 R
node.parentNode.removeChild(node);
7 f5 s$ k- j8 p. f& J; q 9 g# a# H$ J. ^. f& Y8 b$ f8 ?9 ?
}
& @- O2 L9 v" \3 \ else " R, r& G: ?: w( D4 ]- W0 ?
{
% n/ h2 D! E+ v" ?$ P @ if(node.parentNode)
8 S5 _# u* W" t$ T- w3 P% N {% {& [$ y; n6 X/ i2 K! L6 y$ A. r
var orgNode=node;
- H* K6 h" Y Q7 C$ x9 _4 } var orgColor=this.getobjstyle(orgNode,"color")
6 L4 T* Y8 A7 S6 d! I var orgRGB=getRGB(orgColor); 1 G8 q; Z; H% N# f
+ Y; D" h; `/ l' c! M( |
var parentNode=node.parentNode
. C- D+ }& t, r4 c- y M var parentBgColor=this.getobjstyle(parentNode,"background-color");1 P7 _- y! m O9 b) X
$ Y: p( x$ E& _: K# | var isLast=false;* P3 `( }, Z; \) s0 O* ?
" w8 b+ ~, r0 }6 z2 E: G6 j7 [ h$ M
while(parentBgColor == "transparent") 7 n: _7 W- z1 s5 N! ?* \6 o/ r1 y
{
+ _# X% S8 t( \7 N$ H
0 d3 ^9 A( G( O* @4 | . [9 `/ t: H1 K: q) E( ?' d
if(parentNode.parentNode == null)
; L0 d. a! f% r" n2 S {+ Q" d5 L3 j- r1 o8 @) ]. K
isLast=true;# _; i+ T6 {' q$ U7 u1 P# V
break;
) d, _9 t# |0 A" z }- A3 p8 x2 H0 x1 z! {
parentNode=parentNode.parentNode;
& `! e$ X! W! ^0 b/ ~& k parentBgColor=this.getobjstyle(parentNode,"background-color");
$ c# P6 E. n$ O/ ~" i- e
+ r9 m4 o' ^% n* G if(parentBgColor != "transparent") ) \! U; I& I1 T, s$ w* b9 G' _6 O
{
+ K P0 Z8 ?% f% \3 P7 |6 V' S break;( [% J& I& b. s6 a3 B
}+ M. R+ x0 Q$ W6 }7 {/ @
}& a7 K6 ^" ^( O, H
if(isLast) " [* Q7 h, q* p! V
{
7 G! S7 F; ?# j0 Y4 _ if(debug)3 ]( r; ]5 n% L3 g7 L5 i
{
0 ?/ ?7 I$ e6 o( m! `5 i# T alert("last!!");- a8 X7 t4 L" p) U# d. n' g
}1 S# I8 i( M7 g! k) ^1 r
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))9 k+ c# h7 [) ?. {& s7 D
{
4 W% |+ G( q- n5 d; w" B; D orgNode.parentNode.removeChild(orgNode); 6 e+ G7 \" k: R: r. G8 W, N$ G
}6 {- \" k4 w. L V
}8 c; w1 M b: M7 Z; X& }" M! \
else
( M: n9 O% [' y* i {# [$ h8 ]* k& D0 {4 X
if(debug)
8 i1 d% r4 D; v. u: h {
2 ^; m- Z! h1 T9 S; X* q alert("compare color and parent bgcolor!");, y! O" |# h4 m5 t( L
}1 ^! `6 h, }6 ~/ [; x4 f
parentBgRGB=getRGB(parentBgColor);* w, T; h7 S$ w
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
6 E# s% B9 Z$ } K$ ]3 t {
* H4 c' ^3 K2 i# h orgNode.parentNode.removeChild(orgNode); # A0 ^# [2 R% W. [
}! {" M9 Q! ]7 d1 o# `
}
8 g2 B1 d+ b+ X } a9 e. A2 R9 V8 `( M9 `
}
3 @. ^3 l( m4 l* s/ m }
- _1 O6 Q2 p6 q! m3 E% @ }' x8 w+ y& Y. t
3 c' c/ Z; F' o* N3 s
$ c r' x2 a' z4 n3 h# F9 F, L
var itemFrames = page.getElementsByTagName("frame");
, n; \ ^/ S5 K- L- y var itemiFrames = page.getElementsByTagName("iframe");. _8 s' s2 B0 e( ?& H% b, m' D
/ X( l J5 x& C2 W5 ~( h
var frame, iframe;; q4 p! V; q- R2 ^" x1 }
if (itemFrames.length > 0); x3 F9 Y# f" ?" Q; p$ u
{
! z& v% T& [; a/ A& d for (var i = 0 ; i< itemFrames.length ; i++) ) j0 k6 Z4 U4 I/ A' S
{
$ W( R+ d) T2 X. ^- Q, s frame = itemFrames.contentDocument;
0 Z0 U: _; A+ K this.RemoveHide(frame,objname); 1 S% |- g; Q; k
}
) b; P1 U3 X! E6 G0 r, L }
, }2 Z6 X7 w: c; [2 z) x# w if (itemiFrames.length > 0)& n) T3 ?7 K- U& y. t9 F% Q! R
{, i; \7 w& ^$ m$ h
for (var i = 0 ; i < itemiFrames.length ; i++)
+ P( u9 j3 o+ k3 `6 ~, \( _ {
" e3 @7 {, f6 T4 F G8 D$ u iframe = itemiFrames.contentDocument;
0 E7 C" ^3 M/ d6 B- ^( c. { this.RemoveHide(iframe,objname); 3 F, p! J& @$ n) P0 E7 `
}2 C* k p! ?, B' H) W) @) g4 y0 z& }
}/ X, J& G7 @0 F! u {6 S
}! Q/ S: r7 f. p. y) X; d
catch(e)3 j5 _4 G. D! a
{/ @) G3 s1 e$ y. j' D2 P7 f3 H# }
if(debug)
" x \2 a2 ]# H7 H" @) F {4 `4 i% g, [7 L% J0 D- j" [3 n
alert(e.message);6 T, s" N/ l% F6 h) ]
}
& _5 _ E* t9 I$ W' d }' |! |6 f; @+ P7 a8 q
}
0 V8 Q8 } }/ E5 _
6 S( `7 n7 a3 _/ x}% n# r: T( |5 o) h
. u/ ?9 w1 U) v# s/ zfunction getRGB(colorString)
5 s: K$ r5 K& y' O( v{
" D4 j Q2 E3 I var RGB = new Array;
4 s* ]& Q& Z/ y! l. S1 _1 I& V var tempSting=colorString.substring(4,colorString.length-1);8 z2 R% O2 x& K$ I- t Y
var tempArray=tempSting.split(",");- }* ^ c* k t
: b) c0 P( I& C% }
RGB[0]=parseInt(tempArray[0]);
6 b- t7 B3 s! |3 t' j- R' J RGB[1]=parseInt(tempArray[1]);& t3 s8 @5 n- w' U9 u8 b6 u
RGB[2]=parseInt(tempArray[2]);
2 i7 k' H2 I5 R! K0 ]1 G& m
% q. {) }! A) r& y9 J8 @' a0 N+ P return RGB;& X/ A) ]1 `5 u3 ?) G
}! M9 J" Z/ i( {. }9 ^; X5 U( ?& C
function keys(evt)
$ k6 {- E5 y: i8 U { & P' X: r9 n# Z
if(evt.ctrlKey && evt.keyCode=="81") n, R9 E) B5 n$ ^
{ 8 D1 F7 N& W: k- X% _3 Z. Z
CleanHideObj.on(0,1);
' a( M* Z. E3 k0 Y* D alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
1 a- U" {2 B+ `0 {7 q, b! Y6 B, [
) M, d) S1 d9 r7 y2 ] }
2 Y- O" q# Y' X( N4 H8 n } 5 @+ q& B9 B( r4 f8 V2 K, W
document.addEventListener('keydown', keys, false); + x2 S4 W( p0 a6 q2 `1 o0 Y1 X
GM_registerMenuCommand ('Clean Hide',* O( V+ u/ v$ Q2 j2 X% l2 L7 u
function(e){6 }+ J% K/ w0 w+ _. k! z
CleanHideObj.on(0,1)* v0 p& X3 C7 r% u5 j- \
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
- U+ }5 S8 W" e2 e});4 h+ m* l8 I; y/ I/ E. {. u- C
|
评分
-
查看全部评分
|