1/** 2 * ATW JS module: 3 * sitenav.js 4 * 5 * Desc: 6 * Provide menu behavior for the header site nav 7 * 8 * Requires: 9 * jQuery 10 */ 11 12var krnl = ( function( app, $ ) { 13 14 "use strict"; 15 16 /* define new module */ 17 app.sitenav = ( function( $ ) { 18 19 // private vars 20 var _name = 'SiteNav', 21 _initialized = null, 22 _debug_enable = true, 23 debug = null, 24 _enable = true, 25 26 $sitenav = null, 27 $submenu_items = null, 28 _get_display = null, 29 _menus = [], 30 _config = {} 31 ; 32 33 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 34 35 function _init() { 36 37 if ( _initialized ) { 38 39 return; 40 41 } 42 43 /* * * * * * * * * * * * * * * * * * * */ 44 45 debug = ( _debug_enable ) ? krnl.util.debug : function(){}; 46 47 // Example broadcast 48 krnl.mediator.broadcast( 'alpha nav init' ); 49 50 /* * * * * * * * * * * * * * * * * * * */ 51 52 if ( $('body').hasClass( 'legends-index' ) ) { 53 setActive(); 54 } 55 56 } 57 58 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 59 60 function setActive() { 61 62 var alpha = $( '.alpha-selector' ).data( 'alpha' ); 63 64 if ( alpha === 'all' ) { 65 $( '.set-all' ).addClass( 'active' ); 66 } 67 else if ( 'set-show' === alpha) { 68 69 $('.nav-show a').addClass('selected'); 70 71 } else if ('set-artist' === alpha) { 72 73 $('.nav-artist a').addClass('selected'); 74 75 } else { 76 $( '.'+ alpha ).addClass( 'active' ); 77 } 78 79 80 81 } 82 83 84 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 85 86 /* Subscribe to mediator 87 * 88 */ 89 90 function _subscribe() { 91 92 app.mediator.add( _name, function() { 93 94 return { 95 96 name: _name, 97 98 onSiteNavInit: function() { 99 100 101 102 }, 103 104 onDisplayChange: function() { 105 106 107 }, 108 109 onBodyClick: function() { 110 111 112 } 113 114 }; 115 116 }()); 117 118 } 119 120 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 121 122 /* return public-facing methods and/or vars */ 123 return { 124 init : _init 125 }; 126 127 }( $ ) ); 128 129 return app; /* return augmented app object */ 130 131}( krnl || {}, jQuery ) ); /* import app if exists, or create new; import jQuery */ 132 133/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 134 135// register this module for initialization 136krnl.bootstrap.register( krnl.sitenav.init );
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.