Template:Montgomery Cougars NJUSA/Common JS

From 2014hs.igem.org

(Difference between revisions)
Line 1: Line 1:
-
/* Edit this file: https://2014hs.igem.org/wiki/index.php?title=Template:Montgomery_Cougars_NJUSA/Common_CSS&action=edit */
+
$(document).ready(function(){if($("p").filter(function(){return""==$.trim($(this).html())}).remove(),$("br:only-child").remove(),0!=$("#slider").length&&($(".generic-image").remove(),$("#slider").unslider({delay:3250,fluid:!0})),0!=$("#toc").length){$("#toc").remove(),$("body").addClass("with-toc");{$('<div id="jqtoc"></div>').prependTo("#main").toc({container:"#inner-content",headerText:function(t,e,i){return i.text().replace(/\[edit\]/g,"")},selectors:"h1, h2"})}$("#jqtoc > ul").stickySidebar({breakingPoint1:401,contentSelector:"#inner-content",footerThreshold:150,sidebarTopMargin:0})}}),function(t,e){if(!t)return e;var i=function(){this.el=e,this.items=e,this.sizes=[],this.max=[0,0],this.current=0,this.interval=e,this.opts={speed:500,delay:3e3,complete:e,keys:!e,dots:e,fluid:e};var i=this;this.init=function(e,i){return this.el=e,this.ul=e.children("ul"),this.max=[e.outerWidth(),e.outerHeight()],this.items=this.ul.children("li").each(this.calculate),this.opts=t.extend(this.opts,i),this.setup(),this},this.calculate=function(e){var s=t(this),n=s.outerWidth(),o=s.outerHeight();i.sizes[e]=[n,o],n>i.max[0]&&(i.max[0]=n),o>i.max[1]&&(i.max[1]=o)},this.setup=function(){if(this.el.css({overflow:"hidden",width:i.max[0],height:this.items.first().outerHeight()}),this.ul.css({width:100*this.items.length+"%",position:"relative"}),this.items.css("width",100/this.items.length+"%"),this.opts.delay!==e&&(this.start(),this.el.hover(this.stop,this.start)),this.opts.keys&&t(document).keydown(this.keys),this.opts.dots&&this.dots(),this.opts.fluid){var s=function(){i.el.css("width",Math.min(Math.round(i.el.outerWidth()/i.el.parent().outerWidth()*100),100)+"%")};s(),t(window).resize(s)}this.opts.arrows&&this.el.parent().append('<p class="arrows"><span class="prev">←</span><span class="next">→</span></p>').find(".arrows span").click(function(){t.isFunction(i[this.className])&&i[this.className]()}),t.event.swipe&&this.el.on("swipeleft",i.prev).on("swiperight",i.next)},this.move=function(e,s){this.items.eq(e).length||(e=0),0>e&&(e=this.items.length-1);var n=this.items.eq(e),o={height:n.outerHeight()},r=s?5:this.opts.speed;this.ul.is(":animated")||(i.el.find(".dot:eq("+e+")").addClass("active").siblings().removeClass("active"),this.el.animate(o,r)&&this.ul.animate(t.extend({left:"-"+e+"00%"},o),r,function(){i.current=e,t.isFunction(i.opts.complete)&&!s&&i.opts.complete(i.el)}))},this.start=function(){i.interval=setInterval(function(){i.move(i.current+1)},i.opts.delay)},this.stop=function(){return i.interval=clearInterval(i.interval),i},this.keys=function(e){var s=e.which,n={37:i.prev,39:i.next,27:i.stop};t.isFunction(n[s])&&n[s]()},this.next=function(){return i.stop().move(i.current+1)},this.prev=function(){return i.stop().move(i.current-1)},this.dots=function(){var e='<ol class="dots">';t.each(this.items,function(t){e+='<li class="dot'+(1>t?" active":"")+'">'+(t+1)+"</li>"}),e+="</ol>",this.el.addClass("has-dots").append(e).find(".dot").click(function(){i.move(t(this).index())})}};t.fn.unslider=function(e){var s=this.length;return this.each(function(n){var o=t(this),r=(new i).init(o,e);o.data("unslider"+(s>1?"-"+(n+1):""),r)})}}(window.jQuery,!1),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(t){function e(t){var e,i,s;e=t.currentTarget.offsetWidth,i=t.currentTarget.offsetHeight,s={distX:t.distX,distY:t.distY,velocityX:t.velocityX,velocityY:t.velocityY,finger:t.finger},t.distX>t.distY?t.distX>-t.distY?(t.distX/e>r.threshold||t.velocityX*t.distX/e*r.sensitivity>1)&&(s.type="swiperight",o(t.currentTarget,s)):(-t.distY/i>r.threshold||t.velocityY*t.distY/e*r.sensitivity>1)&&(s.type="swipeup",o(t.currentTarget,s)):t.distX>-t.distY?(t.distY/i>r.threshold||t.velocityY*t.distY/e*r.sensitivity>1)&&(s.type="swipedown",o(t.currentTarget,s)):(-t.distX/e>r.threshold||t.velocityX*t.distX/e*r.sensitivity>1)&&(s.type="swipeleft",o(t.currentTarget,s))}function i(e){var i=t.data(e,"event_swipe");return i||(i={count:0},t.data(e,"event_swipe",i)),i}var s=t.event.add,n=t.event.remove,o=function(e,i,s){t.event.trigger(i,s,e)},r={threshold:.4,sensitivity:6};t.event.special.swipe=t.event.special.swipeleft=t.event.special.swiperight=t.event.special.swipeup=t.event.special.swipedown={setup:function(t){var t=i(this);if(!(t.count++>0))return s(this,"moveend",e),!0},teardown:function(){var t=i(this);if(!(--t.count>0))return n(this,"moveend",e),!0},settings:r}}),!function(t){t.fn.smoothScroller=function(e){e=t.extend({},t.fn.smoothScroller.defaults,e);var i=t(this);return t(e.scrollEl).animate({scrollTop:i.offset().top-t(e.scrollEl).offset().top-e.offset},e.speed,e.ease,function(){var t=i.attr("id");t.length&&(history.pushState?history.pushState(null,null,"#"+t):document.location.hash=t),i.trigger("smoothScrollerComplete")}),this},t.fn.smoothScroller.defaults={speed:400,ease:"swing",scrollEl:"body,html",offset:0},t("body").on("click","[data-smoothscroller]",function(e){e.preventDefault();var i=t(this).attr("href");0===i.indexOf("#")&&t(i).smoothScroller()})}(jQuery),function(t){var e={};t.fn.toc=function(e){var i,s=this,n=t.extend({},jQuery.fn.toc.defaults,e),o=t(n.container),r=t(n.selectors,o),l=[],a=n.activeClass,h=function(e,i){if(n.smoothScrolling&&"function"==typeof n.smoothScrolling){e.preventDefault();var o=t(e.target).attr("href");n.smoothScrolling(o,n,i)}t("li",s).removeClass(a),t(e.target).parent().addClass(a)},c=function(){i&&clearTimeout(i),i=setTimeout(function(){for(var e,i=t(window).scrollTop(),o=Number.MAX_VALUE,r=0,h=0,c=l.length;c>h;h++){var d=Math.abs(l[h]-i);o>d&&(r=h,o=d)}t("li",s).removeClass(a),e=t("li:eq("+r+")",s).addClass(a),n.onHighlight(e)},50)};return n.highlightOnScroll&&(t(window).bind("scroll",c),c()),this.each(function(){var e=t(this),i=t(n.listType);r.each(function(s,o){var r=t(o);l.push(r.offset().top-n.highlightOffset);var a=n.anchorName(s,o,n.prefix);o.id!==a&&t("<span/>").attr("id",a).insertBefore(r);var d=t("<a/>").text(n.headerText(s,o,r)).attr("href","#"+a).bind("click",function(i){t(window).unbind("scroll",c),h(i,function(){t(window).bind("scroll",c)}),e.trigger("selected",t(this).attr("href"))}),u=t("<li/>").addClass(n.itemClass(s,o,r,n.prefix)).append(d);i.append(u)}),e.html(i)})},jQuery.fn.toc.defaults={container:"body",listType:"<ul/>",selectors:"h1,h2,h3",smoothScrolling:function(e,i,s){t(e).smoothScroller({offset:i.scrollToOffset}).on("smoothScrollerComplete",function(){s()})},scrollToOffset:0,prefix:"toc",activeClass:"toc-active",onHighlight:function(){},highlightOnScroll:!0,highlightOffset:100,anchorName:function(i,s,n){if(s.id.length)return s.id;var o=t(s).text().replace(/[^a-z0-9]/gi," ").replace(/\s+/g,"-").toLowerCase();if(e[o]){for(var r=2;e[o+r];)r++;o=o+"-"+r}return e[o]=!0,n+"-"+o},headerText:function(t,e,i){return i.text()},itemClass:function(t,e,i,s){return s+"-"+i[0].tagName.toLowerCase()}}}(jQuery),function(t){t.fn.stickySidebar=function(e){var i=t.extend({headerSelector:"header",navSelector:"nav",contentSelector:"#content",footerSelector:"footer",sidebarTopMargin:20,footerThreshold:40},e),s=function(){var e=t(this),s=t(window).height(),n=(t(window).width(),t(document).height()),o=t(i.headerSelector).outerHeight(),r=t(i.navSelector).outerHeight(),l=e.outerHeight(),a=t(i.contentSelector).outerHeight(),h=t(i.footerSelector).outerHeight(),c=t(window).scrollTop(),d=i.breakingPoint1||o+r,u=n-(l+h+i.footerThreshold);if(a>l&&s>l)if(d>c)e.removeClass("sticky");else if(c>=d&&u>c)e.addClass("sticky").css("top",i.sidebarTopMargin);else{var f=u-c;e.addClass("sticky").css("top",f)}};return this.each(function(){t(window).on("scroll",t.proxy(s,this)),t(window).on("resize",t.proxy(s,this)),t.proxy(s,this)()})}}(jQuery);
-
 
