js/jquery.slicknav.js0000755000000000000000000005223513347177614012075 0ustar /*! * SlickNav Responsive Mobile Menu v1.0.10 * (c) 2016 Josh Cope * licensed under MIT */ ;(function ($, document, window) { var // default settings object. defaults = { label: 'MENU', duplicate: true, duration: 200, easingOpen: 'swing', easingClose: 'swing', closedSymbol: '►', openedSymbol: '▼', prependTo: 'body', appendTo: '', parentTag: 'a', closeOnClick: false, allowParentLinks: false, nestedParentLinks: true, showChildren: false, removeIds: true, removeClasses: false, removeStyles: false, brand: '', animations: 'jquery', init: function () {}, beforeOpen: function () {}, beforeClose: function () {}, afterOpen: function () {}, afterClose: function () {} }, mobileMenu = 'slicknav', prefix = 'slicknav', Keyboard = { DOWN: 40, ENTER: 13, ESCAPE: 27, LEFT: 37, RIGHT: 39, SPACE: 32, TAB: 9, UP: 38, }; function Plugin(element, options) { this.element = element; // jQuery has an extend method which merges the contents of two or // more objects, storing the result in the first object. The first object // is generally empty as we don't want to alter the default options for // future instances of the plugin this.settings = $.extend({}, defaults, options); // Don't remove IDs by default if duplicate is false if (!this.settings.duplicate && !options.hasOwnProperty("removeIds")) { this.settings.removeIds = false; } this._defaults = defaults; this._name = mobileMenu; this.init(); } Plugin.prototype.init = function () { var $this = this, menu = $(this.element), settings = this.settings, iconClass, menuBar; // clone menu if needed if (settings.duplicate) { $this.mobileNav = menu.clone(); } else { $this.mobileNav = menu; } // remove IDs if set if (settings.removeIds) { $this.mobileNav.removeAttr('id'); $this.mobileNav.find('*').each(function (i, e) { $(e).removeAttr('id'); }); } // remove classes if set if (settings.removeClasses) { $this.mobileNav.removeAttr('class'); $this.mobileNav.find('*').each(function (i, e) { $(e).removeAttr('class'); }); } // remove styles if set if (settings.removeStyles) { $this.mobileNav.removeAttr('style'); $this.mobileNav.find('*').each(function (i, e) { $(e).removeAttr('style'); }); } // styling class for the button iconClass = prefix + '_icon'; if (settings.label === '') { iconClass += ' ' + prefix + '_no-text'; } if (settings.parentTag == 'a') { settings.parentTag = 'a href="#"'; } // create menu bar $this.mobileNav.attr('class', prefix + '_nav'); menuBar = $('
'); if (settings.brand !== '') { var brand = $('
'+settings.brand+'
'); $(menuBar).append(brand); } $this.btn = $( ['<' + settings.parentTag + ' aria-haspopup="true" role="button" tabindex="0" class="' + prefix + '_btn ' + prefix + '_collapsed">', '' + settings.label + '', '', '', '', '', '', '' ].join('') ); $(menuBar).append($this.btn); if(settings.appendTo !== '') { $(settings.appendTo).append(menuBar); } else { $(settings.prependTo).prepend(menuBar); } menuBar.append($this.mobileNav); // iterate over structure adding additional structure var items = $this.mobileNav.find('li'); $(items).each(function () { var item = $(this), data = {}; data.children = item.children('ul').attr('role', 'menu'); item.data('menu', data); // if a list item has a nested menu if (data.children.length > 0) { // select all text before the child menu // check for anchors var a = item.contents(), containsAnchor = false, nodes = []; $(a).each(function () { if (!$(this).is('ul')) { nodes.push(this); } else { return false; } if($(this).is("a")) { containsAnchor = true; } }); var wrapElement = $( '<' + settings.parentTag + ' role="menuitem" aria-haspopup="true" tabindex="-1" class="' + prefix + '_item"/>' ); // wrap item text with tag and add classes unless we are separating parent links if ((!settings.allowParentLinks || settings.nestedParentLinks) || !containsAnchor) { var $wrap = $(nodes).wrapAll(wrapElement).parent(); $wrap.addClass(prefix+'_row'); } else $(nodes).wrapAll('').parent(); if (!settings.showChildren) { item.addClass(prefix+'_collapsed'); } else { item.addClass(prefix+'_open'); } item.addClass(prefix+'_parent'); // create parent arrow. wrap with link if parent links and separating var arrowElement = $(''+(settings.showChildren?settings.openedSymbol:settings.closedSymbol)+''); if (settings.allowParentLinks && !settings.nestedParentLinks && containsAnchor) arrowElement = arrowElement.wrap(wrapElement).parent(); //append arrow $(nodes).last().after(arrowElement); } else if ( item.children().length === 0) { item.addClass(prefix+'_txtnode'); } // accessibility for links item.children('a').attr('role', 'menuitem').click(function(event){ //Ensure that it's not a parent if (settings.closeOnClick && !$(event.target).parent().closest('li').hasClass(prefix+'_parent')) { //Emulate menu close if set $($this.btn).click(); } }); //also close on click if parent links are set if (settings.closeOnClick && settings.allowParentLinks) { item.children('a').children('a').click(function (event) { //Emulate menu close $($this.btn).click(); }); item.find('.'+prefix+'_parent-link a:not(.'+prefix+'_item)').click(function(event){ //Emulate menu close $($this.btn).click(); }); } }); // structure is in place, now hide appropriate items $(items).each(function () { var data = $(this).data('menu'); if (!settings.showChildren){ $this._visibilityToggle(data.children, null, false, null, true); } }); // finally toggle entire menu $this._visibilityToggle($this.mobileNav, null, false, 'init', true); // accessibility for menu button $this.mobileNav.attr('role','menu'); // outline prevention when using mouse $(document).mousedown(function(){ $this._outlines(false); }); $(document).keyup(function(){ $this._outlines(true); }); // menu button click $($this.btn).click(function (e) { e.preventDefault(); $this._menuToggle(); }); // click on menu parent $this.mobileNav.on('click', '.' + prefix + '_item', function (e) { e.preventDefault(); $this._itemClick($(this)); }); // check for keyboard events on menu button and menu parents $($this.btn).keydown(function (e) { var ev = e || event; switch(ev.keyCode) { case Keyboard.ENTER: case Keyboard.SPACE: case Keyboard.DOWN: e.preventDefault(); if (ev.keyCode !== Keyboard.DOWN || !$($this.btn).hasClass(prefix+'_open')){ $this._menuToggle(); } $($this.btn).next().find('[role="menuitem"]').first().focus(); break; } }); $this.mobileNav.on('keydown', '.'+prefix+'_item', function(e) { var ev = e || event; switch(ev.keyCode) { case Keyboard.ENTER: e.preventDefault(); $this._itemClick($(e.target)); break; case Keyboard.RIGHT: e.preventDefault(); if ($(e.target).parent().hasClass(prefix+'_collapsed')) { $this._itemClick($(e.target)); } $(e.target).next().find('[role="menuitem"]').first().focus(); break; } }); $this.mobileNav.on('keydown', '[role="menuitem"]', function(e) { var ev = e || event; switch(ev.keyCode){ case Keyboard.DOWN: e.preventDefault(); var allItems = $(e.target).parent().parent().children().children('[role="menuitem"]:visible'); var idx = allItems.index( e.target ); var nextIdx = idx + 1; if (allItems.length <= nextIdx) { nextIdx = 0; } var next = allItems.eq( nextIdx ); next.focus(); break; case Keyboard.UP: e.preventDefault(); var allItems = $(e.target).parent().parent().children().children('[role="menuitem"]:visible'); var idx = allItems.index( e.target ); var next = allItems.eq( idx - 1 ); next.focus(); break; case Keyboard.LEFT: e.preventDefault(); if ($(e.target).parent().parent().parent().hasClass(prefix+'_open')) { var parent = $(e.target).parent().parent().prev(); parent.focus(); $this._itemClick(parent); } else if ($(e.target).parent().parent().hasClass(prefix+'_nav')){ $this._menuToggle(); $($this.btn).focus(); } break; case Keyboard.ESCAPE: e.preventDefault(); $this._menuToggle(); $($this.btn).focus(); break; } }); // allow links clickable within parent tags if set if (settings.allowParentLinks && settings.nestedParentLinks) { $('.'+prefix+'_item a').click(function(e){ e.stopImmediatePropagation(); }); } }; //toggle menu Plugin.prototype._menuToggle = function (el) { var $this = this; var btn = $this.btn; var mobileNav = $this.mobileNav; if (btn.hasClass(prefix+'_collapsed')) { btn.removeClass(prefix+'_collapsed'); btn.addClass(prefix+'_open'); } else { btn.removeClass(prefix+'_open'); btn.addClass(prefix+'_collapsed'); } btn.addClass(prefix+'_animating'); $this._visibilityToggle(mobileNav, btn.parent(), true, btn); }; // toggle clicked items Plugin.prototype._itemClick = function (el) { var $this = this; var settings = $this.settings; var data = el.data('menu'); if (!data) { data = {}; data.arrow = el.children('.'+prefix+'_arrow'); data.ul = el.next('ul'); data.parent = el.parent(); //Separated parent link structure if (data.parent.hasClass(prefix+'_parent-link')) { data.parent = el.parent().parent(); data.ul = el.parent().next('ul'); } el.data('menu', data); } if (data.parent.hasClass(prefix+'_collapsed')) { data.arrow.html(settings.openedSymbol); data.parent.removeClass(prefix+'_collapsed'); data.parent.addClass(prefix+'_open'); data.parent.addClass(prefix+'_animating'); $this._visibilityToggle(data.ul, data.parent, true, el); } else { data.arrow.html(settings.closedSymbol); data.parent.addClass(prefix+'_collapsed'); data.parent.removeClass(prefix+'_open'); data.parent.addClass(prefix+'_animating'); $this._visibilityToggle(data.ul, data.parent, true, el); } }; // toggle actual visibility and accessibility tags Plugin.prototype._visibilityToggle = function(el, parent, animate, trigger, init) { var $this = this; var settings = $this.settings; var items = $this._getActionItems(el); var duration = 0; if (animate) { duration = settings.duration; } function afterOpen(trigger, parent) { $(trigger).removeClass(prefix+'_animating'); $(parent).removeClass(prefix+'_animating'); //Fire afterOpen callback if (!init) { settings.afterOpen(trigger); } } function afterClose(trigger, parent) { el.attr('aria-hidden','true'); items.attr('tabindex', '-1'); $this._setVisAttr(el, true); el.hide(); //jQuery 1.7 bug fix $(trigger).removeClass(prefix+'_animating'); $(parent).removeClass(prefix+'_animating'); //Fire init or afterClose callback if (!init){ settings.afterClose(trigger); } else if (trigger == 'init'){ settings.init(); } } if (el.hasClass(prefix+'_hidden')) { el.removeClass(prefix+'_hidden'); //Fire beforeOpen callback if (!init) { settings.beforeOpen(trigger); } if (settings.animations === 'jquery') { el.stop(true,true).slideDown(duration, settings.easingOpen, function(){ afterOpen(trigger, parent); }); } else if(settings.animations === 'velocity') { el.velocity("finish").velocity("slideDown", { duration: duration, easing: settings.easingOpen, complete: function() { afterOpen(trigger, parent); } }); } el.attr('aria-hidden','false'); items.attr('tabindex', '0'); $this._setVisAttr(el, false); } else { el.addClass(prefix+'_hidden'); //Fire init or beforeClose callback if (!init){ settings.beforeClose(trigger); } if (settings.animations === 'jquery') { el.stop(true,true).slideUp(duration, this.settings.easingClose, function() { afterClose(trigger, parent) }); } else if (settings.animations === 'velocity') { el.velocity("finish").velocity("slideUp", { duration: duration, easing: settings.easingClose, complete: function() { afterClose(trigger, parent); } }); } } }; // set attributes of element and children based on visibility Plugin.prototype._setVisAttr = function(el, hidden) { var $this = this; // select all parents that aren't hidden var nonHidden = el.children('li').children('ul').not('.'+prefix+'_hidden'); // iterate over all items setting appropriate tags if (!hidden) { nonHidden.each(function(){ var ul = $(this); ul.attr('aria-hidden','false'); var items = $this._getActionItems(ul); items.attr('tabindex', '0'); $this._setVisAttr(ul, hidden); }); } else { nonHidden.each(function(){ var ul = $(this); ul.attr('aria-hidden','true'); var items = $this._getActionItems(ul); items.attr('tabindex', '-1'); $this._setVisAttr(ul, hidden); }); } }; // get all 1st level items that are clickable Plugin.prototype._getActionItems = function(el) { var data = el.data("menu"); if (!data) { data = {}; var items = el.children('li'); var anchors = items.find('a'); data.links = anchors.add(items.find('.'+prefix+'_item')); el.data('menu', data); } return data.links; }; Plugin.prototype._outlines = function(state) { if (!state) { $('.'+prefix+'_item, .'+prefix+'_btn').css('outline','none'); } else { $('.'+prefix+'_item, .'+prefix+'_btn').css('outline',''); } }; Plugin.prototype.toggle = function(){ var $this = this; $this._menuToggle(); }; Plugin.prototype.open = function(){ var $this = this; if ($this.btn.hasClass(prefix+'_collapsed')) { $this._menuToggle(); } }; Plugin.prototype.close = function(){ var $this = this; if ($this.btn.hasClass(prefix+'_open')) { $this._menuToggle(); } }; $.fn[mobileMenu] = function ( options ) { var args = arguments; // Is the first parameter an object (options), or was omitted, instantiate a new instance if (options === undefined || typeof options === 'object') { return this.each(function () { // Only allow the plugin to be instantiated once due to methods if (!$.data(this, 'plugin_' + mobileMenu)) { // if it has no instance, create a new one, pass options to our plugin constructor, // and store the plugin instance in the elements jQuery data object. $.data(this, 'plugin_' + mobileMenu, new Plugin( this, options )); } }); // If is a string and doesn't start with an underscore or 'init' function, treat this as a call to a public method. } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') { // Cache the method call to make it possible to return a value var returns; this.each(function () { var instance = $.data(this, 'plugin_' + mobileMenu); // Tests that there's already a plugin-instance and checks that the requested public method exists if (instance instanceof Plugin && typeof instance[options] === 'function') { // Call the method of our plugin instance, and pass it the supplied arguments. returns = instance[options].apply( instance, Array.prototype.slice.call( args, 1 ) ); } }); // If the earlier cached method gives a value back return the value, otherwise return this to preserve chainability. return returns !== undefined ? returns : this; } }; }(jQuery, document, window)); js/jquery.slicknav.min.js0000755000000000000000000002034413347177614012653 0ustar /*! * SlickNav Responsive Mobile Menu v1.0.10 * (c) 2016 Josh Cope * licensed under MIT */ !function(e,t,n){function a(t,n){this.element=t,this.settings=e.extend({},i,n),this.settings.duplicate||n.hasOwnProperty("removeIds")||(this.settings.removeIds=!1),this._defaults=i,this._name=s,this.init()}var i={label:"MENU",duplicate:!0,duration:200,easingOpen:"swing",easingClose:"swing",closedSymbol:"►",openedSymbol:"▼",prependTo:"body",appendTo:"",parentTag:"a",closeOnClick:!1,allowParentLinks:!1,nestedParentLinks:!0,showChildren:!1,removeIds:!0,removeClasses:!1,removeStyles:!1,brand:"",animations:"jquery",init:function(){},beforeOpen:function(){},beforeClose:function(){},afterOpen:function(){},afterClose:function(){}},s="slicknav",o="slicknav",l={DOWN:40,ENTER:13,ESCAPE:27,LEFT:37,RIGHT:39,SPACE:32,TAB:9,UP:38};a.prototype.init=function(){var n,a,i=this,s=e(this.element),r=this.settings;if(r.duplicate?i.mobileNav=s.clone():i.mobileNav=s,r.removeIds&&(i.mobileNav.removeAttr("id"),i.mobileNav.find("*").each(function(t,n){e(n).removeAttr("id")})),r.removeClasses&&(i.mobileNav.removeAttr("class"),i.mobileNav.find("*").each(function(t,n){e(n).removeAttr("class")})),r.removeStyles&&(i.mobileNav.removeAttr("style"),i.mobileNav.find("*").each(function(t,n){e(n).removeAttr("style")})),n=o+"_icon",""===r.label&&(n+=" "+o+"_no-text"),"a"==r.parentTag&&(r.parentTag='a href="#"'),i.mobileNav.attr("class",o+"_nav"),a=e('
'),""!==r.brand){var c=e('
'+r.brand+"
");e(a).append(c)}i.btn=e(["<"+r.parentTag+' aria-haspopup="true" role="button" tabindex="0" class="'+o+"_btn "+o+'_collapsed">',''+r.label+"",'','','','',"",""].join("")),e(a).append(i.btn),""!==r.appendTo?e(r.appendTo).append(a):e(r.prependTo).prepend(a),a.append(i.mobileNav);var p=i.mobileNav.find("li");e(p).each(function(){var t=e(this),n={};if(n.children=t.children("ul").attr("role","menu"),t.data("menu",n),n.children.length>0){var a=t.contents(),s=!1,l=[];e(a).each(function(){return e(this).is("ul")?!1:(l.push(this),void(e(this).is("a")&&(s=!0)))});var c=e("<"+r.parentTag+' role="menuitem" aria-haspopup="true" tabindex="-1" class="'+o+'_item"/>');if(r.allowParentLinks&&!r.nestedParentLinks&&s)e(l).wrapAll('').parent();else{var p=e(l).wrapAll(c).parent();p.addClass(o+"_row")}r.showChildren?t.addClass(o+"_open"):t.addClass(o+"_collapsed"),t.addClass(o+"_parent");var d=e(''+(r.showChildren?r.openedSymbol:r.closedSymbol)+"");r.allowParentLinks&&!r.nestedParentLinks&&s&&(d=d.wrap(c).parent()),e(l).last().after(d)}else 0===t.children().length&&t.addClass(o+"_txtnode");t.children("a").attr("role","menuitem").click(function(t){r.closeOnClick&&!e(t.target).parent().closest("li").hasClass(o+"_parent")&&e(i.btn).click()}),r.closeOnClick&&r.allowParentLinks&&(t.children("a").children("a").click(function(t){e(i.btn).click()}),t.find("."+o+"_parent-link a:not(."+o+"_item)").click(function(t){e(i.btn).click()}))}),e(p).each(function(){var t=e(this).data("menu");r.showChildren||i._visibilityToggle(t.children,null,!1,null,!0)}),i._visibilityToggle(i.mobileNav,null,!1,"init",!0),i.mobileNav.attr("role","menu"),e(t).mousedown(function(){i._outlines(!1)}),e(t).keyup(function(){i._outlines(!0)}),e(i.btn).click(function(e){e.preventDefault(),i._menuToggle()}),i.mobileNav.on("click","."+o+"_item",function(t){t.preventDefault(),i._itemClick(e(this))}),e(i.btn).keydown(function(t){var n=t||event;switch(n.keyCode){case l.ENTER:case l.SPACE:case l.DOWN:t.preventDefault(),n.keyCode===l.DOWN&&e(i.btn).hasClass(o+"_open")||i._menuToggle(),e(i.btn).next().find('[role="menuitem"]').first().focus()}}),i.mobileNav.on("keydown","."+o+"_item",function(t){var n=t||event;switch(n.keyCode){case l.ENTER:t.preventDefault(),i._itemClick(e(t.target));break;case l.RIGHT:t.preventDefault(),e(t.target).parent().hasClass(o+"_collapsed")&&i._itemClick(e(t.target)),e(t.target).next().find('[role="menuitem"]').first().focus()}}),i.mobileNav.on("keydown",'[role="menuitem"]',function(t){var n=t||event;switch(n.keyCode){case l.DOWN:t.preventDefault();var a=e(t.target).parent().parent().children().children('[role="menuitem"]:visible'),s=a.index(t.target),r=s+1;a.length<=r&&(r=0);var c=a.eq(r);c.focus();break;case l.UP:t.preventDefault();var a=e(t.target).parent().parent().children().children('[role="menuitem"]:visible'),s=a.index(t.target),c=a.eq(s-1);c.focus();break;case l.LEFT:if(t.preventDefault(),e(t.target).parent().parent().parent().hasClass(o+"_open")){var p=e(t.target).parent().parent().prev();p.focus(),i._itemClick(p)}else e(t.target).parent().parent().hasClass(o+"_nav")&&(i._menuToggle(),e(i.btn).focus());break;case l.ESCAPE:t.preventDefault(),i._menuToggle(),e(i.btn).focus()}}),r.allowParentLinks&&r.nestedParentLinks&&e("."+o+"_item a").click(function(e){e.stopImmediatePropagation()})},a.prototype._menuToggle=function(e){var t=this,n=t.btn,a=t.mobileNav;n.hasClass(o+"_collapsed")?(n.removeClass(o+"_collapsed"),n.addClass(o+"_open")):(n.removeClass(o+"_open"),n.addClass(o+"_collapsed")),n.addClass(o+"_animating"),t._visibilityToggle(a,n.parent(),!0,n)},a.prototype._itemClick=function(e){var t=this,n=t.settings,a=e.data("menu");a||(a={},a.arrow=e.children("."+o+"_arrow"),a.ul=e.next("ul"),a.parent=e.parent(),a.parent.hasClass(o+"_parent-link")&&(a.parent=e.parent().parent(),a.ul=e.parent().next("ul")),e.data("menu",a)),a.parent.hasClass(o+"_collapsed")?(a.arrow.html(n.openedSymbol),a.parent.removeClass(o+"_collapsed"),a.parent.addClass(o+"_open"),a.parent.addClass(o+"_animating"),t._visibilityToggle(a.ul,a.parent,!0,e)):(a.arrow.html(n.closedSymbol),a.parent.addClass(o+"_collapsed"),a.parent.removeClass(o+"_open"),a.parent.addClass(o+"_animating"),t._visibilityToggle(a.ul,a.parent,!0,e))},a.prototype._visibilityToggle=function(t,n,a,i,s){function l(t,n){e(t).removeClass(o+"_animating"),e(n).removeClass(o+"_animating"),s||p.afterOpen(t)}function r(n,a){t.attr("aria-hidden","true"),d.attr("tabindex","-1"),c._setVisAttr(t,!0),t.hide(),e(n).removeClass(o+"_animating"),e(a).removeClass(o+"_animating"),s?"init"==n&&p.init():p.afterClose(n)}var c=this,p=c.settings,d=c._getActionItems(t),u=0;a&&(u=p.duration),t.hasClass(o+"_hidden")?(t.removeClass(o+"_hidden"),s||p.beforeOpen(i),"jquery"===p.animations?t.stop(!0,!0).slideDown(u,p.easingOpen,function(){l(i,n)}):"velocity"===p.animations&&t.velocity("finish").velocity("slideDown",{duration:u,easing:p.easingOpen,complete:function(){l(i,n)}}),t.attr("aria-hidden","false"),d.attr("tabindex","0"),c._setVisAttr(t,!1)):(t.addClass(o+"_hidden"),s||p.beforeClose(i),"jquery"===p.animations?t.stop(!0,!0).slideUp(u,this.settings.easingClose,function(){r(i,n)}):"velocity"===p.animations&&t.velocity("finish").velocity("slideUp",{duration:u,easing:p.easingClose,complete:function(){r(i,n)}}))},a.prototype._setVisAttr=function(t,n){var a=this,i=t.children("li").children("ul").not("."+o+"_hidden");n?i.each(function(){var t=e(this);t.attr("aria-hidden","true");var i=a._getActionItems(t);i.attr("tabindex","-1"),a._setVisAttr(t,n)}):i.each(function(){var t=e(this);t.attr("aria-hidden","false");var i=a._getActionItems(t);i.attr("tabindex","0"),a._setVisAttr(t,n)})},a.prototype._getActionItems=function(e){var t=e.data("menu");if(!t){t={};var n=e.children("li"),a=n.find("a");t.links=a.add(n.find("."+o+"_item")),e.data("menu",t)}return t.links},a.prototype._outlines=function(t){t?e("."+o+"_item, ."+o+"_btn").css("outline",""):e("."+o+"_item, ."+o+"_btn").css("outline","none")},a.prototype.toggle=function(){var e=this;e._menuToggle()},a.prototype.open=function(){var e=this;e.btn.hasClass(o+"_collapsed")&&e._menuToggle()},a.prototype.close=function(){var e=this;e.btn.hasClass(o+"_open")&&e._menuToggle()},e.fn[s]=function(t){var n=arguments;if(void 0===t||"object"==typeof t)return this.each(function(){e.data(this,"plugin_"+s)||e.data(this,"plugin_"+s,new a(this,t))});if("string"==typeof t&&"_"!==t[0]&&"init"!==t){var i;return this.each(function(){var o=e.data(this,"plugin_"+s);o instanceof a&&"function"==typeof o[t]&&(i=o[t].apply(o,Array.prototype.slice.call(n,1)))}),void 0!==i?i:this}}}(jQuery,document,window);js/newstoday.js0000755000000000000000000000174513347177614010762 0ustar jQuery(document).ready(function($) { /** * Document ready (jQuery) */ $(function () { /** * Activate superfish menu. */ $('.sf-menu').superfish({ 'speed': 'fast', 'delay' : 0, 'animation': { 'height': 'show' } }); }); /** * SlickNav */ $('#menu-main-slick').slicknav({ prependTo:'.site-navbar-header', label: newstodayStrings.slicknav_menu_home, allowParentLinks: true }); function mobileadjust() { var windowWidth = $(window).width(); if( typeof window.orientation === 'undefined' ) { $('#menu-main').removeAttr('style'); } if( windowWidth < 769 ) { $('#menu-main').addClass('mobile-menu'); } } mobileadjust(); $(window).resize(function() { mobileadjust(); }); });js/superfish.js0000755000000000000000000001667213347177614010762 0ustar /* * jQuery Superfish Menu Plugin - v1.7.10 * Copyright (c) 2018 Joel Birch * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ ;(function ($, w) { "use strict"; var methods = (function () { // private properties and methods go here var c = { bcClass: 'sf-breadcrumb', menuClass: 'sf-js-enabled', anchorClass: 'sf-with-ul', menuArrowClass: 'sf-arrows' }, ios = (function () { var ios = /^(?![\w\W]*Windows Phone)[\w\W]*(iPhone|iPad|iPod)/i.test(navigator.userAgent); if (ios) { // tap anywhere on iOS to unfocus a submenu $('html').css('cursor', 'pointer').on('click', $.noop); } return ios; })(), wp7 = (function () { var style = document.documentElement.style; return ('behavior' in style && 'fill' in style && /iemobile/i.test(navigator.userAgent)); })(), unprefixedPointerEvents = (function () { return (!!w.PointerEvent); })(), toggleMenuClasses = function ($menu, o, add) { var classes = c.menuClass, method; if (o.cssArrows) { classes += ' ' + c.menuArrowClass; } method = (add) ? 'addClass' : 'removeClass'; $menu[method](classes); }, setPathToCurrent = function ($menu, o) { return $menu.find('li.' + o.pathClass).slice(0, o.pathLevels) .addClass(o.hoverClass + ' ' + c.bcClass) .filter(function () { return ($(this).children(o.popUpSelector).hide().show().length); }).removeClass(o.pathClass); }, toggleAnchorClass = function ($li, add) { var method = (add) ? 'addClass' : 'removeClass'; $li.children('a')[method](c.anchorClass); }, toggleTouchAction = function ($menu) { var msTouchAction = $menu.css('ms-touch-action'); var touchAction = $menu.css('touch-action'); touchAction = touchAction || msTouchAction; touchAction = (touchAction === 'pan-y') ? 'auto' : 'pan-y'; $menu.css({ 'ms-touch-action': touchAction, 'touch-action': touchAction }); }, getMenu = function ($el) { return $el.closest('.' + c.menuClass); }, getOptions = function ($el) { return getMenu($el).data('sfOptions'); }, over = function () { var $this = $(this), o = getOptions($this); clearTimeout(o.sfTimer); $this.siblings().superfish('hide').end().superfish('show'); }, close = function (o) { o.retainPath = ($.inArray(this[0], o.$path) > -1); this.superfish('hide'); if (!this.parents('.' + o.hoverClass).length) { o.onIdle.call(getMenu(this)); if (o.$path.length) { $.proxy(over, o.$path)(); } } }, out = function () { var $this = $(this), o = getOptions($this); if (ios) { $.proxy(close, $this, o)(); } else { clearTimeout(o.sfTimer); o.sfTimer = setTimeout($.proxy(close, $this, o), o.delay); } }, touchHandler = function (e) { var $this = $(this), o = getOptions($this), $ul = $this.siblings(e.data.popUpSelector); if (o.onHandleTouch.call($ul) === false) { return this; } if ($ul.length > 0 && $ul.is(':hidden')) { $this.one('click.superfish', false); if (e.type === 'MSPointerDown' || e.type === 'pointerdown') { $this.trigger('focus'); } else { $.proxy(over, $this.parent('li'))(); } } }, applyHandlers = function ($menu, o) { var targets = 'li:has(' + o.popUpSelector + ')'; if ($.fn.hoverIntent && !o.disableHI) { $menu.hoverIntent(over, out, targets); } else { $menu .on('mouseenter.superfish', targets, over) .on('mouseleave.superfish', targets, out); } var touchevent = 'MSPointerDown.superfish'; if (unprefixedPointerEvents) { touchevent = 'pointerdown.superfish'; } if (!ios) { touchevent += ' touchend.superfish'; } if (wp7) { touchevent += ' mousedown.superfish'; } $menu .on('focusin.superfish', 'li', over) .on('focusout.superfish', 'li', out) .on(touchevent, 'a', o, touchHandler); }; return { // public methods hide: function (instant) { if (this.length) { var $this = this, o = getOptions($this); if (!o) { return this; } var not = (o.retainPath === true) ? o.$path : '', $ul = $this.find('li.' + o.hoverClass).add(this).not(not).removeClass(o.hoverClass).children(o.popUpSelector), speed = o.speedOut; if (instant) { $ul.show(); speed = 0; } o.retainPath = false; if (o.onBeforeHide.call($ul) === false) { return this; } $ul.stop(true, true).animate(o.animationOut, speed, function () { var $this = $(this); o.onHide.call($this); }); } return this; }, show: function () { var o = getOptions(this); if (!o) { return this; } var $this = this.addClass(o.hoverClass), $ul = $this.children(o.popUpSelector); if (o.onBeforeShow.call($ul) === false) { return this; } $ul.stop(true, true).animate(o.animation, o.speed, function () { o.onShow.call($ul); }); return this; }, destroy: function () { return this.each(function () { var $this = $(this), o = $this.data('sfOptions'), $hasPopUp; if (!o) { return false; } $hasPopUp = $this.find(o.popUpSelector).parent('li'); clearTimeout(o.sfTimer); toggleMenuClasses($this, o); toggleAnchorClass($hasPopUp); toggleTouchAction($this); // remove event handlers $this.off('.superfish').off('.hoverIntent'); // clear animation's inline display style $hasPopUp.children(o.popUpSelector).attr('style', function (i, style) { if (typeof style !== 'undefined') { return style.replace(/display[^;]+;?/g, ''); } }); // reset 'current' path classes o.$path.removeClass(o.hoverClass + ' ' + c.bcClass).addClass(o.pathClass); $this.find('.' + o.hoverClass).removeClass(o.hoverClass); o.onDestroy.call($this); $this.removeData('sfOptions'); }); }, init: function (op) { return this.each(function () { var $this = $(this); if ($this.data('sfOptions')) { return false; } var o = $.extend({}, $.fn.superfish.defaults, op), $hasPopUp = $this.find(o.popUpSelector).parent('li'); o.$path = setPathToCurrent($this, o); $this.data('sfOptions', o); toggleMenuClasses($this, o, true); toggleAnchorClass($hasPopUp, true); toggleTouchAction($this); applyHandlers($this, o); $hasPopUp.not('.' + c.bcClass).superfish('hide', true); o.onInit.call(this); }); } }; })(); $.fn.superfish = function (method, args) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method === 'object' || ! method) { return methods.init.apply(this, arguments); } else { return $.error('Method ' + method + ' does not exist on jQuery.fn.superfish'); } }; $.fn.superfish.defaults = { popUpSelector: 'ul,.sf-mega', // within menu context hoverClass: 'sfHover', pathClass: 'overrideThisToUse', pathLevels: 1, delay: 800, animation: {opacity: 'show'}, animationOut: {opacity: 'hide'}, speed: 'normal', speedOut: 'fast', cssArrows: true, disableHI: false, onInit: $.noop, onBeforeShow: $.noop, onShow: $.noop, onBeforeHide: $.noop, onHide: $.noop, onIdle: $.noop, onDestroy: $.noop, onHandleTouch: $.noop }; })(jQuery, window); js/superfish.min.js0000755000000000000000000001062313347177614011532 0ustar /* * jQuery Superfish Menu Plugin - v1.7.10 * Copyright (c) 2018 Joel Birch * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ ;!function(a,b){"use strict";var c=function(){var c={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",menuArrowClass:"sf-arrows"},d=function(){var b=/^(?![\w\W]*Windows Phone)[\w\W]*(iPhone|iPad|iPod)/i.test(navigator.userAgent);return b&&a("html").css("cursor","pointer").on("click",a.noop),b}(),e=function(){var a=document.documentElement.style;return"behavior"in a&&"fill"in a&&/iemobile/i.test(navigator.userAgent)}(),f=function(){return!!b.PointerEvent}(),g=function(a,b,d){var e,f=c.menuClass;b.cssArrows&&(f+=" "+c.menuArrowClass),e=d?"addClass":"removeClass",a[e](f)},h=function(b,d){return b.find("li."+d.pathClass).slice(0,d.pathLevels).addClass(d.hoverClass+" "+c.bcClass).filter(function(){return a(this).children(d.popUpSelector).hide().show().length}).removeClass(d.pathClass)},i=function(a,b){var d=b?"addClass":"removeClass";a.children("a")[d](c.anchorClass)},j=function(a){var b=a.css("ms-touch-action"),c=a.css("touch-action");c=c||b,c="pan-y"===c?"auto":"pan-y",a.css({"ms-touch-action":c,"touch-action":c})},k=function(a){return a.closest("."+c.menuClass)},l=function(a){return k(a).data("sfOptions")},m=function(){var b=a(this),c=l(b);clearTimeout(c.sfTimer),b.siblings().superfish("hide").end().superfish("show")},n=function(b){b.retainPath=a.inArray(this[0],b.$path)>-1,this.superfish("hide"),this.parents("."+b.hoverClass).length||(b.onIdle.call(k(this)),b.$path.length&&a.proxy(m,b.$path)())},o=function(){var b=a(this),c=l(b);d?a.proxy(n,b,c)():(clearTimeout(c.sfTimer),c.sfTimer=setTimeout(a.proxy(n,b,c),c.delay))},p=function(b){var c=a(this),d=l(c),e=c.siblings(b.data.popUpSelector);return d.onHandleTouch.call(e)===!1?this:void(e.length>0&&e.is(":hidden")&&(c.one("click.superfish",!1),"MSPointerDown"===b.type||"pointerdown"===b.type?c.trigger("focus"):a.proxy(m,c.parent("li"))()))},q=function(b,c){var g="li:has("+c.popUpSelector+")";a.fn.hoverIntent&&!c.disableHI?b.hoverIntent(m,o,g):b.on("mouseenter.superfish",g,m).on("mouseleave.superfish",g,o);var h="MSPointerDown.superfish";f&&(h="pointerdown.superfish"),d||(h+=" touchend.superfish"),e&&(h+=" mousedown.superfish"),b.on("focusin.superfish","li",m).on("focusout.superfish","li",o).on(h,"a",c,p)};return{hide:function(b){if(this.length){var c=this,d=l(c);if(!d)return this;var e=d.retainPath===!0?d.$path:"",f=c.find("li."+d.hoverClass).add(this).not(e).removeClass(d.hoverClass).children(d.popUpSelector),g=d.speedOut;if(b&&(f.show(),g=0),d.retainPath=!1,d.onBeforeHide.call(f)===!1)return this;f.stop(!0,!0).animate(d.animationOut,g,function(){var b=a(this);d.onHide.call(b)})}return this},show:function(){var a=l(this);if(!a)return this;var b=this.addClass(a.hoverClass),c=b.children(a.popUpSelector);return a.onBeforeShow.call(c)===!1?this:(c.stop(!0,!0).animate(a.animation,a.speed,function(){a.onShow.call(c)}),this)},destroy:function(){return this.each(function(){var b,d=a(this),e=d.data("sfOptions");return!!e&&(b=d.find(e.popUpSelector).parent("li"),clearTimeout(e.sfTimer),g(d,e),i(b),j(d),d.off(".superfish").off(".hoverIntent"),b.children(e.popUpSelector).attr("style",function(a,b){if("undefined"!=typeof b)return b.replace(/display[^;]+;?/g,"")}),e.$path.removeClass(e.hoverClass+" "+c.bcClass).addClass(e.pathClass),d.find("."+e.hoverClass).removeClass(e.hoverClass),e.onDestroy.call(d),void d.removeData("sfOptions"))})},init:function(b){return this.each(function(){var d=a(this);if(d.data("sfOptions"))return!1;var e=a.extend({},a.fn.superfish.defaults,b),f=d.find(e.popUpSelector).parent("li");e.$path=h(d,e),d.data("sfOptions",e),g(d,e,!0),i(f,!0),j(d),q(d,e),f.not("."+c.bcClass).superfish("hide",!0),e.onInit.call(this)})}}}();a.fn.superfish=function(b,d){return c[b]?c[b].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof b&&b?a.error("Method "+b+" does not exist on jQuery.fn.superfish"):c.init.apply(this,arguments)},a.fn.superfish.defaults={popUpSelector:"ul,.sf-mega",hoverClass:"sfHover",pathClass:"overrideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},animationOut:{opacity:"hide"},speed:"normal",speedOut:"fast",cssArrows:!0,disableHI:!1,onInit:a.noop,onBeforeShow:a.noop,onShow:a.noop,onBeforeHide:a.noop,onHide:a.noop,onIdle:a.noop,onDestroy:a.noop,onHandleTouch:a.noop}}(jQuery,window);