|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
4 A5 Z: ^- m. r3 i. W" W7 G
: t" I2 f. @3 o8 f6 |5 S0 t4 u0 Q火狐插件,用猴子, Z9 {& ?- Y3 w
B/ i2 a7 ~" \/ ?4 G9 m2 Ovar debug=false; ! {9 _9 `6 V9 j2 n% [2 K
var CleanHideObj=new CleanHideClass();
7 U; @8 I+ E; a; R' B3 g9 \
3 `2 ]3 R, D! y( Y4 H6 Dfunction CleanHideClass() 8 a7 R \" D5 `2 }1 l0 Z+ q
{ / [" i. y V! g' m
* v1 ]+ r& ?1 r+ e0 }/ i# h- x9 D this.on=function(id,bMZ)
+ {8 g6 }1 ?9 @3 \: K0 }6 x, ? {$ U7 `) b' A' `4 t' v4 I7 C
. r8 @+ Z! V+ E6 T% W, K; m if(id == 0)
4 K' S4 A& n- N- |; Q3 M( w* [ {
0 x% g( g$ o3 k5 A var page=/* document.getElementById("content").contentDocument */document;
' f2 w& M- F1 O; g- c( n0 m this.RemoveHide(page,"span");' l* h' N# {- E
this.RemoveHide(page,"font");
$ a& m/ ]* n M4 a6 @5 O; e this.RemoveHide(page,"div");! C$ R( A% M% S; g3 v* e }5 r
this.RemoveHide(page,"p");
- X9 u: l6 e% c/ S1 n( _* j8 M; c 6 o, e: R) d* G- @. \% f
}7 e. ~) a1 v* a4 @
( L) S+ g) d: c; C5 f" s3 m
}
- V x3 Q7 E" g% a" A" N$ `& A! g5 j: a this.getobjstyle=function(node,prop)
% x3 r* g4 H8 G% @! k6 k6 p! C8 l {
& i3 \& ?. B4 c' i. M try( _- `6 D4 m, e* {* M
{) ?4 ^. m& @& d, D& B% W, ^0 }
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
5 x: H: y( O3 c" N6 x, M }
" M$ v2 V: {' c C3 d catch(e) I! d& R/ f/ s \
{) B, a) r5 V* h# Z" E( W6 D
if(debug)
5 D, W0 I# @" d @ {) U+ v- O0 {6 k. T5 u
alert(e.message);
$ Q1 m( R( v2 \8 h }5 n) i5 C6 O( `: ]. A* g% q, z
+ C/ i: C6 H% p8 M+ I return "200";
r6 X% w. a! k/ g4 f J; o+ z7 [ }) f! Q* W- b$ z; {
}
?" O" K" q( T
' I7 U* u+ {& n3 a- U this.RemoveHide=function(page,objname)% }1 a! W) D+ ~ s
{$ u, S: l/ z+ {* t
try$ R9 ]! P. f! Y3 a
{( M. d$ ~& p! G8 t O7 Y
var minValue=15;
! U' n! V% _. w. J( S+ N# A9 L' W( u var objs=page.getElementsByTagName(objname);
" U; ^/ ]& O: L9 b) E- m' k
0 O& ?# p9 N5 ?7 H/ m) G if(objs.length == 0) m; p$ m0 B0 D, X
{7 s0 g- `( r, g- e
if(debug)! q3 m. N1 u% a7 f: ~/ A
{ N# b- a$ {2 i* Z% ^3 n) {# q# z' J
alert("no object found!:"+objname);
, U9 U3 A; a) x* r4 K }: |+ N2 K* q! i' Q& I- z
}, t: Q% l7 \" }- L# S
else4 z- W. q# o$ T7 o: W, U2 g/ K. J
{; [+ g! g: w$ M. M2 l4 Q5 \( m
+ Z. m/ m, m6 M: q+ D4 c) E for(var i=objs.length-1;i>=0;i--)
0 r$ U% A% g" @5 f9 v$ X! \3 u {
8 o1 Q' l+ i" n" n- @ var node=objs.item(i);
! {7 M( H) ~# k7 l * E' k& j' E! d1 W' m4 v
6 X9 l- ?% i$ Z" f
if(this.getobjstyle(node,"display") == "none" ||6 _ H7 R1 A; \+ v5 Q
this.getobjstyle(node,"visibility") =="hidden" ||! }2 Q5 H0 u( q$ F# t( {% R i4 P
parseInt(this.getobjstyle(node,"font-size")) == 0)
$ j: Q+ k& ^/ B( y6 V- o {0 Z0 `, `# Z9 N% |
if(debug)
+ t4 c8 W2 m) [/ Q" Z {
; n6 J' L C9 c2 f3 W% ]2 c% }5 B alert("remove invisiable!");9 g: k+ s8 c8 s% S, F4 L' w6 m
}. A" k" W# c8 V4 ~$ J; D0 d
node.parentNode.removeChild(node);
, D& ^$ T+ E, e9 a/ ?
' o0 O, `7 l0 D2 y F% U z }5 o9 p7 Y1 Y0 ^# x% S
else
/ @" a v! c0 U8 }8 U! T# B& ] {+ ^6 Q5 k% @% y7 q/ o& Y" u
if(node.parentNode) 6 ^" ]: n, H8 c$ I1 c5 g2 X
{
1 Y2 M! |7 E, Z var orgNode=node;
/ M( J9 n( b; E var orgColor=this.getobjstyle(orgNode,"color")0 H- v8 |8 s! L
var orgRGB=getRGB(orgColor);
4 l# u+ o4 r4 h3 p) V 1 s0 s+ G( t. J0 `: r
var parentNode=node.parentNode/ C$ L. L; J% K+ @1 @6 Q
var parentBgColor=this.getobjstyle(parentNode,"background-color");
5 T& `+ d4 |6 V+ `# K* T7 [3 m( T& u
: E- D+ O# E- z/ F6 X" i var isLast=false;" s) S& d) [$ Y l3 j
# B7 E* t; f3 p$ w
while(parentBgColor == "transparent") 0 |4 L9 q, a$ ~7 M4 l* d9 x
{
# ^# @% b' w/ P0 h% u( u % j; q2 B l1 T
: P6 z" S, o6 ^# C( P a if(parentNode.parentNode == null)' \) |( \) f0 \1 G
{
. m" G: T# i) [( ]# f+ ~ isLast=true;
" |8 C( k- x7 p break;0 d* ~; W( @( g' i% A% s3 L5 w
}
# w& l5 H- I# }1 o* h; g parentNode=parentNode.parentNode;: e! l9 v+ z0 }. H1 c, \! _: s" V
parentBgColor=this.getobjstyle(parentNode,"background-color");
- F+ s5 l2 ?1 h( V
- s! ?/ Y0 I& G" C if(parentBgColor != "transparent") - u1 M. N$ N4 I/ u' Q
{
/ ~2 C# j% I5 I8 o break;6 {* m4 b7 U' D0 B4 I4 M, l
}
* ^4 V ]3 A- K% W. F+ O }5 g! ?% f: O% x- Z- | H
if(isLast) ; u, a2 p7 {" \% I, s
{! }3 P; }! C) t
if(debug)
+ r) X+ D c* e4 V+ _' t! d {2 c( C1 X0 f: K3 o2 {
alert("last!!");; Y) E+ Y8 _3 Q' T6 b
}% ?+ M3 @: U# H# W( {, K/ ^& |
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))* F; r& i: v0 D o" f8 O! p6 |
{
! s. J% j9 m& r8 m5 R: g5 z( W0 q orgNode.parentNode.removeChild(orgNode); ; ]2 d: V3 V! t8 P# x: f
}
8 k+ H/ c: y' T& X }8 e, S a( \7 g. z" {8 j& \
else
2 d' C' p2 F+ P( A5 [7 E {4 W* E8 Q6 i' s
if(debug)
& h1 _2 w( c2 k6 S( `( p {
& G. a/ c" H5 J$ i alert("compare color and parent bgcolor!");
8 M" F. X# A- P }
/ @9 i4 O" r& ~ parentBgRGB=getRGB(parentBgColor);
3 f7 ?2 U5 y4 L: A8 v+ k4 _4 l if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))$ e; L( _- ?( V
{
+ K# Y0 ]/ C$ @' j5 @5 z orgNode.parentNode.removeChild(orgNode); " t5 s' e- f) ?+ \( w
}, Y2 l+ I+ P, }+ y
}
w" Y4 }3 P2 l3 P }
" P9 B5 J# b$ o$ H$ e1 H/ Y }
% L) y0 o% I0 ]4 n8 [. y& ^ }
@; [5 }3 L* {5 [* {" ^! w: I }. r: \+ ^4 \0 i0 R
' G3 I+ ]4 l& j. z0 r- c; P 1 K$ k2 d) X) X% I
var itemFrames = page.getElementsByTagName("frame");
& Q# x/ y: i6 \2 ^9 b var itemiFrames = page.getElementsByTagName("iframe");
7 U7 `' v# ?( ^/ q9 `$ D2 M( ]4 R
' q% w2 z4 a4 a& W" ^" U var frame, iframe;
* q4 V1 h& B9 F if (itemFrames.length > 0)
% x& x* h0 d4 f0 T3 W# Y$ Z {; e4 {1 [8 ~; E9 }0 A) h- s
for (var i = 0 ; i< itemFrames.length ; i++) 1 x# @' P3 f" K) h4 N
{
/ a$ E8 ^/ I% H, ~+ r2 ~ frame = itemFrames.contentDocument;
3 N7 X6 O+ P5 B, o2 F- g this.RemoveHide(frame,objname); 6 a1 v" K' F n
}
4 n7 j: T" O7 R0 Y) ` }
* W; p5 k. x* g. @/ D if (itemiFrames.length > 0)
. A1 A6 T: O+ k% ^' } {
0 K: |: P! f) n* b# M for (var i = 0 ; i < itemiFrames.length ; i++)
, |1 [8 k' T. @$ A {0 k/ B4 D3 ^1 w" N8 @
iframe = itemiFrames.contentDocument;
$ x! _# g) d8 R, q this.RemoveHide(iframe,objname); . n$ s* K3 y- E
}0 z, }+ e9 W8 Z, |6 d) Q
}
& B+ p5 Q3 s' \; L }/ ~8 t/ ?- E5 m7 O# O3 R
catch(e)
( }( M3 d3 F! X& M; b; Z2 ]9 h {
5 I( t) A& [# L. B/ @$ R" t if(debug)2 y+ t1 K; S- k7 R% h
{* I& L9 m, x6 G, O6 ] n* _
alert(e.message);
9 y5 d8 i1 a5 o; z. d }
1 m, n. T3 w! S! ^1 ~9 e }
g+ R7 [6 O3 |/ k7 R6 ~5 L }
: e6 g g. s- G/ ^) i1 b% t8 n 4 ~$ ^5 T! R6 {
}
. ?1 o6 V+ J' n: Y8 l2 I" {/ i5 t$ q4 W9 t4 _3 H
function getRGB(colorString)% J2 g/ S+ `2 `; i7 b' n2 F
{
# \' ~+ f/ O! M/ z) V! j5 @0 ] ^9 | var RGB = new Array;
' n X0 }% B3 q& | var tempSting=colorString.substring(4,colorString.length-1);
- \% o- K. ]6 ~8 g0 g8 d% ? var tempArray=tempSting.split(",");) j4 D9 ~1 M7 ]* D3 V) W
, e4 I7 c. M2 V, `% u) ^" l RGB[0]=parseInt(tempArray[0]);" M1 N: N+ z0 b
RGB[1]=parseInt(tempArray[1]);
1 z0 s" B- x2 S+ H RGB[2]=parseInt(tempArray[2]);
# l( M$ a* ~ |# X# G
- l, c1 x) p# J: A return RGB;$ D" e B+ U! G7 n. i' z8 P
}, H2 X& f8 F0 N2 r) S
function keys(evt) $ L) Q2 m; ^- j, a- }! S* J
{ ; _ J4 F0 z4 g2 v
if(evt.ctrlKey && evt.keyCode=="81") 3 s: V! e0 M! h' P$ d, k k# e/ U
{
7 V/ b/ N- I0 T4 T CleanHideObj.on(0,1);+ w4 |+ V0 g ?. m) i C. ? c
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); 0 {7 n! h. f" X% M: ^& S
( ~9 Q/ r+ ?; Y& m1 c0 u
} 8 R6 \! c3 p2 m3 y# z+ h2 R
}
# X7 p9 S4 {/ n) ~; \' Ndocument.addEventListener('keydown', keys, false); & f) g! X8 d) P- k
GM_registerMenuCommand ('Clean Hide',
+ A: \1 m% U* X5 G; U9 b6 ofunction(e){
3 b5 a4 R' ~( W% |CleanHideObj.on(0,1)% n- q- e6 s! r- h
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
4 m6 X/ c8 Y1 I3 t});. i' \% `0 y) X1 d) f/ P8 C$ I
|
评分
-
查看全部评分
|