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SAEbzB,EAAUG,MAAQsC,EAAQ,SAK9BzC,EAAUG,MAAQD,EAGtBF,EAAUmD,kBAAkBN,EAAgBA,EAChD,IAEAlB,EAAYG,iBAAiB,SAAS,SAAUM,GAE5CA,EAAEI,iBACFzC,EAAcC,EAAWC,EAC7B,IAEAyB,EAAgBI,iBAAiB,UAAU,SAAUM,GAEjDA,EAAEI,iBACFzC,EAAcC,EAAWC,EAC7B,GACJ,CACJ,EA5IWmB,KA8INgC,oBAAsB,SAAUC,EAAgBC,GAE7CC,OAAOC,MAAQ,KAEfH,EAAe3C,UAAUuB,OAAO,QAChCqB,EAAc5C,UAAUC,IAAI,UAI5B2C,EAAc5C,UAAUuB,OAAO,QAC/BoB,EAAe3C,UAAUC,IAAI,QAErC,CA6BJ,EAEAf,OAAOC,GAAGC,mBAAmBuB,O","sources":["webpack://netzkern.am/./src/Feature/ContentElements/code/Scripts/TeaserNumbersCheck/numbersVideoCheck.js"],"sourcesContent":["import(/* webpackChunkName: \"videoNumbersCheck\" */ '../../Styles/TeaserVideoNumbersCheck/videoNumbersCheck.scss');\r\n\r\nawait import(/* webpackChunkName: \"ajax\" */ 'Feature/Common/code/Scripts/Common/ajax');\r\n\r\nwindow.am = window.am || {};\r\n\r\nwindow.am.lotteryVideoNumber = new function ()\r\n{\r\n var that = this;\r\n\r\n that.init = function ()\r\n {\r\n var lotteryComponents = document.querySelectorAll(\".videoNumbers-check-container\");\r\n\r\n if (lotteryComponents == null)\r\n {\r\n return;\r\n }\r\n\r\n for (let i = 0; i < lotteryComponents.length; i++)\r\n {\r\n let inputText = lotteryComponents[i].querySelector(\".numbers-check-input-text-number\");\r\n let customErrorMessage = lotteryComponents[i].querySelector(\".numbers-check-error-message\");\r\n let checkNumberForm = lotteryComponents[i].querySelector(\".numbers-check-form\");\r\n let inputButton = lotteryComponents[i].querySelector(\".input-button\");\r\n let videoBox = lotteryComponents[i].querySelector(\".video-box\");\r\n let videoTextBoxButton = lotteryComponents[i].querySelector(\".video-text-box-button\");\r\n\r\n if (videoBox)\r\n {\r\n videoBox.addEventListener('click', function ()\r\n {\r\n videoTextBoxButton.click();\r\n });\r\n } \r\n\r\n document.addEventListener('click', function ()\r\n {\r\n if (customErrorMessage.classList.contains(\"error-active\"))\r\n {\r\n var errorMessageContent = customErrorMessage.querySelector('.message-content');\r\n errorMessageContent.innerHTML = \"\";\r\n customErrorMessage.classList.remove(\"error-active\");\r\n } \r\n });\r\n\r\n inputText.addEventListener('focus', function ()\r\n {\r\n let inputLabel = lotteryComponents[i].querySelector('.input-label');\r\n inputLabel.style.fontWeight = \"bold\";\r\n\r\n });\r\n\r\n inputText.addEventListener('blur', function ()\r\n {\r\n let inputLabel = lotteryComponents[i].querySelector('.input-label');\r\n inputLabel.style.fontWeight = \"normal\";\r\n });\r\n\r\n inputText.addEventListener('keypress', function (e)\r\n {\r\n if (customErrorMessage.classList.contains(\"error-active\"))\r\n {\r\n customErrorMessage.classList.remove(\"error-active\");\r\n }\r\n\r\n var charCode = (e.which) ? e.which : e.keyCode\r\n\r\n //Key Code 31: with && charcode prevent to write !\"ยง$ ect., Key Code 48 = 0 , Key Code 57 = 9 , Key Code 32 = space\r\n if (charCode > 31 && (charCode < 48 || charCode > 57) || charCode == 32)\r\n {\r\n e.preventDefault();\r\n return false;\r\n }\r\n\r\n if (e.keyCode !== 8)\r\n {\r\n var inputTextWithoutSpaces = inputText.value.replace(/\\s/g, '');\r\n var chuncks = inputTextWithoutSpaces.match(/.{1,3}/g);\r\n\r\n if (chuncks != null)\r\n {\r\n var outputText = chuncks.join(\" \");\r\n inputText.value = outputText;\r\n }\r\n else\r\n {\r\n inputText.value = inputTextWithoutSpaces;\r\n }\r\n }\r\n });\r\n\r\n inputText.addEventListener('keyup', function (e)\r\n {\r\n let cursorPosition = inputText.selectionStart + 1;\r\n let isEdit = inputText.selectionStart !== inputText.value.length;\r\n let code = e.keyCode;\r\n\r\n //key code: 8 -> backspace, 37 -> left arrow, 38 -> up arrow, 39 - > right arrow, 40 -> bottom arrow\r\n if (code === 8 || code === 37 || code === 38 || code === 39 || code === 40 || isEdit) {\r\n cursorPosition = cursorPosition - 1;\r\n }\r\n\r\n if (e.keyCode === 8 && inputText.value.endsWith(\" \"))\r\n {\r\n inputText.value = inputText.value.slice(0, -1);\r\n\r\n if (inputText.value.endsWith(\" \"))\r\n {\r\n inputText.value = inputText.value.slice(0, -1);\r\n }\r\n }\r\n\r\n var inputTextWithoutSpaces = inputText.value.replace(/\\s/g, '');\r\n var chuncks = inputTextWithoutSpaces.match(/.{1,3}/g);\r\n\r\n if (chuncks != null)\r\n {\r\n if (chuncks.length > 1)\r\n {\r\n var outputText = chuncks.join(\" \");\r\n inputText.value = outputText;\r\n }\r\n else if (chuncks.length == 1)\r\n {\r\n inputText.value = chuncks[0];\r\n }\r\n }\r\n else\r\n {\r\n inputText.value = inputTextWithoutSpaces;\r\n }\r\n\r\n inputText.setSelectionRange(cursorPosition, cursorPosition);\r\n });\r\n\r\n inputButton.addEventListener('click', function (e)\r\n {\r\n e.preventDefault();\r\n performSubmit(inputText, customErrorMessage);\r\n });\r\n\r\n checkNumberForm.addEventListener('submit', function (e)\r\n {\r\n e.preventDefault();\r\n performSubmit(inputText, customErrorMessage); \r\n });\r\n }\r\n } \r\n\r\n that.checkAppLinkDisplay = function (AppLinkDesktop, AppLinkMobile)\r\n {\r\n if (screen.width > 768)\r\n {\r\n AppLinkDesktop.classList.remove(\"hide\");\r\n AppLinkMobile.classList.add(\"hide\");\r\n }\r\n else\r\n {\r\n AppLinkMobile.classList.remove(\"hide\");\r\n AppLinkDesktop.classList.add(\"hide\");\r\n }\r\n }\r\n\r\n function performSubmit(inputText, customErrorMessage)\r\n {\r\n var inputTextWithoutSpaces = inputText.value.replace(/\\s/g, '');\r\n\r\n var url = '/api/sitecore/RaffleTicketCheck/CheckNumber?numberToCheck=' + inputTextWithoutSpaces;\r\n\r\n var successCallback = function (response)\r\n {\r\n if (!response.Error)\r\n {\r\n var dataSuccessAttribute = document.querySelector('[data-lottery-success-link]');\r\n\r\n var successUrl = dataSuccessAttribute.dataset.lotterySuccessLink + inputTextWithoutSpaces;\r\n window.location = successUrl;\r\n }\r\n else\r\n {\r\n customErrorMessage.classList.add(\"error-active\");\r\n customErrorMessage.classList.add(\"error\");\r\n\r\n var errorMessageContent = customErrorMessage.querySelector('.message-content'); \r\n errorMessageContent.innerHTML = response.ErrorMessage;\r\n }\r\n };\r\n\r\n window.am.ajax.sendRequest(url, \"GET\", successCallback);\r\n }\r\n}\r\n\r\nwindow.am.lotteryVideoNumber.init()"],"names":["window","am","lotteryVideoNumber","performSubmit","inputText","customErrorMessage","inputTextWithoutSpaces","value","replace","url","ajax","sendRequest","response","Error","classList","add","querySelector","innerHTML","ErrorMessage","successUrl","document","dataset","lotterySuccessLink","location","this","init","lotteryComponents","querySelectorAll","i","length","checkNumberForm","inputButton","videoBox","videoTextBoxButton","addEventListener","click","contains","remove","style","fontWeight","e","charCode","which","keyCode","preventDefault","chuncks","match","outputText","join","cursorPosition","selectionStart","isEdit","code","endsWith","slice","setSelectionRange","checkAppLinkDisplay","AppLinkDesktop","AppLinkMobile","screen","width"],"sourceRoot":""}