mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-15 17:06:22 +00:00
1 line
7.5 KiB
Plaintext
1 line
7.5 KiB
Plaintext
{"version":3,"sources":["render.js"],"names":["const","render","lsKey","type","configs","al","name","root","array","miku","config","selected","done","i","push","slice","showTogglePrompt","renderEnabled","localStorage","div","document","createElement","innerHTML","buttons","reload","text","className","confirm","swal","content","then","value","do","newValue","querySelector","checked","undefined","removeItem","timer","parseVersion","renderScript","dataset","version","length","previousElement","remove","element","Math","floor","random","alt","title","src","classList","add","addEventListener","body","appendChild","onloaded","page","apiChecked","readyState","window"],"mappings":"AA8DA,IA5DAA,IAAMC,OAAS,CACbC,MAAO,SACPC,KAAM,OACNC,QAAS,CACPC,GAAI,CACFC,KAAM,cACNC,KAAM,aACNC,MAAO,CACL,0BACA,uBACA,cACA,eACA,eACA,cACA,cACA,cACA,cACA,gBACA,gBACA,oBACA,mBACA,iBACA,gBACA,gBACA,gBACA,kBACA,aACA,aACA,aACA,eACA,eACA,eACA,oBACA,kBACA,cACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,kBACA,kBACA,kBACA,mBAGJC,KAAM,CACJH,KAAM,WACNC,KAAM,eACNC,MAAO,KAGXE,OAAQ,KACRC,SAAU,KACVC,MAAM,GAICC,EAAI,EAAGA,GAAK,GAAIA,IAAKZ,OAAOG,QAAQK,KAAKD,MAAMM,MAAS,KAAOD,GAAGE,OAAO,GAAE,QAEpFd,OAAOe,iBAAgB,WACrBhB,IAAMiB,IAAiD,MAA/BC,aAAajB,OAAOC,QACtCiB,EAAMC,SAASC,cAAc,OACnCF,EAAIG,UAAY,+IAIiCL,EAAgB,UAAY,IAAE,wCAC7ChB,OAAOS,OAAO,KAAI,kMAOpDV,IAAMuB,EAAU,GACZN,IACFM,EAAQC,OAAS,CACfC,KAAM,sCACNC,UAAW,wBAGfH,EAAQI,SAAU,EAElBC,KAAK,CACHC,QAASV,EATTI,QAUAA,IACCO,MAAI,SAACC,GACN,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Oe,kBACzCI,SAASoC,KAAKC,YAAYX,KAG5B7C,OAAOyD,SAAQ,WAGO,oBAATC,MAAwBA,KAAKC,aAAe3D,OAAOW,MAC5DX,OAAO+B,MAIiB,gBAAxBZ,SAASyC,YAAwD,aAAxBzC,SAASyC,WACpD5D,OAAOyD,WAEPI,OAAOP,iBAAiB,oBAAkB,WAAK,OAAGtD,OAAOyD","file":"render.js","sourcesContent":["/* global page, swal */\n\nconst render = {\n lsKey: 'render',\n type: 'miku', // This is intended to be hard-coded\n configs: {\n al: {\n name: 'ship waifu~',\n root: 'render/al/',\n array: [\n 'admiral_graf_spee_1.png',\n 'admiral_hipper_1.png',\n 'akagi_1.png',\n 'akashi_1.png',\n 'akashi_2.png',\n 'atago_1.png',\n 'atago_3.png',\n 'atago_4.png',\n 'atago_5.png',\n 'belfast_2.png',\n 'choukai_1.png',\n 'deutschland_1.png',\n 'enterprise_1.png',\n 'glorious_1.png',\n 'hammann_1.png',\n 'hammann_2.png',\n 'hammann_3.png',\n 'hatsuharu_1.png',\n 'kaga_1.png',\n 'kaga_2.png',\n 'kaga_3.png',\n 'laffey_1.png',\n 'laffey_2.png',\n 'laffey_3.png',\n 'prinz_eugen_3.png',\n 'san_diego_1.png',\n 'takao_3.png',\n 'unicorn_1.png',\n 'unicorn_2.png',\n 'unicorn_3.png',\n 'unicorn_4.png',\n 'unicorn_6.png',\n 'unicorn_7.png',\n 'unicorn_8.png',\n 'yamashiro_1.png',\n 'yamashiro_2.png',\n 'yamashiro_3.png',\n 'yukikaze_1.png'\n ]\n },\n miku: {\n name: 'miku ❤️~',\n root: 'render/miku/',\n array: []\n }\n },\n config: null,\n selected: null,\n done: false\n}\n\n// miku: Generate an array of file names from 001.png to 050.png\nfor (let i = 1; i <= 50; i++) render.configs.miku.array.push(`${('00' + i).slice(-3)}.png`)\n\nrender.showTogglePrompt = () => {\n const renderEnabled = !(localStorage[render.lsKey] === '0')\n const div = document.createElement('div')\n div.innerHTML = `\n <div class=\"field\">\n <div class=\"control\">\n <label class=\"checkbox\">\n <input id=\"swalRender\" type=\"checkbox\" ${renderEnabled ? 'checked' : ''}>\n Enable random render of ${render.config.name}\n </label>\n </div>\n <p class=\"help\">If disabled, you will still be able to see a small button on the bottom right corner of the screen to re-enable it.</p>\n </div>\n `\n\n const buttons = {}\n if (renderEnabled) {\n buttons.reload = {\n text: 'Nah fam, show me a different render',\n className: 'swal-button--cancel'\n }\n }\n buttons.confirm = true\n\n swal({\n content: div,\n buttons\n }).then(value => {\n if (value === 'reload') {\n render.do(true)\n } else if (value) {\n const newValue = div.querySelector('#swalRender').checked ? undefined : '0'\n if (newValue !== localStorage[render.lsKey]) {\n if (newValue) localStorage[render.lsKey] = newValue\n else localStorage.removeItem(render.lsKey)\n swal('', `Random render is now ${newValue ? 'disabled' : 'enabled'}.`, 'success', {\n buttons: false,\n timer: 1500\n })\n render.do()\n }\n }\n })\n}\n\nrender.parseVersion = () => {\n const renderScript = document.querySelector('#renderScript')\n if (renderScript && renderScript.dataset.version) return `?v=${renderScript.dataset.version}`\n else return ''\n}\n\nrender.do = reload => {\n if (!render.done) render.done = true\n\n render.config = render.configs[render.type]\n if (!render.config || !render.config.array.length) return\n\n const previousElement = document.querySelector('body > .render')\n if (previousElement) previousElement.remove()\n\n const doRender = () => {\n if (render.version === undefined) {\n render.version = render.parseVersion()\n }\n\n // Let us just allow people to get new render when toggling the option\n render.selected = render.config.array[Math.floor(Math.random() * render.config.array.length)]\n element = document.createElement('img')\n element.alt = element.title = render.config.name\n element.className = 'is-hidden-mobile'\n element.src = `${render.config.root}${render.selected}${render.version}`\n }\n\n let element\n if (!reload && localStorage[render.lsKey] === '0') {\n element = document.createElement('a')\n element.className = 'button is-info is-hidden-mobile'\n element.title = render.config.name\n element.innerHTML = '<i class=\"icon-picture\"></i>'\n } else {\n doRender()\n }\n\n element.classList.add('render')\n element.addEventListener('click', render.showTogglePrompt)\n document.body.appendChild(element)\n}\n\nrender.onloaded = () => {\n // If the main script had already done its API check, yet render haven't been triggered, do it\n // This would only happen if this render script only gets loaded after the main script's API check\n if (typeof page !== 'undefined' && page.apiChecked && !render.done) {\n render.do()\n }\n}\n\nif (document.readyState === 'interactive' || document.readyState === 'complete') {\n render.onloaded()\n} else {\n window.addEventListener('DOMContentLoaded', () => render.onloaded())\n}\n"]} |