|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
8 k3 F5 D* F% k. K7 O+ b( w3 U: b% `
0 P5 q: |9 I8 h! @火狐插件,用猴子
- z) R; J+ f. @* n: c$ p0 E2 l/ J9 T }* l
var debug=false; 0 g7 |) }: b3 @$ w0 z5 I
var CleanHideObj=new CleanHideClass();
5 \$ g0 z5 |( h/ T9 _
5 B6 p8 _* }/ [ nfunction CleanHideClass()
0 K' L) V7 ]& W0 s/ Q+ H; c5 L3 t% {{ 8 Q& g, f" A0 ^- ]
$ w" \, c- V `0 z( f# r' ?, D0 { this.on=function(id,bMZ)
: s" L, a1 e' T, K/ P* D \ {% a- W) e& F! h7 o
- D3 r9 K7 k0 _7 \# K( O/ }0 l if(id == 0)/ |0 g6 x" A, u
{8 Y' w7 ?; ?3 V8 x
var page=/* document.getElementById("content").contentDocument */document; $ u, J! h$ c+ F) t- ?7 O. O
this.RemoveHide(page,"span");0 f: `0 s8 e4 K$ G: C. o/ O6 G
this.RemoveHide(page,"font");
7 h1 L X- ?- N) U( ~$ | this.RemoveHide(page,"div");) X% x$ a( z8 T7 U: }2 m6 t
this.RemoveHide(page,"p");
3 y0 j( v! a2 z. f/ u9 M
( [6 |- `* i, _" R }
, X N- @( h. |5 i
! D8 Q8 o1 O) ~0 G7 `1 U$ ? }6 W/ Q l7 H8 H( m+ F6 B
this.getobjstyle=function(node,prop)6 r- e- C; }# b, P
{
( a2 V. K0 D3 g& V9 U; v K0 U try
2 P0 H0 v& U; `+ ?/ F: W4 n {7 c' Y* Q3 U& H% O5 I' p
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);% F0 q& V b& Y0 C$ N! z' K
}9 {& k$ b9 h0 e! Y7 m& j
catch(e)
; B s* x5 u. y$ h- a {
( I# S' \4 e3 B! Y if(debug)2 ^4 ~) v! f5 D. l
{# _! k$ k- o# F D, f
alert(e.message);
% n# b/ A! X* O* H- g- c2 L' \ }1 g5 A/ V& x6 V1 a! w! \
' H1 B2 |; ^5 P2 n0 |
return "200";
- |6 f7 r. B8 L \ }
5 c9 L7 Y3 c1 w5 I- z9 } }
% G/ E" ]" O% s8 y. N$ X# X% q ?" {! l+ E8 F! g0 d& o/ t
this.RemoveHide=function(page,objname); f. j9 w/ C' Y+ n% D
{4 R- d' ~& d. r
try' A, X$ {/ V3 e+ U) s7 e" C+ [' h
{2 y, d7 ~( Q, w% d2 W5 Y' i& T! u
var minValue=15;
$ K) q5 R; P+ j" u# E var objs=page.getElementsByTagName(objname);
4 ^0 _/ }9 Q1 X4 u9 P
( e1 t- B8 d( Y& S9 x3 b if(objs.length == 0)
! c2 S' W# W. ?; p' l {' b9 O+ ~3 S# q, }; M0 I% I
if(debug)
! T# S: j" z/ g, z: @/ X! z. p {
/ Q& g# g# U) U( M% w alert("no object found!:"+objname);
% `; S- D+ }9 T/ O, b; M }
0 p4 Z) {! Z L4 R4 [1 c }- o, M0 j! _; ~2 G
else
: j. O% Y+ N8 @4 w( \$ F) @ {
: F H3 U# |+ r# W m2 Y
5 b: b+ T5 P0 I$ h! s for(var i=objs.length-1;i>=0;i--)
$ a6 C4 k, [8 U) ]( r- i/ G {
: f) P! c+ x: n% }0 v e var node=objs.item(i); - M! l! ^6 q+ Q) X
& u8 u2 q/ r$ V/ t% J7 ]4 Z # o' r; T3 Q5 B# h* h5 K
if(this.getobjstyle(node,"display") == "none" ||
8 M$ |7 ^8 L% v) G# p* d/ t% S) X this.getobjstyle(node,"visibility") =="hidden" ||7 {# [, w5 h9 V) e
parseInt(this.getobjstyle(node,"font-size")) == 0) ) B# j7 X9 }+ N# M2 i
{2 v5 L. g" ~1 E. B
if(debug)
3 w) u* D8 [, d. F8 q( g# D7 O {
7 N8 A, a" r/ ~6 A3 A% p3 G; A alert("remove invisiable!");
7 C; ~% R2 o7 Z+ L }. i" c: |% K2 ~4 U
node.parentNode.removeChild(node); M: |- m6 I$ d1 |% F s
! t) B/ s1 ]- x# b! b; \
}3 |- o' v4 |( {
else
) G9 ]8 ]5 g* B# M! J {
! n3 u& ]! B# @3 i* u( [ if(node.parentNode)
9 z# B5 A3 n) K* m {
, T# {4 \- O6 x z6 _4 U4 F var orgNode=node;
* p! c6 y7 j8 O# K1 } var orgColor=this.getobjstyle(orgNode,"color")
6 w/ Z, Z ]! S* [8 f' n var orgRGB=getRGB(orgColor);
" }0 c K( {9 X: u/ N8 c* |- J : U3 I. R1 g6 p
var parentNode=node.parentNode2 y O" f7 m" H2 `: @* R( l+ _
var parentBgColor=this.getobjstyle(parentNode,"background-color");3 f' K9 u2 @" P
7 i3 }. l7 s! T- O0 t+ J0 W1 [ var isLast=false;$ N' s4 R9 p/ {3 g
; k# N2 W: k( F7 J# @ while(parentBgColor == "transparent") / L& J$ _* x/ t) ?) R6 S3 h
{% F/ K* i% j( v, K C3 ^
0 T0 P8 g) d. w
4 s! `% A! a3 `. N if(parentNode.parentNode == null)
: o2 e, d- S9 K _, {& S {
9 g# i" x' G0 Q1 w! L- Y isLast=true;( k1 S! l0 j3 Q1 u% ^3 m7 t' o
break;+ X6 W; H- Y0 k
}
* ~: h3 Q! C: R" O. }. ~ parentNode=parentNode.parentNode;$ L4 |5 e& M- N1 y" C& f, ]
parentBgColor=this.getobjstyle(parentNode,"background-color");
. U/ L3 z V5 z; l7 m4 g4 _$ a! e/ N, Y" T, r0 ^2 K2 `6 e# q# `
if(parentBgColor != "transparent") 4 w& h* g" M# l% \% a
{& W ~7 L& V7 r$ |7 Z! o2 p
break;$ j+ O6 Z/ N! U k' e f, h
}
% L; Y2 I. T, k1 ^ ` V) S8 ]0 j8 J }
5 K0 J5 }0 C1 V' z/ ?) h if(isLast)
( ?; I0 v& ]7 R6 d- R {9 @( Q. ?" C7 r& `4 p
if(debug)6 p1 S. Y# H4 ?' h: H" a$ I
{7 Z' O: o. _7 N& b3 s) K7 P) y
alert("last!!");
5 S* v; I4 h8 e# R- d9 z }
9 R3 R" P; z, [, V' L, n if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))3 a. [) X- t1 y, m, r3 p, ?& @
{! ]8 e& g2 @/ I7 l
orgNode.parentNode.removeChild(orgNode); % P3 a1 R1 W1 |$ N3 g: w/ {
}4 u) C! D3 {# G) V/ O& k2 i
}, i: g6 V+ M2 E: m
else* ]' h4 J# t# \& k4 b/ q5 E, ]" ?
{. q1 H5 k. e# I
if(debug); O' T5 N |+ o4 b) {' P$ a- l! |
{6 h+ s1 ^0 f: R& C# Q( x4 z( l
alert("compare color and parent bgcolor!");
9 z. ]4 N1 R# S/ {+ a* R2 ~ u }9 s5 [" F$ D( U; l$ }0 |0 P& p
parentBgRGB=getRGB(parentBgColor);
3 f5 U" J. [+ \" K! y% X( H! M# J. s if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))8 |0 }& W4 F/ {, a. H; r
{1 X/ B3 d- M' X( M' l
orgNode.parentNode.removeChild(orgNode); * X6 c0 S" V& Z2 Y
}
& q `$ e" e- _7 P, R }6 D9 m0 m/ U, c8 |0 x! |! P
}0 P! I* O$ V) H9 k
}
* D1 n) V T" a5 F3 v2 d/ g1 d1 Q$ l }
( {# L9 a5 x Z5 h! p. N3 L) D }
7 T; o" O: j+ Q6 G - ~9 N. }% k6 Q9 m( Q$ r' E& c
% m! L# X W) m# {$ V var itemFrames = page.getElementsByTagName("frame");2 L' P. V5 [( p/ f; m
var itemiFrames = page.getElementsByTagName("iframe");
4 U/ W0 e) j8 B; a0 i& w' o # o3 W8 @; }! n6 }
var frame, iframe;! I1 |- f* a% B2 k u4 a3 E
if (itemFrames.length > 0)" A9 F0 G3 t, U s# u1 a
{
% p% p- ?9 ?3 g2 E+ c1 R9 X& F for (var i = 0 ; i< itemFrames.length ; i++)
. H& V% j0 l. Y N$ M+ `! f; P {
, Q: ~+ `7 {! h. t frame = itemFrames.contentDocument;4 `. K( s! S+ y/ @- b
this.RemoveHide(frame,objname);
( n# X1 V- a0 s3 T6 t6 T }
6 t2 p" P1 F# W+ _ }7 f# q" F+ @" M$ N
if (itemiFrames.length > 0)% M! K/ r/ W- ?
{+ i5 h5 @& ?9 ]2 E- |- i
for (var i = 0 ; i < itemiFrames.length ; i++)
5 c" T" [5 P% G! z1 @) O# K {
, I9 @: r4 Z8 O9 I iframe = itemiFrames.contentDocument;
' @7 M( x; S% ~9 N: q this.RemoveHide(iframe,objname); 2 H4 H. i9 d; g: v3 d. f
}5 m( G* c7 n9 q/ O
}
7 C" g/ a4 _0 K/ M+ H }4 G$ m' ]: o) \, W* }" [1 p
catch(e)
" f" h: P+ D7 o" x {+ b) s; n- K7 X7 w
if(debug)
8 B! A+ @# _& B8 P. a {
3 q+ L! G2 ]7 s$ j% `, F# c: g alert(e.message);
1 O. k$ P4 }& p: K }
3 w( S) P! _7 J( C; L+ {$ b y. { }1 e1 q7 Y% C7 y6 m, n
}8 D' t1 ?* E3 G
0 ?7 a+ ]9 Y- F. q& R3 u [
}' W0 g' n# o7 ]6 X1 d4 }/ R
' }) i% D5 j' T+ x/ t' Lfunction getRGB(colorString), a2 m; H# p( O" \8 `5 e
{
p( ?( R4 f/ _8 j, x var RGB = new Array;
' ^5 v% Z% C( x! S: R8 h var tempSting=colorString.substring(4,colorString.length-1);
r( S! X( e# _3 i1 ~" [ var tempArray=tempSting.split(",");0 Z7 T |8 _. p3 F6 v. @ X
8 x$ x6 R# o4 G; b3 Z% I
RGB[0]=parseInt(tempArray[0]);
4 ^4 [6 ?' G3 g' o RGB[1]=parseInt(tempArray[1]);
- H, q5 a% T, z- [$ w RGB[2]=parseInt(tempArray[2]);' U" e8 a) R8 w, r
5 T) Q2 c. i& B% p: J4 H
return RGB;! C+ s0 Z7 R( r2 b$ |$ Q! n
} M1 W) S. F" R
function keys(evt)
% Z4 Y7 a! X1 m( L* h, W8 l5 T; x" X { $ |0 ^, b1 V' I- Z
if(evt.ctrlKey && evt.keyCode=="81")
U- b8 ?( P2 W7 d: A { % h. H. q0 |; D0 b) [
CleanHideObj.on(0,1);
8 }1 B h% J m7 l/ J$ j alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); ; T7 B$ z' v2 T9 ?' M1 X' G
2 t+ j! r6 N7 V }
+ H3 }0 |# u# a; K) J } ; D& V/ j" [7 M* c* C0 f3 A" v
document.addEventListener('keydown', keys, false); 4 t5 Y2 l! [2 k( T' c
GM_registerMenuCommand ('Clean Hide',
4 D5 k+ @% Q8 V- }' O# V, @function(e){
3 o1 x) V s0 K0 y0 ~CleanHideObj.on(0,1)' C1 ?% c- S+ t" t
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");. u! \5 _1 |' Q
});1 k$ R: ~ [$ q! F, K. u2 V
|
评分
-
查看全部评分
|