1// Avoid `console` errors in browsers that lack a console. 2(function() { 3 var method; 4 var noop = function () {}; 5 var methods = [ 6 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 7 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 8 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 9 'timeStamp', 'trace', 'warn' 10 ]; 11 var length = methods.length; 12 var console = (window.console = window.console || {}); 13 14 while (length--) { 15 method = methods[length]; 16 17 // Only stub undefined methods. 18 if (!console[method]) { 19 console[method] = noop; 20 } 21 } 22}()); 23 24// jQuery/helper plugins in here. 25/* 26 JavaScript Dynamic Select Navigation v1.0.0 27 by Todd Motto: http://www.toddmotto.com 28 Latest version: https://github.com/toddmotto/selectnav 29 30 Copyright 2013 Todd Motto 31 Licensed under the MIT license 32 http://www.opensource.org/licenses/mit-license.php 33 34 Dynamically creates a select menu with nested capabilities 35*/ 36function selectnav(id) { 37 38 var select = document.createElement('select'); 39 var first = document.createElement('option'); 40 41 first.innerHTML = 'Navigation'; 42 first.setAttribute('selected', 'selected'); 43 select.setAttribute('id', 'mobile'); 44 select.appendChild(first); 45 46 var nav = document.getElementById(id); 47 var loadLinks = function(element, hyphen, level) { 48 49 var e = element; 50 var children = e.children; 51 52 for(var i = 0; i < e.children.length; ++i) { 53 54 var currentLink = children[i]; 55 56 switch(currentLink.nodeName) { 57 case 'A': 58 var option = document.createElement('option'); 59 option.innerHTML = (level++ < 1 ? '' : hyphen) + currentLink.innerHTML; 60 option.value = currentLink.href; 61 select.appendChild(option); 62 break; 63 default: 64 if(currentLink.nodeName === 'UL') { 65 (level < 2) || (hyphen += hyphen); 66 } 67 loadLinks(currentLink, hyphen, level); 68 break; 69 } 70 } 71 } 72 73 loadLinks(nav, '- ', 0); 74 75 nav.appendChild(select); 76 77 var mobile = document.getElementById('mobile'); 78 79 if(mobile.addEventListener) { 80 mobile.addEventListener('change', function () { 81 window.location.href = mobile.options[mobile.selectedIndex].value; 82 }); 83 } else if(mobile.attachEvent) { 84 mobile.attachEvent('onchange', function () { 85 window.location.href = mobile.options[mobile.selectedIndex].value; 86 }); 87 } else { 88 mobile.onchange = function () { 89 window.location.href = mobile.options[mobile.selectedIndex].value; 90 } 91 } 92 93}
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.