From 97dbc8c3772c89022a55d591c4ed90cee1d1feaa Mon Sep 17 00:00:00 2001 From: Dylan Bolger Date: Wed, 21 Mar 2018 08:24:51 -0500 Subject: redesign --- assets/js/ie/PIE.htc | 96 ----- assets/js/ie/html5shiv.js | 8 - assets/js/ie/respond.min.js | 6 - assets/js/jquery.min.js | 0 assets/js/jquery.scrolly.min.js | 2 - assets/js/jquery.scrollzer.min.js | 2 - assets/js/main.js | 877 +++++++++++++++++++++++++++++++++----- assets/js/skel.min.js | 2 +- assets/js/util.js | 587 ------------------------- 9 files changed, 766 insertions(+), 814 deletions(-) delete mode 100755 assets/js/ie/PIE.htc delete mode 100755 assets/js/ie/html5shiv.js delete mode 100755 assets/js/ie/respond.min.js mode change 100755 => 100644 assets/js/jquery.min.js delete mode 100755 assets/js/jquery.scrolly.min.js delete mode 100755 assets/js/jquery.scrollzer.min.js mode change 100755 => 100644 assets/js/main.js mode change 100755 => 100644 assets/js/skel.min.js delete mode 100755 assets/js/util.js (limited to 'assets/js') diff --git a/assets/js/ie/PIE.htc b/assets/js/ie/PIE.htc deleted file mode 100755 index ca3b547..0000000 --- a/assets/js/ie/PIE.htc +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - diff --git a/assets/js/ie/html5shiv.js b/assets/js/ie/html5shiv.js deleted file mode 100755 index dcf351c..0000000 --- a/assets/js/ie/html5shiv.js +++ /dev/null @@ -1,8 +0,0 @@ -/* - HTML5 Shiv v3.6.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed -*/ -(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag(); -a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x"; -c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| -"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video",version:"3.6.2",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment(); -for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d #mq-test-1 { width: 42px; }',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){v(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))},g=function(a){return a.replace(c.regex.minmaxwh,"").match(c.regex.other)};if(c.ajax=f,c.queue=d,c.unsupportedmq=g,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var h,i,j,k=a.document,l=k.documentElement,m=[],n=[],o=[],p={},q=30,r=k.getElementsByTagName("head")[0]||l,s=k.getElementsByTagName("base")[0],t=r.getElementsByTagName("link"),u=function(){var a,b=k.createElement("div"),c=k.body,d=l.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=k.createElement("body"),c.style.background="none"),l.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&l.insertBefore(c,l.firstChild),a=b.offsetWidth,f?l.removeChild(c):c.removeChild(b),l.style.fontSize=d,e&&(c.style.fontSize=e),a=j=parseFloat(a)},v=function(b){var c="clientWidth",d=l[c],e="CSS1Compat"===k.compatMode&&d||k.body[c]||d,f={},g=t[t.length-1],p=(new Date).getTime();if(b&&h&&q>p-h)return a.clearTimeout(i),i=a.setTimeout(v,q),void 0;h=p;for(var s in m)if(m.hasOwnProperty(s)){var w=m[s],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?j||u():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?j||u():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(n[w.rules]))}for(var C in o)o.hasOwnProperty(C)&&o[C]&&o[C].parentNode===r&&r.removeChild(o[C]);o.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=k.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,r.insertBefore(E,g.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(k.createTextNode(F)),o.push(E)}},w=function(a,b,d){var e=a.replace(c.regex.comments,"").replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var h=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},i=!f&&d;b.length&&(b+="/"),i&&(f=1);for(var j=0;f>j;j++){var k,l,o,p;i?(k=d,n.push(h(a))):(k=e[j].match(c.regex.findStyles)&&RegExp.$1,n.push(RegExp.$2&&h(RegExp.$2))),o=k.split(","),p=o.length;for(var q=0;p>q;q++)l=o[q],g(l)||m.push({media:l.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:n.length-1,hasquery:l.indexOf("(")>-1,minw:l.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:l.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}v()},x=function(){if(d.length){var b=d.shift();f(b.href,function(c){w(c,b.href,b.media),p[b.href]=!0,a.setTimeout(function(){x()},0)})}},y=function(){for(var b=0;b1){for(o=0;o=d[i].start&&n<=d[i].end&&(c=i,o=!0),t++;u.lastHack&&n+r.height()>=a.height()&&(c=i,o=!0),o&&!f.hasClass("scrollzer-locked")&&(f.removeClass(u.activeClassName),d[c].link.addClass(u.activeClassName))}),r.trigger("resize")})}; diff --git a/assets/js/main.js b/assets/js/main.js old mode 100755 new mode 100644 index 3601ce3..d13cd05 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -1,113 +1,766 @@ -/* - Read Only by HTML5 UP - html5up.net | @ajlkn - Free for personal and commercial use under the CCA 3.0 license (html5up.net/license) -*/ - -(function($) { - - skel.breakpoints({ - xlarge: '(max-width: 1680px)', - large: '(max-width: 1280px)', - medium: '(max-width: 1024px)', - small: '(max-width: 736px)', - xsmall: '(max-width: 480px)' - }); - - $(function() { - - var $body = $('body'), - $header = $('#header'), - $nav = $('#nav'), $nav_a = $nav.find('a'), - $wrapper = $('#wrapper'); - - // Fix: Placeholder polyfill. - $('form').placeholder(); - - // Prioritize "important" elements on medium. - skel.on('+medium -medium', function() { - $.prioritize( - '.important\\28 medium\\29', - skel.breakpoint('medium').active - ); - }); - - // Header. - var ids = []; - - // Set up nav items. - $nav_a - .scrolly({ offset: 44 }) - .on('click', function(event) { - - var $this = $(this), - href = $this.attr('href'); - - // Not an internal link? Bail. - if (href.charAt(0) != '#') - return; - - // Prevent default behavior. - event.preventDefault(); - - // Remove active class from all links and mark them as locked (so scrollzer leaves them alone). - $nav_a - .removeClass('active') - .addClass('scrollzer-locked'); - - // Set active class on this link. - $this.addClass('active'); - - }) - .each(function() { - - var $this = $(this), - href = $this.attr('href'), - id; - - // Not an internal link? Bail. - if (href.charAt(0) != '#') - return; - - // Add to scrollzer ID list. - id = href.substring(1); - $this.attr('id', id + '-link'); - ids.push(id); - - }); - - // Initialize scrollzer. - $.scrollzer(ids, { pad: 300, lastHack: true }); - - // Off-Canvas Navigation. - - // Title Bar. - $( - '
' + - '' + - '' + $('#logo').html() + '' + - '
' - ) - .appendTo($body); - - // Header. - $('#header') - .panel({ - delay: 500, - hideOnClick: true, - hideOnSwipe: true, - resetScroll: true, - resetForms: true, - side: 'right', - target: $body, - visibleClass: 'header-visible' - }); - - // Fix: Remove navPanel transitions on WP<10 (poor/buggy performance). - if (skel.vars.os == 'wp' && skel.vars.osVersion < 10) - $('#titleBar, #header, #wrapper') - .css('transition', 'none'); - - }); - +/* + Ethereal by HTML5 UP + html5up.net | @ajlkn + Free for personal and commercial use under the CCA 3.0 license (html5up.net/license) +*/ + +(function($) { + + // Settings. + var settings = { + + // Keyboard shortcuts. + keyboardShortcuts: { + + // If true, enables scrolling via keyboard shortcuts. + enabled: true, + + // Sets the distance to scroll when using the left/right arrow keys. + distance: 50 + + }, + + // Scroll wheel. + scrollWheel: { + + // If true, enables scrolling via the scroll wheel. + enabled: true, + + // Sets the scroll wheel factor. (Ideally) a value between 0 and 1 (lower = slower scroll, higher = faster scroll). + factor: 1 + + }, + + // Scroll zones. + scrollZones: { + + // If true, enables scrolling via scroll zones on the left/right edges of the scren. + enabled: true, + + // Sets the speed at which the page scrolls when a scroll zone is active (higher = faster scroll, lower = slower scroll). + speed: 15 + + }, + + // Dragging. + dragging: { + + // If true, enables scrolling by dragging the main wrapper with the mouse. + enabled: true, + + // Sets the momentum factor. Must be a value between 0 and 1 (lower = less momentum, higher = more momentum, 0 = disable momentum scrolling). + momentum: 0.875, + + // Sets the drag threshold (in pixels). + threshold: 10 + + }, + + // If set to a valid selector , prevents key/mouse events from bubbling from these elements. + excludeSelector: 'input:focus, select:focus, textarea:focus, audio, video, iframe', + + // Link scroll speed. + linkScrollSpeed: 1000 + + }; + + // Skel. + skel.breakpoints({ + xlarge: '(max-width: 1680px)', + large: '(max-width: 1280px)', + medium: '(max-width: 980px)', + small: '(max-width: 736px)', + xsmall: '(max-width: 480px)', + xxsmall: '(max-width: 360px)', + short: '(min-aspect-ratio: 16/7)', + xshort: '(min-aspect-ratio: 16/6)' + }); + + // Ready event. + $(function() { + + // Vars. + var $window = $(window), + $document = $(document), + $body = $('body'), + $html = $('html'), + $bodyHtml = $('body,html'), + $wrapper = $('#wrapper'); + + // Disable animations/transitions until the page has loaded. + $body.addClass('is-loading'); + + $window.on('load', function() { + window.setTimeout(function() { + $body.removeClass('is-loading'); + }, 100); + }); + + // Tweaks/fixes. + + // Mobile: Revert to native scrolling. + if (skel.vars.mobile) { + + // Disable all scroll-assist features. + settings.keyboardShortcuts.enabled = false; + settings.scrollWheel.enabled = false; + settings.scrollZones.enabled = false; + settings.dragging.enabled = false; + + // Re-enable overflow on body. + $body.css('overflow-x', 'auto'); + + } + + // IE: Various fixes. + if (skel.vars.browser == 'ie') { + + // Enable IE mode. + $body.addClass('is-ie'); + + // Page widths. + $window + .on('load resize', function() { + + // Calculate wrapper width. + var w = 0; + + $wrapper.children().each(function() { + w += $(this).width(); + }); + + // Apply to page. + $html.css('width', w + 'px'); + + }); + + } + + // Polyfill: Object fit. + if (!skel.canUse('object-fit')) { + + $('.image[data-position]').each(function() { + + var $this = $(this), + $img = $this.children('img'); + + // Apply img as background. + $this + .css('background-image', 'url("' + $img.attr('src') + '")') + .css('background-position', $this.data('position')) + .css('background-size', 'cover') + .css('background-repeat', 'no-repeat'); + + // Hide img. + $img + .css('opacity', '0'); + + }); + + } + + // Keyboard shortcuts. + if (settings.keyboardShortcuts.enabled) + (function() { + + $wrapper + + // Prevent keystrokes inside excluded elements from bubbling. + .on('keypress keyup keydown', settings.excludeSelector, function(event) { + + // Stop propagation. + event.stopPropagation(); + + }); + + $window + + // Keypress event. + .on('keydown', function(event) { + + var scrolled = false; + + switch (event.keyCode) { + + // Left arrow. + case 37: + $document.scrollLeft($document.scrollLeft() - settings.keyboardShortcuts.distance); + scrolled = true; + break; + + // Right arrow. + case 39: + $document.scrollLeft($document.scrollLeft() + settings.keyboardShortcuts.distance); + scrolled = true; + break; + + // Page Up. + case 33: + $document.scrollLeft($document.scrollLeft() - $window.width() + 100); + scrolled = true; + break; + + // Page Down, Space. + case 34: + case 32: + $document.scrollLeft($document.scrollLeft() + $window.width() - 100); + scrolled = true; + break; + + // Home. + case 36: + $document.scrollLeft(0); + scrolled = true; + break; + + // End. + case 35: + $document.scrollLeft($document.width()); + scrolled = true; + break; + + } + + // Scrolled? + if (scrolled) { + + // Prevent default. + event.preventDefault(); + event.stopPropagation(); + + // Stop link scroll. + $bodyHtml.stop(); + + } + + }); + + })(); + + // Scroll wheel. + if (settings.scrollWheel.enabled) + (function() { + + // Based on code by @miorel + @pieterv of Facebook (thanks guys :) + // github.com/facebook/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js + var normalizeWheel = function(event) { + + var pixelStep = 10, + lineHeight = 40, + pageHeight = 800, + sX = 0, + sY = 0, + pX = 0, + pY = 0; + + // Legacy. + if ('detail' in event) + sY = event.detail; + else if ('wheelDelta' in event) + sY = event.wheelDelta / -120; + else if ('wheelDeltaY' in event) + sY = event.wheelDeltaY / -120; + + if ('wheelDeltaX' in event) + sX = event.wheelDeltaX / -120; + + // Side scrolling on FF with DOMMouseScroll. + if ('axis' in event + && event.axis === event.HORIZONTAL_AXIS) { + sX = sY; + sY = 0; + } + + // Calculate. + pX = sX * pixelStep; + pY = sY * pixelStep; + + if ('deltaY' in event) + pY = event.deltaY; + + if ('deltaX' in event) + pX = event.deltaX; + + if ((pX || pY) + && event.deltaMode) { + + if (event.deltaMode == 1) { + pX *= lineHeight; + pY *= lineHeight; + } + else { + pX *= pageHeight; + pY *= pageHeight; + } + + } + + // Fallback if spin cannot be determined. + if (pX && !sX) + sX = (pX < 1) ? -1 : 1; + + if (pY && !sY) + sY = (pY < 1) ? -1 : 1; + + // Return. + return { + spinX: sX, + spinY: sY, + pixelX: pX, + pixelY: pY + }; + + }; + + // Wheel event. + $body.on('wheel', function(event) { + + // Disable on <=small. + if (skel.breakpoint('small').active) + return; + + // Prevent default. + event.preventDefault(); + event.stopPropagation(); + + // Stop link scroll. + $bodyHtml.stop(); + + // Calculate delta, direction. + var n = normalizeWheel(event.originalEvent), + x = (n.pixelX != 0 ? n.pixelX : n.pixelY), + delta = Math.min(Math.abs(x), 150) * settings.scrollWheel.factor, + direction = x > 0 ? 1 : -1; + + // Scroll page. + $document.scrollLeft($document.scrollLeft() + (delta * direction)); + + }); + + })(); + + // Scroll zones. + if (settings.scrollZones.enabled) + (function() { + + var $left = $('
'), + $right = $('
'), + $zones = $left.add($right), + paused = false, + intervalId = null, + direction, + activate = function(d) { + + // Disable on <=small. + if (skel.breakpoint('small').active) + return; + + // Paused? Bail. + if (paused) + return; + + // Stop link scroll. + $bodyHtml.stop(); + + // Set direction. + direction = d; + + // Initialize interval. + clearInterval(intervalId); + + intervalId = setInterval(function() { + $document.scrollLeft($document.scrollLeft() + (settings.scrollZones.speed * direction)); + }, 25); + + }, + deactivate = function() { + + // Unpause. + paused = false; + + // Clear interval. + clearInterval(intervalId); + + }; + + $zones + .appendTo($wrapper) + .on('mouseleave mousedown', function(event) { + deactivate(); + }); + + $left + .css('left', '0') + .on('mouseenter', function(event) { + activate(-1); + }); + + $right + .css('right', '0') + .on('mouseenter', function(event) { + activate(1); + }); + + $wrapper + .on('---pauseScrollZone', function(event) { + + // Pause. + paused = true; + + // Unpause after delay. + setTimeout(function() { + paused = false; + }, 500); + + }); + + })(); + + // Dragging. + if (settings.dragging.enabled) + (function() { + + var dragging = false, + dragged = false, + distance = 0, + startScroll, + momentumIntervalId, velocityIntervalId, + startX, currentX, previousX, + velocity, direction; + + $wrapper + + // Prevent image drag and drop. + .on('mouseup mousemove mousedown', '.image, img', function(event) { + event.preventDefault(); + }) + + // Prevent mouse events inside excluded elements from bubbling. + .on('mouseup mousemove mousedown', settings.excludeSelector, function(event) { + + // Prevent event from bubbling. + event.stopPropagation(); + + // End drag. + dragging = false; + $wrapper.removeClass('is-dragging'); + clearInterval(velocityIntervalId); + clearInterval(momentumIntervalId); + + // Pause scroll zone. + $wrapper.triggerHandler('---pauseScrollZone'); + + }) + + // Mousedown event. + .on('mousedown', function(event) { + + // Disable on <=small. + if (skel.breakpoint('small').active) + return; + + // Clear momentum interval. + clearInterval(momentumIntervalId); + + // Stop link scroll. + $bodyHtml.stop(); + + // Start drag. + dragging = true; + $wrapper.addClass('is-dragging'); + + // Initialize and reset vars. + startScroll = $document.scrollLeft(); + startX = event.clientX; + previousX = startX; + currentX = startX; + distance = 0; + direction = 0; + + // Initialize velocity interval. + clearInterval(velocityIntervalId); + + velocityIntervalId = setInterval(function() { + + // Calculate velocity, direction. + velocity = Math.abs(currentX - previousX); + direction = (currentX > previousX ? -1 : 1); + + // Update previous X. + previousX = currentX; + + }, 50); + + }) + + // Mousemove event. + .on('mousemove', function(event) { + + // Not dragging? Bail. + if (!dragging) + return; + + // Velocity. + currentX = event.clientX; + + // Scroll page. + $document.scrollLeft(startScroll + (startX - currentX)); + + // Update distance. + distance = Math.abs(startScroll - $document.scrollLeft()); + + // Distance exceeds threshold? Disable pointer events on all descendents. + if (!dragged + && distance > settings.dragging.threshold) { + + $wrapper.addClass('is-dragged'); + + dragged = true; + + } + + }) + + // Mouseup/mouseleave event. + .on('mouseup mouseleave', function(event) { + + var m; + + // Not dragging? Bail. + if (!dragging) + return; + + // Dragged? Re-enable pointer events on all descendents. + if (dragged) { + + setTimeout(function() { + $wrapper.removeClass('is-dragged'); + }, 100); + + dragged = false; + + } + + // Distance exceeds threshold? Prevent default. + if (distance > settings.dragging.threshold) + event.preventDefault(); + + // End drag. + dragging = false; + $wrapper.removeClass('is-dragging'); + clearInterval(velocityIntervalId); + clearInterval(momentumIntervalId); + + // Pause scroll zone. + $wrapper.triggerHandler('---pauseScrollZone'); + + // Initialize momentum interval. + if (settings.dragging.momentum > 0) { + + m = velocity; + + momentumIntervalId = setInterval(function() { + + // Momentum is NaN? Bail. + if (isNaN(m)) { + + clearInterval(momentumIntervalId); + return; + + } + + // Scroll page. + $document.scrollLeft($document.scrollLeft() + (m * direction)); + + // Decrease momentum. + m = m * settings.dragging.momentum; + + // Negligible momentum? Clear interval and end. + if (Math.abs(m) < 1) + clearInterval(momentumIntervalId); + + }, 15); + + } + + }); + + })(); + + // Link scroll. + $wrapper + .on('mousedown mouseup', 'a[href^="#"]', function(event) { + + // Stop propagation. + event.stopPropagation(); + + }) + .on('click', 'a[href^="#"]', function(event) { + + var $this = $(this), + href = $this.attr('href'), + $target, x, y; + + // Get target. + if (href == '#' + || ($target = $(href)).length == 0) + return; + + // Prevent default. + event.preventDefault(); + event.stopPropagation(); + + // Calculate x, y. + if (skel.breakpoint('small').active) { + + x = $target.offset().top - (Math.max(0, $window.height() - $target.outerHeight()) / 2); + y = { scrollTop: x }; + + } + else { + + x = $target.offset().left - (Math.max(0, $window.width() - $target.outerWidth()) / 2); + y = { scrollLeft: x }; + + } + + // Scroll. + $bodyHtml + .stop() + .animate( + y, + settings.linkScrollSpeed, + 'swing' + ); + + }); + + // Gallery. + $('.gallery') + .on('click', 'a', function(event) { + + var $a = $(this), + $gallery = $a.parents('.gallery'), + $modal = $gallery.children('.modal'), + $modalImg = $modal.find('img'), + href = $a.attr('href'); + + // Not an image? Bail. + if (!href.match(/\.(jpg|gif|png|mp4)$/)) + return; + + // Prevent default. + event.preventDefault(); + event.stopPropagation(); + + // Locked? Bail. + if ($modal[0]._locked) + return; + + // Lock. + $modal[0]._locked = true; + + // Set src. + $modalImg.attr('src', href); + + // Set visible. + $modal.addClass('visible'); + + // Focus. + $modal.focus(); + + // Delay. + setTimeout(function() { + + // Unlock. + $modal[0]._locked = false; + + }, 600); + + }) + .on('click', '.modal', function(event) { + + var $modal = $(this), + $modalImg = $modal.find('img'); + + // Locked? Bail. + if ($modal[0]._locked) + return; + + // Already hidden? Bail. + if (!$modal.hasClass('visible')) + return; + + // Stop propagation. + event.stopPropagation(); + + // Lock. + $modal[0]._locked = true; + + // Clear visible, loaded. + $modal + .removeClass('loaded') + + // Delay. + setTimeout(function() { + + $modal + .removeClass('visible') + + // Pause scroll zone. + $wrapper.triggerHandler('---pauseScrollZone'); + + setTimeout(function() { + + // Clear src. + $modalImg.attr('src', ''); + + // Unlock. + $modal[0]._locked = false; + + // Focus. + $body.focus(); + + }, 475); + + }, 125); + + }) + .on('keypress', '.modal', function(event) { + + var $modal = $(this); + + // Escape? Hide modal. + if (event.keyCode == 27) + $modal.trigger('click'); + + }) + .on('mouseup mousedown mousemove', '.modal', function(event) { + + // Stop propagation. + event.stopPropagation(); + + }) + .prepend('') + .find('img') + .on('load', function(event) { + + var $modalImg = $(this), + $modal = $modalImg.parents('.modal'); + + setTimeout(function() { + + // No longer visible? Bail. + if (!$modal.hasClass('visible')) + return; + + // Set loaded. + $modal.addClass('loaded'); + + }, 275); + + }); + + }); + })(jQuery); \ No newline at end of file diff --git a/assets/js/skel.min.js b/assets/js/skel.min.js old mode 100755 new mode 100644 index 6ca4bf1..0e7633a --- a/assets/js/skel.min.js +++ b/assets/js/skel.min.js @@ -1,2 +1,2 @@ -/* skel.js v3.0.1 | (c) skel.io | MIT licensed */ +/* skel.js v3.0.1 | (c) skel.io | MIT licensed */ var skel=function(){"use strict";var t={breakpointIds:null,events:{},isInit:!1,obj:{attachments:{},breakpoints:{},head:null,states:{}},sd:"/",state:null,stateHandlers:{},stateId:"",vars:{},DOMReady:null,indexOf:null,isArray:null,iterate:null,matchesMedia:null,extend:function(e,n){t.iterate(n,function(i){t.isArray(n[i])?(t.isArray(e[i])||(e[i]=[]),t.extend(e[i],n[i])):"object"==typeof n[i]?("object"!=typeof e[i]&&(e[i]={}),t.extend(e[i],n[i])):e[i]=n[i]})},newStyle:function(t){var e=document.createElement("style");return e.type="text/css",e.innerHTML=t,e},_canUse:null,canUse:function(e){t._canUse||(t._canUse=document.createElement("div"));var n=t._canUse.style,i=e.charAt(0).toUpperCase()+e.slice(1);return e in n||"Moz"+i in n||"Webkit"+i in n||"O"+i in n||"ms"+i in n},on:function(e,n){var i=e.split(/[\s]+/);return t.iterate(i,function(e){var a=i[e];if(t.isInit){if("init"==a)return void n();if("change"==a)n();else{var r=a.charAt(0);if("+"==r||"!"==r){var o=a.substring(1);if(o in t.obj.breakpoints)if("+"==r&&t.obj.breakpoints[o].active)n();else if("!"==r&&!t.obj.breakpoints[o].active)return void n()}}}t.events[a]||(t.events[a]=[]),t.events[a].push(n)}),t},trigger:function(e){return t.events[e]&&0!=t.events[e].length?(t.iterate(t.events[e],function(n){t.events[e][n]()}),t):void 0},breakpoint:function(e){return t.obj.breakpoints[e]},breakpoints:function(e){function n(t,e){this.name=this.id=t,this.media=e,this.active=!1,this.wasActive=!1}return n.prototype.matches=function(){return t.matchesMedia(this.media)},n.prototype.sync=function(){this.wasActive=this.active,this.active=this.matches()},t.iterate(e,function(i){t.obj.breakpoints[i]=new n(i,e[i])}),window.setTimeout(function(){t.poll()},0),t},addStateHandler:function(e,n){t.stateHandlers[e]=n},callStateHandler:function(e){var n=t.stateHandlers[e]();t.iterate(n,function(e){t.state.attachments.push(n[e])})},changeState:function(e){t.iterate(t.obj.breakpoints,function(e){t.obj.breakpoints[e].sync()}),t.vars.lastStateId=t.stateId,t.stateId=e,t.breakpointIds=t.stateId===t.sd?[]:t.stateId.substring(1).split(t.sd),t.obj.states[t.stateId]?t.state=t.obj.states[t.stateId]:(t.obj.states[t.stateId]={attachments:[]},t.state=t.obj.states[t.stateId],t.iterate(t.stateHandlers,t.callStateHandler)),t.detachAll(t.state.attachments),t.attachAll(t.state.attachments),t.vars.stateId=t.stateId,t.vars.state=t.state,t.trigger("change"),t.iterate(t.obj.breakpoints,function(e){t.obj.breakpoints[e].active?t.obj.breakpoints[e].wasActive||t.trigger("+"+e):t.obj.breakpoints[e].wasActive&&t.trigger("-"+e)})},generateStateConfig:function(e,n){var i={};return t.extend(i,e),t.iterate(t.breakpointIds,function(e){t.extend(i,n[t.breakpointIds[e]])}),i},getStateId:function(){var e="";return t.iterate(t.obj.breakpoints,function(n){var i=t.obj.breakpoints[n];i.matches()&&(e+=t.sd+i.id)}),e},poll:function(){var e="";e=t.getStateId(),""===e&&(e=t.sd),e!==t.stateId&&t.changeState(e)},_attach:null,attach:function(e){var n=t.obj.head,i=e.element;return i.parentNode&&i.parentNode.tagName?!1:(t._attach||(t._attach=n.firstChild),n.insertBefore(i,t._attach.nextSibling),e.permanent&&(t._attach=i),!0)},attachAll:function(e){var n=[];t.iterate(e,function(t){n[e[t].priority]||(n[e[t].priority]=[]),n[e[t].priority].push(e[t])}),n.reverse(),t.iterate(n,function(e){t.iterate(n[e],function(i){t.attach(n[e][i])})})},detach:function(t){var e=t.element;return t.permanent||!e.parentNode||e.parentNode&&!e.parentNode.tagName?!1:(e.parentNode.removeChild(e),!0)},detachAll:function(e){var n={};t.iterate(e,function(t){n[e[t].id]=!0}),t.iterate(t.obj.attachments,function(e){e in n||t.detach(t.obj.attachments[e])})},attachment:function(e){return e in t.obj.attachments?t.obj.attachments[e]:null},newAttachment:function(e,n,i,a){return t.obj.attachments[e]={id:e,element:n,priority:i,permanent:a}},init:function(){t.initMethods(),t.initVars(),t.initEvents(),t.obj.head=document.getElementsByTagName("head")[0],t.isInit=!0,t.trigger("init")},initEvents:function(){t.on("resize",function(){t.poll()}),t.on("orientationChange",function(){t.poll()}),t.DOMReady(function(){t.trigger("ready")}),window.onload&&t.on("load",window.onload),window.onload=function(){t.trigger("load")},window.onresize&&t.on("resize",window.onresize),window.onresize=function(){t.trigger("resize")},window.onorientationchange&&t.on("orientationChange",window.onorientationchange),window.onorientationchange=function(){t.trigger("orientationChange")}},initMethods:function(){document.addEventListener?!function(e,n){t.DOMReady=n()}("domready",function(){function t(t){for(r=1;t=n.shift();)t()}var e,n=[],i=document,a="DOMContentLoaded",r=/^loaded|^c/.test(i.readyState);return i.addEventListener(a,e=function(){i.removeEventListener(a,e),t()}),function(t){r?t():n.push(t)}}):!function(e,n){t.DOMReady=n()}("domready",function(t){function e(t){for(h=1;t=i.shift();)t()}var n,i=[],a=!1,r=document,o=r.documentElement,s=o.doScroll,c="DOMContentLoaded",d="addEventListener",u="onreadystatechange",l="readyState",f=s?/^loaded|^c/:/^loaded|c/,h=f.test(r[l]);return r[d]&&r[d](c,n=function(){r.removeEventListener(c,n,a),e()},a),s&&r.attachEvent(u,n=function(){/^c/.test(r[l])&&(r.detachEvent(u,n),e())}),t=s?function(e){self!=top?h?e():i.push(e):function(){try{o.doScroll("left")}catch(n){return setTimeout(function(){t(e)},50)}e()}()}:function(t){h?t():i.push(t)}}),Array.prototype.indexOf?t.indexOf=function(t,e){return t.indexOf(e)}:t.indexOf=function(t,e){if("string"==typeof t)return t.indexOf(e);var n,i,a=e?e:0;if(!this)throw new TypeError;if(i=this.length,0===i||a>=i)return-1;for(0>a&&(a=i-Math.abs(a)),n=a;i>n;n++)if(this[n]===t)return n;return-1},Array.isArray?t.isArray=function(t){return Array.isArray(t)}:t.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},Object.keys?t.iterate=function(t,e){if(!t)return[];var n,i=Object.keys(t);for(n=0;i[n]&&e(i[n],t[i[n]])!==!1;n++);}:t.iterate=function(t,e){if(!t)return[];var n;for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])===!1)break},window.matchMedia?t.matchesMedia=function(t){return""==t?!0:window.matchMedia(t).matches}:window.styleMedia||window.media?t.matchesMedia=function(t){if(""==t)return!0;var e=window.styleMedia||window.media;return e.matchMedium(t||"all")}:window.getComputedStyle?t.matchesMedia=function(t){if(""==t)return!0;var e=document.createElement("style"),n=document.getElementsByTagName("script")[0],i=null;e.type="text/css",e.id="matchmediajs-test",n.parentNode.insertBefore(e,n),i="getComputedStyle"in window&&window.getComputedStyle(e,null)||e.currentStyle;var a="@media "+t+"{ #matchmediajs-test { width: 1px; } }";return e.styleSheet?e.styleSheet.cssText=a:e.textContent=a,"1px"===i.width}:t.matchesMedia=function(t){if(""==t)return!0;var e,n,i,a,r={"min-width":null,"max-width":null},o=!1;for(i=t.split(/\s+and\s+/),e=0;er["max-width"]||null!==r["min-height"]&&cr["max-height"]?!1:!0},navigator.userAgent.match(/MSIE ([0-9]+)/)&&RegExp.$1<9&&(t.newStyle=function(t){var e=document.createElement("span");return e.innerHTML=' ",e})},initVars:function(){var e,n,i,a=navigator.userAgent;e="other",n=0,i=[["firefox",/Firefox\/([0-9\.]+)/],["bb",/BlackBerry.+Version\/([0-9\.]+)/],["bb",/BB[0-9]+.+Version\/([0-9\.]+)/],["opera",/OPR\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)/],["edge",/Edge\/([0-9\.]+)/],["safari",/Version\/([0-9\.]+).+Safari/],["chrome",/Chrome\/([0-9\.]+)/],["ie",/MSIE ([0-9]+)/],["ie",/Trident\/.+rv:([0-9]+)/]],t.iterate(i,function(t,i){return a.match(i[1])?(e=i[0],n=parseFloat(RegExp.$1),!1):void 0}),t.vars.browser=e,t.vars.browserVersion=n,e="other",n=0,i=[["ios",/([0-9_]+) like Mac OS X/,function(t){return t.replace("_",".").replace("_","")}],["ios",/CPU like Mac OS X/,function(t){return 0}],["wp",/Windows Phone ([0-9\.]+)/,null],["android",/Android ([0-9\.]+)/,null],["mac",/Macintosh.+Mac OS X ([0-9_]+)/,function(t){return t.replace("_",".").replace("_","")}],["windows",/Windows NT ([0-9\.]+)/,null],["bb",/BlackBerry.+Version\/([0-9\.]+)/,null],["bb",/BB[0-9]+.+Version\/([0-9\.]+)/,null]],t.iterate(i,function(t,i){return a.match(i[1])?(e=i[0],n=parseFloat(i[2]?i[2](RegExp.$1):RegExp.$1),!1):void 0}),t.vars.os=e,t.vars.osVersion=n,t.vars.IEVersion="ie"==t.vars.browser?t.vars.browserVersion:99,t.vars.touch="wp"==t.vars.os?navigator.msMaxTouchPoints>0:!!("ontouchstart"in window),t.vars.mobile="wp"==t.vars.os||"android"==t.vars.os||"ios"==t.vars.os||"bb"==t.vars.os}};return t.init(),t}();!function(t,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?module.exports=e():t.skel=e()}(this,function(){return skel}); diff --git a/assets/js/util.js b/assets/js/util.js deleted file mode 100755 index ecf7b37..0000000 --- a/assets/js/util.js +++ /dev/null @@ -1,587 +0,0 @@ -(function($) { - - /** - * Generate an indented list of links from a nav. Meant for use with panel(). - * @return {jQuery} jQuery object. - */ - $.fn.navList = function() { - - var $this = $(this); - $a = $this.find('a'), - b = []; - - $a.each(function() { - - var $this = $(this), - indent = Math.max(0, $this.parents('li').length - 1), - href = $this.attr('href'), - target = $this.attr('target'); - - b.push( - '' + - '' + - $this.text() + - '' - ); - - }); - - return b.join(''); - - }; - - /** - * Panel-ify an element. - * @param {object} userConfig User config. - * @return {jQuery} jQuery object. - */ - $.fn.panel = function(userConfig) { - - // No elements? - if (this.length == 0) - return $this; - - // Multiple elements? - if (this.length > 1) { - - for (var i=0; i < this.length; i++) - $(this[i]).panel(userConfig); - - return $this; - - } - - // Vars. - var $this = $(this), - $body = $('body'), - $window = $(window), - id = $this.attr('id'), - config; - - // Config. - config = $.extend({ - - // Delay. - delay: 0, - - // Hide panel on link click. - hideOnClick: false, - - // Hide panel on escape keypress. - hideOnEscape: false, - - // Hide panel on swipe. - hideOnSwipe: false, - - // Reset scroll position on hide. - resetScroll: false, - - // Reset forms on hide. - resetForms: false, - - // Side of viewport the panel will appear. - side: null, - - // Target element for "class". - target: $this, - - // Class to toggle. - visibleClass: 'visible' - - }, userConfig); - - // Expand "target" if it's not a jQuery object already. - if (typeof config.target != 'jQuery') - config.target = $(config.target); - - // Panel. - - // Methods. - $this._hide = function(event) { - - // Already hidden? Bail. - if (!config.target.hasClass(config.visibleClass)) - return; - - // If an event was provided, cancel it. - if (event) { - - event.preventDefault(); - event.stopPropagation(); - - } - - // Hide. - config.target.removeClass(config.visibleClass); - - // Post-hide stuff. - window.setTimeout(function() { - - // Reset scroll position. - if (config.resetScroll) - $this.scrollTop(0); - - // Reset forms. - if (config.resetForms) - $this.find('form').each(function() { - this.reset(); - }); - - }, config.delay); - - }; - - // Vendor fixes. - $this - .css('-ms-overflow-style', '-ms-autohiding-scrollbar') - .css('-webkit-overflow-scrolling', 'touch'); - - // Hide on click. - if (config.hideOnClick) { - - $this.find('a') - .css('-webkit-tap-highlight-color', 'rgba(0,0,0,0)'); - - $this - .on('click', 'a', function(event) { - - var $a = $(this), - href = $a.attr('href'), - target = $a.attr('target'); - - if (!href || href == '#' || href == '' || href == '#' + id) - return; - - // Cancel original event. - event.preventDefault(); - event.stopPropagation(); - - // Hide panel. - $this._hide(); - - // Redirect to href. - window.setTimeout(function() { - - if (target == '_blank') - window.open(href); - else - window.location.href = href; - - }, config.delay + 10); - - }); - - } - - // Event: Touch stuff. - $this.on('touchstart', function(event) { - - $this.touchPosX = event.originalEvent.touches[0].pageX; - $this.touchPosY = event.originalEvent.touches[0].pageY; - - }) - - $this.on('touchmove', function(event) { - - if ($this.touchPosX === null - || $this.touchPosY === null) - return; - - var diffX = $this.touchPosX - event.originalEvent.touches[0].pageX, - diffY = $this.touchPosY - event.originalEvent.touches[0].pageY, - th = $this.outerHeight(), - ts = ($this.get(0).scrollHeight - $this.scrollTop()); - - // Hide on swipe? - if (config.hideOnSwipe) { - - var result = false, - boundary = 20, - delta = 50; - - switch (config.side) { - - case 'left': - result = (diffY < boundary && diffY > (-1 * boundary)) && (diffX > delta); - break; - - case 'right': - result = (diffY < boundary && diffY > (-1 * boundary)) && (diffX < (-1 * delta)); - break; - - case 'top': - result = (diffX < boundary && diffX > (-1 * boundary)) && (diffY > delta); - break; - - case 'bottom': - result = (diffX < boundary && diffX > (-1 * boundary)) && (diffY < (-1 * delta)); - break; - - default: - break; - - } - - if (result) { - - $this.touchPosX = null; - $this.touchPosY = null; - $this._hide(); - - return false; - - } - - } - - // Prevent vertical scrolling past the top or bottom. - if (($this.scrollTop() < 0 && diffY < 0) - || (ts > (th - 2) && ts < (th + 2) && diffY > 0)) { - - event.preventDefault(); - event.stopPropagation(); - - } - - }); - - // Event: Prevent certain events inside the panel from bubbling. - $this.on('click touchend touchstart touchmove', function(event) { - event.stopPropagation(); - }); - - // Event: Hide panel if a child anchor tag pointing to its ID is clicked. - $this.on('click', 'a[href="#' + id + '"]', function(event) { - - event.preventDefault(); - event.stopPropagation(); - - config.target.removeClass(config.visibleClass); - - }); - - // Body. - - // Event: Hide panel on body click/tap. - $body.on('click touchend', function(event) { - $this._hide(event); - }); - - // Event: Toggle. - $body.on('click', 'a[href="#' + id + '"]', function(event) { - - event.preventDefault(); - event.stopPropagation(); - - config.target.toggleClass(config.visibleClass); - - }); - - // Window. - - // Event: Hide on ESC. - if (config.hideOnEscape) - $window.on('keydown', function(event) { - - if (event.keyCode == 27) - $this._hide(event); - - }); - - return $this; - - }; - - /** - * Apply "placeholder" attribute polyfill to one or more forms. - * @return {jQuery} jQuery object. - */ - $.fn.placeholder = function() { - - // Browser natively supports placeholders? Bail. - if (typeof (document.createElement('input')).placeholder != 'undefined') - return $(this); - - // No elements? - if (this.length == 0) - return $this; - - // Multiple elements? - if (this.length > 1) { - - for (var i=0; i < this.length; i++) - $(this[i]).placeholder(); - - return $this; - - } - - // Vars. - var $this = $(this); - - // Text, TextArea. - $this.find('input[type=text],textarea') - .each(function() { - - var i = $(this); - - if (i.val() == '' - || i.val() == i.attr('placeholder')) - i - .addClass('polyfill-placeholder') - .val(i.attr('placeholder')); - - }) - .on('blur', function() { - - var i = $(this); - - if (i.attr('name').match(/-polyfill-field$/)) - return; - - if (i.val() == '') - i - .addClass('polyfill-placeholder') - .val(i.attr('placeholder')); - - }) - .on('focus', function() { - - var i = $(this); - - if (i.attr('name').match(/-polyfill-field$/)) - return; - - if (i.val() == i.attr('placeholder')) - i - .removeClass('polyfill-placeholder') - .val(''); - - }); - - // Password. - $this.find('input[type=password]') - .each(function() { - - var i = $(this); - var x = $( - $('
') - .append(i.clone()) - .remove() - .html() - .replace(/type="password"/i, 'type="text"') - .replace(/type=password/i, 'type=text') - ); - - if (i.attr('id') != '') - x.attr('id', i.attr('id') + '-polyfill-field'); - - if (i.attr('name') != '') - x.attr('name', i.attr('name') + '-polyfill-field'); - - x.addClass('polyfill-placeholder') - .val(x.attr('placeholder')).insertAfter(i); - - if (i.val() == '') - i.hide(); - else - x.hide(); - - i - .on('blur', function(event) { - - event.preventDefault(); - - var x = i.parent().find('input[name=' + i.attr('name') + '-polyfill-field]'); - - if (i.val() == '') { - - i.hide(); - x.show(); - - } - - }); - - x - .on('focus', function(event) { - - event.preventDefault(); - - var i = x.parent().find('input[name=' + x.attr('name').replace('-polyfill-field', '') + ']'); - - x.hide(); - - i - .show() - .focus(); - - }) - .on('keypress', function(event) { - - event.preventDefault(); - x.val(''); - - }); - - }); - - // Events. - $this - .on('submit', function() { - - $this.find('input[type=text],input[type=password],textarea') - .each(function(event) { - - var i = $(this); - - if (i.attr('name').match(/-polyfill-field$/)) - i.attr('name', ''); - - if (i.val() == i.attr('placeholder')) { - - i.removeClass('polyfill-placeholder'); - i.val(''); - - } - - }); - - }) - .on('reset', function(event) { - - event.preventDefault(); - - $this.find('select') - .val($('option:first').val()); - - $this.find('input,textarea') - .each(function() { - - var i = $(this), - x; - - i.removeClass('polyfill-placeholder'); - - switch (this.type) { - - case 'submit': - case 'reset': - break; - - case 'password': - i.val(i.attr('defaultValue')); - - x = i.parent().find('input[name=' + i.attr('name') + '-polyfill-field]'); - - if (i.val() == '') { - i.hide(); - x.show(); - } - else { - i.show(); - x.hide(); - } - - break; - - case 'checkbox': - case 'radio': - i.attr('checked', i.attr('defaultValue')); - break; - - case 'text': - case 'textarea': - i.val(i.attr('defaultValue')); - - if (i.val() == '') { - i.addClass('polyfill-placeholder'); - i.val(i.attr('placeholder')); - } - - break; - - default: - i.val(i.attr('defaultValue')); - break; - - } - }); - - }); - - return $this; - - }; - - /** - * Moves elements to/from the first positions of their respective parents. - * @param {jQuery} $elements Elements (or selector) to move. - * @param {bool} condition If true, moves elements to the top. Otherwise, moves elements back to their original locations. - */ - $.prioritize = function($elements, condition) { - - var key = '__prioritize'; - - // Expand $elements if it's not already a jQuery object. - if (typeof $elements != 'jQuery') - $elements = $($elements); - - // Step through elements. - $elements.each(function() { - - var $e = $(this), $p, - $parent = $e.parent(); - - // No parent? Bail. - if ($parent.length == 0) - return; - - // Not moved? Move it. - if (!$e.data(key)) { - - // Condition is false? Bail. - if (!condition) - return; - - // Get placeholder (which will serve as our point of reference for when this element needs to move back). - $p = $e.prev(); - - // Couldn't find anything? Means this element's already at the top, so bail. - if ($p.length == 0) - return; - - // Move element to top of parent. - $e.prependTo($parent); - - // Mark element as moved. - $e.data(key, $p); - - } - - // Moved already? - else { - - // Condition is true? Bail. - if (condition) - return; - - $p = $e.data(key); - - // Move element back to its original location (using our placeholder). - $e.insertAfter($p); - - // Unmark element as moved. - $e.removeData(key); - - } - - }); - - }; - -})(jQuery); \ No newline at end of file -- cgit v1.2.3