home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2004 June
/
PCWorld_2004-06_cd.bin
/
software
/
vyzkuste
/
problemy
/
problemy.exe
/
M2Combo.exe
/
Plugin
/
fileDialog.js
< prev
next >
Wrap
Text File
|
2003-12-17
|
4KB
|
139 lines
var fso,fo;
fso=dialogArguments.fso;
function loadFileType()
{var s,ss,sss,ext;
s = dialogArguments.external.m2_readIni('WMP Player','config.ini','FileType','fileType','');
ss = s.split(";");
for (var i=0;i<ss.length;i++)
{
sss = ss[i].split("|");
D4.options[D4.options.length] = new Option(sss[0],sss[1]);
}
ext=dialogArguments.external.m2_readIni('WMP Player','config.ini','FileType','DefaultExt','');
if (ext.length>0)
{
D4.value=ext;
}
}
function ShowDriveList()
{
var s, n, e, x;
e = new Enumerator(fso.Drives);
for (; !e.atEnd(); e.moveNext())
{
x = e.item();
switch (x.DriveType)
{
case 0: t = dialogArguments.lngStr("Drive","Unknown")+" ("; break;
case 1: t = dialogArguments.lngStr("Drive","Removable")+" ("; break;
case 2: t = dialogArguments.lngStr("Drive","Fixed")+" ("; break;
case 3: t = dialogArguments.lngStr("Drive","Network")+" ("; break;
case 4: t = dialogArguments.lngStr("Drive","CD-ROM")+" ("; break;
case 5: t = dialogArguments.lngStr("Drive","RAM Disk")+" ("; break;
}
D1.options[D1.options.length] = new Option(t+x+")",x.Path);
}
}
function goUp()
{
var rf=fso.GetFolder(fo.Path);
if (rf.IsRootFolder)
{alert(dialogArguments.lngStr("Message","The specified folder is the root folder."));}
else
{
var fop=fo.ParentFolder.Path;
ShowFolderList(fop);
}
}
function cmd(A,B)
{
execScript('c1=(ASC(\"'+A+'\"))','vbscript');
execScript('c2=(ASC(\"'+B+'\"))','vbscript');
if (((c1>0)&&(c2>0))||((c1<0)&&(c2<0))) return (c1-c2);
else {return c1>c2?-1:1;}
}
function ShowFolderList(folderspec)
{
var ar = new Array();
if (fso.FolderExists(folderspec))
{
var fc;
document.frames("I1").frames("left").D2.length = 0;
fo = fso.GetFolder(folderspec);
D1.value=fo.Drive.Path;
T1.value=fo.Path;
dialogArguments.path = fo.Path;
fc = new Enumerator(fo.SubFolders);
for (; !fc.atEnd(); fc.moveNext())
{
ar[ar.length] = new Array(fc.item().name.toLowerCase(),fc.item().name,fc.item());
}
ar.sort(cmd);
for (var i=0;i<ar.length ;i++ )
{
document.frames("I1").frames("left").D2.options[i] = new Option(ar[i][1],ar[i][2]);
}
ShowFolderFileList(folderspec);
}
else
alert(dialogArguments.lngStr("Message","Folder invalid")+" !");
}
function ShowFolderFileList(folderspec)
{ var ar = new Array();
document.frames("I1").frames("right").D3.length = 0;
var f1,fc;
fo = fso.GetFolder(folderspec);
fc = new Enumerator(fo.files);
for (; !fc.atEnd(); fc.moveNext())
{ if (!(D4.value==".*"))
{
if ((fc.item().name.substr(fc.item().name.lastIndexOf('.')))==D4.value)
ar[ar.length] = new Array(fc.item().name.toLowerCase(),fc.item().name,fc.item());
}
else
ar[ar.length] = new Array(fc.item().name.toLowerCase(),fc.item().name,fc.item());
}
ar.sort(cmd);
for (var i=0;i<ar.length ;i++ )
{
document.frames("I1").frames("right").D3.options[i] = new Option(ar[i][1],ar[i][2]);
}
}
function fff()
{
var se=document.frames("I1").frames("right").D3;
var isSelect=false;
for(var i=0;i < se.options.length;i++)
{
if (se.options[i].selected==true)
{
if (se.options[i].value.substr(se.options[i].value.lastIndexOf('.'))=='.wpl')
{
var newPlaylist = dialogArguments.Player.newPlaylist("temp",se.options[i].value);
for (var j=0;j<newPlaylist.count;j++)
dialogArguments.addList(newPlaylist.item(j).sourceURL);
}
else
dialogArguments.addList(se.options[i].value);
isSelect=true;
}
}
if (!isSelect)
alert('Please select files!');
else
{
if (dialogArguments.Player.playState !=3)
{dialogArguments.Player.controls.stop();dialogArguments.Player.controls.play();}
dialogArguments.external.m2_writeIni('WMP Player','config.ini','FileType','DefaultExt',D4.value);
dialogArguments.itemList();
window.close();
}
}
function loadpath()
{
if (!dialogArguments.path=='')
{ShowFolderList(dialogArguments.path);}
}