{"version":3,"sources":["webpack:///./Scripts/loadmorebutton.js"],"names":["__webpack_require__","r","__webpack_exports__","element","maxItems","hasAttribute","parseInt","getAttribute","useLessButton","items","Array","prototype","slice","call","querySelectorAll","moreBtn","querySelector","visibleCount","update","index","forEach","item","classList","remove","add","setAttribute","innerHTML","removeAttribute","document","autoimage","handle","addEventListener"],"mappings":"0FAAAA,EAAAC,EAAAC,GAAeA,EAAA,iBAAAC,GAEX,IAAIC,EAAWD,EAAQE,aAAa,qBAAuBC,SAASH,EAAQI,aAAa,sBAAwB,GAC7GC,KAAiBL,EAAQE,aAAa,uBAAuE,QAA9CF,EAAQI,aAAa,uBACpFE,EAAQC,MAAMC,UAAUC,MAAMC,KAAKV,EAAQW,iBAAiB,4BAC5DC,EAAUZ,EAAQa,cAAc,0BAEhCC,EAAeb,EAEfc,EAAS,WACT,IAAIC,EAAQ,EAERJ,EAAQV,aAAa,eACrBY,EAAeb,GAEnBK,EAAMW,QAAQ,SAAUC,GAChBA,EAAKhB,aAAa,wBAGlBc,EAAQF,EACRI,EAAKC,UAAUC,OAdT,UAgBNF,EAAKC,UAAUE,IAhBT,UAkBVL,OAGCX,GAMGW,GAASf,GACTW,EAAQO,UAAUE,IA5BZ,UA8BNL,GAASF,GACTF,EAAQU,aAAa,YAAa,IAClCV,EAAQC,cAAc,KAAKU,UAAYX,EAAQC,cAAc,KAAKT,aAAa,oBAE/EQ,EAAQY,gBAAgB,YAAa,IACrCZ,EAAQC,cAAc,KAAKU,UAAYX,EAAQC,cAAc,KAAKT,aAAa,wBAb/EY,GAASF,EACTF,EAAQO,UAAUE,IAvBZ,UAyBNT,EAAQO,UAAUC,OAzBZ,UAuCdK,SAASC,UAAUC,UAEvB3B,EAAQ4B,iBAAiB,SAAUb,GAEnCH,EAAQgB,iBAAiB,QAAS,WAC9Bd,GAAiBT,EAAiB,MAAQJ,EAC1Cc,MAGJA","file":"6.js","sourcesContent":["export default element => {\n\n var maxItems = element.hasAttribute('data-loadmore-max') ? parseInt(element.getAttribute('data-loadmore-max')) : 10;\n var useLessButton = (element.hasAttribute('data-loadmore-less') && element.getAttribute('data-loadmore-less') == \"true\") ? true : false;\n var items = Array.prototype.slice.call(element.querySelectorAll(\"[data-loadmore-content]\"));\n var moreBtn = element.querySelector(\"[data-loadmore-button]\");\n var hiddenClass = 'd-none';\n var visibleCount = maxItems;\n\n var update = function () {\n var index = 0;\n\n if (moreBtn.hasAttribute('data-less'))\n visibleCount = maxItems;\n\n items.forEach(function (item) {\n if (item.hasAttribute(\"data-loadmore-skip\"))\n return;\n\n if (index < visibleCount)\n item.classList.remove(hiddenClass);\n else\n item.classList.add(hiddenClass);\n\n index++;\n });\n\n if (!useLessButton) {\n if (index <= visibleCount)\n moreBtn.classList.add(hiddenClass);\n else\n moreBtn.classList.remove(hiddenClass);\n } else {\n if (index <= maxItems)\n moreBtn.classList.add(hiddenClass);\n\n if (index <= visibleCount) {\n moreBtn.setAttribute('data-less', '');\n moreBtn.querySelector('a').innerHTML = moreBtn.querySelector('a').getAttribute('data-less-text');\n } else {\n moreBtn.removeAttribute('data-less', '');\n moreBtn.querySelector('a').innerHTML = moreBtn.querySelector('a').getAttribute('data-loadmore-text');\n }\n }\n\n document.autoimage.handle();\n };\n element.addEventListener(\"update\", update);\n\n moreBtn.addEventListener('click', function () {\n visibleCount += (useLessButton) ? 99999 : maxItems;\n update();\n });\n\n update();\n}"],"sourceRoot":""}