{"version":3,"sources":["../../../../dev/j/v2/components/cmp-sticky-bar.js"],"names":["console","log"],"mappings":"AAAAA,QAAQC,IAAI","file":"cmp-sticky-bar.js","sourcesContent":["console.log('OSB'); // OSB = Old sticky bar. Console hint on which pages this script can be removed.\n/* (function() {\n\t'use strict';\n\ttry {\n \n\t\t\n\n\t\tvar\n\t\t\tstickyBars = document.querySelectorAll('.sticky-bar'),\n\t\t\tbuttons = document.querySelectorAll('.sticky-bar a'),\n\t\t\twaypoint = '.sticky-waypoint',\n\t\t\ttable = '.tables-common.sticky-header, .tables.tables--sticky',\n\t\t\ttableTop = '.tables-common.sticky-header thead, .tables.tables--sticky thead',\n\t\t\twaypoints = avm.require('avast.web.waypoints');\n\n\n\t\t// (un)set all sticky bar buttons to be tabable\n\t\tfunction changeTabindex(value) {\n\t\t\tbuttons.forEach(function(button){\n\t\t\t\tbutton.setAttribute('tabindex', value);\n\t\t\t});\n\t\t}\n\n\t\t// (un)set class to sticky bar\n\t\tfunction makeSticky(bool) {\n\t\t\tstickyBars.forEach(function(bar){\n\t\t\t\tif (bool) {\n\t\t\t\t\tbar.classList.add('is-sticky');\n\t\t\t\t\tchangeTabindex(0);\n\t\t\t\t} else {\n\t\t\t\t\tbar.classList.remove('is-sticky');\n\t\t\t\t\tchangeTabindex(-1);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t// sticky params changes logic\n\t\tfunction stickyParams() {\n\t\t\tif (\n\t\t\t\twaypoints(waypoint, null, null, true) // sticky-waypoint is on top or above viewport AND\n\t\t\t\t&& (\n\t\t\t\t\t!waypoints(tableTop, -64, null, true) // top of the sticky table (minus height of the bar) is above viewport OR\n\t\t\t\t\t|| !waypoints(table) // table is in viewport\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tmakeSticky(true);\n\t\t\t} else {\n\t\t\t\tmakeSticky(false);\n\t\t\t}\n\t\t}\n\n\t\t// initially disable all sticky bar buttons from tabbing scope\n\t\tchangeTabindex(-1);\n\t\t\n\n\t\t// event listeners assignment only if waypoint class exists\n\t\tif (waypoint) {\n\t\t\twindow.addEventListener('scroll', function () {\n\t\t\t\tstickyParams();\n\t\t\t});\n\n\t\t\twindow.addEventListener('resize', function () {\n\t\t\t\tstickyParams();\n\t\t\t});\n\t\t}\n\t\t\n\n\t} catch (error) {\n\t\t// singe data layer error tracking\n\t\tif (typeof sdl !== 'undefined') {\n\t\t\tconsole.error(error);\n\t\t\tsdl.push({\n\t\t\t\tsystem: {\n\t\t\t\t\terror: {\n\t\t\t\t\t\ttype: error.name,\n\t\t\t\t\t\tmessage: error.message,\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tevent: 'system.error'\n\t\t\t});\n\t\t}\n\t}\n})();\n */"]}