|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 ( ^- R- E; V; O1 Q; t; L
; d: f6 g3 x0 H1 q+ u" c
火狐插件,用猴子
# n6 H% _9 |) L( `( T" k1 L* p9 o" u
var debug=false;
; O3 J: L, Y, {! X" i g, Pvar CleanHideObj=new CleanHideClass();' u, `& ~1 D5 C$ l* ^
1 F1 c4 I- T8 S {+ X) ~9 ]1 D; tfunction CleanHideClass()
& q& A8 Y6 P! u$ a7 {/ }; \{ - _$ x& x& n: e! A4 A
9 L- Q& ?7 v2 z0 ^4 L5 v$ t, D
this.on=function(id,bMZ)9 M5 o0 r5 O; a& D
{; A# n& P5 F- ?; }* t0 W
. p K" X+ q- y( D8 E: m if(id == 0); }6 f1 Q8 c% V) @1 s3 _- W
{" v6 M+ G9 l5 ^$ f
var page=/* document.getElementById("content").contentDocument */document;
+ k3 p# R7 a" _+ \! y this.RemoveHide(page,"span");
% K0 s c$ C! h3 W8 A# F& K this.RemoveHide(page,"font");$ v6 _3 |* p ~/ ] U6 a
this.RemoveHide(page,"div");1 j5 r( z* w4 x7 ?
this.RemoveHide(page,"p");
# a9 M7 H J7 A7 e) ~) l% v0 r
" L9 [. R9 |9 q3 H }
# B3 Z; f: v' v4 f
) j6 Z. D$ ^; f" { }
: q. X |% l% d8 } this.getobjstyle=function(node,prop)( x' B# I8 h9 M% s) ?
{. }4 t( v$ |0 i2 [
try1 J9 z) p3 z6 Q: n9 p5 g
{$ {4 U. c* o' E5 u! `( B q
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);/ G, G5 y+ @# \: x
}
' @$ m6 n' ]* a7 z4 s" P3 r4 \" @ catch(e)* C: k9 V$ a9 k6 z* r
{3 h& @6 m1 C% ^# `/ d4 o* v
if(debug)
+ ^ j; y: t6 K7 \3 Z, e1 p {9 T G# a2 p# w: m
alert(e.message);1 H5 N' F) @0 O/ Q A% A1 s1 v
}
o' ?- \9 a! p0 U( r
. I: D3 E+ `# U) g0 q* Y return "200";
# q6 W+ Q1 n! @9 w# ~: w+ F }
3 ]2 v4 j" x! Q( ] }
" d1 h' l b3 u$ o* Q # K2 S2 n) U: m4 f( n4 S) U
this.RemoveHide=function(page,objname)9 s4 F, p1 B: j! d. Z. }: B" i
{
, X5 Y/ M4 O) E$ N try& Y" t+ F+ e8 P0 W
{
4 q& b, s- j1 s& j var minValue=15;! _% o1 D* D& I
var objs=page.getElementsByTagName(objname); , m' j4 X( ^( L/ ]
. F1 X& x) d+ K
if(objs.length == 0) ( `0 J. R* s) N$ j. h6 }0 S- e* n8 D
{
* g6 |7 p$ `2 q if(debug) Y! E- [$ N! p4 Q( E. t
{
$ p$ a: K" k" |6 |8 D alert("no object found!:"+objname);' L2 _- c) d6 N& N
}# }$ D, |' J& X. M
}$ T! P) @; f9 ]
else
. A+ V/ s3 ^9 b( x* j" ^ {
5 }( U" Y' M8 s
$ ?/ A, X Z# W, D, x. f- V for(var i=objs.length-1;i>=0;i--)
$ `! G8 N/ _! K5 ^: p5 ^ {; q5 D. J S2 @' _
var node=objs.item(i);
5 @* @9 @6 p1 F( R 8 U% ~5 R4 v2 N( G# Q7 e
* Q& e5 K& v' C b) U if(this.getobjstyle(node,"display") == "none" ||
. i: g" O9 G1 Q) N this.getobjstyle(node,"visibility") =="hidden" || c1 D' z& W9 C
parseInt(this.getobjstyle(node,"font-size")) == 0) & p' }9 f% K, N- p1 q
{4 e B/ S; U; H: M& q
if(debug)7 v4 i% \. N) i* J4 }% X7 {
{! V# }% i7 ?3 d C) t
alert("remove invisiable!");
' ?# _2 E, t" [" h }. n2 I! O: a2 f
node.parentNode.removeChild(node);& M* \4 z0 i K8 o8 |. F* H) w' K
" a/ U6 e+ x7 S/ } }
3 D# Z2 S1 C) s6 s else # u5 X0 ^1 ~4 d F- W
{1 |2 L' x8 \) K
if(node.parentNode) 3 Z$ a i3 u$ K
{
$ t& j$ b3 d! ~# E2 m8 R) q K( w var orgNode=node;: I& _ p( Y$ |1 o4 f
var orgColor=this.getobjstyle(orgNode,"color")* X* C2 n! x f# ]3 u, [' I
var orgRGB=getRGB(orgColor); ' O4 j H+ D7 Q! x
9 @& L" `6 N% f var parentNode=node.parentNode
; [6 ]& ^& j' a2 w" d' R0 N* o( g var parentBgColor=this.getobjstyle(parentNode,"background-color");
. i0 _) O# N8 d % J, i% J. I- K/ |1 a
var isLast=false;
0 k8 g. p4 h! ?" s$ M! P, T1 O 7 t* N- F% s$ r& v( P3 l9 m9 F- Y/ a
while(parentBgColor == "transparent")
0 o, v2 U6 q9 ]! G9 U2 {$ y {
. F1 w5 Q6 j- F* ?/ F 4 O* }" H. M/ W
1 e: j9 ?! ~3 a0 I; l+ g
if(parentNode.parentNode == null)
( h2 W# W, @) S2 _ {9 f6 b4 ]. J; d) N3 i
isLast=true;3 K0 ]% X: J' b( C/ x7 b Q( i
break;
5 I0 F* m/ H, p [ }" J6 M/ O! G5 P4 D K
parentNode=parentNode.parentNode;
' D4 x, m' x' y7 w+ m$ G/ K6 m parentBgColor=this.getobjstyle(parentNode,"background-color");2 [! ?* u$ s, Q5 |. C: A: i
2 T8 @' V5 u) E if(parentBgColor != "transparent") 1 l; B) V9 d5 K. r( ^9 i1 a
{
- T a9 C% |2 n2 s' P( f& A, u) P3 _ break;3 T' T( I0 s# H( s7 k! o& E: U/ U7 [+ ~
}
' F$ c4 U; I1 x3 [/ [+ v! h } L4 T2 @) \) B
if(isLast)
4 q# K9 Q) O. d7 Z" X! t5 d! m {2 P' y$ n6 m0 E& h
if(debug); [: v6 R0 {+ c: J
{, Z8 V# ?3 C# |$ E- P, T
alert("last!!");6 x# y6 q# t* F/ D4 v; J9 S
}
: N% ~8 z9 a! m/ ~ if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue)) d; ]* D" z$ q; e) a" A" K
{+ Q! M3 _% b, _! g# `/ M$ c4 F
orgNode.parentNode.removeChild(orgNode); 4 u, v& @4 {: r
}: i* C# z9 z2 F
}. D- J! h9 C% N0 o; k
else
% R: \: Z& W7 T: t4 V {
. `0 @3 _5 G0 A- ^( ~% G if(debug)9 x4 y) b- V; N% D% q) h
{
1 c$ w' @) d/ j5 p! W alert("compare color and parent bgcolor!");
) b" E8 s" Q& K0 m }
. }7 E, M4 j! U& _3 B+ p( g parentBgRGB=getRGB(parentBgColor);
5 g5 b% U! r/ l) h if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
1 R- `1 Y- d. ~9 ]% W% j7 f# O {
& m& H Z* q$ } orgNode.parentNode.removeChild(orgNode);
8 L1 |8 U: c) b }$ w- n! L( g2 e
}
( ^3 r% T( C: _/ I- I }
# `+ |1 Y& F% Q' E+ V; V }
8 E$ G& u- U# p4 P$ M- g }- V9 b! l. z) ] I7 M8 ~
}+ O: h5 K5 S! i
! _4 y! y8 A; j6 J0 ]2 X! v; o 4 F! ^2 G/ H% i0 T+ O" q6 V
var itemFrames = page.getElementsByTagName("frame");
6 F/ S4 @1 c9 e) K% t, V var itemiFrames = page.getElementsByTagName("iframe");! t c6 y! r9 V, ~5 h M
+ }2 G: G& _/ h1 G% W7 F
var frame, iframe;
* f& R, P3 f4 D2 Q# \ if (itemFrames.length > 0); I+ g; }1 W4 P3 I0 B7 {
{: d( p, \4 s6 s9 i$ ]* S! j
for (var i = 0 ; i< itemFrames.length ; i++)
E7 x" `0 M! n" L c! M {9 s) H, |% D: F$ ^: I$ G, V4 Y
frame = itemFrames.contentDocument;" S; }$ }7 a3 g! I1 t2 O3 }
this.RemoveHide(frame,objname); 2 T- x/ f& k2 C. G6 _3 o- D t
}
9 I- W m `0 O# Y6 t }. d. b6 m3 a- ]! U! _
if (itemiFrames.length > 0)! {* p, s. t: w# }0 L8 J
{
$ R) h) H+ i6 D' u I for (var i = 0 ; i < itemiFrames.length ; i++)
, K+ l4 L5 k# ~ {
/ c6 E/ v( K- Q# [/ s& T2 [ iframe = itemiFrames.contentDocument;
2 V t, O) H( F3 X8 I) L& ~ this.RemoveHide(iframe,objname);
& a1 q' D G o }
) D6 |4 L q+ ` P+ Z) G* ^$ s# C }
) P+ b; O+ Q: { }. h6 x* P' l4 L: h/ p$ q
catch(e). V; z3 ?! |! x: k2 t" t
{
- y& `! Z' G( v if(debug)) M+ O& Q; i$ G- X
{/ C' G C% R# F' J3 A
alert(e.message);- g9 @) C3 V% h& L" I
}
! c) K4 U$ U8 X: }% X7 k }
* h0 }: [4 ?- @5 R1 d p# K }8 d B3 i! @% }8 ?
4 J% k- Q% R4 R}" e% ~& g4 V; I- @2 y
: j5 R# o3 A/ B- ~8 Mfunction getRGB(colorString)
' n! F7 g& U& _0 V{
% w9 M: l# ~9 g4 [2 R2 l O' \ var RGB = new Array;! J% h& P5 v1 B& s) k& S) H" A
var tempSting=colorString.substring(4,colorString.length-1);" X$ I" B. g1 ~( h" } Y/ Z- p
var tempArray=tempSting.split(",");
' V, f* {& Z& Y% `& s
$ V$ e1 B3 m9 U% M RGB[0]=parseInt(tempArray[0]);
, M, f9 U/ {+ y7 n* A7 q6 v RGB[1]=parseInt(tempArray[1]);
; G$ }: M$ V& P5 d3 }0 U/ B6 s. r$ s RGB[2]=parseInt(tempArray[2]);' f" c3 x- m' A7 q* N
7 u0 |! F9 O3 ^6 s( p- h0 @ return RGB;* Y* P; ]# I% l& ?# a
}
- J( g$ C8 V8 Ufunction keys(evt)
$ _; J: k, X9 K# t. F { ; f% ?, C! @- j, a
if(evt.ctrlKey && evt.keyCode=="81") 6 r: _. {0 G A7 J( c
{ 0 [; V! J. z# X! r# c
CleanHideObj.on(0,1);
+ Q7 Y( B# d# u8 V% D6 z# [1 v7 } alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); ( B& l, w* t- b' [7 ]1 ~) u
; m0 g6 b7 @# n* r9 c
}
7 W; I( p0 w" l x* [6 F }
: o: k! D& r; B$ `% G5 Udocument.addEventListener('keydown', keys, false); 0 V! y0 o" q+ S
GM_registerMenuCommand ('Clean Hide',; I8 w t: Y9 d3 }
function(e){
$ v; M) M- R+ s3 _4 tCleanHideObj.on(0,1)6 e+ h6 U" X5 {3 ^
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
; L+ H# f9 m" k$ c) \6 O+ q});
( s5 R9 Z" \: x8 J5 s |
评分
-
查看全部评分
|