{"version":3,"file":"default/js/content.js","sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/app_ua_core/cartridge/client/default/js/content.js"],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./cartridges/app_ua_core/cartridge/client/default/js/content.js\");\n","'use strict';\n\n$(document).ready(function () {\n    var $cache = {\n        input: $('.faq__input'),\n        results: $('.faq__results'),\n        menu: $('.faq__menu'),\n        footer: $('footer#footercontent'),\n        accordion: $('.accordion'),\n        accordionMobile: $('.accordion-mobile'),\n        contentLinks: $('.content-links'),\n        d: $(document),\n        w: $(window)\n    };\n\n    /**\n     * to clear the results\n    * */\n    function clearResults() {\n        $cache.results.html('');\n    }\n\n    /**\n     * to scroll the browser on click of sub nav\n     *  @param {number} xLocation - scrolled to this position\n    * */\n    function scrollBrowser(xLocation) {\n        var $scrollBasis = $('html,body');\n        var $wrapper = $('.faq__wrapper');\n        var $globalPromo = $('#global-promo:visible');\n        var $header = $('header.l-header:visible');\n        var stickNavTop = 0;\n        var fullHeaderHeight = ($globalPromo.length ? $globalPromo.height() : 0) + ($header.length ? $header.height() : 0);\n\n        if (xLocation < $('.faq__wrapper').offset().top) {\n            $scrollBasis.animate({ scrollTop: xLocation }, 500);\n            return;\n        }\n\n        // if it need to change header height\n        if ($(window).scrollTop() < stickNavTop) {\n            $scrollBasis.animate({ scrollTop: stickNavTop }, 100, function () {\n                var wrapperTopBefore = $wrapper.offset().top; // wrapper top position when header is big\n                var wrapperTopDifference = wrapperTopBefore - $wrapper.offset().top; // wrapper top position difference\n                fullHeaderHeight = ($globalPromo.length ? $globalPromo.height() : 0) + ($header.length ? $header.height() : 0) + wrapperTopDifference;\n                $scrollBasis.animate({ scrollTop: xLocation - fullHeaderHeight }, 500);\n            });\n        } else {\n            $scrollBasis.animate({ scrollTop: xLocation - fullHeaderHeight }, 500);\n        }\n    }\n\n    /**\n     * to search from FAQ search field\n     *  @param {string} term - search the string passed\n    * */\n    function searchMe(term) {\n        if ($cache.input.val() !== '') {\n            clearResults();\n            $('.faq__category').each(function (i) {\n                var $this = $(this);\n                var Nid = $this.attr('id');\n                if ($this.text().search(new RegExp(term, 'i')) !== -1) {\n                    $cache.results.append('<div class=\"faq__answer faq' + i + '\"><a class=\"faq__named\" href=\"#' + Nid + '\" role=\"control\">' + Nid.replace(/_/g, ' ') + '</a></div>');\n                    $('#' + Nid + ' .faq__q-and-a').each(function () {\n                        var $thisqa = $(this);\n                        if ($thisqa.text().search(new RegExp(term, 'i')) !== -1) {\n                            $thisqa.clone().appendTo('.faq__answer.faq' + i);\n                        }\n                    });\n\n                    if ($('.faq__answer.faq' + i + ' .faq__q-and-a').length === 0) {\n                        $('.faq__answer.faq' + i).addClass('faq__empty');\n                    }\n                }\n            });\n        }\n        if ($cache.results.children().length === 0) {\n            $cache.results.append('<div class=\"faq__noHits\">' + $cache.results.data('nohits') + '</div>');\n        }\n    }\n\n    if ($('.faq__wrapper').length > 0) {\n        $('html').addClass('faq-content-page');\n        $(window).on('scroll', function () {\n            var menuheight = $cache.menu.height();\n            var foottop = $cache.footer.offset().top - menuheight;\n            var menutop = $cache.menu.offset().top;\n            if (foottop - 50 <= menutop) {\n                $cache.menu.addClass('faq__menu--bottom');\n            }\n            if ($cache.menu.css('position') === 'absolute' && $cache.w.scrollTop() + $cache.w.height() < Number($cache.menu.offset().top + menuheight + 380)) {\n                $cache.menu.removeClass('faq__menu--bottom');\n            }\n        });\n\n        $cache.input.on('keydown', function (e) {\n            if (e.which === 13 || e.keyCode === 13) {\n                e.preventDefault();\n                searchMe($cache.input.val());\n            }\n        });\n    }\n\n    $cache.d.on('click', 'a.faq__named', function (e) {\n        e.preventDefault();\n        var newTop = $($(this).attr('href')).offset().top;\n        scrollBrowser(newTop);\n    });\n\n    $cache.d.on('click', '.faq__q-and-a', function () {\n        var $this = $(this);\n        var el = $this.find('div:first');\n        if (el.hasClass('icon__plus--square') === true) {\n            el.removeClass('icon__plus--square').addClass('icon__minus--square');\n            $this.find('span').addClass('faq__q-a--is-open');\n        } else {\n            el.removeClass('icon__minus--square').addClass('icon__plus--square');\n            $this.find('span').removeClass('faq__q-a--is-open');\n        }\n    });\n\n    $cache.d.on('click', '.faq__button-search', function () {\n        searchMe($cache.input.val());\n    });\n\n    $cache.d.on('click', '.faq__button-clear', function () {\n        clearResults();\n        $cache.input.val('');\n    });\n\n    /**\n     * to remove the hash tag which is getting aaded to the url\n    * */\n    function contentLinksReset() {\n        // only run if cache exists\n        if (typeof ($cache.contentLinks === 'undefined')) {\n            $cache.contentLinks = $('.content-links');\n        }\n        // mobile versus desktop\n        var trigger = $cache.contentLinks.find('.trigger');\n        if (trigger.length > 0) {\n            trigger.remove();\n        }\n        $cache.contentLinks.removeClass('open');\n\n        $cache.contentLinks.find('a').off('click').on('click', function (e) {\n            e.preventDefault();\n            // escape slashes from href if exists\n            var hrefValue = $(this).attr('href');\n            if (hrefValue.indexOf('/') !== -1) {\n                hrefValue = hrefValue.replace(/\\//g, '\\\\/');\n            }\n            // scroll to the div\n            var newTop = $(hrefValue).offset().top;\n            scrollBrowser(newTop);\n        });\n    }\n    contentLinksReset();\n});\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AClFA;AACA;AADA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;A","sourceRoot":""}