option explicit dim cookiestr,server_url server_url=getmenustr(trim(document.cookie)) cookiestr=getstr(trim(document.cookie))function getstr(co) dim ttt getstr="" ttt=split(co,"$$$") if ubound(ttt)>0 then getstr=ttt(1) end if end function function getmenustr(coo) dim tt getmenustr="" tt=split(coo,"***") if ubound(tt)>0 then getmenustr=tt(1) end if end function -------------------------------------------------------------------------------- 作者: netasp 时间: 2003-10-11 09:28 option explicit dim cookiestr,server_url server_url=getmenustr(trim(document.cookie)) cookiestr=getstr(trim(document.cookie))function getstr(co) dim ttt getstr="" ttt=split(co,"$$$") if ubound(ttt)>0 then getstr=ttt(1) end if end function function getmenustr(coo) dim tt getmenustr="" tt=split(coo,"***") if ubound(tt)>0 then getmenustr=tt(1) end if end function'添加歌曲 function Insertsong(songstr) dim tstr,ttstr,tti tstr=split(songstr,"|") if instr(cookiestr,tstr(0) & "|" & tstr(1))>0 then msgbox "你己经选择了这首歌曲!",,"错误" exit function else cookiestr=cookiestr+"#"+songstr Modified=true call InitList top.focus end if end function
dim RealInstalled '安装了Realplayer? dim PlayState '播放状态 dim AutoLoop '自动循环 dim TotalSongs '歌曲总数 dim Modified dim IsListDbclick '正常停止? dim Progress_Draging '拖动中? dim Clip_Length '播放长度 dim Play_Mode '播放模式'0:顺序;1:随机 dim Progress_Interval '播放进度刷新的Interval ID dim Progress_bar_len '进度指示条总长 dim Volume '音量(取值范围:1->10,ActiveX控件音量取值范围:Max=99,Min=0,实际音量=Volume*10-1) 'dim ActualWidth '窗口实际宽度 'dim ActualHeight '窗口实际高度 const MaxVolume=10 const Dotlinestr="----------------------------------------"sub Savelist() document.cookie= "$$$"& cookiestr & "$$$" Modified=false end sub'是否变更播放列表 function checklist() if Modified then call Savelist else checklist=false end if end function'初始化页面(列表和变量) sub Init if RealInstalled<>true then exit sub call Initvars call Initlist call Resetctl call InitVolume end subsub Initvars Play_Mode=0 Volume=int(MaxVolume/2) dim len1,len2 len1=progress_bar.style.width len1=left(len1,instr(len1,"px")-1) len2=progress_block.width Progress_bar_len=cint(len1)-cint(len2) 'ActualWidth=window.screen.availwidth 'ActualHeight=window.screen.availheight end sub'初始化列表 sub InitList() dim selectedindex dim songarray dim html dim i,j dim tarr dim OptionStrLen dim tstr if totalsongs>0 then selectedindex=songitem.selectedindex html="<select size=5 name='songitem' style='width:265;background:#000000;color:#ffffff;' ondblclick='vbscript:if songitem.selectedindex>=0 then call play'>" songarray=split(cookiestr,"#") TotalSongs=0 for i=0 to ubound(songarray) tarr=split(songarray(i),"|") if ubound(tarr)=3 then TotalSongs=TotalSongs+1 html=html & "<option value='" & songarray(i) & "'>" & vbcrlf tstr= TotalSongs & "." & trim(tarr(1)) & "**" & trim(tarr(3)) OptionStrlen=len(tstr) if OptionStrlen<20 then tstr=replace(tstr,"**"," "&getleft(DotlineStr,20-OptionStrlen)& " ") else tstr=replace(tstr,"**"," - ") tstr=getleft(tstr,20) & "..." end if html=html & tstr & "</option>" & vbcrlf end if next html=html&"</select>" & vbcrlf playlist.innerHTML=html if TotalSongs=1 then songitem.selectedindex=0 else if selectedindex<totalsongs then songitem.selectedindex=selectedindex else songitem.selectedindex=selectedindex-1 end if end if end sub'删除歌曲 sub song_delete_onclick dim i i=songitem.selectedindex if i<0 then msgbox "请选择你要删除的歌曲!",,"请选择" exit sub end if dim cursong cursong=songitem.options(songitem.selectedindex).value cookiestr=replace(cookiestr,cursong,"") call InitList 'if i>ubound(songitem.options) then i=ubound(songitem.options) 'songitem.options(i).selected=true end sub'全部删除 sub song_deleteall_onclick dim resp resp=msgbox("真的要清空播放列表吗?",1,"确认") if (resp=1) then cookiestr="" Modified=true call InitList end if end sub'播放歌曲 sub play() if songitem.selectedindex<0 then msgbox "请选择你要播放的曲目",,"请选择" exit sub end if if PlayState<>0 and PlayState<>4 then:IsListDbclick=true:real.dostop:end if dim var dim person,collect,song,url var=split(songitem.options(songitem.selectedindex).value,"|") url=server_url if instr(var(0),":\")>0 then url=var(0) else url=url+var(0) end if song=var(1) collect=var(2) person=var(3) if lenb(person)>14 then info_person.innerHTML=leftb(person,12)&"..." else info_person.innerHTML=person end if if lenb(collect)>14 then info_collect.innerHTML=leftb(collect,12)&"..." else info_collect.innerHTML=collect end if if lenb(song)>14 then info_song.innerHTML=leftb(song,12)&"..." else info_song.innerHTML=song end if if real.getPlaystate<>0 then IsListDbclick=true real.setsource(url) real.doPlay end sub ''' /* 1连接3播放0停止4暂停2缓冲 */'ActiveX控件的事件处理脚本 sub real_OnPlayStateChange(newstate) dim src dim converttext PlayState=newstate select case PlayState case 0 converttext="己停止" case 1 converttext="正在连接" case 2 converttext="缓冲数据" case 3 converttext="播放中" case 4 converttext="己暂停" case else converttext="Unknown" end select 'if Playstate=1 or Playstate=2 then window.focus info_play_state.innerHTML=converttext if real.canplay then ctl_play.src=replace(ctl_play.src,"-2.gif","-1.gif") else ctl_play.src=replace(ctl_play.src,"-1.gif","-2.gif") ' ctl_play.disabled=true end if if real.canstop then ctl_stop.src=replace(ctl_stop.src,"-2.gif","-1.gif") else ctl_stop.src=replace(ctl_stop.src,"-1.gif","-2.gif") end if if real.canplaypause then ctl_pause.src=replace(ctl_pause.src,"-2.gif","-1.gif") else ctl_pause.src=replace(ctl_pause.src,"-1.gif","-2.gif") end ifend sub'同上 sub real_OnClipOpened(clipname,clipurl) ' Clip_Playing=true Clip_Length=real.GetLength Progress_Interval=setInterval ("call Progress_Change",1000) '开始移动指示条 end sub'同上 sub real_onClipClosed dim Rndnum Rndnum=songitem.selectedindex clearInterval Progress_Interval '停止移动指示条 ' Clip_Playing=false dim i if IsListDbclick<>true then i=songitem.selectedindex if Play_Mode=0 then if i<TotalSongs-1 then songitem.options(i+1).selected=true else songitem.options(0).selected=true end if else randomize while Rndnum=songitem.selectedindex Rndnum=int(rnd()*TotalSongs) wend songitem.options(Rndnum).selected=true end if call play end if IsListDbclick=false call Resetctl end subsub Resetctl Progress_block.style.left="0px" info_postion.innerHTML="00:00" info_speed.innerHTML="0kbps" info_Play_state.innerHTML="未打开" end sub'播放时每一定时间移动指示条 sub Progress_Change dim Current_Length,offset Current_Length=real.GetPosition offset=int((Current_Length/Clip_length)*Progress_bar_len) '偏移量=己播放的百分比*进度指示条总长 'msgbox "当前偏移量"&offset Progress_block.style.left=offset&"px" info_postion.innerHTML=FormatClipTime(Current_Length) info_speed.innerHTML=int(real.GetBandWidthAverage/10)/100 &"k" end sub'将RealPlayer的影片时间格式化 function FormatClipTime(timestr) dim min,sec timestr=int(timestr/1000) min=int(timestr/60) if len(cstr(min))<2 then FormatClipTime=FormatClipTime & "0" FormatClipTime=FormatClipTime & min & ":" sec=timestr mod 60 if len(cstr(sec))<2 then FormatClipTime=FormatClipTime & "0" FormatClipTime=FormatClipTime & sec end function'控制按钮 上一首 的处理脚本 sub ctl_last_onclick if songitem.selectedindex>0 and songitem.selectedindex<TotalSongs then songitem.options(songitem.selectedindex-1).selected=true call play end if end sub'控制按钮 播放 的处理脚本 sub ctl_play_onclick call play end sub'控制按钮 停止 的处理脚本 sub ctl_stop_onclick
dim cookiestr,server_url
server_url=getmenustr(trim(document.cookie))
cookiestr=getstr(trim(document.cookie))function getstr(co)
dim ttt
getstr=""
ttt=split(co,"$$$")
if ubound(ttt)>0 then
getstr=ttt(1)
end if
end function
function getmenustr(coo)
dim tt
getmenustr=""
tt=split(coo,"***")
if ubound(tt)>0 then
getmenustr=tt(1)
end if
end function
--------------------------------------------------------------------------------
作者: netasp 时间: 2003-10-11 09:28
option explicit
dim cookiestr,server_url
server_url=getmenustr(trim(document.cookie))
cookiestr=getstr(trim(document.cookie))function getstr(co)
dim ttt
getstr=""
ttt=split(co,"$$$")
if ubound(ttt)>0 then
getstr=ttt(1)
end if
end function
function getmenustr(coo)
dim tt
getmenustr=""
tt=split(coo,"***")
if ubound(tt)>0 then
getmenustr=tt(1)
end if
end function'添加歌曲
function Insertsong(songstr)
dim tstr,ttstr,tti
tstr=split(songstr,"|")
if instr(cookiestr,tstr(0) & "|" & tstr(1))>0 then
msgbox "你己经选择了这首歌曲!",,"错误"
exit function
else
cookiestr=cookiestr+"#"+songstr
Modified=true
call InitList
top.focus
end if
end function
dim PlayState '播放状态
dim AutoLoop '自动循环
dim TotalSongs '歌曲总数
dim Modified
dim IsListDbclick '正常停止?
dim Progress_Draging '拖动中?
dim Clip_Length '播放长度
dim Play_Mode '播放模式'0:顺序;1:随机
dim Progress_Interval '播放进度刷新的Interval ID
dim Progress_bar_len '进度指示条总长
dim Volume '音量(取值范围:1->10,ActiveX控件音量取值范围:Max=99,Min=0,实际音量=Volume*10-1)
'dim ActualWidth '窗口实际宽度
'dim ActualHeight '窗口实际高度
const MaxVolume=10
const Dotlinestr="----------------------------------------"sub Savelist()
document.cookie= "$$$"& cookiestr & "$$$"
Modified=false
end sub'是否变更播放列表
function checklist()
if Modified then
call Savelist
else
checklist=false
end if
end function'初始化页面(列表和变量)
sub Init
if RealInstalled<>true then exit sub
call Initvars
call Initlist
call Resetctl
call InitVolume
end subsub Initvars
Play_Mode=0
Volume=int(MaxVolume/2)
dim len1,len2
len1=progress_bar.style.width
len1=left(len1,instr(len1,"px")-1)
len2=progress_block.width
Progress_bar_len=cint(len1)-cint(len2)
'ActualWidth=window.screen.availwidth
'ActualHeight=window.screen.availheight
end sub'初始化列表
sub InitList()
dim selectedindex
dim songarray
dim html
dim i,j
dim tarr
dim OptionStrLen
dim tstr
if totalsongs>0 then selectedindex=songitem.selectedindex
html="<select size=5 name='songitem' style='width:265;background:#000000;color:#ffffff;' ondblclick='vbscript:if songitem.selectedindex>=0 then call play'>"
songarray=split(cookiestr,"#")
TotalSongs=0
for i=0 to ubound(songarray)
tarr=split(songarray(i),"|")
if ubound(tarr)=3 then
TotalSongs=TotalSongs+1
html=html & "<option value='" & songarray(i) & "'>" & vbcrlf
tstr= TotalSongs & "." & trim(tarr(1)) & "**" & trim(tarr(3))
OptionStrlen=len(tstr)
if OptionStrlen<20 then
tstr=replace(tstr,"**"," "&getleft(DotlineStr,20-OptionStrlen)& " ")
else
tstr=replace(tstr,"**"," - ")
tstr=getleft(tstr,20) & "..."
end if
html=html & tstr & "</option>" & vbcrlf
end if
next
html=html&"</select>" & vbcrlf
playlist.innerHTML=html
if TotalSongs=1 then
songitem.selectedindex=0
else if selectedindex<totalsongs then
songitem.selectedindex=selectedindex
else
songitem.selectedindex=selectedindex-1
end if
end if
end sub'删除歌曲
sub song_delete_onclick
dim i
i=songitem.selectedindex
if i<0 then
msgbox "请选择你要删除的歌曲!",,"请选择"
exit sub
end if
dim cursong
cursong=songitem.options(songitem.selectedindex).value
cookiestr=replace(cookiestr,cursong,"")
call InitList
'if i>ubound(songitem.options) then i=ubound(songitem.options)
'songitem.options(i).selected=true
end sub'全部删除
sub song_deleteall_onclick
dim resp
resp=msgbox("真的要清空播放列表吗?",1,"确认")
if (resp=1) then
cookiestr=""
Modified=true
call InitList
end if
end sub'播放歌曲
sub play()
if songitem.selectedindex<0 then
msgbox "请选择你要播放的曲目",,"请选择"
exit sub
end if
if PlayState<>0 and PlayState<>4 then:IsListDbclick=true:real.dostop:end if
dim var
dim person,collect,song,url
var=split(songitem.options(songitem.selectedindex).value,"|")
url=server_url
if instr(var(0),":\")>0 then
url=var(0)
else
url=url+var(0)
end if
song=var(1)
collect=var(2)
person=var(3)
if lenb(person)>14 then
info_person.innerHTML=leftb(person,12)&"..."
else
info_person.innerHTML=person
end if
if lenb(collect)>14 then
info_collect.innerHTML=leftb(collect,12)&"..."
else
info_collect.innerHTML=collect
end if
if lenb(song)>14 then
info_song.innerHTML=leftb(song,12)&"..."
else
info_song.innerHTML=song
end if
if real.getPlaystate<>0 then IsListDbclick=true
real.setsource(url)
real.doPlay
end sub
''' /* 1连接3播放0停止4暂停2缓冲 */'ActiveX控件的事件处理脚本
sub real_OnPlayStateChange(newstate)
dim src
dim converttext
PlayState=newstate
select case PlayState
case 0
converttext="己停止"
case 1
converttext="正在连接"
case 2
converttext="缓冲数据"
case 3
converttext="播放中"
case 4
converttext="己暂停"
case else
converttext="Unknown"
end select
'if Playstate=1 or Playstate=2 then window.focus
info_play_state.innerHTML=converttext
if real.canplay then
ctl_play.src=replace(ctl_play.src,"-2.gif","-1.gif")
else
ctl_play.src=replace(ctl_play.src,"-1.gif","-2.gif")
' ctl_play.disabled=true
end if
if real.canstop then
ctl_stop.src=replace(ctl_stop.src,"-2.gif","-1.gif")
else
ctl_stop.src=replace(ctl_stop.src,"-1.gif","-2.gif")
end if
if real.canplaypause then
ctl_pause.src=replace(ctl_pause.src,"-2.gif","-1.gif")
else
ctl_pause.src=replace(ctl_pause.src,"-1.gif","-2.gif")
end ifend sub'同上
sub real_OnClipOpened(clipname,clipurl)
' Clip_Playing=true
Clip_Length=real.GetLength
Progress_Interval=setInterval ("call Progress_Change",1000) '开始移动指示条
end sub'同上
sub real_onClipClosed
dim Rndnum
Rndnum=songitem.selectedindex
clearInterval Progress_Interval '停止移动指示条
' Clip_Playing=false
dim i
if IsListDbclick<>true then
i=songitem.selectedindex
if Play_Mode=0 then
if i<TotalSongs-1 then
songitem.options(i+1).selected=true
else
songitem.options(0).selected=true
end if
else
randomize
while Rndnum=songitem.selectedindex
Rndnum=int(rnd()*TotalSongs)
wend
songitem.options(Rndnum).selected=true
end if
call play
end if
IsListDbclick=false
call Resetctl
end subsub Resetctl
Progress_block.style.left="0px"
info_postion.innerHTML="00:00"
info_speed.innerHTML="0kbps"
info_Play_state.innerHTML="未打开"
end sub'播放时每一定时间移动指示条
sub Progress_Change
dim Current_Length,offset
Current_Length=real.GetPosition
offset=int((Current_Length/Clip_length)*Progress_bar_len) '偏移量=己播放的百分比*进度指示条总长
'msgbox "当前偏移量"&offset
Progress_block.style.left=offset&"px"
info_postion.innerHTML=FormatClipTime(Current_Length)
info_speed.innerHTML=int(real.GetBandWidthAverage/10)/100 &"k"
end sub'将RealPlayer的影片时间格式化
function FormatClipTime(timestr)
dim min,sec
timestr=int(timestr/1000)
min=int(timestr/60)
if len(cstr(min))<2 then FormatClipTime=FormatClipTime & "0"
FormatClipTime=FormatClipTime & min & ":"
sec=timestr mod 60
if len(cstr(sec))<2 then FormatClipTime=FormatClipTime & "0"
FormatClipTime=FormatClipTime & sec
end function'控制按钮 上一首 的处理脚本
sub ctl_last_onclick
if songitem.selectedindex>0 and songitem.selectedindex<TotalSongs then
songitem.options(songitem.selectedindex-1).selected=true
call play
end if
end sub'控制按钮 播放 的处理脚本
sub ctl_play_onclick
call play
end sub'控制按钮 停止 的处理脚本
sub ctl_stop_onclick