+
-
/* https://2011.igem.org/Team:DTU-Denmark/How_to_customize_an_iGEM_wiki#Remove_all_empty_.3Cp.3E.3C.2Fp.3E_tags */
+
-
$(document).ready(function() {
+
-
    $("p").filter( function() {
+
-
        return $.trim($(this).html()) == '';
+
-
    }).remove();
+
-
    $("br:only-child").remove();
+
-
 
+
-
    if($('#slider').length != 0) {
+
-
        $('.generic-image').remove();
+
-
        $('#slider').unslider({
+
-
            delay: 3250,
+
-
            fluid: true
+
-
        });
+
-
    }
+
-
 
+
-
    if($('#toc').length != 0) {
+
-
        $('#toc').remove();
+
-
        $('body').addClass('with-toc');
+
-
 
+
-
        var $jqtoc = $('<div id="jqtoc"></div>')
+
-
        .prependTo('#main')
+
-
        .toc({
+
-
            container: '#inner-content',
+
-
            headerText: function(i, heading, $heading) { // remove [edit] link
+
-
                return $heading.text().replace(/\[edit\]/g, '');
+
-
            },
+
-
            selectors: 'h1, h2'
+
-
        });
+
-
 
+
-
        $('#jqtoc > ul').stickySidebar({
+
-
            breakingPoint1: 401,
+
-
            contentSelector: '#inner-content',
+
-
            footerThreshold: 150,
+
-
            sidebarTopMargin: 0
+
-
        });
+
-
 
+
-
        // if($('#jqtoc ul').height() > $(window).height()) {
+
-
        //    $('#jqtoc ul').height($(window).height() - 5);
+
-
        //    $('#jqtoc ul').css({ 'overflow-y': 'scroll' });
+
-
        // }
+
-
    }
+
-
 
+
-
});
+
-
 
