home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2007 November
/
PCWorld_2007-11_cd.bin
/
temacd
/
imtoodownyoutube
/
download-youtube-video.exe
/
script
/
flvmain.js
< prev
next >
Wrap
Text File
|
2007-09-11
|
26KB
|
1,118 lines
var _g_debug_model = false;
var dropstr=""
/*
MainWindow.RegisterMessage(1024+150,"onstart");
function onstart(args)
{
MainWindow_Minimize();
}*/
function UpodStartup()
{
LoadConfig();
StartupTestRegister();
MainWindow.title.maintitle.SetText(GetMainWindowTitle());
flvmain_init();
TaskManager.RunTask();
//MainWindow.SetTimer(103, 1000, "LoadSavedTasks");
LoadSavedTasks();
if (MainWindow.listctrlfiles.GetItemCount()>0)
{
MainWindow.listctrlfiles.height=332;
MainWindow.pel.height=0;
}
MainWindow_Minimize();
if(cfgGetInt("general","minstartup",0)==1)
MainWindow.SetTimer(103,100,"checkMainWindow");
}
function checkMainWindow()
{
if(IsWindowVisible(MainWindow))
{
MainWindow.KillTimer(103);
MainWindow_Minimize();
}
}
function OnMessage(args)
{
/*
var hMainWndHandle;
hMainWndHandle = MainWindow.GetHandle();
//SetForegroundWindow(hMainWndHandle);
BringWindowToTop(hMainWndHandle);
ActiveWindow(hMainWndHandle);
shownewtask(args[3]);
*/
dropstr=args[3];
drop_task_array.push(args[3]);
if (drop_task_process_time_running==false)
{
drop_task_process_time_running = true;
MainWindow.SetTimer(104, 100, "new_task_by_drop_timefunc");
}
}
function flvmain_init()
{
MainWindow.ShowMessageBox = ShowMessageBox;
MainWindow.menubar.menuoffile.menuofnewtask.SetEnable(true);
MainWindow.menubar.menuoffile.menuoffileinfo.SetEnable(false);
MainWindow.menubar.menuoffile.menuofexit.SetEnable(true);
MainWindow.menubar.menuofedit.menuofselall.SetEnable(false);
MainWindow.menubar.menuofedit.menuofdeltask.SetEnable(false);
MainWindow.menubar.menuofedit.menuofdelfintask.SetEnable(false);
// MainWindow.menubar.menuofview.menuoflistview.SetEnable(false);
// MainWindow.menubar.menuofview.menuofthumbnailview.SetEnable(false);
MainWindow.menubar.menuofaction.menuofstart.SetEnable(false);
MainWindow.menubar.menuofaction.menuofpause.SetEnable(false);
MainWindow.menubar.menuofaction.menuofstop.SetEnable(false);
MainWindow.menubar.menuofaction.menuofplayvideo.SetEnable(false);
MainWindow.menubar.menuoftools.menuoflanguage.SetEnable(true);
MainWindow.menubar.menuofhelp.menuofupodhelp.SetEnable(true);
MainWindow.menubar.menuofhelp.menuofbuyproduct1.SetEnable(true);
MainWindow.menubar.menuofhelp.menuofbuyproduct2.SetEnable(true);
MainWindow.menubar.menuofhelp.menufeed.SetEnable(true);
MainWindow.menubar.menuofhelp.menuabout.SetEnable(true);
flvmenupopup.menupopupbar.menupopup.menuofopentargetfoder.SetEnable(true);
flvmenupopup.menupopupbar.menupopup.menustart.SetEnable(false);
flvmenupopup.menupopupbar.menupopup.menupause.SetEnable(false);
flvmenupopup.menupopupbar.menupopup.menustop.SetEnable(false);
flvmenupopup.menupopupbar.menupopup.menudeletefinishtask.SetEnable(false);
flvmenupopup.menupopupbar.menupopup.menupreview.SetEnable(false);
flvmenupopup.menupopupbar.menupopup.menufileinfo.SetEnable(false);
flvmenupopup.menupopupbar.menupopup.menupreview.SetEnable(false);
MainWindow.buttonnew.SetEnable(true);
MainWindow.buttonstop.SetEnable(false);
MainWindow.buttonpause.SetEnable(false);
MainWindow.buttondelete.SetEnable(false);
MainWindow.buttonfileinfo.SetEnable(false);
MainWindow.buttonpre.SetEnable(false);
MainWindow.buttonstart.SetEnable(false);
if(IsWindowVisible(popwin))
{
popwin.Close();
}else if(IsWindowVisible(popupnotask))
{
popupnotask.Close();
}
if (cfgGetInt("general", "minstartup")!=0)
{
MainWindow_Minimize();
}
if (cfgGetInt("general", "showdrop", 1)!=0)
{
settings.showdrop.SetCheck(1);
showpopup();
}
g_ConfigObj.s_targetpath = GetDefaultOutputFolder();
g_ConfigObj.b_rename=cfgGetInt("general","rename",1);
g_ConfigObj.b_AutoDeleteFinished = cfgGetInt("general", "autodelete", 0);
g_ConfigObj.b_x=cfgGetInt("general","cx",GetScreenX()-60);
g_ConfigObj.b_y=cfgGetInt("general","cy",20);
//g_upodutil.SetWindowMinisizeable(MainWindow.GetHandle());
}
var WM_RBUTTONUP = 517;
var WM_LBUTTONDBLCLK = 515;
function sysNotify(nMsg, ParentObj, ParmObj)
{
switch(nMsg)
{
case WM_RBUTTONUP:
droppopup.dropmenupopupbar.dropmenupopup.Popup();
break;
case WM_LBUTTONDBLCLK:
//g_Systray.OpenSysTray();
hidemainwnd();
break;
}
}
function LoadSavedTasks()
{
//MainWindow.KillTimer(103);
//if (_g_debug_model)
//MainWindow.ShowMessageBox("Must load saved tasks", "debug info");
var TaskConfig = new JSIniFile();
TaskConfig.SetPath("upod.ini");
ExportObj(TaskConfig,"g_Config");
if(!g_Config.ReadFile())
{
g_Config.WriteFile();
}
var count=g_Config.GetValue("General","TaskCount",0);
for(var i=0;i<count;i++)
{
//var item1 = ["", upodurl, upodfilesize, upodprogress, proftype, upodpath];
//MainWindow.listctrlfiles.InsertItem(i,item1);
var str=g_Config.GetValue("task",i,"");
var splitstr=str.split(",/");
var item=["",splitstr[14],splitstr[15],splitstr[16],splitstr[4]];
var task=new Object;
task.st=splitstr[13];
task.taskid = -1;
task.filesize = -1;
task.filename = "";
task.lastProgress = 0;
//// 0 1 2 3 4 5 6 7 8 9 10 11 12
//task.info = [isconvert, upodurl, upodfilesize, upodprogress, upodpath, proftype, profopt, isconvert, srcfile, targetfile, realurl, bjrename, flvtmppath];
task.info = [splitstr[0], splitstr[1], splitstr[2], splitstr[3], splitstr[4], splitstr[5], splitstr[6], splitstr[7], splitstr[8], splitstr[9], splitstr[10], splitstr[11], splitstr[12]];
MainWindow.listctrlfiles.InsertItem(i,item);
MainWindow.listctrlfiles.SetItemData(i, task);
NewTaskSetItemStatus(i, task, task.st);
if(task.st=="downloadling")
MainWindow.listctrlfiles.SetText(i,3,LanguageStr("_download"));
else if(task.st=="stopped")
{
MainWindow.listctrlfiles.SetText(i,3,LanguageStr("_stop"));
}else if(task.st=="finished")
{
MainWindow.listctrlfiles.SetText(i,3,LanguageStr("_finish"));
}
//TaskSetItemStatus(i, "waiting");
}
}
function savesettings()
{
SaveAllTasks();
}
function MainWindow_destroy()
{
var ishavetask=0;
for (var i=0; i<MainWindow.listctrlfiles.GetItemCount(); i++)
{
var task =MainWindow.listctrlfiles.GetItemData(i);
if (task.st=="downloadling"||task.st=="converting"||task.st=="convert_paused")
{
ishavetask=1;
break;
}
}
if(ishavetask==1)
{
MainWindow.ShowMessageBox(LanguageStr("_flvmain_msg_taskworkingexit"), GetProductName(),2);
if(b_flag==0)
return;
// return false;
}
savesettings();
MainWindow.Close();
}
function getisminwindow()
{
if (cfgGetInt("general", "minstartup", 0)!=0)
{
MainWindow_Minimize();
}
}
function getsuburl(upodurl)
{
var start = upodurl.lastIndexOf("?") + 3;
var end = upodurl.length;
return upodurl.substr(start,end-start+1);
}
function Addtolistctrl(upodurl, upodfilesize, upodprogress, upodpath,proftype,profopt,isconvert,srcfile,targetfile,realurl,bjrename)
{
if (_g_debug_model)
{
SetWindowRedraw(MainWindow.listctrlfiles, false);
for (var i=0; i<1; i++)
{
TaskManager.AddTask(upodurl, upodfilesize, upodprogress, upodpath, proftype, profopt, isconvert, srcfile, targetfile, realurl, bjrename, GetTempFolder());
Sleep(100);
}
SetWindowRedraw(MainWindow.listctrlfiles, true);
}else
{
TaskManager.AddTask(upodurl, upodfilesize, upodprogress, upodpath, proftype, profopt, isconvert, srcfile, targetfile, realurl, bjrename, GetTempFolder());
}
}
function geturl()
{
return newtask.newtaskpanelinfo.newtaskurlvalue.GetText();
}
function startdownload(args)
{
DoStartWorking();
}
function formatFloat(src, pos)
{
return Math.round(src*Math.pow(10, pos))/Math.pow(10, pos);
}
function deletetask(args)
{
DoDeleteTask();
}
function deletefinishtask(args)
{
DoDeleteFinishedTask();
}
////////////////////////////////////////////////////////////
function pauseconvert(args)
{
DoPauseConverting();
}
function stopdownload(args)
{
DoStopWorking();
}
//////////////////////////////////////////////////////////////////
function flv_listrclick(args)
{
with (MainWindow)
{
var b_start = false;
var b_pause = false;
var b_stop = false;
var b_delete = false;
var b_file_info = false;
var b_play = false;
var b_delete_finished = false;
var b_select_all = false;
var b_open_target = 0;
var bj_play=0;
for (var i=0; i<listctrlfiles.GetItemCount(); i++)
{
if (b_delete_finished==false)
{
var task = listctrlfiles.GetItemData(i);
if (task.st=="finished")
{
b_delete_finished = true;
}
}
if (listctrlfiles.IsSelected(i))
{
bj_play++;
var task = listctrlfiles.GetItemData(i);
b_delete = true;
b_open_target ++;
if (b_start==false && TaskCanStart(task))
{
b_start = true;
}
if (b_pause==false && TaskCanPause(task))
{
b_pause = true;
}
if (b_stop==false && TaskCanStop(task))
{
b_stop = true;
}
if (b_file_info==false && task.st=="finished")
{
b_file_info = true;
b_play = true;
}
}
}
if(bj_play>1)
{
b_file_info = false;
b_play = false;
}
buttonstart.SetEnable(b_start);
buttonstop.SetEnable(b_stop);
buttonpre.SetEnable(b_play);
buttonfileinfo.SetEnable(b_file_info);
buttondelete.SetEnable(b_delete);
buttonpause.SetEnable(b_pause);
menubar.menuoffile.menuoffileinfo.SetEnable(b_file_info);
//menubar.menuofedit.menuofselall.SetEnable(b_select_all);
menubar.menuofedit.menuofdeltask.SetEnable(b_delete);
menubar.menuofedit.menuofdelfintask.SetEnable(b_delete_finished); // ???
menubar.menuofaction.menuofstart.SetEnable(b_start);
menubar.menuofaction.menuofpause.SetEnable(b_pause);
menubar.menuofaction.menuofstop.SetEnable(b_stop);
menubar.menuofaction.menuofplayvideo.SetEnable(b_play);
with (flvmenupopup.menupopupbar.menupopup)
{
var count = listctrlfiles.GetItemCount();
menustart.SetEnable(b_start);
menupreview.SetEnable(b_play);
menufileinfo.SetEnable(b_file_info);
menudeletetask.SetEnable(b_delete);
menudeletefinishtask.SetEnable(b_delete_finished);
menuofopentargetfoder.SetEnable(b_open_target==1);
menupause.SetEnable(b_pause);
menustop.SetEnable(b_stop);
Popup();
}
}
}
function flv_listitemclick(item)
{
UpdateUIStatus();
}
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
var drop_task_array = new Array();
var drop_task_loas_count = 0;
var drop_task_process_time_running = false;
function listctrldropfile(args)
{
/*
var hMainWndHandle;
hMainWndHandle = MainWindow.GetHandle();
// BringWindowToTop(hMainWndHandle);
SetForegroundWindow(hMainWndHandle);
// drop_task_array.push(args[2]);
var n_len = args[2].length;
if ( args[2].Substring(0,31)!=file1
&& args[2].Substring(0,27)!=file2
&& args[2].Substring(n_len-4, n_len)!=".flv"
)
{
MainWindow.ShowMessageBox(LanguageStr("_invalid_file_path"), GetProductName(),1);
return ;
//continue;
}
shownewtask(args[2]);*/
dropstr=args[2];
drop_task_process_time_running = false;
if (drop_task_process_time_running==false)
{
drop_task_process_time_running = true;
MainWindow.SetTimer(104, 100, "new_task_by_drop_timefunc()");
}
}
function ondropfile11(args)
{
if ( args[2].substr(0,31)!=file1
&& args[2].substr(0,27)!=file2
)
{
MainWindow.ShowMessageBox(LanguageStr("_invalid_file_path"), GetProductName(),1);
return ;
//continue;
}
listctrldropfile(args);
}
//avoid to make the IE or browser not be disabled
function new_task_by_drop_timefunc()
{
if (drop_task_loas_count<drop_task_array.length)
{
drop_task_loas_count = drop_task_array.length;
return;
}
if (IsWindowVisible(newtask))
{
return;
}
MainWindow.KillTimer(104);
var process_tasks = drop_task_array.splice(0, drop_task_array.length);
process_tasks.sort();
drop_task_loas_count = 0;
drop_task_process_time_running = false;
SetForegroundWindow(MainWindow.GetHandle());
//MainWindow.listctrlfiles.height=340;
//MainWindow.pel.height=0;
for (var i=0; i<process_tasks.length; i++)
{
var s_item = process_tasks[i];
var n_len = s_item.length;
if ( s_item.substr(0,31)!=file1
&& s_item.substr(0,27)!=file2
&& s_item.substr(n_len-4, 4)!=".flv"
)
{
MainWindow.ShowMessageBox(LanguageStr("_invalid_file_path"), GetProductName(),1);
b_wind=false;
return ;
//continue;
}
}
shownewtask(dropstr);
dropstr="";
}
function opentargetfile()
{
var sel = MainWindow.listctrlfiles.GetCurSel();
var selitem = MainWindow.listctrlfiles.GetItem(sel[1]);
var path=selitem[4];
if(path>4)
path+="\\";
helper.Helper_OpenFolder(path);
}
//////////////////////////////////////////////////////////////////
function playvideo()
{
/*
var sel = MainWindow.listctrlfiles.GetCurSel();
var selitem = MainWindow.listctrlfiles.GetItem(sel[1]);
var filename = "";
for(var i = 0;i < finishlist[0];i = i+2)
{
if(sel[1] == finishlist[i + 1])
{
filename = finishlist[i + 2];
break;
}
}
if(helper.Helper_IsFileExist(selitem[5]+filename+"."+selitem[4])==1)
{
preview.ShowModalLess();
play(selitem[5] + filename + "." + selitem[4]);
}
*/
var sel = MainWindow.listctrlfiles.GetCurSel();
if (sel[0]<=0)
return;
var task = MainWindow.listctrlfiles.GetItemData(sel[1]);
if (task.st=="finished")
{
var selitem = MainWindow.listctrlfiles.GetItem(sel[1]);
if(helper.Helper_IsFileExist(selitem[4]+selitem[1]+"."+"flv")==1)
{
var s_TaskSavedFile ="player.ini";
var TaskConfig = new JSIniFile();
TaskConfig.SetPath(s_TaskSavedFile);
TaskConfig.SetValue("general","skin",cfgGetString("general","skin","newskin"));
TaskConfig.SetValue("general","language",cfgGetString("general","language","English"));
TaskConfig.WriteFile();
TaskConfig = null;
var playerfilename=selitem[4]+selitem[1]+"."+"flv";
if(!helper.Helper_IsPlayerVisible())
helper.Helper_StartUpModule("ImTOO FLV Player.exe",0);
var szCmd;
szCmd = "-file " + "\"" + playerfilename + "\"";
helper.Helper_StartUpModule("ImTOO FLV Player.exe",szCmd);
}else
{
MainWindow.ShowMessageBox(LanguageStr("_file_not_exist"),GetProductName(),1);
}
}
}
//////////////////////////////////////////////////////////////////
function getfileinfo()
{
var sel = MainWindow.listctrlfiles.GetCurSel();
if (sel[0]<=0)
return;
var task = MainWindow.listctrlfiles.GetItemData(sel[1]);
if (task.st=="finished")
{
var selitem = MainWindow.listctrlfiles.GetItem(sel[1]);
if(helper.Helper_IsFileExist(selitem[4]+selitem[1]+"."+"flv")==1)
{
GetFileInfo(selitem[4]+selitem[1]+"."+"flv");
fileinfos.ShowModal();
}
else
{
MainWindow.ShowMessageBox(LanguageStr("_file_not_exist"),GetProductName(),1);
}
}
return;
/*
for(var i = 0;i < finishlist[0];i = i+2)
{
if(sel[1] == finishlist[i + 1])
{
filename = finishlist[i+2];
break;
}
}
*/
}
function gotoyoutube()
{
GotoUrl("http://www.youtube.com");
}
function SelectAll()
{
MainWindow.listctrlfiles.SelectAll();
UpdateUIStatus();
}
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
function setenglish()
{
ChangeLanguage("English");
if(helper.Helper_IsPlayerVisible())
helper.Helper_StartUpModule("ImTOO FLV Player.exe","-language English");
}
//////////////////////////////////////////////////////////////////
function setchinese()
{
ChangeLanguage("Chinese(Simplified)");
if(helper.Helper_IsPlayerVisible())
helper.Helper_StartUpModule("ImTOO FLV Player.exe","-language Chinese(Simplified)");
}
function setgerman()
{
ChangeLanguage("Deutsch");
if(helper.Helper_IsPlayerVisible())
helper.Helper_StartUpModule("ImTOO FLV Player.exe","-language Deutsch");
}
function setjapan()
{
ChangeLanguage("Japanese");
if(helper.Helper_IsPlayerVisible())
helper.Helper_StartUpModule("ImTOO FLV Player.exe","-language Japanese");
}
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
function setdefaultskin()
{
ChangeSkin("newskin");
if(helper.Helper_IsPlayerVisible())
helper.Helper_StartUpModule("ImTOO FLV Player.exe","-skin newskin");
}
function zidingyiskin()
{
ChangeSkin("upod_green");
if(helper.Helper_IsPlayerVisible())
helper.Helper_StartUpModule("ImTOO FLV Player.exe","-skin upod_green");
}
function shownewtask(filename)//target should show
{
//if (_g_debug_model && newtask.newtaskpanelinfo.newtaskurlvalue.GetText()=="")
//newtask.newtaskpanelinfo.newtaskurlvalue.SetText("http://www.youtube.com/watch?v=SmA8fDPFxlY");
if (IsWindowVisible(newtask))
{
return;
}
newtask.ShowMessageBox = ShowMessageBox;
newtask.newtaskpanelinfo.newtasksaveto.SetText(GetDefaultOutputFolder());
if(cfgGetInt("general","rename",0)==1)//
{
newtask.newtaskpanelinfo.checkrename.SetCheck(true);
newtask.newtaskpanelinfo.rename.SetEnable(false);
newtask.newtaskpanelinfo.newtaskfilename.SetText("");
newtask.newtaskpanelinfo.newtaskfilename.SetEnable(false);
}
else
{
newtask.newtaskpanelinfo.checkrename.SetCheck(false);
//newtask.newtaskpanelinfo.checkrename.SetCheck(true);
newtask.newtaskpanelinfo.rename.SetEnable(true);
newtask.newtaskpanelinfo.newtaskfilename.SetEnable(true);
}
// newtask.newtaskpanelinfo.rename.SetEnable(false);
if(filename.length>20)
{
newtask.newtaskpanelinfo.newtaskurlvalue.SetText(filename);
// newtask.newtaskpanelinfo.newtaskurlvalue.SetText("");
}
else
{
var file1="http://www.youtube.com/watch?v=";
var handle1=newtask.GetHandle();
var clipstr=GetClipBoxText(handle1);
if ( clipstr.length>30&& clipstr.substr(0,31)==file1 )
{
newtask.newtaskpanelinfo.newtaskurlvalue.SetText(clipstr);
}
else
{
newtask.newtaskpanelinfo.newtaskurlvalue.SetText("");
}
//newtask.newtaskpanelinfo.newtaskurlvalue.SetText("");
}
newtask.ShowModal();
g_upodutil.SetForegroundWindow(MainWindow.GetHandle());
SetForegroundWindow(MainWindow);
}
function showpreview()
{
var s_TaskSavedFile ="player.ini";
var TaskConfig = new JSIniFile();
TaskConfig.SetPath(s_TaskSavedFile);
TaskConfig.SetValue("general","skin",cfgGetString("general","skin","newskin"));
TaskConfig.SetValue("general","language",cfgGetString("general","language","English"));
TaskConfig.WriteFile();
TaskConfig = null;
if(!helper.Helper_IsPlayerVisible())
helper.Helper_StartUpModule("ImTOO FLV Player.exe",0);
}
/// help menu process functions \\\
function OnHelp(args)
{
var urlstr ="ImTOO Download YouTube Video.chm";
if(urlstr.length <= 0)
{
return 1;
}
GotoUrl(urlstr);
}
function onBuy1(args)
{
var urlstr = "http://www.imtoo.com/youtube-video-converter.html";
GotoUrl(urlstr);
}
function onBuy2(args)
{
var urlstr = "http://www.imtoo.com/youtube-to-ipod-converter.html";
GotoUrl(urlstr);
}
function onSupport(args)
{
var urlstr = Product.GetSupportUrl();
if(urlstr.length <= 0)
{
return 1;
}
GotoUrl(urlstr);
}
function onAbout(args)
{
AboutWindow.abouttitle.SetText(LanguageStr("_flvmain_menu_about")+" "+GetProductName());
AboutWindow.productname.SetText(GetProductName());
AboutWindow.productid.SetText(Product.GetVersion());
AboutWindow.url1.SetLink(Product.GetCompanyUrl());
AboutWindow.url1.SetText(Product.GetCompanyName());
AboutWindow.ShowModal();
}
var bjfudong=0;
function showpopup()
{
if(TaskManager.RunningCount==0)
{
var cx=cfgGetInt("general","cx",GetScreenX()-60);
var cy=cfgGetInt("general","cy",20);
popupnotask.SetPosition(cx,cy,48,48);
popupnotask.ShowModalLess();
bjfudong=1;
}
else
{
var cx=cfgGetInt("general","cx",GetScreenX()-60);
var cy=cfgGetInt("general","cy",20);
popwin.SetPosition(cx,cy,48,48);
popwin.panel1.SetVisible(true);
popwin.panel2.SetVisible(false);
popwin.ShowModalLess();
bjfudong=2;
}
droppopup.dropmenupopupbar.dropmenupopup.menushowdrop.SetCheck(true);
/*popupnotask.SetPosition(x-60,20,48,48);
popupnotask.ShowModalLess();*/
}
function fudong_control()
{
if(cfgGetInt("general","showdrop",0)==0)//if exist close it
{
if(IsWindowVisible(popwin)||IsWindowVisible(popupnotask))
{
fudong_close();
cfgSetInt("general","showdrop",0);
}else
return;
}
else//show it
{
showpopup();
cfgSetInt("general","showdrop",1);
}
}
function fudong_control1()
{
if(IsWindowVisible(popwin)||IsWindowVisible(popupnotask))//if exist close it
{
fudong_close();
cfgSetInt("general","showdrop",0);
}
else//show it
{
showpopup();
cfgSetInt("general","showdrop",1);
}
}
function winhover(args)
{
popwin.SetAlpha(255);
}
function winleave(args)
{
popwin.SetAlpha(120);
}
var b_wind=false;
function windropfile(args)
{
if(IsWindowVisible(newtask))
return ;
b_wind=true;
listctrldropfile(args);
}
function closemainwnd()
{
MainWindow_Minimize();
}
// ???
function hidemainwnd()
{//tray
if (IsWindowVisible(MainWindow))
{
MainWindow_Minimize();
//hide=1;
}
else
{
MainWindow.RestoreWindow();
}
}
function fudong_close()
{
if(bjfudong==2)
{
cfgSetInt("general","cx",popwin.GetWindowLeft());
cfgSetInt("general","cy",popwin.GetWindowTop());
popwin.Close();
}
if(bjfudong==1)
{
cfgSetInt("general","cx",popupnotask.GetWindowLeft());
cfgSetInt("general","cy",popupnotask.GetWindowTop());
popupnotask.Close();
}
droppopup.dropmenupopupbar.dropmenupopup.menushowdrop.SetCheck(false);
bjfudong=0;
}
function LoadConfig()
{
//var s_lang = GetLanguage(); // "Chinese(Simplified)" // ???
//RefreshLanguage(s_lang);
LoadLanguageStartup();
LoadSkinStartup();
TaskManager.MaxtTask = cfgGetInt("general", "maxtask", 3);
if (TaskManager.MaxtTask<=0 || TaskManager.MaxtTask>10)
{
TaskManager.MaxtTask = 3;
cfgGetInt("general", "maxtask", TaskManager.MaxtTask);
}
}
function StartupTestRegister()
{
/*
var reginfo = Product.GetRegInfo();
RegWindow.regname.SetText(reginfo[0]);
if (Product.IsValidateReg())
{
RegWindow.regname.SetText(reginfo[0]);
return;
}
var dayleft=helper.Helper_CanRun();
if(dayleft>0&&dayleft<=14)
{
//regbefore.range1.SetText(dayleft);
var limitstr = LanguageStr("_registration_label_limitation");
var newstring=limitstr.replace("d%",dayleft);
regbefore.ShowMessageBox = ShowMessageBox;
regbefore.limit.SetText(newstring);
regbefore.regname.SetText(reginfo[0]);
regbefore.ShowModal();
}
else if(dayleft==0)
{
var expirestr=LanguageStr("_registration_label_limitation2");
regbefore.ShowMessageBox = ShowMessageBox;
regbefore.limit.SetText(expirestr);
regbefore.reglater.SetEnable(false);
regbefore.ShowModal();
//MainWindow.SetTimer(102,100,"checkmainwndvisible");
}
*/
}
var tray=0;
function MainWindow_Minimize()
{
if(tray==1)
{
g_Systray.DeleteSysTray();
var mainhandle=MainWindow.GetHandle();
g_Systray.SetParentWnd(mainhandle);
g_Systray.AddSysTray("upod_16.ico", sysNotify);
}
if(tray==0)
{
var mainhandle=MainWindow.GetHandle();
g_Systray.SetParentWnd(mainhandle);
g_Systray.AddSysTray("upod_16.ico", sysNotify);
tray=1;
}
}
function msgok()
{
normal.Close();
}
function specialmsgok()
{
special.Close();
b_flag=1;
}
function specialmsgcancel()
{
special.Close();
b_flag=0;
}
//chenzhong start
LoadLib("MemoryShare.dll");
var MemoryShare = new JSMemoryShare();
MemoryShare.MemoryShare_Init();
function OnSyncSkin(args)
{
ChangeSkin(args[3]);
// cfgSetString("general","skin",args[3]);
}
function OnSyncLanguage(args)
{
ChangeLanguage(args[3]);
//cfgSetString("general","language",args[3]);
}
MainWindow.RegisterSysMenuHandle("sysmenuhandle");
function sysmenuhandle(args)
{
var mess = args[2];
if(mess == 61472)
{
MainWindow_Minimize();
return false;
}
return true;
}