23 lines
9.7 KiB
JavaScript
23 lines
9.7 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");
|
|
(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 f(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 k(d,
|
|
b,a){b.match(/^([\w\-]+)$/)||b.split(" ").forEach(function(b){k(d,b,a)});d.addEventListener(b,a,!1)}function g(d,b,l,c){k(d,l,function(l){a.$(b,d).forEach(function(b){l.target==b&&(c.call(b,l),l.stopPropagation())})})}function m(d){var b=[];Object.keys(d).forEach(function(a){var l=d[a].toString();a=encodeURIComponent(a);l=encodeURIComponent(l);b.push(a+"\x3d"+l)});return b.join("\x26")}function p(a){var b=[];a.forEach(function(a){var d=a.attributes,l=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"+l+'\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,l=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"+l+'\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 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),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(a,b,l){var d=!1;return function(c){for(var h=[],f=0;f<arguments.length;++f)h[f-0]=arguments[f];f=l||this;d||(b.apply(f,h),d=!0,setTimeout(function(){d=!1},a))}},on:function(d,b,l,c){3===arguments.length?(c=l,a.$(d).forEach(function(a){k(a,
|
|
b,c)})):a.$(d).forEach(function(a){g(a,l,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 c=new XMLHttpRequest,f=String(b.type).toUpperCase();"GET"===f&&(d+=d.match(/\?/)?m(b.data):"?"+m(b.data));c.open(f,d);c.onreadystatechange=function(){if(4===c.readyState){var a="json"===c.responseType?JSON.parse(c.responseText):c.responseText;299<
|
|
c.status?b.error.call(null,c.status,a,c.response):b.success.call(null,a,c.status)}};"json"===b.dataType?(b.data=JSON.stringify(b.data),b.mimeType="application/json"):b.data=m(b.data);c.setRequestHeader("Content-Type",b.mimeType);switch(f){case "GET":c.send(null);break;default:c.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")})});"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(a.hasElement(".anime #search"))a.on("#search","keyup",a.throttle(250,function(){var a=encodeURIComponent(this.value);
|
|
""!==a&&f(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 f=a.$(".name a",b)[0].textContent,h={id:b.dataset.kitsuId,mal_id:b.dataset.malId,data:{progress:d+1}};if(isNaN(d)||0===d)h.data.status="current";isNaN(d)||d+1!==c||(h.data.status="completed");a.show(a.$("#loading-shadow")[0]);a.ajax(a.url("/anime/update"),{data:h,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 "+f+". ")):("completed"===c.data.attributes.status&&a.hide(b),a.hide(a.$("#loading-shadow")[0]),a.showMessage("success","Successfully updated "+f),a.$(".completed_number",b)[0].textContent=++d);a.scrollToTop()},error:function(){a.hide(a.$("#loading-shadow")[0]);a.showMessage("error","Failed to update "+f+". ");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"),f=b.classList.contains("plus_one_chapter")?"chapter":"volume",h=parseInt(a.$("."+f+"s_read",d)[0].textContent,10)||0;c=parseInt(a.$("."+f+"_count",d)[0].textContent,10);var k=a.$(".name",d)[0].textContent;isNaN(h)&&(h=0);var g={id:d.dataset.kitsuId,mal_id:d.dataset.malId,data:{progress:h}};if(isNaN(h)||
|
|
0===h)g.data.status="current";isNaN(h)||h+1!==c||(g.data.status="completed");g.data.progress=++h;a.show(a.$("#loading-shadow")[0]);a.ajax(a.url("/manga/update"),{data:g,dataType:"json",type:"POST",mimeType:"application/json",success:function(){"completed"===g.data.status&&a.hide(d);a.hide(a.$("#loading-shadow")[0]);a.$("."+f+"s_read",d)[0].textContent=h;a.showMessage("success","Successfully updated "+k);a.scrollToTop()},error:function(){a.hide(a.$("#loading-shadow")[0]);a.showMessage("error","Failed to update "+
|
|
k);a.scrollToTop()}})})})();
|
|
//# sourceMappingURL=scripts-authed.min.js.map
|