window.twirl = { debug: false, //window.location.href.startsWith("file://"), themes: ["Default", "Basic", "Hacker", "Monoclassic", "Doze"], audioTypes: ["audio/mpeg", "audio/mp4", "audio/ogg", "audio/vorbis", "audio/x-flac","audio/aiff","audio/x-aiff", "audio/vnd.wav", "audio/wave", "audio/x-wav", "audio/wav", "audio/flac"], maxFileSize: 1e+8, // 100MB latencyCorrection: 40, storage: {}, errorState: null, audioContext: null, _booted: false, _initialised: false, _remote: {sessionID: null, sending: false}, _els: { base: null, toolTip: null, prompt: {}, loading: {}, contextMenu: null } }; twirl.boot = function() { if (twirl._booted) return; twirl.audioContext = new AudioContext(); twirl._booted = true; }; twirl.init = function() { if (twirl._initialised) return; var NoteData = function() { var self = this; this.data = null; fetch("../twirl/notedata.json").then(function(r) { r.json().then(function(j) { self.data = j; }); }); }; twirl.noteData = new NoteData(); // storage twirl.storage.data = localStorage.getItem("twirl"); if (twirl.storage.data) { twirl.storage.data = JSON.parse(twirl.storage.data); } else { twirl.storage.data = {}; } // base twirl._els.base = $("
").attr("id", "twirl").appendTo($("body")); // tooltip twirl._els.toolTip = $("
").addClass("twirl_tooltip").appendTo(twirl._els.base); // context menu twirl._els.contextMenu = $("
").addClass("twirl_contextmenu").appendTo(twirl._els.base); // prompt var p = twirl._els.prompt; p.base = $("
").attr("id", "twirl_prompt").appendTo(twirl._els.base); $("
").attr("id", "twirl_prompt_background").appendTo(p.base); var promptInner = $("
").attr("id", "twirl_prompt_inner").appendTo(p.base); p.text = $("
").attr("id", "twirl_prompt_text").appendTo(promptInner); p.button = $("