{"version":3,"sources":["../../dev/j/freegsr-detect.js"],"names":["detect","avastGlobals","wrongDownlaodPopupClose","document","querySelector","chooseDifferentPopup","runDetect","enableFreegsrDetect","useExactIDs","onlyExactIDs","downloadButtonIDs","customDownloadIDs","length","buttonSelector","os","isWindows","i","toLowerCase","downloadButtons","querySelectorAll","chooseDifferentPopupClose","addEventListener","e","preventDefault","classList","add","setTimeout","click","remove"],"mappings":"CAAA,WACC,YACA,IAAIA,GAASC,aAAaD,OACxBE,EAA0BC,SAASC,cAAc,yDACjDC,EAAuBF,SAASC,cAAc,kDAC9CE,EAA2C,mBAAxBC,sBAAsCA,oBACzDC,EAAsC,mBAAjBC,eAA+BA,aACpDC,EAAiD,mBAAtBC,oBAAqCA,kBAAkBC,OAASD,mBAC1F,UACA,MACA,MACA,sBACA,MACA,MACA,cAEDE,EAAiB,EAEnB,IAAIP,GAAaN,EAAOc,GAAGC,WAAaV,EAAsB,CAC7D,IAAK,GAAIW,GAAI,EAAGA,EAAIN,EAAkBE,OAAQI,IACtB,KAAnBH,IACHA,GAAkB,MAEfL,GACHK,GAAkB,2CAA4CH,EAAkBM,GAAI,KACpFH,GAAkB,6CAA8CH,EAAkBM,GAAGC,cAAe,OAEpGJ,GAAkB,8BAA+BH,EAAkBM,GAAI,KACvEH,GAAkB,gCAAiCH,EAAkBM,GAAGC,cAAe,KAGzF,IAAIC,GAAkBf,SAASgB,iBAAiBN,GAC9CO,EAA4Bf,EAAqBc,iBAAiB,YAEpE,IAAID,EAAgBN,OACnB,IAAK,GAAII,GAAI,EAAGA,EAAIE,EAAgBN,OAAQI,IAC3CE,EAAgBF,GAAGK,iBAAiB,QAAS,SAASC,GACrDA,EAAEC,iBAEFlB,EAAqBmB,UAAUC,IAAI,cAG/BvB,GACHwB,WAAW,WACVxB,EAAwByB,SACtB,IAMP,IAAIP,EAA0BR,OAC7B,IAAK,GAAII,GAAI,EAAGA,EAAII,EAA0BR,OAAQI,IACrDI,EAA0BJ,GAAGK,iBAAiB,QAAS,SAASC,GAC/DA,EAAEC,iBACFlB,EAAqBmB,UAAUI,OAAO","file":"freegsr-detect.js","sourcesContent":["(function () {\n\t'use strict';\n\tvar detect = avastGlobals.detect,\n\t\t\twrongDownlaodPopupClose = document.querySelector('.js-notification-overlay-for-wrong-download .js-close'),\n\t\t\tchooseDifferentPopup = document.querySelector('.js-notification-overlay-for-different-product'),\n\t\t\trunDetect = typeof enableFreegsrDetect !== 'undefined' ? enableFreegsrDetect : false,\n\t\t\tuseExactIDs = typeof onlyExactIDs !== 'undefined' ? onlyExactIDs : false,\n\t\t\tdownloadButtonIDs = typeof customDownloadIDs !== 'undefined' && customDownloadIDs.length ? customDownloadIDs : [\n\t\t\t\t'FREEGSR',\n\t\t\t\t'AVC',\n\t\t\t\t'AVF',\n\t\t\t\t'DEFAULT-www.avg.com',\n\t\t\t\t'GSU',\n\t\t\t\t'RCD',\n\t\t\t\t'XPROMO-AVG',\n\t\t\t], // IDs source: https://docs.google.com/spreadsheets/d/18YCaKnJeUWJGzMVw6IO9YY2wKXak9CcktUJcO797K5I/edit#gid=1052215900\n\t\t\tbuttonSelector = '';\n\n\tif (runDetect && detect.os.isWindows && chooseDifferentPopup) {\n\t\tfor (var i = 0; i < downloadButtonIDs.length; i++) {\n\t\t\tif (buttonSelector !== '') {\n\t\t\t\tbuttonSelector += ', ';\n\t\t\t}\n\t\t\tif (useExactIDs) {\n\t\t\t\tbuttonSelector += 'a[href*=\"product=\"][data-download-name=\"'+ downloadButtonIDs[i] +'\"]';\n\t\t\t\tbuttonSelector += ', a[href*=\"product=\"][data-download-name=\"'+ downloadButtonIDs[i].toLowerCase() +'\"]';\n\t\t\t} else {\n\t\t\t\tbuttonSelector += 'a[href*=\"product=\"][href*=\"'+ downloadButtonIDs[i] +'\"]';\n\t\t\t\tbuttonSelector += ', a[href*=\"product=\"][href*=\"'+ downloadButtonIDs[i].toLowerCase() +'\"]';\n\t\t\t}\n\t\t}\n\t\tvar downloadButtons = document.querySelectorAll(buttonSelector),\n\t\t\t\tchooseDifferentPopupClose = chooseDifferentPopup.querySelectorAll('.js-close');\n\n\t\tif (downloadButtons.length) {\n\t\t\tfor (var i = 0; i < downloadButtons.length; i++) {\n\t\t\t\tdownloadButtons[i].addEventListener('click', function(e) {\n\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\tchooseDifferentPopup.classList.add('show-popup');\n\n\t\t\t\t\t// make sure possible popup is hidden (if have time, find out cleaner way)\n\t\t\t\t\tif (wrongDownlaodPopupClose) {\n\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\twrongDownlaodPopupClose.click();\n\t\t\t\t\t\t}, 1)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tif (chooseDifferentPopupClose.length) {\n\t\t\tfor (var i = 0; i < chooseDifferentPopupClose.length; i++) {\n\t\t\t\tchooseDifferentPopupClose[i].addEventListener('click', function(e) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tchooseDifferentPopup.classList.remove('show-popup');\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n})();\n"]}