{"html":"<%= fp.ui.locale('skip-to-main-content', 'Skip to Main Content') %>","js":"fp.Module.SkipToMainContent = fp.Module.extend({\n    construct: function (element, config, template) {\n        config = _.defaults(config, {\n            sourceSelector: \"#header\",\n            targetSelector: \"#content\",\n            layout: \"layout-0\",\n            enableLocale: true,\n            enableModuleCss: fp.config.enableModuleCss && !fp.config.enableMobile\n        });\n\n        this._super(element, config, template);\n    },\n    render: function(params) {\n        this._super(params);\n\n        var $element = this.$element,\n            config = this.config,\n            source = config.sourceSelector,\n            target = config.targetSelector,\n            scope = this.scope,\n            self = this;\n\n        // set link target from targetSelector unless false is specified\n        if (target === false)\n            target = $element.prop('href');\n        else\n            $element.attr('href', target);\n\n        $element\n            .on('keydown', function(event) {\n                if (event.keyCode == 27) {\n                    // hide on escape\n                    self.__hideLink(event, target);\n                } else if (event.keyCode === 32) {\n                    // respond to enter key\n                    self.__followLink(event, target);\n                }\n            })\n            .on('click', function(event) {\n                self.__followLink(event, target);\n            });\n    },\n    __hideLink: function(event, target) {\n        // close without modifying the URL\n        event.preventDefault();\n        var $link = $(this.$element);\n        $link.blur();\n    },\n    __followLink: function(event, target) {\n        // follow the link without modifying the URL\n        var $button = $(this.$element);\n        if ($(target).length > 0) {\n            event.preventDefault();\n                // don't add #content to url\n            $button.blur();\n                // hide selector element\n            $targetLink = $(target).find('a:visible').first();\n                // find first visible link after target\n            util.scrollTo($targetLink, { duration: 500 });\n                // scroll smoothly to link after target\n            $targetLink.focus();\n                // focus on link after target\n        }\n        // else jump to #content modifying URL\n    }\n});\n\nreturn fp.Module.SkipToMainContent;\n\n//# sourceURL=module/skip-to-main-content/skip-to-main-content.js"}