|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
/ X+ v/ Y4 F& S- p0 m/ M u0 i- ]4 H( j' n+ a r! o( C
火狐插件,用猴子
. ]' n; L' {! A' j7 f9 `- Q
% ~8 o$ }5 ~% a% svar debug=false;
0 E& g7 K: e7 F* Gvar CleanHideObj=new CleanHideClass();
* [) P( y7 k* i; y+ g! W5 S/ Z& ~: w1 W) C1 W0 E/ R6 z
function CleanHideClass() 6 Q; }$ V/ _% Z5 t. I* C
{
9 c) m R" N7 h/ |/ T* N" k ; q( u* @# Y! D G% r# p2 Z% n
this.on=function(id,bMZ)" R' D1 W& M7 Z; S1 v
{
3 v; X* j' b! O8 H! [: R0 y * f+ H9 g6 e' @0 k
if(id == 0)
/ `& F7 G2 A a. ^& E {
# V R1 m, Y/ v3 G$ ~ var page=/* document.getElementById("content").contentDocument */document;
" y# i5 B; d. t! ^+ O! Q this.RemoveHide(page,"span");
' T+ c; m6 g! y. Z7 f this.RemoveHide(page,"font");
2 V5 ]2 H B- B$ h' S this.RemoveHide(page,"div");
8 z3 E' b) s; X4 w, M this.RemoveHide(page,"p");
' d& ^1 r/ ?! T7 \& C6 l" G1 ~+ F, U / g* g( d7 T: S' H0 k
}3 _* a& d* M* Q: ~0 H, p% x: U
. u5 z( s5 o# q1 L) c
}
, J9 h- j+ E. |% y this.getobjstyle=function(node,prop)
N2 v" G8 w0 F4 U% {! } {" y3 K! x; a& U+ n/ O) }& ^
try
( B7 n) C; ~# `4 v6 k( E0 q |+ j {2 Y5 c3 l+ _+ ~/ e
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);! a5 |" {7 F7 P2 e9 ^
}6 y! y+ l: s7 L( Z0 [2 H$ E
catch(e)& W) w/ W/ \! A2 ]: x4 V) q# S1 q
{
# p2 J% D) ?% ^4 K0 y4 f6 w/ D if(debug). u, b/ m. G4 }. g% }+ @; G
{0 E! V2 Q( U+ K2 }$ w! a5 a; q
alert(e.message);0 B3 w- B. X( G& i& W: c
}( x- K/ L2 s1 a2 x6 N- A
2 Z+ t+ i# t2 ~3 u return "200";
7 z/ M- `$ n$ b# F/ | }
* C' }5 H; v7 R }2 j" j. e o! I: t9 N. s* H
' l" m* P/ ~2 S6 s: v this.RemoveHide=function(page,objname)
# \6 I% b" I1 z& E8 i( Z) `2 H0 C {& c, u9 ^: m1 B( k7 k/ ?& D/ ?$ t
try
# o: N. v5 m0 q5 I: N/ _ {
6 u; i, b& k1 K4 h4 j5 w; U var minValue=15;1 H- y' u y' B. }0 s
var objs=page.getElementsByTagName(objname); 6 U" w9 _5 n. C R7 c
$ ]" w# X; J. h; `+ c8 `% C
if(objs.length == 0)
: |) Y! }5 f- N {; L7 o, U: T7 E5 @- B
if(debug)7 @& P) B, U; [
{
" u" T9 x$ j+ n alert("no object found!:"+objname);* x7 @$ ?' g4 A+ w
}4 Y, U+ P- W5 J1 z7 Q
}: D9 m# r7 ^6 O, d% N% G) J
else
! G7 A5 z: G* }+ Z4 ]6 Z4 }2 D: j$ O {
6 z% R% d. V2 M, a# v, j . C% q% u3 n, H, H" s+ [, Y
for(var i=objs.length-1;i>=0;i--)
, b3 n. Y$ G, [( m" e. q2 g+ L0 e {/ y- H5 S, Z! q5 u0 O; V
var node=objs.item(i); % {1 J; c$ @/ I/ |% K7 I& @+ }1 y
; s2 D) \9 K5 l$ c; q9 G* o/ ~
2 e+ a+ ?* l$ D+ J4 `3 M5 U8 ]1 g
if(this.getobjstyle(node,"display") == "none" ||0 @/ K3 @4 V! L( \6 l: ?, [$ V
this.getobjstyle(node,"visibility") =="hidden" ||' Y9 R8 v8 A6 q# @: Z- M
parseInt(this.getobjstyle(node,"font-size")) == 0) ( l4 T4 ` }4 C' u9 t, y
{ ]3 ~ h+ r! Y' V
if(debug): x5 U& k; t3 ^* u. K. k9 h9 |
{
! `1 D3 O8 }7 y- e4 G alert("remove invisiable!");0 b s" L1 u' @
}
; v9 B0 U* Q! S3 B# s* O( A node.parentNode.removeChild(node);
, h$ k+ V# _' h: c2 l+ L + r) T7 w& r+ C3 i
}2 P! y7 a+ R0 v! W% c) i1 R
else # {" s/ U- ?, C& |4 E; N g5 m
{6 r! f* J/ K8 u0 i; {; U# p3 K
if(node.parentNode)
* `- {$ [; ?$ C# F( | {
; l) p$ X4 R) a( v var orgNode=node;: ]5 L% t9 A; S$ F
var orgColor=this.getobjstyle(orgNode,"color")
6 A& D* s- U/ T: l var orgRGB=getRGB(orgColor);
: g/ Q ~& O! I5 d3 S: m8 k( O6 J
m2 E" f' B3 r) u$ J8 x var parentNode=node.parentNode R! p" Y k+ y% Z' \" K9 U: p+ G
var parentBgColor=this.getobjstyle(parentNode,"background-color");) a: @/ Z- j# _! d
2 s3 Z i' |% X: P% d% X& S
var isLast=false;) \% U8 D' K, G. l/ q
+ O0 A% f' }4 _% r9 ] W while(parentBgColor == "transparent") 0 s/ K. y! ?+ v; U1 c6 o
{
) N7 n' [/ w/ M/ h. q6 p5 u
3 \1 Q$ o, s3 M M3 v! {
: G. `0 a$ N! E& ^8 W% [ if(parentNode.parentNode == null)1 a3 h& W3 b2 f9 O" \/ t9 q
{- x# L. {4 O% \: k
isLast=true;
& F n) X9 x% \0 k6 Y0 w break;* X; U% C( b) `/ i. D4 l
}+ a* |7 |( [2 _% b4 b& v
parentNode=parentNode.parentNode;# L; }1 X7 ^* B( ?5 y! y9 X; {. H- k
parentBgColor=this.getobjstyle(parentNode,"background-color");+ ~9 }6 e+ n L2 }
: |. }7 Z2 c; w
if(parentBgColor != "transparent") + z3 `" b4 l& f* p& ]! u; e# B; x0 B& V
{
: O/ T' R; E3 l, A$ ] break;
' l* U" X, I& K! {( u# ~& M }$ [/ ^: Z B5 y: N, |0 \
}8 T0 J1 y4 q' g5 F: N) _7 h( h: \
if(isLast) : t7 W; Z1 z; K, v9 h" n
{1 K7 U- P2 M% g5 c: T
if(debug)( i% M4 K& r3 `
{# v; [1 ]: {4 q5 ?
alert("last!!");4 d# O( g- `: Y6 _: i
}
9 `+ N1 H6 g1 ~2 @) V$ p2 A g j if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
9 `6 m8 i* h5 j- p( b {! ^, v2 [5 @. c) O' p
orgNode.parentNode.removeChild(orgNode); ! F7 ]9 }+ E# m' M* H6 L
} d3 Z2 N% V( S. {7 x
}
. q2 p9 r& Z2 a0 i, p& C else
* f! v" |$ [1 D7 s# {' z% G9 e {
w M$ T; e( l if(debug)7 N" ^- d* {) A9 h, L1 A+ W8 i
{
+ Q* H$ N) y( @5 C5 P alert("compare color and parent bgcolor!");, G: \* Y W& g( _# A8 y1 J
}
. V# E4 F, N& K( q parentBgRGB=getRGB(parentBgColor);; _' R9 @* j5 P# o& K
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
) @6 J5 I% E/ j9 E2 C) Q! k {
, B0 z) t! P0 W3 L) j* U orgNode.parentNode.removeChild(orgNode); ) D3 c1 \; j& K [" M1 A
}% x% N) G+ w* D
}
; l% p n" j% p/ k. t }& k( S# J6 g$ w( x3 {
}
5 V! m: U1 g5 ~9 x6 W: |+ s }
: k& H1 ^2 D# p7 m }: v0 `& N) s* A/ ]5 }5 `
& a, }8 x" e( U/ l
+ X, q# K X* S" K. M, ?
var itemFrames = page.getElementsByTagName("frame");7 W: A3 i! [. U8 u# W6 N; g
var itemiFrames = page.getElementsByTagName("iframe");. y2 \% C3 q* e" ~
2 j+ j, A% Q6 O) x. @ var frame, iframe;# I9 c) {+ _! C0 T4 A! Z) w
if (itemFrames.length > 0); i8 m% ?8 t8 g
{
, g0 W/ u3 t8 O$ y for (var i = 0 ; i< itemFrames.length ; i++)
6 W8 D+ d5 t3 b8 L" e8 `# W {8 K/ A; U! D: `1 E8 [
frame = itemFrames.contentDocument;; V; D" J7 [0 A7 p3 F
this.RemoveHide(frame,objname); 1 @$ B, N p5 S2 @1 ^* D7 Z
}
1 ^; W( X& B! Q, z( L }! f. M/ H! Y0 g1 x/ p* c
if (itemiFrames.length > 0)
. C" a8 d6 l) Z9 {8 @8 c {. d& [& l. b0 ]4 F
for (var i = 0 ; i < itemiFrames.length ; i++) , A8 ]# E w9 [
{) U7 A0 m2 k1 K! [# y F
iframe = itemiFrames.contentDocument;5 s4 [3 U! O& I+ A8 v9 N
this.RemoveHide(iframe,objname);
+ O& {8 v, K" P J7 w }# ^; y0 A6 b2 u, e
}8 h3 G/ n+ a, B- G) Z
}
: q; V8 j/ ?( ~ Q6 ? catch(e): C) S( d7 f/ i: V( @% K
{, e3 T4 j# A- J* s3 s
if(debug)
+ l3 ]# b! @6 i; o' m4 J {
1 t: L; ]1 K% H" p alert(e.message);% i. T: u/ s2 m/ l
} U) H; j4 W9 i9 ]3 X# H* a
}
& Q) v6 u3 [3 k& } M# k }
4 {4 c9 D/ Z6 q% f
) L- \1 c- u# r}
, ^$ O3 R+ l7 p
& [/ K* {. c: i; N2 Nfunction getRGB(colorString)$ A5 P2 w' F! g& C; c2 A
{
# A9 R I1 w& V! U8 [( V+ J% x2 e var RGB = new Array;
+ e4 N5 ]5 ?8 O9 i8 L var tempSting=colorString.substring(4,colorString.length-1);2 h5 b( c+ x# d$ m8 b9 t
var tempArray=tempSting.split(",");
9 W9 e- ?" S8 h3 P
, S5 C# c# [" \7 |2 v RGB[0]=parseInt(tempArray[0]);3 s4 y; t3 D. M) l
RGB[1]=parseInt(tempArray[1]);. c8 ^/ J5 T5 ]9 k
RGB[2]=parseInt(tempArray[2]);" ~2 g, H4 |+ y5 e, U- ]* B' n
( g9 U7 Q* V4 j& y1 O1 S' \' Q return RGB;& G7 d z9 ^/ k& H& |5 |7 \0 F
}. R- z$ t9 |( `) ?: F% O6 f
function keys(evt)
. g' ~6 x4 x9 v! T7 Q {
5 I, m4 G: M' L: G if(evt.ctrlKey && evt.keyCode=="81")
% L" b3 @& q7 T& Y) \ {
5 O( M9 W1 _5 Y* I( o5 B* A& | CleanHideObj.on(0,1);$ M9 f) Q' ~( c" `/ Q% p0 \8 R
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); 5 L f7 k3 I' b6 U) E
! X7 _# I! w3 f. V, G* G
}
/ `: y7 w. g- p d' k0 R }
4 ~- `. v6 n4 |" g0 B( B# [4 }document.addEventListener('keydown', keys, false); 0 P& M$ @" x e! M$ U. Y
GM_registerMenuCommand ('Clean Hide',
4 y$ `; r7 M' s7 |2 i; \function(e){" _( X! `' i6 x3 K: P
CleanHideObj.on(0,1)9 {( l3 t U# x6 y' }% d, d
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");8 f6 `# r) s9 D& Z/ ?* V
});) j! M4 b' X3 C) g' W9 d5 n+ Q# h
|
评分
-
查看全部评分
|