home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2007 November
/
PCWorld_2007-11_cd.bin
/
temacd
/
imtoodownyoutube
/
download-youtube-video.exe
/
script
/
preview.js
< prev
next >
Wrap
Text File
|
2007-09-11
|
12KB
|
479 lines
LoadLib("MyFileDialog.dll");
LoadLib("Helper.dll");
var help=new JSHelper;
help.Helper_Init();
var timerpos = 0; var fileinfopath="";
var timer1=0;var m_bplayer=0;
preview.curplay.SetText("00:00:00");
preview.totalplay.SetText("00:00:00");
var ini = new JSIniFile("player.ini");
ExportObj(ini,"g_Config");
player_init();
preview.v1.SetPos(100);
function player_init()
{
ini.ReadFile();
var langstr=g_Config.GetValue("general","language","English");
changlanguage(langstr);
var skinstr=g_Config.GetValue("general","skin","newskin");
changskin(skinstr);
}
function SliderChange(args)
{
var pos = args[2];
var isDrag = args[3];
timerpos = pos;
preview.player1.Player_SeekTo(timerpos);
}
function changevolume(args)
{
args[2]+=20;
if(args>100)
args[2]=100;
preview.player1.Player_SetVolume(args[2]);
}
var strtime="";
function getstrtime(time)
{
var h=parseInt(time/3600);
var m=parseInt((time-h*3600)/60);
var s=time%60;
if(h<10)h="0"+h;
if(m<10)m="0"+m;
if(s<10)s="0"+s;
strtime=h+":"+m+":"+s;
return strtime;
}
var bjplay=0,bjstop=0;
function play(filename)
{
var totaltime=preview.player1.Player_GetTotalTime();
preview.totalplay.SetText(getstrtime(totaltime));
var curtime=preview.player1.Player_GetCurrentTime();
preview.curplay.SetText(getstrtime(curtime));
preview.play111.SetEnable(true);
playerpath=filename;
preview.menupopup.play.SetEnable(true);
preview.volume.SetEnable(true);
m_bplayer=1;
playplay();
}
function playplay()
{
if(bjplay==0)
{
if(bjstop==1)
preview.player1.Player_SetFile(playerpath);
if(bjvolume==1)
preview.player1.Player_SetVolume(0);
else
preview.player1.Player_SetVolume(preview.v1.GetPos());
preview.play111.SetImage("player-pause.png");
preview.play111.SetTipText(LanguageStr("_player_menu_pause"));
preview.playstop.SetEnable(true);
preview.menuofplay.SetEnable(false);
preview.menuofstop.SetEnable(true);
preview.menuofpause.SetEnable(true);
preview.menupopup.play.SetEnable(false);
preview.menupopup.pause.SetEnable(true);
preview.menupopup.stop.SetEnable(true);
preview.volume.SetEnable(true);
bjstop=0;
preview.player1.Player_Play();
bjplay=1;
}
else if(bjplay==1)
{ preview.play111.SetImage("player-play.png");
bjplay=0;
playpause();
preview.play111.SetTipText(LanguageStr("_player_btn_tooltip_play"));
preview.menuofpause.SetEnable(false);
preview.menuofplay.SetEnable(true);
preview.menuofstop.SetEnable(true);
preview.menupopup.play.SetEnable(true);
preview.menupopup.pause.SetEnable(false);
preview.menupopup.stop.SetEnable(true);
return 1;
}
preview.menuoffullscreen.SetEnable(true);
if(timer1==0)
{
preview.SetTimer(2,1000,"timerfunc");
timer1=1;
}
}
function timerfunc(args)
{
if(timer1==0) preview.KillTimer(1);
timerpos=getprogress();
preview.slider1.SetPos(timerpos);
if(timerpos >=100)
{
timerpos = 0;
preview.slider1.SetPos(0);
playstop();
preview.KillTimer(1);
}
var curtime=preview.player1.Player_GetCurrentTime();
preview.curplay.SetText(getstrtime(curtime));
}
function playstop()
{
preview.play111.SetImage("player-play.png");
preview.play111.SetEnable(true);
preview.playstop.SetEnable(false);
preview.play111.SetTipText(LanguageStr("_player_btn_tooltip_play"));
bjplay=0;
preview.player1.Player_Stop();
preview.menuofplay.SetEnable(true);
preview.menuofpause.SetEnable(false);
preview.menuofstop.SetEnable(false);
preview.menupopup.play.SetEnable(true);
preview.menupopup.pause.SetEnable(false);
preview.menupopup.stop.SetEnable(false);
preview.menuoffullscreen.SetEnable(false);
preview.slider1.SetPos(0);
preview.volume.SetEnable(false);
bjstop=1;
timer1=0;
if(bjfullscreen==1)
{
preview.menupopup.size.SetText(LanguageStr("_player_menu_fullscr"));
bjfullscreen=0;
}
}
function playpause()
{ // preview.play111.SetImage("player-play.png");
preview.player1.Player_Pause();
timer1=0;
}
function getprogress()
{
return preview.player1.Player_GetProgress();
}
function preview_close()
{
if(timer1==1)
{
timer=0;
preview.KillTimer(2);
}
if(m_bplayer==1)
{
preview.player1.Player_Stop();
m_bplayer=0;
}
preview.Close();
}
var mydlg=new JSMyFileDialog();
var playerpath="";
function showdir1()
{
var path=mydlg.showdir();
if(path=="")
return;
playerpath=path;
if(playerpath.substr(playerpath.length-4,4)!=".flv")
return;
if(playerpath!="")
{
bjplay=0;
preview.menuoffileinfo.SetEnable(true);
preview.player1.Player_SetFile(playerpath);
preview.menuoffullscreen.SetEnable(true);
play(playerpath);
}
else
{
return 1;
}
}
function getfileinfos(playerpath)
{
GetFileInfo(playerpath);
playerfileinfos.ShowModal();
}
function change(args)
{
var vol=args+20;
if(vol>100)
vol=100;
preview.player1.Player_SetVolume(vol);
}
function ondropme(args)
{
if(m_bplayer==1)
{preview.player1.Player_Stop(); }
playerpath=args[2];
preview.slider1.SetPos(0);
bjplay=0;
preview.player1.Player_SetFile(playerpath);
play(playerpath);
preview.menuoffullscreen.SetEnable(true);
preview.menuoffileinfo.SetEnable(true);
preview.menuofplay.SetEnable(false);
preview.menuofpause.SetEnable(true);
preview.menuofstop.SetEnable(true);
preview.menupopup.play.SetEnable(false);
preview.menupopup.pause.SetEnable(true);
preview.menupopup.stop.SetEnable(true);
}
function showpreview_about()
{
/* if (Product.IsValidateReg())
{
var reginfo = Product.GetRegInfo();
preview_about.username.SetText(reginfo[0]);
preview_about.RegTip.SetText(LanguageStr("_about__status_reg"));
}else
{
preview_about.RegTip.SetText(LanguageStr("_about__status_unreg"));
preview_about.username.SetText("");
}*/
preview_about.aboutplayer.SetText(LanguageStr("_flvmain_menu_about")+" "+"ImTOO Flv Player");
preview_about.ShowModal();
}
var bjvolume=0;
function openvolume()
{
if(bjvolume==0)
{
preview.player1.Player_SetMutex(1);
preview.volume.SetImage("mute.png");
bjvolume=1;
}
else
{
preview.player1.Player_SetMutex(0);
preview.volume.SetImage("volume.png");
bjvolume=0;
}
}
function rclick(args)
{
preview.menupopup.Popup();
}
var bjfullscreen=0;
function onsize()
{
if(bjfullscreen==0)
{
preview.player1.Player_ToggleToFullScreen();
preview.menuoffullscreen.SetEnable(false);
preview.menupopup.size.SetText(LanguageStr("_player_menu_normalsize"));
bjfullscreen=1;
}
else if(bjfullscreen==1)
{
preview.player1.Player_ToggleToFullScreen();
preview.menuoffullscreen.SetEnable(true);
preview.menupopup.size.SetText(LanguageStr("_player_menu_fullscr"));
bjfullscreen=0;
}
}
function doubleclick()
{
onsize();
}
function previw_help()
{
var urlstr = "Youtube Download.chm";
if(urlstr.length <= 0)
{
return 1;
}
GotoUrl(urlstr);
}
function changlanguage(langstr)
{
RefreshLanguage(langstr);
if(langstr=="Chinese(Simplified)")
{
preview.tools.language.english.SetCheck(false);
preview.tools.language.chinese.SetCheck(true);
preview.tools.language.german.SetCheck(false);
preview.tools.language.japanese.SetCheck(false);
}else if(langstr=="English")
{
preview.tools.language.english.SetCheck(true);
preview.tools.language.chinese.SetCheck(false);
preview.tools.language.german.SetCheck(false);
preview.tools.language.japanese.SetCheck(false);
}else if(langstr=="Deutsch")
{
preview.tools.language.english.SetCheck(false);
preview.tools.language.chinese.SetCheck(false);
preview.tools.language.german.SetCheck(true);
preview.tools.language.japanese.SetCheck(false);
}else
{
preview.tools.language.english.SetCheck(false);
preview.tools.language.chinese.SetCheck(false);
preview.tools.language.german.SetCheck(false);
preview.tools.language.japanese.SetCheck(true);
}
g_Config.SetValue("general","language",langstr);
}
function changskin(skinstr)
{
var pos=preview.v1.GetPos();
LoadSkin(skinstr);
if(skinstr=="newskin")
{preview.v1.SetPos(pos);
preview.tools.skin.newskin.SetCheck(true);
preview.tools.skin.greenskin.SetCheck(false);
}
else if(skinstr=="upod_green")
{preview.v1.SetPos(pos);
preview.tools.skin.newskin.SetCheck(false);
preview.tools.skin.greenskin.SetCheck(true);
}
g_Config.SetValue("general","skin",skinstr);
}
function changeenglish()
{
changlanguage("English");
g_Config.SetValue("general","language","English");
//if(help.Helper_IsConverterVisible())
// help.Helper_StartUpModule("ImTOO Download YouTube Video.exe","-language English");
}
function changechinese()
{
changlanguage("Chinese(Simplified)");
g_Config.SetValue("general","language","Chinese(Simplified)");
//if(help.Helper_IsConverterVisible())
// help.Helper_StartUpModule("ImTOO Download YouTube Video.exe","-language Chinese(Simplified)");
}
function changegerman()
{
changlanguage("Deutsch");
g_Config.SetValue("general","language","Deutsch");
//if(help.Helper_IsConverterVisible())
// help.Helper_StartUpModule("ImTOO Download YouTube Video.exe","-language Deutsch");
}
function changejapan()
{
changlanguage("Japanese");
g_Config.SetValue("general","language","Japanese");
//if(help.Helper_IsConverterVisible())
// help.Helper_StartUpModule("ImTOO Download YouTube Video.exe","-language Japanese");
}
function changenewskin()
{
changskin("newskin");
g_Config.SetValue("general","skin","newskin");
//if(help.Helper_IsConverterVisible())
// help.Helper_StartUpModule("ImTOO Download YouTube Video.exe","-skin newskin");
}
function changegreen()
{
changskin("upod_green");
g_Config.SetValue("general","skin","upod_green");
//if(help.Helper_IsConverterVisible())
//{
// help.Helper_StartUpModule("ImTOO Download YouTube Video.exe","-skin upod_green");
//}
}
LoadLib("MemoryShare.dll");
var MemoryShare = new JSMemoryShare();
MemoryShare.MemoryShare_Init();
function OnSyncSkin(args)
{
changskin(args[3]);
}
function OnSyncLanguage(args)
{
changlanguage(args[3]);
}
function OnPlayFile(args)
{
if(args[0]!=4)
return;
bjplay=0;
preview.player1.Player_SetFile(args[3]);
play(args[3]);
// play(playerpath);
preview.menuoffullscreen.SetEnable(true);
preview.menuoffileinfo.SetEnable(true);
preview.menuofplay.SetEnable(false);
preview.menuofpause.SetEnable(true);
preview.menuofstop.SetEnable(true);
preview.menupopup.play.SetEnable(false);
preview.menupopup.pause.SetEnable(true);
preview.menupopup.stop.SetEnable(true);
}