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

21 lines
8.9 KiB
JavaScript
Raw Normal View History

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,g,l){c!=Array.prototype&&c!=Object.prototype&&(c[g]=l.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(g){return e.SYMBOL_PREFIX+(g||"")+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 g=0;return e.iteratorPrototype(function(){return g<c.length?{done:!1,value:c[g++]}:{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,g){e.initSymbolIterator();c instanceof String&&(c+="");var l=0,h={next:function(){if(l<c.length){var m=l++;return{value:g(m,c[m]),done:!1}}h.next=function(){return{done:!0,value:void 0}};return h.next()}};h[Symbol.iterator]=function(){return h};return h};
e.polyfill=function(c,g){if(g){var l=e.global;c=c.split(".");for(var h=0;h<c.length-1;h++){var m=c[h];m in l||(l[m]={});l=l[m]}c=c[c.length-1];h=l[c];g=g(h);g!=h&&null!=g&&e.defineProperty(l,c,{configurable:!0,writable:!0,value:g})}};e.polyfill("Array.prototype.keys",function(c){return c?c:function(){return e.iteratorFromArray(this,function(c){return c})}},"es6","es3");
(function(){function c(d){a.$(".cssload-loader")[0].removeAttribute("hidden");a.get(a.url("/manga/search"),{query:d},function(b){b=JSON.parse(b);a.$(".cssload-loader")[0].setAttribute("hidden","hidden");a.$("#series_list")[0].innerHTML=n(b.data)})}function g(d){a.$(".cssload-loader")[0].removeAttribute("hidden");a.get(a.url("/anime-collection/search"),{query:d},function(b){b=JSON.parse(b);a.$(".cssload-loader")[0].setAttribute("hidden","hidden");a.$("#series_list")[0].innerHTML=p(b.data)})}function l(a,
b,f){b.match(/^([\w\-]+)$/)||b.split(" ").forEach(function(b){l(a,b,f)});a.addEventListener(b,f,!1)}function h(d,b,f,c){l(d,f,function(f){a.$(b,d).forEach(function(b){f.target==b&&(c.call(b,f),f.stopPropagation())})})}function m(a){var b=[];Object.keys(a).forEach(function(f){var d=a[f].toString();f=encodeURIComponent(f);d=encodeURIComponent(d);b.push(f+"\x3d"+d)});return b.join("\x26")}function p(a){var b=[];a.forEach(function(a){var d=a.attributes,f=d.titles.reduce(function(b,a){return b+(a+"\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"+f+"\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\x3c/article\x3e\n\t\t")});
return b.join("")}function n(a){var b=[];a.forEach(function(a){var d=a.attributes,f=d.titles.reduce(function(b,a){return b+(a+"\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"+f+"\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\x3c/article\x3e\n\t\t")});return b.join("")}var a={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(d){return 0<a.$(d).length},
scrollToTop:function(){window.scroll(0,0)},hide:function(a){a.setAttribute("hidden","hidden")},show:function(a){a.removeAttribute("hidden")},showMessage:function(d,b){d="\x3cdiv class\x3d'message "+d+"'\x3e\n\t\t\t\t\x3cspan class\x3d'icon'\x3e\x3c/span\x3e\n\t\t\t\t"+b+"\n\t\t\t\t\x3cspan class\x3d'close'\x3e\x3c/span\x3e\n\t\t\t\x3c/div\x3e";b=a.$(".message");void 0!==b[0]&&b[0].remove();a.$("header")[0].insertAdjacentHTML("beforeend",d)},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),k=c.length;0<=--k&&c.item(k)!==d;);if(-1<k)return a;a=a.parentElement}return null},url:function(a){var b="//"+document.location.host;return b+="/"===a.charAt(0)?a:"/"+a},throttle:function(a,b,f){var d=!1;return function(c){for(var k=[],g=0;g<arguments.length;++g)k[g-0]=arguments[g];g=f||this;d||(b.apply(g,k),d=!0,setTimeout(function(){d=!1},a))}},on:function(d,b,f,c){3===arguments.length?(c=f,a.$(d).forEach(function(a){l(a,
b,c)})):a.$(d).forEach(function(a){h(a,f,b,c)})},ajax:function(d,b){b=b||{};b.data=b.data||{};b.type=b.type||"GET";b.dataType=b.dataType||"";b.success=b.success||a.noop;b.mimeType=b.mimeType||"application/x-www-form-urlencoded";b.error=b.error||a.noop;var f=new XMLHttpRequest,c=String(b.type).toUpperCase();"GET"===c&&(d+=d.match(/\?/)?m(b.data):"?"+m(b.data));f.open(c,d);f.onreadystatechange=function(){if(4===f.readyState){var a="json"===f.responseType?JSON.parse(f.responseText):f.responseText;299<
f.status?b.error.call(null,f.status,a,f.response):b.success.call(null,a,f.status)}};"json"===b.dataType?(b.data=JSON.stringify(b.data),b.mimeType="application/json"):b.data=m(b.data);f.setRequestHeader("Content-Type",b.mimeType);switch(c){case "GET":f.send(null);break;default:f.send(b.data)}},get:function(d,b,c){c=void 0===c?null:c;null===c&&(c=b,b={});return a.ajax(d,{data:b,success:c})}};a.on("header","click",".message",function(){a.hide(this)});a.on("form.js-delete","submit",function(a){!1===confirm("Are you ABSOLUTELY SURE you want to delete this item?")&&
(a.preventDefault(),a.stopPropagation())});a.on(".js-clear-cache","click",function(){a.get("/cache_purge",function(){a.showMessage("success","Successfully purged api cache")})});if(a.hasElement(".anime #search"))a.on("#search","keyup",a.throttle(250,function(){var a=encodeURIComponent(this.value);""!==a&&g(a)}));a.on("body.anime.list","click",".plus_one",function(c){var b=a.closestParent(c.target,"article"),d=parseInt(a.$(".completed_number",b)[0].textContent,10)||0;c=parseInt(a.$(".total_number",
b)[0].textContent,10);var g=a.$(".name a",b)[0].textContent,k={id:b.dataset.kitsuId,mal_id:b.dataset.malId,data:{progress:d+1}};if(isNaN(d)||0===d)k.data.status="current";isNaN(d)||d+1!==c||(k.data.status="completed");a.show(a.$("#loading-shadow")[0]);a.ajax(a.url("/anime/update"),{data:k,dataType:"json",type:"POST",success:function(c){c=JSON.parse(c);c.errors?(a.hide(a.$("#loading-shadow")[0]),a.showMessage("error","Failed to update "+g+". ")):("completed"===c.data.attributes.status&&a.hide(b),a.hide(a.$("#loading-shadow")[0]),
a.showMessage("success","Successfully updated "+g),a.$(".completed_number",b)[0].textContent=++d);a.scrollToTop()},error:function(){a.hide(a.$("#loading-shadow")[0]);a.showMessage("error","Failed to update "+g+". ");a.scrollToTop()}})});if(a.hasElement(".manga #search"))a.on("#search","keyup",a.throttle(250,function(){var a=encodeURIComponent(this.value);""!==a&&c(a)}));a.on(".manga.list","click",".edit_buttons button",function(c){var b=c.target,d=a.closestParent(c.target,"article"),g=b.classList.contains("plus_one_chapter")?
"chapter":"volume",k=parseInt(a.$("."+g+"s_read",d)[0].textContent,10)||0;c=parseInt(a.$("."+g+"_count",d)[0].textContent,10);var l=a.$(".name",d)[0].textContent;isNaN(k)&&(k=0);var h={id:d.dataset.kitsuId,mal_id:d.dataset.malId,data:{progress:k}};if(isNaN(k)||0===k)h.data.status="current";isNaN(k)||k+1!==c||(h.data.status="completed");h.data.progress=++k;a.show(a.$("#loading-shadow")[0]);a.ajax(a.url("/manga/update"),{data:h,dataType:"json",type:"POST",mimeType:"application/json",success:function(){"completed"===
h.data.status&&a.hide(d);a.hide(a.$("#loading-shadow")[0]);a.$("."+g+"s_read",d)[0].textContent=k;a.showMessage("success","Sucessfully updated "+l);a.scrollToTop()},error:function(){a.hide(a.$("#loading-shadow")[0]);a.showMessage("error","Failed to update "+l);a.scrollToTop()}})})})();
//# sourceMappingURL=scripts-authed.min.js.map