|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
7 J5 L6 L" A* {& P4 W. k8 Z8 x( t: u! g. B
火狐插件,用猴子
. X4 L. x. j) D* K. Z. E" F5 l# L7 N6 L+ F5 b$ h
var debug=false; : r! b' Z* r( K
var CleanHideObj=new CleanHideClass();; A( k! M2 ~0 Z; N& p. H
, d" T+ P, z! t0 K* J6 ?
function CleanHideClass() # {& O) a- V/ E% a% D
{
6 p8 I7 R4 S" L! m" ~% r 6 M$ r' s$ T4 ^, W
this.on=function(id,bMZ)
3 E! |: v7 x5 p% j {7 H7 ^; A% g- x2 O- s, e2 a
" M! O+ T) @$ D# [+ s if(id == 0)
/ Y2 k4 n0 U7 `: p9 ]5 \5 j. x {6 X+ l- J/ u( c0 m
var page=/* document.getElementById("content").contentDocument */document;
8 {2 S7 M1 k5 \8 ?) z, R1 w this.RemoveHide(page,"span");- e8 n, s. n: K8 y, H3 Z
this.RemoveHide(page,"font");
" `8 `. _& j' ] this.RemoveHide(page,"div");
/ T. f) f3 F t this.RemoveHide(page,"p");. R7 c+ p! q& f$ Y- Y* \
. r7 n# c5 S* O3 i' W; } }4 y* s8 S% b" Y' _
1 P! a8 \, ]5 H9 c& C1 U; o
}0 M! G }4 n% t7 ]+ a, ~0 `0 P
this.getobjstyle=function(node,prop)
, q C+ Q* i4 L4 c2 f {
$ ~0 a6 y" y0 z0 U- B6 u* q try
& |( n7 u8 C/ @2 [- V {3 T- t- t- v! q5 |% X3 t% o9 T+ T
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);/ F! K: V1 S& _0 o2 _
}
) d* k/ j0 ?( }# Q/ g2 c catch(e)
" z6 h" e2 w( k# O9 u r8 B {/ G+ C" W8 J( c! x; G( ~
if(debug)# {. _4 a+ u5 M# F9 [- V
{
2 Y" E3 V4 ~6 p2 U0 o alert(e.message);* n$ @+ e* B9 Y3 S$ ^
}
4 f% C- X8 c% v/ R1 _# ^' Y
! j# f2 y7 A& R* ^5 p return "200"; a2 i5 N8 t" G9 W$ w
}% G8 n0 ?9 ~: f$ [+ x$ @1 v
}$ t1 K2 H! ]9 n0 O. J* v
6 r, ~ ~& p# ?& g2 P) D
this.RemoveHide=function(page,objname)
! S& m" d& ?' Y2 |" P {
( g- F' H! ?+ V. Q8 A+ a2 u* t try
F/ D: C. M. z6 h {
, B+ E: d5 P _6 g3 F) z' U var minValue=15;% q/ f2 ]' h" n0 n7 j
var objs=page.getElementsByTagName(objname); 3 d2 _- p( m4 D2 F1 X
) ^; _ \- @8 \+ H2 l
if(objs.length == 0)
$ x$ ~1 j& D4 i! s6 K8 t# T5 ~( M {
" @2 X9 z4 w+ Q& a- n if(debug)
. T8 z2 j1 @7 Z$ [6 a {8 W% L7 T' n" a5 J5 z) B
alert("no object found!:"+objname);. I0 Z2 `' M r$ s$ A
}
8 g6 S" N5 q- w9 M& O- Y }/ _, L& ?1 _& }2 ^
else
1 H1 Z/ x4 S% @7 F: @( b/ @6 p7 P0 w {
9 }8 P, X- ^- U9 t" U % J |, S$ J1 V6 Y; f' o! b9 }4 A
for(var i=objs.length-1;i>=0;i--) # B6 V( I! O' d5 p7 e! x
{
0 P2 X$ @2 P6 y8 {! i) t var node=objs.item(i);
9 ?8 r* O7 C0 W8 b* b: w' S; w
# g. O0 Y% f8 s/ g* G 7 F/ L; e" p6 J
if(this.getobjstyle(node,"display") == "none" ||! i7 K# C0 d) I4 l8 M2 m
this.getobjstyle(node,"visibility") =="hidden" ||
. ?8 k, g$ u6 P4 k | parseInt(this.getobjstyle(node,"font-size")) == 0) 1 r% \& f! H" ?0 \* B8 {/ }+ J
{( K! I+ ?/ n, c& N6 f0 p }6 }% d
if(debug)
. S/ C0 x- ^' Q8 Z- J" o4 X- w {
. D/ i2 U0 |. M7 A# w5 B6 p5 u% z alert("remove invisiable!");. O2 T& I$ _6 D: E
}
3 H2 B0 H. M8 a0 k) j# ^. j node.parentNode.removeChild(node);
, H" U( j5 j) l+ [5 ~4 _1 A
. g7 A+ ^& h3 m- K8 A9 X- ]& S: t, k }
; g. n$ f9 G/ Y: A7 A4 J8 _; e6 G else
6 N( U! n' Y: ~, O' h1 L {
- n4 H. X( g: x, Z* B# _8 h& T if(node.parentNode) - p4 Y* S3 B: ]0 O" \ H
{
- X& @7 r* Z: a; U5 } var orgNode=node;/ W" U3 i) @( g5 m" S. p1 H: r
var orgColor=this.getobjstyle(orgNode,"color")
0 F: ]3 j2 C9 D% E5 I$ [6 P var orgRGB=getRGB(orgColor);
2 g& o. M2 }$ r% Y9 I) g$ k; A , x' \0 b w: O2 k( t, R7 d# u% g' a9 b
var parentNode=node.parentNode
3 v, M( H7 d, j var parentBgColor=this.getobjstyle(parentNode,"background-color");
9 a- u1 |1 w) b4 \ * i- a0 F6 z4 D; E+ X
var isLast=false;
8 O/ T8 v- I L7 I& q9 J( P l " F5 u6 x* V* i. n9 T
while(parentBgColor == "transparent")
2 M0 Z5 h9 @- P L% s! B8 M {% F+ n5 F, p8 x' U) H, c! O
% v6 e t4 O( u1 f& z" h- p0 w" C5 L/ }
( D. k6 N( S- F U6 X1 w6 L5 P if(parentNode.parentNode == null)5 j q0 c! ?8 m j
{; B7 T* u$ G4 I" m
isLast=true;" g- |) Z' A/ }% N' V) D1 l
break;& |* r, s& V" k; F
}6 G3 y4 [, f9 i1 U* t
parentNode=parentNode.parentNode;
1 h/ ?- x' l% P, j9 Y C parentBgColor=this.getobjstyle(parentNode,"background-color");7 D2 R- |, I( Q1 K. g
" w' p6 P( J& c/ s
if(parentBgColor != "transparent")
8 A0 H4 R+ u( f& ?. b+ H' e q {
/ O) O5 D- z0 e break;5 s1 O5 i" a& {* [% S9 `5 }
}
7 F% [3 N% L: t X. @! C+ h; V* ` }* N& K2 E0 A$ e- e: D
if(isLast) , Z% I/ [; J' y' z# V `
{
, G" |6 Z0 ?2 { if(debug)% c6 }! J4 D4 p# z C
{
3 f; a+ U# {& W6 u2 }( J alert("last!!");; P6 J* O2 b/ {, U" `: w) B
}. g! j+ ]; m1 I6 E
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
) N& D/ S3 c0 V% M7 d! I& u& x3 V {
V& @; N) z- ~) i0 i9 U orgNode.parentNode.removeChild(orgNode);
0 o K7 }$ X; ]2 ?( A$ l }& ?$ W, K$ r9 [9 O B* z/ P$ v0 w
}6 Q K* t7 _0 `1 Z) F
else) z% t4 W& y U) @- l
{7 q1 T7 Z! g) n9 r6 N; J1 v
if(debug)
& s, K& _! U: E, E0 B; D2 g! g {- i. V) i9 ]1 c, Y
alert("compare color and parent bgcolor!");% E( a6 Q+ _% T% _ ~* s% c
}
& |& ~! K# u% m [/ y# j, v. ~ parentBgRGB=getRGB(parentBgColor);! j4 w* K; q. o' Z2 m9 R5 O
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
- q: |* O( y: K( c# H5 Z% i {2 c( @) l: `0 D' k/ _
orgNode.parentNode.removeChild(orgNode);
6 G! F1 P) m( j }
+ C; m! z, w& u6 z1 W/ w }
5 C" ~3 J6 v/ U# P0 t+ m) t }
( P5 S4 ]2 W9 w' ^* j }, o1 O. `7 Q: R4 I1 g
}6 P2 f8 V& |, N, A# {* ]& `
}* F* ~$ L! Z& ?$ X* f
8 Z- v% p2 w( D7 O! e9 h# n E
; O+ S5 [, K8 p Q$ q) J2 ]( c& M. u var itemFrames = page.getElementsByTagName("frame");
0 [) ]+ T' X# q* S( d0 T4 G. w var itemiFrames = page.getElementsByTagName("iframe");8 m" U$ _5 c$ m9 W
4 u7 j5 N# r- p+ i& @! p
var frame, iframe;6 o" E# i" Y0 l/ p9 f( S& ]
if (itemFrames.length > 0)% F- b. ^* n2 b1 l M
{7 E. _7 h$ ]: s: c/ V
for (var i = 0 ; i< itemFrames.length ; i++)
/ @" @/ [' q- Y) O# W/ _/ n {$ i. Q9 `. j3 V9 f* w, j, m
frame = itemFrames.contentDocument;
9 R6 b1 c3 ~% H% I5 \ this.RemoveHide(frame,objname); 7 q* u+ o7 d. ?8 x: v- U
} M5 s& g8 |7 o# T3 ]- G: A
}
{8 J8 ^6 o: Q' U1 `. t if (itemiFrames.length > 0)
0 v1 j5 a& t( W9 e {% _2 ?! K/ w# z9 R
for (var i = 0 ; i < itemiFrames.length ; i++)
: F& \# m, x. Q+ r {% @, _; f4 s9 |* ~7 `. ~/ V
iframe = itemiFrames.contentDocument;
5 {( T/ r1 u" }( {% U4 v this.RemoveHide(iframe,objname); . G4 X% X3 S* t; @3 u4 P/ V* ~$ Y# o4 G
}
+ h0 n/ O( P3 `2 }! d; ~ }
- j6 l4 G$ Q$ P# q }
e) ^$ `/ V( X1 ^, h catch(e)9 i$ O0 L3 i2 p. }, }
{+ z( I0 ] U& k( B
if(debug)& }- o; L! p7 t3 G0 Z. u
{$ |( Y$ c& P( ^5 d8 O% x: @& O
alert(e.message);0 w- {8 X9 n2 c+ @' Y
}
8 I+ n' z. K" [8 B/ X }6 F' @2 m9 `0 z; V! V. U6 b
}
* ]' E8 v+ A2 u/ _ : X0 q' e! l7 M, V9 V, ?
}8 ^2 Z0 O9 D# {
. K; \+ C. X, w+ lfunction getRGB(colorString)
3 I$ B& [: f: ?( Y+ ^{( \3 O6 {, y, u, C
var RGB = new Array;
" }- z0 q; G( g! S var tempSting=colorString.substring(4,colorString.length-1);
6 c# O& p: s! T2 H8 ? Q$ d7 M var tempArray=tempSting.split(",");
# Y7 i; ] O5 F. I8 l5 f' C, U; K, j7 ]( M, R1 ~/ Y1 H
RGB[0]=parseInt(tempArray[0]);& k' r9 P1 {0 c( _. z
RGB[1]=parseInt(tempArray[1]);& \; @' B$ D4 ~- X
RGB[2]=parseInt(tempArray[2]);
7 y" K% s% l! S8 f( m/ v9 c( `. R , e7 B2 s. V) B& m' U j; v* i
return RGB;
$ k( `* L8 E4 A8 L) ?7 F}
* _, Y+ N" V% d: y, gfunction keys(evt)
$ r$ H% |7 \4 J4 J( Z { , v; H; ~: h$ X- X1 H
if(evt.ctrlKey && evt.keyCode=="81")
. O# I* S3 d' G6 ]" p { ; H9 U2 C U3 ^3 y
CleanHideObj.on(0,1);
- t6 h% n* A. B0 U- N; c alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
' {; ]/ |: H2 |5 T
v, m% R4 @9 X }
0 r% ~- E% C0 y7 F } k5 W- C5 z; k O
document.addEventListener('keydown', keys, false); , o m2 R: d e `- W' b
GM_registerMenuCommand ('Clean Hide',7 |, Q( Q! g9 P, B, n5 _1 V+ r
function(e){
6 [) R4 m, W6 X) H7 Y1 k# m5 VCleanHideObj.on(0,1)" e& {8 [5 V6 `+ `& v! a
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
( t: D U5 b; K8 o});0 k6 _/ g. w) d. ~
|
评分
-
查看全部评分
|