+
-
/**
+
-
*  Unslider by @idiot
+
-
*/
+
-
(function(e,t){if(!e)return t;var n=function(){this.el=t;this.items=t;this.sizes=[];this.max=[0,0];this.current=0;this.interval=t;this.opts={speed:500,delay:3e3,complete:t,keys:!t,dots:t,fluid:t};var n=this;this.init=function(t,n){this.el=t;this.ul=t.children("ul");this.max=[t.outerWidth(),t.outerHeight()];this.items=this.ul.children("li").each(this.calculate);this.opts=e.extend(this.opts,n);this.setup();return this};this.calculate=function(t){var r=e(this),i=r.outerWidth(),s=r.outerHeight();n.sizes[t]=[i,s];if(i>n.max[0])n.max[0]=i;if(s>n.max[1])n.max[1]=s};this.setup=function(){this.el.css({overflow:"hidden",width:n.max[0],height:this.items.first().outerHeight()});this.ul.css({width:this.items.length*100+"%",position:"relative"});this.items.css("width",100/this.items.length+"%");if(this.opts.delay!==t){this.start();this.el.hover(this.stop,this.start)}this.opts.keys&&e(document).keydown(this.keys);this.opts.dots&&this.dots();if(this.opts.fluid){var r=function(){n.el.css("width",Math.min(Math.round(n.el.outerWidth()/n.el.parent().outerWidth()*100),100)+"%")};r();e(window).resize(r)}if(this.opts.arrows){this.el.parent().append('<p class="arrows"><span class="prev">←</span><span class="next">→</span></p>').find(".arrows span").click(function(){e.isFunction(n[this.className])&&n[this.className]()})}if(e.event.swipe){this.el.on("swipeleft",n.prev).on("swiperight",n.next)}};this.move=function(t,r){if(!this.items.eq(t).length)t=0;if(t<0)t=this.items.length-1;var i=this.items.eq(t);var s={height:i.outerHeight()};var o=r?5:this.opts.speed;if(!this.ul.is(":animated")){n.el.find(".dot:eq("+t+")").addClass("active").siblings().removeClass("active");this.el.animate(s,o)&&this.ul.animate(e.extend({left:"-"+t+"00%"},s),o,function(i){n.current=t;e.isFunction(n.opts.complete)&&!r&&n.opts.complete(n.el)})}};this.start=function(){n.interval=setInterval(function(){n.move(n.current+1)},n.opts.delay)};this.stop=function(){n.interval=clearInterval(n.interval);return n};this.keys=function(t){var r=t.which;var i={37:n.prev,39:n.next,27:n.stop};if(e.isFunction(i[r])){i[r]()}};this.next=function(){return n.stop().move(n.current+1)};this.prev=function(){return n.stop().move(n.current-1)};this.dots=function(){var t='<ol class="dots">';e.each(this.items,function(e){t+='<li class="dot'+(e<1?" active":"")+'">'+(e+1)+"</li>"});t+="</ol>";this.el.addClass("has-dots").append(t).find(".dot").click(function(){n.move(e(this).index())})}};e.fn.unslider=function(t){var r=this.length;return this.each(function(i){var s=e(this);var u=(new n).init(s,t);s.data("unslider"+(r>1?"-"+(i+1):""),u)})}})(window.jQuery,false);
+
-
 
