Template:Montgomery Cougars NJUSA/Common JS
From 2014hs.igem.org
Casey.chow (Talk | contribs) |
Casey.chow (Talk | contribs) |
||
Line 15: | Line 15: | ||
}); | }); | ||
} | } | ||
- | + | ||
$('#nav ul ul').parent().children('a').addClass('is-parent'); | $('#nav ul ul').parent().children('a').addClass('is-parent'); | ||
Latest revision as of 19:26, 20 June 2014
/* Edit this file: https://2014hs.igem.org/wiki/index.php?title=Template:Montgomery_Cougars_NJUSA/Common_CSS&action=edit */
/* 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 }); } $('#nav ul ul').parent().children('a').addClass('is-parent');
if($('#toc').length != 0) { $('#toc').remove(); $('body').addClass('with-toc');var $jqtoc = $('')
.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($(window).height() < $('#jqtoc > ul').height()) { $('<a id="scrolltop" href="#">▲</a>') .appendTo('#main') .fadeOut() .click(function() { $('html, body').animate({scrollTop: 0}); return false; }); $(window).scroll(function() { if($(window).scrollTop() > 500) { $('#scrolltop').fadeIn(200); } else { $('#scrolltop').fadeOut(200); } }); } }
});
/**
* 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('
â†â†’
').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='- ';e.each(this.items,function(e){t+='<li class="dot'+(e<1?" active":"")+'">'+(e+1)+""});t+="
// 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
- /