mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-15 08:56:21 +00:00
3 lines
2.7 KiB
JavaScript
3 lines
2.7 KiB
JavaScript
var render={lsKey:"render",configs:{al:{name:"ship waifu~",root:"render/al/",array:Array.apply(null,{length:38}).map((function(e,r){return("00"+(r+1)).slice(-3)+".png"}))},miku:{name:"miku ❤️~",root:"render/miku/",array:Array.apply(null,{length:50}).map((function(e,r){return("00"+(r+1)).slice(-3)+".png"}))}},config:null,selected:null,done:!1,showTogglePrompt:function(){var e=!("0"===localStorage[render.lsKey]),r=document.createElement("div");r.innerHTML='\n <div class="field">\n <div class="control">\n <label class="checkbox">\n <input id="swalRender" type="checkbox" '+(e?"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 ';var n={};e&&(n.reload={text:"Nah fam, show me a different render",className:"swal-button--cancel"}),n.confirm=!0,swal({content:r,buttons:n}).then((function(e){if("reload"===e)render.do(!0);else if(e){var n=r.querySelector("#swalRender").checked?void 0:"0";n!==localStorage[render.lsKey]&&(n?localStorage[render.lsKey]=n:localStorage.removeItem(render.lsKey),swal("","Random render is now "+(n?"disabled":"enabled")+".","success",{buttons:!1,timer:1500}),render.do())}}))},parseSelectedConfig:function(){var e=document.querySelector("#renderScript");if(e&&e.dataset.config)return e.dataset.config},parseVersion:function(){var e=document.querySelector("#renderScript");return e&&e.dataset.version?"?v="+e.dataset.version:""},do:function(e){if(render.done||(render.done=!0),render.config=render.configs[render.parseSelectedConfig()],render.config&&render.config.array.length){var r=document.querySelector("body > .render");r&&r.remove();var n;e||"0"!==localStorage[render.lsKey]?(void 0===render.version&&(render.version=render.parseVersion()),render.selected=render.config.array[Math.floor(Math.random()*render.config.array.length)],(n=document.createElement("img")).alt=n.title=render.config.name,n.className="is-hidden-mobile",n.src=""+render.config.root+render.selected+render.version):((n=document.createElement("a")).className="button is-info is-hidden-mobile",n.title=render.config.name,n.innerHTML='<i class="icon-picture"></i>'),n.classList.add("render"),n.addEventListener("click",render.showTogglePrompt),document.body.appendChild(n)}},onloaded:function(){"undefined"!=typeof page&&page.apiChecked&&!render.done&&render.do()}};"interactive"===document.readyState||"complete"===document.readyState?render.onloaded():window.addEventListener("DOMContentLoaded",(function(){return render.onloaded()}));
|
|
//# sourceMappingURL=render.js.map
|