|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
7 K( a0 G3 J) f0 l; A7 H, K- F3 q
火狐插件,用猴子$ i7 G/ l: ?1 ~9 Q v: Y# V1 x
2 ~+ _$ _5 [5 q2 F" b$ i* |
var debug=false; . Y, p: L' [# r8 i2 b
var CleanHideObj=new CleanHideClass();
, d, n$ J) M8 Z# M. D2 Z! |) K* ]4 q& y w. m, o
function CleanHideClass() $ _, W) ^' t" w! ^6 p
{
! S: f9 P% t7 V( O6 y: r
- i* u0 K9 T) X! G% X. I this.on=function(id,bMZ)
/ Z- o2 y" ~- j; B {
2 X9 C' s4 B. |# t8 D, ]
2 _* ~) C R$ m0 K/ X8 F if(id == 0)7 Y8 n& H1 L9 m6 o
{, Q! S" D; Y% ^% n7 Y
var page=/* document.getElementById("content").contentDocument */document;
. R+ z' ]( |# L+ E this.RemoveHide(page,"span");! |$ d. n+ ~9 H T
this.RemoveHide(page,"font");
7 h; C' k Z' y: X this.RemoveHide(page,"div");
, @" k# `# k6 s* B+ R this.RemoveHide(page,"p");, f) t5 Q) r; R3 r# t7 x. R
' s9 ]: E1 U c }
9 v6 {9 k0 e) m- @- v+ P( _
, O) k, o* Z! w; n }
: k% \$ h% f' Q/ S& Y$ ~ this.getobjstyle=function(node,prop)$ ^9 ~# }7 n% A; n
{3 ^/ p# ?; ~" D/ j* v8 n
try
0 }& U3 Z: d* H) O$ L { X& ]) A }' X& V$ }
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);! r5 W4 M i; G3 |4 V( V
} g) _' B: {# G" v+ z. j/ n
catch(e)
- ?; C" ]+ N6 d) v1 {1 k$ j* x) N {- v' d5 N* e3 W) `
if(debug)
& a; J' h; p5 ^1 I( Y2 K2 a4 c {
+ w# y- k7 Y' ]5 c5 s alert(e.message);
% v* M8 w5 K) f0 f" |$ c5 B6 W }
) P7 z+ r. F& H4 f+ g) L ( L1 ^- p; i) U
return "200";" |7 r2 {: C& ?8 Q
}9 P, F% k7 ?( c
}* S: X# R6 \* a( A; c$ D' c
3 x. b" C2 }0 e3 |* z4 z
this.RemoveHide=function(page,objname)
6 C2 v4 u$ {' y: b3 s% g) m7 c {
8 j% H: u' P% D( |2 X+ |, X- \ try
% t4 g& O. B$ L# n a {1 H& e( U- p$ ]( i
var minValue=15;# _* u6 j$ z7 d( E1 M1 M& K
var objs=page.getElementsByTagName(objname);
7 L# v V7 x) A# d7 O, w, i
7 k4 V# S1 l1 [2 b if(objs.length == 0) * A- |( G" p$ Q' C! y, x
{& R7 v9 `. H7 p1 X2 p, l
if(debug)6 n* I1 Y6 f1 [, E$ s" x& P: O
{
! w) q$ S' I' q. B/ b6 |5 H; P* v alert("no object found!:"+objname);
1 u' i3 a9 f4 e5 O; t; I }1 m$ z: C) P( M, l+ k
}6 R2 w& S7 O/ Y7 }% }& b% s
else
9 B8 z% C3 @3 P5 r) ]: r" S/ b {
! C2 K9 P' m/ ]% ^9 }- M
5 b* A. T O8 h! ~& m* B for(var i=objs.length-1;i>=0;i--) # R! T6 ?* J" S: T1 d7 U
{
5 C" Z- N. P5 c9 [ var node=objs.item(i);
0 s% Z6 x6 h. a% E0 \ L4 C
4 h5 v* i& u% F/ I8 C9 m) o. i
* i# w0 h* U1 T; X( N' a$ e# L if(this.getobjstyle(node,"display") == "none" ||& k! V& Y' U# J+ P$ \7 r
this.getobjstyle(node,"visibility") =="hidden" ||' F1 K! e+ s, a# O
parseInt(this.getobjstyle(node,"font-size")) == 0) 1 f0 T* }, f& R+ ?; B
{, A- l* l* l& E! ]; j0 i
if(debug)
( x0 h, C! t. w2 u {
' n) }0 w! g. T& A. ^ alert("remove invisiable!");
' E* s$ Z" M6 d$ I9 v- @ }
' L- q5 `; g0 A# |2 ` node.parentNode.removeChild(node);
% Y; o! q8 R. Z# ~ , [7 ]0 A! ~2 O$ R/ a
}/ T0 Z5 o$ S) r
else
& U: k( g' _- B( ^! Q0 p% L {
; C- a" @& I( U if(node.parentNode) , U+ } V. i$ r+ Y
{- L2 H; [) k$ B% m+ i
var orgNode=node;; x7 y( E, E9 K" d. K2 F9 b
var orgColor=this.getobjstyle(orgNode,"color"); [& {' c! \4 v$ f0 a0 A- D
var orgRGB=getRGB(orgColor); 0 q y5 o, e1 U
0 C$ V1 e9 s* s: ~9 I) s0 G3 J. z
var parentNode=node.parentNode4 B3 A; i' I# ^
var parentBgColor=this.getobjstyle(parentNode,"background-color");6 a/ B: D* h! o6 Q: y' V
+ |5 c% s4 ^2 a9 d6 w var isLast=false;
" n9 s, X) t' G# m+ ?- `( y. H 5 g9 D4 x- M: ~' _' T
while(parentBgColor == "transparent")
$ W' x5 J6 S3 n& k( B {$ S* m* X) @0 W( l3 O: N
1 h! q' H2 x* R0 U, Q
$ L5 }4 G) O3 W
if(parentNode.parentNode == null)
$ o; p, T: V2 @2 F( k+ h- u/ X {! e" N" d: ?; T+ A3 D# J3 p# d# g
isLast=true;
5 n7 x( j G! ^( g break;9 r9 ?6 p9 \, C# R: {
}
$ s0 b1 ^) g& t parentNode=parentNode.parentNode;$ z: ]: W( i) V
parentBgColor=this.getobjstyle(parentNode,"background-color");$ K) o- j) O: o' B
* c5 V% f" C) Q2 l if(parentBgColor != "transparent") # G, `) j' i2 ^- a% @5 G5 {2 f
{
+ P) q: `8 T6 e break;
2 w0 C& p3 ]1 s8 L/ l+ P }
# U2 c5 }. e+ [ }
/ X3 \/ R" `# I) d# p' X: y& M if(isLast)
3 K. x) f2 x& l3 X3 L8 ]. K {
3 O1 I+ x' Z: S if(debug)
4 f! i* h( \; M* c6 W3 G {1 M. G" {# ~0 L8 l. ~
alert("last!!");; R4 ]# |0 n Z$ |- _$ `2 C
}
- R( I% v9 y- q K; \ if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))$ F% D. E+ x' L1 [% Z
{& r2 h+ _- k% l# f' y+ {8 [
orgNode.parentNode.removeChild(orgNode);
g# a7 v9 k+ `! ^+ A2 h% A4 q }3 m( I8 P' ^7 H/ Q& n E+ k
}& ]* U/ z6 N$ x& R! ?) O9 d2 C
else
, w! O/ J# u! `9 V {
/ U% ]+ v& K! { if(debug)9 }7 z) v+ U. p
{
. H2 M/ q5 e% z- [: Z alert("compare color and parent bgcolor!");' f& }! f. X, V- w/ Z t
}
- b5 i0 E" b+ f8 I7 r3 O5 I" |4 r parentBgRGB=getRGB(parentBgColor);' M: s [; }7 P1 S0 J3 y7 Z
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue)): d7 T. Q6 v0 K; w5 ]/ E- H
{
+ `) ^! \/ |8 D5 j- B orgNode.parentNode.removeChild(orgNode); 2 S% q& Q3 a8 [& J' E7 h
}" t7 r2 H/ L" x0 E& V
} Q; b. B) u/ `3 T$ m: f3 ^ }
}) d9 M( Y8 ?) I, t) }6 N1 \
}7 c5 P- x2 B5 f9 R& x n9 @! u
}
, @3 M( z# C; ^; y( h }
4 B5 B; G. {, P1 @# X 8 M2 f4 F8 n4 {0 f# B+ `$ W
8 s/ M1 Q. } j# f9 V" U' i var itemFrames = page.getElementsByTagName("frame");. _4 v8 W7 L: ^" B) C4 ~
var itemiFrames = page.getElementsByTagName("iframe");
, H; ?- }! F6 q' @, b6 T 5 ^; Y" [8 o5 ]2 `
var frame, iframe;) a& a$ R1 n1 i! J# d
if (itemFrames.length > 0)
" S9 o- J! v( D) \8 t4 `3 \; ?3 ] {
/ d* U; V8 w7 I# [3 c$ U! o0 j) V for (var i = 0 ; i< itemFrames.length ; i++)
+ g* y! c7 Y8 D) \' c* o {3 S# j* G! Q1 w& A' v
frame = itemFrames.contentDocument;
0 d+ k& e' ?. ^. ~$ Y% q this.RemoveHide(frame,objname); + ^ P- L5 y7 c+ U
}) b0 x2 U" H* t) [, W
}7 |) C Q+ a6 W5 }* B8 A
if (itemiFrames.length > 0)
, o0 U! z9 A" v0 X/ y1 C {4 \8 x% v( i' v, F+ K! \! [7 I) t8 x
for (var i = 0 ; i < itemiFrames.length ; i++) 4 @' ~/ ?: v4 _; u
{# ?% w* A% S _* r* i
iframe = itemiFrames.contentDocument;+ g$ z z8 w+ J5 I( V; e
this.RemoveHide(iframe,objname); ; _% ^+ e) B4 a7 r, @2 s; b
}
: W9 A4 G; R4 b' t! ^- L }
% ]! @ o' x* [4 v! K0 W }
8 n( X: I4 y* { catch(e)/ O3 w. J3 [' |: w# V8 i
{
8 V$ B$ R; Y9 U8 ?( }+ M$ T if(debug)
2 V" i' G J: V w Z* v& y/ R# v! R {
& W9 @1 X, V( R$ v2 K6 |8 t alert(e.message);; U% q! g7 w9 }6 _5 h
}
1 N4 u1 X; R' B( D! n3 \ }0 a& H' B7 i# z, O" N! t; l0 X: G) w
}2 U. Q' N" `+ y
2 A: D$ q K) Y, ?. V0 G4 ~4 h}
; v S" a+ p! G
' u' I! S! d6 `4 p' \" b1 ofunction getRGB(colorString)) q: [ ^% u$ e+ K( E$ \/ g% A: n
{8 X% c9 X( M/ F4 d- X' U
var RGB = new Array;
: A% e3 E, |6 i, i& u var tempSting=colorString.substring(4,colorString.length-1);
1 Y) @7 ^8 V2 e var tempArray=tempSting.split(",");# M8 n! J9 j( Z# R' I
( F3 N w) T$ a8 p$ h3 c: ^% p/ E( i
RGB[0]=parseInt(tempArray[0]);
- b/ F; K# T$ w% L' m; |$ F RGB[1]=parseInt(tempArray[1]);
9 }1 ~* n/ ?& x' h+ W* c RGB[2]=parseInt(tempArray[2]);
* {$ p7 e( T D6 N : C( i" `' c6 n/ Z
return RGB;% R9 V2 C0 `! k
}. H1 B H1 Z+ X: ?
function keys(evt)
" w" u. U" A. Z$ \, q, _) K { 6 E+ Q |: Z: g( E* b d
if(evt.ctrlKey && evt.keyCode=="81")
+ Z8 F# N$ [7 W! Z- r) t {
6 r4 f9 R3 j5 V! X$ Q3 W CleanHideObj.on(0,1);" K8 r7 Y& }( n+ E7 \8 Y5 |+ I
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
3 I/ N7 ?. q( d# N* q0 C0 d2 ] " \ v$ P! }* P! P S
} ' X/ B- r/ J- U; U A5 M/ G' L
} 7 A7 D3 A) U7 p6 w c% X* N1 O
document.addEventListener('keydown', keys, false); 5 v8 }) e+ x* Y' x% j9 N
GM_registerMenuCommand ('Clean Hide',. _: n& b3 a5 `+ A5 f: A* a
function(e){
" g5 Q5 V d+ q; |2 d9 [1 b2 j6 @CleanHideObj.on(0,1)
1 X. z9 y& I/ [ _alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
) X# A3 o; L3 f3 |. ^2 k});2 W* T- _: F6 E9 x
|
评分
-
查看全部评分
|