{"version":3,"sources":["webpack:///./LeLab.Web/src/js/img-loaded-class.entry.js"],"names":["body","document","ImgLoadedClass","img","classes","dataset","loadedClass","replace","split","push","isTriggerBack","classList","add","addEventListener","e","target","matches","querySelectorAll","forEach","complete"],"mappings":"4FAAA,kBAEA,MAAMA,EAAOC,SAASD,KAGtB,SAASE,EAAeC,GACpB,IAAIC,EAAUD,EAAIE,QAAQC,YAC1BF,EAAUA,EAAQG,QAAQ,OAAQ,KAClCH,EAAUA,EAAQI,MAAM,KACxBJ,EAAQK,KAAKC,cAAkB,UAAY,aAC3CP,EAAIQ,UAAUC,OAAOR,GAGzBJ,EAAKa,iBACD,OACAC,IACQA,EAAEC,OAAOC,QAbJ,2BAcLd,EAAeY,EAAEC,UAGzB,GAGJf,EAAKiB,iBApBY,0BAoBeC,QAAQf,IAChCA,EAAIgB,UACJjB,EAAeC,O","file":"img-loaded-class.js","sourcesContent":["import { isTriggerBack } from \"barba\"\r\n\r\nconst body = document.body\r\nconst selector = 'img[data-loaded-class]'\r\n\r\nfunction ImgLoadedClass(img) {\r\n let classes = img.dataset.loadedClass\r\n classes = classes.replace(/\\s+/g, \" \")\r\n classes = classes.split(\" \")\r\n classes.push(isTriggerBack() ? 'is-back' : 'is-foward')\r\n img.classList.add(...classes)\r\n}\r\n\r\nbody.addEventListener(\r\n 'load',\r\n e => {\r\n if (e.target.matches(selector)) {\r\n ImgLoadedClass(e.target)\r\n }\r\n },\r\n true // Use capture, image load event won't bubble up\r\n)\r\n\r\nbody.querySelectorAll(selector).forEach(img => {\r\n if (img.complete) {\r\n ImgLoadedClass(img)\r\n }\r\n})\r\n"],"sourceRoot":""}