|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
; @! k7 Z2 {1 o6 K$ y6 D! G* r' j. h5 ~" w
火狐插件,用猴子
% t: g- e$ l$ U& @% A- W) J4 A/ l' [# g0 s2 F3 p" r
var debug=false; $ M+ A7 V, j7 `. ?0 c
var CleanHideObj=new CleanHideClass();
/ R2 R0 h' N4 b {& Y9 t' D& G+ H* N6 y# b: ^; Z
function CleanHideClass() " `9 G$ ?% z* q- L7 n u ^8 G4 K
{ , m. I% }; ^1 [: G
5 D7 O4 O9 w2 H1 ~ this.on=function(id,bMZ)
/ j2 L$ b/ {5 n7 a5 c" X; n j! G {
0 a- H2 ?% u f+ s. `
! e( M3 i# o/ v if(id == 0). ^+ n6 L4 v/ o. s
{
b* c: v2 |! D/ z var page=/* document.getElementById("content").contentDocument */document;
6 L' ~1 b4 v: B this.RemoveHide(page,"span");
6 Q- U& i2 H. A8 |$ \/ C this.RemoveHide(page,"font");
$ C3 y7 _6 q& Q4 F: T$ p h P, G this.RemoveHide(page,"div");
8 x$ d7 v$ ]) k) E this.RemoveHide(page,"p");/ e9 Z4 @" B5 O0 b* ]+ U4 ~
$ G8 q l9 l0 G4 G }
) B( j0 }; r! }, ?$ w 3 ]8 V4 F {6 O3 E( M
}
9 u" w0 U2 y6 Y" {+ Z this.getobjstyle=function(node,prop); u/ k5 c5 s. Z6 @
{
" E- H" i b3 q9 o( A9 T8 Z. B1 Z try) a0 V7 d8 G+ k; U4 N$ g6 c: J1 E0 y
{) e2 _$ w5 y$ `1 a. A
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);& t$ H% a0 {2 _) L
}
6 Z8 ^" Z* X4 ^: Y! W catch(e), V5 B$ J, r1 m; e+ K6 Z
{
3 h: E- V0 ]6 a if(debug)
/ E5 r" A0 x0 [ {
( f1 M. J& v! b) x* y | alert(e.message);
9 a' @, S* r. g }
$ Y& g+ b# V# N' ^* M6 f , [" S# L& i9 S& X* {
return "200";. u. ?2 `. b5 p* G, A( B
}2 j6 C9 u* C/ I
}
+ w2 J8 K0 Q) h( ^) D" t. z ) [' t5 s1 ~- K1 \, Y% {, k2 ^
this.RemoveHide=function(page,objname)+ x |. F- |0 z) `! g$ I4 J0 b
{
5 D. e, c. U) z. ~# _) ? try! F. g& E! r5 X1 m
{
' l$ M6 ]- A! L: l; l1 x- r6 A' v var minValue=15;: g' H. m! ~, r1 P
var objs=page.getElementsByTagName(objname); 3 e! R/ d- }4 ]- f+ U: Y4 R
) V' P1 n. k# V3 Y; z" V% K7 f if(objs.length == 0) - a, `) z3 n3 q* _+ d \
{
/ J' A( _6 j/ n7 g( C if(debug)' W2 @& G4 R+ v; o
{* ?9 A6 T0 U- S5 f2 \
alert("no object found!:"+objname);, f- P% ?# a( y; _
}
8 g2 g( \% ~( z: A+ o2 x2 E }4 a9 U% U; t8 c& R4 z7 d
else4 z) Y Q4 U' B# B5 {# l! L" z
{
7 w% W$ c; t9 G4 c / I/ Y* v/ Z3 |( J! B. n
for(var i=objs.length-1;i>=0;i--)
) i- ~. a& a' h* S+ e5 s- } {9 e/ }; N# ]+ l+ W( x# V
var node=objs.item(i); 8 s3 E& L/ E- w* h- o; w
: i: g' Y7 k. n0 x
9 C4 A. b' m6 {% i j if(this.getobjstyle(node,"display") == "none" ||6 }+ C& i4 H5 r8 Y% X5 r& k4 ?
this.getobjstyle(node,"visibility") =="hidden" ||% }# i: X, J+ i$ l& L+ {8 W+ T
parseInt(this.getobjstyle(node,"font-size")) == 0)
: I: Y, \- P; `. c4 s% z {
2 p/ s4 Q5 J# n3 H4 I- o8 a if(debug)4 ~ {( A5 Z7 P- ^
{5 t. [- @% t* j9 H3 c; m3 P
alert("remove invisiable!");7 E% ~7 b& p4 v& |* `7 F
}
* s9 n/ Y; g" ]! F node.parentNode.removeChild(node);
5 G9 ^8 c) b1 b( r
3 @# o! U1 S8 z! F' p! p( H }% a* Z9 @* H6 i3 X8 o
else
. m- G2 Z. s) h$ {) _ {9 f, p$ d9 o9 X$ o
if(node.parentNode) ; M2 O8 n3 i" {1 ?: Q+ R% l3 Z
{
! ?, @: c/ g# B1 G) ]' v0 c var orgNode=node;$ C1 F6 ^9 B$ M+ e; C1 U+ l- t
var orgColor=this.getobjstyle(orgNode,"color")3 W/ E! t" q: F r, m' K' |
var orgRGB=getRGB(orgColor);
9 ^* P! g! M6 C7 i0 U! m4 h, X
& Q9 O2 {5 E' `# n var parentNode=node.parentNode
6 H( }( J! x* k9 E i2 u) A7 i var parentBgColor=this.getobjstyle(parentNode,"background-color");" z; @; t* g$ k g0 U/ O
" j$ W' j4 w& C var isLast=false;. F) T$ c8 E p
/ }& z: R: B% \6 L# J" J
while(parentBgColor == "transparent")
. l- K# y }$ k7 F" e6 s {
( x# w V( h$ \! R8 k+ a " J% l; d5 M L; m0 l) F( H; ?) x
/ m' g, e: {! N6 t& B7 n) c
if(parentNode.parentNode == null)" S& W$ B# r" ^9 s1 Q4 _. [
{
) i% o( e1 I# s4 ^5 b isLast=true;
2 A" `& ]& H) e break;
5 N7 ?8 G. u1 F7 W. C }* K o9 C* [; }3 I2 e4 k! I- l
parentNode=parentNode.parentNode;4 ?' u6 M3 M2 z) Y( e7 S) J& ^2 N r
parentBgColor=this.getobjstyle(parentNode,"background-color");
9 G$ q7 f* W8 ?; K4 v/ ]- o$ `1 h) x! x) c. U* R! _2 F7 A! ]- T
if(parentBgColor != "transparent")
& G& _) X! C+ b* y; {2 g2 R {' [0 w; L$ ]% `4 ?
break;; v e6 z5 q- ~5 k9 {4 G: q
}! P% p3 m4 D& Q3 F
}3 g' T1 w4 C& C( B9 y4 ]
if(isLast)
. X/ V7 _. d) C( j8 w/ l- q {
. v- a* S5 n$ P$ d) m5 y if(debug)8 ?) b; _5 y$ y
{2 u3 x! d! u8 G' f. I2 d8 B
alert("last!!");( Q' w2 p3 T9 T; e/ I0 I
}
: Q! _4 U9 z# ^6 [7 P& m# R if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))# N7 J$ u: [7 U
{2 G$ |+ T! [) [9 b3 U
orgNode.parentNode.removeChild(orgNode);
6 U' _" e) T- u. e6 p }$ S. X% J% y/ |3 d v c; Y3 H
}
A% a! [+ p0 O6 A( t0 R& D4 _- w else7 p( N/ b1 V- U, R- w$ }
{
# v% L# x& v1 `! ` if(debug)
: g7 m0 p" \9 B* { {
/ U5 u; O- m6 K7 M) V; p; K& l alert("compare color and parent bgcolor!");
" K; n5 {! f) Y4 a4 [% z } u: i) V+ M! J7 Z; q
parentBgRGB=getRGB(parentBgColor);
' a0 L# ?6 {. D9 z0 h3 B( [8 t if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue)). _( {2 P7 G- x4 w4 Q' \) u
{
# J% k* s) B2 f F' i: o/ ?) D* i orgNode.parentNode.removeChild(orgNode);
! A* H. [, ]+ Y" T$ ~ [ }$ z& |( F3 l9 W0 C* T
}
# F8 J/ d: k$ s+ l) d }7 R3 \, Q# U! E% g) ]
}
/ E% r7 S7 l: m) I* M1 ]4 h }; e4 T G, e# y+ g! n; W
}
' W) F; _8 m, s 7 s- y% S' T6 i4 ^* B( J
4 y! I; n, g( d9 z, X, \
var itemFrames = page.getElementsByTagName("frame");
/ F0 D2 ]6 ^ ?: g var itemiFrames = page.getElementsByTagName("iframe");
' R( t# N7 Y/ n( F4 f4 j
! L" v7 v" ?7 ]. j- w+ p, f& d var frame, iframe;
1 o9 _$ O* I! C5 j, V2 `3 |( ] if (itemFrames.length > 0)
' h+ N4 F7 p" F* A {
: b. \1 J+ h9 w6 O0 G+ ^ for (var i = 0 ; i< itemFrames.length ; i++) # D7 }0 X7 b2 w# z. [& Z% a( ?
{- e5 T; ?3 Q; Y5 O8 j
frame = itemFrames.contentDocument;
* a! Z% o, Y' }; \ this.RemoveHide(frame,objname); 8 K, E, X$ V2 y/ x7 K( H
}0 T" Q9 R+ Z7 N9 F! q+ U
}3 s1 Z! G. h. k$ ~& B
if (itemiFrames.length > 0)6 C3 @0 w. W2 i/ Q- W/ h r
{
3 {5 g8 ?) b6 T1 |9 ^0 y for (var i = 0 ; i < itemiFrames.length ; i++)
6 w/ W* a4 U$ u& g0 B {, u/ x8 G- ]$ N6 |. T8 y' s
iframe = itemiFrames.contentDocument;& c7 ]" r2 _6 t3 f. A7 H
this.RemoveHide(iframe,objname); . A6 I: @( ]- ~
}$ A) g' O7 A- L6 T) q4 _1 H
}5 l) @5 ^2 d D8 H7 y( @
}
' F) e7 n3 p* `* { catch(e)$ M; R6 y% Q5 n* \% J$ {; T0 o
{
! {4 Y$ l6 _5 K- N5 h4 W if(debug)
0 F, k9 B ?: K# m/ @& t {
% `/ n' B0 V! d alert(e.message);: d, t' f& A9 {; l4 m( E
}+ j9 L7 m; g- H, S7 Q0 R" s9 G
}
# ]8 O& H' s- `5 `- N" X }' n" p E G( \) _ n5 Y, t& F# e+ _. K/ Y
, `3 b7 K" g( A4 i0 F) B. P; k}, H( T2 Q6 [7 ]1 Q
2 i* o, G5 h* _- ^function getRGB(colorString)
! }% ~7 h2 m! W: n U% T{' F6 j/ N. f, s$ ~# [2 v f
var RGB = new Array;
3 t# Z# J* E# { var tempSting=colorString.substring(4,colorString.length-1);
0 E% V1 ]# H1 g; W0 X# }7 W var tempArray=tempSting.split(",");
7 T. }- u( G% T' e
5 B8 L3 ~- y, L/ E* a" w RGB[0]=parseInt(tempArray[0]);
9 T; x1 b, W# u4 x- C RGB[1]=parseInt(tempArray[1]);
7 I6 a. ~4 ?, Q1 O9 t9 \ RGB[2]=parseInt(tempArray[2]);5 ^% [' H4 v {6 r
5 D! @2 O* Q; }# I return RGB;/ E4 a6 P' S: `! V
}
2 x# N: s% X5 d1 Jfunction keys(evt) , |5 j$ M3 p, v/ n/ p1 J* ~$ t
{
. n+ B5 l5 ~9 j- ]- X7 d9 K( Q if(evt.ctrlKey && evt.keyCode=="81") 6 X9 w4 R& ^2 z3 o- O+ B
{ 4 _( u4 ~2 Z$ z+ v; y$ s
CleanHideObj.on(0,1);
9 e$ }- m! A' a& \ alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
, m N; k( R( l$ w: ?* E 2 u Y7 ~5 D# |
} $ F0 j$ r: e1 M/ m: }
} $ Z) N- h" p9 w: z2 v* M
document.addEventListener('keydown', keys, false); 7 r k- a7 x2 s" }" q; y
GM_registerMenuCommand ('Clean Hide',7 B9 |9 t; k6 E" {7 \
function(e){
# e1 P; V5 w3 p! j/ C' x$ bCleanHideObj.on(0,1)$ [, G) p0 P, I0 X
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
4 t# q5 Q6 h' ~8 p4 s});) v; K1 A* T2 |6 C8 R3 y! q
|
评分
-
查看全部评分
|