1/* 2 * SimpleModal 1.4.4 - jQuery Plugin 3 * http://simplemodal.com/ 4 * Copyright (c) 2013 Eric Martin 5 * Licensed under MIT and GPL 6 * Date: Sun, Jan 20 2013 15:58:56 -0800 7 */ 8(function(b){"function"===typeof define&&define.amd?define(["jquery"],b):b(jQuery)})(function(b){var j=[],n=b(document),k=navigator.userAgent.toLowerCase(),l=b(window),g=[],o=null,p=/msie/.test(k)&&!/opera/.test(k),q=/opera/.test(k),m,r;m=p&&/msie 6./.test(k)&&"object"!==typeof window.XMLHttpRequest;r=p&&/msie 7.0/.test(k);b.modal=function(a,h){return b.modal.impl.init(a,h)};b.modal.close=function(){b.modal.impl.close()};b.modal.focus=function(a){b.modal.impl.focus(a)};b.modal.setContainerDimensions= 9function(){b.modal.impl.setContainerDimensions()};b.modal.setPosition=function(){b.modal.impl.setPosition()};b.modal.update=function(a,h){b.modal.impl.update(a,h)};b.fn.modal=function(a){return b.modal.impl.init(this,a)};b.modal.defaults={appendTo:"body",focus:!0,opacity:50,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataId:"simplemodal-data",dataCss:{},minHeight:null,minWidth:null,maxHeight:null,maxWidth:null,autoResize:!1,autoPosition:!0,zIndex:1E3, 10close:!0,closeHTML:'<a class="modalCloseImg" title="Close"></a>',closeClass:"simplemodal-close",escClose:!0,overlayClose:!1,fixed:!0,position:null,persist:!1,modal:!0,onOpen:null,onShow:null,onClose:null};b.modal.impl={d:{},init:function(a,h){if(this.d.data)return!1;o=p&&!b.support.boxModel;this.o=b.extend({},b.modal.defaults,h);this.zIndex=this.o.zIndex;this.occb=!1;if("object"===typeof a){if(a=a instanceof b?a:b(a),this.d.placeholder=!1,0<a.parent().parent().size()&&(a.before(b("<span></span>").attr("id", 11"simplemodal-placeholder").css({display:"none"})),this.d.placeholder=!0,this.display=a.css("display"),!this.o.persist))this.d.orig=a.clone(!0)}else if("string"===typeof a||"number"===typeof a)a=b("<div></div>").html(a);else return alert("SimpleModal Error: Unsupported data type: "+typeof a),this;this.create(a);this.open();b.isFunction(this.o.onShow)&&this.o.onShow.apply(this,[this.d]);return this},create:function(a){this.getDimensions();if(this.o.modal&&m)this.d.iframe=b('<iframe src="javascript:false;"></iframe>').css(b.extend(this.o.iframeCss, 12{display:"none",opacity:0,position:"fixed",height:g[0],width:g[1],zIndex:this.o.zIndex,top:0,left:0})).appendTo(this.o.appendTo);this.d.overlay=b("<div></div>").attr("id",this.o.overlayId).addClass("simplemodal-overlay").css(b.extend(this.o.overlayCss,{display:"none",opacity:this.o.opacity/100,height:this.o.modal?j[0]:0,width:this.o.modal?j[1]:0,position:"fixed",left:0,top:0,zIndex:this.o.zIndex+1})).appendTo(this.o.appendTo);this.d.container=b("<div></div>").attr("id",this.o.containerId).addClass("simplemodal-container").css(b.extend({position:this.o.fixed? 13"fixed":"absolute"},this.o.containerCss,{display:"none",zIndex:this.o.zIndex+2})).append(this.o.close&&this.o.closeHTML?b(this.o.closeHTML).addClass(this.o.closeClass):"").appendTo(this.o.appendTo);this.d.wrap=b("<div></div>").attr("tabIndex",-1).addClass("simplemodal-wrap").css({height:"100%",outline:0,width:"100%"}).appendTo(this.d.container);this.d.data=a.attr("id",a.attr("id")||this.o.dataId).addClass("simplemodal-data").css(b.extend(this.o.dataCss,{display:"none"})).appendTo("body");this.setContainerDimensions(); 14this.d.data.appendTo(this.d.wrap);(m||o)&&this.fixIE()},bindEvents:function(){var a=this;b("."+a.o.closeClass).bind("click.simplemodal",function(b){b.preventDefault();a.close()});a.o.modal&&a.o.close&&a.o.overlayClose&&a.d.overlay.bind("click.simplemodal",function(b){b.preventDefault();a.close()});n.bind("keydown.simplemodal",function(b){a.o.modal&&9===b.keyCode?a.watchTab(b):a.o.close&&a.o.escClose&&27===b.keyCode&&(b.preventDefault(),a.close())});l.bind("resize.simplemodal orientationchange.simplemodal", 15function(){a.getDimensions();a.o.autoResize?a.setContainerDimensions():a.o.autoPosition&&a.setPosition();m||o?a.fixIE():a.o.modal&&(a.d.iframe&&a.d.iframe.css({height:g[0],width:g[1]}),a.d.overlay.css({height:j[0],width:j[1]}))})},unbindEvents:function(){b("."+this.o.closeClass).unbind("click.simplemodal");
15n.unbind("keydown.simplemodal");l.unbind(".simplemodal");this.d.overlay.unbind("click.simplemodal")},fixIE:function(){var a=this.o.position;b.each([this.d.iframe||null,!this.o.modal?null:this.d.overlay, 16"fixed"===this.d.container.css("position")?this.d.container:null],function(b,e){if(e){var f=e[0].style;f.position="absolute";if(2>b)f.removeExpression("height"),f.removeExpression("width"),f.setExpression("height",'document.body.scrollHeight > document.body.clientHeight ? document.body.scrollHeight : document.body.clientHeight + "px"'),f.setExpression("width",'document.body.scrollWidth > document.body.clientWidth ? document.body.scrollWidth : document.body.clientWidth + "px"');else{var c,d;a&&a.constructor=== 17Array?(c=a[0]?"number"===typeof a[0]?a[0].toString():a[0].replace(/px/,""):e.css("top").replace(/px/,""),c=-1===c.indexOf("%")?c+' + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"':parseInt(c.replace(/%/,""))+' * ((document.documentElement.clientHeight || document.body.clientHeight) / 100) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"',a[1]&&(d="number"===typeof a[1]? 18a[1].toString():a[1].replace(/px/,""),d=-1===d.indexOf("%")?d+' + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"':parseInt(d.replace(/%/,""))+' * ((document.documentElement.clientWidth || document.body.clientWidth) / 100) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"')):(c='(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"', 19d='(document.documentElement.clientWidth || document.body.clientWidth) / 2 - (this.offsetWidth / 2) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"');f.removeExpression("top");f.removeExpression("left");f.setExpression("top",c);f.setExpression("left",d)}}})},focus:function(a){var h=this,a=a&&-1!==b.inArray(a,["first","last"])?a:"first",e=b(":input:enabled:visible:"+a,h.d.wrap);setTimeout(function(){0<e.length?e.focus():h.d.wrap.focus()}, 2010)},getDimensions:function(){var a="undefined"===typeof window.innerHeight?l.height():window.innerHeight;j=[n.height(),n.width()];g=[a,l.width()]},getVal:function(a,b){return a?"number"===typeof a?a:"auto"===a?0:0<a.indexOf("%")?parseInt(a.replace(/%/,""))/100*("h"===b?g[0]:g[1]):parseInt(a.replace(/px/,"")):null},update:function(a,b){if(!this.d.data)return!1;this.d.origHeight=this.getVal(a,"h");this.d.origWidth=this.getVal(b,"w");this.d.data.hide();a&&this.d.container.css("height",a);b&&this.d.container.css("width", 21b);this.setContainerDimensions();this.d.data.show();this.o.focus&&this.focus();this.unbindEvents();this.bindEvents()},setContainerDimensions:function(){var a=m||r,b=this.d.origHeight?this.d.origHeight:q?this.d.container.height():this.getVal(a?this.d.container[0].currentStyle.height:this.d.container.css("height"),"h"),a=this.d.origWidth?this.d.origWidth:q?this.d.container.width():this.getVal(a?this.d.container[0].currentStyle.width:this.d.container.css("width"),"w"),e=this.d.data.outerHeight(!0),f= 22this.d.data.outerWidth(!0);this.d.origHeight=this.d.origHeight||b;this.d.origWidth=this.d.origWidth||a;var c=this.o.maxHeight?this.getVal(this.o.maxHeight,"h"):null,d=this.o.maxWidth?this.getVal(this.o.maxWidth,"w"):null,c=c&&c<g[0]?c:g[0],d=d&&d<g[1]?d:g[1],i=this.o.minHeight?this.getVal(this.o.minHeight,"h"):"auto",b=b?this.o.autoResize&&b>c?c:b<i?i:b:e?e>c?c:this.o.minHeight&&"auto"!==i&&e<i?i:e:i,c=this.o.minWidth?this.getVal(this.o.minWidth,"w"):"auto",a=a?this.o.autoResize&&a>d?d:a<c?c:a:f? 23f>d?d:this.o.minWidth&&"auto"!==c&&f<c?c:f:c;this.d.container.css({height:b,width:a});this.d.wrap.css({overflow:e>b||f>a?"auto":"visible"});this.o.autoPosition&&this.setPosition()},setPosition:function(){var a,b;a=g[0]/2-this.d.container.outerHeight(!0)/2;b=g[1]/2-this.d.container.outerWidth(!0)/2;var e="fixed"!==this.d.container.css("position")?l.scrollTop():0;this.o.position&&"[object Array]"===Object.prototype.toString.call(this.o.position)?(a=e+(this.o.position[0]||a),b=this.o.position[1]||b): 24a=e+a;this.d.container.css({left:b,top:a})}
24,watchTab:function(a){if(0<b(a.target).parents(".simplemodal-container").length){if(this.inputs=b(":input:enabled:visible:first, :input:enabled:visible:last",this.d.data[0]),!a.shiftKey&&a.target===this.inputs[this.inputs.length-1]||a.shiftKey&&a.target===this.inputs[0]||0===this.inputs.length)a.preventDefault(),this.focus(a.shiftKey?"last":"first")}else a.preventDefault(),this.focus()},open:function(){this.d.iframe&&this.d.iframe.show();b.isFunction(this.o.onOpen)? 25this.o.onOpen.apply(this,[this.d]):(this.d.overlay.show(),this.d.container.show(),this.d.data.show());this.o.focus&&this.focus();this.bindEvents()},close:function(){if(!this.d.data)return!1;this.unbindEvents();if(b.isFunction(this.o.onClose)&&!this.occb)this.occb=!0,this.o.onClose.apply(this,[this.d]);else{if(this.d.placeholder){var a=b("#simplemodal-placeholder");this.o.persist?a.replaceWith(this.d.data.removeClass("simplemodal-data").css("display",this.display)):(this.d.data.hide().remove(),a.replaceWith(this.d.orig))}else this.d.data.hide().remove(); 26this.d.container.hide().remove();this.d.overlay.hide();this.d.iframe&&this.d.iframe.hide().remove();this.d.overlay.remove();this.d={}}}}}); 27 28/*! 29 * SlickNav Responsive Mobile Menu v1.0.10 30 * (c) 2016 Josh Cope 31 * licensed under MIT 32 */ 33;(function ($, document, window) { 34 var 35 // default settings object. 36 defaults = { 37 label: 'MENU', 38 duplicate: true, 39 duration: 200, 40 easingOpen: 'swing', 41 easingClose: 'swing', 42 closedSymbol: '►', 43 openedSymbol: '▼', 44 prependTo: 'body', 45 appendTo: '', 46 parentTag: 'a', 47 closeOnClick: false, 48 allowParentLinks: false, 49 nestedParentLinks: true, 50 showChildren: false, 51 removeIds: true, 52 removeClasses: false, 53 removeStyles: false, 54 brand: '', 55 animations: 'jquery', 56 init: function () {}, 57 beforeOpen: function () {}, 58 beforeClose: function () {}, 59 afterOpen: function () {}, 60 afterClose: function () {} 61 }, 62 mobileMenu = 'slicknav', 63 prefix = 'slicknav', 64 65 Keyboard = { 66 DOWN: 40, 67 ENTER: 13, 68 ESCAPE: 27, 69 LEFT: 37, 70 RIGHT: 39, 71 SPACE: 32, 72 TAB: 9, 73 UP: 38, 74 }; 75 76 function Plugin(element, options) { 77 this.element = element; 78 79 // jQuery has an extend method which merges the contents of two or 80 // more objects, storing the result in the first object. The first object 81 // is generally empty as we don't want to alter the default options for 82 // future instances of the plugin 83 this.settings = $.extend({}, defaults, options); 84 85 // Don't remove IDs by default if duplicate is false 86 if (!this.settings.duplicate && !options.hasOwnProperty("removeIds")) { 87 this.settings.removeIds = false; 88 } 89 90 this._defaults = defaults; 91 this._name = mobileMenu; 92 93 this.init(); 94 } 95 96 Plugin.prototype.init = function () { 97 var $this = this, 98 menu = $(this.element), 99 settings = this.settings, 100 iconClass, 101 menuBar; 102 103 // clone menu if needed 104 if (settings.duplicate) { 105 $this.mobileNav = menu.clone(); 106 } else { 107 $this.mobileNav = menu; 108 } 109 110 // remove IDs if set 111 if (settings.removeIds) { 112 $this.mobileNav.removeAttr('id'); 113 $this.mobileNav.find('*').each(function (i, e) { 114 $(e).removeAttr('id'); 115 }); 116 } 117 118 // remove classes if set 119 if (settings.removeClasses) { 120 $this.mobileNav.removeAttr('class'); 121 $this.mobileNav.find('*').each(function (i, e) { 122 $(e).removeAttr('class'); 123 }); 124 } 125 126 // remove styles if set 127 if (settings.removeStyles) { 128 $this.mobileNav.removeAttr('style'); 129 $this.mobileNav.find('*').each(function (i, e) { 130 $(e).removeAttr('style'); 131 }); 132 } 133 134 // styling class for the button 135 iconClass = prefix + '_icon'; 136 137 if (settings.label === '') { 138 iconClass += ' ' + prefix + '_no-text'; 139 } 140 141 if (settings.parentTag == 'a') { 142 settings.parentTag = 'a href="#"'; 143 } 144 145 // create menu bar 146 $this.mobileNav.attr('class', prefix + '_nav'); 147 menuBar = $('<div class="' + prefix + '_menu"></div>'); 148 if (settings.brand !== '') { 149 var brand = $('<div class="' + prefix + '_brand">'+settings.brand+'</div>'); 150 $(menuBar).append(brand); 151 } 152 $this.btn = $( 153 ['<' + settings.parentTag + ' aria-haspopup="true" role="button" tabindex="0" class="' + prefix + '_btn ' + prefix + '_collapsed">', 154 '<span class="' + prefix + '_menutxt">' + settings.label + '</span>', 155 '<span class="' + iconClass + '">', 156 '<span class="' + prefix + '_icon-bar"></span>', 157 '<span class="' + prefix + '_icon-bar"></span>', 158 '<span class="' + prefix + '_icon-bar"></span>', 159 '</span>', 160 '</' + settings.parentTag + '>' 161 ].join('') 162 ); 163 $(menuBar).append($this.btn); 164 if(settings.appendTo !== '') { 165 $(settings.appendTo).append(menuBar); 166 } else { 167 $(settings.prependTo).prepend(menuBar); 168 } 169 menuBar.append($this.mobileNav); 170 171 // iterate over structure adding additional structure 172 var items = $this.mobileNav.find('li'); 173 $(items).each(function () { 174 var item = $(this), 175 data = {}; 176 data.children = item.children('ul').attr('role', 'menu'); 177 item.data('menu', data); 178 179 // if a list item has a nested menu 180 if (data.children.length > 0) { 181 182 // select all text before the child menu 183 // check for anchors 184 185 var a = item.contents(), 186 containsAnchor = false, 187 nodes = []; 188 189 $(a).each(function () { 190 if (!$(this).is('ul')) { 191 nodes.push(this); 192 } else { 193 return false;
194 } 195 196 if($(this).is("a")) { 197 containsAnchor = true; 198 } 199 }); 200 201 var wrapElement = $( 202 '<' + settings.parentTag + ' role="menuitem" aria-haspopup="true" tabindex="-1" class="' + prefix + '_item"/>' 203 ); 204 205 // wrap item text with tag and add classes unless we are separating parent links 206 if ((!settings.allowParentLinks || settings.nestedParentLinks) || !containsAnchor) { 207 var $wrap = $(nodes).wrapAll(wrapElement).parent(); 208 $wrap.addClass(prefix+'_row'); 209 } else 210 $(nodes).wrapAll('<span class="'+prefix+'_parent-link '+prefix+'_row"/>').parent(); 211 212 if (!settings.showChildren) { 213 item.addClass(prefix+'_collapsed'); 214 } else { 215 item.addClass(prefix+'_open'); 216 } 217 218 item.addClass(prefix+'_parent'); 219 220 // create parent arrow. wrap with link if parent links and separating 221 var arrowElement = $('<span class="'+prefix+'_arrow">'+(settings.showChildren?settings.openedSymbol:settings.closedSymbol)+'</span>'); 222 223 if (settings.allowParentLinks && !settings.nestedParentLinks && containsAnchor) 224 arrowElement = arrowElement.wrap(wrapElement).parent(); 225 226 //append arrow 227 $(nodes).last().after(arrowElement); 228 229 230 } else if ( item.children().length === 0) { 231 item.addClass(prefix+'_txtnode'); 232 } 233 234 // accessibility for links 235 item.children('a').attr('role', 'menuitem').click(function(event){ 236 //Ensure that it's not a parent 237 if (settings.closeOnClick && !$(event.target).parent().closest('li').hasClass(prefix+'_parent')) { 238 //Emulate menu close if set 239 $($this.btn).click(); 240 } 241 }); 242 243 //also close on click if parent links are set 244 if (settings.closeOnClick && settings.allowParentLinks) { 245 item.children('a').children('a').click(function (event) { 246 //Emulate menu close 247 $($this.btn).click(); 248 }); 249 250 item.find('.'+prefix+'_parent-link a:not(.'+prefix+'_item)').click(function(event){ 251 //Emulate menu close 252 $($this.btn).click(); 253 }); 254 } 255 }); 256 257 // structure is in place, now hide appropriate items 258 $(items).each(function () { 259 var data = $(this).data('menu'); 260 if (!settings.showChildren){ 261 $this._visibilityToggle(data.children, null, false, null, true); 262 } 263 }); 264 265 // finally toggle entire menu 266 $this._visibilityToggle($this.mobileNav, null, false, 'init', true); 267 268 // accessibility for menu button 269 $this.mobileNav.attr('role','menu'); 270 271 // outline prevention when using mouse 272 $(document).mousedown(function(){ 273 $this._outlines(false); 274 }); 275 276 $(document).keyup(function(){ 277 $this._outlines(true); 278 }); 279 280 // menu button click 281 $($this.btn).click(function (e) { 282 e.preventDefault(); 283 $this._menuToggle(); 284 }); 285 286 // click on menu parent 287 $this.mobileNav.on('click', '.' + prefix + '_item', function (e) { 288 e.preventDefault(); 289 $this._itemClick($(this)); 290 }); 291 292 // check for keyboard events on menu button and menu parents 293 $($this.btn).keydown(function (e) { 294 var ev = e || event; 295 296 switch(ev.keyCode) { 297 case Keyboard.ENTER: 298 case Keyboard.SPACE: 299 case Keyboard.DOWN: 300 e.preventDefault(); 301 if (ev.keyCode !== Keyboard.DOWN || !$($this.btn).hasClass(prefix+'_open')){ 302 $this._menuToggle(); 303 } 304 305 $($this.btn).next().find('[role="menuitem"]').first().focus(); 306 break; 307 } 308 309 310 }); 311 312 $this.mobileNav.on('keydown', '.'+prefix+'_item', function(e) { 313 var ev = e || event; 314 315 switch(ev.keyCode) { 316 case Keyboard.ENTER: 317 e.preventDefault(); 318 $this._itemClick($(e.target)); 319 break; 320 case Keyboard.RIGHT: 321 e.preventDefault(); 322 if ($(e.target).parent().hasClass(prefix+'_collapsed')) { 323 $this._itemClick($(e.target)); 324 } 325 $(e.target).next().find('[role="menuitem"]').first().focus(); 326 break; 327 } 328 }); 329 330 $this.mobileNav.on('keydown', '[role="menuitem"]', function(e) { 331 var ev = e || event; 332 333 switch(ev.keyCode){
334 case Keyboard.DOWN: 335 e.preventDefault(); 336 var allItems = $(e.target).parent().parent().children().children('[role="menuitem"]:visible'); 337 var idx = allItems.index( e.target ); 338 var nextIdx = idx + 1; 339 if (allItems.length <= nextIdx) { 340 nextIdx = 0; 341 } 342 var next = allItems.eq( nextIdx ); 343 next.focus(); 344 break; 345 case Keyboard.UP: 346 e.preventDefault(); 347 var allItems = $(e.target).parent().parent().children().children('[role="menuitem"]:visible'); 348 var idx = allItems.index( e.target ); 349 var next = allItems.eq( idx - 1 ); 350 next.focus(); 351 break; 352 case Keyboard.LEFT: 353 e.preventDefault(); 354 if ($(e.target).parent().parent().parent().hasClass(prefix+'_open')) { 355 var parent = $(e.target).parent().parent().prev(); 356 parent.focus(); 357 $this._itemClick(parent); 358 } else if ($(e.target).parent().parent().hasClass(prefix+'_nav')){ 359 $this._menuToggle(); 360 $($this.btn).focus(); 361 } 362 break; 363 case Keyboard.ESCAPE: 364 e.preventDefault(); 365 $this._menuToggle(); 366 $($this.btn).focus(); 367 break; 368 } 369 }); 370 371 // allow links clickable within parent tags if set 372 if (settings.allowParentLinks && settings.nestedParentLinks) { 373 $('.'+prefix+'_item a').click(function(e){ 374 e.stopImmediatePropagation(); 375 }); 376 } 377 }; 378 379 //toggle menu 380 Plugin.prototype._menuToggle = function (el) { 381 var $this = this; 382 var btn = $this.btn; 383 var mobileNav = $this.mobileNav; 384 385 if (btn.hasClass(prefix+'_collapsed')) { 386 btn.removeClass(prefix+'_collapsed'); 387 btn.addClass(prefix+'_open'); 388 } else { 389 btn.removeClass(prefix+'_open'); 390 btn.addClass(prefix+'_collapsed'); 391 } 392 btn.addClass(prefix+'_animating'); 393 $this._visibilityToggle(mobileNav, btn.parent(), true, btn); 394 }; 395 396 // toggle clicked items 397 Plugin.prototype._itemClick = function (el) { 398 var $this = this; 399 var settings = $this.settings; 400 var data = el.data('menu'); 401 if (!data) { 402 data = {}; 403 data.arrow = el.children('.'+prefix+'_arrow'); 404 data.ul = el.next('ul'); 405 data.parent = el.parent(); 406 //Separated parent link structure 407 if (data.parent.hasClass(prefix+'_parent-link')) { 408 data.parent = el.parent().parent(); 409 data.ul = el.parent().next('ul'); 410 } 411 el.data('menu', data); 412 } 413 if (data.parent.hasClass(prefix+'_collapsed')) { 414 data.arrow.html(settings.openedSymbol); 415 data.parent.removeClass(prefix+'_collapsed'); 416 data.parent.addClass(prefix+'_open'); 417 data.parent.addClass(prefix+'_animating'); 418 $this._visibilityToggle(data.ul, data.parent, true, el); 419 } else { 420 data.arrow.html(settings.closedSymbol); 421 data.parent.addClass(prefix+'_collapsed'); 422 data.parent.removeClass(prefix+'_open'); 423 data.parent.addClass(prefix+'_animating'); 424 $this._visibilityToggle(data.ul, data.parent, true, el); 425 } 426 }; 427 428 // toggle actual visibility and accessibility tags 429 Plugin.prototype._visibilityToggle = function(el, parent, animate, trigger, init) { 430 var $this = this; 431 var settings = $this.settings; 432 var items = $this._getActionItems(el); 433 var duration = 0; 434 if (animate) { 435 duration = settings.duration; 436 } 437 438 function afterOpen(trigger, parent) { 439 $(trigger).removeClass(prefix+'_animating'); 440 $(parent).removeClass(prefix+'_animating'); 441 442 //Fire afterOpen callback 443 if (!init) { 444 settings.afterOpen(trigger); 445 } 446 } 447
vendor: 6,737 bytes, lines 448-638
448 function afterClose(trigger, parent) { 449 el.attr('aria-hidden','true'); 450 items.attr('tabindex', '-1'); 451 $this._setVisAttr(el, true); 452 el.hide(); //jQuery 1.7 bug fix 453 454 $(trigger).removeClass(prefix+'_animating'); 455 $(parent).removeClass(prefix+'_animating'); 456 457 //Fire init or afterClose callback 458 if (!init){ 459 settings.afterClose(trigger); 460 } else if (trigger == 'init'){ 461 settings.init(); 462 } 463 } 464 465 if (el.hasClass(prefix+'_hidden')) { 466 el.removeClass(prefix+'_hidden'); 467 //Fire beforeOpen callback 468 if (!init) { 469 settings.beforeOpen(trigger); 470 } 471 if (settings.animations === 'jquery') { 472 el.stop(true,true).slideDown(duration, settings.easingOpen, function(){ 473 afterOpen(trigger, parent); 474 }); 475 } else if(settings.animations === 'velocity') { 476 el.velocity("finish").velocity("slideDown", { 477 duration: duration, 478 easing: settings.easingOpen, 479 complete: function() { 480 afterOpen(trigger, parent); 481 } 482 }); 483 } 484 el.attr('aria-hidden','false'); 485 items.attr('tabindex', '0'); 486 $this._setVisAttr(el, false); 487 } else { 488 el.addClass(prefix+'_hidden'); 489 490 //Fire init or beforeClose callback 491 if (!init){ 492 settings.beforeClose(trigger); 493 } 494 495 if (settings.animations === 'jquery') { 496 el.stop(true,true).slideUp(duration, this.settings.easingClose, function() { 497 afterClose(trigger, parent) 498 }); 499 } else if (settings.animations === 'velocity') { 500 501 el.velocity("finish").velocity("slideUp", { 502 duration: duration, 503 easing: settings.easingClose, 504 complete: function() { 505 afterClose(trigger, parent); 506 } 507 }); 508 } 509 } 510 }; 511 512 // set attributes of element and children based on visibility 513 Plugin.prototype._setVisAttr = function(el, hidden) { 514 var $this = this; 515 516 // select all parents that aren't hidden 517 var nonHidden = el.children('li').children('ul').not('.'+prefix+'_hidden'); 518 519 // iterate over all items setting appropriate tags 520 if (!hidden) { 521 nonHidden.each(function(){ 522 var ul = $(this); 523 ul.attr('aria-hidden','false'); 524 var items = $this._getActionItems(ul); 525 items.attr('tabindex', '0'); 526 $this._setVisAttr(ul, hidden); 527 }); 528 } else { 529 nonHidden.each(function(){ 530 var ul = $(this); 531 ul.attr('aria-hidden','true'); 532 var items = $this._getActionItems(ul); 533 items.attr('tabindex', '-1'); 534 $this._setVisAttr(ul, hidden); 535 }); 536 } 537 }; 538 539 // get all 1st level items that are clickable 540 Plugin.prototype._getActionItems = function(el) { 541 var data = el.data("menu"); 542 if (!data) { 543 data = {}; 544 var items = el.children('li'); 545 var anchors = items.find('a'); 546 data.links = anchors.add(items.find('.'+prefix+'_item')); 547 el.data('menu', data); 548 } 549 return data.links; 550 }; 551 552 Plugin.prototype._outlines = function(state) { 553 if (!state) { 554 $('.'+prefix+'_item, .'+prefix+'_btn').css('outline','none'); 555 } else { 556 $('.'+prefix+'_item, .'+prefix+'_btn').css('outline',''); 557 } 558 }; 559 560 Plugin.prototype.toggle = function(){ 561 var $this = this; 562 $this._menuToggle(); 563 }; 564 565 Plugin.prototype.open = function(){ 566 var $this = this; 567 if ($this.btn.hasClass(prefix+'_collapsed')) { 568 $this._menuToggle(); 569 } 570 }; 571 572 Plugin.prototype.close = function(){ 573 var $this = this; 574 if ($this.btn.hasClass(prefix+'_open')) { 575 $this._menuToggle(); 576 } 577 }; 578 579 $.fn[mobileMenu] = function ( options ) { 580 var args = arguments; 581 582 // Is the first parameter an object (options), or was omitted, instantiate a new instance 583 if (options === undefined || typeof options === 'object') { 584 return this.each(function () { 585 586 // Only allow the plugin to be instantiated once due to methods 587 if (!$.data(this, 'plugin_' + mobileMenu)) { 588 589 // if it has no instance, create a new one, pass options to our plugin constructor, 590 // and store the plugin instance in the elements jQuery data object. 591 $.data(this, 'plugin_' + mobileMenu, new Plugin( this, options )); 592 } 593 }); 594 595 // If is a string and doesn't start with an underscore or 'init' function, treat this as a call to a public method. 596 } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') { 597 598 // Cache the method call to make it possible to return a value 599 var returns; 600 601 this.each(function () { 602 var instance = $.data(this, 'plugin_' + mobileMenu); 603 604 // Tests that there's already a plugin-instance and checks that the requested public method exists 605 if (instance instanceof Plugin && typeof instance[options] === 'function') { 606 607 // Call the method of our plugin instance, and pass it the supplied arguments. 608 returns = instance[options].apply( instance, Array.prototype.slice.call( args, 1 ) ); 609 } 610 }); 611 612 // If the earlier cached method gives a value back return the value, otherwise return this to preserve chainability. 613 return returns !== undefined ? returns : this; 614 } 615 }; 616}(jQuery, document, window)); 617 618(function($) { 619 620 /* 621 ============================================================= 622 SlickNav 623 ============================================================= 624 */ 625 626 $("#primary-menu").slicknav({ 627 label: "", 628 duration: 700 629 }); 630 631 /* 632 ============================================================= 633 Smooth Anchor Scrolling 634 ============================================================= 635 */ 636 637 $(function() { 638 $('a[href*="#"]:not([href="#"])').click(function() {
639 if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { 640 var target = $(this.hash); 641 target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); 642 if (target.length) { 643 $('html, body').animate({ 644 scrollTop: target.offset().top 645 }, 1500); 646 return false; 647 } 648 } 649 }); 650 }); 651 652})(window.jQuery);
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.