{"version":3,"file":"main.js","mappings":"CAAA,WACE,MAAMA,EAAWC,SAASC,eAAe,aAEzC,IAAKF,EAAU,OAEf,IAAIG,EAAQ,IACZ,MAAMC,EAAWJ,EAASK,aAAa,kBACjCC,EAAWN,EAASK,aAAa,kBACjCE,EAAWP,EAASK,aAAa,kBAAoB,GACrDG,EAASR,EAASK,aAAa,gBAAkB,GAEvDL,EAASS,iBAAiB,SAAS,SAAUC,GAC3CA,EAAMC,iBAENC,MAAMC,eAAeC,IAAK,CACxBC,OAAQ,OACRC,QAAS,CACP,eAAgB,qCAElBC,KAAM,IAAIC,gBAAgB,CACxBC,MAAON,eAAeM,MACtBC,OAAQP,eAAeO,OACvBjB,MAAOA,EACPG,SAAUA,EACVC,SAAUA,EACVC,OAAQA,EACRa,OAAQ,iBAGTC,MAAKC,IACJ,IAAKA,EAASC,GACZ,MAAM,IAAIC,MAAM,uBAAuBF,EAASG,UAGlD,OAAOH,EAASI,MAAM,IAEvBL,MAAKC,IACJpB,IACA,MAAMyB,EAAY3B,SAASC,eAAe,wBACrC0B,IAELA,EAAUC,mBAAmB,YAAaN,GAE1CpB,GAASC,EACLJ,EAAS8B,SACT9B,EAAS+B,UAAW,EAAK,IAE9BC,OAAMC,IACLC,QAAQD,MAAM,SAAUA,GACxBjC,EAAS+B,UAAW,CAAK,IAG7B/B,EAAS+B,UAAW,CACtB,GACD,CAtDD","sources":["webpack://tvkampen/./assets/src/js/load-more/archive.js"],"sourcesContent":["(function () {\n const loadMore = document.getElementById('load-more');\n\n if (!loadMore) return;\n\n let paged = '1';\n const maxPages = loadMore.getAttribute('data-max-pages');\n const postType = loadMore.getAttribute('data-post-type');\n const category = loadMore.getAttribute('data-category') ?? '';\n const author = loadMore.getAttribute('data-author') ?? '';\n\n loadMore.addEventListener('click', function (event) {\n event.preventDefault();\n\n fetch(load_more_data.url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded'\n },\n body: new URLSearchParams({\n nonce: load_more_data.nonce,\n locale: load_more_data.locale,\n paged: paged,\n postType: postType,\n category: category,\n author: author,\n action: 'more_posts'\n })\n })\n .then(response => {\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n\n return response.text();\n })\n .then(response => {\n paged++;\n const container = document.getElementById('article-list-archive');\n if (!container) return;\n\n container.insertAdjacentHTML('beforeend', response);\n\n paged == maxPages\n ? loadMore.remove()\n : loadMore.disabled = false;\n })\n .catch(error => {\n console.error('Error:', error);\n loadMore.disabled = false;\n });\n\n loadMore.disabled = true;\n });\n})();"],"names":["loadMore","document","getElementById","paged","maxPages","getAttribute","postType","category","author","addEventListener","event","preventDefault","fetch","load_more_data","url","method","headers","body","URLSearchParams","nonce","locale","action","then","response","ok","Error","status","text","container","insertAdjacentHTML","remove","disabled","catch","error","console"],"sourceRoot":""}