1jQuery(document).ready(function () { 2 var container = jQuery('.slidingmenu'); 3 4 jQuery(container).prependTo(document.body); 5 6 var bodyEl = document.body, 7 content = document.querySelector( '#g-page-surround' ), 8 openbtn = document.getElementById( 'open-button' ), 9 closebtn = document.getElementById( 'close-button' ), 10 isOpen = false; 11 12 var body_overlay = jQuery('.slidingmenu-overlay', container); 13 jQuery(body_overlay).prependTo(content); 14 15 if (container.data('slidingmenu-animation') === 'sideslide') { 16 (function() { 17 function init() { 18 initEvents(); 19 } 20 21 function initEvents() { 22 openbtn.addEventListener( 'click', toggleMenu ); 23 if( closebtn ) { 24 closebtn.addEventListener( 'click', toggleMenu ); 25 } 26 27 // close the menu element if the target it´s not the menu element or one of its descendants.. 28 content.addEventListener( 'click', function(ev) { 29 var target = ev.target; 30 if( isOpen && target !== openbtn ) { 31 toggleMenu(); 32 } 33 } ); 34 } 35 36 function toggleMenu() { 37 if( isOpen ) { 38 classie.remove( bodyEl, 'show-menu' ); 39 } 40 else { 41 classie.add( bodyEl, 'show-menu' ); 42 } 43 isOpen = !isOpen; 44 } 45 46 init(); 47 })(); 48 } else if (container.data('slidingmenu-animation') === 'sideslide-animated') { 49 (function() { 50 function init() { 51 initEvents(); 52 } 53 54 function initEvents() { 55 openbtn.addEventListener( 'click', toggleMenu ); 56 if( closebtn ) { 57 closebtn.addEventListener( 'click', toggleMenu ); 58 } 59 60 // close the menu element if the target it´s not the menu element or one of its descendants.. 61 content.addEventListener( 'click', function(ev) { 62 var target = ev.target; 63 if( isOpen && target !== openbtn ) { 64 toggleMenu(); 65 } 66 } ); 67 } 68 69 function toggleMenu() { 70 if( isOpen ) { 71 classie.remove( bodyEl, 'show-menu' ); 72 } 73 else { 74 classie.add( bodyEl, 'show-menu' ); 75 } 76 isOpen = !isOpen; 77 } 78 79 init(); 80 })(); 81 } else if (container.data('slidingmenu-animation') === 'elastic') { 82 (function() { 83 var morphEl = document.getElementById( 'morph-shape' ), 84 s = Snap( morphEl.querySelector( 'svg' ) ); 85 path = s.select( 'path' ); 86 initialPath = this.path.attr('d'), 87 pathOpen = morphEl.getAttribute( 'data-morph-open' ), 88 isAnimating = false; 89 90 function init() { 91 initEvents(); 92 } 93 94 function initEvents() { 95 openbtn.addEventListener( 'click', toggleMenu ); 96 if( closebtn ) { 97 closebtn.addEventListener( 'click', toggleMenu ); 98 } 99 100 // close the menu element if the target it´s not the menu element or one of its descendants.. 101 content.addEventListener( 'click', function(ev) { 102 var target = ev.target; 103 if( isOpen && target !== openbtn ) { 104 toggleMenu(); 105 } 106 } ); 107 } 108 109 function toggleMenu() { 110 if( isAnimating ) return false; 111 isAnimating = true; 112 if( isOpen ) { 113 classie.remove( bodyEl, 'show-menu' ); 114 // animate path 115 setTimeout( function() { 116 // reset path 117 path.attr( 'd', initialPath ); 118 isAnimating = false;
119 }, 300 ); 120 } 121 else { 122 classie.add( bodyEl, 'show-menu' ); 123 // animate path 124 path.animate( { 'path' : pathOpen }, 400, mina.easeinout, function() { isAnimating = false; } ); 125 } 126 isOpen = !isOpen; 127 } 128 129 init(); 130 })(); 131 } else if (container.data('slidingmenu-animation') === 'bubble') { 132 (function() { 133 var morphEl = document.getElementById( 'morph-shape' ), 134 s = Snap( morphEl.querySelector( 'svg' ) ); 135 path = s.select( 'path' ); 136 initialPath = this.path.attr('d'), 137 steps = morphEl.getAttribute( 'data-morph-open' ).split(';'); 138 stepsTotal = steps.length; 139 isAnimating = false; 140 141 function init() { 142 initEvents(); 143 } 144 145 function initEvents() { 146 openbtn.addEventListener( 'click', toggleMenu ); 147 if( closebtn ) { 148 closebtn.addEventListener( 'click', toggleMenu ); 149 } 150 151 // close the menu element if the target it´s not the menu element or one of its descendants.. 152 content.addEventListener( 'click', function(ev) { 153 var target = ev.target; 154 if( isOpen && target !== openbtn ) { 155 toggleMenu(); 156 } 157 } ); 158 } 159 160 function toggleMenu() { 161 if( isAnimating ) return false; 162 isAnimating = true; 163 if( isOpen ) { 164 classie.remove( bodyEl, 'show-menu' ); 165 // animate path 166 setTimeout( function() { 167 // reset path 168 path.attr( 'd', initialPath ); 169 isAnimating = false; 170 }, 300 ); 171 } 172 else { 173 classie.add( bodyEl, 'show-menu' ); 174 // animate path 175 var pos = 0, 176 nextStep = function( pos ) { 177 if( pos > stepsTotal - 1 ) { 178 isAnimating = false; 179 return; 180 } 181 path.animate( { 'path' : steps[pos] }, pos === 0 ? 400 : 500, pos === 0 ? mina.easein : mina.elastic, function() { nextStep(pos); } ); 182 pos++; 183 }; 184 185 nextStep(pos); 186 } 187 isOpen = !isOpen; 188 } 189 190 init(); 191 })(); 192 } 193});
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.