1(function (w, d) { 2 "use strict"; 3 4 // do nothing unless media queries are supported, since we will be using 5 // `minimal.css` otherwise. Do nothing if support is lacking. 6 if (!Modernizr.mediaquery || !w.addEventListener) { 7 return; 8 } 9 10 // lookup common function's 11 var OPP = w.OPP; 12 var toggleClass = OPP.toggleClass; 13 14 // do nothing if common functions are not available 15 if (!toggleClass) { 16 return; 17 } 18 19 (function () { 20 // class used to indicate state of mobile menu 21 var menuActiveClass = 'is-mobile-nav-active'; 22 23 // for repeated calls to `toggleClass()` 24 var docElem = d.documentElement; 25 26 // find required elements by `id` 27 var menuLink = d.getElementById('mobile-menu-link'); 28 var header = d.getElementById('header'); 29 30 function toggleMenu (e) { 31 if ( Modernizr.mq(OPP.smallMQ) ) { 32 toggleClass(docElem, menuActiveClass); 33 e.preventDefault(); 34 } 35 } 36 37 // (de-)activate menu on click, when present 38 !!menuLink && menuLink.addEventListener('click', toggleMenu); 39 !!header && header.addEventListener('click', toggleMenu); 40 })(); 41})(window, window.document);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.