|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 5 N) C) @) t$ E% T- Z8 b) W3 X
8 Q2 k7 ] i6 Z5 ]+ C& w, \1 @
火狐插件,用猴子
& m+ x; ^) v( E R% U1 u( _5 }; u, I# Y! L" R# v* q
var debug=false;
+ h5 ]/ |* F' S2 \+ w7 Tvar CleanHideObj=new CleanHideClass();. r7 \9 E. _; Z
. x) }$ a! t6 ifunction CleanHideClass()
9 D2 i# J6 c" w{ ) m. A( X6 [9 y7 W4 A G7 N1 x
; _0 v0 c% x- G$ D
this.on=function(id,bMZ)" B6 ~4 i/ V4 N7 M
{
% g0 Y- T8 A7 F( C5 P4 h
8 G1 Y" `& x0 B+ v7 d( K8 j' F4 o if(id == 0)
) h8 \: H4 y% Y1 u* N: I {3 U$ ^2 y2 N+ S. }2 n# g, m
var page=/* document.getElementById("content").contentDocument */document;
( P. K# I2 W9 D5 h1 M0 B this.RemoveHide(page,"span"); X) H( P$ t( s4 J0 u
this.RemoveHide(page,"font");" e4 k- d# c4 {
this.RemoveHide(page,"div");3 y# s/ ]! P& ^" m$ D( g
this.RemoveHide(page,"p");3 y, F5 x! w1 z3 ?2 P0 s
# }1 i, D- b4 y6 n) ] x- Z& @ h4 V }4 I& ^/ k2 @" i4 ] W0 X
6 k# e1 |* |0 k) {" q( u6 j m4 G }% V1 C( f$ S2 o. e. {
this.getobjstyle=function(node,prop)
3 s: J2 ^! x6 a9 g S {
# E# N9 a0 s+ D! B- J try6 d& ^" U3 G4 ?6 K2 V5 H
{( e O( `6 n( h& ^3 o G
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
) P" m$ x W/ d+ K, w2 z }8 }9 g* @0 H1 V" N1 J0 q
catch(e); U4 U# ^# @2 q" T9 U( g# l* r
{
, R9 y# {# Y; o0 f1 {/ v' ]* C if(debug)& G$ m4 W% S: x" y' [* G: P; Q0 o
{- H. Z" ^$ U0 r* f0 N# U
alert(e.message);
. U' c. V4 o- L ]( L% t5 [ }' _0 b( {' r4 h! S* G2 ]0 b/ l7 ?
4 q& s4 G6 J0 h5 l0 ^) U- l
return "200";9 w6 m$ E0 R5 ~. ?
}
% G5 a) e. s! y) b$ } }
1 r* b, |% c" u 9 l$ d; V' [; b7 o$ w
this.RemoveHide=function(page,objname)
1 l% p* _8 v b' \ {
& F0 [ D' v! c$ Z" P4 g try6 S( b* W8 B! J: C- d" L
{$ e) `. r% K3 Y( F" n
var minValue=15;$ G+ F* V1 i5 t! s
var objs=page.getElementsByTagName(objname);
% z; Z) N; @; h9 S) {+ b5 J9 `% F& j1 G: |
if(objs.length == 0) ! M; N- G6 B- \3 V" m3 K
{; y9 }" Y6 S7 Q
if(debug)
. K" K) I z% S5 |* G% J {
/ n5 }5 N+ N; C! I alert("no object found!:"+objname);
! u+ t0 J! W8 d. S& M }$ @7 t8 r" {. C8 o D7 q, e
}2 v% K, \' I7 G1 f0 e; Z9 f
else1 O% M4 L/ z) U d
{
i Z" n& Y' A1 w) X8 v$ ~ # p* }7 ^% K' q3 E( Y. r. P
for(var i=objs.length-1;i>=0;i--) , g# z& Q1 U: d5 @/ q
{
5 z9 V9 j* B; Y% f' c. ^! ?# X0 p var node=objs.item(i); 5 x' N( R+ K4 E+ G1 F! b! K; e
' L! |! c# V, _: o$ s7 J
# C" @5 B/ `2 i# O6 [9 m
if(this.getobjstyle(node,"display") == "none" ||7 S0 k' S" O+ L& r% _
this.getobjstyle(node,"visibility") =="hidden" ||
$ N ?9 A$ t. h parseInt(this.getobjstyle(node,"font-size")) == 0)
8 d- ~& q; _8 t9 X4 e {! m `9 d! k2 X" x7 @3 J3 i$ M9 `
if(debug)
H u% |' z; v p {. Z! M* H. I5 f2 J& q
alert("remove invisiable!");
3 F6 U% l/ {! A, O }% Y( n; Q5 R0 S2 m
node.parentNode.removeChild(node);
1 M$ I! P0 E6 @# c9 Z
% y- _# K% y8 }5 x d }
& V' L& x6 I" p/ `2 [) M else
9 A- f1 n7 ]4 M; {+ _3 p- y" t {
: x8 M9 {3 O9 z, P7 P if(node.parentNode)
9 T$ Y4 X7 ~7 m& F9 ?' F { T4 t! c3 h A- h3 q
var orgNode=node;
8 Q/ j, X: l- ~! y var orgColor=this.getobjstyle(orgNode,"color")
4 k/ ?0 e$ x0 r/ @! X+ {8 |+ g var orgRGB=getRGB(orgColor); . q& |; e+ d X0 G. y' c! L
7 d, L" k3 m3 _. z
var parentNode=node.parentNode
6 d. E. x# d7 v! y var parentBgColor=this.getobjstyle(parentNode,"background-color");4 A& I' g/ C/ M' D
1 ? g& h8 A5 l var isLast=false;
3 P9 q" Q3 [* ]1 Y( V7 x5 @
! U. L- S) L* \$ j, U while(parentBgColor == "transparent") & }: @5 p/ }" F* V8 l+ T/ Q
{& |, G& s7 e! K& a2 K" ]4 b: w
" }7 Y7 I# @% [$ x % j6 l! o6 u$ O! v
if(parentNode.parentNode == null)
. {2 i; M4 S: v3 C {; e$ H9 Q. I* ?0 s8 K3 ~. t; q! L
isLast=true;% g& a4 X; k/ u3 ?4 {" i m
break;! t! }7 A% y, Q: V; {, S! N. l
}
: ?* h- r0 `7 _ parentNode=parentNode.parentNode;- V4 z9 W) d% p/ _
parentBgColor=this.getobjstyle(parentNode,"background-color");! g6 o, U+ C( G6 E3 G+ O' v
8 Y& l. t$ B. E4 R
if(parentBgColor != "transparent") $ ^7 }" _3 y; b
{
; ]! M3 X. Q3 j break;1 w* e7 i7 c, R L* s# Z
}( [0 W( N1 w% ]) q
}
; \7 v$ {3 E: y' p if(isLast)
# D4 D8 c. }( G; {8 b {' J+ \' [0 W: `. G5 D- f; ~
if(debug)
3 o2 k2 I+ x; d9 U {
( U; T5 x8 _7 J0 M alert("last!!");* [. [3 i+ V) z8 m
}
4 h& h. r: h a8 `/ x9 p) x4 }; ] if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))7 `& n- P7 Z; J
{- Z* T& M7 V1 T8 a% I
orgNode.parentNode.removeChild(orgNode);
[. Q( r) d, w; X3 n" { }) v% e' N0 c& d
}
+ ^8 b% v/ h# a3 F/ a; B: B4 h else
: q! N* ~, j) r3 T. ] {
# \- e4 \& G% P9 m9 K5 [( ?! V if(debug)
' ?, A3 g- i& b8 G' i, | {
0 s2 i, \4 B, | alert("compare color and parent bgcolor!");
. n0 E9 E7 w' _/ d( K0 J* \8 J }( z* j; I/ [5 a1 T, @! D4 z
parentBgRGB=getRGB(parentBgColor);/ c- e' z' j& O! q
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))7 S% ]; \# H+ E+ W) i
{/ z- ]! F, h) e, L
orgNode.parentNode.removeChild(orgNode);
: p9 f4 A& \. X }
% C, P1 R3 G% z) G5 u6 T Q }! E% k5 s8 p. U
}- s; d" ]9 k1 R
}
( S5 Y' {+ V9 c2 j$ N2 d9 N }
& E% n4 Z3 B- p; c }
6 C0 _+ \" l X, p2 x% t9 i% j
$ s2 ] H6 K! \2 u& x! ? m 6 U1 _ T2 b7 {
var itemFrames = page.getElementsByTagName("frame");
2 _' R- x! ~+ g8 w6 g* ]: Y var itemiFrames = page.getElementsByTagName("iframe");! Q% [7 I: [6 k7 C6 ~% I
g/ j W# K& R r3 j9 i7 g+ Z' U
var frame, iframe;
: K$ X6 h, ^+ h if (itemFrames.length > 0)8 w; e8 L5 W6 k
{
3 i1 c k* a+ e7 E; k' W for (var i = 0 ; i< itemFrames.length ; i++)
" Z" w1 j {" n8 e1 ? {7 ^3 h7 b* d8 \3 W! z) W! M
frame = itemFrames.contentDocument;1 i# F4 E+ E2 \& f; N' V7 |
this.RemoveHide(frame,objname); , U( ?, B3 S0 T7 r
}' Z' L _3 a+ P4 J
}
Z1 D# a3 C: c' c if (itemiFrames.length > 0)
- [ _3 r! s: u {
5 P; A! g: G$ z$ A- p$ S4 T- f6 J+ Q for (var i = 0 ; i < itemiFrames.length ; i++)
/ M" l( Z/ t; a N. B {3 L O7 m% T! S \( x
iframe = itemiFrames.contentDocument;
9 N5 O E: v* F0 Y5 \3 e& @ this.RemoveHide(iframe,objname);
8 K P" }% [+ a: z8 V1 S j* _9 G" w }( n" f: W& D# m! ?
}2 u/ ^- N/ ~, [* U; ]0 Z
}/ X6 D; f/ Z. [( g! h s
catch(e) z$ a" C1 `3 _0 h/ ?$ P
{
# ]# g2 S; i( L3 v, | if(debug)
' N& X+ ]$ ~3 X' w) z- p: z {1 T5 G& R8 M; m* m' s% {/ m
alert(e.message);2 U5 x+ z9 U: A% r
}& y* g' [) c) e
}# h. r! Y4 _/ a: A* O
}
7 ?( f/ P9 _7 c2 h, q4 ?" d 9 T e1 ~8 C5 L/ {; K
}$ g; M4 y) W" h% W* K
# ^& O) X- i; {7 m o- b( s5 a$ Pfunction getRGB(colorString)
& }2 l* c ]3 o' Z" _/ A/ z{
- ^; `* k1 h3 U$ r6 O. M7 Y var RGB = new Array;
: q5 h4 Y* T& g var tempSting=colorString.substring(4,colorString.length-1);
$ k/ o# I/ f2 Q! S$ G var tempArray=tempSting.split(",");; p0 Z+ l8 |3 Q
e$ H7 c) |) X2 t
RGB[0]=parseInt(tempArray[0]);5 f0 Y) M n( e) b- M
RGB[1]=parseInt(tempArray[1]);
8 a8 ?* C( h! U RGB[2]=parseInt(tempArray[2]);
0 i, H+ X6 y; F8 z+ | u7 \6 L2 T" o- q+ U6 r
return RGB;- r1 ~1 X5 W: G3 }# `
}7 @% z1 b8 U; d; O1 q& s" y
function keys(evt) & j4 }" ?+ [2 b
{ , ^" P, r3 r" R% E
if(evt.ctrlKey && evt.keyCode=="81") & p& ~; o3 V/ k" z# g$ M$ z( F' V
{
! D7 `: _2 ~/ y( H5 R( s CleanHideObj.on(0,1);: C" c+ g" B" s1 q ~
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
: a& c" s* f. r( q
) N" E' E1 _' l5 i }
7 ~7 h; H8 c! k: B6 @ }
@: {. c. N% T, M" odocument.addEventListener('keydown', keys, false); : m/ | H T! B+ _. ^
GM_registerMenuCommand ('Clean Hide',' f8 }$ l/ x" b
function(e){4 f% s. e2 H B9 P! x
CleanHideObj.on(0,1)) t8 ]- [* E. M _
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");5 s* L/ m$ Z7 H9 n0 _% g$ c
});
* [) _6 V& `2 ^& D' H) T" w5 @ |
评分
-
查看全部评分
|