filesafe/dist/js/misc/render.js.map
Bobby Wibowo e10ce7807f
Updated
Auto-close some Sweetalert success dialogs after 1.5s.

Fixed edit user not displaying user's new username properly.

Disabled eslint-plugin-compat on some lines that won't work in
Safari 5.1.
Optionally look into not supporting the browser altogether.

Bumped v1 version string.
2019-10-29 19:39:44 +07:00

1 line
5.9 KiB
Plaintext

{"version":3,"sources":["render.js"],"names":["lsKeys","render","page","renderType","renderConfig","al","name","root","array","miku","let","i","push","slice","config","doRenderSwal","const","div","document","createElement","innerHTML","localStorage","swal","content","buttons","confirm","then","value","newValue","querySelector","checked","undefined","removeItem","timer","remove","doRender","getRenderVersion","renderScript","dataset","version","element","length","className","title","Math","floor","random","alt","src","classList","add","addEventListener","body","appendChild"],"mappings":"AAGAA,OAAOC,OAAS,SAEhBC,KAAKC,WAAa,OAClBD,KAAKE,aAAe,CAClBC,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,KAKX,IAAKE,IAAIC,EAAI,EAAGA,GAAK,GAAIA,IACvBT,KAAKE,aAAaK,KAAKD,MAAMI,MAAS,KAAOD,GAAGE,OAAO,GAAE,QAE3DX,KAAKY,OAAS,KACdZ,KAAKD,OAAS,KAEdC,KAAKa,aAAY,WACfC,IAAMC,EAAMC,SAASC,cAAc,OACnCF,EAAIG,UAAY,+IAIiE,MAAhCC,aAAarB,OAAOC,QAAkB,GAAK,WAAS,wCACnEC,KAAKY,OAAO,KAAI,kMAOlDQ,KAAK,CACHC,QAASN,EACTO,QAAS,CACPC,SAAS,KAEVC,MAAI,SAACC,GACN,GAAKA,EAAL,CACAX,IAAMY,EAAWX,EAAIY,cAAc,eAAeC,aAAUC,EAAY,IACxE,GAAIH,IAAaP,aAAarB,OAAOC,QAC/B2B,EACFP,aAAarB,OAAOC,QAAU2B,EAE9BP,aAAaW,WAAWhC,OAAOC,QACjCqB,KAAK,GAAI,yBAAwBM,EAAW,WAAa,WAAS,IAAK,UAAW,CAChFJ,SAAS,EACTS,MAAO,OAEOf,SAASW,cAAc,kBAC/BK,SACRhC,KAAKiC,gBAKXjC,KAAKkC,iBAAgB,WACnBpB,IAAMqB,EAAenB,SAASW,cAAc,iBAC5C,OAAIQ,GAAgBA,EAAaC,QAAQC,QAChC,MAAMF,EAAaC,QAAe,QACpC,IAGTpC,KAAKiC,SAAQ,WAIXzB,IAAI8B,GAHJtC,KAAKY,OAASZ,KAAKE,aAAaF,KAAKC,YAChCD,KAAKY,QAAWZ,KAAKY,OAAON,MAAMiC,UAGH,MAAhCpB,aAAarB,OAAOC,UACtBuC,EAAUtB,SAASC,cAAc,MACzBuB,UAAY,kCACpBF,EAAQG,MAAQzC,KAAKY,OAAOR,KAC5BkC,EAAQpB,UAAY,iCAGpBlB,KAAKD,OAASC,KAAKY,OAAON,MAAMoC,KAAKC,MAAMD,KAAKE,SAAW5C,KAAKY,OAAON,MAAMiC,UAC7ED,EAAUtB,SAASC,cAAc,QACzB4B,IAAMP,EAAQG,MAAQzC,KAAKY,OAAOR,KAC1CkC,EAAQE,UAAY,mBACpBF,EAAQQ,IAAM,GAAG9C,KAAKY,OAAW,KAAGZ,KAAW,OAAGA,KAAKkC,oBAGzDI,EAAQS,UAAUC,IAAI,UACtBV,EAAQW,iBAAiB,QAASjD,KAAKa,cACvCG,SAASkC,KAAKC,YAAYb","file":"render.js","sourcesContent":["/* global lsKeys, page, swal */\n\n// keys for localStorage\nlsKeys.render = 'render'\n\npage.renderType = 'miku'\npage.renderConfig = {\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\n// miku: Generate an array of file names from 001.png to 050.png\nfor (let i = 1; i <= 50; i++)\n page.renderConfig.miku.array.push(`${('00' + i).slice(-3)}.png`)\n\npage.config = null\npage.render = null\n\npage.doRenderSwal = () => {\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\" ${localStorage[lsKeys.render] === '0' ? '' : 'checked'}>\n Enable random render of ${page.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 swal({\n content: div,\n buttons: {\n confirm: true\n }\n }).then(value => {\n if (!value) return\n const newValue = div.querySelector('#swalRender').checked ? undefined : '0'\n if (newValue !== localStorage[lsKeys.render]) {\n if (newValue)\n localStorage[lsKeys.render] = newValue\n else\n localStorage.removeItem(lsKeys.render)\n swal('', `Random render is now ${newValue ? 'disabled' : 'enabled'}.`, 'success', {\n buttons: false,\n timer: 1500\n })\n const element = document.querySelector('body > .render')\n element.remove()\n page.doRender()\n }\n })\n}\n\npage.getRenderVersion = () => {\n const renderScript = document.querySelector('#renderScript')\n if (renderScript && renderScript.dataset.version)\n return `?v=${renderScript.dataset.version}`\n return ''\n}\n\npage.doRender = () => {\n page.config = page.renderConfig[page.renderType]\n if (!page.config || !page.config.array.length) return\n\n let element\n if (localStorage[lsKeys.render] === '0') {\n element = document.createElement('a')\n element.className = 'button is-info is-hidden-mobile'\n element.title = page.config.name\n element.innerHTML = '<i class=\"icon-picture\"></i>'\n } else {\n // Let us just allow people to get new render when toggling the option\n page.render = page.config.array[Math.floor(Math.random() * page.config.array.length)]\n element = document.createElement('img')\n element.alt = element.title = page.config.name\n element.className = 'is-hidden-mobile'\n element.src = `${page.config.root}${page.render}${page.getRenderVersion()}`\n }\n\n element.classList.add('render')\n element.addEventListener('click', page.doRenderSwal)\n document.body.appendChild(element)\n}\n"]}