📄 cnsidebud.js
字号:
var ccl = objMmInfo[cActIdx].mmCl;
if(ctit=="nAnT"){ objMmInfo[cActIdx].mmTit = strAuthor + " - " + strTitle;
ctit=strAuthor + " - " + strTitle;
cActTit="T"+ trknum + ". " +ctit;
mpc_name.innerHTML = cActTit;
disp4.innerHTML = ccl;
}
strMmInfo= "Media (Title) : " + strTitle + " (CnSide MP:" + strType +")" + "\n"
strMmInfo= strMmInfo + "Media (Author) : " + strAuthor + "\n"
strMmInfo= strMmInfo + "Media (URL) : 媒体路径已被隐藏 \n";
//strMmInfo= strMmInfo + "Media (URL) : " +strUrl + "\n"
strMmInfo= strMmInfo + "Media (Copyright) : " + strCopy +"\n"
strMmInfo= strMmInfo + "Media (Duration) : " +strDur +"\n\n";
strMmInfo= strMmInfo + "睡房首页:http://www.sengfun.com \n";
strMmInfo= strMmInfo + "CnSide MP 2002-2003\n";
if(blnShowMmInfo){alert(strMmInfo);}
}
}
function evtPSChg(f){
// 0(Undefined) 1(Stopped) 2 (Paused) 3(Playing) 4(ScanFowrd) 5(ScanReverse)
// 6(Buffering) 7(Waitng) 8(MediaEnded) 9(Transitioning) 10(Redy)
switch(f){
case 1:
evtStop();
break;
case 2:
evtPause();
break;
case 3:
evtPlay();
break;
case 8:
setTimeout('playAuto()', intDelay);
break;
}
}
//evtWmpBuff()
function evtWmpBuff(f){
if(f){ mpc_time_played.innerHTML = "Buffering";
var msg="Loading..." + cActTit;
mpc_name.innerHTML = msg;
if(blnStatusBar){window.status=(msg);}
}
else{
mpc_name.innerHTML=cActTit;
var ccl = objMmInfo[cActIdx].mmCl;
//disp4.innerHTML=ccl;
showTLab();
}
}
//evtWmpError()
function evtWmpError(){
intErrCnt=intErrCnt+1;
if(intErrCnt<=3){
//mpc_time_played.innerHTML="Error("+intErrCnt+")";
mpc_time_played.innerHTML="未知";
var msg="(Error:" + intErrCnt +") " +cActTit;
mpc_name.innerHTML="欢迎光临睡房网" +cActTit;
disp4.innerHTML='正在链接...';
if(blnStatusBar){window.status=(msg);}
tidErr=setTimeout('retryPlay()',1000);
}
else{
disp4.innerHTML='无法连接到服务器';
clearTimeout(tidErr);
intErrCnt=0;
showTLab();
var msg="发生错误";
if(blnStatusBar){window.status=(msg);}
setTimeout('playAuto()',1000);}
}
function evtStop(){
clearTimeout(tidErr);
clearInterval(tidTLab);
showTLab();
intErrCnt=0;
imgChange("pauzt",0);
imgChange("playt",0);
imgChange("scope",0);
time.style.pixelLeft=3;
mpc_name.innerHTML="CnSide MP Player";
disp4.innerHTML="播放器已停止";
if(blnStatusBar){window.status=('CnSide MP Player');}
}
function evtPause(){
imgChange("pauzt",1)
imgChange("playt",0);
imgChange("stopt",0);
imgChange("scope",0);
clearInterval(tidTLab);
showTLab();
}
function evtPlay(){
imgChange("pauzt",0)
imgChange("playt",1);
imgChange("stopt",0);
//imgChange("scope",1);
tidTLab=setInterval('showTLab()',1000);
}
/**
* 显示时间长度Displaying Timer label(Elapse,Lapse)
*/
function showTLab(){
var ps=CnSideBud.playState;
if(ps==2 || ps==3){
var cp=CnSideBud.controls.currentPosition
var cps=CnSideBud.controls.currentPositionString
var dur=CnSideBud.currentMedia.duration;
var durs=CnSideBud.currentMedia.durationString;
if(blnElaps){mpc_time_played.innerHTML= cps+" | "+durs;
var msg=cActTit + " ("+cps+" | "+durs+ ")";
if(ps==2){msg="(CnSide MP) "+ msg;}
if(blnStatusBar){window.status=(msg);return true;}
}
else{var laps= dur-cp;
var strLaps=wmpTime(laps);
mpc_time_played.innerHTML= strLaps + " | "+durs;
var msg= cActTit + " (" + strLaps + " | "+durs + ")";
if(ps==2){msg="(CnSide MP) "+ msg;}
if(blnStatusBar){window.status=(msg);return true;}
}
//PrositionBar
if (CnSideBud.controls.currentPosition>0){
var now_postion=Math.floor(cp);
var total_postion=Math.floor(dur);
var postion_value=((now_postion * 320) / total_postion) +3;
if (postion_value){
document.all.time.style.pixelLeft=postion_value;
}
}
//
}
else{mpc_time_played.innerHTML="00:00 | 00:00";}
}
/**
* 时间显示模式
*/
function chgTimeFmt(){
var wmps=CnSideBud.playState;
if(wmps == 3){clearInterval(tidTLab);}
if(blnElaps){blnElaps=false; mpc_time_played.innerHTML="Laps";}
else{blnElaps=true;mpc_time_played.innerHTML="ELaps";}
tidMsg=setTimeout('rtnTLab()',1000);
}
/**
* 显示时间指示器
*/
function rtnTLab(){
clearTimeout(tidMsg);
var wmps=CnSideBud.playState;
if(wmps == 3){tidTLab=setInterval('showTLab()',1000);}
else{showTLab();}
}
/**
* 计算时间长度
*/
function wmpTime(dur){
var hh, min, sec, timeLabel
hh = Math.floor(dur/3600);
min = Math.floor(dur / 60)%60;
sec = Math.floor(dur % 60);
if (isNaN(min)){ return "00:00"; }
if (isNaN(hh) || hh==0){timeLabel="";}
else{
if(hh >9){timeLabel = hh.toString()+":";}
else{timeLabel="0"+hh.toString() +":";}
}
if ( min > 9 ){ timeLabel = timeLabel + min.toString() + ":"; }
else {timeLabel = timeLabel + "0" +min.toString() + ":";}
if ( sec > 9 ){timeLabel = timeLabel + sec.toString();}
else{timeLabel = timeLabel + "0" + sec.toString();}
return timeLabel;
}
/**
* 静音
*/
function wmpMute() {
var wmps=CnSideBud.playState;
if(wmps == 3) { clearInterval(tidTLab); }
var ps = CnSideBud.settings;
if(!ps.mute) {
ps.mute = true;
//disp2.innerHTML="静音";
imgChange("vmute", 1);
} else {
ps.mute = false;
//disp2.innerHTML="取消静音";
imgChange("vmute", 0)
}
tidMsg=setTimeout('rtnTLab()',1000);
}
/**
* 初始化音量开关
*/
function initVol() {
var ps=intVolume;
if(isNaN(ps) || ps<0) { ps=0; }
else if(ps>=100){ps=100;}
volSliderObj = document.getElementById('volSlider');
sliderPosLeft = parseInt(volSliderObj.style.left);
volSliderObj.style.left = (sliderPosLeft + Math.floor(volSliderLength * ps/100)) + "px";;
}
var time_startpoint=0;
var time_endpoint=320;
var chkEvent = 0;
function SetStatebar(){
if(Math.floor(CnSideBud.controls.currentPosition)>0){
positionSet=true;
iex=event.clientX;
tempx=time.style.pixelLeft;
document.onmousemove=positionDragControl;
if (document.all){document.onmouseup=playerSetPosition;}
}
}
function positionDragControl(){
if (positionSet){
var mov = tempx+event.clientX-iex;
if ((mov >= time_startpoint) && (mov < time_endpoint)){
time.style.pixelLeft=mov;
if ( chkEvent != 3 ) { chkEvent++; } else { chkEvent = 0; }
} return false;
}
}
function playerSetPosition(){
if (positionSet){
positionSet=false;
CnSideBud.controls.CurrentPosition = Math.floor(CnSideBud.currentMedia.duration *((time.style.pixelLeft-4)/320));
}
}
function drag_dropie(){
if (setVolMove){
var mov = Pos_Left+event.clientX-XX;
if ((mov >= 0) && (mov < 35)){
cutpoint=35-sound.style.pixelLeft;
sound.style.pixelLeft=Pos_Left+event.clientX-XX;
CnSideBud.settings.Volume=100-(100*(cutpoint/35));
mpc_time_played.innerHTML="Vol. " + CnSideBud.settings.Volume +"%";
if (mov < 35) { CnSideBud.settings.Mute = true; } else { CnSideBud.settings.Mute=false; }
}return false;
}
}
function SetVolume(){
XX=event.clientX;
Pos_Left=sound.style.pixelLeft;
setVolMove=true;
document.onmousemove=drag_dropie;
if (document.all){document.onmouseup=endVolume;}
}
function endVolume(){setVolMove=false;}
function waitMsg(){
if(intCnSideBudStat ==1){mpc_name.innerHTML="CnSide MP Player";}
if(intCnSideBudStat ==2){mpc_name.innerHTML="CnSide MP Player";}
if(blnStatusBar){
if(intCnSideBudStat ==1){window.status=('CnSide MP Player');return true;}
if(intCnSideBudStat ==2){window.status=('CnSide MP Player'); return true;}
}
}
function chkWmpState(){
// 0(Undefined) 1(Stopped) 2 (Paused) 3(Playing) 4(ScanFowrd) 5(ScanReverse)
// 6(Buffering) 7(Waitng) 8(MediaEnded) 9(Transitioning) 10(Redy)
return CnSideBud.playState;
}
function chkWmpOState(){
// 0(Undefined) 8(MediaChanging) 9(MediaLocating) 10(MediaConnecting) 11(MediaLoading)
// 12(MediaOpening) 13(MediaOpen) 20(MediaWaiting) 21(OpeningUnknownURL)
return CnSideBud.openState;
}
function chkOnline(){
// true(Network Connected) false(Network Lost)
return CnSideBud.isOnline;
}
function vizCnSideBud(){
//CnSideBud.launchURL("http://www.cnside.com");
window.open("http://www.sentfun.com","vizCnSideBud");
}
function gotoUrl(curid){
parent.location = nextUrl + objMmInfo[curid].mmId;
}
function nonLRC(){
var tempTop=scrollId.scrollTop;
scrollId.scrollTop=tempTop+scrollSpeed;
nonLRCHandle=window.setTimeout("nonLRC()",400);
}
function initLRC(){
//初始化歌词
objLrc = new LRCClass();
}
function showLRC(lrcUrl)
{
objLrc.setPlayer(CnSideBud);
objLrc.setURL(lrcUrl);
objLrc.setOutput("contentLRC");
objLrc.setDisplayType(1);
objLrc.setScrollId("scrollId");
objLrc.setScLength(18)
objLrc.syncLRC();
objLrc.start();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -