HummingBirdAnimeClient/public/js/scripts-authed.min.js

24 lines
9.9 KiB
JavaScript

var e=e||{};e.scope={};e.ASSUME_ES5=!1;e.ASSUME_NO_NATIVE_MAP=!1;e.ASSUME_NO_NATIVE_SET=!1;e.defineProperty=e.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,f,k){c!=Array.prototype&&c!=Object.prototype&&(c[f]=k.value)};e.getGlobal=function(c){return"undefined"!=typeof window&&window===c?c:"undefined"!=typeof global&&null!=global?global:c};e.global=e.getGlobal(this);e.SYMBOL_PREFIX="jscomp_symbol_";
e.initSymbol=function(){e.initSymbol=function(){};e.global.Symbol||(e.global.Symbol=e.Symbol)};e.Symbol=function(){var c=0;return function(f){return e.SYMBOL_PREFIX+(f||"")+c++}}();e.initSymbolIterator=function(){e.initSymbol();var c=e.global.Symbol.iterator;c||(c=e.global.Symbol.iterator=e.global.Symbol("iterator"));"function"!=typeof Array.prototype[c]&&e.defineProperty(Array.prototype,c,{configurable:!0,writable:!0,value:function(){return e.arrayIterator(this)}});e.initSymbolIterator=function(){}};
e.arrayIterator=function(c){var f=0;return e.iteratorPrototype(function(){return f<c.length?{done:!1,value:c[f++]}:{done:!0}})};e.iteratorPrototype=function(c){e.initSymbolIterator();c={next:c};c[e.global.Symbol.iterator]=function(){return this};return c};
e.iteratorFromArray=function(c,f){e.initSymbolIterator();c instanceof String&&(c+="");var k=0,g={next:function(){if(k<c.length){var m=k++;return{value:f(m,c[m]),done:!1}}g.next=function(){return{done:!0,value:void 0}};return g.next()}};g[Symbol.iterator]=function(){return g};return g};
e.polyfill=function(c,f){if(f){var k=e.global;c=c.split(".");for(var g=0;g<c.length-1;g++){var m=c[g];m in k||(k[m]={});k=k[m]}c=c[c.length-1];g=k[c];f=f(g);f!=g&&null!=f&&e.defineProperty(k,c,{configurable:!0,writable:!0,value:f})}};e.polyfill("Array.prototype.keys",function(c){return c?c:function(){return e.iteratorFromArray(this,function(c){return c})}},"es6","es3");e.owns=function(c,f){return Object.prototype.hasOwnProperty.call(c,f)};
e.assign="function"==typeof Object.assign?Object.assign:function(c,f){for(var k=1;k<arguments.length;k++){var g=arguments[k];if(g)for(var m in g)e.owns(g,m)&&(c[m]=g[m])}return c};e.polyfill("Object.assign",function(c){return c||e.assign},"es6","es3");
(function(){function c(a){b.$(".cssload-loader")[0].removeAttribute("hidden");b.get(b.url("/manga/search"),{query:a},function(a){a=JSON.parse(a);b.$(".cssload-loader")[0].setAttribute("hidden","hidden");b.$("#series_list")[0].innerHTML=n(a.data)})}function f(a){b.$(".cssload-loader")[0].removeAttribute("hidden");b.get(b.url("/anime-collection/search"),{query:a},function(a){a=JSON.parse(a);b.$(".cssload-loader")[0].setAttribute("hidden","hidden");b.$("#series_list")[0].innerHTML=p(a.data)})}function k(a,
b,d){b.match(/^([\w\-]+)$/)||b.split(" ").forEach(function(b){k(a,b,d)});a.addEventListener(b,d,!1)}function g(a,h,d,c){k(a,d,function(d){b.$(h,a).forEach(function(a){d.target==a&&(c.call(a,d),d.stopPropagation())})})}function m(a){var b=[];Object.keys(a).forEach(function(d){var h=a[d].toString();d=encodeURIComponent(d);h=encodeURIComponent(h);b.push(d+"\x3d"+h)});return b.join("\x26")}function p(a){var b=[];a.forEach(function(a){var d=a.attributes,h=d.titles.reduce(function(a,b){return a+(b+"\x3cbr /\x3e")},
[]);b.push('\n\t\t\t\x3carticle class\x3d"media search"\x3e\n\t\t\t\t\x3cdiv class\x3d"name"\x3e\n\t\t\t\t\t\x3cinput type\x3d"radio" class\x3d"big-check" id\x3d"'+d.slug+'" name\x3d"id" value\x3d"'+a.id+'" /\x3e\n\t\t\t\t\t\x3clabel for\x3d"'+d.slug+'"\x3e\n\t\t\t\t\t\t\x3cimg src\x3d"/public/images/anime/'+a.id+'.jpg" alt\x3d"" width\x3d"220" /\x3e\n\t\t\t\t\t\t\x3cspan class\x3d"name"\x3e\n\t\t\t\t\t\t\t'+d.canonicalTitle+"\x3cbr /\x3e\n\t\t\t\t\t\t\t\x3csmall\x3e"+h+'\x3c/small\x3e\n\t\t\t\t\t\t\x3c/span\x3e\n\t\t\t\t\t\x3c/label\x3e\n\t\t\t\t\x3c/div\x3e\n\t\t\t\t\x3cdiv class\x3d"table"\x3e\n\t\t\t\t\t\x3cdiv class\x3d"row"\x3e\n\t\t\t\t\t\t\x3cspan class\x3d"edit"\x3e\n\t\t\t\t\t\t\t\x3ca class\x3d"bracketed" href\x3d"/anime/details/'+
d.slug+'"\x3eInfo Page\x3c/a\x3e\n\t\t\t\t\t\t\x3c/span\x3e\n\t\t\t\t\t\x3c/div\x3e\n\t\t\t\t\x3c/div\x3e\n\t\t\t\x3c/article\x3e\n\t\t')});return b.join("")}function n(a){var b=[];a.forEach(function(a){var d=a.attributes,h=d.titles.reduce(function(a,b){return a+(b+"\x3cbr /\x3e")},[]);b.push('\n\t\t\t\x3carticle class\x3d"media search"\x3e\n\t\t\t\t\x3cdiv class\x3d"name"\x3e\n\t\t\t\t\t\x3cinput type\x3d"radio" class\x3d"big-check" id\x3d"'+d.slug+'" name\x3d"id" value\x3d"'+a.id+'" /\x3e\n\t\t\t\t\t\x3clabel for\x3d"'+
d.slug+'"\x3e\n\t\t\t\t\t\t\x3cimg src\x3d"/public/images/manga/'+a.id+'.jpg" alt\x3d"" width\x3d"220" /\x3e\n\t\t\t\t\t\t\x3cspan class\x3d"name"\x3e\n\t\t\t\t\t\t\t'+d.canonicalTitle+"\x3cbr /\x3e\n\t\t\t\t\t\t\t\x3csmall\x3e"+h+'\x3c/small\x3e\n\t\t\t\t\t\t\x3c/span\x3e\n\t\t\t\t\t\x3c/label\x3e\n\t\t\t\t\x3c/div\x3e\n\t\t\t\t\x3cdiv class\x3d"table"\x3e\n\t\t\t\t\t\x3cdiv class\x3d"row"\x3e\n\t\t\t\t\t\t\x3cspan class\x3d"edit"\x3e\n\t\t\t\t\t\t\t\x3ca class\x3d"bracketed" href\x3d"/manga/details/'+
d.slug+'"\x3eInfo Page\x3c/a\x3e\n\t\t\t\t\t\t\x3c/span\x3e\n\t\t\t\t\t\x3c/div\x3e\n\t\t\t\t\x3c/div\x3e\n\t\t\t\x3c/article\x3e\n\t\t')});return b.join("")}var b={noop:function(){},$:function(a,b){b=void 0===b?null:b;if("string"!==typeof a)return a;b=null!==b&&1===b.nodeType?b:document;var d=[];a.match(/^#([\w]+$)/)?d.push(document.getElementById(a.split("#")[1])):d=[].slice.apply(b.querySelectorAll(a));return d},hasElement:function(a){return 0<b.$(a).length},scrollToTop:function(){window.scroll(0,
0)},hide:function(a){a.setAttribute("hidden","hidden")},show:function(a){a.removeAttribute("hidden")},showMessage:function(a,h){a="\x3cdiv class\x3d'message "+a+"'\x3e\n\t\t\t\t\x3cspan class\x3d'icon'\x3e\x3c/span\x3e\n\t\t\t\t"+h+"\n\t\t\t\t\x3cspan class\x3d'close'\x3e\x3c/span\x3e\n\t\t\t\x3c/div\x3e";h=b.$(".message");void 0!==h[0]&&h[0].remove();b.$("header")[0].insertAdjacentHTML("beforeend",a)},closestParent:function(a,b){if(void 0!==Element.prototype.closest)return a.closest(b);for(;a!==
document.documentElement;){for(var d=a,c=(d.document||d.ownerDocument).querySelectorAll(b),h=c.length;0<=--h&&c.item(h)!==d;);if(-1<h)return a;a=a.parentElement}return null},url:function(a){var b="//"+document.location.host;return b+="/"===a.charAt(0)?a:"/"+a},throttle:function(b,c,d){var a=!1;return function(h){for(var f=[],l=0;l<arguments.length;++l)f[l-0]=arguments[l];l=d||this;a||(c.apply(l,f),a=!0,setTimeout(function(){a=!1},b))}},on:function(a,c,d,f){void 0===f?(f=d,b.$(a).forEach(function(a){k(a,
c,f)})):b.$(a).forEach(function(a){g(a,d,c,f)})},ajax:function(a,c){c=Object.assign({},{data:{},type:"GET",dataType:"",success:b.noop,mimeType:"application/x-www-form-urlencoded",error:b.noop},c);var d=new XMLHttpRequest,h=String(c.type).toUpperCase();"GET"===h&&(a+=a.match(/\?/)?m(c.data):"?"+m(c.data));d.open(h,a);d.onreadystatechange=function(){if(4===d.readyState){var a="json"===d.responseType?JSON.parse(d.responseText):d.responseText;299<d.status?c.error.call(null,d.status,a,d.response):c.success.call(null,
a,d.status)}};"json"===c.dataType?(c.data=JSON.stringify(c.data),c.mimeType="application/json"):c.data=m(c.data);d.setRequestHeader("Content-Type",c.mimeType);switch(h){case "GET":d.send(null);break;default:d.send(c.data)}},get:function(a,c,d){d=void 0===d?null:d;null===d&&(d=c,c={});return b.ajax(a,{data:c,success:d})}};b.on("header","click",".message",function(a){b.hide(a.target)});b.on("form.js-delete","submit",function(a){!1===confirm("Are you ABSOLUTELY SURE you want to delete this item?")&&
(a.preventDefault(),a.stopPropagation())});b.on(".js-clear-cache","click",function(){b.get("/cache_purge",function(){b.showMessage("success","Successfully purged api cache")})});"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").then(function(a){console.log("Service worker registered",a.scope)}).catch(function(a){console.error("Failed to register service worker",a)});if(b.hasElement(".anime #search"))b.on("#search","keyup",b.throttle(250,function(a){a=encodeURIComponent(a.target.value);
""!==a&&f(a)}));b.on("body.anime.list","click",".plus_one",function(a){var c=b.closestParent(a.target,"article"),d=parseInt(b.$(".completed_number",c)[0].textContent,10)||0;a=parseInt(b.$(".total_number",c)[0].textContent,10);var f=b.$(".name a",c)[0].textContent,l={id:c.dataset.kitsuId,mal_id:c.dataset.malId,data:{progress:d+1}};if(isNaN(d)||0===d)l.data.status="current";isNaN(d)||d+1!==a||(l.data.status="completed");b.show(b.$("#loading-shadow")[0]);b.ajax(b.url("/anime/increment"),{data:l,dataType:"json",
type:"POST",success:function(a){a=JSON.parse(a);a.errors?(b.hide(b.$("#loading-shadow")[0]),b.showMessage("error","Failed to update "+f+". ")):("completed"===a.data.attributes.status&&b.hide(c),b.hide(b.$("#loading-shadow")[0]),b.showMessage("success","Successfully updated "+f),b.$(".completed_number",c)[0].textContent=++d);b.scrollToTop()},error:function(){b.hide(b.$("#loading-shadow")[0]);b.showMessage("error","Failed to update "+f+". ");b.scrollToTop()}})});if(b.hasElement(".manga #search"))b.on("#search",
"keyup",b.throttle(250,function(a){a=encodeURIComponent(a.target.value);""!==a&&c(a)}));b.on(".manga.list","click",".edit_buttons button",function(a){var c=a.target,d=b.closestParent(a.target,"article"),f=c.classList.contains("plus_one_chapter")?"chapter":"volume",l=parseInt(b.$("."+f+"s_read",d)[0].textContent,10)||0;a=parseInt(b.$("."+f+"_count",d)[0].textContent,10);var k=b.$(".name",d)[0].textContent;isNaN(l)&&(l=0);var g={id:d.dataset.kitsuId,mal_id:d.dataset.malId,data:{progress:l}};if(isNaN(l)||
0===l)g.data.status="current";isNaN(l)||l+1!==a||(g.data.status="completed");g.data.progress=++l;b.show(b.$("#loading-shadow")[0]);b.ajax(b.url("/manga/update"),{data:g,dataType:"json",type:"POST",mimeType:"application/json",success:function(){"completed"===g.data.status&&b.hide(d);b.hide(b.$("#loading-shadow")[0]);b.$("."+f+"s_read",d)[0].textContent=l;b.showMessage("success","Successfully updated "+k);b.scrollToTop()},error:function(){b.hide(b.$("#loading-shadow")[0]);b.showMessage("error","Failed to update "+
k);b.scrollToTop()}})})})();
//# sourceMappingURL=scripts-authed.min.js.map