=0&&m.item(i)!==elm);return i> -1};var AnimeClient={noop:function(){},$:function(selector,param){var context=param===void 0?null:param;if(typeof selector!=='string')return selector;context=context!==null&&context.nodeType===1?context:document;var elements=[];if(selector.match(/^#([\w]+$)/))elements.push(document.getElementById(selector.split('#')[1]));else elements=[].slice.apply(context.querySelectorAll(selector));return elements},hasElement:function(selector){return AnimeClient["$"](selector).length>0},scrollToTop:function(){var el=AnimeClient["$"]('header')[0];el.scrollIntoView(true)},hide:function(sel){if(typeof sel==='string')sel=AnimeClient["$"](sel);if(Array.isArray(sel))sel.forEach(function(el){return el.setAttribute('hidden','hidden')});else sel.setAttribute('hidden','hidden')},show:function(sel){if(typeof sel==='string')sel=AnimeClient["$"](sel);if(Array.isArray(sel))sel.forEach(function(el){return el.removeAttribute('hidden')});else sel.removeAttribute('hidden')},showMessage:function(type,message){var template="\n\t\t\t\t\n\t\t\t\t").concat(message,"\n\t\t\t\t\n\t\t\t
");var sel=AnimeClient["$"]('.message');if(sel[0]!==undefined)sel[0].remove();AnimeClient["$"]('header')[0].insertAdjacentHTML('beforeend',template)},closestParent:function(current,parentSelector){if(Element.prototype.closest!==undefined)return current.closest(parentSelector);while(current!==document.documentElement){if(matches(current,parentSelector))return current;current=current.parentElement}return null},url:function(path){var uri="//".concat(document.location.host);uri+=path.charAt(0)==='/'?path:"/".concat(path);return uri},throttle:function(interval,fn,scope){var wait=false;return function(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}var context=scope||this;if(!wait){fn.apply(context,args);wait=true;setTimeout(function(){wait=false},interval)}}}};function addEvent(sel,event,listener){if(!event.match(/^([\w\-]+)$/))event.split(' ').forEach(function(evt){addEvent(sel,evt,listener)});sel.addEventListener(event,listener,false)}function delegateEvent(sel,target,event,listener){addEvent(sel,event,function(e){AnimeClient["$"](target,sel).forEach(function(element){if(e.target==element){listener.call(element,e);e.stopPropagation()}})})}AnimeClient.on=function(sel,event,target,listener){if(listener===undefined){listener=target;AnimeClient["$"](sel).forEach(function(el){addEvent(el,event,listener)})}else AnimeClient["$"](sel).forEach(function(el){delegateEvent(el,target,event,listener)})};function ajaxSerialize(data){var pairs=[];Object.keys(data).forEach(function(name){var value=data[name].toString();name=encodeURIComponent(name);value=encodeURIComponent(value);pairs.push("".concat(name,"=").concat(value))});return pairs.join('&')}AnimeClient.ajax=function(url,config){var defaultConfig={data:{},type:'GET',dataType:'',success:AnimeClient.noop,mimeType:'application/x-www-form-urlencoded',error:AnimeClient.noop};config=_objectSpread({},defaultConfig,config);var request=new XMLHttpRequest();var method=String(config.type).toUpperCase();if(method==='GET')url+=url.match(/\?/)?ajaxSerialize(config.data):"?".concat(ajaxSerialize(config.data));request.open(method,url);request.onreadystatechange=function(){if(request.readyState===4){var responseText='';if(request.responseType==='json')responseText=JSON.parse(request.responseText);else responseText=request.responseText;if(request.status>299)config.error.call(null,request.status,responseText,request.response);else config.success.call(null,responseText,request.status)}};if(config.dataType==='json'){config.data=JSON.stringify(config.data);config.mimeType='application/json'}else config.data=ajaxSerialize(config.data);request.setRequestHeader('Content-Type',config.mimeType);if(method==='GET')request.send(null);else request.send(config.data);return request};AnimeClient.get=function(url,data,param){var callback=param===void 0?null:param;if(callback===null){callback=data;data={}}return AnimeClient.ajax(url,{data:data,success:callback})};AnimeClient.on('header','click','.message',hide);AnimeClient.on('form.js-delete','submit',confirmDelete);AnimeClient.on('.js-clear-cache','click',clearAPICache);AnimeClient.on('.vertical-tabs input','change',scrollToSection);AnimeClient.on('.media-filter','input',filterMedia);function hide(event){AnimeClient.hide(event.target)}function confirmDelete(event){var proceed=confirm('Are you ABSOLUTELY SURE you want to delete this item?');if(proceed===false){event.preventDefault();event.stopPropagation()}}function clearAPICache(){AnimeClient.get('/cache_purge',function(){AnimeClient.showMessage('success','Successfully purged api cache')})}function scrollToSection(event){var el=event.currentTarget.parentElement;var rect=el.getBoundingClientRect();var top=rect.top+window.pageYOffset;window.scrollTo({top:top,behavior:'smooth'})}function filterMedia(event){var rawFilter=event.target.value;var filter=new RegExp(rawFilter,'i');if(rawFilter!==''){AnimeClient["$"]('article.media').forEach(function(article){var titleLink=AnimeClient["$"]('.name a',article)[0];var title=String(titleLink.textContent).trim();if(!filter.test(title))AnimeClient.hide(article);else AnimeClient.show(article)});AnimeClient["$"]('table.media-wrap tbody tr').forEach(function(tr){var titleCell=AnimeClient["$"]('td.align-left',tr)[0];var titleLink=AnimeClient["$"]('a',titleCell)[0];var linkTitle=String(titleLink.textContent).trim();var textTitle=String(titleCell.textContent).trim();if(!(filter.test(linkTitle)||filter.test(textTitle)))AnimeClient.hide(tr);else AnimeClient.show(tr)})}else{AnimeClient.show('article.media');AnimeClient.show('table.media-wrap tbody tr')}}(function(){var hidden=null;var visibilityChange=null;if(typeof document.hidden!=="undefined"){hidden="hidden";visibilityChange="visibilitychange"}else if(typeof document.msHidden!=="undefined"){hidden="msHidden";visibilityChange="msvisibilitychange"}else if(typeof document.webkitHidden!=="undefined"){hidden="webkitHidden";visibilityChange="webkitvisibilitychange"}function handleVisibilityChange(){if(!document[hidden])AnimeClient.get('/heartbeat',function(beat){var status=JSON.parse(beat);if(status.hasAuth!==true){document.removeEventListener(visibilityChange,handleVisibilityChange,false);location.reload()}})}if(hidden===null)console.info('Page visibility API not supported, JS session check will not work');else document.addEventListener(visibilityChange,handleVisibilityChange,false)})();AnimeClient.on('main','change','.big-check',function(e){var id=e.target.id;document.getElementById("mal_".concat(id)).checked=true});function renderEditLink(type,item,param){var isCollection=param===void 0?false:param;if(isCollection||item.libraryEntry===null)return'';return"\n\t\t\n\t\t\t[ Already in List ]\n\t\t
\n\t\t\n\t\t\t
\n\t\t\t\tEdit\n\t\t\t\n\t\t
\n\t\t
\n\t")}function renderSearchResults(type,data,param){var isCollection=param===void 0?false:param;return data.map(function(item){var titles=item.titles.join('
');var disabled=item.libraryEntry!==null?'disabled':'';var editLink=renderEditLink(type,item,isCollection);if(isCollection)disabled='';return"\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t").concat(editLink,"\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\tInfo Page\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\n\t\t")}).join('')}var search=function(query,param){var isCollection=param===void 0?false:param;AnimeClient.show('.cssload-loader');return AnimeClient.get(AnimeClient.url('/anime-collection/search'),{query:query},function(searchResults,status){searchResults=JSON.parse(searchResults);AnimeClient.hide('.cssload-loader');AnimeClient["$"]('#series-list')[0].innerHTML=renderSearchResults('anime',searchResults,isCollection)})};if(AnimeClient.hasElement('.anime #search')){var prevRequest=null;AnimeClient.on('#search','input',AnimeClient.throttle(250,function(e){var query=encodeURIComponent(e.target.value);if(query==='')return;if(prevRequest!==null)prevRequest.abort();prevRequest=search(query)}))}if(AnimeClient.hasElement('#search-anime-collection')){var prevRequest=null;AnimeClient.on('#search-anime-collection','input',AnimeClient.throttle(250,function(e){var query=encodeURIComponent(e.target.value);if(query==='')return;if(prevRequest!==null)prevRequest.abort();prevRequest=search(query,true)}))}AnimeClient.on('body.anime.list','click','.plus-one',function(e){var parentSel=AnimeClient.closestParent(e.target,'article');var watchedCount=parseInt(AnimeClient["$"]('.completed_number',parentSel)[0].textContent,10)||0;var totalCount=parseInt(AnimeClient["$"]('.total_number',parentSel)[0].textContent,10);var title=AnimeClient["$"]('.name a',parentSel)[0].textContent;var data={id:parentSel.dataset.kitsuId,mal_id:parentSel.dataset.malId,data:{progress:watchedCount+1}};if(isNaN(watchedCount)||watchedCount===0)data.data.status='CURRENT';if(!isNaN(watchedCount)&&watchedCount+1===totalCount)data.data.status='COMPLETED';AnimeClient.show('#loading-shadow');AnimeClient.ajax(AnimeClient.url('/anime/increment'),{data:data,dataType:'json',type:'POST',success:function(res){var resData=JSON.parse(res);if(resData.error){AnimeClient.hide('#loading-shadow');AnimeClient.showMessage('error',"Failed to update ".concat(title,". "));AnimeClient.scrollToTop();return}if(resData.data.libraryEntry.update.libraryEntry.status==='COMPLETED')AnimeClient.hide(parentSel);AnimeClient.hide('#loading-shadow');AnimeClient.showMessage('success',"Successfully updated ".concat(title));AnimeClient["$"]('.completed_number',parentSel)[0].textContent=++watchedCount;AnimeClient.scrollToTop()},error:function(){AnimeClient.hide('#loading-shadow');AnimeClient.showMessage('error',"Failed to update ".concat(title,". "));AnimeClient.scrollToTop()}})});var search1=function(query){AnimeClient.show('.cssload-loader');return AnimeClient.get(AnimeClient.url('/manga/search'),{query:query},function(searchResults,status){searchResults=JSON.parse(searchResults);AnimeClient.hide('.cssload-loader');AnimeClient["$"]('#series-list')[0].innerHTML=renderSearchResults('manga',searchResults)})};if(AnimeClient.hasElement('.manga #search')){var prevRequest=null;AnimeClient.on('#search','input',AnimeClient.throttle(250,function(e){var query=encodeURIComponent(e.target.value);if(query==='')return;if(prevRequest!==null)prevRequest.abort();prevRequest=search1(query)}))}AnimeClient.on('.manga.list','click','.edit-buttons button',function(e){var thisSel=e.target;var parentSel=AnimeClient.closestParent(e.target,'article');var type=thisSel.classList.contains('plus-one-chapter')?'chapter':'volume';var completed=parseInt(AnimeClient["$"](".".concat(type,"s_read"),parentSel)[0].textContent,10)||0;var total=parseInt(AnimeClient["$"](".".concat(type,"_count"),parentSel)[0].textContent,10);var mangaName=AnimeClient["$"]('.name',parentSel)[0].textContent;if(isNaN(completed))completed=0;var data={id:parentSel.dataset.kitsuId,mal_id:parentSel.dataset.malId,data:{progress:completed}};if(isNaN(completed)||completed===0)data.data.status='CURRENT';if(!isNaN(completed)&&completed+1===total)data.data.status='COMPLETED';data.data.progress=++completed;AnimeClient.show('#loading-shadow');AnimeClient.ajax(AnimeClient.url('/manga/increment'),{data:data,dataType:'json',type:'POST',mimeType:'application/json',success:function(res){var resData=JSON.parse(res);if(resData.error){AnimeClient.hide('#loading-shadow');AnimeClient.showMessage('error',"Failed to update ".concat(mangaName,". "));AnimeClient.scrollToTop();return}if(String(data.data.status).toUpperCase()==='COMPLETED')AnimeClient.hide(parentSel);AnimeClient.hide('#loading-shadow');AnimeClient["$"](".".concat(type,"s_read"),parentSel)[0].textContent=String(completed);AnimeClient.showMessage('success',"Successfully updated ".concat(mangaName));AnimeClient.scrollToTop()},error:function(){AnimeClient.hide('#loading-shadow');AnimeClient.showMessage('error',"Failed to update ".concat(mangaName));AnimeClient.scrollToTop()}})})
\ No newline at end of file
diff --git a/public/js/scripts.min.js.map b/public/js/scripts.min.js.map
index 9a302bd3..42f2fc10 100644
--- a/public/js/scripts.min.js.map
+++ b/public/js/scripts.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["/var/www/anime/frontEndSrc/js/sw.js","/var/www/anime/frontEndSrc/js/anime-client.js","/var/www/anime/frontEndSrc/js/events.js","/var/www/anime/frontEndSrc/js/session-check.js","/var/www/anime/frontEndSrc/js/template-helpers.js","/var/www/anime/frontEndSrc/js/anime.js","/var/www/anime/frontEndSrc/js/manga.js"],"sourcesContent":["// Start the service worker, if you can\nif ('serviceWorker' in navigator) {\n\tnavigator.serviceWorker.register('/sw.js').then(reg => {\n\t\tconsole.log('Service worker registered', reg.scope);\n\t}).catch(error => {\n\t\tconsole.error('Failed to register service worker', error);\n\t});\n}","// -------------------------------------------------------------------------\n// ! Base\n// -------------------------------------------------------------------------\n\nconst matches = (elm, selector) => {\n\tlet m = (elm.document || elm.ownerDocument).querySelectorAll(selector);\n\tlet i = matches.length;\n\twhile (--i >= 0 && m.item(i) !== elm) {};\n\treturn i > -1;\n}\n\nconst AnimeClient = {\n\t/**\n\t * Placeholder function\n\t */\n\tnoop: () => {},\n\t/**\n\t * DOM selector\n\t *\n\t * @param {string} selector - The dom selector string\n\t * @param {Element} [context]\n\t * @return array of dom elements\n\t */\n\t$(selector, context = null) {\n\t\tif (typeof selector !== 'string') {\n\t\t\treturn selector;\n\t\t}\n\n\t\tcontext = (context !== null && context.nodeType === 1)\n\t\t\t? context\n\t\t\t: document;\n\n\t\tlet elements = [];\n\t\tif (selector.match(/^#([\\w]+$)/)) {\n\t\t\telements.push(document.getElementById(selector.split('#')[1]));\n\t\t} else {\n\t\t\telements = [].slice.apply(context.querySelectorAll(selector));\n\t\t}\n\n\t\treturn elements;\n\t},\n\t/**\n\t * Does the selector exist on the current page?\n\t *\n\t * @param {string} selector\n\t * @returns {boolean}\n\t */\n\thasElement (selector) {\n\t\treturn AnimeClient.$(selector).length > 0;\n\t},\n\t/**\n\t * Scroll to the top of the Page\n\t *\n\t * @return {void}\n\t */\n\tscrollToTop () {\n\t\tconst el = AnimeClient.$('header')[0];\n\t\tel.scrollIntoView(true);\n\t},\n\t/**\n\t * Hide the selected element\n\t *\n\t * @param {string|Element|Element[]} sel - the selector of the element to hide\n\t * @return {void}\n\t */\n\thide (sel) {\n\t\tif (typeof sel === 'string') {\n\t\t\tsel = AnimeClient.$(sel);\n\t\t}\n\n\t\tif (Array.isArray(sel)) {\n\t\t\tsel.forEach(el => el.setAttribute('hidden', 'hidden'));\n\t\t} else {\n\t\t\tsel.setAttribute('hidden', 'hidden');\n\t\t}\n\t},\n\t/**\n\t * UnHide the selected element\n\t *\n\t * @param {string|Element|Element[]} sel - the selector of the element to hide\n\t * @return {void}\n\t */\n\tshow (sel) {\n\t\tif (typeof sel === 'string') {\n\t\t\tsel = AnimeClient.$(sel);\n\t\t}\n\n\t\tif (Array.isArray(sel)) {\n\t\t\tsel.forEach(el => el.removeAttribute('hidden'));\n\t\t} else {\n\t\t\tsel.removeAttribute('hidden');\n\t\t}\n\t},\n\t/**\n\t * Display a message box\n\t *\n\t * @param {string} type - message type: info, error, success\n\t * @param {string} message - the message itself\n\t * @return {void}\n\t */\n\tshowMessage (type, message) {\n\t\tlet template =\n\t\t\t`\n\t\t\t\t\n\t\t\t\t${message}\n\t\t\t\t\n\t\t\t
`;\n\n\t\tlet sel = AnimeClient.$('.message');\n\t\tif (sel[0] !== undefined) {\n\t\t\tsel[0].remove();\n\t\t}\n\n\t\tAnimeClient.$('header')[0].insertAdjacentHTML('beforeend', template);\n\t},\n\t/**\n\t * Finds the closest parent element matching the passed selector\n\t *\n\t * @param {Element} current - the current Element\n\t * @param {string} parentSelector - selector for the parent element\n\t * @return {Element|null} - the parent element\n\t */\n\tclosestParent (current, parentSelector) {\n\t\tif (Element.prototype.closest !== undefined) {\n\t\t\treturn current.closest(parentSelector);\n\t\t}\n\n\t\twhile (current !== document.documentElement) {\n\t\t\tif (matches(current, parentSelector)) {\n\t\t\t\treturn current;\n\t\t\t}\n\n\t\t\tcurrent = current.parentElement;\n\t\t}\n\n\t\treturn null;\n\t},\n\t/**\n\t * Generate a full url from a relative path\n\t *\n\t * @param {string} path - url path\n\t * @return {string} - full url\n\t */\n\turl (path) {\n\t\tlet uri = `//${document.location.host}`;\n\t\turi += (path.charAt(0) === '/') ? path : `/${path}`;\n\n\t\treturn uri;\n\t},\n\t/**\n\t * Throttle execution of a function\n\t *\n\t * @see https://remysharp.com/2010/07/21/throttling-function-calls\n\t * @see https://jsfiddle.net/jonathansampson/m7G64/\n\t * @param {Number} interval - the minimum throttle time in ms\n\t * @param {Function} fn - the function to throttle\n\t * @param {Object} [scope] - the 'this' object for the function\n\t * @return {Function}\n\t */\n\tthrottle (interval, fn, scope) {\n\t\tlet wait = false;\n\t\treturn function (...args) {\n\t\t\tconst context = scope || this;\n\n\t\t\tif ( ! wait) {\n\t\t\t\tfn.apply(context, args);\n\t\t\t\twait = true;\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\twait = false;\n\t\t\t\t}, interval);\n\t\t\t}\n\t\t};\n\t},\n};\n\n// -------------------------------------------------------------------------\n// ! Events\n// -------------------------------------------------------------------------\n\nfunction addEvent(sel, event, listener) {\n\t// Recurse!\n\tif (! event.match(/^([\\w\\-]+)$/)) {\n\t\tevent.split(' ').forEach((evt) => {\n\t\t\taddEvent(sel, evt, listener);\n\t\t});\n\t}\n\n\tsel.addEventListener(event, listener, false);\n}\n\nfunction delegateEvent(sel, target, event, listener) {\n\t// Attach the listener to the parent\n\taddEvent(sel, event, (e) => {\n\t\t// Get live version of the target selector\n\t\tAnimeClient.$(target, sel).forEach((element) => {\n\t\t\tif(e.target == element) {\n\t\t\t\tlistener.call(element, e);\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\t});\n\t});\n}\n\n/**\n * Add an event listener\n *\n * @param {string|Element} sel - the parent selector to bind to\n * @param {string} event - event name(s) to bind\n * @param {string|Element|function} target - the element to directly bind the event to\n * @param {function} [listener] - event listener callback\n * @return {void}\n */\nAnimeClient.on = (sel, event, target, listener) => {\n\tif (listener === undefined) {\n\t\tlistener = target;\n\t\tAnimeClient.$(sel).forEach((el) => {\n\t\t\taddEvent(el, event, listener);\n\t\t});\n\t} else {\n\t\tAnimeClient.$(sel).forEach((el) => {\n\t\t\tdelegateEvent(el, target, event, listener);\n\t\t});\n\t}\n};\n\n// -------------------------------------------------------------------------\n// ! Ajax\n// -------------------------------------------------------------------------\n\n/**\n * Url encoding for non-get requests\n *\n * @param data\n * @returns {string}\n * @private\n */\nfunction ajaxSerialize(data) {\n\tlet pairs = [];\n\n\tObject.keys(data).forEach((name) => {\n\t\tlet value = data[name].toString();\n\n\t\tname = encodeURIComponent(name);\n\t\tvalue = encodeURIComponent(value);\n\n\t\tpairs.push(`${name}=${value}`);\n\t});\n\n\treturn pairs.join('&');\n}\n\n/**\n * Make an ajax request\n *\n * Config:{\n * \tdata: // data to send with the request\n * \ttype: // http verb of the request, defaults to GET\n * \tsuccess: // success callback\n * \terror: // error callback\n * }\n *\n * @param {string} url - the url to request\n * @param {Object} config - the configuration object\n * @return {XMLHttpRequest}\n */\nAnimeClient.ajax = (url, config) => {\n\t// Set some sane defaults\n\tconst defaultConfig = {\n\t\tdata: {},\n\t\ttype: 'GET',\n\t\tdataType: '',\n\t\tsuccess: AnimeClient.noop,\n\t\tmimeType: 'application/x-www-form-urlencoded',\n\t\terror: AnimeClient.noop\n\t}\n\n\tconfig = {\n\t\t...defaultConfig,\n\t\t...config,\n\t}\n\n\tlet request = new XMLHttpRequest();\n\tlet method = String(config.type).toUpperCase();\n\n\tif (method === 'GET') {\n\t\turl += (url.match(/\\?/))\n\t\t\t? ajaxSerialize(config.data)\n\t\t\t: `?${ajaxSerialize(config.data)}`;\n\t}\n\n\trequest.open(method, url);\n\n\trequest.onreadystatechange = () => {\n\t\tif (request.readyState === 4) {\n\t\t\tlet responseText = '';\n\n\t\t\tif (request.responseType === 'json') {\n\t\t\t\tresponseText = JSON.parse(request.responseText);\n\t\t\t} else {\n\t\t\t\tresponseText = request.responseText;\n\t\t\t}\n\n\t\t\tif (request.status > 299) {\n\t\t\t\tconfig.error.call(null, request.status, responseText, request.response);\n\t\t\t} else {\n\t\t\t\tconfig.success.call(null, responseText, request.status);\n\t\t\t}\n\t\t}\n\t};\n\n\tif (config.dataType === 'json') {\n\t\tconfig.data = JSON.stringify(config.data);\n\t\tconfig.mimeType = 'application/json';\n\t} else {\n\t\tconfig.data = ajaxSerialize(config.data);\n\t}\n\n\trequest.setRequestHeader('Content-Type', config.mimeType);\n\n\tif (method === 'GET') {\n\t\trequest.send(null);\n\t} else {\n\t\trequest.send(config.data);\n\t}\n\n\treturn request\n};\n\n/**\n * Do a get request\n *\n * @param {string} url\n * @param {object|function} data\n * @param {function} [callback]\n * @return {XMLHttpRequest}\n */\nAnimeClient.get = (url, data, callback = null) => {\n\tif (callback === null) {\n\t\tcallback = data;\n\t\tdata = {};\n\t}\n\n\treturn AnimeClient.ajax(url, {\n\t\tdata,\n\t\tsuccess: callback\n\t});\n};\n\n// -------------------------------------------------------------------------\n// Export\n// -------------------------------------------------------------------------\n\nexport default AnimeClient;","import _ from './anime-client.js';\n\n// ----------------------------------------------------------------------------\n// Event subscriptions\n// ----------------------------------------------------------------------------\n_.on('header', 'click', '.message', hide);\n_.on('form.js-delete', 'submit', confirmDelete);\n_.on('.js-clear-cache', 'click', clearAPICache);\n_.on('.vertical-tabs input', 'change', scrollToSection);\n_.on('.media-filter', 'input', filterMedia);\n\n// ----------------------------------------------------------------------------\n// Handler functions\n// ----------------------------------------------------------------------------\n\n/**\n * Hide the html element attached to the event\n *\n * @param {MouseEvent} event\n * @return void\n */\nfunction hide (event) {\n\t_.hide(event.target)\n}\n\n/**\n * Confirm deletion of an item\n *\n * @param {MouseEvent} event\n * @return void\n */\nfunction confirmDelete (event) {\n\tconst proceed = confirm('Are you ABSOLUTELY SURE you want to delete this item?');\n\n\tif (proceed === false) {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t}\n}\n\n/**\n * Clear the API cache, and show a message if the cache is cleared\n *\n * @return void\n */\nfunction clearAPICache () {\n\t_.get('/cache_purge', () => {\n\t\t_.showMessage('success', 'Successfully purged api cache');\n\t});\n}\n\n/**\n * Scroll to the accordion/vertical tab section just opened\n *\n * @param {InputEvent} event\n * @return void\n */\nfunction scrollToSection (event) {\n\tconst el = event.currentTarget.parentElement;\n\tconst rect = el.getBoundingClientRect();\n\n\tconst top = rect.top + window.pageYOffset;\n\n\twindow.scrollTo({\n\t\ttop,\n\t\tbehavior: 'smooth',\n\t});\n}\n\n/**\n * Filter an anime or manga list\n *\n * @param {InputEvent} event\n * @return void\n */\nfunction filterMedia (event) {\n\tconst rawFilter = event.target.value;\n\tconst filter = new RegExp(rawFilter, 'i');\n\n\t// console.log('Filtering items by: ', filter);\n\n\tif (rawFilter !== '') {\n\t\t// Filter the cover view\n\t\t_.$('article.media').forEach(article => {\n\t\t\tconst titleLink = _.$('.name a', article)[0];\n\t\t\tconst title = String(titleLink.textContent).trim();\n\t\t\tif ( ! filter.test(title)) {\n\t\t\t\t_.hide(article);\n\t\t\t} else {\n\t\t\t\t_.show(article);\n\t\t\t}\n\t\t});\n\n\t\t// Filter the list view\n\t\t_.$('table.media-wrap tbody tr').forEach(tr => {\n\t\t\tconst titleCell = _.$('td.align-left', tr)[0];\n\t\t\tconst titleLink = _.$('a', titleCell)[0];\n\t\t\tconst linkTitle = String(titleLink.textContent).trim();\n\t\t\tconst textTitle = String(titleCell.textContent).trim();\n\t\t\tif ( ! (filter.test(linkTitle) || filter.test(textTitle))) {\n\t\t\t\t_.hide(tr);\n\t\t\t} else {\n\t\t\t\t_.show(tr);\n\t\t\t}\n\t\t});\n\t} else {\n\t\t_.show('article.media');\n\t\t_.show('table.media-wrap tbody tr');\n\t}\n}\n","import _ from './anime-client.js';\n\n(() => {\n\tlet hidden = null;\n\tlet visibilityChange = null;\n\n\tif (typeof document.hidden !== \"undefined\") {\n\t\thidden = \"hidden\";\n\t\tvisibilityChange = \"visibilitychange\";\n\t} else if (typeof document.msHidden !== \"undefined\") {\n\t\thidden = \"msHidden\";\n\t\tvisibilityChange = \"msvisibilitychange\";\n\t} else if (typeof document.webkitHidden !== \"undefined\") {\n\t\thidden = \"webkitHidden\";\n\t\tvisibilityChange = \"webkitvisibilitychange\";\n\t}\n\n\tfunction handleVisibilityChange() {\n\t\t// Check the user's session to see if they are currently logged-in\n\t\t// when the page becomes visible\n\t\tif ( ! document[hidden]) {\n\t\t\t_.get('/heartbeat', (beat) => {\n\t\t\t\tconst status = JSON.parse(beat)\n\n\t\t\t\t// If the session is expired, immediately reload so that\n\t\t\t\t// you can't attempt to do an action that requires authentication\n\t\t\t\tif (status.hasAuth !== true) {\n\t\t\t\t\tdocument.removeEventListener(visibilityChange, handleVisibilityChange, false);\n\t\t\t\t\tlocation.reload();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tif (hidden === null) {\n\t\tconsole.info('Page visibility API not supported, JS session check will not work');\n\t} else {\n\t\tdocument.addEventListener(visibilityChange, handleVisibilityChange, false);\n\t}\n})();","import _ from './anime-client.js';\n\n// Click on hidden MAL checkbox so\n// that MAL id is passed\n_.on('main', 'change', '.big-check', (e) => {\n\tconst id = e.target.id;\n\tdocument.getElementById(`mal_${id}`).checked = true;\n});\n\n/**\n * On search results with an existing library entry, this shows that fact, with an edit link for the existing\n * library entry\n *\n * @param {'anime'|'manga'} type\n * @param {Object} item\n * @param isCollection\n * @returns {String}\n */\nfunction renderEditLink (type, item, isCollection = false) {\n\tif (isCollection || item.libraryEntry === null) {\n\t\treturn '';\n\t}\n\n\treturn `\n\t\t\n\t\t\t[ Already in List ]\n\t\t
\n\t\t\n\t\t\t
\n\t\t\t\tEdit\n\t\t\t\n\t\t
\n\t\t
\n\t`\n}\n\n/**\n * Show the search results for a media item\n *\n * @param {'anime'|'manga'} type\n * @param {Object} data\n * @param {boolean} isCollection\n * @returns {String}\n */\nexport function renderSearchResults (type, data, isCollection = false) {\n\treturn data.map(item => {\n\t\tconst titles = item.titles.join('
');\n\t\tlet disabled = item.libraryEntry !== null ? 'disabled' : '';\n\t\tconst editLink = renderEditLink(type, item, isCollection);\n\n\t\tif (isCollection) {\n\t\t\tdisabled = '';\n\t\t}\n\n\t\treturn `\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t${editLink}\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\tInfo Page\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\n\t\t`;\n\t}).join('');\n}","import _ from './anime-client.js'\nimport { renderSearchResults } from './template-helpers.js'\n\nconst search = (query, isCollection = false) => {\n\t// Show the loader\n\t_.show('.cssload-loader');\n\n\t// Do the api search\n\treturn _.get(_.url('/anime-collection/search'), { query }, (searchResults, status) => {\n\t\tsearchResults = JSON.parse(searchResults);\n\n\t\t// Hide the loader\n\t\t_.hide('.cssload-loader');\n\n\t\t// Show the results\n\t\t_.$('#series-list')[ 0 ].innerHTML = renderSearchResults('anime', searchResults, isCollection);\n\t});\n};\n\n// Anime list search\nif (_.hasElement('.anime #search')) {\n\tlet prevRequest = null;\n\n\t_.on('#search', 'input', _.throttle(250, (e) => {\n\t\tconst query = encodeURIComponent(e.target.value);\n\t\tif (query === '') {\n\t\t\treturn;\n\t\t}\n\n\t\tif (prevRequest !== null) {\n\t\t\tprevRequest.abort();\n\t\t}\n\n\t\tprevRequest = search(query);\n\t}));\n}\n\n// Anime collection search\nif (_.hasElement('#search-anime-collection')) {\n\tlet prevRequest = null;\n\n\t_.on('#search-anime-collection', 'input', _.throttle(250, (e) => {\n\t\tconst query = encodeURIComponent(e.target.value);\n\t\tif (query === '') {\n\t\t\treturn;\n\t\t}\n\n\t\tif (prevRequest !== null) {\n\t\t\tprevRequest.abort();\n\t\t}\n\n\t\tprevRequest = search(query, true);\n\t}));\n}\n\n// Action to increment episode count\n_.on('body.anime.list', 'click', '.plus-one', (e) => {\n\tlet parentSel = _.closestParent(e.target, 'article');\n\tlet watchedCount = parseInt(_.$('.completed_number', parentSel)[ 0 ].textContent, 10) || 0;\n\tlet totalCount = parseInt(_.$('.total_number', parentSel)[ 0 ].textContent, 10);\n\tlet title = _.$('.name a', parentSel)[ 0 ].textContent;\n\n\t// Setup the update data\n\tlet data = {\n\t\tid: parentSel.dataset.kitsuId,\n\t\tmal_id: parentSel.dataset.malId,\n\t\tdata: {\n\t\t\tprogress: watchedCount + 1\n\t\t}\n\t};\n\n\t// If the episode count is 0, and incremented,\n\t// change status to currently watching\n\tif (isNaN(watchedCount) || watchedCount === 0) {\n\t\tdata.data.status = 'CURRENT';\n\t}\n\n\t// If you increment at the last episode, mark as completed\n\tif ((!isNaN(watchedCount)) && (watchedCount + 1) === totalCount) {\n\t\tdata.data.status = 'COMPLETED';\n\t}\n\n\t_.show('#loading-shadow');\n\n\t// okay, lets actually make some changes!\n\t_.ajax(_.url('/anime/increment'), {\n\t\tdata,\n\t\tdataType: 'json',\n\t\ttype: 'POST',\n\t\tsuccess: (res) => {\n\t\t\tconst resData = JSON.parse(res);\n\n\t\t\tif (resData.error) {\n\t\t\t\t_.hide('#loading-shadow');\n\t\t\t\t_.showMessage('error', `Failed to update ${title}. `);\n\t\t\t\t_.scrollToTop();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (resData.data.libraryEntry.update.libraryEntry.status === 'COMPLETED') {\n\t\t\t\t_.hide(parentSel);\n\t\t\t}\n\n\t\t\t_.hide('#loading-shadow');\n\n\t\t\t_.showMessage('success', `Successfully updated ${title}`);\n\t\t\t_.$('.completed_number', parentSel)[ 0 ].textContent = ++watchedCount;\n\t\t\t_.scrollToTop();\n\t\t},\n\t\terror: () => {\n\t\t\t_.hide('#loading-shadow');\n\t\t\t_.showMessage('error', `Failed to update ${title}. `);\n\t\t\t_.scrollToTop();\n\t\t}\n\t});\n});","import _ from './anime-client.js'\nimport { renderSearchResults } from './template-helpers.js'\n\nconst search = (query) => {\n\t_.show('.cssload-loader');\n\treturn _.get(_.url('/manga/search'), { query }, (searchResults, status) => {\n\t\tsearchResults = JSON.parse(searchResults);\n\t\t_.hide('.cssload-loader');\n\t\t_.$('#series-list')[ 0 ].innerHTML = renderSearchResults('manga', searchResults);\n\t});\n};\n\nif (_.hasElement('.manga #search')) {\n\tlet prevRequest = null\n\n\t_.on('#search', 'input', _.throttle(250, (e) => {\n\t\tlet query = encodeURIComponent(e.target.value);\n\t\tif (query === '') {\n\t\t\treturn;\n\t\t}\n\n\t\tif (prevRequest !== null) {\n\t\t\tprevRequest.abort();\n\t\t}\n\n\t\tprevRequest = search(query);\n\t}));\n}\n\n/**\n * Javascript for editing manga, if logged in\n */\n_.on('.manga.list', 'click', '.edit-buttons button', (e) => {\n\tlet thisSel = e.target;\n\tlet parentSel = _.closestParent(e.target, 'article');\n\tlet type = thisSel.classList.contains('plus-one-chapter') ? 'chapter' : 'volume';\n\tlet completed = parseInt(_.$(`.${type}s_read`, parentSel)[ 0 ].textContent, 10) || 0;\n\tlet total = parseInt(_.$(`.${type}_count`, parentSel)[ 0 ].textContent, 10);\n\tlet mangaName = _.$('.name', parentSel)[ 0 ].textContent;\n\n\tif (isNaN(completed)) {\n\t\tcompleted = 0;\n\t}\n\n\t// Setup the update data\n\tlet data = {\n\t\tid: parentSel.dataset.kitsuId,\n\t\tmal_id: parentSel.dataset.malId,\n\t\tdata: {\n\t\t\tprogress: completed\n\t\t}\n\t};\n\n\t// If the episode count is 0, and incremented,\n\t// change status to currently reading\n\tif (isNaN(completed) || completed === 0) {\n\t\tdata.data.status = 'CURRENT';\n\t}\n\n\t// If you increment at the last chapter, mark as completed\n\tif ((!isNaN(completed)) && (completed + 1) === total) {\n\t\tdata.data.status = 'COMPLETED';\n\t}\n\n\t// Update the total count\n\tdata.data.progress = ++completed;\n\n\t_.show('#loading-shadow');\n\n\t_.ajax(_.url('/manga/increment'), {\n\t\tdata,\n\t\tdataType: 'json',\n\t\ttype: 'POST',\n\t\tmimeType: 'application/json',\n\t\tsuccess: (res) => {\n\t\t\tconst resData = JSON.parse(res)\n\t\t\tif (resData.error) {\n\t\t\t\t_.hide('#loading-shadow');\n\t\t\t\t_.showMessage('error', `Failed to update ${mangaName}. `);\n\t\t\t\t_.scrollToTop();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (String(data.data.status).toUpperCase() === 'COMPLETED') {\n\t\t\t\t_.hide(parentSel);\n\t\t\t}\n\n\t\t\t_.hide('#loading-shadow');\n\n\t\t\t_.$(`.${type}s_read`, parentSel)[ 0 ].textContent = String(completed);\n\t\t\t_.showMessage('success', `Successfully updated ${mangaName}`);\n\t\t\t_.scrollToTop();\n\t\t},\n\t\terror: () => {\n\t\t\t_.hide('#loading-shadow');\n\t\t\t_.showMessage('error', `Failed to update ${mangaName}`);\n\t\t\t_.scrollToTop();\n\t\t}\n\t});\n});"],"names":[],"mappings":"imBACA,EAAE,CAAE,CAAe,iBAAI,SAAS,CAC/B,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAQ,SAAE,IAAI,CAAC,QAAQ,CAAR,GAAG,CAAI,CAAC,AACvD,OAAO,CAAC,GAAG,CAAC,CAA2B,2BAAE,GAAG,CAAC,KAAK,CACnD,CAAC,EAAE,CAAK,QAAC,QAAQ,CAAR,KAAK,CAAI,CAAC,AAClB,OAAO,CAAC,KAAK,CAAC,CAAmC,mCAAE,KAAK,CACzD,CAAC,ECFF,GAAK,CAAC,OAAO,CAAG,QAAQ,CAAP,GAAG,CAAE,QAAQ,CAAK,CAAC,AACnC,GAAG,CAAC,CAAC,EAAI,GAAG,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,CAAC,CAAE,kBACrD,WAAW,GACb,MAAM,AACP,CAAC,AAED,EAAE,CAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,KAAO,CAAW,uBACvD,IAAI,CAAC,SAAS,cAGf,IAAI,CAAC,CAAiB,8BAEtB,CAAC,IAAE,CAAC,GAAO,MAAM,CAAX,IAAI,CAAC,CAAM,SAAG,SAAS,EAAG,CAAC,EAAG,WAAW,CAAG,MAAM,CAAC,SAAS,cAClE,WAAW,CAAC,CAAS,SAAG,CAAqB,uBAAY,MAAA,CAAV,SAAS,eACxD,WAAW,EACd,CAAC,CACD,KAAK,CAAE,QACT,EADe,CAAC,YACX,IAAI,CAAC,CAAiB,8BACtB,WAAW,CAAC,CAAO,OAAG,CAAiB,mBAAY,MAAA,CAAV,SAAS,eAClD,WAAW,EACd,CAAC,AACF,CAAC,CACF,CAAC"}
\ No newline at end of file
+{"version":3,"sources":["/var/www/htdocs/github.timshomepage.net/animeclient/frontEndSrc/js/sw.js","/var/www/htdocs/github.timshomepage.net/animeclient/frontEndSrc/js/anime-client.js","/var/www/htdocs/github.timshomepage.net/animeclient/frontEndSrc/js/events.js","/var/www/htdocs/github.timshomepage.net/animeclient/frontEndSrc/js/session-check.js","/var/www/htdocs/github.timshomepage.net/animeclient/frontEndSrc/js/template-helpers.js","/var/www/htdocs/github.timshomepage.net/animeclient/frontEndSrc/js/anime.js","/var/www/htdocs/github.timshomepage.net/animeclient/frontEndSrc/js/manga.js"],"sourcesContent":["// Start the service worker, if you can\nif ('serviceWorker' in navigator) {\n\tnavigator.serviceWorker.register('/sw.js').then(reg => {\n\t\tconsole.log('Service worker registered', reg.scope);\n\t}).catch(error => {\n\t\tconsole.error('Failed to register service worker', error);\n\t});\n}","// -------------------------------------------------------------------------\n// ! Base\n// -------------------------------------------------------------------------\n\nconst matches = (elm, selector) => {\n\tlet m = (elm.document || elm.ownerDocument).querySelectorAll(selector);\n\tlet i = matches.length;\n\twhile (--i >= 0 && m.item(i) !== elm) {};\n\treturn i > -1;\n}\n\nconst AnimeClient = {\n\t/**\n\t * Placeholder function\n\t */\n\tnoop: () => {},\n\t/**\n\t * DOM selector\n\t *\n\t * @param {string} selector - The dom selector string\n\t * @param {Element} [context]\n\t * @return array of dom elements\n\t */\n\t$(selector, context = null) {\n\t\tif (typeof selector !== 'string') {\n\t\t\treturn selector;\n\t\t}\n\n\t\tcontext = (context !== null && context.nodeType === 1)\n\t\t\t? context\n\t\t\t: document;\n\n\t\tlet elements = [];\n\t\tif (selector.match(/^#([\\w]+$)/)) {\n\t\t\telements.push(document.getElementById(selector.split('#')[1]));\n\t\t} else {\n\t\t\telements = [].slice.apply(context.querySelectorAll(selector));\n\t\t}\n\n\t\treturn elements;\n\t},\n\t/**\n\t * Does the selector exist on the current page?\n\t *\n\t * @param {string} selector\n\t * @returns {boolean}\n\t */\n\thasElement (selector) {\n\t\treturn AnimeClient.$(selector).length > 0;\n\t},\n\t/**\n\t * Scroll to the top of the Page\n\t *\n\t * @return {void}\n\t */\n\tscrollToTop () {\n\t\tconst el = AnimeClient.$('header')[0];\n\t\tel.scrollIntoView(true);\n\t},\n\t/**\n\t * Hide the selected element\n\t *\n\t * @param {string|Element|Element[]} sel - the selector of the element to hide\n\t * @return {void}\n\t */\n\thide (sel) {\n\t\tif (typeof sel === 'string') {\n\t\t\tsel = AnimeClient.$(sel);\n\t\t}\n\n\t\tif (Array.isArray(sel)) {\n\t\t\tsel.forEach(el => el.setAttribute('hidden', 'hidden'));\n\t\t} else {\n\t\t\tsel.setAttribute('hidden', 'hidden');\n\t\t}\n\t},\n\t/**\n\t * UnHide the selected element\n\t *\n\t * @param {string|Element|Element[]} sel - the selector of the element to hide\n\t * @return {void}\n\t */\n\tshow (sel) {\n\t\tif (typeof sel === 'string') {\n\t\t\tsel = AnimeClient.$(sel);\n\t\t}\n\n\t\tif (Array.isArray(sel)) {\n\t\t\tsel.forEach(el => el.removeAttribute('hidden'));\n\t\t} else {\n\t\t\tsel.removeAttribute('hidden');\n\t\t}\n\t},\n\t/**\n\t * Display a message box\n\t *\n\t * @param {string} type - message type: info, error, success\n\t * @param {string} message - the message itself\n\t * @return {void}\n\t */\n\tshowMessage (type, message) {\n\t\tlet template =\n\t\t\t`\n\t\t\t\t\n\t\t\t\t${message}\n\t\t\t\t\n\t\t\t
`;\n\n\t\tlet sel = AnimeClient.$('.message');\n\t\tif (sel[0] !== undefined) {\n\t\t\tsel[0].remove();\n\t\t}\n\n\t\tAnimeClient.$('header')[0].insertAdjacentHTML('beforeend', template);\n\t},\n\t/**\n\t * Finds the closest parent element matching the passed selector\n\t *\n\t * @param {Element} current - the current Element\n\t * @param {string} parentSelector - selector for the parent element\n\t * @return {Element|null} - the parent element\n\t */\n\tclosestParent (current, parentSelector) {\n\t\tif (Element.prototype.closest !== undefined) {\n\t\t\treturn current.closest(parentSelector);\n\t\t}\n\n\t\twhile (current !== document.documentElement) {\n\t\t\tif (matches(current, parentSelector)) {\n\t\t\t\treturn current;\n\t\t\t}\n\n\t\t\tcurrent = current.parentElement;\n\t\t}\n\n\t\treturn null;\n\t},\n\t/**\n\t * Generate a full url from a relative path\n\t *\n\t * @param {string} path - url path\n\t * @return {string} - full url\n\t */\n\turl (path) {\n\t\tlet uri = `//${document.location.host}`;\n\t\turi += (path.charAt(0) === '/') ? path : `/${path}`;\n\n\t\treturn uri;\n\t},\n\t/**\n\t * Throttle execution of a function\n\t *\n\t * @see https://remysharp.com/2010/07/21/throttling-function-calls\n\t * @see https://jsfiddle.net/jonathansampson/m7G64/\n\t * @param {Number} interval - the minimum throttle time in ms\n\t * @param {Function} fn - the function to throttle\n\t * @param {Object} [scope] - the 'this' object for the function\n\t * @return {Function}\n\t */\n\tthrottle (interval, fn, scope) {\n\t\tlet wait = false;\n\t\treturn function (...args) {\n\t\t\tconst context = scope || this;\n\n\t\t\tif ( ! wait) {\n\t\t\t\tfn.apply(context, args);\n\t\t\t\twait = true;\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\twait = false;\n\t\t\t\t}, interval);\n\t\t\t}\n\t\t};\n\t},\n};\n\n// -------------------------------------------------------------------------\n// ! Events\n// -------------------------------------------------------------------------\n\nfunction addEvent(sel, event, listener) {\n\t// Recurse!\n\tif (! event.match(/^([\\w\\-]+)$/)) {\n\t\tevent.split(' ').forEach((evt) => {\n\t\t\taddEvent(sel, evt, listener);\n\t\t});\n\t}\n\n\tsel.addEventListener(event, listener, false);\n}\n\nfunction delegateEvent(sel, target, event, listener) {\n\t// Attach the listener to the parent\n\taddEvent(sel, event, (e) => {\n\t\t// Get live version of the target selector\n\t\tAnimeClient.$(target, sel).forEach((element) => {\n\t\t\tif(e.target == element) {\n\t\t\t\tlistener.call(element, e);\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\t});\n\t});\n}\n\n/**\n * Add an event listener\n *\n * @param {string|Element} sel - the parent selector to bind to\n * @param {string} event - event name(s) to bind\n * @param {string|Element|function} target - the element to directly bind the event to\n * @param {function} [listener] - event listener callback\n * @return {void}\n */\nAnimeClient.on = (sel, event, target, listener) => {\n\tif (listener === undefined) {\n\t\tlistener = target;\n\t\tAnimeClient.$(sel).forEach((el) => {\n\t\t\taddEvent(el, event, listener);\n\t\t});\n\t} else {\n\t\tAnimeClient.$(sel).forEach((el) => {\n\t\t\tdelegateEvent(el, target, event, listener);\n\t\t});\n\t}\n};\n\n// -------------------------------------------------------------------------\n// ! Ajax\n// -------------------------------------------------------------------------\n\n/**\n * Url encoding for non-get requests\n *\n * @param data\n * @returns {string}\n * @private\n */\nfunction ajaxSerialize(data) {\n\tlet pairs = [];\n\n\tObject.keys(data).forEach((name) => {\n\t\tlet value = data[name].toString();\n\n\t\tname = encodeURIComponent(name);\n\t\tvalue = encodeURIComponent(value);\n\n\t\tpairs.push(`${name}=${value}`);\n\t});\n\n\treturn pairs.join('&');\n}\n\n/**\n * Make an ajax request\n *\n * Config:{\n * \tdata: // data to send with the request\n * \ttype: // http verb of the request, defaults to GET\n * \tsuccess: // success callback\n * \terror: // error callback\n * }\n *\n * @param {string} url - the url to request\n * @param {Object} config - the configuration object\n * @return {XMLHttpRequest}\n */\nAnimeClient.ajax = (url, config) => {\n\t// Set some sane defaults\n\tconst defaultConfig = {\n\t\tdata: {},\n\t\ttype: 'GET',\n\t\tdataType: '',\n\t\tsuccess: AnimeClient.noop,\n\t\tmimeType: 'application/x-www-form-urlencoded',\n\t\terror: AnimeClient.noop\n\t}\n\n\tconfig = {\n\t\t...defaultConfig,\n\t\t...config,\n\t}\n\n\tlet request = new XMLHttpRequest();\n\tlet method = String(config.type).toUpperCase();\n\n\tif (method === 'GET') {\n\t\turl += (url.match(/\\?/))\n\t\t\t? ajaxSerialize(config.data)\n\t\t\t: `?${ajaxSerialize(config.data)}`;\n\t}\n\n\trequest.open(method, url);\n\n\trequest.onreadystatechange = () => {\n\t\tif (request.readyState === 4) {\n\t\t\tlet responseText = '';\n\n\t\t\tif (request.responseType === 'json') {\n\t\t\t\tresponseText = JSON.parse(request.responseText);\n\t\t\t} else {\n\t\t\t\tresponseText = request.responseText;\n\t\t\t}\n\n\t\t\tif (request.status > 299) {\n\t\t\t\tconfig.error.call(null, request.status, responseText, request.response);\n\t\t\t} else {\n\t\t\t\tconfig.success.call(null, responseText, request.status);\n\t\t\t}\n\t\t}\n\t};\n\n\tif (config.dataType === 'json') {\n\t\tconfig.data = JSON.stringify(config.data);\n\t\tconfig.mimeType = 'application/json';\n\t} else {\n\t\tconfig.data = ajaxSerialize(config.data);\n\t}\n\n\trequest.setRequestHeader('Content-Type', config.mimeType);\n\n\tif (method === 'GET') {\n\t\trequest.send(null);\n\t} else {\n\t\trequest.send(config.data);\n\t}\n\n\treturn request\n};\n\n/**\n * Do a get request\n *\n * @param {string} url\n * @param {object|function} data\n * @param {function} [callback]\n * @return {XMLHttpRequest}\n */\nAnimeClient.get = (url, data, callback = null) => {\n\tif (callback === null) {\n\t\tcallback = data;\n\t\tdata = {};\n\t}\n\n\treturn AnimeClient.ajax(url, {\n\t\tdata,\n\t\tsuccess: callback\n\t});\n};\n\n// -------------------------------------------------------------------------\n// Export\n// -------------------------------------------------------------------------\n\nexport default AnimeClient;","import _ from './anime-client.js';\n\n// ----------------------------------------------------------------------------\n// Event subscriptions\n// ----------------------------------------------------------------------------\n_.on('header', 'click', '.message', hide);\n_.on('form.js-delete', 'submit', confirmDelete);\n_.on('.js-clear-cache', 'click', clearAPICache);\n_.on('.vertical-tabs input', 'change', scrollToSection);\n_.on('.media-filter', 'input', filterMedia);\n\n// ----------------------------------------------------------------------------\n// Handler functions\n// ----------------------------------------------------------------------------\n\n/**\n * Hide the html element attached to the event\n *\n * @param {MouseEvent} event\n * @return void\n */\nfunction hide (event) {\n\t_.hide(event.target)\n}\n\n/**\n * Confirm deletion of an item\n *\n * @param {MouseEvent} event\n * @return void\n */\nfunction confirmDelete (event) {\n\tconst proceed = confirm('Are you ABSOLUTELY SURE you want to delete this item?');\n\n\tif (proceed === false) {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t}\n}\n\n/**\n * Clear the API cache, and show a message if the cache is cleared\n *\n * @return void\n */\nfunction clearAPICache () {\n\t_.get('/cache_purge', () => {\n\t\t_.showMessage('success', 'Successfully purged api cache');\n\t});\n}\n\n/**\n * Scroll to the accordion/vertical tab section just opened\n *\n * @param {InputEvent} event\n * @return void\n */\nfunction scrollToSection (event) {\n\tconst el = event.currentTarget.parentElement;\n\tconst rect = el.getBoundingClientRect();\n\n\tconst top = rect.top + window.pageYOffset;\n\n\twindow.scrollTo({\n\t\ttop,\n\t\tbehavior: 'smooth',\n\t});\n}\n\n/**\n * Filter an anime or manga list\n *\n * @param {InputEvent} event\n * @return void\n */\nfunction filterMedia (event) {\n\tconst rawFilter = event.target.value;\n\tconst filter = new RegExp(rawFilter, 'i');\n\n\t// console.log('Filtering items by: ', filter);\n\n\tif (rawFilter !== '') {\n\t\t// Filter the cover view\n\t\t_.$('article.media').forEach(article => {\n\t\t\tconst titleLink = _.$('.name a', article)[0];\n\t\t\tconst title = String(titleLink.textContent).trim();\n\t\t\tif ( ! filter.test(title)) {\n\t\t\t\t_.hide(article);\n\t\t\t} else {\n\t\t\t\t_.show(article);\n\t\t\t}\n\t\t});\n\n\t\t// Filter the list view\n\t\t_.$('table.media-wrap tbody tr').forEach(tr => {\n\t\t\tconst titleCell = _.$('td.align-left', tr)[0];\n\t\t\tconst titleLink = _.$('a', titleCell)[0];\n\t\t\tconst linkTitle = String(titleLink.textContent).trim();\n\t\t\tconst textTitle = String(titleCell.textContent).trim();\n\t\t\tif ( ! (filter.test(linkTitle) || filter.test(textTitle))) {\n\t\t\t\t_.hide(tr);\n\t\t\t} else {\n\t\t\t\t_.show(tr);\n\t\t\t}\n\t\t});\n\t} else {\n\t\t_.show('article.media');\n\t\t_.show('table.media-wrap tbody tr');\n\t}\n}\n","import _ from './anime-client.js';\n\n(() => {\n\tlet hidden = null;\n\tlet visibilityChange = null;\n\n\tif (typeof document.hidden !== \"undefined\") {\n\t\thidden = \"hidden\";\n\t\tvisibilityChange = \"visibilitychange\";\n\t} else if (typeof document.msHidden !== \"undefined\") {\n\t\thidden = \"msHidden\";\n\t\tvisibilityChange = \"msvisibilitychange\";\n\t} else if (typeof document.webkitHidden !== \"undefined\") {\n\t\thidden = \"webkitHidden\";\n\t\tvisibilityChange = \"webkitvisibilitychange\";\n\t}\n\n\tfunction handleVisibilityChange() {\n\t\t// Check the user's session to see if they are currently logged-in\n\t\t// when the page becomes visible\n\t\tif ( ! document[hidden]) {\n\t\t\t_.get('/heartbeat', (beat) => {\n\t\t\t\tconst status = JSON.parse(beat)\n\n\t\t\t\t// If the session is expired, immediately reload so that\n\t\t\t\t// you can't attempt to do an action that requires authentication\n\t\t\t\tif (status.hasAuth !== true) {\n\t\t\t\t\tdocument.removeEventListener(visibilityChange, handleVisibilityChange, false);\n\t\t\t\t\tlocation.reload();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tif (hidden === null) {\n\t\tconsole.info('Page visibility API not supported, JS session check will not work');\n\t} else {\n\t\tdocument.addEventListener(visibilityChange, handleVisibilityChange, false);\n\t}\n})();","import _ from './anime-client.js';\n\n// Click on hidden MAL checkbox so\n// that MAL id is passed\n_.on('main', 'change', '.big-check', (e) => {\n\tconst id = e.target.id;\n\tdocument.getElementById(`mal_${id}`).checked = true;\n});\n\n/**\n * On search results with an existing library entry, this shows that fact, with an edit link for the existing\n * library entry\n *\n * @param {'anime'|'manga'} type\n * @param {Object} item\n * @param isCollection\n * @returns {String}\n */\nfunction renderEditLink (type, item, isCollection = false) {\n\tif (isCollection || item.libraryEntry === null) {\n\t\treturn '';\n\t}\n\n\treturn `\n\t\t\n\t\t\t[ Already in List ]\n\t\t
\n\t\t\n\t\t\t
\n\t\t\t\tEdit\n\t\t\t\n\t\t
\n\t\t
\n\t`\n}\n\n/**\n * Show the search results for a media item\n *\n * @param {'anime'|'manga'} type\n * @param {Object} data\n * @param {boolean} isCollection\n * @returns {String}\n */\nexport function renderSearchResults (type, data, isCollection = false) {\n\treturn data.map(item => {\n\t\tconst titles = item.titles.join('
');\n\t\tlet disabled = item.libraryEntry !== null ? 'disabled' : '';\n\t\tconst editLink = renderEditLink(type, item, isCollection);\n\n\t\tif (isCollection) {\n\t\t\tdisabled = '';\n\t\t}\n\n\t\treturn `\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t${editLink}\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\tInfo Page\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\n\t\t`;\n\t}).join('');\n}","import _ from './anime-client.js'\nimport { renderSearchResults } from './template-helpers.js'\n\nconst search = (query, isCollection = false) => {\n\t// Show the loader\n\t_.show('.cssload-loader');\n\n\t// Do the api search\n\treturn _.get(_.url('/anime-collection/search'), { query }, (searchResults, status) => {\n\t\tsearchResults = JSON.parse(searchResults);\n\n\t\t// Hide the loader\n\t\t_.hide('.cssload-loader');\n\n\t\t// Show the results\n\t\t_.$('#series-list')[ 0 ].innerHTML = renderSearchResults('anime', searchResults, isCollection);\n\t});\n};\n\n// Anime list search\nif (_.hasElement('.anime #search')) {\n\tlet prevRequest = null;\n\n\t_.on('#search', 'input', _.throttle(250, (e) => {\n\t\tconst query = encodeURIComponent(e.target.value);\n\t\tif (query === '') {\n\t\t\treturn;\n\t\t}\n\n\t\tif (prevRequest !== null) {\n\t\t\tprevRequest.abort();\n\t\t}\n\n\t\tprevRequest = search(query);\n\t}));\n}\n\n// Anime collection search\nif (_.hasElement('#search-anime-collection')) {\n\tlet prevRequest = null;\n\n\t_.on('#search-anime-collection', 'input', _.throttle(250, (e) => {\n\t\tconst query = encodeURIComponent(e.target.value);\n\t\tif (query === '') {\n\t\t\treturn;\n\t\t}\n\n\t\tif (prevRequest !== null) {\n\t\t\tprevRequest.abort();\n\t\t}\n\n\t\tprevRequest = search(query, true);\n\t}));\n}\n\n// Action to increment episode count\n_.on('body.anime.list', 'click', '.plus-one', (e) => {\n\tlet parentSel = _.closestParent(e.target, 'article');\n\tlet watchedCount = parseInt(_.$('.completed_number', parentSel)[ 0 ].textContent, 10) || 0;\n\tlet totalCount = parseInt(_.$('.total_number', parentSel)[ 0 ].textContent, 10);\n\tlet title = _.$('.name a', parentSel)[ 0 ].textContent;\n\n\t// Setup the update data\n\tlet data = {\n\t\tid: parentSel.dataset.kitsuId,\n\t\tmal_id: parentSel.dataset.malId,\n\t\tdata: {\n\t\t\tprogress: watchedCount + 1\n\t\t}\n\t};\n\n\t// If the episode count is 0, and incremented,\n\t// change status to currently watching\n\tif (isNaN(watchedCount) || watchedCount === 0) {\n\t\tdata.data.status = 'CURRENT';\n\t}\n\n\t// If you increment at the last episode, mark as completed\n\tif ((!isNaN(watchedCount)) && (watchedCount + 1) === totalCount) {\n\t\tdata.data.status = 'COMPLETED';\n\t}\n\n\t_.show('#loading-shadow');\n\n\t// okay, lets actually make some changes!\n\t_.ajax(_.url('/anime/increment'), {\n\t\tdata,\n\t\tdataType: 'json',\n\t\ttype: 'POST',\n\t\tsuccess: (res) => {\n\t\t\tconst resData = JSON.parse(res);\n\n\t\t\tif (resData.error) {\n\t\t\t\t_.hide('#loading-shadow');\n\t\t\t\t_.showMessage('error', `Failed to update ${title}. `);\n\t\t\t\t_.scrollToTop();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (resData.data.libraryEntry.update.libraryEntry.status === 'COMPLETED') {\n\t\t\t\t_.hide(parentSel);\n\t\t\t}\n\n\t\t\t_.hide('#loading-shadow');\n\n\t\t\t_.showMessage('success', `Successfully updated ${title}`);\n\t\t\t_.$('.completed_number', parentSel)[ 0 ].textContent = ++watchedCount;\n\t\t\t_.scrollToTop();\n\t\t},\n\t\terror: () => {\n\t\t\t_.hide('#loading-shadow');\n\t\t\t_.showMessage('error', `Failed to update ${title}. `);\n\t\t\t_.scrollToTop();\n\t\t}\n\t});\n});","import _ from './anime-client.js'\nimport { renderSearchResults } from './template-helpers.js'\n\nconst search = (query) => {\n\t_.show('.cssload-loader');\n\treturn _.get(_.url('/manga/search'), { query }, (searchResults, status) => {\n\t\tsearchResults = JSON.parse(searchResults);\n\t\t_.hide('.cssload-loader');\n\t\t_.$('#series-list')[ 0 ].innerHTML = renderSearchResults('manga', searchResults);\n\t});\n};\n\nif (_.hasElement('.manga #search')) {\n\tlet prevRequest = null\n\n\t_.on('#search', 'input', _.throttle(250, (e) => {\n\t\tlet query = encodeURIComponent(e.target.value);\n\t\tif (query === '') {\n\t\t\treturn;\n\t\t}\n\n\t\tif (prevRequest !== null) {\n\t\t\tprevRequest.abort();\n\t\t}\n\n\t\tprevRequest = search(query);\n\t}));\n}\n\n/**\n * Javascript for editing manga, if logged in\n */\n_.on('.manga.list', 'click', '.edit-buttons button', (e) => {\n\tlet thisSel = e.target;\n\tlet parentSel = _.closestParent(e.target, 'article');\n\tlet type = thisSel.classList.contains('plus-one-chapter') ? 'chapter' : 'volume';\n\tlet completed = parseInt(_.$(`.${type}s_read`, parentSel)[ 0 ].textContent, 10) || 0;\n\tlet total = parseInt(_.$(`.${type}_count`, parentSel)[ 0 ].textContent, 10);\n\tlet mangaName = _.$('.name', parentSel)[ 0 ].textContent;\n\n\tif (isNaN(completed)) {\n\t\tcompleted = 0;\n\t}\n\n\t// Setup the update data\n\tlet data = {\n\t\tid: parentSel.dataset.kitsuId,\n\t\tmal_id: parentSel.dataset.malId,\n\t\tdata: {\n\t\t\tprogress: completed\n\t\t}\n\t};\n\n\t// If the episode count is 0, and incremented,\n\t// change status to currently reading\n\tif (isNaN(completed) || completed === 0) {\n\t\tdata.data.status = 'CURRENT';\n\t}\n\n\t// If you increment at the last chapter, mark as completed\n\tif ((!isNaN(completed)) && (completed + 1) === total) {\n\t\tdata.data.status = 'COMPLETED';\n\t}\n\n\t// Update the total count\n\tdata.data.progress = ++completed;\n\n\t_.show('#loading-shadow');\n\n\t_.ajax(_.url('/manga/increment'), {\n\t\tdata,\n\t\tdataType: 'json',\n\t\ttype: 'POST',\n\t\tmimeType: 'application/json',\n\t\tsuccess: (res) => {\n\t\t\tconst resData = JSON.parse(res)\n\t\t\tif (resData.error) {\n\t\t\t\t_.hide('#loading-shadow');\n\t\t\t\t_.showMessage('error', `Failed to update ${mangaName}. `);\n\t\t\t\t_.scrollToTop();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (String(data.data.status).toUpperCase() === 'COMPLETED') {\n\t\t\t\t_.hide(parentSel);\n\t\t\t}\n\n\t\t\t_.hide('#loading-shadow');\n\n\t\t\t_.$(`.${type}s_read`, parentSel)[ 0 ].textContent = String(completed);\n\t\t\t_.showMessage('success', `Successfully updated ${mangaName}`);\n\t\t\t_.scrollToTop();\n\t\t},\n\t\terror: () => {\n\t\t\t_.hide('#loading-shadow');\n\t\t\t_.showMessage('error', `Failed to update ${mangaName}`);\n\t\t\t_.scrollToTop();\n\t\t}\n\t});\n});"],"names":[],"mappings":"imBACA,EAAE,CAAE,CAAe,iBAAI,SAAS,CAC/B,SAAS,CAAC,aAAa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,IAAI,CAAC,KAAK,CAAC,GAAG,EAC9B,EAAE,CAAE,OAAO,CAAC,KAAK,CAAE,CAAC,YACjB,IAAI,CAAC,CAAiB,8BACtB,WAAW,CAAC,CAAO,OAAG,CAAiB,mBAAY,MAAE,CAAZ,SAAS,CAAC,CAAE,kBACrD,WAAW,GACb,MAAM,AACP,CAAC,AAED,EAAE,CAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,KAAO,CAAW,uBACvD,IAAI,CAAC,SAAS,cAGf,IAAI,CAAC,CAAiB,8BAEtB,CAAC,IAAE,CAAC,GAAO,MAAM,CAAX,IAAI,CAAC,CAAM,SAAG,SAAS,EAAG,CAAC,EAAG,WAAW,CAAG,MAAM,CAAC,SAAS,cAClE,WAAW,CAAC,CAAS,SAAG,CAAqB,uBAAY,MAAA,CAAV,SAAS,eACxD,WAAW,EACd,CAAC,CACD,KAAK,CAAE,QACT,EADe,CAAC,YACX,IAAI,CAAC,CAAiB,8BACtB,WAAW,CAAC,CAAO,OAAG,CAAiB,mBAAY,MAAA,CAAV,SAAS,eAClD,WAAW,EACd,CAAC,AACF,CAAC,CACF,CAAC"}
\ No newline at end of file
diff --git a/public/js/tables.min.js.map b/public/js/tables.min.js.map
index efef2f37..6688df55 100644
--- a/public/js/tables.min.js.map
+++ b/public/js/tables.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["/var/www/anime/frontEndSrc/js/base/sort-tables.js"],"sourcesContent":["const LightTableSorter = (() => {\n\tlet th = null;\n\tlet cellIndex = null;\n\tlet order = '';\n\tconst text = (row) => row.cells.item(cellIndex).textContent.toLowerCase();\n\tconst sort = (a, b) => {\n\t\tlet textA = text(a);\n\t\tlet textB = text(b);\n\t\tconsole.log(\"Comparing \" + textA + \" and \" + textB)\n\t\t\n\t\tif(th.classList.contains(\"numeric\")){\n\t\t\tarrayA = textA.replace('episodes: ','').replace('-',0).split(\"/\");\n\t\t\tarrayB = textB.replace('episodes: ','').replace('-',0).split(\"/\");\n\t\t\tif(arrayA.length > 1) {\n\t\t\t\ttextA = parseInt(arrayA[0],10) / parseInt(arrayA[1],10);\n\t\t\t\ttextB = parseInt(arrayB[0],10) / parseInt(arrayB[1],10);\n\t\t\t}\n\t\t\telse{\n\t\t\t\ttextA = parseInt(arrayA[0],10);\n\t\t\t\ttextB = parseInt(arrayB[0],10);\n\t\t\t}\n\t\t}\n\t\telse if (parseInt(textA, 10)) {\n\t\t\ttextA = parseInt(textA, 10);\n\t\t\ttextB = parseInt(textB, 10);\n\t\t}\n\t\tif (textA > textB) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (textA < textB) {\n\t\t\treturn -1;\n\t\t}\n\t\treturn 0;\n\t};\n\tconst toggle = () => {\n\t\tconst c = order !== 'sorting-asc' ? 'sorting-asc' : 'sorting-desc';\n\t\tth.className = (th.className.replace(order, '') + ' ' + c).trim();\n\t\treturn order = c;\n\t};\n\tconst reset = () => {\n\t\tth.classList.remove('sorting-asc', 'sorting-desc');\n\t\tth.classList.add('sorting');\n\t\treturn order = '';\n\t};\n\tconst onClickEvent = (e) => {\n\t\tif (th && (cellIndex !== e.target.cellIndex)) {\n\t\t\treset();\n\t\t}\n\t\tth = e.target;\n\t\tif (th.nodeName.toLowerCase() === 'th') {\n\t\t\tcellIndex = th.cellIndex;\n\t\t\tconst tbody = th.offsetParent.getElementsByTagName('tbody')[0];\n\t\t\tlet rows = Array.from(tbody.rows);\n\t\t\tif (rows) {\n\t\t\t\trows.sort(sort);\n\t\t\t\tif (order === 'sorting-asc') {\n\t\t\t\t\trows.reverse();\n\t\t\t\t}\n\t\t\t\ttoggle();\n\t\t\t\ttbody.innerHtml = '';\n\n\t\t\t\trows.forEach(row => {\n\t\t\t\t\ttbody.appendChild(row);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n\treturn {\n\t\tinit: () => {\n\t\t\tlet ths = document.getElementsByTagName('th');\n\t\t\tlet results = [];\n\t\t\tfor (let i = 0, len = ths.length; i < len; i++) {\n\t\t\t\tlet th = ths[i];\n\t\t\t\tth.classList.add('sorting');\n\t\t\t\tth.classList.add('testing');\n\t\t\t\tresults.push(th.onclick = onClickEvent);\n\t\t\t}\n\t\t\treturn results;\n\t\t}\n\t};\n})();\n\nLightTableSorter.init();"],"names":[],"mappings":"AAAA,GAAK,CAAC,gBAAgB,CAAI,QAC1B,EADgC,CAAC,AAChC,GAAG,CAAC,EAAE,CAAG,IAAI,CACb,GAAG,CAAC,SAAS,CAAG,IAAI,CACpB,GAAG,CAAC,KAAK,CAAG,CAAE,EACd,GAAK,CAAC,IAAI,CAAG,QAAQ,CAAP,GAAG,EAAK,MAAM,CAAN,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,WAAW,IACvE,GAAK,CAAC,IAAI,CAAG,QAAQ,CAAP,CAAC,CAAE,CAAC,CAAK,CAAC,AACvB,GAAG,CAAC,KAAK,CAAG,IAAI,CAAC,CAAC,EAClB,GAAG,CAAC,KAAK,CAAG,IAAI,CAAC,CAAC,EAClB,OAAO,CAAC,GAAG,CAAC,CAAY,YAAG,KAAK,CAAG,CAAO,OAAG,KAAK,EAElD,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAS,UAAE,CAAC,AACpC,MAAM,CAAG,KAAK,CAAC,OAAO,CAAC,CAAa,aAAC,CAAE,GAAE,OAAO,CAAC,CAAG,GAAC,CAAC,EAAE,KAAK,CAAC,CAAG,IACjE,MAAM,CAAG,KAAK,CAAC,OAAO,CAAC,CAAa,aAAC,CAAE,GAAE,OAAO,CAAC,CAAG,GAAC,CAAC,EAAE,KAAK,CAAC,CAAG,IACjE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAG,CAAC,CAAE,CAAC,AACtB,KAAK,CAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EACtD,KAAK,CAAG,QAAQ,CA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ources":["/var/www/htdocs/github.timshomepage.net/animeclient/frontEndSrc/js/base/sort-tables.js"],"sourcesContent":["const LightTableSorter = (() => {\n\tlet th = null;\n\tlet cellIndex = null;\n\tlet order = '';\n\tconst text = (row) => row.cells.item(cellIndex).textContent.toLowerCase();\n\tconst sort = (a, b) => {\n\t\tlet textA = text(a);\n\t\tlet textB = text(b);\n\t\tconsole.log(\"Comparing \" + textA + \" and \" + textB)\n\t\t\n\t\tif(th.classList.contains(\"numeric\")){\n\t\t\tarrayA = textA.replace('episodes: ','').replace('-',0).split(\"/\");\n\t\t\tarrayB = textB.replace('episodes: ','').replace('-',0).split(\"/\");\n\t\t\tif(arrayA.length > 1) {\n\t\t\t\ttextA = parseInt(arrayA[0],10) / parseInt(arrayA[1],10);\n\t\t\t\ttextB = parseInt(arrayB[0],10) / parseInt(arrayB[1],10);\n\t\t\t}\n\t\t\telse{\n\t\t\t\ttextA = parseInt(arrayA[0],10);\n\t\t\t\ttextB = parseInt(arrayB[0],10);\n\t\t\t}\n\t\t}\n\t\telse if (parseInt(textA, 10)) {\n\t\t\ttextA = parseInt(textA, 10);\n\t\t\ttextB = parseInt(textB, 10);\n\t\t}\n\t\tif (textA > textB) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (textA < textB) {\n\t\t\treturn -1;\n\t\t}\n\t\treturn 0;\n\t};\n\tconst toggle = () => {\n\t\tconst c = order !== 'sorting-asc' ? 'sorting-asc' : 'sorting-desc';\n\t\tth.className = (th.className.replace(order, '') + ' ' + c).trim();\n\t\treturn order = c;\n\t};\n\tconst reset = () => {\n\t\tth.classList.remove('sorting-asc', 'sorting-desc');\n\t\tth.classList.add('sorting');\n\t\treturn order = '';\n\t};\n\tconst onClickEvent = (e) => {\n\t\tif (th && (cellIndex !== e.target.cellIndex)) {\n\t\t\treset();\n\t\t}\n\t\tth = e.target;\n\t\tif (th.nodeName.toLowerCase() === 'th') {\n\t\t\tcellIndex = th.cellIndex;\n\t\t\tconst tbody = th.offsetParent.getElementsByTagName('tbody')[0];\n\t\t\tlet rows = Array.from(tbody.rows);\n\t\t\tif (rows) {\n\t\t\t\trows.sort(sort);\n\t\t\t\tif (order === 'sorting-asc') {\n\t\t\t\t\trows.reverse();\n\t\t\t\t}\n\t\t\t\ttoggle();\n\t\t\t\ttbody.innerHtml = '';\n\n\t\t\t\trows.forEach(row => {\n\t\t\t\t\ttbody.appendChild(row);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n\treturn {\n\t\tinit: () => {\n\t\t\tlet ths = document.getElementsByTagName('th');\n\t\t\tlet results = [];\n\t\t\tfor (let i = 0, len = ths.length; i < len; i++) {\n\t\t\t\tlet th = ths[i];\n\t\t\t\tth.classList.add('sorting');\n\t\t\t\tth.classList.add('testing');\n\t\t\t\tresults.push(th.onclick = onClickEvent);\n\t\t\t}\n\t\t\treturn results;\n\t\t}\n\t};\n})();\n\nLightTableSorter.init();"],"names":[],"mappings":"AAAA,GAAK,CAAC,gBAAgB,CAAI,QAC1B,EADgC,CAAC,AAChC,GAAG,CAAC,EAAE,CAAG,IAAI,CACb,GAAG,CAAC,SAAS,CAAG,IAAI,CACpB,GAAG,CAAC,KAAK,CAAG,CAAE,EACd,GAAK,CAAC,IAAI,CAAG,QAAQ,CAAP,GAAG,EAAK,MAAM,CAAN,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,WAAW,IACvE,GAAK,CAAC,IAAI,CAAG,QAAQ,CAAP,CAAC,CAAE,CAAC,CAAK,CAAC,AACvB,GAAG,CAAC,KAAK,CAAG,IAAI,CAAC,CAAC,EAClB,GAAG,CAAC,KAAK,CAAG,IAAI,CAAC,CAAC,EAClB,OAAO,CAAC,GAAG,CAAC,CAAY,YAAG,KAAK,CAAG,CAAO,OAAG,KAAK,EAElD,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAS,UAAE,CAAC,AACpC,MAAM,CAAG,KAAK,CAAC,OAAO,CAAC,CAAa,aA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AAG,CAAC,MAAM,CAAE,CAAC,CAAG,GAAG,CAAE,CAAC,GAAI,CAAC,AAChD,GAAG,CAAC,EAAE,CAAG,GAAG,CAAC,CAAC,EACd,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAS,UAC1B,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAS,UAC1B,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAG,YAAY,CACvC,CAAC,AACD,MAAM,CAAC,OAAO,AACf,CAAC,AACF,CAAC,AACF,CAAC,GAED,gBAAgB,CAAC,IAAI"}
\ No newline at end of file
diff --git a/src/AnimeClient/API/Kitsu/Model.php b/src/AnimeClient/API/Kitsu/Model.php
index c46f925c..f7a872d5 100644
--- a/src/AnimeClient/API/Kitsu/Model.php
+++ b/src/AnimeClient/API/Kitsu/Model.php
@@ -534,6 +534,7 @@ final class Model {
$searchItem = [
'id' => $item['id'],
'slug' => $item['slug'],
+ 'coverImage' => K::getPosterImage($item),
'canonicalTitle' => $item['titles']['canonical'],
'titles' => array_values(K::getTitles($item['titles'])),
'libraryEntry' => $item['myLibraryEntry'],
diff --git a/src/AnimeClient/API/Kitsu/Queries/SearchAnime.graphql b/src/AnimeClient/API/Kitsu/Queries/SearchAnime.graphql
index b72aad30..a91b6c6f 100644
--- a/src/AnimeClient/API/Kitsu/Queries/SearchAnime.graphql
+++ b/src/AnimeClient/API/Kitsu/Queries/SearchAnime.graphql
@@ -2,6 +2,14 @@ query ($query: String!) {
searchAnimeByTitle(title: $query, first: 20) {
nodes {
id
+ posterImage {
+ original {
+ url
+ }
+ views {
+ url
+ }
+ }
mappings(first: 10) {
nodes {
externalId
diff --git a/src/AnimeClient/API/Kitsu/Queries/SearchManga.graphql b/src/AnimeClient/API/Kitsu/Queries/SearchManga.graphql
index 8ad9a6e8..0e4bb4c6 100644
--- a/src/AnimeClient/API/Kitsu/Queries/SearchManga.graphql
+++ b/src/AnimeClient/API/Kitsu/Queries/SearchManga.graphql
@@ -2,6 +2,14 @@ query ($query: String!) {
searchMangaByTitle(title: $query, first: 20) {
nodes {
id
+ posterImage {
+ original {
+ url
+ }
+ views {
+ url
+ }
+ }
mappings(first: 10) {
nodes {
externalId
diff --git a/src/AnimeClient/API/Kitsu/Transformer/AnimeListTransformer.php b/src/AnimeClient/API/Kitsu/Transformer/AnimeListTransformer.php
index 71bdf25b..2880c583 100644
--- a/src/AnimeClient/API/Kitsu/Transformer/AnimeListTransformer.php
+++ b/src/AnimeClient/API/Kitsu/Transformer/AnimeListTransformer.php
@@ -96,9 +96,7 @@ final class AnimeListTransformer extends AbstractTransformer {
'titles' => $titles,
'slug' => $anime['slug'],
'show_type' => (string)StringType::from($anime['subtype'])->upperCaseFirst(),
- 'cover_image' => $anime['posterImage']['views'][1]['url']
- ?? $anime['posterImage']['original']['url']
- ?? '/public/images/placeholder.png',
+ 'cover_image' => Kitsu::getPosterImage($anime),
'genres' => $genres,
'streaming_links' => $streamingLinks,
],
diff --git a/src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php b/src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php
index 34b2404b..f2676a43 100644
--- a/src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php
+++ b/src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php
@@ -125,9 +125,7 @@ final class AnimeTransformer extends AbstractTransformer {
'age_rating' => $base['ageRating'],
'age_rating_guide' => $base['ageRatingGuide'],
'characters' => $characters,
- 'cover_image' => $base['posterImage']['views'][1]['url']
- ?? $base['posterImage']['original']['url']
- ?? '/public/images/placeholder.png',
+ 'cover_image' => Kitsu::getPosterImage($base),
'episode_count' => $base['episodeCount'],
'episode_length' => $base['episodeLength'],
'genres' => $genres,
diff --git a/src/AnimeClient/API/Kitsu/Transformer/HistoryTransformer.php b/src/AnimeClient/API/Kitsu/Transformer/HistoryTransformer.php
index f6855630..5ad2dfa4 100644
--- a/src/AnimeClient/API/Kitsu/Transformer/HistoryTransformer.php
+++ b/src/AnimeClient/API/Kitsu/Transformer/HistoryTransformer.php
@@ -17,6 +17,7 @@
namespace Aviat\AnimeClient\API\Kitsu\Transformer;
use Aviat\AnimeClient\Types\HistoryItem;
+use Aviat\AnimeClient\Kitsu;
use DateTimeImmutable;
use DateTimeInterface;
use DateTimeZone;
@@ -186,7 +187,6 @@ abstract class HistoryTransformer {
{
$data = $entry['media'];
$title = $this->linkTitle($data);
- $imgUrl = $data['posterImage']['views'][0]['url'] ?? $data['posterImage']['original']['url'];
$item = end($entry['changedData']['progress']);
// No showing episode 0 nonsense
@@ -214,7 +214,7 @@ abstract class HistoryTransformer {
return HistoryItem::from([
'action' => $action,
- 'coverImg' => $imgUrl,
+ 'coverImg' => Kitsu::getPosterImage($data, 0),
'kind' => 'progressed',
'original' => $entry,
'title' => $title,
@@ -227,7 +227,6 @@ abstract class HistoryTransformer {
{
$data = $entry['media'];
$title = $this->linkTitle($data);
- $imgUrl = $data['posterImage']['views'][0]['url'] ?? $data['posterImage']['original']['url'];
$kind = array_key_first($entry['changedData']);
@@ -245,7 +244,7 @@ abstract class HistoryTransformer {
return HistoryItem::from([
'action' => $statusName,
- 'coverImg' => $imgUrl,
+ 'coverImg' => Kitsu::getPosterImage($data, 0),
'kind' => 'updated',
'original' => $entry,
'title' => $title,
diff --git a/src/AnimeClient/API/Kitsu/Transformer/LibraryEntryTransformer.php b/src/AnimeClient/API/Kitsu/Transformer/LibraryEntryTransformer.php
index 3b677c36..e15d1ae8 100644
--- a/src/AnimeClient/API/Kitsu/Transformer/LibraryEntryTransformer.php
+++ b/src/AnimeClient/API/Kitsu/Transformer/LibraryEntryTransformer.php
@@ -102,9 +102,7 @@ final class LibraryEntryTransformer extends AbstractTransformer
'titles' => $titles,
'slug' => $anime['slug'],
'show_type' => (string)StringType::from($anime['subtype'])->upperCaseFirst(),
- 'cover_image' => $anime['posterImage']['views'][1]['url']
- ?? $anime['posterImage']['original']['url']
- ?? '/public/images/placeholder.png',
+ 'cover_image' => Kitsu::getPosterImage($anime),
'genres' => $genres,
'streaming_links' => $streamingLinks,
],
@@ -169,7 +167,7 @@ final class LibraryEntryTransformer extends AbstractTransformer
'manga' => MangaListItemDetail::from([
'genres' => $genres,
'id' => $mangaId,
- 'image' => $manga['posterImage']['views'][1]['url'],
+ 'image' => Kitsu::getPosterImage($manga),
'slug' => $manga['slug'],
'title' => $title,
'titles' => $titles,
diff --git a/src/AnimeClient/API/Kitsu/Transformer/MangaListTransformer.php b/src/AnimeClient/API/Kitsu/Transformer/MangaListTransformer.php
index c8f97ba5..085bfe6a 100644
--- a/src/AnimeClient/API/Kitsu/Transformer/MangaListTransformer.php
+++ b/src/AnimeClient/API/Kitsu/Transformer/MangaListTransformer.php
@@ -91,7 +91,7 @@ final class MangaListTransformer extends AbstractTransformer {
'manga' => MangaListItemDetail::from([
'genres' => $genres,
'id' => $mangaId,
- 'image' => $manga['posterImage']['views'][1]['url'],
+ 'image' => Kitsu::getPosterImage($manga),
'slug' => $manga['slug'],
'title' => $title,
'titles' => $titles,
diff --git a/src/AnimeClient/API/Kitsu/Transformer/MangaTransformer.php b/src/AnimeClient/API/Kitsu/Transformer/MangaTransformer.php
index a15fc4e9..e6d32b72 100644
--- a/src/AnimeClient/API/Kitsu/Transformer/MangaTransformer.php
+++ b/src/AnimeClient/API/Kitsu/Transformer/MangaTransformer.php
@@ -125,7 +125,7 @@ final class MangaTransformer extends AbstractTransformer {
'characters' => $characters,
'chapter_count' => $base['chapterCount'],
'volume_count' => $base['volumeCount'],
- 'cover_image' => $base['posterImage']['views'][1]['url'],
+ 'cover_image' => Kitsu::getPosterImage($base),
'genres' => $genres,
'links' => $links,
'manga_type' => $base['subtype'],
diff --git a/src/AnimeClient/API/Kitsu/Transformer/PersonTransformer.php b/src/AnimeClient/API/Kitsu/Transformer/PersonTransformer.php
index 71e387ea..1e1ea8f7 100644
--- a/src/AnimeClient/API/Kitsu/Transformer/PersonTransformer.php
+++ b/src/AnimeClient/API/Kitsu/Transformer/PersonTransformer.php
@@ -84,7 +84,7 @@ final class PersonTransformer extends AbstractTransformer {
'title' => $title,
'titles' => array_merge([$title], Kitsu::getFilteredTitles($media['titles'])),
'image' => [
- 'original' => $media['posterImage']['views'][1]['url'] ?? '',
+ 'original' => Kitsu::getPosterImage($media)
],
'slug' => $media['slug'],
];
diff --git a/src/AnimeClient/Kitsu.php b/src/AnimeClient/Kitsu.php
index 29078174..681be82a 100644
--- a/src/AnimeClient/Kitsu.php
+++ b/src/AnimeClient/Kitsu.php
@@ -336,6 +336,20 @@ final class Kitsu {
return $valid;
}
+ /**
+ * Get the url of the posterImage from Kitsu, with fallbacks
+ *
+ * @param array $base
+ * @param int $size
+ * @return string
+ */
+ public static function getPosterImage(array $base, int $size = 1): string
+ {
+ return $base['posterImage']['views'][$size]['url']
+ ?? $base['posterImage']['original']['url']
+ ?? '/public/images/placeholder.png';
+ }
+
/**
* Get the name and logo for the streaming service of the current link
*