|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
/ I9 F1 G+ J3 s% d' T
$ t5 Q0 R3 Q9 J; v6 C# o9 Z% {火狐插件,用猴子4 y0 v& W8 o3 T0 y, R
0 Q j) t4 }$ O: h; C# ]8 Ivar debug=false;
! Y' i% W" y: ]4 u4 F- Kvar CleanHideObj=new CleanHideClass();
2 I8 P' N" {7 n3 i' r# ?
% Q% {3 }) ]% l1 u, Mfunction CleanHideClass() 1 a9 `/ f" n! q) w- s3 l
{ 4 d# b# {" Y& n! ~
' Q9 y2 T- }3 }) ]5 h' a/ e: V% S/ w! \ this.on=function(id,bMZ)% I* B# e g2 A+ A, Z+ [
{
/ M0 T) G2 k! a/ t* y! T
8 x' I N3 N) t% V if(id == 0)/ ]2 v( L6 J" Y M2 l4 O
{
5 b; X% b Z( }; d/ J* H var page=/* document.getElementById("content").contentDocument */document;
! l6 G a- c% v4 o0 T; Y4 [/ I this.RemoveHide(page,"span");
* j" \; w+ U* @ ?+ m9 k: S this.RemoveHide(page,"font");: j5 X. N Z+ k; r
this.RemoveHide(page,"div");4 l8 k) m2 o' D& E5 ?
this.RemoveHide(page,"p");1 T1 Y. Z) k" \
" A, D1 R% @$ t. Q$ i/ q }
; F8 M8 F) N3 {; P3 \: C* a ! F2 s8 W2 Q$ C( V! K6 Y
}. y; c6 a% k! n9 d2 g, a' u
this.getobjstyle=function(node,prop)
1 y1 e# [( k2 W h% u2 |6 N {2 S0 S4 h0 |: w1 }( t
try+ t2 h( R( U7 h. U& N/ q* V5 E
{
6 Q- V/ d! ^4 X$ l. o w return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);: P- R; d. w2 ?% H- i0 v8 P( l, B
}, V! x* X! ]2 x6 f: Z
catch(e)
% I4 c$ B4 P) Y, H" \& y {
9 I+ X$ J/ C8 X# i if(debug)
" g0 D0 {: l. w$ F: y {
; Q+ }) G8 L8 w9 t! i G" e alert(e.message);: e/ u- x, f: J, R: J4 k. q
}4 Y8 G7 [# x+ D6 V& q# v
8 B. W: I( ?: [2 ?8 O; t; w" f# J2 y return "200";( }7 z7 O3 q, I" \/ z9 }9 ~
}
6 M) b& E+ P. a% |+ {: I2 j }& O3 H, h& H+ L2 c9 I
# w* J. H: a" H+ X y this.RemoveHide=function(page,objname)8 j4 M- j1 Z4 I: M7 G2 L
{1 s' t+ k& c, v* A
try7 t2 _$ O+ e; s p ?
{$ g9 @/ r- G1 ^
var minValue=15;
% A6 s u8 M& \# d9 I- L* b var objs=page.getElementsByTagName(objname); , i* D9 p H1 g4 {
1 \$ \& r: w$ J- W8 \& H' l if(objs.length == 0) # v( M1 |4 V: C$ K/ h
{
' Q1 u1 b$ y5 u% j' t if(debug)/ \* L* ~, X$ @( K( z* U
{) r3 A f H G3 t% `) t, ]+ y
alert("no object found!:"+objname);9 q* x' h* E4 v- {; x B
} s# j8 p/ `5 B0 c+ r, o
}
- \& x: @0 k9 W5 }5 [1 m else
* o& O E2 e3 }2 x1 p8 r1 f {6 P/ ?# q0 U. b! s% T
* m6 K6 J8 I2 e" |6 k8 o( m
for(var i=objs.length-1;i>=0;i--)
$ g9 x1 U& C% b/ }: j: d- a {( _+ a& |( [9 Q
var node=objs.item(i);
6 `# [$ s4 c4 U# s& O" o, W# d9 K# q m$ ^% ?# c2 J
' {" c7 Q) N% E! T4 F if(this.getobjstyle(node,"display") == "none" ||
% A% V/ ?) `/ f* r* A; O& d! q3 ~ this.getobjstyle(node,"visibility") =="hidden" ||3 H$ j3 ^+ y' Q2 p' b* m
parseInt(this.getobjstyle(node,"font-size")) == 0) ) \! r$ G( T* ?. N: q; t
{& b6 j7 R- X8 x+ C
if(debug)
@7 E& S" P4 C: `7 c% \2 V% ~ {
) X" M" T3 O/ ^: l alert("remove invisiable!");! t- S& l7 u& T. {0 q: s* J
}
) d3 _1 |6 m' A node.parentNode.removeChild(node);( t) S; V; z9 Q3 g# D$ q* `$ _
/ n/ f2 i2 M7 C1 ]; k
}! E1 \- w, u: @! C. V2 {+ c
else
$ N% V* Y+ e+ Z1 n {
! q" l" ?2 h! S, O2 X* ^ if(node.parentNode)
" l- E2 i, G; W0 A4 ?& q+ H9 m {
5 E4 T3 h7 M8 @7 y* q/ G( o var orgNode=node;
5 x M6 j; ~* e. v0 s9 }( K var orgColor=this.getobjstyle(orgNode,"color")) v; A T( J2 u2 L: s* _/ x
var orgRGB=getRGB(orgColor); 0 L7 G* s- p4 E# r. P; H# W4 f
+ |1 h$ s3 l) s" ]* O1 f/ g
var parentNode=node.parentNode+ Z/ V2 Y, {4 t/ P! y6 `
var parentBgColor=this.getobjstyle(parentNode,"background-color");* V$ J4 l1 t4 j( X/ e. k$ m
8 S* C1 O( b( u) |5 `
var isLast=false;
0 t1 L% }+ H" J1 M ; \2 k6 Z# S8 u0 z+ n
while(parentBgColor == "transparent")
/ I7 T H* v/ e4 h" C4 v4 @( K {
! E! e% t% |8 h& {: ^
# w M) T4 g2 {6 l0 k$ N 1 P, A3 \) B) C' n/ U* s
if(parentNode.parentNode == null)
% p* s0 b# {& t( w {
! y! Q; W* B# A- A& U; J$ L isLast=true;: T0 X9 `( D: V
break;
$ ?' ]3 \9 m+ x }
( q1 i& N* V/ Q1 A& |4 \ parentNode=parentNode.parentNode;5 Q8 u- P: z& g7 X% r- v. B
parentBgColor=this.getobjstyle(parentNode,"background-color");
2 p1 v8 a% i$ I) `( X- Z) I1 ]# a6 R5 t8 F
if(parentBgColor != "transparent")
: k2 C: b7 {5 Y- w/ {. f3 s {) @% i* \& Z' [3 d8 C0 o3 W
break;
; K% m, J/ f, \* ^, r/ D }
# N" A( T+ ]2 j5 c7 i4 G, Y }
1 p, C# X8 x: u+ M1 u9 I if(isLast) / L: ?/ f" A# l3 I) k$ `8 i
{
; [/ d5 r5 a0 q" _4 [; `+ b if(debug)
; \$ Z3 M) I$ W+ m {
' N/ i9 h2 o) Q alert("last!!");5 I* `/ K4 U$ B
}
, P: h3 K* d+ Y) g5 y2 Z! P if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))! J9 `" L, H; b8 [
{# P6 Y9 M. J% Z
orgNode.parentNode.removeChild(orgNode);
) w2 H$ _2 \; u2 y+ h% T$ e1 ?+ ^ }
- }$ d; x# U* s$ i% ]9 u }8 P9 l6 E/ [9 m$ S0 G
else( ?% W5 W$ b* z7 \
{
2 v9 a# o& ~( n* S, X if(debug)
' k) R4 G* z6 T. T% b' `: K {$ n9 T3 a) D) O$ b" d/ @
alert("compare color and parent bgcolor!");
/ D/ R: V3 s" @( i# J1 p# l }( ?' ? J1 J: N0 q7 X- B3 h1 h* e
parentBgRGB=getRGB(parentBgColor);- R$ I8 W7 Z2 ^* N2 K/ X( D/ z
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
* t2 q/ a) N5 X5 a {. t+ q, W) ?: B5 _
orgNode.parentNode.removeChild(orgNode); 4 r9 G$ x l, G. x. `
}
7 j9 \( T M5 O% A! i }
) C% X) x# U% D! c; i0 N: m3 O }
c1 N8 R3 A$ [ }
# t- E* ~( i1 o' O }
1 x8 `% A/ f& G9 p0 `; l8 u8 y+ t }
( x9 y6 H* E+ r0 A6 {# Z2 l$ W 9 p/ h! }9 G) s
- U4 f: u0 p7 f
var itemFrames = page.getElementsByTagName("frame");
+ V; R3 w5 p' t: I" W/ q var itemiFrames = page.getElementsByTagName("iframe");
! E2 s$ J+ y7 _% R& u; [9 F + G1 J$ X6 H8 N* L8 P3 ~# m8 D
var frame, iframe;
) L% y( h0 `( i, P& ` if (itemFrames.length > 0)
5 d% i! h5 D; G2 G {" v( Z3 k" j+ z" p+ j! l
for (var i = 0 ; i< itemFrames.length ; i++)
H+ o8 S) |' a/ L8 ^) X {
( m3 A9 T. E- T2 p6 t! N frame = itemFrames.contentDocument;
8 ?+ j3 e/ ^' @/ [* e this.RemoveHide(frame,objname);
Q) ^8 ]/ `( D& Z0 J }1 K4 R2 V- Y" h1 }0 W! W
}
. l& J( t" G2 b+ H if (itemiFrames.length > 0)
* q& W8 p2 T B1 ? {
4 y& i5 ~0 y M+ C" n for (var i = 0 ; i < itemiFrames.length ; i++)
4 y7 |# _* q! {1 n0 v! Z3 G: C {
% }! a2 d) `8 p2 R9 D4 D- f iframe = itemiFrames.contentDocument;
" X2 D) d9 j! C* Q6 ] this.RemoveHide(iframe,objname); ^2 V* N" e& \2 c
}/ W' {! ^. U' O; |( x- x
}
; f0 I2 C" @/ b5 Q }
8 ~, X5 v6 i4 q u catch(e)$ ?1 u: L+ I. `4 y# L
{
; [9 m1 z9 W8 w1 ?2 \ if(debug) o& @: l9 I i7 L) }1 K
{" l/ {3 S' S! G# t: s
alert(e.message);
- a8 v$ n6 V' n% K }
; e0 k G& S- v `9 p8 F }
& z, ^9 v4 S% E }) t' e& P% h4 q. y% r4 y: [
" |- G9 \! K' x0 v0 t& q0 c}4 K# ^% I* n& |3 v
& B8 ^6 \1 L( B4 l; Afunction getRGB(colorString)
3 i7 [; }3 a% `% R( j" J{
# n; v( F4 u- b& \4 H N U4 Y var RGB = new Array;
! M5 b" ?/ R G/ s var tempSting=colorString.substring(4,colorString.length-1);
& O' t+ E# c# [+ n/ F var tempArray=tempSting.split(",");4 o+ y6 a0 r+ A0 s
8 N8 B% c' }9 t+ T' N! R3 l
RGB[0]=parseInt(tempArray[0]);2 d z) ?% c3 P* N$ v
RGB[1]=parseInt(tempArray[1]);8 u( m, r( D* r6 X/ x1 w/ i- A6 ^% [2 J
RGB[2]=parseInt(tempArray[2]);0 F) l1 v8 {1 s% U
. ?( H# G5 ^' \2 ?- h
return RGB;
9 m3 Z' x* ~1 P9 H5 z3 X}, p0 i) I9 T w8 o* R/ q7 M
function keys(evt) . o) r2 _; ]6 L" P
{ * m; Y5 d2 w5 {# r
if(evt.ctrlKey && evt.keyCode=="81")
/ }* P) M% E! ^3 B( v# B$ J {
8 V8 ?) X( \2 [. q$ u' q& q CleanHideObj.on(0,1);
& b* p5 M: O4 D6 o& ^ alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
! R2 c o2 `/ ^' z& {! q- N7 o 1 Y1 B2 L4 x4 ]4 @' J# o, F" e
} 7 g9 w3 \6 ?* i. ?- C" f1 n+ A% l
}
6 {- o9 {) r' T, H* odocument.addEventListener('keydown', keys, false); $ B" m$ c$ I" M* u$ m- _5 V4 s
GM_registerMenuCommand ('Clean Hide',
/ @9 a7 v2 d' h3 _function(e){
% N9 J$ g1 x$ WCleanHideObj.on(0,1)
' |7 r" M+ S( I5 _/ y/ n+ `alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");$ a: B" j% v( `9 Q% E0 s @
});
/ [: A6 \8 ?/ [3 i a |
评分
-
查看全部评分
|