{"version":3,"sources":["../../dev/j/store.js"],"names":["setStickyMargin","headerElems","margin","$window","innerWidth","removeAttr","css","filterClick","evt","target","currentTarget","filterElements","hash","substr","$","removeClass","platform","filterContent","selector","all","document","querySelectorAll","forEach","el","classList","remove","querySelector","add","scrollToSection","element","hasClass","minusPos","sectionSelect","position","attr","offset","top","animate","scrollTop","$details","$thProduct","waypoints","avm","require","hashVal","window","location","platformsArray","each","push","this","length","indexOf","on","substring","click","parent","find","slideToggle","toggleClass","event","preventDefault","section","replace","sel","trim","$visibleTable","$tableFooter","addClass","outerHeight","avastGlobals","web","locale","ready","selectsList","Array","prototype","slice","call","key","closest","dataset","actionboxDecoupledSelect","appendChild","IntersectionObserver","tableStickyWaypoints","topStickyWaypoint","tableStickyWaypoint","entries","entry","intersectionRatio","fadeIn","threshold","observe","e"],"mappings":"CAAA,WACC,YA+BA,SAASA,GAAgBC,EAAaC,GACrC,GAAIC,EAAQC,aAAe,OAASF,EAEnC,WADAD,GAAYI,WAAW,QAGxBJ,GAAYK,IAAI,eAAgBJ,GAChCD,EAAYK,IAAI,aAAcJ,GAa/B,QAASK,GAAYC,GACpB,GAAIC,GAASD,EAAIE,aAGjBC,GAFUF,GAAUA,EAAOG,KAAOH,EAAOG,KAAKC,OAAO,GAAK,OAI1DC,EAAE,4BAA4BC,YAAY,aAO3C,QAASJ,GAAeK,GAEvBC,EAAc,KAAOD,EAAU,aAG/BC,EAAc,aAAeD,EAAU,+BAGvCC,EAAc,YAAcD,EAAU,oBAQvC,QAASC,GAAcC,EAAUC,GAChCC,SAASC,iBAAiBF,GAAKG,QAAQ,SAASC,GAC/CA,EAAGC,UAAUC,OAAO,YAGrBL,SAASM,cAAcR,GAAUM,UAAUG,IAAI,UAqGhD,QAASC,GAAgBC,GACxB,GAAIf,EAAE,iDAAiDgB,SAAS,aAC/D,GAAIC,GAAW,QAEf,IAAIA,GAAW,GAGhB,IAAIC,GAAgB,EAChBlB,GAAE,gBAAgBgB,SAAS,UAC9BE,EAA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GjDL,EAAmB,CACP,GAAIF,sBAClB,SAAUI,GACTA,EAAQlE,QAAQ,SAAUmE,GACrBA,EAAMC,mBAAqB,EAC9B5E,EAAE,oBAAoBC,YAAY,cAAc4E,OAAO,KAEvD7E,EAAE,oBAAoBsD,SAAS,cAAcuB,OAAO,SAIrDC,UAAW,IAELC,QAAQP,OAEjBxE,GAAE,oBAAoBsD,SAAS,cAAcuB,OAAO,KA8BtD7E,EAAE,0BAA0BuC,GAAG,QAAS,SAASyC,GAChDA,EAAEjC,iBACFjC,EAAgBsB,QAGjBpC,EAAE,kCAAkCyC,MAAM,SAASuC,GAClDA,EAAEjC,iBACFjC,EAAgBsB","file":"store.js","sourcesContent":["(function() {\n\t'use strict';\n\tvar $actionbox = '.js-col-actionbox',\n\t\t$details = $('.js-details'),\n\t\t$thProduct = $('#comparison table thead th.product:not(.feature)'),\n\t\twaypoints = avm.require('avast.web.waypoints'),\n\t\thashVal = window.location.hash.substr(1),\n\t\tplatformsArray = [],\n\t\t$window = $(window);\n\n\t// set filter by url hash\n\t$('.filter a').each(function(){platformsArray.push(this.hash.substr(1))});\n\tif(hashVal.length>0 && platformsArray.indexOf(hashVal) !== -1) {\n\t\tfilterElements(hashVal)\n\t}\n\t// set listener on hash change\n\t$window.on('hashchange', function(){\n\t\tif (platformsArray.indexOf(window.location.hash.substr(1)) !== -1) {\n\t\t\tfilterElements(window.location.hash.substr(1))\n\t\t}\n\t\tif (window.location.hash.substring(1) !== -1) {\n\t\t\tif(window.location.hash.substring(1) === 'mac' ) {\n\t\t\t\t$('.text-small.js-pc').css('display','none');\n\t\t\t\t$('.text-small.js-mac').css('display','inline-flex');\n\t\t\t} else if (window.location.hash.substring(1) === 'pc'){\n\t\t\t\t$('.text-small.js-mac').css('display','none');\n\t\t\t\t$('.text-small.js-pc').css('display','inline-flex');\n\t\t\t}\n\t\t}\n\t})\n\n\t// add margin for footer offset on mobile\n\tfunction setStickyMargin(headerElems, margin) {\n\t\tif ($window.innerWidth() > 1055 || !margin) {\n\t\t\theaderElems.removeAttr('style')\n\t\t\treturn\n\t\t}\n\t\theaderElems.css('marginBottom', margin)\n\t\theaderElems.css('marginTop', -margin)\n\t}\n\n\n\t// Initialy synthetic all-products click\n\n\t// Bind click to filter\n\t$('.filter').on('click', 'a', filterClick);\n\n\t/**\n\t *\n\t * @param {Object} evt\n\t */\n\tfunction filterClick(evt) {\n\t\tvar target = evt.currentTarget,\n\t\t\tsuffix = target && target.hash ? target.hash.substr(1) : 'all';\n\n\t\tfilterElements(suffix)\n\n\t\t$('.js-avg-comparison-table').removeClass('is-sticky');\n\t}\n\n\t/**\n\t * set of filtered elements\n\t * @param {string} platform\n\t */\n\tfunction filterElements(platform) {\n\t\t// Highlight filter buttons\n\t\tfilterContent('a.' + platform, '.filter a');\n\n\t\t// Switch headlines\n\t\tfilterContent('.headline-' + platform, '#top h1[class^=\"headline-\"]');\n\n\t\t// Switch sections\n\t\tfilterContent('#section-' + platform, '[id^=\"section-\"]');\n\t}\n\n\t/**\n\t * filterContent Switch content visibility\n\t * @param {String} selector Selector for element to be switched on and visible on page.\n\t * @param {String} all Selector for all elements to be switched off and to be hidden.\n\t */\n\tfunction filterContent(selector, all) {\n\t\tdocument.querySelectorAll(all).forEach(function(el) {\n\t\t\tel.classList.remove('active');\n\t\t});\n\n\t\tdocument.querySelector(selector).classList.add('active');\n\t}\n\n\n\t// Mobile version detail toggler\n\t$details.click(function() {\n\t\t$(this).parent().find($actionbox).slideToggle();\n\t\t$(this).toggleClass('close');\n\t\tevent.preventDefault();\n\t });\n\n\t$window.on('resize scroll', function() {\n\t\tvar section = $('.filter .filter-items .active').attr('class').replace('active', ''),\n\t\t\tsel = section ? '#section-' + section.trim() + ' .js-avg-comparison-table' : null,\n\t\t\t$visibleTable = $('section.active[role=\"tabpanel\"] #comparison .avg-comparison-table:visible'),\n\t\t\t$tableFooter = null;\n\n\t\tif ($visibleTable.length) {\n\t\t\t$tableFooter = $visibleTable.find('tfoot')\n\t\t\tif (!$tableFooter.length) {\n\t\t\t\t$tableFooter = $visibleTable.find('tbody tr.border + tr')\n\t\t\t}\n\t\t}\n\n\t\tif (sel && waypoints($(sel), null, null, true)) {\n\t\t\t$(sel).addClass('is-sticky');\n\t\t\tif ($thProduct.length && $tableFooter.length) {\n\t\t\t\tsetStickyMargin($thProduct, $tableFooter.outerHeight());\n\t\t\t}\n\t\t} else {\n\t\t\t$('.js-avg-comparison-table').removeClass('is-sticky');\n\t\t\tif ($thProduct.length) {\n\t\t\t\tsetStickyMargin($thProduct);\n\t\t\t}\n\t\t}\n\t});\n\n\t// Move togglers to the top of the table\n\t// hotsale don't move toggler\n\tif (avastGlobals.web.locale !== 'en-us' && avastGlobals.web.locale !== 'en-gb') {\n\t\t$(document).ready(function() {\n\t\t\tvar selectsList = document.querySelectorAll('[data-actionbox-decoupled-select] .toggler'),\n\t\t\t\tselects = Array.prototype.slice.call(selectsList);\n\n\t\t\tselects.forEach(function(el) {\n\t\t\t\tvar key = el.closest('[data-actionbox-decoupled-select]').dataset.actionboxDecoupledSelect,\n\t\t\t\t\ttarget = el.closest('table').querySelector('[data-actionbox-decoupled-select-target=\"' + key + '\"]');\n\n\t\t\t\tif (target) {\n\t\t\t\t\ttarget.appendChild(el);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\t// GLOWEB-5962 -- Back To School - Sticky message bar\n\tif (window.IntersectionObserver && (avastGlobals.web.locale == 'en-ww' || avastGlobals.web.locale == 'en-us' || avastGlobals.web.locale == 'en-gb')) {\n\t\tvar tableStickyWaypoints = document.querySelectorAll(\".avg-comparison-table\");\n\t\tvar topStickyWaypoint = document.querySelector(\"#top\");\n\n\t\tif (tableStickyWaypoints && tableStickyWaypoints.length > 0) {\n\t\t\ttableStickyWaypoints.forEach(function (tableStickyWaypoint) {\n\n\t\t\t\tvar observer = new IntersectionObserver(\n\t\t\t\t\tfunction (entries) {\n\t\t\t\t\t\tentries.forEach(function (entry) {\n\t\t\t\t\t\t\tif (entry.intersectionRatio <= 0) {\n\t\t\t\t\t\t\t\t$('.message-bar.bts').addClass('bts-sticky').fadeIn(1000);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t$('.message-bar.bts').removeClass('bts-sticky').fadeIn(1000);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\t{ threshold: 0 }\n\t\t\t\t);\n\t\t\t\tobserver.observe(tableStickyWaypoint);\n\t\t\t});\n\t\t} else {\n\t\t\t$('.message-bar.bts').addClass('bts-sticky').fadeIn(1000);\n\t\t}\n\n\t\tif (topStickyWaypoint) {\n\t\t\tvar observer = new IntersectionObserver(\n\t\t\t\tfunction (entries) {\n\t\t\t\t\tentries.forEach(function (entry) {\n\t\t\t\t\t\tif (entry.intersectionRatio <= 0) {\n\t\t\t\t\t\t\t$('.message-bar.bts').removeClass('bts-sticky').fadeIn(1000);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$('.message-bar.bts').addClass('bts-sticky').fadeIn(1000);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\t{ threshold: 0 }\n\t\t\t);\n\t\t\tobserver.observe(topStickyWaypoint);\n\t\t} else {\n\t\t\t$('.message-bar.bts').addClass('bts-sticky').fadeIn(1000);\n\t\t}\n\t}\n\n\t// mobile sticky table header buttons scroll fix\n\tfunction scrollToSection(element) {\n\t\tif ($(\".avg-comparison-table.js-avg-comparison-table\").hasClass('is-sticky')) {\n\t\t\tvar minusPos = 235;\n\t\t} else {\n\t\t\tvar minusPos = 470;\n\t\t}\n\n\t\tvar sectionSelect = \"\";\n\t\tif ($(\"#section-all\").hasClass('active')) {\n\t\t\tsectionSelect = \"#section-all \";\n\t\t} else if ($(\"#section-pc\").hasClass('active')) {\n\t\t\tsectionSelect = \"#section-pc \";\n\t\t} else if ($(\"#section-mac\").hasClass('active')) {\n\t\t\tsectionSelect = \"#section-mac \";\n\t\t} else if ($(\"#section-mobile\").hasClass('active')) {\n\t\t\tsectionSelect = \"#section-mobile \";\n\t\t}\n\n\t\tvar position = $(sectionSelect + $(element).attr(\"href\")).offset().top;\n\n\t\t$(\"body, html\").animate({\n\t\t\tscrollTop: position - minusPos\n\t\t} /* speed */ );\n\t}\n\n\t$(\"a[href^='#'].btn-store\").on('click', function(e) {\n\t\te.preventDefault();\n\t\tscrollToSection(this);\n\t});\n\n\t$(\"a[href^='#'].btn-store-outline\").click(function(e) {\n\t\te.preventDefault();\n\t\tscrollToSection(this);\n\t});\n\n})();\n"]}