+
-
// jQuery.event.swipe
+
-
// 0.5
+
-
// Stephen Band
+
-
 
+
-
// Dependencies
+
-
// jQuery.event.move 1.2
+
-
 
+
-
// One of swipeleft, swiperight, swipeup or swipedown is triggered on
+
-
// moveend, when the move has covered a threshold ratio of the dimension
+
-
// of the target node, or has gone really fast. Threshold and velocity
+
-
// sensitivity changed with:
+
-
//
+
-
// jQuery.event.special.swipe.settings.threshold
+
-
// jQuery.event.special.swipe.settings.sensitivity
+
-
(function(module){if(typeof define==='function'&&define.amd){define(['jquery'],module);}else{module(jQuery);}})(function(jQuery,undefined){var add=jQuery.event.add,remove=jQuery.event.remove,trigger=function(node,type,data){jQuery.event.trigger(type,data,node);},settings={threshold:0.4,sensitivity:6};function moveend(e){var w,h,event;w=e.currentTarget.offsetWidth;h=e.currentTarget.offsetHeight;event={distX:e.distX,distY:e.distY,velocityX:e.velocityX,velocityY:e.velocityY,finger:e.finger};if(e.distX>e.distY){if(e.distX>-e.distY){if(e.distX/w>settings.threshold||e.velocityX*e.distX/w*settings.sensitivity>1){event.type='swiperight';trigger(e.currentTarget,event);}} else{if(-e.distY/h>settings.threshold||e.velocityY*e.distY/w*settings.sensitivity>1){event.type='swipeup';trigger(e.currentTarget,event);}}} else{if(e.distX>-e.distY){if(e.distY/h>settings.threshold||e.velocityY*e.distY/w*settings.sensitivity>1){event.type='swipedown';trigger(e.currentTarget,event);}} else{if(-e.distX/w>settings.threshold||e.velocityX*e.distX/w*settings.sensitivity>1){event.type='swipeleft';trigger(e.currentTarget,event);}}}} function getData(node){var data=jQuery.data(node,'event_swipe');if(!data){data={count:0};jQuery.data(node,'event_swipe',data);} return data;} jQuery.event.special.swipe=jQuery.event.special.swipeleft=jQuery.event.special.swiperight=jQuery.event.special.swipeup=jQuery.event.special.swipedown={setup:function(data,namespaces,eventHandle){var data=getData(this);if(data.count++>0){return;} add(this,'moveend',moveend);return true;},teardown:function(){var data=getData(this);if(--data.count>0){return;} remove(this,'moveend',moveend);return true;},settings:settings};});
+
-
 
+
-
/*!
+
-
* toc - jQuery Table of Contents Plugin
+
-
* v0.3.2
+
-
* http://projects.jga.me/toc/
+
-
* copyright Greg Allen 2014
+
-
* MIT License
+
-
*/
+
-
!function(a){a.fn.smoothScroller=function(b){b=a.extend({},a.fn.smoothScroller.defaults,b);var c=a(this);return a(b.scrollEl).animate({scrollTop:c.offset().top-a(b.scrollEl).offset().top-b.offset},b.speed,b.ease,function(){var a=c.attr("id");a.length&&(history.pushState?history.pushState(null,null,"#"+a):document.location.hash=a),c.trigger("smoothScrollerComplete")}),this},a.fn.smoothScroller.defaults={speed:400,ease:"swing",scrollEl:"body,html",offset:0},a("body").on("click","[data-smoothscroller]",function(b){b.preventDefault();var c=a(this).attr("href");0===c.indexOf("#")&&a(c).smoothScroller()})}(jQuery),function(a){var b={};a.fn.toc=function(b){var c,d=this,e=a.extend({},jQuery.fn.toc.defaults,b),f=a(e.container),g=a(e.selectors,f),h=[],i=e.activeClass,j=function(b,c){if(e.smoothScrolling&&"function"==typeof e.smoothScrolling){b.preventDefault();var f=a(b.target).attr("href");e.smoothScrolling(f,e,c)}a("li",d).removeClass(i),a(b.target).parent().addClass(i)},k=function(){c&&clearTimeout(c),c=setTimeout(function(){for(var b,c=a(window).scrollTop(),f=Number.MAX_VALUE,g=0,j=0,k=h.length;k>j;j++){var l=Math.abs(h[j]-c);f>l&&(g=j,f=l)}a("li",d).removeClass(i),b=a("li:eq("+g+")",d).addClass(i),e.onHighlight(b)},50)};return e.highlightOnScroll&&(a(window).bind("scroll",k),k()),this.each(function(){var b=a(this),c=a(e.listType);g.each(function(d,f){var g=a(f);h.push(g.offset().top-e.highlightOffset);var i=e.anchorName(d,f,e.prefix);if(f.id!==i){a("<span/>").attr("id",i).insertBefore(g)}var l=a("<a/>").text(e.headerText(d,f,g)).attr("href","#"+i).bind("click",function(c){a(window).unbind("scroll",k),j(c,function(){a(window).bind("scroll",k)}),b.trigger("selected",a(this).attr("href"))}),m=a("<li/>").addClass(e.itemClass(d,f,g,e.prefix)).append(l);c.append(m)}),b.html(c)})},jQuery.fn.toc.defaults={container:"body",listType:"<ul/>",selectors:"h1,h2,h3",smoothScrolling:function(b,c,d){a(b).smoothScroller({offset:c.scrollToOffset}).on("smoothScrollerComplete",function(){d()})},scrollToOffset:0,prefix:"toc",activeClass:"toc-active",onHighlight:function(){},highlightOnScroll:!0,highlightOffset:100,anchorName:function(c,d,e){if(d.id.length)return d.id;var f=a(d).text().replace(/[^a-z0-9]/gi," ").replace(/\s+/g,"-").toLowerCase();if(b[f]){for(var g=2;b[f+g];)g++;f=f+"-"+g}return b[f]=!0,e+"-"+f},headerText:function(a,b,c){return c.text()},itemClass:function(a,b,c,d){return d+"-"+c[0].tagName.toLowerCase()}}}(jQuery);
+
-
 
+
-
 
+
-
// http://spoiledmilk.com/blog/sticky-sidebar/
+
-
(function ($) {
+
-
 
+
-
    $.fn.stickySidebar = function (options) {
+
-
 
+
-
        var config = $.extend({
+
-
            headerSelector: 'header',
+
-
            navSelector: 'nav',
+
-
            contentSelector: '#content',
+
-
            footerSelector: 'footer',
+
-
            sidebarTopMargin: 20,
+
-
            footerThreshold: 40
+
-
        }, options);
+
-
 
+
-
        var fixSidebr = function () {
+
-
 
+
-
            var sidebarSelector = $(this);
+
-
            var viewportHeight = $(window).height();
+
-
            var viewportWidth = $(window).width();
+
-
            var documentHeight = $(document).height();
+
-
            var headerHeight = $(config.headerSelector).outerHeight();
+
-
            var navHeight = $(config.navSelector).outerHeight();
+
-
            var sidebarHeight = sidebarSelector.outerHeight();
+
-
            var contentHeight = $(config.contentSelector).outerHeight();
+
-
            var footerHeight = $(config.footerSelector).outerHeight();
+
-
            var scroll_top = $(window).scrollTop();
+
-
            var fixPosition = contentHeight - sidebarHeight;
+
-
            var breakingPoint1 = config.breakingPoint1 || (headerHeight + navHeight);
+
-
            var breakingPoint2 = documentHeight - (sidebarHeight + footerHeight + config.footerThreshold);
+
-
 
+
-
            // calculate
+
-
            if ((contentHeight > sidebarHeight) && (viewportHeight > sidebarHeight)) {
+
-
 
+
-
                if (scroll_top < breakingPoint1) {
+
-
 
+
-
                    sidebarSelector.removeClass('sticky');
+
-
 
+
-
                } else if ((scroll_top >= breakingPoint1) && (scroll_top < breakingPoint2)) {
+
-
 
+
-
                    sidebarSelector.addClass('sticky').css('top', config.sidebarTopMargin);
+
-
 
+
-
                } else {
+
-
 
+
-
                    var negative = breakingPoint2 - scroll_top;
+
-
                    sidebarSelector.addClass('sticky').css('top', negative);
+
-
 
+
-
                }
+
-
 
+
-
            }
+
-
        };
+
-
 
+
-
        return this.each(function () {
+
-
            $(window).on('scroll', $.proxy(fixSidebr, this));
+
-
            $(window).on('resize', $.proxy(fixSidebr, this))
+
-
            $.proxy(fixSidebr, this)();
+
-
        });
+
-
 
+
-
    };
+
-
 
+
-
}(jQuery));
+

Revision as of 06:57, 20 June 2014

$(document).ready(function(){if($("p").filter(function(){return""==$.trim($(this).html())}).remove(),$("br:only-child").remove(),0!=$("#slider").length&&($(".generic-image").remove(),$("#slider").unslider({delay:3250,fluid:!0})),0!=$("#toc").length){$("#toc").remove(),$("body").addClass("with-toc");{$('
').prependTo("#main").toc({container:"#inner-content",headerText:function(t,e,i){return i.text().replace(/\[edit\]/g,"")},selectors:"h1, h2"})}$("#jqtoc > ul").stickySidebar({breakingPoint1:401,contentSelector:"#inner-content",footerThreshold:150,sidebarTopMargin:0})}}),function(t,e){if(!t)return e;var i=function(){this.el=e,this.items=e,this.sizes=[],this.max=[0,0],this.current=0,this.interval=e,this.opts={speed:500,delay:3e3,complete:e,keys:!e,dots:e,fluid:e};var i=this;this.init=function(e,i){return this.el=e,this.ul=e.children("ul"),this.max=[e.outerWidth(),e.outerHeight()],this.items=this.ul.children("li").each(this.calculate),this.opts=t.extend(this.opts,i),this.setup(),this},this.calculate=function(e){var s=t(this),n=s.outerWidth(),o=s.outerHeight();i.sizes[e]=[n,o],n>i.max[0]&&(i.max[0]=n),o>i.max[1]&&(i.max[1]=o)},this.setup=function(){if(this.el.css({overflow:"hidden",width:i.max[0],height:this.items.first().outerHeight()}),this.ul.css({width:100*this.items.length+"%",position:"relative"}),this.items.css("width",100/this.items.length+"%"),this.opts.delay!==e&&(this.start(),this.el.hover(this.stop,this.start)),this.opts.keys&&t(document).keydown(this.keys),this.opts.dots&&this.dots(),this.opts.fluid){var s=function(){i.el.css("width",Math.min(Math.round(i.el.outerWidth()/i.el.parent().outerWidth()*100),100)+"%")};s(),t(window).resize(s)}this.opts.arrows&&this.el.parent().append('

←→

').find(".arrows span").click(function(){t.isFunction(i[this.className])&&i[this.className]()}),t.event.swipe&&this.el.on("swipeleft",i.prev).on("swiperight",i.next)},this.move=function(e,s){this.items.eq(e).length||(e=0),0>e&&(e=this.items.length-1);var n=this.items.eq(e),o={height:n.outerHeight()},r=s?5:this.opts.speed;this.ul.is(":animated")||(i.el.find(".dot:eq("+e+")").addClass("active").siblings().removeClass("active"),this.el.animate(o,r)&&this.ul.animate(t.extend({left:"-"+e+"00%"},o),r,function(){i.current=e,t.isFunction(i.opts.complete)&&!s&&i.opts.complete(i.el)}))},this.start=function(){i.interval=setInterval(function(){i.move(i.current+1)},i.opts.delay)},this.stop=function(){return i.interval=clearInterval(i.interval),i},this.keys=function(e){var s=e.which,n={37:i.prev,39:i.next,27:i.stop};t.isFunction(n[s])&&n[s]()},this.next=function(){return i.stop().move(i.current+1)},this.prev=function(){return i.stop().move(i.current-1)},this.dots=function(){var e='
    ';t.each(this.items,function(t){e+='
  1. t?" active":"")+'">'+(t+1)+"
  2. "}),e+="
",this.el.addClass("has-dots").append(e).find(".dot").click(function(){i.move(t(this).index())})}};t.fn.unslider=function(e){var s=this.length;return this.each(function(n){var o=t(this),r=(new i).init(o,e);o.data("unslider"+(s>1?"-"+(n+1):""),r)})}}(window.jQuery,!1),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(t){function e(t){var e,i,s;e=t.currentTarget.offsetWidth,i=t.currentTarget.offsetHeight,s={distX:t.distX,distY:t.distY,velocityX:t.velocityX,velocityY:t.velocityY,finger:t.finger},t.distX>t.distY?t.distX>-t.distY?(t.distX/e>r.threshold||t.velocityX*t.distX/e*r.sensitivity>1)&&(s.type="swiperight",o(t.currentTarget,s)):(-t.distY/i>r.threshold||t.velocityY*t.distY/e*r.sensitivity>1)&&(s.type="swipeup",o(t.currentTarget,s)):t.distX>-t.distY?(t.distY/i>r.threshold||t.velocityY*t.distY/e*r.sensitivity>1)&&(s.type="swipedown",o(t.currentTarget,s)):(-t.distX/e>r.threshold||t.velocityX*t.distX/e*r.sensitivity>1)&&(s.type="swipeleft",o(t.currentTarget,s))}function i(e){var i=t.data(e,"event_swipe");return i||(i={count:0},t.data(e,"event_swipe",i)),i}var s=t.event.add,n=t.event.remove,o=function(e,i,s){t.event.trigger(i,s,e)},r={threshold:.4,sensitivity:6};t.event.special.swipe=t.event.special.swipeleft=t.event.special.swiperight=t.event.special.swipeup=t.event.special.swipedown={setup:function(t){var t=i(this);if(!(t.count++>0))return s(this,"moveend",e),!0},teardown:function(){var t=i(this);if(!(--t.count>0))return n(this,"moveend",e),!0},settings:r}}),!function(t){t.fn.smoothScroller=function(e){e=t.extend({},t.fn.smoothScroller.defaults,e);var i=t(this);return t(e.scrollEl).animate({scrollTop:i.offset().top-t(e.scrollEl).offset().top-e.offset},e.speed,e.ease,function(){var t=i.attr("id");t.length&&(history.pushState?history.pushState(null,null,"#"+t):document.location.hash=t),i.trigger("smoothScrollerComplete")}),this},t.fn.smoothScroller.defaults={speed:400,ease:"swing",scrollEl:"body,html",offset:0},t("body").on("click","[data-smoothscroller]",function(e){e.preventDefault();var i=t(this).attr("href");0===i.indexOf("#")&&t(i).smoothScroller()})}(jQuery),function(t){var e={};t.fn.toc=function(e){var i,s=this,n=t.extend({},jQuery.fn.toc.defaults,e),o=t(n.container),r=t(n.selectors,o),l=[],a=n.activeClass,h=function(e,i){if(n.smoothScrolling&&"function"==typeof n.smoothScrolling){e.preventDefault();var o=t(e.target).attr("href");n.smoothScrolling(o,n,i)}t("li",s).removeClass(a),t(e.target).parent().addClass(a)},c=function(){i&&clearTimeout(i),i=setTimeout(function(){for(var e,i=t(window).scrollTop(),o=Number.MAX_VALUE,r=0,h=0,c=l.length;c>h;h++){var d=Math.abs(l[h]-i);o>d&&(r=h,o=d)}t("li",s).removeClass(a),e=t("li:eq("+r+")",s).addClass(a),n.onHighlight(e)},50)};return n.highlightOnScroll&&(t(window).bind("scroll",c),c()),this.each(function(){var e=t(this),i=t(n.listType);r.each(function(s,o){var r=t(o);l.push(r.offset().top-n.highlightOffset);var a=n.anchorName(s,o,n.prefix);o.id!==a&&t("<span/>").attr("id",a).insertBefore(r);var d=t("<a/>").text(n.headerText(s,o,r)).attr("href","#"+a).bind("click",function(i){t(window).unbind("scroll",c),h(i,function(){t(window).bind("scroll",c)}),e.trigger("selected",t(this).attr("href"))}),u=t("
  • ").addClass(n.itemClass(s,o,r,n.prefix)).append(d);i.append(u)}),e.html(i)})},jQuery.fn.toc.defaults={container:"body",listType:"<ul/>",selectors:"h1,h2,h3",smoothScrolling:function(e,i,s){t(e).smoothScroller({offset:i.scrollToOffset}).on("smoothScrollerComplete",function(){s()})},scrollToOffset:0,prefix:"toc",activeClass:"toc-active",onHighlight:function(){},highlightOnScroll:!0,highlightOffset:100,anchorName:function(i,s,n){if(s.id.length)return s.id;var o=t(s).text().replace(/[^a-z0-9]/gi," ").replace(/\s+/g,"-").toLowerCase();if(e[o]){for(var r=2;e[o+r];)r++;o=o+"-"+r}return e[o]=!0,n+"-"+o},headerText:function(t,e,i){return i.text()},itemClass:function(t,e,i,s){return s+"-"+i[0].tagName.toLowerCase()}}}(jQuery),function(t){t.fn.stickySidebar=function(e){var i=t.extend({headerSelector:"header",navSelector:"nav",contentSelector:"#content",footerSelector:"footer",sidebarTopMargin:20,footerThreshold:40},e),s=function(){var e=t(this),s=t(window).height(),n=(t(window).width(),t(document).height()),o=t(i.headerSelector).outerHeight(),r=t(i.navSelector).outerHeight(),l=e.outerHeight(),a=t(i.contentSelector).outerHeight(),h=t(i.footerSelector).outerHeight(),c=t(window).scrollTop(),d=i.breakingPoint1||o+r,u=n-(l+h+i.footerThreshold);if(a>l&&s>l)if(d>c)e.removeClass("sticky");else if(c>=d&&u>c)e.addClass("sticky").css("top",i.sidebarTopMargin);else{var f=u-c;e.addClass("sticky").css("top",f)}};return this.each(function(){t(window).on("scroll",t.proxy(s,this)),t(window).on("resize",t.proxy(s,this)),t.proxy(s,this)()})}}(jQuery);