var $this = $(this),
$li = $this.parent('li')
$next = $li.children('UL').first();
if (e.type == 'mouseenter') {
//Clear Timeout
clearTimeout(data.timer);
//Clean up adjacent hover classes, but not the current xpath
data.lis.not($li).not($li.parents()).removeClass(o.hoverClass);
//Add hover class to current LI
$li.addClass(o.hoverClass);
//Find next UL and animate it
if ($next.is(':hidden')) {
o.onBeforeShow.call(null,$next);
$next.animate(o.animIn,o.speedIn,o.easeIn, function(){
o.onShow.call(null,$next);
})
}
} else if (e.type == "mouseleave") {
data.timer = setTimeout(function(){
methods.close(_);
},o.delay);
} else {
console.warn(' $(this), event.type', $(this), e.type)
}
e.preventDefault();
e.stopPropagation();
return false;
});
//@TODO
if (o.pathClass !== sf.defaults.pathClass) {
console.warn('@TODO pathClass enabled')
$('li.'+o.pathClass,_).slice(0,o.pathLevels)
}
o.onAfterInit.call(null,_);
})//End jQuery.each
},//END INIT METHOD
close: function (elem) {
//Handle API invoked method
if (typeof(elem) == "undefined") var elem = $(this);
return elem.each( function () {
var data = elem.data('superfish'),
o = data.options;
o.onBeforeHide.call(null,elem);
data.uls.animate(o.animOut,o.speedOut,o.easeOut, function(){
o.onHide.call(null,$(this));
});
//Second timeout to run after animation is complete
setTimeout( function () {
data.uls.hide();
data.lis.removeClass(o.hoverClass);
}, o.speedOut);
})
},
destroy: function () {
return this.each( function () {
if ($(this).data('superfish')) {
var data = $(this).data('superfish'),
o = data.options;
data.target.removeClass(sf.c.menuClass);
data.uls.removeAttr('style');
if (o.autoArrows) {
$('li:has(ul)',data.target).removeClass(sf.c.anchorClass)
$("."+sf.c.subClass,data.target).remove();
}
data.lis.undelegate('a','mouseenter mouseleave');
$(this).removeData('superfish');
} else {
if (typeof(console) !== "undefined") console.warn('Superfish not initialized on that dom element')
}
})
}
}//End Methods
})(jQuery);
(function($) {
$(window).bind('resize load',function() {
if( $(this).width() > 599 ) { /* if screen is wider than 600px, use Superfish */
$('#site-nav ul').superfish({
hoverClass :'menu-hover', /* change hover class from default sfHover */
delay : 600, /* delay on mouseout, in ms */
animIn : {opacity:'show',height:'show'}, /* fade-in and slide-down animation */
animOut : {opacity:'hide',height:'hide'},
speedIn : 'normal',
speedOut : 'slow',
easeIn : 'easeOutExpo',
easeOut : 'easeInExpo'
});
}
});
})(jQuery);
(function($) {
$(window).bind('resize',function() {
if( $(this).width() < 600 ) {
$('ul.main-nav ul.sub-menu').removeAttr('style');
$('ul.main-nav').removeClass('sf-js-enabled');
};
});
})(jQuery);
jQuery( document ).ready( function( $ ) {
if(window.location.hash) {
$(window.location.hash).addClass( 'highlight' );
}
});
/* Lifted from _s & modified to suit, Handles toggling main nav for small screens.
*/
jQuery( document ).ready( function( $ ) {
var $masthead = $( '#masthead' ),
timeout = false;
$.fn.smallMenu = function() {
$masthead.find( '#site-nav' ).removeClass( 'main-nav' ).addClass( 'main-nav-small' );
$masthead.find( '#site-nav h1' ).removeClass( 'assistive-text' ).addClass( 'menu-toggle' );
/* $masthead.find( '.sub-menu' ).removeAttr( 'style' );
*/
$( '.menu-toggle' ).unbind( 'click' ).click( function() {
$masthead.find( '.menu' ).toggle();
$( this ).toggleClass( 'toggled-on' );
} );
};
/* Check viewport width on first load. */
if ( $( window ).width() < 600 )
$.fn.smallMenu();
/* Check viewport width when user resizes the browser window. */
$( window ).resize( function() {
var browserWidth = $( window ).width();
if ( false !== timeout )
clearTimeout( timeout );
timeout = setTimeout( function() {
if ( browserWidth < 600 ) {
$.fn.smallMenu();
} else {
$masthead.find( '#site-nav' ).removeClass( 'main-nav-small' ).addClass( 'main-nav' );
$masthead.find( '#site-nav h1' ).removeClass( 'menu-toggle' ).addClass( 'assistive-text' );
$masthead.find( '.menu' ).removeAttr( 'style' );
}
}, 200 );
} );
} );
/* scripts by Matt Weibe et al for device detection, resizing media, and enabling touch events for hover
*/
(function($){
function supportsTouch() {
var android = navigator.userAgent.indexOf('Android') != -1
return android || !!('createTouch' in document)
}
$.support.touch = supportsTouch
/* Use $('a').touchOrClick instead of $('a').click in your code. */
$.fn.touchOrClick = function(efunc) {
if (typeof efunc == 'undefined') {
return this.trigger(supportsTouch() ? 'touchstart' : 'click')
} else {
return this.bind(supportsTouch() ? 'touchstart' : 'click', efunc)
}
}
})(jQuery);
jQuery(document).ready(function($) {
var mainMenu = $("nav .main-nav");
/* mainMenu.fitText(6.5, {minWidth:1600})
$("hgroup h1").fitText(3.2, {minWidth:420}) */
/* menus on touch devices can't exactly hover. */
if ( $.support.touch ) {
$.addOutsideEvent('touchstart', 'touchoutside')
function openMenu() {
mainMenu.addClass('hover').unbind('touchstart').bind('touchoutside', closeMenu)
}
function closeMenu() {
mainMenu.removeClass('hover').unbind('touchoutside').bind('touchstart', openMenu)
}
closeMenu()
}
mainMenu.click(function(event) {
$(this).toggleClass("hover")
})
/*
$("#main .main").fitVids({cusomSelector: 'iframe[src^="http://maps.google"]:first'})
*/
/* pseudo color-inherit on linked steps */
/* if ( $.browser.msie && $.browser.version.substring(0, 1) < 8 ) {
$("h1 > a, h2 > a").each(function(index) {
var me = $(this),
color = me.parent().css('color')
me.css('color', color)
})
}
*/
});
/*
* FitText.js 1.2
*
* Copyright 2011, Dave Rupert http://daverupert.com
* Contribution by Matt Wiebe http://somadesign.ca/
* Released under the WTFPL license
* http://sam.zoy.org/wtfpl/
*
* Date: Mon Sep 05 12:31:00 2011 -0600
*/
(function(a){a.fn.fitText=function(d,b){var c={minFontSize:Number.NEGATIVE_INFINITY,maxFontSize:Number.POSITIVE_INFINITY,minWidth:0,maxWidth:Number.POSITIVE_INFINITY};return this.each(function(){var e=a(this);var g=d||1;if(b){a.extend(c,b);}var f=function(){var h=a(window).width();if(h>=c.minWidth&&h<=c.maxWidth){e.css("fontSize",Math.max(Math.min(e.width()/(g*10),parseFloat(c.maxFontSize)),parseFloat(c.minFontSize)));}else{e.css("fontSize","");}};f();a(window).resize(f);});};})(jQuery);
/*
* FitVids 1.0
*
* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
*
* Date: Thu Sept 01 18:00:00 2011 -0500
*/
(function(a){a.fn.fitVids=function(b){var c={customSelector:null};var e=document.createElement("div"),d=document.getElementsByTagName("base")[0]||document.getElementsByTagName("script")[0];e.className="fit-vids-style";e.innerHTML="";d.parentNode.insertBefore(e,d);if(b){a.extend(c,b);}return this.each(function(){var f=["iframe[src^='http://player.vimeo.com']","iframe[src^='http://www.youtube.com']","iframe[src^='http://www.kickstarter.com']","object","embed"];if(c.customSelector){f.push(c.customSelector);}var g=a(this).find(f.join(","));g.each(function(){var j=a(this),h=this.tagName=="OBJECT"?j.attr("height"):j.height(),i=h/j.width();j.wrap('').parent(".fluid-width-video-wrapper").css("padding-top",(i*100)+"%");j.removeAttr("height").removeAttr("width");});});};})(jQuery);
/*
* jQuery outside events - v1.1 - 3/16/2010
* http://benalman.com/projects/jquery-outside-events-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($,c,b){$.map("click dblclick mousemove mousedown mouseup mouseover mouseout change select submit keydown keypress keyup".split(" "),function(d){a(d)});a("focusin","focus"+b);a("focusout","blur"+b);$.addOutsideEvent=a;function a(g,e){e=e||g+b;var d=$(),h=g+"."+e+"-special-event";$.event.special[e]={setup:function(){d=d.add(this);if(d.length===1){$(c).bind(h,f)}},teardown:function(){d=d.not(this);if(d.length===0){$(c).unbind(h)}},add:function(i){var j=i.handler;i.handler=function(l,k){l.target=k;j.apply(this,arguments)}}};function f(i){$(d).each(function(){var j=$(this);if(this!==i.target&&!j.has(i.target).length){j.triggerHandler(e,[i.target])}})}}})(jQuery,document,"outside");