// ysfactory Windows Media Player window v2(euc)
// Copyright 2006 (C) ysfactory
// last modified 2009.10.26
function yf_wmp_popup(){
if( typeof(yf_wmp_wnd)=="undefined" || typeof(yf_wmp_wnd.closed)=="undefined" || yf_wmp_wnd.closed ){
yf_wmp_wnd = window.open("","yf_wmp_wnd","width=400, height=390, resizable=yes status=yes");
if( typeof(yf_wmp_wnd.document.form)=="undefined" ){
yf_wmp_wnd.document.open();
yf_wmp_wnd.document.writeln('');
yf_wmp_wnd.document.writeln('');
yf_wmp_wnd.document.writeln('
');
yf_wmp_wnd.document.writeln('');
yf_wmp_wnd.document.writeln('ysfactory WMP window v2(euc)');
//==(Sub window script)==
yf_wmp_wnd.document.writeln('');
yf_wmp_player_event_script(); //Player Event Script
yf_wmp_wnd.document.writeln('');
yf_wmp_wnd.document.writeln('');
// yf_wmp_wnd.document.writeln('');
yf_wmp_wnd.document.writeln('');
yf_wmp_wnd.document.writeln('');
yf_wmp_wnd.document.writeln('');
yf_wmp_wnd.document.close();
yf_wmp_wnd.yf_wmp_cookie_load();
}
}
yf_wmp_wnd.focus();
}
function yf_wmp_play(name, file){
yf_wmp_popup();
yf_wmp_wnd.yf_wmp_play(name, file);
}
function yf_wmp_entry(name, file){
yf_wmp_popup();
yf_wmp_wnd.yf_wmp_entry(name, file);
}
//==Sub-window script==
function yf_wmp_subwindow_script(){
//Values
yf_wmp_wnd.document.write(
'var yf_wmp_list_max = 30;\n'
+ 'var yf_wmp_file_list = new Array();\n'
+ 'var yf_wmp_current_index = 0;\n'
+ 'var yf_wmp_direction = "stop";\n'
+ 'var yf_wmp_interrupt = false;\n'
+ 'var yf_wmp_last_state = 0;\n'
);
//Cookie save
yf_wmp_wnd.document.write(
'//Cookie save\n'
+ 'function yf_wmp_cookie_save(){\n'
+ 'var i, flist ="SongFileList=", nlist ="SongNameList=";\n'
+ 'if(!navigator.cookieEnabled){\n'
+ ' alert("クッキーが許可されていないと出来ません!");\n'
+ ' return;\n'
+ '}\n'
+ 'for(i=0; i0){\n'
+ ' flist += ",";\n'
+ ' nlist += ",";\n'
+ ' }\n'
+ ' flist += escape(yf_wmp_file_list[i]);\n'
+ ' if(i0){\n'
+ ' xDay.setFullYear( xDay.getFullYear() + 1 );\n'
+ '}else{\n'
+ ' xDay.setTime( xDay.getTime() - 1 );\n'
+ '}\n'
+ 'xDay = xDay.toGMTString();\n'
+ 'document.cookie = flist + "expires=" + xDay +";";\n'
+ 'document.cookie = nlist + "expires=" + xDay +";";\n'
//+ 'alert(document.cookie);\n'
+ '}\n'
);
//Cookie load
yf_wmp_wnd.document.write(
'//Cookie load\n'
+ 'function yf_wmp_cookie_load(){\n'
+ 'var i, source, keyword, value, flist, nlist;\n'
+ 'if(!navigator.cookieEnabled){\n'
+ ' return;\n'
+ '}\n'
+ 'source = document.cookie + ";";\n'
//+ 'alert(source);\n'
+ 'while( keyword = source.match(/SongFileList=|SongNameList=/) ){\n'
+ ' keyword = keyword[0];\n'
+ ' i = source.indexOf(keyword);\n'
+ ' source = source.substring(i+keyword.length);\n'
+ ' i = source.indexOf(";");\n'
+ ' value = source.substring(0,i);\n'
+ ' source = source.substring(i+1);\n'
+ ' switch(keyword){\n'
+ ' case "SongFileList=":\n'
+ ' flist = value.split(",");\n'
+ ' break;\n'
+ ' case "SongNameList=":\n'
+ ' nlist = value.split(",");\n'
+ ' break;\n'
+ ' }\n'
+ '}\n'
+ 'for( i=0; flist && i=yf_wmp_list_max){\n'
+ ' alert("これ以上登録できません");\n'
+ ' return;\n'
+ ' }\n'
+ ' document.form.yf_wmp_name_list[document.form.yf_wmp_name_list.length]\n'
+ ' = new Option(name);\n'
+ ' yf_wmp_file_list.push(file);\n'
+ '}\n'
);
//Next
yf_wmp_wnd.document.write(
'function yf_wmp_next(){\n'
+ ' if(yf_wmp_interrupt){\n'
+ ' }else switch(yf_wmp_direction){\n'
+ ' case "forward":\n'
+ ' yf_wmp_current_index++;\n'
+ ' if(yf_wmp_current_index>=yf_wmp_file_list.length){\n'
+ ' if(document.form.yf_wmp_repeat_mode[2].checked){ //all\n'
+ ' yf_wmp_current_index = 0;\n'
+ ' }else{\n'
+ ' document.form.yf_wmp_player.controls.stop();\n'
+ ' yf_wmp_direction = "stop";\n'
+ ' return;\n'
+ ' }\n'
+ ' }\n'
+ ' break;\n'
+ ' case "stop":\n'
+ ' if(yf_wmp_file_list.length<=0) return;\n'
+ ' if(document.form.yf_wmp_name_list.selectedIndex>=0){\n'
+ ' yf_wmp_current_index = document.form.yf_wmp_name_list.selectedIndex;\n'
+ ' }else{\n'
+ ' yf_wmp_current_index = 0;\n'
+ ' }\n'
+ ' break;\n'
+ ' }\n'
+ ' document.form.yf_wmp_title.value\n'
+ ' = document.form.yf_wmp_name_list[yf_wmp_current_index].text;\n'
+ ' document.form.yf_wmp_player.URL = yf_wmp_file_list[yf_wmp_current_index];\n'
+ ' document.form.yf_wmp_name_list.selectedIndex = yf_wmp_current_index;\n'
+ ' yf_wmp_direction = "forward";\n'
+ ' yf_wmp_interrupt = false;\n'
+ '}\n'
);
//Previos
yf_wmp_wnd.document.write(
'function yf_wmp_previos(){\n'
+ ' if(yf_wmp_interrupt){\n'
+ ' }else switch(yf_wmp_direction){\n'
+ ' case "back":\n'
+ ' if(yf_wmp_current_index>0){\n'
+ ' yf_wmp_current_index--;\n'
+ ' }else{\n'
+ ' if(document.form.yf_wmp_repeat_mode[2].checked){ //all\n'
+ ' yf_wmp_current_index = yf_wmp_file_list.length - 1;\n'
+ ' }else{\n'
+ ' document.form.yf_wmp_player.controls.stop();\n'
+ ' yf_wmp_direction = "stop";\n'
+ ' return;\n'
+ ' }\n'
+ ' }\n'
+ ' break;\n'
+ ' case "stop":\n'
+ ' if(yf_wmp_file_list.length<=0) return;\n'
+ ' if(document.form.yf_wmp_name_list.selectedIndex>=0){\n'
+ ' yf_wmp_current_index = document.form.yf_wmp_name_list.selectedIndex;\n'
+ ' }else{\n'
+ ' yf_wmp_current_index = yf_wmp_file_list.length -1;\n'
+ ' }\n'
+ ' break;\n'
+ ' }\n'
+ ' document.form.yf_wmp_title.value\n'
+ ' = document.form.yf_wmp_name_list[yf_wmp_current_index].text;\n'
+ ' document.form.yf_wmp_player.URL = yf_wmp_file_list[yf_wmp_current_index];\n'
+ ' document.form.yf_wmp_name_list.selectedIndex = yf_wmp_current_index;\n'
+ ' yf_wmp_direction = "back";\n'
+ ' yf_wmp_interrupt = false;\n'
+ '}\n'
);
//Jump
yf_wmp_wnd.document.write(
'function yf_wmp_jump(){\n'
+ ' yf_wmp_current_index = document.form.yf_wmp_name_list.selectedIndex;\n'
+ ' document.form.yf_wmp_title.value\n'
+ ' = document.form.yf_wmp_name_list[yf_wmp_current_index].text;\n'
+ ' document.form.yf_wmp_player.URL = yf_wmp_file_list[yf_wmp_current_index];\n'
+ '}\n'
);
//Stop
yf_wmp_wnd.document.write(
'function yf_wmp_stop(){\n'
+ ' document.form.yf_wmp_player.controls.stop();\n'
+ ' yf_wmp_direction = "stop";\n'
+ '}\n'
);
//List-up
yf_wmp_wnd.document.write(
'function yf_wmp_list_up(){\n'
+ ' var i;\n'
+ ' if( (i=document.form.yf_wmp_name_list.selectedIndex)<=0 ) return;\n'
+ ' var name = document.form.yf_wmp_name_list[i-1].text;\n'
+ ' var file = yf_wmp_file_list[i-1];\n'
+ ' document.form.yf_wmp_name_list[i-1].text = document.form.yf_wmp_name_list[i].text;\n'
+ ' yf_wmp_file_list[i-1] = yf_wmp_file_list[i];\n'
+ ' document.form.yf_wmp_name_list[i].text = name;\n'
+ ' yf_wmp_file_list[i] = file;\n'
+ ' document.form.yf_wmp_name_list.selectedIndex = i-1;\n'
+ '}\n'
);
//List-down
yf_wmp_wnd.document.write(
'function yf_wmp_list_down(){\n'
+ ' var i;\n'
+ ' if( (i=document.form.yf_wmp_name_list.selectedIndex)<0\n'
+ ' || i>=document.form.yf_wmp_name_list.length-1 ) return;\n'
+ ' var name = document.form.yf_wmp_name_list[i+1].text;\n'
+ ' var file = yf_wmp_file_list[i+1];\n'
+ ' document.form.yf_wmp_name_list[i+1].text = document.form.yf_wmp_name_list[i].text;\n'
+ ' yf_wmp_file_list[i+1] = yf_wmp_file_list[i];\n'
+ ' document.form.yf_wmp_name_list[i].text = name;\n'
+ ' yf_wmp_file_list[i] = file;\n'
+ ' document.form.yf_wmp_name_list.selectedIndex = i+1;\n'
+ '}\n'
);
//List-delete
yf_wmp_wnd.document.write(
'function yf_wmp_list_delete(){\n'
+ ' var i;\n'
+ ' if( (i=document.form.yf_wmp_name_list.selectedIndex)<0 ) return;\n'
+ ' document.form.yf_wmp_name_list.options[i] = null;\n'
+ ' var j = i;\n'
+ ' for( ; j<=yf_wmp_file_list.length-1; j++){\n'
+ ' yf_wmp_file_list[j] = yf_wmp_file_list[j+1];\n'
+ ' }\n'
+ ' yf_wmp_file_list.pop();\n'
+ ' if( i\n'
+ 'if(yf_wmp_last_state==8 && NewState==9){ //MediaEnded -> Transitioning\n'
+ ' if(document.form.yf_wmp_repeat_mode[1].checked ){ //single\n'
+ ' document.form.yf_wmp_player.URL = document.form.yf_wmp_player.URL;\n'
+ ' }else switch(yf_wmp_direction){\n'
+ ' case "forward":\n'
+ ' yf_wmp_next();\n'
+ ' break;\n'
+ ' case "back":\n'
+ ' yf_wmp_previos();\n'
+ ' break;\n'
+ ' }\n'
+ '}\n'
+ 'if(NewState==1){ //Stopped\n'
+ ' yf_wmp_direction = "stop";\n'
+ ' yf_wmp_interrupt = false;\n'
+ '}\n'
+ 'yf_wmp_last_state = NewState;\n'
+ '\n'
);
}