Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: static/dist/js/main.js.map

Issue 29624561: Issue 6104 - Minified code in help center repository (Closed) Base URL: https://hg.adblockplus.org/help.eyeo.com
Patch Set: Move all requires to top of gulpfile.js Created Dec. 4, 2017, 2:10 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 {"version":3,"names":[],"mappings":"","sources":["main.js"],"sourcesContent":["/ *!\n * This file is part of help.eyeo.com.\n * Copyright (C) 2017-present eyeo G mbH\n *\n * help.eyeo.com is free software: you can redistribute it and/or modif y\n * it under the terms of the GNU General Public License as published by\n * t he Free Software Foundation, either version 3 of the License, or\n * (at your op tion) any later version.\n *\n * help.eyeo.com is distributed in the hope that i t will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warrant y of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU G eneral Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with help.eyeo.com. If not, see <ht tp://www.gnu.org/licenses/>.\n */\n(function()\n{\n document.addEventListener(\ "DOMContentLoaded\", function()\n {\n\n /*********************************** ***************************************\n * General\n ****************** ********************************************************/\n\n // Change html class name from \"no-js\" to \"js\"\n document.documentElement.className = \" js\";\n\n /****************************************************************** ********\n * Navbar\n ************************************************** ************************/\n\n function toggleNavbarCollapse()\n {\n v ar navbarCollapseEls = this.parentElement.getElementsByClassName(\"navbar-collap se\");\n for (var i = 0; i < navbarCollapseEls.length; i++)\n {\n navbarCollapseEls[i]\n .classList.toggle(\"open\")\n }\n }\n \n var toggleNavbarCollapseEls = document.getElementsByClassName(\"toggle-nav bar-collapse\");\n for (var i = 0; i < toggleNavbarCollapseEls.length; i++)\n {\n toggleNavbarCollapseEls[i]\n .addEventListener(\"click\", to ggleNavbarCollapse, false);\n }\n\n /************************************* *************************************\n * CustomSelect\n *************** ***********************************************************/\n\n function Cus tomSelect(select)\n {\n this.select = select;\n this.close();\n this.select\n .addEventListener(\"click\", this._onClick.bind(this), false);\n this.select\n .addEventListener(\"focusout\", this._onFo cusOut.bind(this), false);\n }\n\n CustomSelect.prototype._onFocusOut = fu nction()\n {\n // setTimeout to allow document.activeElement \n // to move to newly focused element\n setTimeout(function()\n {\n var newFocus = document.activeElement;\n \n if (newFocus\n .classList.contains(\"custom-select-selected\") ||\n newFocus\n .classList.contains(\"custom-select-option\") ||\n newF ocus\n .parentElement\n .classList.contains(\"custom-s elect-option\"))\n {\n return;\n }\n\n this.close( );\n \n }.bind(this), 1);\n }\n\n CustomSelect.prototype._onCl ick = function(event)\n {\n if (event.target.classList.contains(\"custom -select-selected\"))\n {\n var options = this.select.querySelector(\ ".custom-select-options\");\n if (options.getAttribute(\"aria-hidden\") = = \"true\")\n {\n this.open();\n }\n else\n {\n this.close();\n }\n }\n }\n\n CustomSelect.proto type.open = function()\n {\n this.select\n .querySelector(\".cust om-select-selected\")\n .setAttribute(\"aria-expanded\", \"true\");\n\n this.select\n .querySelector(\".custom-select-options\")\n .re moveAttribute(\"aria-hidden\");\n }\n\n CustomSelect.prototype.close = fun ction()\n {\n this.select\n .querySelector(\".custom-select-selec ted\")\n .setAttribute(\"aria-expanded\", \"false\");\n\n this.select\ n .querySelector(\".custom-select-options\")\n .setAttribute(\"ari a-hidden\", \"true\");\n }\n \n new CustomSelect(document.getElementByI d(\"language-select\"));\n\n /*********************************************** ***************************\n * Accordion\n **************************** **********************************************/\n\n function Accordion(accord ion)\n {\n this.accordion = accordion;\n \n var accordionButto ns = this.accordion.getElementsByClassName('accordion-toggle-button');\n fo r (var i = 0; i < accordionButtons.length; i++)\n {\n // Close all s ections except the first\n if (i !== 0)\n {\n accordionBu ttons[i].setAttribute(\"aria-expanded\", \"false\");\n document\n .getElementById( accordionButtons[i].getAttribute(\"aria-controls\") )\n .setAttribute(\"hidden\", \"true\");\n }\n }\n\n this .accordion\n .addEventListener(\"click\", this._onClick.bind(this), false );\n this.accordion\n .addEventListener(\"keydown\", this._onKeyDown .bind(this), false);\n }\n\n Accordion.prototype.toggleSection = function( clickedButton)\n {\n // Hide currently expanded section\n var expan dedButton = this.accordion.querySelector(\"button[aria-expanded='true']\");\n if (expandedButton)\n {\n expandedButton.setAttribute(\"aria-expa nded\", \"false\");\n document\n .getElementById( expandedButton .getAttribute(\"aria-controls\") )\n .setAttribute(\"hidden\", \"true\" );\n }\n\n // If currently expanded section is clicked\n if (expa ndedButton === clickedButton) return;\n\n // Expand new section\n clic kedButton.setAttribute(\"aria-expanded\", \"true\");\n document\n .g etElementById( clickedButton.getAttribute(\"aria-controls\") )\n .removeA ttribute(\"hidden\");\n }\n\n Accordion.prototype.focusNextSection = funct ion()\n {\n var currentFocus = document.activeElement;\n var nexthe ading = currentFocus.parentElement.nextElementSibling.nextElementSibling;\n\n if (nextheading)\n {\n nextheading // .accordion-heading\n .firstElementChild // .accordion-toggle-button\n .focus();\n }\ n else\n {\n this.accordion\n .firstElementChild // .a ccordion-heading\n .firstElementChild // .accordion-toggle-button\n .focus();\n }\n }\n\n Accordion.prototype.focusPrevSection = fu nction()\n {\n var currentFocus = document.activeElement;\n var pre vAccordionBody = currentFocus.parentElement.previousElementSibling;\n\n if (prevAccordionBody)\n {\n prevAccordionBody // .accordion-body\n .previousElementSibling // .accordion-heading\n .firstElementChil d // .accordion-toggle-button\n .focus();\n }\n else\n { \n this.accordion\n .lastElementChild // .accordion-body\n .previousElementSibling // .accordion-heading\n .firstElementChild // .accordion-toggle-button\n .focus();\n }\n }\n\n Accordio n.prototype._onKeyDown = function(event)\n {\n if (!event.target.classLi st.contains(\"accordion-toggle-button\")) return;\n\n if (event.key == \"Ar rowUp\" || event.keyCode == 38)\n {\n this.focusPrevSection();\n }\n else if (event.key == \"ArrowDown\" || event.keyCode == 40)\n {\ n this.focusNextSection();\n }\n }\n\n Accordion.prototype._on Click = function(event)\n {\n if (!event.target.classList.contains(\"acc ordion-toggle-button\")) return;\n \n this.toggleSection(event.target) ;\n }\n\n var productTopicsAccordion = document.getElementById('product-to pics-accordion');\n if (productTopicsAccordion)\n {\n new Accordion(p roductTopicsAccordion);\n }\n\n /***************************************** *********************************\n * BrowserSelect\n ****************** ********************************************************/\n\n function Browse rSelect(select)\n {\n this.select = select;\n CustomSelect.apply(th is, [this.select]);\n \n this.BROWSER_STORAGE_KEY = \"BROWSER\";\n this.BROWSER_AUTODETECTED_STORAGE_KEY = \"BROWSER_AUTODETECTED\";\n this. SUPPORTED_BROWSERS = [\"chrome\", \"opera\", \"samsungBrowser\", \n \"yandexbrowser\", \"maxthon\", \"msie\", \n \"msedge\", \"firefox\", \"ios\", \"safari\"];\n this.DEFA ULT_BROWSER = \"chrome\";\n \n this.select\n .addEventListener( \"click\", this._onClickOrKeyDown.bind(this), false);\n \n this.select \n .addEventListener(\"keydown\", this._onClickOrKeyDown.bind(this), fals e);\n\n var storedBrowser = localStorage.getItem(this.BROWSER_STORAGE_KEY); \n if (storedBrowser) this.selectOption(storedBrowser);\n else this.de tectBrowser();\n }\n\n BrowserSelect.prototype = Object.create(CustomSelec t.prototype);\n BrowserSelect.prototype.constructor = BrowserSelect;\n\n B rowserSelect.prototype.detectBrowser = function()\n {\n for (var i = 0; i < this.SUPPORTED_BROWSERS.length; i++)\n {\n var supportedBrowser = this.SUPPORTED_BROWSERS[i];\n if (bowser[supportedBrowser])\n {\ n localStorage.setItem(this.BROWSER_AUTODETECTED_STORAGE_KEY, \"true\") ;\n return this.selectOption(supportedBrowser);\n }\n }\n\n this.selectOption(this.DEFAULT_BROWSER); \n };\n\n BrowserSelect.pr ototype.selectOption = function(browser)\n {\n localStorage.setItem(this .BROWSER_STORAGE_KEY, browser);\n\n // Change body class\n var bodyCla ssList = Array.prototype.slice.call(document.body.classList);\n for (var i = 0; i < bodyClassList.length; i++)\n {\n if (bodyClassList[i].index Of(\"ua-\") > -1)\n {\n document.body.classList.remove(bodyClass List[i]);\n }\n }\n document.body.classList.add(\"ua-\" + brows er);\n\n // Check selected option\n var selectedItem = this.select\n .querySelector(\"[data-value='\" + browser + \"']\"); \n selectedItem.setAttribute(\"aria-checked\", \"true\");\n\n // Set s elected option\n var selectedOption = selectedItem.innerHTML;\n\n if ( localStorage.getItem(this.BROWSER_AUTODETECTED_STORAGE_KEY))\n {\n v ar autodetected = document\n .getElementById(\"brow ser-select-autodetected\")\n .innerHTML;\n s electedOption += \"<span class='muted'>(\" + autodetected + \")</span>\";\n }\n\n this.select\n .querySelector(\".custom-select-selected\")\n .innerHTML = selectedOption;\n \n if (!document.querySelecto r(\".platform-\" + browser))\n {\n this.handleNoContentForBrowser(br owser);\n }\n };\n\n BrowserSelect.prototype.handleNoContentForBrowse r = function(browser)\n {\n var section = document.createElement(\"secti on\");\n section.classList.add(\"platform-\" + browser);\n section.inn erHTML = document\n .getElementById(\"no-content-for- platform-message\")\n .innerHTML;\n\n document\n .querySelector(\".article-body\")\n .insertAdjacentElement(\"afte rbegin\", section);\n }\n\n BrowserSelect.prototype._onClickOrKeyDown = fu nction(event)\n {\n var option = event.target.closest(\".custom-select-o ption\");\n if (!option) return;\n\n var IS_ENTER_KEY = event.key == \ "Enter\" || event.keyCode == 13;\n if (event.keyCode && !IS_ENTER_KEY) retu rn;\n\n localStorage.removeItem(this.BROWSER_AUTODETECTED_STORAGE_KEY);\n\n // Uncheck previously checked option\n this.select\n .queryS elector(\"[aria-checked='true']\")\n .setAttribute(\"aria-checked\", \" false\");\n\n this.selectOption(option.getAttribute(\"data-value\"));\n\n this.close();\n };\n\n var browserSelect = document.getElementById(\"b rowser-select\");\n if (browserSelect)\n {\n new BrowserSelect(browse rSelect);\n }\n\n }, false);\n}());\n//# sourceMappingURL=main.js.map\n\n//# sourceMappingURL=main-debug.js.map\n\n//# sourceMappingURL=main.js.map\n"],"fil e":"main.js"}
OLDNEW
« gulpfile.js ('K') | « static/dist/js/main.js ('k') | static/dist/js/main.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld