home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2004 June
/
PCWorld_2004-06_cd.bin
/
software
/
vyzkuste
/
problemy
/
problemy.exe
/
M2Combo.exe
/
Plugin
/
main.js
< prev
next >
Wrap
Text File
|
2003-12-18
|
33KB
|
1,050 lines
function savecss(css) {
window.external.m2_writeIni('WMP Player','config.ini','General','css',css);
}
var skin;
function loadcss()
{
skin = window.external.m2_readIni('WMP Player','config.ini','General','css','');
if (skin!='')
{
changeCss(skin);
}
}
function changeCss(c) //╤∙╩╜╟╨╗╗
{
css1.href='css/'+c;
skin=c;
savecss(c)
}
var color1,color2,fon,siz,fontw,under;
var idL,idT,idC; //═¼▓╜╕Φ┤╩║»╩²showLine(),╥╤╣²╩▒╝Σ║»╩²showTime()
var path="",lrcDir="";
function loadConfig() //╘╪╚δ╔Φ╓├
{
path = window.external.m2_readIni('WMP Player','config.ini','General','path','');
lrcDir = window.external.m2_readIni('WMP Player','config.ini','General','lrcDir','');
color1 = window.external.m2_readIni('WMP Player','config.ini','lyric','color1','');
color2 = window.external.m2_readIni('WMP Player','config.ini','lyric','color2','');
fon = window.external.m2_readIni('WMP Player','config.ini','lyric','font','');
siz = window.external.m2_readIni('WMP Player','config.ini','lyric','size','');
fontw = window.external.m2_readIni('WMP Player','config.ini','lyric','fontw','');
under = window.external.m2_readIni('WMP Player','config.ini','lyric','underline','');
lrcFont();
}
//=================================================
function saveConfig() //▒ú┤µ╔Φ╓├
{
window.external.m2_writeIni('WMP Player','config.ini','General','path',path);
window.external.m2_writeIni('WMP Player','config.ini','General','lrcDir',lrcDir);
window.external.m2_writeIni('WMP Player','config.ini','lyric','color1',color1);
window.external.m2_writeIni('WMP Player','config.ini','lyric','color2',color2);
window.external.m2_writeIni('WMP Player','config.ini','lyric','font',fon);
window.external.m2_writeIni('WMP Player','config.ini','lyric','size',siz);
window.external.m2_writeIni('WMP Player','config.ini','lyric','fontw',fontw);
window.external.m2_writeIni('WMP Player','config.ini','lyric','underline',under);
window.external.m2_writeIni('WMP Player','config.ini','General','Volume',VolumePos.toString());
window.external.m2_writeIni('WMP Player','config.ini','General','Shuff',isshuff);
window.external.m2_writeIni('WMP Player','config.ini','General','Loop',isloop);
}
//=================================================
function lrcFont() //╕ⁿ╕─╕Φ┤╩╫╓╠σ
{
capText.style.textDecoration = '';
capText1.style.textDecoration = '';
capText2.style.textDecoration = '';
capText.style.color = color1;
capText1.style.color = color2;
capText2.style.color = color1;
capText.style.fontFamily = fon;
capText1.style.fontFamily = fon;
capText2.style.fontFamily = fon;
capText.style.fontSize = siz + 'pt';
capText1.style.fontSize = siz + 'pt';
capText2.style.fontSize = siz + 'pt';
switch (fontw)
{
case 'Normal':
{
capText.style.fontWeight = '';
capText1.style.fontWeight = '';
capText2.style.fontWeight = '';
capText.style.fontStyle = '';
capText1.style.fontStyle = '';
capText2.style.fontStyle = '';
break;
}
case 'Bold':
{capText.style.fontWeight = 'bold';
capText1.style.fontWeight = 'bold';
capText2.style.fontWeight = 'bold';
capText.style.fontStyle = '';
capText1.style.fontStyle = '';
capText2.style.fontStyle = '';
break;}
case 'Italic':
{
capText.style.fontWeight = '';
capText1.style.fontWeight = '';
capText2.style.fontWeight = '';
capText.style.fontStyle = 'italic';
capText1.style.fontStyle = 'italic';
capText2.style.fontStyle = 'italic';
break;}
case 'Bold and italic':
{
capText.style.fontWeight = 'bold';
capText1.style.fontWeight = 'bold';
capText2.style.fontWeight = 'bold';
capText.style.fontStyle = 'italic';
capText1.style.fontStyle = 'italic';
capText2.style.fontStyle = 'italic';
break;}
}
if (under=='true')
{
capText.style.textDecoration = 'underline';
capText1.style.textDecoration = 'underline';
capText2.style.textDecoration = 'underline';
}
else
{capText.style.textDecoration = 'none';
capText1.style.textDecoration = 'none';
capText2.style.textDecoration = 'none';
}
}
//=================================================
var lrcArray = new Array();
var fso = new ActiveXObject("Scripting.FileSystemObject");
//=================================================
var lrcFilesArray=new Array();
function findFiles(folderspec)
{
var f1,fc,i=0;
lrcFilesArray.length=0;
var ti=Player.currentMedia.getItemInfo("Title").toLowerCase();
var na=Player.currentMedia.name.toLowerCase();
fo = fso.GetFolder(folderspec);
fc = new Enumerator(fo.files);
for (; !fc.atEnd(); fc.moveNext())
{
if (fc.item().name.substr(fc.item().name.lastIndexOf('.'))=='.lrc')
{
if ((fc.item().name.toLowerCase().indexOf(ti)!=-1)||(fc.item().name.toLowerCase().indexOf(na)!=-1))
{
lrcFilesArray[i]=new Array(fc.item());
i=i+1;
}
}
}
}
function WriteLrcItems()
{ capText1.innerHTML='';
for (i=0;i<lrcFilesArray.length;i++)
{
capText1.innerHTML +='<a href="#" onclick="loadlrc(this.outerText)"><font color="#FF0000">'+lrcFilesArray[i]+'</font></a><BR>';
}
}
function findLrc() //Lookup lyric files
{
capText.innerHTML='';
capText1.innerHTML=lngStr("Lyric","Show Lyric Here(Lrc)");
capText2.innerHTML='';
lrcFilesArray.length=0;
lrcArray.length=0;
var ti=Player.currentMedia.getItemInfo("Title").toLowerCase();
var na=Player.currentMedia.name.toLowerCase();
var strUrl = Player.currentMedia.getItemInfo("SourceURL");
var lrcS=external.m2_readIni('WMP Player','Associate.ini','AssociateLyric',strUrl,'');
if (lrcS.length>0)
{
loadlrc(lrcS);
}
else
{
strUrl = strUrl.split('.');
Urls = strUrl[0] + '.lrc';
var strSmi=strUrl[0] + '.smi';
if (fso.FileExists(Urls)||fso.FileExists(strSmi))
{
if (fso.FileExists(strSmi))
{ return;}
else
{loadlrc(Urls);}
}
else
{
strUrl = Player.currentMedia.getItemInfo("SourceURL");
strUrl = strUrl.split('\\');
strUrl = strUrl[strUrl.length-1];
strUrl = strUrl.split('.');
strUrl = strUrl[0] + '.lrc';
if (lrcDir.substr(lrcDir.length-1,lrcDir.length)!='\\')
lrcDir += '\\';
Urls= lrcDir + strUrl;
if (fso.FileExists(Urls))
loadlrc(Urls);
else
{
strUrl = Player.currentMedia.getItemInfo("SourceURL");
var index = strUrl.lastIndexOf('\\');
strUrl=strUrl.substr(0,index); //
if (strUrl.substr(strUrl.length-1,strUrl.length)!='\\')
strUrl += '\\';
findFiles(strUrl);
if (lrcFilesArray.length>0)
{
if (lrcFilesArray.length>1)
{
WriteLrcItems();
}
else {loadlrc(lrcFilesArray[0]);}
}
else
{
if (lrcDir.substr(lrcDir.length-1,lrcDir.length)!='\\')
lrcDir += '\\';
findFiles(lrcDir);
if (lrcFilesArray.length>0)
{
if (lrcFilesArray.length>1)
{
WriteLrcItems();
}
else {loadlrc(lrcFilesArray[0]);}
}
else
{
capText.innerHTML='';
capText1.innerHTML=lngStr('Lyric','No lyric');
capText2.innerHTML='';
window.clearInterval(idL); //╟σ│²═¼▓╜╕Φ┤╩║»╩²╢¿╩▒╓┤╨╨
}
}
}
}
}
}
//======================================
function loadlrc(u) //Load lyric text to array
{ var s,sLrc,sLine,str,shh;
var ind;
//alert(u);
capText1.innerHTML='';
lrcArray.length=0;
var f = fso.OpenTextFile(u, 1);
sLrc = f.ReadAll();
sLine = sLrc.split('\r\n');
ind = 0;
for (var i=0;i<sLine.length;i++)
{
s = sLine[i];
if (s.length>0)
{
str = s.split(']');
if (str[str.length-1].length>0)
{
for (var j=0;j<(str.length-1);j++)
{
if ((str[j].length>0)&&(str[j].length<10))
{
str[j]=str[j].substr(1, 5);
lrcArray[ind] = new Array(str[j],str[str.length-1]);
ind = ind + 1;
}
}
}
}
}
f.Close();
lrcArray.sort();
//alert(lrcArray)
}
//=======================================
function seldir() //Set lyric directory
{
//var objSrc= new ActiveXObject("Shell.Application")
var objSrc=oShell.BrowseForFolder(0, lngStr('Other','Select the lyric directory')+'\n'+lngStr("Control","Current Directory is")+' :['+lrcDir+']', 0, '');
if (objSrc!=null)
{
lrcDir = objSrc.Items().Item().Path;
seld.alt=lngStr("Control","Set lyric Directory")+'\n'+lngStr("Control","Current Directory is")+' :\n ['+lrcDir+']';
}
}
//=================================================
function showLine() //Display lyric
{
var t=Player.controls.currentPositionString;
for (var i=0;i<lrcArray.length;i++)
{
if (lrcArray[i][0]==t)
{ if (i>0)
capText.innerHTML=lrcArray[i-1][1];
else capText.innerHTML='';
capText1.innerHTML=lrcArray[i][1];
capText2.innerHTML=lrcArray[i+1][1];
break;
}
}
}
//=================================================
function WritePL() //Save PlayList to PL.txt
{ var strUrl='',s='';
for (var j=0;j<Player.currentPlaylist.count;j++)
{
strUrl = Player.currentPlaylist.item(j).getItemInfo("SourceURL");
if (j==Player.currentPlaylist.count-1)
{s +=strUrl;}
else
{s +=strUrl + ";";}
}
external.writeFile("WMP Player","PL.txt",s);
//saveConfig();
}
//=================================================
function GetPL() //Load PlayList from PL.txt
{ var s,ss;
loadConfig();
s = window.external.readFile("WMP Player","PL.txt");
if (s!='')
{
ss = s.split(";");
for (var i=0;i<ss.length;i++)
{
addList(ss[i]);
}
Player.controls.currentItem = Player.currentPlaylist.item(0);
if (external.m2_readIni('WMP Player','config.ini','General','autoPlay','')=='1')
{ Player.controls.play(); }
itemList(); //╦ó╨┬ PlayList
}
}
//=================================================
function full() //╚½╞┴
{
if (Player.playState == 3)
Player.fullScreen = 'true';
}
//=================================================
function showInfo() //╧╘╩╛├╜╠σ╨┼╧ó
{
var strTitle = Player.currentMedia.getItemInfo("Title");
if (strTitle.length <= 0){strTitle = lngStr("Other","UnknowTitle");}
var strAuthor = Player.currentMedia.getItemInfo("Author");
if (strAuthor.length <= 0){strAuthor = lngStr("Other","UnknowArtist");}
var strDur = Player.currentMedia.durationString;
var strUrl = Player.currentMedia.getItemInfo("SourceURL");
strMmInfo = lngStr("Message","Title :") + strTitle + "\n\n";
strMmInfo += lngStr("Message","Artist:") + strAuthor + "\n\n";
strMmInfo += lngStr("Message","Time :") + strDur + "\n\n";
strMmInfo += lngStr("Message","URL :") + strUrl +' ';
return strMmInfo;
}
function scrollStr()
{ var str='';
var strTitle = Player.currentMedia.getItemInfo("Title");
if (strTitle.length <= 0){strTitle = lngStr("Other","UnknowTitle");}
var strAuthor = Player.currentMedia.getItemInfo("Author");
if (strAuthor.length <= 0){strAuthor = lngStr("Other","UnknowArtist");}
var strDur = Player.currentMedia.durationString;
var strBitrate=Player.currentMedia.getItemInfo("Bitrate")/1000+'Kbps';
str = strAuthor + " ";
str += strTitle + " [";
str += strDur + "] "+strBitrate;
scrollText.innerHTML=str;
ST.innerHTML=str;
}
//=================================================
function showInfoSel() //╧╘╩╛╤í╘±╡─├╜╠σ╨┼╧ó
{
var v = playItem.selectedIndex;
var mediaObject = Player.currentPlaylist.item(v);
var strTitle = Player.currentPlaylist.item(v).getItemInfo("Title");
if(strTitle.length <= 0){strTitle = lngStr("Other","UnknowTitle");}
var strAuthor = Player.currentPlaylist.item(v).getItemInfo("Author");
if(strAuthor.length <= 0){strAuthor = lngStr("Other","UnknowArtist");}
var strDur = Player.currentPlaylist.item(v).DurationString;
var strUrl = Player.currentPlaylist.item(v).getItemInfo("SourceURL");
strMmInfo = lngStr("Message","Title :") + strTitle + "\n\n";
strMmInfo += lngStr("Message","Artist:") + strAuthor + "\n\n";
strMmInfo += lngStr("Message","Time :") + strDur + "\n\n\n";
strMmInfo += lngStr("Message","URL :") + strUrl + "\n\n";
alert(strMmInfo);
}
//=================================================
function formatItemStr(index)
{
var formatStrArray=new Array();
var FormatStr=external.m2_readIni('WMP Player','config.ini','General','PLItemFormat','');
if (FormatStr.length<=0)
{ FormatStr='%I.%A - %T'; }
var str,strAuthor,strTitle,strUrl,strName,strDuration,strFileType;
str=FormatStr;
strAuthor = Player.currentPlaylist.item(index).getItemInfo("Author");
strTitle = Player.currentPlaylist.item(index).getItemInfo("Title");
strDuration = Player.currentPlaylist.item(index).durationString;
strFileType = Player.currentPlaylist.item(index).getItemInfo("FileType");
strUrl = Player.currentPlaylist.item(index).getItemInfo("SourceURL");
strName=Player.currentPlaylist.item(index).name;
//alert('OK');
if(strAuthor.length <= 0)
{strAuthor = lngStr("Other","UnknowArtist");}
if(strTitle.length <= 0)
{strTitle = lngStr("Other","UnknowTitle");}
str=str.replace('%I',(index+1).toString());
str=str.replace('%A',strAuthor);
str=str.replace('%T',strTitle);
str=str.replace('%N',strName);
str=str.replace('%D',strDuration);
str=str.replace('%Ft',strFileType);
str=str.replace('%S',strUrl);
formatStrArray[0]=str;
formatStrArray[1]=strUrl;
return formatStrArray;
}
//==========================================
function itemList() //╝╙╘╪▓Ñ╖┼┴╨▒φ
{
var strs,strUrl;
playItem.length = 0;
for(var i=0;i<Player.currentPlaylist.count;i++)
{
strs=formatItemStr(i)[0];
strUrl=formatItemStr(i)[1];
//Player.currentPlaylist.item(i).getItemInfo("SourceURL");
playItem.options[playItem.options.length] = new Option(strs,strUrl);
}
WritePL();
plPosition();
}
//=================================================
function playSel(c) //╦½╗≈▓Ñ╖┼╤í╘±╡─╟·─┐
{
Player.controls.stop();
Player.controls.currentItem = Player.currentPlaylist.item(c);
Player.controls.play();
}
//=================================================
function delItem() //╔╛│²╤í╘±╡─╟·─┐
{
var l = playItem.selectedIndex;
var mediaObject = Player.currentPlaylist.item(l);
var strAuthor = Player.currentPlaylist.item(l).getItemInfo("Author");
var strTitle = Player.currentPlaylist.item(l).getItemInfo("Title");
var strUrl = Player.currentPlaylist.item(l).getItemInfo("SourceURL");
if(strAuthor.length <= 0){strAuthor = lngStr("Other","UnknowArtist");}
if(strTitle.length <= 0){strTitle = lngStr("Other","UnknowTitle");}
var mediaStr = strAuthor+" - "+strTitle;
var answer = confirm(lngStr("Message","You sure delete")+" \" " + mediaStr +" [ "+strUrl+ " ] \" ?");
if (answer)
{
Player.currentPlaylist.removeItem(mediaObject);
playItem.options[l].removeNode();
itemList();
}
}
//=================================================
function addDialog() //╠φ╝╙╬─╝■╢╘╗░┐≥
{
window.showModalDialog("addfile.htm", window, "dialogHeight:250px;dialogWidth:420px;status:0;help:0;scroll:0");
}
function openDialog() //┤≥┐¬╬─╝■╢╘╗░┐≥
{
window.showModalDialog("openfile.htm", window, "dialogHeight:250px;dialogWidth:420px;status:0;help:0;scroll:0");
}
function setfont() //╕Φ┤╩╫╓╠σ╔Φ╓├╢╘╗░┐≥
{
window.showModalDialog("setfont.htm", window, "dialogHeight:300px;dialogWidth:500px;status:0;help:0;scroll:0");
}
//=================================================
function addList(v) //╠φ╝╙┴╨▒φ
{
var cm = Player.newMedia(v);
Player.currentPlaylist.insertItem(Player.currentPlaylist.count,cm);
}
//=================================================
function removeList() //╟σ┐╒┴╨▒φ
{ Player.controls.stop();
var mediaObject;
var num = Player.currentPlaylist.count;
for (var i=0;i<num;i++)
{ mediaObject = Player.currentPlaylist.item(0);
Player.currentPlaylist.removeItem(mediaObject);
playItem.options[0].removeNode();
}
}
//=================================================
function preload(imgname,imgsrc) //ͼƬSRC
{
eval(imgname+'=new Image()')
eval(imgname+'.src="images\/'+imgsrc+'"')
}
//=================================================
preload("play1","play.gif");
preload("play2","play_b.gif");
preload("stop1","stop.gif");
preload("stop2","stop_b.gif");
preload("sound1","sound.gif");
preload("sound2","sound_b.gif");
preload("volume","volume.gif");
preload("pause1","pause.gif");
preload("pause2","pause_b.gif");
preload("full1","full.gif");
preload("full2","full_b.gif");
preload("shuff1","shuff.gif");
preload("shuff2","shuff_b.gif");
preload("loop1","loop.gif");
preload("loop2","loop_b.gif");
preload("imgPlay","pla.gif");
preload("imgPause","paus.gif");
preload("imgStop","stp.gif");
preload("imgTra","tra.gif");
preload("imgBef","bef.gif");
preload("mplay1","m_play.gif");
preload("mplay2","m_play_b.gif");
preload("mpause1","m_pause.gif");
preload("mpause2","m_pause_b.gif");
preload("mstop1","m_stop.gif");
preload("mstop2","m_stop_b.gif");
preload("mmute1","m_mute.gif");
preload("mmute2","m_mute_b.gif");
preload("mloop1","m_loop.gif");
preload("mloop2","m_loop_b.gif");
preload("mshuff1","m_shuff.gif");
preload("mshuff2","m_shuff_b.gif");
//=================================================
function DoPlay() //▓Ñ╖┼
{
Player.controls.play();
document.play.src=play2.src;
document.stop.src=stop1.src;
document.pause.src=pause1.src;
document.micplay.src=mplay2.src;
document.micpause.src=mpause1.src;
document.micstop.src=mstop1.src;
}
//=================================================
function DoStop() //ֹͣ
{
Player.controls.CurrentPosition=0;
Player.controls.stop();
document.play.src=play1.src;
document.stop.src=stop2.src;
document.pause.src=pause1.src;
document.micplay.src=mplay1.src;
document.micpause.src=mpause1.src;
document.micstop.src=mstop2.src;
if (document.seek.style.visibility=="visible")
document.seek.style.left=4;
window.clearInterval(idT); //╟σ│²╥╤╣²╩▒╝Σ║»╩²╢¿╩▒╓┤╨╨
}
//=================================================
function DoPause() //╘▌═ú
{
Player.controls.pause();
document.play.src=play1.src;
document.pause.src=pause2.src;
document.stop.src=stop1.src;
document.micplay.src=mplay1.src;
document.micpause.src=mpause2.src;
document.micstop.src=mstop1.src;
window.clearInterval(idT); //╟σ│²╥╤╣²╩▒╝Σ║»╩²╢¿╩▒╓┤╨╨
}
function DoNext()
{
Player.controls.next();
if (!(Player.playState==3))
{Player.controls.stop();Player.controls.play();}
}
function DoPrevious()
{
Player.controls.previous();
if (!(Player.playState==3))
{Player.controls.stop();Player.controls.play();}
}
//=================================================
var mute
mute = false;
//=================================================
function SetMute() //╛▓╥⌠
{
if (!Player.playState == 3) return
if (mute){
Player.settings.Mute=false
document.sound.src=sound1.src;
document.micmute.src=mmute1.src;
document.vol.style.visibility="visible";
mute=false
}
else{
Player.settings.Mute=true;
document.sound.src=sound2.src;
document.micmute.src=mmute2.src;
document.vol.style.visibility="hidden";
mute=true
}
}
//=================================================
var x,theImg;
var Maxvol, Minvol;
var VolumePos=100;
Maxvol=52;
Minvol=2;
cur=32;
//=================================================
function move() //╥⌠┴┐╗¼┐Θ╥╞╢»
{
if (event.button==1&&(Player.playState == 3)){
left=temp1+event.clientX-x;
if ((left<=Maxvol)&&(left>=Minvol))
{theImg.style.pixelLeft=left;enddrag();}
else
if(left>Maxvol)
{theImg.style.pixelLeft=Maxvol;enddrag();}
else
{theImg.style.pixelLeft=Minvol;enddrag();}
return false
}
}
//=================================================
function enddrag() //╥⌠┴┐╗¼┐Θ═ú╓╣
{
//╒Γ└∩╔Φ╓├╥⌠┴┐
if (Player.playState == 3){
cur=theImg.style.pixelLeft;
cur=(cur-2)*2;
SetVolume(cur);
//document.onmousemove=null;
}
}
//=================================================
function begindrag(Elm) //╥⌠┴┐╗¼┐Θ═╧╢»
{
if (!document.all)
return
if (!Player.playState == 3)
return
temp1=Elm.style.pixelLeft
theImg=Elm
x=event.clientX;
Elm.onmousemove=move
}
//=================================================
function SetVolume(Pos) //╔Φ╓├╥⌠┴┐
{
Player.settings.volume=Pos;
vol.alt=lngStr("Control","Volume")+': '+Pos+'%';
VolumePos=Pos;
}
//=================================================
//***************╥╘╧┬▓┐╖╓╬¬▓Ñ╖┼╜°╢╚┐╪╓╞*************
var movelen=0;
function GetLength() //╗±╚í╡▒╟░├╜╠σ│ñ╢╚
{
return Player.currentMedia.duration;
}
//=================================================
function GetPosition() //╗±╚í╡▒╟░▓Ñ╖┼╜°╢╚
{
tt=Player.controls.currentPosition;
return tt;
}
//=================================================
function SetPosition(Pos) //╔Φ╓├▓Ñ╖┼╜°╢╚
{
if (!Player.playState == 3) return;
Player.controls.currentPosition=+Pos;
}
//=================================================
var Start, End;
var seeking;
seeking=false
Start=4;
End=218;
//=================================================
function beginseek(Elm) //╜°╢╚╠⌡┐¬╩╝═╧╢»
{
if (!document.all)
return
if (!Player.playState == 3)
return
temp1=Elm.style.pixelLeft
theImg=Elm
x=event.clientX;
seeking=true
Elm.onmousemove=moveseek
}
//=================================================
function moveseek() //╜°╢╚╗¼┐Θ╥╞╢»
{
if (event.button==1&&(Player.playState == 3)){
left=temp1+event.clientX-x
if ((left<=End)&&(left>=Start))
theImg.style.pixelLeft=left
else
if(left>End)
theImg.style.pixelLeft=End
else
theImg.style.pixelLeft=Start
return false
}
}
//=================================================
function enddragseek() //╜°╢╚═╧╢»╜ß╩°
{
//╒Γ└∩╔Φ╓├╩▒╝Σ╦╤╦≈
if (Player.playState == 3){
movelen=GetLength()
cur=theImg.style.pixelLeft;
if (cur==End)
Player.controls.stop();
else{
cur=Math.floor((cur-Start)*movelen/(End-Start));
SetPosition(cur);
seeking=false;
//document.onmousemove=null;
}
}
}
//=================================================
function changeseek() //╕∙╛▌▓Ñ╖┼╕─▒Σ╜°╢╚╠⌡╬╗╓├
{
// if (Player.playState != 2) return;
End=positionBar.width-10;
if (!seeking)
{
if (movelen==0)
movelen=GetLength();
cur=GetPosition();
cur=Math.floor((End-Start)*cur/movelen);
document.seek.style.pixelLeft=Start+cur;
}
}
//==========
var blnElaps=true;
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 ShowTime() //╧╘╩╛▓Ñ╖┼╩▒╝Σ╡─╫┤╠¼ú¿╥╤╣²╩▒╝Σ|╫▄╩▒╝Σú⌐
{ var alltime,NowT,num,cp,dur;
alltime = Player.currentMedia.durationString;
NowT = Player.controls.currentPositionString;
if (!blnElaps)
{
cp=Player.controls.currentPosition;
dur=Player.currentMedia.duration;
NowT='-'+wmpTime(dur-cp);
}
disp2.innerHTML = ' '+NowT + '|' +alltime ;
mdisp2.innerHTML = ' '+NowT + '|' +alltime ;
}
//=================================================
function goUrl() //┤≥┐¬URL
{var s;
s=prompt(lngStr("Other","Input URL")+'','http://');
if (s=='') {alert(lngStr("Other","Nothing")+'!')}
else
{
Player.URL = s;
Player.controls.play();
itemList();
}
}
//=================================================
var isshuff = 'false';
//=================================================
function setshuff() //╔Φ╓├╦µ╗·─ú╩╜
{ if (isshuff=='true')
{
Player.settings.setMode('shuffle', false);
document.shuff.src=shuff1.src;
document.micshuff.src=mshuff1.src;
isshuff='false';
}
else
{
Player.settings.setMode('shuffle', true);
document.shuff.src=shuff2.src;
document.micshuff.src=mshuff2.src;
isshuff='true';
}
}
//=================================================
var isloop = 'false';
//=================================================
function setloop() //╔Φ╓├╤¡╗╖─ú╩╜
{ if (isloop=='true')
{
Player.settings.setMode('loop', false);
document.loop.src=loop1.src;
document.micloop.src=mloop1.src;
isloop='false';
}
else
{
Player.settings.setMode('loop', true);
document.loop.src=loop2.src;
document.micloop.src=mloop2.src;
isloop='true';
}
}
//=================================================
var idU;
function UpdateBP(){
disp1.innerHTML = "";
disp1.innerHTML = ' '+lngStr("State","Buffering")+':';
disp1.innerHTML += Player.network.bufferingProgress+"%";
mdisp1.innerHTML=disp1.innerHTML;
}
function changeState() //▓Ñ╖┼╫┤╠¼╕─▒Σ╧∞╙ª╩┬╝■
{
window.clearInterval(idU);
window.clearInterval(idC);
var myText;
var NewState=Player.playState;
switch (NewState){
case 1:
{
myText = lngStr("State","Stoped");
window.clearInterval(idT);
document.imgState.src=imgStop.src;
document.mimgState.src=imgStop.src;
document.play.src=play1.src;
document.stop.src=stop2.src;
document.pause.src=pause1.src;
document.micplay.src=mplay1.src;
document.micpause.src=mpause1.src;
document.micstop.src=mstop2.src;
disp2.innerHTML=' 00:00|'+Player.currentMedia.durationString;
break;
}
case 2:
{
myText = lngStr("State","Paused");
window.clearInterval(idT);
document.imgState.src=imgPause.src;
document.mimgState.src=imgPause.src;
document.play.src=play1.src;
document.pause.src=pause2.src;
document.stop.src=stop1.src;
document.micplay.src=mplay1.src;
document.micpause.src=mpause2.src;
document.micstop.src=mstop1.src;
break;
}
case 3:
{
myText = lngStr("State","Playing");
idT=setInterval('ShowTime()',1000);
idC=setInterval('changeseek()',1000);
document.imgState.src=imgPlay.src;
document.mimgState.src=imgPlay.src;
document.play.src=play2.src;
document.stop.src=stop1.src;
document.pause.src=pause1.src;
document.micplay.src=mplay2.src;
document.micpause.src=mpause1.src;
document.micstop.src=mstop1.src;
findLrc();
break;
}
case 6:
myText = lngStr("State","Buffering")+'...';
document.imgState.src=imgBef.src;
document.mimgState.src=imgBef.src;
idU = window.setInterval("UpdateBP()", 500);
break;
case 7:
myText = lngStr("State","Waiting");
window.clearInterval(idT);
break;
case 9:
myText = lngStr("State","Transitioning...");
window.clearInterval(idT);
document.imgState.src=imgTra.src;
document.mimgState.src=imgTra.src;
break;
case 10:
myText = lngStr("State","Ready");
window.clearInterval(idT);
DoStop();
break;
default:
myText = "";
}
disp1.innerHTML=' '+myText;
mdisp1.innerHTML=' '+myText;
}
//============================================================
function about() //╣╪╙┌╢╘╗░┐≥
{
showModalDialog('about.htm',window,'dialogHeight:210px;dialogWidth:365px;help:no;status:no;scroll:no');
}
//============================================================
var playId=0;
function plPosition() //╘┌┴╨▒φ╓╨╢¿╬╗╡▒╟░├╜╠σ
{
var strUrl = Player.currentMedia.getItemInfo("SourceURL");
playItem.options[playId].style.backgroundColor = "Black";
playItem.value=strUrl;
playId=playItem.selectedIndex;
playItem.options[playId].style.backgroundColor = "green";
}
//============================================================
function openDir() //╠φ╝╙─┐┬╝
{
var objSrc= oShell.BrowseForFolder(0, lngStr('Other','Select Folder you want add'), 0, '');
if (objSrc!=null)
{
var s=objSrc.Items().Item().Path;
addDirFiles(s);
itemList();
}
}
//============================================================
function addDirFiles(folderspec) //╠φ╝╙─┐┬╝íó╫╙─┐┬╝╓╨WMP╦∙╙╨╓º│╓╡─╬─╝■
{ var ext=external.m2_readIni('WMP Player','config.ini','FileType','ext','');
ext=ext.split('|');
var f1,fc,fo,ff;
fo = fso.GetFolder(folderspec);
fc = new Enumerator(fo.files);
for (; !fc.atEnd(); fc.moveNext())
{
for (var i=0;i<ext.length ;i++ )
{
if (fc.item().name.substr(fc.item().name.lastIndexOf('.'))==ext[i])
{ addList(fc.item());break;}
}
}
ff = new Enumerator(fo.SubFolders); //▓Θ╒╥╫╙─┐┬╝
for (; !ff.atEnd(); ff.moveNext())
{
addDirFiles(ff.item());
}
}
//============================================================
function delAll() //╔╛│²╚½▓┐╚╖╚╧
{
if(confirm(lngStr("Message","You sure remove all items")+' ?'))
{removeList();itemList();}
}
//============================================================
function openMediaLib() // ├╜╠σ┐Γ
{
window.showModalDialog("MediaLibrary.htm", window, "dialogHeight:300px;dialogWidth:500px;status:0;help:0;scroll:0");
}
//============================================================
function option() //╕Φ┤╩╫╓╠σ╔Φ╓├╢╘╗░┐≥
{
window.showModalDialog("options.htm", window, "dialogHeight:310px;dialogWidth:430px;status:0;help:0;scroll:0");
}
//============================================================
var associateItem='';
function assDialog() //╣╪┴¬╕Φ┤╩╢╘╗░┐≥
{
associateItem=playItem.options[playItem.selectedIndex].value;
var lyricFile=external.m2_readIni('WMP Player','Associate.ini','AssociateLyric',associateItem,'')
if (lyricFile.length>0)
{
var answer = confirm('[ '+associateItem+' ] \n'+lngStr("Other","was associated with")+' \n[ '+lyricFile+' ]\n\n'+lngStr("Other","You want to reAssociate")+' ?');
if (answer)
{
window.showModalDialog("associateDialog.htm", window, "dialogHeight:250px;dialogWidth:420px;status:0;help:0;scroll:0");
}
}
else
{
window.showModalDialog("associateDialog.htm", window, "dialogHeight:250px;dialogWidth:420px;status:0;help:0;scroll:0");
}
}
function assLyric() //╣╪┴¬╕Φ┤╩▓Θ┐┤
{
window.showModalDialog("associateLyric.htm", window, "dialogHeight:250px;dialogWidth:420px;status:0;help:0;scroll:0");
}
function writeAssociate(mediaFile,lrcFile)
{
window.external.m2_writeIni('WMP Player','Associate.ini','AssociateLyric',mediaFile,lrcFile);
}
function roadControls() //│⌡╩╝╥⌠┴┐ú¼╤¡╗╖─ú╩╜ú¼╦µ╗·/╦│╨≥─ú╩╜
{
var volnum=window.external.m2_readIni('WMP Player','config.ini','General','Volume','');
if (volnum.length>0)
{ VolumePos=volnum;}
else
{ VolumePos=100; }
SetVolume(VolumePos);
vol.style.pixelLeft=Math.floor(VolumePos/2)+2;
var sh=window.external.m2_readIni('WMP Player','config.ini','General','Shuff','');
var lo=window.external.m2_readIni('WMP Player','config.ini','General','Loop','');
if (sh=='true')
{ setshuff(); }
if (lo=='true')
{ setloop(); }
var plSize=window.external.m2_readIni('WMP Player','config.ini','General','PLSize','');
if (plSize.length>0)
{ playItem.size=plSize} //Playlist Size
}
function moveitem(num)
{
var i=playItem.selectedIndex;
if (num==1&&i!=0)
{
Player.currentPlaylist.moveItem(i, i-1);
playItem.options[i].text=formatItemStr(i)[0];
playItem.options[i].value=formatItemStr(i)[1];
playItem.options[i-1].text=formatItemStr(i-1)[0];
playItem.options[i-1].value=formatItemStr(i-1)[1];
plPosition();
playItem.options[i-1].selected=true;
}
if ((num==-1)&&(i!=playItem.length-1))
{
Player.currentPlaylist.moveItem(i, i+1);
playItem.options[i].text=formatItemStr(i)[0];
playItem.options[i].value=formatItemStr(i)[1];
playItem.options[i+1].text=formatItemStr(i+1)[0];
playItem.options[i+1].value=formatItemStr(i+1)[1];
plPosition();
playItem.options[i+1].selected=true;
}
}