{"version":3,"sources":["../../../../dev/j/v2/pages/lp-avast-one-paid.js"],"names":["initModal","element","modalButton","querySelector","modalTarget","getAttribute","addEventListener","loadModal","e","charCode","target","document","getElementById","contentHolder","xhr","XMLHttpRequest","onreadystatechange","this","readyState","status","container","createElement","innerHTML","responseText","append","BSN","Modal","show","open","avastGlobals","web","domain","locale","setRequestHeader","send","getCurrentPlatform","jsClasses","js-pc","js-mac","js-android","js-ios","key","hasOwnProperty","$","hasClass","avm","require","$open","$close","$openComparison","$closeComparison","trialDownloadIDs","pc","mac","android","ios","detectedPlatform","detect","os","name","toLowerCase","configCurrentPage","pathnameSplitted","window","location","pathname","split","length","supported-platform","product-id","Vue","el","data","activeVal","methods","toggleActive","mounted","$el","updated","delimiters","on","parents","find","addClass","$target","removeClass","parent","next","$openButton","prev","scrollTo","top","offset","innerHeight","left","behavior","scrolledTop","pageYOffset","stickyBar","comarisonTable","outerHeight"],"mappings":"CAAA,WACC,YAoEA,SAASA,GAAUC,GAClB,GAAIC,GAAcD,EAAQE,cAAc,yBACvCC,EAA8B,OAAhBF,EAAuBA,EAAYG,aAAa,eAAiB,IAE5D,QAAhBH,GAAwC,OAAhBE,IAC3BF,EAAYI,iBAAiB,QAAS,WACrCC,EAAUH,KAGXF,EAAYI,iBAAiB,WAAY,SAASE,GAC9B,KAAfA,EAAEC,UACLF,EAAUH,MAMd,QAASG,GAAUG,GAElB,GAAwC,OAApCC,SAASC,eAAeF,GAAkB,CAC7C,GAAIG,GAAgBF,SAASR,cAAc,mBAC1CW,EAAM,GAAIC,eAEXD,GAAIE,mBAAqB,WACxB,GAAuB,GAAnBC,KAAKC,YAAkC,KAAfD,KAAKE,OAAe,CAE/C,GAAIC,GAAYT,SAASU,cAAc,MAEvCD,GAAUE,UAAYL,KAAKM,aAC3BV,EAAcW,OAAOJ,EAET,IAAIK,KAAIC,MAAMf,SAASC,eAAeF,IAC5CiB,SAIRb,EAAIc,KAAK,MAAO,WAAaC,aAAaC,IAAIC,OAAS,IA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AOgC,GAAG,QAAS,WAClB,GAAII,GAAUzC,EAAE1B,MAAMgE,QAAQ,uBACfG,GAAQH,QAAQ,WAAWC,KAAK,YAEnCG,YAAY,UACxBD,EAAQC,YAAY,UAGrBpC,EAAgB+B,GAAG,QAAS,WACbrC,EAAE1B,MAAMqE,SAASC,KAAK,0BAE5BJ,SAAS,QACjBxC,EAAE1B,MAAMkE,SAAS,YAGlBjC,EAAiB8B,GAAG,QAAS,WAC5B,GAAII,GAAUzC,EAAE1B,MAAMgE,QAAQ,0BAC7BO,EAAcJ,EAAQK,OAAOP,KAAK,sBAEnCM,GAAYH,YAAY,UACxBD,EAAQC,YAAY,QAEpB1C,EAAE,eAAe0C,YAAY,UAE7BtB,OAAO2B,UACNC,IAAKH,EAAYI,SAASD,IAAM5B,OAAO8B,YAAc,EACrDC,KAAM,EACNC,SAAU,aAIZpD,EAAEoB,QAAQiB,GAAG,SAAU,WACtB,GAAIgB,GAAcjC,OAAOkC,YACrBC,EAAYvD,EAAE,eACdwD,EAAiBxD,EAAE,8BAClBwD,GAAehC,SAGhB6B,EAAcG,EAAeP,SAASD,KAAOK,EAAcG,EAAeP,SAASD,IAAMQ,EAAeC,cAC3GF,EAAUf,SAAS,UAEnBe,EAAUb,YAAY","file":"lp-avast-one-paid.js","sourcesContent":["(function() {\n\t'use strict';\n\tvar $ = avm.require('jquery'),\n\t\t$open = $('.js-open'),\n\t\t$close = $('.js-close'),\n\t\t$openComparison = $('.js-open-comparison'),\n\t\t$closeComparison = $('.js-close-comparison'),\n\t\ttrialDownloadIDs = {\n\t\t\tpc: 'AVAST-ONE-FREE-WIN-PP',\n\t\t\tmac: 'AVAST-ONE-FREE-MAC-PP',\n\t\t\tandroid: 'AVAST-ONE-ANDROID-PP',\n\t\t\tios: 'AVAST-ONE-IOS-PP'\n\t\t},\n\t\tdetectedPlatform = avastGlobals.detect.os.name.toLowerCase(),\n\t\t$document = $(document),\n\t\tcurrentPageName = getCurrentPageName(),\n\t\tsupportedPlatforms = {\n\t\t\tandroid: {\n\t\t\t\ttext: 'Android',\n\t\t\t\tstyle: 'google-play.png'\n\t\t\t},\n\t\t\tios: {\n\t\t\t\ttext: 'iOS',\n\t\t\t\tstyle: 'app-store.png'\n\t\t\t},\n\t\t\tmac: {\n\t\t\t\ttext: 'Mac',\n\t\t\t\tstyle: 'logo-mac'\n\t\t\t},\n\t\t\tpc: {\n\t\t\t\ttext: 'Windows',\n\t\t\t\tstyle: 'logo-win'\n\t\t\t}\n\t\t},\n\t\tdefaultIconName = 'google-play.png',\n\t\tconfigCurrentPage = {\n\t\t\t'supported-platform': getCurrentPlatform(),\n\t\t\t'product-id': trialDownloadIDs[getCurrentPlatform()]\n\t\t},\n\t\tpageSupportedPlatform = configCurrentPage['supported-platform'].toLowerCase();\n\n\t// fix platform name\n\tif (detectedPlatform === 'windows') {\n\t\tdetectedPlatform = 'pc';\n\t}\n\n\tvar cardToggler = new Vue({\n\t el: '#card-toggler',\n\t data: {\n\t activeVal: 'individual'\n\t },\n\t methods: {\n\t toggleActive: function(name) {\n\t this.activeVal = name;\n\t }\n\t },\n\t mounted: function() {\n\t\t\tif (avastGlobals.web.locale === 'en-us' || avastGlobals.web.locale === 'en-gb') {\n\t\t\t\tinitModal(this.$el);\n\t\t\t}\n\t },\n\t updated: function() {\n\t\t\tif (avastGlobals.web.locale === 'en-us' || avastGlobals.web.locale === 'en-gb') {\n\t\t\t\tinitModal(this.$el);\n\t\t\t}\n\t },\n\t delimiters: ['<%', '%>']\n\t});\n\n\tfunction initModal(element) {\n\t\tvar modalButton = element.querySelector('[data-toggle=\"modal\"]'),\n\t\t\tmodalTarget = modalButton !== null ? modalButton.getAttribute('data-target') : null;\n\n\t\tif (modalButton !== null && modalTarget !== null) {\n\t\t\tmodalButton.addEventListener('click', function() {\n\t\t\t\tloadModal(modalTarget);\n\t\t\t});\n\n\t\t\tmodalButton.addEventListener('keypress', function(e) {\n\t\t\t\tif (e.charCode === 13) {\n\t\t\t\t\tloadModal(modalTarget);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tfunction loadModal(target) {\n\t\t// !!make sure name of source page for modal and target in modal trigger are same!!\n\t\tif (document.getElementById(target) === null) {\n\t\t\tvar contentHolder = document.querySelector('.content-holder'),\n\t\t\t\txhr = new XMLHttpRequest();\n\n\t\t\txhr.onreadystatechange = function() {\n\t\t\t\tif (this.readyState == 4 && this.status == 200) {\n\n\t\t\t\t\tvar container = document.createElement('div');\n\n\t\t\t\t\tcontainer.innerHTML = this.responseText;\n\t\t\t\t\tcontentHolder.append(container);\n\n\t\t\t\t\tvar modal = new BSN.Modal(document.getElementById(target));\n\t\t\t\t\tmodal.show();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\txhr.open('GET', 'https://' + avastGlobals.web.domain + '/' + avastGlobals.web.locale + '/' + target, true);\n\t\t\txhr.setRequestHeader('x-requested-with', 'XMLHttpRequest');\n\t\t\txhr.send(null);\n\t\t} else {\n\t\t\tvar modal = new BSN.Modal(document.getElementById(target));\n\t\t\tmodal.show();\n\t\t}\n\t}\n\n\t$open.on('click', function() {\n\t\tvar $target = $(this).parents('section').find('.js-features-content');\n\n\t\t$target.addClass('show');\n\t\t$(this).addClass('d-none');\n\t});\n\n\t$close.on('click', function() {\n\t\tvar $target = $(this).parents('.js-features-content'),\n\t\t\t$openButton = $target.parents('section').find('.js-open');\n\n\t\t$openButton.removeClass('d-none');\n\t\t$target.removeClass('show');\n\t});\n\n\t$openComparison.on('click', function() {\n\t\tvar $target = $(this).parent().next('.js-comparison-content');\n\n\t\t$target.addClass('show');\n\t\t$(this).addClass('d-none');\n\t});\n\n\t$closeComparison.on('click', function() {\n\t\tvar $target = $(this).parents('.js-comparison-content'),\n\t\t\t$openButton = $target.prev().find('.js-open-comparison');\n\n\t\t$openButton.removeClass('d-none');\n\t\t$target.removeClass('show');\n\n\t\t$('.sticky-bar').removeClass('hidden');\n\n\t\twindow.scrollTo({\n\t\t\ttop: $openButton.offset().top - window.innerHeight / 2,\n\t\t\tleft: 0,\n\t\t\tbehavior: 'smooth'\n\t\t});\n\t});\n\n\t$(window).on('scroll', function() {\n\t\tvar scrolledTop = window.pageYOffset;\n\t\tvar stickyBar = $('.sticky-bar');\n\t\tvar comarisonTable = $('.js-comparison-content.show');\n\t\tif (!comarisonTable.length) {\n\t\t\treturn;\n\t\t}\n\t\tif (scrolledTop > comarisonTable.offset().top && scrolledTop < comarisonTable.offset().top + comarisonTable.outerHeight()) {\n\t\t\tstickyBar.addClass('hidden');\n\t\t} else {\n\t\t\tstickyBar.removeClass('hidden');\n\t\t}\n\t});\n\n\t// get current js-${platform} class\n\tfunction getCurrentPlatform() {\n\t\tvar jsClasses = {\n\t\t\t'js-pc': 'pc',\n\t\t\t'js-mac': 'mac',\n\t\t\t'js-android': 'android',\n\t\t\t'js-ios': 'ios'\n\t\t};\n\t\tfor (var key in jsClasses) {\n\t\t\tif (jsClasses.hasOwnProperty(key)) {\n\t\t\t\tif ($('html').hasClass(key)) {\n\t\t\t\t\treturn jsClasses[key];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn 'pc';\n\t}\n\n\tfunction getCurrentPageName() {\n\t\tvar pathnameSplitted = window.location.pathname.split('/');\n\t\treturn pathnameSplitted[pathnameSplitted.length - 1];\n\t}\n\n})();\n"]}