|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
: Q8 v9 Z; M3 V; }5 w7 x
9 s2 _: e1 u, d* g A$ R2 x: b- e T" s火狐插件,用猴子
c3 L* E: b/ G1 d& R% j. o4 k0 y4 L7 l/ U! }) a
var debug=false; 0 G4 a! A! _! j/ U9 o: t4 G4 v
var CleanHideObj=new CleanHideClass();/ Q1 A- C2 d' u. J# R
6 V5 @/ Q4 m/ k0 o2 h* Z2 Sfunction CleanHideClass()
8 l& g5 K2 K1 l{
1 n( L2 \" T6 C! O& i
% n; m7 N6 Y% g% R# {& C( z this.on=function(id,bMZ)5 q2 d: @( k }
{
E/ k% u i' r% P# s8 C7 ^9 Y # @& R5 [4 \. t) J: w
if(id == 0)
% N' R, I& c6 t4 d( p( T {
# `, ^. v3 N3 v( i! c. X; k var page=/* document.getElementById("content").contentDocument */document; % y7 g" y0 x4 ^* O# g! ^7 ]
this.RemoveHide(page,"span");
" C) Q- J1 h t8 w/ T6 z this.RemoveHide(page,"font");
% Q% P& V7 A6 q, [& k this.RemoveHide(page,"div");
; }4 J+ u) F9 H2 R: S this.RemoveHide(page,"p");
0 C1 @9 o2 t* A# s 8 `7 R- q9 f: \
}# a# p9 D0 E! T+ S" [
1 _* A: _2 P7 P: ^! `9 o1 e }
7 `; E$ Q: I, o. m; P this.getobjstyle=function(node,prop): M; P/ p0 T% F5 P K) Z( Y% s
{( h' w/ j. g( B8 p" J$ H
try7 w$ B) Y8 M. f& C! z! S' r5 A* K
{7 }1 k5 D2 U! x% H) P% p
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
0 L. M$ v p5 e( d+ G" b7 k# U }
% _7 d9 o: U9 X* }+ ? catch(e)
: J, f t# B2 h4 V) ~ {
$ @) f% L; S" Z0 O/ O$ b. V: ? if(debug)
# ~$ I5 G' S+ [; K1 L+ O' H {8 R# R" r6 W: T( Q) R. {' M
alert(e.message);
+ s" f2 h% f. Z- Q7 p' e8 @6 S }8 o- I1 }3 O3 t( }3 y+ `
! o+ Y& \8 {! Y0 w" i- Z l. z3 @% h return "200";
$ [& B% @1 U& N0 L1 Q }
$ l% A- r$ ?8 } }4 _ v. B- z: F: u0 d+ D3 u
; J* Y/ [& S' ]9 R
this.RemoveHide=function(page,objname)
5 F5 H' V% a# }7 \' O. W; H/ u {5 r0 A: p4 n2 m% f1 F$ Y6 T& A3 Z
try5 X2 l8 x: X5 d
{
2 |. C {4 N* z$ v9 P% V- Q7 {8 X" `3 E var minValue=15;) ^+ t0 W) p1 \, b
var objs=page.getElementsByTagName(objname); / F" d/ L J" T6 @# g% N% H! z( ~
1 K1 _9 L d! ^ if(objs.length == 0)
3 F9 i2 o- L+ R7 s+ }) c {
5 C3 e, k g4 J, A if(debug)
1 Q- m: J8 b# s* y/ n( a {
* E( G0 U! @& G* w3 w alert("no object found!:"+objname);
' W& y4 d) D! n6 T1 Q% n$ p }7 u- t1 q9 u9 t# V
}3 n+ c, U# |% Y/ B
else, g& |8 c! V( j! ^& E
{
5 K' G4 {3 g! u9 m 7 V; _7 o2 S8 n; L( \
for(var i=objs.length-1;i>=0;i--) 4 h. e" c% `* x" z# L% W2 r
{6 r, [3 @% |0 ?# I2 `) y
var node=objs.item(i);
8 Q( a7 q/ W; z v% y* c) o
$ ~# [' Y A: t0 W1 r2 P
4 f+ s O4 B6 V if(this.getobjstyle(node,"display") == "none" ||
4 u( m7 C4 L. w% g+ {1 d1 E this.getobjstyle(node,"visibility") =="hidden" ||
5 k! D& N5 A- }5 l parseInt(this.getobjstyle(node,"font-size")) == 0) 7 p' u% R6 i4 T0 s: ^
{
% Q( R4 o2 K' O7 Y# b/ A- X4 f if(debug)
# C5 f4 H3 N7 w# W {/ A8 k T `# n( V, j# |
alert("remove invisiable!");& Y6 H: d# {* x+ w' Z1 Z3 t5 K
}
, B7 [' J, |% D) X4 s2 v. H8 \ node.parentNode.removeChild(node);
% e2 [! b3 _0 C" k
) U% [5 l* s4 z* j9 Q Q }
* h# w+ z3 o2 g8 J5 C4 }- c: p- z else
! d2 f4 `0 h/ u, m7 _0 E4 T {
y' C, H# b- c" V: A3 b4 ?* A8 g! ~ if(node.parentNode)
# q4 r' f4 A1 T) Q. E {- x& j) C2 i% W5 n+ @2 o+ X) Y
var orgNode=node;* w" e1 i8 k& }" M% u
var orgColor=this.getobjstyle(orgNode,"color")2 C1 }6 t" b- y; b
var orgRGB=getRGB(orgColor);
# O$ m8 b& E _
# Z: p1 F3 f& E$ e8 F& L1 l% ] var parentNode=node.parentNode K. r/ _. \. W7 t" b
var parentBgColor=this.getobjstyle(parentNode,"background-color");6 A7 V4 V& I# e. l, [
+ S2 K d4 Q- J4 m
var isLast=false;
5 Q9 X5 e& I( U0 G( K 3 y: L5 }. I& U# B- t
while(parentBgColor == "transparent") + x& x: N2 e o4 a4 l
{$ c* P. u) {9 X6 l
6 ]+ H) J8 @) w: g9 g
8 V9 f- b" }' v& A. @' e' C if(parentNode.parentNode == null)$ t% V3 i; D! I9 M9 `; f
{7 c0 J" Y) E J: n; S' \ b. R E
isLast=true;
! x5 v- l" k) }; P1 Y3 }2 ^# }7 d break;
, W, l9 B+ N# [, `# x }$ p; \' |4 m/ }* K1 N. H
parentNode=parentNode.parentNode;
# j P5 G, J( M7 P5 Q8 t- u parentBgColor=this.getobjstyle(parentNode,"background-color");+ t: }& O7 J" j) o
7 w4 p0 {1 i8 j5 m5 J if(parentBgColor != "transparent") ) T" D+ J# i" e+ [' v
{' f; p2 B J( `7 Q5 F% D5 T
break;
1 Z$ f7 b0 R5 n/ V- I+ K8 t+ @1 ? }3 B: D0 o$ }* c; S4 |
}0 b5 ~4 m, O9 I; f: a9 z/ U( L7 z9 r
if(isLast) ' n$ ?8 s% q0 d- e5 t" Y
{
7 c! H2 H P6 q' `3 h. x if(debug)
! H, Z9 W+ j7 q O2 h, d+ U {3 K0 e- N# j Q
alert("last!!");
( M' j3 i0 f8 L9 r/ m3 @" h }
7 E" q, f4 G% y i" C/ _& m if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
2 a- n, U2 _9 x4 O" f5 l3 @ {
& b- u) i3 p- G6 I orgNode.parentNode.removeChild(orgNode); 9 G% i$ z: O" f
}
t( l3 X! g5 w3 k- P }$ t( V! F8 ]2 R4 F
else. U' E- \( ~7 w& L T# s# I
{, x$ D6 w- x8 H( U! n
if(debug)
6 T4 f& H3 c+ n& q d {% y1 k6 R% B* O5 h# {
alert("compare color and parent bgcolor!");+ z: f2 H$ t" o" N
}
7 \3 V$ L; E: b2 A! `/ X+ o parentBgRGB=getRGB(parentBgColor);
/ J! p6 g' q" g' D6 [ if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
& L% N* X' L& R! ~ {; a2 i7 P6 u' S5 N- ^: ]
orgNode.parentNode.removeChild(orgNode); ' R- ~& Z6 |$ c' H% Z7 r( g' k
}. {; m) h' f6 a
}
/ V& e4 c- k0 ~+ A* t, W$ P/ @6 F }7 l/ e% P5 d8 f6 q/ B4 p: a
}$ ?' J; w3 G- Z/ c
}8 \8 u% a/ b7 y" L n; s
}
B; I* n% w4 ]3 O 7 B- C- _( d2 h# K* T" h. z9 w; J# q2 b
4 A& w& w1 O+ A g5 [ var itemFrames = page.getElementsByTagName("frame");2 i0 ^8 r2 j) n& {! n( _
var itemiFrames = page.getElementsByTagName("iframe");
3 j6 q1 |9 p# Y
Q; q: z, Q0 g0 r4 d& m var frame, iframe;; z1 p$ K* @3 @4 e. v, {8 Y% y
if (itemFrames.length > 0)
& m' a, P$ {- O9 v3 H# ^ {
+ U* \% z/ P" N* m5 w for (var i = 0 ; i< itemFrames.length ; i++)
7 U9 E& k9 a# j: B% e {0 J% T6 }3 }& Y, b, i6 Z; P! y
frame = itemFrames.contentDocument;
. I) Q) n6 M5 p/ A this.RemoveHide(frame,objname); $ v/ g5 A+ U3 m ?9 j }* `- Z- x
}$ ?( T: n% R6 |/ e
}8 E( c0 g7 Q; G9 g0 m# S3 w
if (itemiFrames.length > 0)
* D+ ^( U A5 Q, Q+ q; r {" ^" T4 H6 O* t7 `
for (var i = 0 ; i < itemiFrames.length ; i++)
' f9 z% V3 i1 B+ `8 K {2 m" N2 U7 b( a4 d4 G
iframe = itemiFrames.contentDocument;
0 w1 y P; a4 o" V! i% R9 f l4 h this.RemoveHide(iframe,objname); 3 O0 a' X9 n h6 l& E" o
}) P6 D. q4 u7 B% X0 h5 F0 d
}! W9 C: M( `( h$ g+ y( d
}) C0 I" r4 f. K/ X, j" H$ b
catch(e)# d- E0 e2 ~. I. U" A+ b# w
{
/ ^' x& @4 O8 |$ }4 J( r9 e i* D if(debug)! N5 S1 |$ I P% S7 Y
{. X* t- {4 w9 v T. V
alert(e.message);
[7 Z7 K+ g; o# I }3 G, i! h4 {! J, K
}0 s: l3 \* g+ ^4 c+ |1 N8 ^4 [9 E
}$ K. X6 k! s1 W: V# [3 ^$ s
" O, r7 _# v3 J1 {
}4 X7 y1 J/ h# w7 Y/ |! K! h5 [+ }
0 @) a& G2 E# S+ D& i( D! Qfunction getRGB(colorString)3 {- @0 P2 q: T" F1 }4 v: j% R
{' B# S1 T7 P1 |' `
var RGB = new Array;( L/ o" y6 s! o$ ]% v
var tempSting=colorString.substring(4,colorString.length-1);
9 L4 K8 i$ U+ T% w# _& o" f var tempArray=tempSting.split(",");
' @. w( A( P! X" z2 s q7 ^8 F5 ~6 S5 a
RGB[0]=parseInt(tempArray[0]);
7 s3 r2 d$ q5 v3 x6 o' p. g, | RGB[1]=parseInt(tempArray[1]);; m# e' x1 ]# V
RGB[2]=parseInt(tempArray[2]);5 E1 j* V4 {: f# o% X* h
3 t% a5 ?: U! E) n8 E$ V' j: X
return RGB;
! B$ V2 l, n, [# [* q' s7 X}
/ z) c4 Z8 L8 pfunction keys(evt)
. ]. c, ^& i2 A3 Y% E; U# i1 n { : @& l$ i6 d& i% \+ T# _& F, W
if(evt.ctrlKey && evt.keyCode=="81") % D' q& _' w- g0 O7 w
{ $ e' d4 N) w8 s- A
CleanHideObj.on(0,1);* {2 }% M) p6 ?$ w; p/ t( a
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); - U! K7 k$ R# f' r6 Z
' u3 B+ v3 _9 ]% z9 j, t }
, p- l7 D5 B; V } ; O# \% K8 e6 _/ E
document.addEventListener('keydown', keys, false); 7 c9 I6 ?; w$ Q5 {8 C
GM_registerMenuCommand ('Clean Hide',
; J2 q, J9 g5 m2 {+ Z7 ifunction(e){1 k, v$ U |7 x) [# D0 c
CleanHideObj.on(0,1)
|7 D3 P$ X# `) }" S8 J9 Calert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");; T2 M. E- M1 o$ ?# E8 R# a! X
});; o$ t/ T/ g; {& m
|
评分
-
查看全部评分
|