/*!
* @file Planeptune Loop Player Core Loader
* @version 1.3
* @author zefie <zefie@zefie.net>
* @copyright 2017-2021 Zefie Networks
* @license CC-BY-SA-4.0
*
* Minified using uglify-js v3.x
* For human readable version of the loader, see https://loops.planeptune.org/geshi/source/js/loader.js
* For human readable version of the loop player core, see https://loops.planeptune.org/geshi/source/js/loopplayer.html5.core.js
*/
var z_urlp;
var dm;
var offline = false;
(function () {
"use strict";
z_urlp = function (sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)).replace(/\+/g,' '),
sURLVariables = sPageURL.split("&"),
sParameterName;
for (var i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split("=");
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
function is_nwjs(){
try{
return (typeof require('nw.gui') !== "undefined");
} catch (e){
return false;
}
}
function loadScriptWithIntegrity(url, integrity, successCallback, errorCallback) {
const script = document.createElement('script');
script.src = url;
script.integrity = integrity;
script.crossOrigin = 'anonymous'; // Required for SRI to work
script.onload = successCallback;
script.onerror = errorCallback;
document.head.appendChild(script);
}
$(document).ready(function () {
console.log("loopplayer loader v1.3 initializing");
dm = z_urlp("debug") || null;
offline = is_nwjs();
var offlinescript = "/source/js/offline.js";
var offlinehash = "~OFFLINEHASH~"
var corescript = "/core/js/loopplayer.html5.core.min.js";
var corehash = "~COREHASH~"
var howlscript = "/core/js/howler.min.js";
var howlhash = "~HOWLHASH~"
var caching = true;
var cachingAfter = true;
if (dm) {
switch (dm) {
case "core":
corescript = "/source/js/loopplayer.html5.core.js";
corehash = "~CORESRCHASH~"
break;
case "howler":
corescript = "/source/js/loopplayer.html5.core.js";
corehash = "~CORESRCHASH~"
howlscript = "/source/js/howler.js";
howlhash = "~HOWLSRCHASH~"
break;
}
caching = false;
}
$.ajaxSetup({
cache: caching
});
if (offline) {
loadScriptWithIntegrity(offlinescript, offlinehash, function () {
loadScriptWithIntegrity(howlscript, howlhash, function (s) {
if (s) {
loadScriptWithIntegrity(corescript, corehash, function () {
$.ajaxSetup({
cache: cachingAfter
});
});
}
});
});
} else {
loadScriptWithIntegrity(howlscript, howlhash, function (s) {
if (s) {
loadScriptWithIntegrity(corescript, corehash, function () {
$.ajaxSetup({
cache: cachingAfter
});
});
}
});
};
});
/*
if (offline) {
loadScript(offlinescript, function () {
loadScript(howlscript, function (s) {
if (s) {
loadScript(corescript, function () {
$.ajaxSetup({
cache: cachingAfter
});
});
}
});
});
} else {
loadScript(howlscript, function (s) {
if (s) {
loadScript(corescript, function () {
$.ajaxSetup({
cache: cachingAfter
});
});
}
});
};
});
*/
})();