This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A very basic (linear) scroll to top function | |
*/ | |
function scrollToTop () { | |
if(window.scrollY!=0) { | |
setTimeout(function() { | |
window.scrollTo(0,window.scrollY-30); | |
TopscrollTo(); | |
}, 20); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A custom sort method to sort DOM nodes | |
* | |
* @param wrap {HTMLElement} direct parent of sortable elements | |
* @param filter {Function} A pre-filter to gather the comparable attributes into an array (because DOM comparison is costly) | |
* @param map {Array} Desired order of elements by their IDs | |
*/ | |
function sortModules(wrap, filter, map) { | |
var l = wrap.children.length, | |
arr = [], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ajaxPost; | |
(function() { | |
ajaxPost = function (endPoint, obj, failCallback) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open('POST', endPoint, true); | |
xhr.onload = function() { | |
if (xhr.status != 200 && xhr.status != 4) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html { | |
font: normal normal 105%/1.7 sans-serif | |
} | |
.container { | |
max-width: 1120px; | |
margin: 0 auto; | |
padding: 0 30px; | |
padding: 0 1.5rem | |
} | |
.grid { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Vanilla JS implementation of $.closest() | |
* | |
* @param {Node|HTMLElement|*} el Starting point element | |
* @param {String} selector Selector to match parent element against | |
* @returns {*} Element node if found, otherwise null | |
*/ | |
function closestEl(el, selector) { | |
var matchesSelector = el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Forked from https://github.com/tristen/tablesort/blob/gh-pages/src/sorts/tablesort.date.js | |
// Basic dates in dd/mm/yy, dd-mm-yy or dd.mm.yy format. | |
// Years can be 4 digits. Days and Months can be 1 or 2 digits. | |
(function(){ | |
// Change $1/$2/$3 order to $2/$1/$3 to support dd/mm/yy format instead of mm/dd/yy | |
var dateFormat = '$2/$1/$3'; | |
var parseDate = function(date) { | |
date = date.replace(/\-/g, '/'); | |
date = date.replace(/(\d{1,2})[\/\-.](\d{1,2})[\/\-.](\d{2})/, dateFormat); // format before getTime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Just saving a solution by http://lehollandaisvolant.net/tout/examples/swipe/ | |
* From http://stackoverflow.com/questions/2264072/detect-a-finger-swipe-through-javascript-on-the-iphone-and-android/23230280#23230280 | |
*/ | |
document.addEventListener('touchstart', handleTouchStart, false); | |
document.addEventListener('touchmove', handleTouchMove, false); | |
document.addEventListener('touchend', handleTouchEnd, false); | |
document.addEventListener('touchcancel', handleTouchEnd, false); | |
var xDown = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Credit goes to Don't Wake Me Up | |
// http://dontwakemeup.com/sass-mixin-for-pseudo-element-css-arrows/ | |
@mixin css-arrow($arrow-position, $arrow-color, $arrow-size) { | |
&:after { | |
position: absolute; | |
border: solid transparent; | |
content: " "; | |
top: auto; | |
left: auto; | |
height: 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function classList(el) { | |
var list = el.classList; | |
return { | |
toggle: function(c) { list.toggle(c); return this; }, | |
add: function(c) { list.add (c); return this; }, | |
remove: function(c) { list.remove(c); return this; } | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Vanilla scrollTo implementation (smoothly scroll/"jump" to an element) | |
* @author github.com/andreasvirkus | |
* | |
* Default easing is: | |
* Robert Penner's easeInOutQuad - http://robertpenner.com/easing/ | |
* | |
* @param {String} target selector to scroll to | |
* @param {Object} options Optionally defined duration, offset, callback and easing | |
* |