{"version":3,"file":"../ajaxLoadListing.js","names":["listMoreBtn","document","querySelector","loadingIcon","addEventListener","e","locale","getAttribute","searchQuery","getElementById","searchString","value","target","classList","add","hidden","requestData","slug","dataset","s","page","parseInt","currentPage","action","searchParams","URLSearchParams","fetch","ajaxurl","method","cache","body","then","response","text","data","console","log","innerHTML","totalPages","setAttribute","remove","catch","error"],"sources":["ajaxLoadListing.js"],"mappings":"AAAA,MAAMA,YAAYC,SAASC,cAAc,2BACnCC,YAAYF,SAASC,cAAc,wBACtCF,aACHA,YAAYI,iBAAiB,SAAQ,SAASC,GAC1C,MACMC,OADWL,SAASC,cAAc,8BAChBK,aAAa,WAC/BC,YAAeP,SAASQ,eAAe,yBAC7C,IAAIC,aAAa,UACU,IAAjB,aAA+C,MAAfF,cAEtCE,aAAaF,YAAYG,OAE7BN,EAAEO,OAAOC,UAAUC,IAAI,QACvBX,YAAYY,QAAO,EAEnBC,YAAY,CAACC,KAAOZ,EAAEO,OAAOM,QAAQD,KAAKE,EAAIT,aAAaJ,OAASA,OAAQc,KAAOC,SAAShB,EAAEO,OAAOM,QAAQI,aAAa,EAAGC,OAAS,mBACtI,MAAMC,aAAa,IAAIC,gBAAgBT,aACvCU,MAAMC,QAAQ,CACVC,OAAQ,OACRC,MAAO,WACPC,KAAMN,eACPO,MAAMC,UAAsBA,SAASC,SACvCF,MAAMG,OACHC,QAAQC,IAAIF,MACZ/B,YAAYY,QAAO,EACNd,SAASC,cAAc,0BAC7BmC,WAAWH,KACfb,SAASrB,YAAYkB,QAAQoB,YAAYjB,SAASrB,YAAYkB,QAAQI,eACrEtB,YAAYuC,aAAa,oBAAoBlB,SAASrB,YAAYkB,QAAQI,aAAa,GACvFtB,YAAYa,UAAU2B,OAAO,QACjC,IAEHC,OAAOC,QACJvC,YAAYY,QAAO,EACnBoB,QAAQC,IAAIM,OACZ1C,YAAYa,UAAU2B,OAAO,OAAO,GAG5C","ignoreList":[],"sourcesContent":["const listMoreBtn=document.querySelector(\"button.baseul-load-more\");\r\nconst loadingIcon=document.querySelector(\".baseul-loading-icon\");\r\nif(listMoreBtn){\r\nlistMoreBtn.addEventListener(\"click\",function(e){\r\n const localeMeta=document.querySelector(\"meta[property='og:locale']\");\r\n const locale=localeMeta.getAttribute(\"content\");\r\n const searchQuery = document.getElementById('original_search_query');\r\n let searchString=null;\r\n if (typeof(searchQuery) != 'undefined' && searchQuery != null)\r\n {\r\n searchString=searchQuery.value;\r\n }\r\n e.target.classList.add(\"hide\");\r\n loadingIcon.hidden=false;\r\n\r\n requestData={\"slug\":e.target.dataset.slug,\"s\":searchString,\"locale\":locale, \"page\":parseInt(e.target.dataset.currentPage)+1, \"action\":\"ajaxloadlisting\"};\r\n const searchParams=new URLSearchParams(requestData);\r\n fetch(ajaxurl,{\r\n method: 'POST',\r\n cache: 'no-cache',\r\n body: searchParams\r\n }).then((response) => { return response.text();})\r\n .then((data) => {\r\n console.log(data);\r\n loadingIcon.hidden=true;\r\n const lister=document.querySelector(\".baseul-nouvelles-list\");\r\n lister.innerHTML+=data;\r\n if(parseInt(listMoreBtn.dataset.totalPages)>parseInt(listMoreBtn.dataset.currentPage)){\r\n listMoreBtn.setAttribute(\"data-current-page\",parseInt(listMoreBtn.dataset.currentPage)+1);\r\n listMoreBtn.classList.remove(\"hide\");\r\n }\r\n })\r\n .catch((error) => {\r\n loadingIcon.hidden=true;\r\n console.log(error);\r\n listMoreBtn.classList.remove(\"hide\");\r\n });\r\n\r\n});\r\n}"]}