MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

/* Music Queueable Soundfiles */

if (mw.config.get("wgPageName") == "Music") { function addtoqueue(event) { if (queuecheck(event.currentTarget)) { if (!queue[0] || queue[0].paused) { queue[0] = event.currentTarget; } else { queue.push(event.currentTarget); };			event.currentTarget.addEventListener("ended", nextinqueue); };		if (queue[0] != event.currentTarget) { event.currentTarget.pause; };	};	function nextinqueue { queue.shift; queue[0].play; };	function queuecheck(t) { for (var i=0; i<queue.length; i++) { if (queue[i] == t) { return false; };		};		return true; };

const trs = document.getElementsByTagName("audio"); for (var i=0; i<trs.length; i++) { trs[i].addEventListener("play", addtoqueue); };	var queue = []; };