用户:Krliov/pagemusic.js

来自PRTS
跳转到导航 跳转到搜索

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:Ctrl-F5
$().ready(function(){
	var a1 = document.createElement("audio");
	a1.volume = 0.5;
	a1.hidden = true;
	var aint = true,asub,alop;
	var aurl = "https://static.prts.wiki/music/music/";
	var pname = mw.config.get("wgPageName");
	//首页
	if(pname == "首页"){
		var alist = ['v007/m_sys/m_sys_cerberus','v008/m_bat_ccs1','static/m_avg/m_avg_exciting01','static/m_bat/m_bat_frostnovaevolution',
		'static/m_bat/m_bat_frostnovaevolutionhard','act5d0/m_avg_speedoflight','beta3_181101/m_bat_game02'];
        var asub1 = ['sys_void','bat_epic','bat_normal01','bat_normal02'];
		var asub2 = ["sys_title",'bat_normal03','sys_tech','bat_normalbattle','dia_nightoflongmen'];
		var asub3 = ["bat_fesedm","bat_fesmetal","bat_longmenbatboss","bat_volcano","sys_alive","sys_ddd","sys_emperor"];
		for(var i of asub1) alist.push("beta1_180603/m_"+i);
		for(var i2 of asub2) alist.push("beta2_180603/m_"+i2);
		for(var i3 of asub3) alist.push("obt/m_"+i3);
        asub = alist[Math.floor(Math.random()*alist.length)];
        console.log("已选中:"+asub);
    }
	//危机合约
	else if(pname.includes("危机合约")){
		a1.id = "audio_ccs_sys";
		switch(pname){
			case '危机合约/2019':
				asub = "static/m_sys/m_sys_ccs0";
				break;
			case '危机合约/荒芜行动':
				asub = "v008/m_sys_ccs1";
				break;
			case '危机合约/黄铁行动':
				asub = "act10d0d0/m_sys_ccs1_1_loop.mp3";
				aint = false;
				break;
			case '危机合约/利刃行动':
				asub = "act11d5d0/m_sys_ccs2.mp3";
				aint = false;
				break;
			case '危机合约/燃灰行动':
				asub = "act14d5d0/m_sys_ccs3";
				break;
			case '危机合约/铅封行动':
				asub = "act16d0d0/m_sys_ccs4";
				break;
			case '危机合约/光谱行动':
				asub = "act18d5d0/m_sys_ccs5";
				break;
			case '危机合约/蛮鳞行动':
				asub = "act6rune/sys_ccs6";
				break;
			case '危机合约/松烟行动':
				asub = "act7rune/sys_ccs7";
				break;
			case '危机合约/寻昼行动':
				asub = "act8rune/m_sys_ccs8";
				break;
			case '危机合约/渊默行动':
				asub = "act9rune/m_sys_ccs9";
				break;
			default:
				return;
		}
	}
	else return;
	if(document.getElementById("audio_ccs_sys")) return;
    alop = aint ? aurl + asub + "_loop.mp3" : aurl + asub;
	aint = aint ? aurl + asub + "_intro.mp3" : aint;
	if(aint === false){
		a1.src = alop;
		a1.loop = true;
	}
	else{
		a1.src = aint;
		a1.onended = function(){a1.src = alop;a1.loop = true;a1.play();};
	}
	a1.autoplay = true;
	$("HEAD").append(a1);
});