{"version":3,"sources":["webpack:///./Scripts/textrotator.js"],"names":["__webpack_require__","r","__webpack_exports__","element","settings","animation","separator","speed","current","words","animations","rotate","indexOf","style","opacity","classList","remove","setTimeout","add","length","textContent","keys","Object","i","dataset","split","map","x","trim","setInterval","init"],"mappings":"2FAAAA,EAAAC,EAAAC,GAAeA,EAAA,iBAAAC,GACX,IAAIC,GAAaC,UAAW,OAAQC,UAAW,IAAKC,MAAO,KACvDC,EAAU,EACVC,KACAC,GAAc,OAAQ,SAAU,QAAS,QAsB7C,SAASC,IACDD,EAAWE,QAAQR,EAASC,YAAc,IAC1CF,EAAQU,MAAMC,QAAU,EACxBX,EAAQY,UAAUC,OAAOZ,EAASC,WAElCY,WAAW,WACP,OAAOd,EAAQY,UAAUG,IAAId,EAASC,YACvC,IAEHG,EAAUA,IAAYC,EAAMU,OAAS,EAAI,EAAIX,EAAU,EACvDL,EAAQiB,YAAcX,EAAMD,KA9BpC,WAEI,IADA,IAAIa,EAAOC,OAAOD,KAAKjB,GACdmB,EAAI,EAAGA,EAAIF,EAAKF,OAAQI,IACzBpB,EAAQqB,QAAQH,EAAKE,MACrBnB,EAASiB,EAAKE,IAAMpB,EAAQqB,QAAQH,EAAKE,KAIjDd,EAAQN,EAAQiB,YAAYK,MAAMrB,EAASE,WAAWoB,IAAI,SAAUC,GAChE,OAAOA,EAAEC,SAGbzB,EAAQiB,YAAcX,EAAMD,GAExBC,EAAMU,QAAU,GAGpBU,YAAYlB,EAAQP,EAASG,OAiBjCuB","file":"10.js","sourcesContent":["export default element => {\n var settings = { animation: 'fade', separator: ',', speed: 1000 };\n var current = 0;\n var words = [];\n var animations = ['fade', 'bounce', 'slide', 'zoom'];\n\n function init() {\n var keys = Object.keys(settings);\n for (var i = 0; i < keys.length; i++) {\n if (element.dataset[keys[i]]) {\n settings[keys[i]] = element.dataset[keys[i]];\n }\n }\n\n words = element.textContent.split(settings.separator).map(function (x) {\n return x.trim();\n });\n\n element.textContent = words[current];\n\n if (words.length <= 1)\n return;\n\n setInterval(rotate, settings.speed);\n }\n\n function rotate() {\n if (animations.indexOf(settings.animation) > -1) {\n element.style.opacity = 0;\n element.classList.remove(settings.animation);\n\n setTimeout(function () {\n return element.classList.add(settings.animation);\n }, 20);\n\n current = current === words.length - 1 ? 0 : current + 1;\n element.textContent = words[current];\n }\n }\n\n init();\n};"],"sourceRoot":""}