From 4547e8e96919ce39bdf91d4935f504882397b30f Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Sun, 11 Dec 2016 07:41:56 -0500 Subject: [PATCH 001/104] v10.2.0 (#303) * v10.2.0 Updated getClosest() for broader selector support * Updated readme --- README.md | 2 +- dist/js/smooth-scroll.js | 74 ++++++++----------------------- dist/js/smooth-scroll.min.js | 4 +- docs/dist/js/smooth-scroll.js | 74 ++++++++----------------------- docs/dist/js/smooth-scroll.min.js | 4 +- package.json | 2 +- src/js/smooth-scroll.js | 72 +++++++----------------------- 7 files changed, 59 insertions(+), 173 deletions(-) diff --git a/README.md b/README.md index 619638a..510fee9 100755 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ smoothScroll.init({ }); ``` -***Note:*** *To programatically add Smooth Scroll to all anchor links on a page, pass `selector: 'a'` into `init`. The script checks that the link points to the current page before running.* +***Note:*** *To programatically add Smooth Scroll to all anchor links on a page, pass `selector: 'a[href^="#"]'` into `init`.* #### Easing Options diff --git a/dist/js/smooth-scroll.js b/dist/js/smooth-scroll.js index 8aba31a..c147ed3 100755 --- a/dist/js/smooth-scroll.js +++ b/dist/js/smooth-scroll.js @@ -1,5 +1,5 @@ /*! - * smooth-scroll v10.1.0: Animate scrolling to anchor links + * smooth-scroll v10.2.0: Animate scrolling to anchor links * (c) 2016 Chris Ferdinandi * MIT License * http://github.com/cferdinandi/smooth-scroll @@ -99,68 +99,30 @@ * Get the closest matching element up the DOM tree. * @private * @param {Element} elem Starting element - * @param {String} selector Selector to match against (class, ID, data attribute, or tag) + * @param {String} selector Selector to match against * @return {Boolean|Element} Returns null if not match found */ var getClosest = function ( elem, selector ) { - // Variables - var firstChar = selector.charAt(0); - var supports = 'classList' in document.documentElement; - var attribute, value; - - // If selector is a data attribute, split attribute from value - if ( firstChar === '[' ) { - selector = selector.substr(1, selector.length - 2); - attribute = selector.split( '=' ); - - if ( attribute.length > 1 ) { - value = true; - attribute[1] = attribute[1].replace( /"/g, '' ).replace( /'/g, '' ); - } + // Element.matches() polyfill + if (!Element.prototype.matches) { + Element.prototype.matches = + Element.prototype.matchesSelector || + Element.prototype.mozMatchesSelector || + Element.prototype.msMatchesSelector || + Element.prototype.oMatchesSelector || + Element.prototype.webkitMatchesSelector || + function(s) { + var matches = (this.document || this.ownerDocument).querySelectorAll(s), + i = matches.length; + while (--i >= 0 && matches.item(i) !== this) {} + return i > -1; + }; } // Get closest match - for ( ; elem && elem !== document && elem.nodeType === 1; elem = elem.parentNode ) { - - // If selector is a class - if ( firstChar === '.' ) { - if ( supports ) { - if ( elem.classList.contains( selector.substr(1) ) ) { - return elem; - } - } else { - if ( new RegExp('(^|\\s)' + selector.substr(1) + '(\\s|$)').test( elem.className ) ) { - return elem; - } - } - } - - // If selector is an ID - if ( firstChar === '#' ) { - if ( elem.id === selector.substr(1) ) { - return elem; - } - } - - // If selector is a data attribute - if ( firstChar === '[' ) { - if ( elem.hasAttribute( attribute[0] ) ) { - if ( value ) { - if ( elem.getAttribute( attribute[0] ) === attribute[1] ) { - return elem; - } - } else { - return elem; - } - } - } - - // If selector is a tag - if ( elem.tagName.toLowerCase() === selector ) { - return elem; - } - + for ( ; elem && elem !== document; elem = elem.parentNode ) { + if ( elem.matches( selector ) ) return elem; } return null; diff --git a/dist/js/smooth-scroll.min.js b/dist/js/smooth-scroll.min.js index 789fef1..edf86f5 100755 --- a/dist/js/smooth-scroll.min.js +++ b/dist/js/smooth-scroll.min.js @@ -1,2 +1,2 @@ -/*! smooth-scroll v10.1.0 | (c) 2016 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ -!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,i,c,u={},l="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var r=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&"[object Object]"===Object.prototype.toString.call(n[o])?e[o]=f(!0,e[o],n[o]):e[o]=n[o])};n1&&(o=!0,n[1]=n[1].replace(/"/g,"").replace(/'/g,"")));e&&e!==document&&1===e.nodeType;e=e.parentNode){if("."===r)if(a){if(e.classList.contains(t.substr(1)))return e}else if(new RegExp("(^|\\s)"+t.substr(1)+"(\\s|$)").test(e.className))return e;if("#"===r&&e.id===t.substr(1))return e;if("["===r&&e.hasAttribute(n[0])){if(!o)return e;if(e.getAttribute(n[0])===n[1])return e}if(e.tagName.toLowerCase()===t)return e}return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",i=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===i?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},g=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=t<.5?2*t*t:-1+(4-2*t)*t),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},p=function(e,t,n){var o=0;if(e.offsetParent)do o+=e.offsetTop,e=e.offsetParent;while(e);return o=Math.max(o-t-n,0),Math.min(o,v()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},v=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},y=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},H=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};u.animateScroll=function(n,o,i){var u=y(o?o.getAttribute("data-options"):null),l=f(t||s,i||{},u),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;l.selectorHeader&&!r&&(r=document.querySelector(l.selectorHeader)),a||(a=O(r));var b,I,S=d?n:p(h,a,parseInt(l.offset,10)),E=S-m,A=v(),j=0,L=function(t,r,a){var i=e.pageYOffset;(t==r||i==r||e.innerHeight+i>=A)&&(clearInterval(a),H(n,r,d),l.callback(n,o))},w=function(){j+=16,b=j/parseInt(l.speed,10),b=b>1?1:b,I=m+E*g(l.easing,b),e.scrollTo(0,Math.floor(I)),L(I,S,c)},C=function(){clearInterval(c),c=setInterval(w,16)};0===e.pageYOffset&&e.scrollTo(0,0),C()}};var I=function(t){e.location.hash;n&&(n.id=n.getAttribute("data-scroll-id"),u.animateScroll(n,o),n=null,o=null)},S=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector),o&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href))){var a=m(o.hash);if("#"===a){r.preventDefault(),n=document.body;var i=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",i),n.id="",void(e.location.hash.substring(1)===i?I():e.location.hash=i)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),I()))}},E=function(e){i||(i=setTimeout((function(){i=null,a=O(r)}),66))};return u.destroy=function(){t&&(document.removeEventListener("click",S,!1),e.removeEventListener("resize",E,!1),t=null,n=null,o=null,r=null,a=null,i=null,c=null)},u.init=function(n){l&&(u.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",S,!1),e.addEventListener("hashchange",I,!1),r&&e.addEventListener("resize",E,!1))},u})); \ No newline at end of file +/*! smooth-scroll v10.2.0 | (c) 2016 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ +!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,l,i={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var r=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&"[object Object]"===Object.prototype.toString.call(n[o])?e[o]=f(!0,e[o],n[o]):e[o]=n[o])};n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=t<.5?2*t*t:-1+(4-2*t)*t),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},g=function(e,t,n){var o=0;if(e.offsetParent)do o+=e.offsetTop,e=e.offsetParent;while(e);return o=Math.max(o-t-n,0),Math.min(o,v()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},v=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},y=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};i.animateScroll=function(n,o,c){var i=y(o?o.getAttribute("data-options"):null),u=f(t||s,c||{},i),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,H=d?n:g(h,a,parseInt(u.offset,10)),I=H-m,A=v(),j=0,M=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,d),u.callback(n,o))},w=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+I*p(u.easing,b),e.scrollTo(0,Math.floor(E)),M(E,H,l)},Q=function(){clearInterval(l),l=setInterval(w,16)};0===e.pageYOffset&&e.scrollTo(0,0),Q()}};var E=function(t){e.location.hash;n&&(n.id=n.getAttribute("data-scroll-id"),i.animateScroll(n,o),n=null,o=null)},H=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector),o&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href))){var a=m(o.hash);if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},I=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return i.destroy=function(){t&&(document.removeEventListener("click",H,!1),e.removeEventListener("resize",I,!1),t=null,n=null,o=null,r=null,a=null,c=null,l=null)},i.init=function(n){u&&(i.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",H,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",I,!1))},i})); \ No newline at end of file diff --git a/docs/dist/js/smooth-scroll.js b/docs/dist/js/smooth-scroll.js index 8aba31a..c147ed3 100755 --- a/docs/dist/js/smooth-scroll.js +++ b/docs/dist/js/smooth-scroll.js @@ -1,5 +1,5 @@ /*! - * smooth-scroll v10.1.0: Animate scrolling to anchor links + * smooth-scroll v10.2.0: Animate scrolling to anchor links * (c) 2016 Chris Ferdinandi * MIT License * http://github.com/cferdinandi/smooth-scroll @@ -99,68 +99,30 @@ * Get the closest matching element up the DOM tree. * @private * @param {Element} elem Starting element - * @param {String} selector Selector to match against (class, ID, data attribute, or tag) + * @param {String} selector Selector to match against * @return {Boolean|Element} Returns null if not match found */ var getClosest = function ( elem, selector ) { - // Variables - var firstChar = selector.charAt(0); - var supports = 'classList' in document.documentElement; - var attribute, value; - - // If selector is a data attribute, split attribute from value - if ( firstChar === '[' ) { - selector = selector.substr(1, selector.length - 2); - attribute = selector.split( '=' ); - - if ( attribute.length > 1 ) { - value = true; - attribute[1] = attribute[1].replace( /"/g, '' ).replace( /'/g, '' ); - } + // Element.matches() polyfill + if (!Element.prototype.matches) { + Element.prototype.matches = + Element.prototype.matchesSelector || + Element.prototype.mozMatchesSelector || + Element.prototype.msMatchesSelector || + Element.prototype.oMatchesSelector || + Element.prototype.webkitMatchesSelector || + function(s) { + var matches = (this.document || this.ownerDocument).querySelectorAll(s), + i = matches.length; + while (--i >= 0 && matches.item(i) !== this) {} + return i > -1; + }; } // Get closest match - for ( ; elem && elem !== document && elem.nodeType === 1; elem = elem.parentNode ) { - - // If selector is a class - if ( firstChar === '.' ) { - if ( supports ) { - if ( elem.classList.contains( selector.substr(1) ) ) { - return elem; - } - } else { - if ( new RegExp('(^|\\s)' + selector.substr(1) + '(\\s|$)').test( elem.className ) ) { - return elem; - } - } - } - - // If selector is an ID - if ( firstChar === '#' ) { - if ( elem.id === selector.substr(1) ) { - return elem; - } - } - - // If selector is a data attribute - if ( firstChar === '[' ) { - if ( elem.hasAttribute( attribute[0] ) ) { - if ( value ) { - if ( elem.getAttribute( attribute[0] ) === attribute[1] ) { - return elem; - } - } else { - return elem; - } - } - } - - // If selector is a tag - if ( elem.tagName.toLowerCase() === selector ) { - return elem; - } - + for ( ; elem && elem !== document; elem = elem.parentNode ) { + if ( elem.matches( selector ) ) return elem; } return null; diff --git a/docs/dist/js/smooth-scroll.min.js b/docs/dist/js/smooth-scroll.min.js index 789fef1..edf86f5 100755 --- a/docs/dist/js/smooth-scroll.min.js +++ b/docs/dist/js/smooth-scroll.min.js @@ -1,2 +1,2 @@ -/*! smooth-scroll v10.1.0 | (c) 2016 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ -!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,i,c,u={},l="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var r=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&"[object Object]"===Object.prototype.toString.call(n[o])?e[o]=f(!0,e[o],n[o]):e[o]=n[o])};n1&&(o=!0,n[1]=n[1].replace(/"/g,"").replace(/'/g,"")));e&&e!==document&&1===e.nodeType;e=e.parentNode){if("."===r)if(a){if(e.classList.contains(t.substr(1)))return e}else if(new RegExp("(^|\\s)"+t.substr(1)+"(\\s|$)").test(e.className))return e;if("#"===r&&e.id===t.substr(1))return e;if("["===r&&e.hasAttribute(n[0])){if(!o)return e;if(e.getAttribute(n[0])===n[1])return e}if(e.tagName.toLowerCase()===t)return e}return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",i=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===i?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},g=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=t<.5?2*t*t:-1+(4-2*t)*t),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},p=function(e,t,n){var o=0;if(e.offsetParent)do o+=e.offsetTop,e=e.offsetParent;while(e);return o=Math.max(o-t-n,0),Math.min(o,v()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},v=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},y=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},H=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};u.animateScroll=function(n,o,i){var u=y(o?o.getAttribute("data-options"):null),l=f(t||s,i||{},u),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;l.selectorHeader&&!r&&(r=document.querySelector(l.selectorHeader)),a||(a=O(r));var b,I,S=d?n:p(h,a,parseInt(l.offset,10)),E=S-m,A=v(),j=0,L=function(t,r,a){var i=e.pageYOffset;(t==r||i==r||e.innerHeight+i>=A)&&(clearInterval(a),H(n,r,d),l.callback(n,o))},w=function(){j+=16,b=j/parseInt(l.speed,10),b=b>1?1:b,I=m+E*g(l.easing,b),e.scrollTo(0,Math.floor(I)),L(I,S,c)},C=function(){clearInterval(c),c=setInterval(w,16)};0===e.pageYOffset&&e.scrollTo(0,0),C()}};var I=function(t){e.location.hash;n&&(n.id=n.getAttribute("data-scroll-id"),u.animateScroll(n,o),n=null,o=null)},S=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector),o&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href))){var a=m(o.hash);if("#"===a){r.preventDefault(),n=document.body;var i=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",i),n.id="",void(e.location.hash.substring(1)===i?I():e.location.hash=i)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),I()))}},E=function(e){i||(i=setTimeout((function(){i=null,a=O(r)}),66))};return u.destroy=function(){t&&(document.removeEventListener("click",S,!1),e.removeEventListener("resize",E,!1),t=null,n=null,o=null,r=null,a=null,i=null,c=null)},u.init=function(n){l&&(u.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",S,!1),e.addEventListener("hashchange",I,!1),r&&e.addEventListener("resize",E,!1))},u})); \ No newline at end of file +/*! smooth-scroll v10.2.0 | (c) 2016 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ +!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,l,i={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var r=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&"[object Object]"===Object.prototype.toString.call(n[o])?e[o]=f(!0,e[o],n[o]):e[o]=n[o])};n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=t<.5?2*t*t:-1+(4-2*t)*t),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},g=function(e,t,n){var o=0;if(e.offsetParent)do o+=e.offsetTop,e=e.offsetParent;while(e);return o=Math.max(o-t-n,0),Math.min(o,v()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},v=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},y=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};i.animateScroll=function(n,o,c){var i=y(o?o.getAttribute("data-options"):null),u=f(t||s,c||{},i),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,H=d?n:g(h,a,parseInt(u.offset,10)),I=H-m,A=v(),j=0,M=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,d),u.callback(n,o))},w=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+I*p(u.easing,b),e.scrollTo(0,Math.floor(E)),M(E,H,l)},Q=function(){clearInterval(l),l=setInterval(w,16)};0===e.pageYOffset&&e.scrollTo(0,0),Q()}};var E=function(t){e.location.hash;n&&(n.id=n.getAttribute("data-scroll-id"),i.animateScroll(n,o),n=null,o=null)},H=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector),o&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href))){var a=m(o.hash);if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},I=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return i.destroy=function(){t&&(document.removeEventListener("click",H,!1),e.removeEventListener("resize",I,!1),t=null,n=null,o=null,r=null,a=null,c=null,l=null)},i.init=function(n){u&&(i.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",H,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",I,!1))},i})); \ No newline at end of file diff --git a/package.json b/package.json index 9e5bfaa..1749279 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smooth-scroll", - "version": "10.1.0", + "version": "10.2.0", "description": "Animate scrolling to anchor links", "main": "./dist/js/smooth-scroll.min.js", "author": { diff --git a/src/js/smooth-scroll.js b/src/js/smooth-scroll.js index 1139c73..229df2f 100755 --- a/src/js/smooth-scroll.js +++ b/src/js/smooth-scroll.js @@ -92,68 +92,30 @@ * Get the closest matching element up the DOM tree. * @private * @param {Element} elem Starting element - * @param {String} selector Selector to match against (class, ID, data attribute, or tag) + * @param {String} selector Selector to match against * @return {Boolean|Element} Returns null if not match found */ var getClosest = function ( elem, selector ) { - // Variables - var firstChar = selector.charAt(0); - var supports = 'classList' in document.documentElement; - var attribute, value; - - // If selector is a data attribute, split attribute from value - if ( firstChar === '[' ) { - selector = selector.substr(1, selector.length - 2); - attribute = selector.split( '=' ); - - if ( attribute.length > 1 ) { - value = true; - attribute[1] = attribute[1].replace( /"/g, '' ).replace( /'/g, '' ); - } + // Element.matches() polyfill + if (!Element.prototype.matches) { + Element.prototype.matches = + Element.prototype.matchesSelector || + Element.prototype.mozMatchesSelector || + Element.prototype.msMatchesSelector || + Element.prototype.oMatchesSelector || + Element.prototype.webkitMatchesSelector || + function(s) { + var matches = (this.document || this.ownerDocument).querySelectorAll(s), + i = matches.length; + while (--i >= 0 && matches.item(i) !== this) {} + return i > -1; + }; } // Get closest match - for ( ; elem && elem !== document && elem.nodeType === 1; elem = elem.parentNode ) { - - // If selector is a class - if ( firstChar === '.' ) { - if ( supports ) { - if ( elem.classList.contains( selector.substr(1) ) ) { - return elem; - } - } else { - if ( new RegExp('(^|\\s)' + selector.substr(1) + '(\\s|$)').test( elem.className ) ) { - return elem; - } - } - } - - // If selector is an ID - if ( firstChar === '#' ) { - if ( elem.id === selector.substr(1) ) { - return elem; - } - } - - // If selector is a data attribute - if ( firstChar === '[' ) { - if ( elem.hasAttribute( attribute[0] ) ) { - if ( value ) { - if ( elem.getAttribute( attribute[0] ) === attribute[1] ) { - return elem; - } - } else { - return elem; - } - } - } - - // If selector is a tag - if ( elem.tagName.toLowerCase() === selector ) { - return elem; - } - + for ( ; elem && elem !== document; elem = elem.parentNode ) { + if ( elem.matches( selector ) ) return elem; } return null; From e39e069058c9ffeea92bdef88dd2daf1ad7c4a88 Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Mon, 26 Dec 2016 08:45:46 -0500 Subject: [PATCH 002/104] v10.2.1 (#307) Added support for Chinese, Cyrillic, and other non-ASCII characters --- dist/js/smooth-scroll.js | 19 ++++++++++++++++--- dist/js/smooth-scroll.min.js | 4 ++-- docs/dist/js/smooth-scroll.js | 19 ++++++++++++++++--- docs/dist/js/smooth-scroll.min.js | 4 ++-- docs/index.html | 13 +++++++++++++ package.json | 2 +- src/docs/index.md | 13 +++++++++++++ src/js/smooth-scroll.js | 17 +++++++++++++++-- 8 files changed, 78 insertions(+), 13 deletions(-) diff --git a/dist/js/smooth-scroll.js b/dist/js/smooth-scroll.js index c147ed3..0c5ca7d 100755 --- a/dist/js/smooth-scroll.js +++ b/dist/js/smooth-scroll.js @@ -1,5 +1,5 @@ /*! - * smooth-scroll v10.2.0: Animate scrolling to anchor links + * smooth-scroll v10.2.1: Animate scrolling to anchor links * (c) 2016 Chris Ferdinandi * MIT License * http://github.com/cferdinandi/smooth-scroll @@ -413,7 +413,13 @@ var hashChangeHandler = function (event) { // Get hash from URL - var hash = root.location.hash; + // var hash = decodeURIComponent( escapeCharacters( root.location.hash ) ); + var hash; + try { + hash = escapeCharacters( decodeURIComponent( root.location.hash ) ); + } catch(e) { + hash = escapeCharacters( root.location.hash ); + } // Only run if there's an anchor element to scroll to if ( !anchor ) return; @@ -447,7 +453,14 @@ if ( toggle.hostname !== root.location.hostname || toggle.pathname !== root.location.pathname || !/#/.test(toggle.href) ) return; // Get the sanitized hash - var hash = escapeCharacters( toggle.hash ); + // var hash = decodeURIComponent( escapeCharacters( toggle.hash ) ); + // console.log(hash); + var hash; + try { + hash = escapeCharacters( decodeURIComponent( toggle.hash ) ); + } catch(e) { + hash = escapeCharacters( toggle.hash ); + } // If the hash is empty, scroll to the top of the page if ( hash === '#' ) { diff --git a/dist/js/smooth-scroll.min.js b/dist/js/smooth-scroll.min.js index edf86f5..d952995 100755 --- a/dist/js/smooth-scroll.min.js +++ b/dist/js/smooth-scroll.min.js @@ -1,2 +1,2 @@ -/*! smooth-scroll v10.2.0 | (c) 2016 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ -!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,l,i={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var r=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&"[object Object]"===Object.prototype.toString.call(n[o])?e[o]=f(!0,e[o],n[o]):e[o]=n[o])};n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=t<.5?2*t*t:-1+(4-2*t)*t),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},g=function(e,t,n){var o=0;if(e.offsetParent)do o+=e.offsetTop,e=e.offsetParent;while(e);return o=Math.max(o-t-n,0),Math.min(o,v()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},v=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},y=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};i.animateScroll=function(n,o,c){var i=y(o?o.getAttribute("data-options"):null),u=f(t||s,c||{},i),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,H=d?n:g(h,a,parseInt(u.offset,10)),I=H-m,A=v(),j=0,M=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,d),u.callback(n,o))},w=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+I*p(u.easing,b),e.scrollTo(0,Math.floor(E)),M(E,H,l)},Q=function(){clearInterval(l),l=setInterval(w,16)};0===e.pageYOffset&&e.scrollTo(0,0),Q()}};var E=function(t){e.location.hash;n&&(n.id=n.getAttribute("data-scroll-id"),i.animateScroll(n,o),n=null,o=null)},H=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector),o&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href))){var a=m(o.hash);if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},I=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return i.destroy=function(){t&&(document.removeEventListener("click",H,!1),e.removeEventListener("resize",I,!1),t=null,n=null,o=null,r=null,a=null,c=null,l=null)},i.init=function(n){u&&(i.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",H,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",I,!1))},i})); \ No newline at end of file +/*! smooth-scroll v10.2.1 | (c) 2016 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ +!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,l,i={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},d=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var r=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&"[object Object]"===Object.prototype.toString.call(n[o])?e[o]=d(!0,e[o],n[o]):e[o]=n[o])};n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=t<.5?2*t*t:-1+(4-2*t)*t),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},g=function(e,t,n){var o=0;if(e.offsetParent)do o+=e.offsetTop,e=e.offsetParent;while(e);return o=Math.max(o-t-n,0),Math.min(o,v()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},v=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},y=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?f(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};i.animateScroll=function(n,o,c){var i=y(o?o.getAttribute("data-options"):null),u=d(t||s,c||{},i),f="[object Number]"===Object.prototype.toString.call(n),h=f||!n.tagName?null:n;if(f||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=f?n:g(h,a,parseInt(u.offset,10)),H=I-m,A=v(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,f),u.callback(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,l)},w=function(){clearInterval(l),l=setInterval(M,16)};0===e.pageYOffset&&e.scrollTo(0,0),w()}};var E=function(t){var r;try{r=m(decodeURIComponent(e.location.hash))}catch(t){r=m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),i.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector),o&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href))){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return i.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,l=null)},i.init=function(n){u&&(i.destroy(),t=d(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},i})); \ No newline at end of file diff --git a/docs/dist/js/smooth-scroll.js b/docs/dist/js/smooth-scroll.js index c147ed3..0c5ca7d 100755 --- a/docs/dist/js/smooth-scroll.js +++ b/docs/dist/js/smooth-scroll.js @@ -1,5 +1,5 @@ /*! - * smooth-scroll v10.2.0: Animate scrolling to anchor links + * smooth-scroll v10.2.1: Animate scrolling to anchor links * (c) 2016 Chris Ferdinandi * MIT License * http://github.com/cferdinandi/smooth-scroll @@ -413,7 +413,13 @@ var hashChangeHandler = function (event) { // Get hash from URL - var hash = root.location.hash; + // var hash = decodeURIComponent( escapeCharacters( root.location.hash ) ); + var hash; + try { + hash = escapeCharacters( decodeURIComponent( root.location.hash ) ); + } catch(e) { + hash = escapeCharacters( root.location.hash ); + } // Only run if there's an anchor element to scroll to if ( !anchor ) return; @@ -447,7 +453,14 @@ if ( toggle.hostname !== root.location.hostname || toggle.pathname !== root.location.pathname || !/#/.test(toggle.href) ) return; // Get the sanitized hash - var hash = escapeCharacters( toggle.hash ); + // var hash = decodeURIComponent( escapeCharacters( toggle.hash ) ); + // console.log(hash); + var hash; + try { + hash = escapeCharacters( decodeURIComponent( toggle.hash ) ); + } catch(e) { + hash = escapeCharacters( toggle.hash ); + } // If the hash is empty, scroll to the top of the page if ( hash === '#' ) { diff --git a/docs/dist/js/smooth-scroll.min.js b/docs/dist/js/smooth-scroll.min.js index edf86f5..d952995 100755 --- a/docs/dist/js/smooth-scroll.min.js +++ b/docs/dist/js/smooth-scroll.min.js @@ -1,2 +1,2 @@ -/*! smooth-scroll v10.2.0 | (c) 2016 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ -!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,l,i={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var r=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&"[object Object]"===Object.prototype.toString.call(n[o])?e[o]=f(!0,e[o],n[o]):e[o]=n[o])};n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=t<.5?2*t*t:-1+(4-2*t)*t),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},g=function(e,t,n){var o=0;if(e.offsetParent)do o+=e.offsetTop,e=e.offsetParent;while(e);return o=Math.max(o-t-n,0),Math.min(o,v()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},v=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},y=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};i.animateScroll=function(n,o,c){var i=y(o?o.getAttribute("data-options"):null),u=f(t||s,c||{},i),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,H=d?n:g(h,a,parseInt(u.offset,10)),I=H-m,A=v(),j=0,M=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,d),u.callback(n,o))},w=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+I*p(u.easing,b),e.scrollTo(0,Math.floor(E)),M(E,H,l)},Q=function(){clearInterval(l),l=setInterval(w,16)};0===e.pageYOffset&&e.scrollTo(0,0),Q()}};var E=function(t){e.location.hash;n&&(n.id=n.getAttribute("data-scroll-id"),i.animateScroll(n,o),n=null,o=null)},H=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector),o&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href))){var a=m(o.hash);if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},I=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return i.destroy=function(){t&&(document.removeEventListener("click",H,!1),e.removeEventListener("resize",I,!1),t=null,n=null,o=null,r=null,a=null,c=null,l=null)},i.init=function(n){u&&(i.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",H,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",I,!1))},i})); \ No newline at end of file +/*! smooth-scroll v10.2.1 | (c) 2016 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ +!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,l,i={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},d=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var r=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&"[object Object]"===Object.prototype.toString.call(n[o])?e[o]=d(!0,e[o],n[o]):e[o]=n[o])};n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=t<.5?2*t*t:-1+(4-2*t)*t),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},g=function(e,t,n){var o=0;if(e.offsetParent)do o+=e.offsetTop,e=e.offsetParent;while(e);return o=Math.max(o-t-n,0),Math.min(o,v()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},v=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},y=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?f(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};i.animateScroll=function(n,o,c){var i=y(o?o.getAttribute("data-options"):null),u=d(t||s,c||{},i),f="[object Number]"===Object.prototype.toString.call(n),h=f||!n.tagName?null:n;if(f||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=f?n:g(h,a,parseInt(u.offset,10)),H=I-m,A=v(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,f),u.callback(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,l)},w=function(){clearInterval(l),l=setInterval(M,16)};0===e.pageYOffset&&e.scrollTo(0,0),w()}};var E=function(t){var r;try{r=m(decodeURIComponent(e.location.hash))}catch(t){r=m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),i.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector),o&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href))){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return i.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,l=null)},i.init=function(n){u&&(i.destroy(),t=d(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},i})); \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index c002dca..e61cf7c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -63,6 +63,19 @@

Smooth Scroll

.
.
.
.
.
.
.
.
.
.
.
.
.

+

+ Non-ASCII Characters
+ 中文 +

+ +

+ .
.
.
.
.
.
.
.
.
.
.
.
.
+ .
.
.
.
.
.
.
.
.
.
.
.
.
+ .
.
.
.
.
.
.
.
.
.
.
.
. +

+ +

中文

+

Bazinga!

diff --git a/package.json b/package.json index 1749279..e75f674 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smooth-scroll", - "version": "10.2.0", + "version": "10.2.1", "description": "Animate scrolling to anchor links", "main": "./dist/js/smooth-scroll.min.js", "author": { diff --git a/src/docs/index.md b/src/docs/index.md index 33b0e26..e55a541 100644 --- a/src/docs/index.md +++ b/src/docs/index.md @@ -33,6 +33,19 @@ .
.
.
.
.
.
.
.
.
.
.
.
.

+

+ Non-ASCII Characters
+ 中文 +

+ +

+ .
.
.
.
.
.
.
.
.
.
.
.
.
+ .
.
.
.
.
.
.
.
.
.
.
.
.
+ .
.
.
.
.
.
.
.
.
.
.
.
. +

+ +

中文

+

Bazinga!

diff --git a/src/js/smooth-scroll.js b/src/js/smooth-scroll.js index 229df2f..9370083 100755 --- a/src/js/smooth-scroll.js +++ b/src/js/smooth-scroll.js @@ -406,7 +406,13 @@ var hashChangeHandler = function (event) { // Get hash from URL - var hash = root.location.hash; + // var hash = decodeURIComponent( escapeCharacters( root.location.hash ) ); + var hash; + try { + hash = escapeCharacters( decodeURIComponent( root.location.hash ) ); + } catch(e) { + hash = escapeCharacters( root.location.hash ); + } // Only run if there's an anchor element to scroll to if ( !anchor ) return; @@ -440,7 +446,14 @@ if ( toggle.hostname !== root.location.hostname || toggle.pathname !== root.location.pathname || !/#/.test(toggle.href) ) return; // Get the sanitized hash - var hash = escapeCharacters( toggle.hash ); + // var hash = decodeURIComponent( escapeCharacters( toggle.hash ) ); + // console.log(hash); + var hash; + try { + hash = escapeCharacters( decodeURIComponent( toggle.hash ) ); + } catch(e) { + hash = escapeCharacters( toggle.hash ); + } // If the hash is empty, scroll to the top of the page if ( hash === '#' ) { From f4a5f6e4461ec04b8668690ef734f0825fc30f00 Mon Sep 17 00:00:00 2001 From: cferdinandi Date: Mon, 3 Apr 2017 14:19:26 -0400 Subject: [PATCH 003/104] Updated readme --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 510fee9..ac6f8bb 100755 --- a/README.md +++ b/README.md @@ -4,6 +4,13 @@ A lightweight script to animate scrolling to anchor links. Smooth Scroll works g [Download Smooth Scroll](https://github.com/cferdinandi/smooth-scroll/archive/master.zip) / [View the demo](http://cferdinandi.github.io/smooth-scroll/) +


+ +### Want to learn how to write your own vanilla JS plugins? Check out ["The Vanilla JS Guidebook"](https://gomakethings.com/vanilla-js-guidebook/) and level-up as a web developer. 🚀 + +
+ + ## Getting Started From a541227605cc46f05c87748cda68397aa961a8eb Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Fri, 7 Apr 2017 12:39:24 -0400 Subject: [PATCH 004/104] Agarzola master (#318) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Track jshint as dev dependency gulp-jshint requires jshint@2.x as a peer dep, which wasn’t tracked. * Support offset function * Bump version & build dist * Update README for offset function * Updated dependencies * Updated dependencies --- README.md | 2 +- dist/js/smooth-scroll.js | 6 +++--- dist/js/smooth-scroll.min.js | 4 ++-- docs/dist/js/smooth-scroll.js | 6 +++--- docs/dist/js/smooth-scroll.min.js | 4 ++-- package.json | 15 ++++++++------- src/js/smooth-scroll.js | 2 +- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index ac6f8bb..73cdd4d 100755 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ smoothScroll.init({ selectorHeader: null, // Selector for fixed headers (must be a valid CSS selector) [optional] speed: 500, // Integer. How fast to complete the scroll in milliseconds easing: 'easeInOutCubic', // Easing pattern to use - offset: 0, // Integer. How far to offset the scrolling anchor location in pixels + offset: 0, // Integer or Function returning an integer. How far to offset the scrolling anchor location in pixels callback: function ( anchor, toggle ) {} // Function to run after scrolling }); ``` diff --git a/dist/js/smooth-scroll.js b/dist/js/smooth-scroll.js index 0c5ca7d..3439579 100755 --- a/dist/js/smooth-scroll.js +++ b/dist/js/smooth-scroll.js @@ -1,6 +1,6 @@ /*! - * smooth-scroll v10.2.1: Animate scrolling to anchor links - * (c) 2016 Chris Ferdinandi + * smooth-scroll v10.3.1: Animate scrolling to anchor links + * (c) 2017 Chris Ferdinandi * MIT License * http://github.com/cferdinandi/smooth-scroll */ @@ -342,7 +342,7 @@ // Get the height of a fixed header if one exists and not already set headerHeight = getHeaderHeight( fixedHeader ); } - var endLocation = isNum ? anchor : getEndLocation( anchorElem, headerHeight, parseInt(animateSettings.offset, 10) ); // Location to scroll to + var endLocation = isNum ? anchor : getEndLocation( anchorElem, headerHeight, parseInt((typeof animateSettings.offset === 'function' ? animateSettings.offset() : animateSettings.offset), 10) ); // Location to scroll to var distance = endLocation - startLocation; // distance to travel var documentHeight = getDocumentHeight(); var timeLapsed = 0; diff --git a/dist/js/smooth-scroll.min.js b/dist/js/smooth-scroll.min.js index d952995..a01d8a3 100755 --- a/dist/js/smooth-scroll.min.js +++ b/dist/js/smooth-scroll.min.js @@ -1,2 +1,2 @@ -/*! smooth-scroll v10.2.1 | (c) 2016 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ -!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,l,i={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},d=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var r=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&"[object Object]"===Object.prototype.toString.call(n[o])?e[o]=d(!0,e[o],n[o]):e[o]=n[o])};n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=t<.5?2*t*t:-1+(4-2*t)*t),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},g=function(e,t,n){var o=0;if(e.offsetParent)do o+=e.offsetTop,e=e.offsetParent;while(e);return o=Math.max(o-t-n,0),Math.min(o,v()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},v=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},y=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?f(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};i.animateScroll=function(n,o,c){var i=y(o?o.getAttribute("data-options"):null),u=d(t||s,c||{},i),f="[object Number]"===Object.prototype.toString.call(n),h=f||!n.tagName?null:n;if(f||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=f?n:g(h,a,parseInt(u.offset,10)),H=I-m,A=v(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,f),u.callback(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,l)},w=function(){clearInterval(l),l=setInterval(M,16)};0===e.pageYOffset&&e.scrollTo(0,0),w()}};var E=function(t){var r;try{r=m(decodeURIComponent(e.location.hash))}catch(t){r=m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),i.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector),o&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href))){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return i.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,l=null)},i.init=function(n){u&&(i.destroy(),t=d(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},i})); \ No newline at end of file +/*! smooth-scroll v10.3.1 | (c) 2017 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ +!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,l,i={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(;n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},g=function(e,t,n){var o=0;if(e.offsetParent)do{o+=e.offsetTop,e=e.offsetParent}while(e);return o=Math.max(o-t-n,0),Math.min(o,y()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},y=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},v=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};i.animateScroll=function(n,o,c){var i=v(o?o.getAttribute("data-options"):null),u=f(t||s,c||{},i),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=d?n:g(h,a,parseInt("function"==typeof u.offset?u.offset():u.offset,10)),H=I-m,A=y(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,d),u.callback(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,l)};0===e.pageYOffset&&e.scrollTo(0,0),(function(){clearInterval(l),l=setInterval(M,16)})()}};var E=function(t){try{m(decodeURIComponent(e.location.hash))}catch(t){m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),i.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector))&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href)){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return i.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,l=null)},i.init=function(n){u&&(i.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},i})); \ No newline at end of file diff --git a/docs/dist/js/smooth-scroll.js b/docs/dist/js/smooth-scroll.js index 0c5ca7d..3439579 100755 --- a/docs/dist/js/smooth-scroll.js +++ b/docs/dist/js/smooth-scroll.js @@ -1,6 +1,6 @@ /*! - * smooth-scroll v10.2.1: Animate scrolling to anchor links - * (c) 2016 Chris Ferdinandi + * smooth-scroll v10.3.1: Animate scrolling to anchor links + * (c) 2017 Chris Ferdinandi * MIT License * http://github.com/cferdinandi/smooth-scroll */ @@ -342,7 +342,7 @@ // Get the height of a fixed header if one exists and not already set headerHeight = getHeaderHeight( fixedHeader ); } - var endLocation = isNum ? anchor : getEndLocation( anchorElem, headerHeight, parseInt(animateSettings.offset, 10) ); // Location to scroll to + var endLocation = isNum ? anchor : getEndLocation( anchorElem, headerHeight, parseInt((typeof animateSettings.offset === 'function' ? animateSettings.offset() : animateSettings.offset), 10) ); // Location to scroll to var distance = endLocation - startLocation; // distance to travel var documentHeight = getDocumentHeight(); var timeLapsed = 0; diff --git a/docs/dist/js/smooth-scroll.min.js b/docs/dist/js/smooth-scroll.min.js index d952995..a01d8a3 100755 --- a/docs/dist/js/smooth-scroll.min.js +++ b/docs/dist/js/smooth-scroll.min.js @@ -1,2 +1,2 @@ -/*! smooth-scroll v10.2.1 | (c) 2016 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ -!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,l,i={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},d=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var r=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&"[object Object]"===Object.prototype.toString.call(n[o])?e[o]=d(!0,e[o],n[o]):e[o]=n[o])};n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=t<.5?2*t*t:-1+(4-2*t)*t),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},g=function(e,t,n){var o=0;if(e.offsetParent)do o+=e.offsetTop,e=e.offsetParent;while(e);return o=Math.max(o-t-n,0),Math.min(o,v()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},v=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},y=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?f(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};i.animateScroll=function(n,o,c){var i=y(o?o.getAttribute("data-options"):null),u=d(t||s,c||{},i),f="[object Number]"===Object.prototype.toString.call(n),h=f||!n.tagName?null:n;if(f||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=f?n:g(h,a,parseInt(u.offset,10)),H=I-m,A=v(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,f),u.callback(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,l)},w=function(){clearInterval(l),l=setInterval(M,16)};0===e.pageYOffset&&e.scrollTo(0,0),w()}};var E=function(t){var r;try{r=m(decodeURIComponent(e.location.hash))}catch(t){r=m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),i.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector),o&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href))){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return i.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,l=null)},i.init=function(n){u&&(i.destroy(),t=d(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},i})); \ No newline at end of file +/*! smooth-scroll v10.3.1 | (c) 2017 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ +!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,l,i={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(;n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},g=function(e,t,n){var o=0;if(e.offsetParent)do{o+=e.offsetTop,e=e.offsetParent}while(e);return o=Math.max(o-t-n,0),Math.min(o,y()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},y=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},v=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};i.animateScroll=function(n,o,c){var i=v(o?o.getAttribute("data-options"):null),u=f(t||s,c||{},i),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=d?n:g(h,a,parseInt("function"==typeof u.offset?u.offset():u.offset,10)),H=I-m,A=y(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,d),u.callback(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,l)};0===e.pageYOffset&&e.scrollTo(0,0),(function(){clearInterval(l),l=setInterval(M,16)})()}};var E=function(t){try{m(decodeURIComponent(e.location.hash))}catch(t){m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),i.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector))&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href)){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return i.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,l=null)},i.init=function(n){u&&(i.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},i})); \ No newline at end of file diff --git a/package.json b/package.json index e75f674..eca9e45 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smooth-scroll", - "version": "10.2.1", + "version": "10.3.1", "description": "Animate scrolling to anchor links", "main": "./dist/js/smooth-scroll.min.js", "author": { @@ -15,7 +15,7 @@ "devDependencies": { "gulp": "^3.9.1", "node-fs": "^0.1.7", - "del": "^2.2.0", + "del": "^2.2.2", "lazypipe": "^1.0.1", "gulp-plumber": "^1.1.0", "gulp-flatten": "^0.3.1", @@ -23,13 +23,14 @@ "gulp-rename": "^1.2.2", "gulp-header": "^1.8.8", "gulp-footer": "^1.0.5", - "gulp-watch": "^4.3.9", + "gulp-watch": "^4.3.11", "gulp-livereload": "^3.8.1", - "gulp-jshint": "^2.0.1", + "jshint": "^2.9.4", + "gulp-jshint": "^2.0.4", "jshint-stylish": "^2.2.1", - "gulp-concat": "^2.6.0", - "gulp-uglify": "^2.0.0", - "gulp-optimize-js": "^1.0.2", + "gulp-concat": "^2.6.1", + "gulp-uglify": "^2.1.2", + "gulp-optimize-js": "^1.1.0", "gulp-markdown": "^1.2.0", "gulp-file-include": "^0.14.0" } diff --git a/src/js/smooth-scroll.js b/src/js/smooth-scroll.js index 9370083..2dae938 100755 --- a/src/js/smooth-scroll.js +++ b/src/js/smooth-scroll.js @@ -335,7 +335,7 @@ // Get the height of a fixed header if one exists and not already set headerHeight = getHeaderHeight( fixedHeader ); } - var endLocation = isNum ? anchor : getEndLocation( anchorElem, headerHeight, parseInt(animateSettings.offset, 10) ); // Location to scroll to + var endLocation = isNum ? anchor : getEndLocation( anchorElem, headerHeight, parseInt((typeof animateSettings.offset === 'function' ? animateSettings.offset() : animateSettings.offset), 10) ); // Location to scroll to var distance = endLocation - startLocation; // distance to travel var documentHeight = getDocumentHeight(); var timeLapsed = 0; From 07532cb30b28e7c93354158e967dcdad952c1cf9 Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Mon, 1 May 2017 17:03:39 -0400 Subject: [PATCH 005/104] v11.0.0 (#324) * Updated license to GPLv3 * Added before/after callbacks * Added custom easing pattern options * Updates to docs * Fixed typo --- CONTRIBUTING.md | 4 +- LICENSE.md | 692 ++++++++- README.md | 263 +--- dist/js/smooth-scroll.js | 30 +- dist/js/smooth-scroll.min.js | 4 +- docs/assets/css/custom.css | 176 +++ docs/assets/css/main.css | 1559 ++++++++++++++++++++ docs/assets/js/gumshoe.min.js | 2 + docs/assets/js/highlight-active-nav.js | 134 ++ docs/assets/js/prism.js | 21 + docs/assets/js/toc.js | 191 +++ docs/browsers.html | 104 ++ docs/dist/js/smooth-scroll.js | 30 +- docs/dist/js/smooth-scroll.min.js | 4 +- docs/index.html | 99 +- docs/license.html | 212 +++ docs/options.html | 241 +++ docs/setup.html | 110 ++ docs/source.html | 112 ++ gulpfile.js | 4 +- package.json | 4 +- src/docs/_templates/_footer.html | 33 +- src/docs/_templates/_header.html | 56 +- src/docs/assets/css/custom.css | 176 +++ src/docs/assets/css/main.css | 1559 ++++++++++++++++++++ src/docs/assets/js/gumshoe.min.js | 2 + src/docs/assets/js/highlight-active-nav.js | 134 ++ src/docs/assets/js/prism.js | 21 + src/docs/assets/js/toc.js | 191 +++ src/docs/browsers.md | 18 + src/docs/index.md | 8 + src/docs/license.md | 161 ++ src/docs/options.md | 191 +++ src/docs/setup.md | 30 + src/docs/source.md | 19 + src/js/smooth-scroll.js | 26 +- 36 files changed, 6280 insertions(+), 341 deletions(-) create mode 100755 docs/assets/css/custom.css create mode 100755 docs/assets/css/main.css create mode 100755 docs/assets/js/gumshoe.min.js create mode 100755 docs/assets/js/highlight-active-nav.js create mode 100755 docs/assets/js/prism.js create mode 100755 docs/assets/js/toc.js create mode 100755 docs/browsers.html mode change 100644 => 100755 docs/index.html create mode 100755 docs/license.html create mode 100755 docs/options.html create mode 100755 docs/setup.html create mode 100644 docs/source.html mode change 100644 => 100755 src/docs/_templates/_footer.html mode change 100644 => 100755 src/docs/_templates/_header.html create mode 100755 src/docs/assets/css/custom.css create mode 100755 src/docs/assets/css/main.css create mode 100755 src/docs/assets/js/gumshoe.min.js create mode 100755 src/docs/assets/js/highlight-active-nav.js create mode 100755 src/docs/assets/js/prism.js create mode 100755 src/docs/assets/js/toc.js create mode 100755 src/docs/browsers.md mode change 100644 => 100755 src/docs/index.md create mode 100755 src/docs/license.md create mode 100755 src/docs/options.md create mode 100755 src/docs/setup.md create mode 100644 src/docs/source.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c3863d1..eb80a84 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ -# How to contribute +# Bugs, Questions, and Pull Requests -I'm delighted that you're helping make this open source project better. Here are a few quick guidelines to make this an easier and better process for everyone. +A few quick guidelines to make this an easier and better process for everyone. diff --git a/LICENSE.md b/LICENSE.md index b5e8ef7..5885148 100755 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,21 +1,677 @@ -# The MIT License (MIT) +# GNU GENERAL PUBLIC LICENSE Copyright (c) Go Make Things, LLC -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +### Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom +to share and change all versions of a program--to make sure it remains +free software for all its users. We, the Free Software Foundation, use +the GNU General Public License for most of our software; it applies +also to any other work released this way by its authors. You can apply +it to your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you +have certain responsibilities if you distribute copies of the +software, or if you modify it: responsibilities to respect the freedom +of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the +manufacturer can do so. This is fundamentally incompatible with the +aim of protecting users' freedom to change the software. The +systematic pattern of such abuse occurs in the area of products for +individuals to use, which is precisely where it is most unacceptable. +Therefore, we have designed this version of the GPL to prohibit the +practice for those products. If such problems arise substantially in +other domains, we stand ready to extend this provision to those +domains in future versions of the GPL, as needed to protect the +freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish +to avoid the special danger that patents applied to a free program +could make it effectively proprietary. To prevent this, the GPL +assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +### TERMS AND CONDITIONS + +#### 0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds +of works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of +an exact copy. The resulting work is called a "modified version" of +the earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user +through a computer network, with no transfer of a copy, is not +conveying. + +An interactive user interface displays "Appropriate Legal Notices" to +the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +#### 1. Source Code. + +The "source code" for a work means the preferred form of the work for +making modifications to it. "Object code" means any non-source form of +a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can +regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same +work. + +#### 2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, +without conditions so long as your license otherwise remains in force. +You may convey covered works to others for the sole purpose of having +them make modifications exclusively for you, or provide you with +facilities for running those works, provided that you comply with the +terms of this License in conveying all material for which you do not +control copyright. Those thus making or running the covered works for +you must do so exclusively on your behalf, under your direction and +control, on terms that prohibit them from making any copies of your +copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the +conditions stated below. Sublicensing is not allowed; section 10 makes +it unnecessary. + +#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such +circumvention is effected by exercising rights under this License with +respect to the covered work, and you disclaim any intention to limit +operation or modification of the work as a means of enforcing, against +the work's users, your or third parties' legal rights to forbid +circumvention of technological measures. + +#### 4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +#### 5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these +conditions: + +- a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. +- b) The work must carry prominent notices stating that it is + released under this License and any conditions added under + section 7. This requirement modifies the requirement in section 4 + to "keep intact all notices". +- c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. +- d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +#### 6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of +sections 4 and 5, provided that you also convey the machine-readable +Corresponding Source under the terms of this License, in one of these +ways: + +- a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. +- b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the Corresponding + Source from a network server at no charge. +- c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. +- d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. +- e) Convey the object code using peer-to-peer transmission, + provided you inform other peers where the object code and + Corresponding Source of the work are being offered to the general + public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, +family, or household purposes, or (2) anything designed or sold for +incorporation into a dwelling. In determining whether a product is a +consumer product, doubtful cases shall be resolved in favor of +coverage. For a particular product received by a particular user, +"normally used" refers to a typical or common use of that class of +product, regardless of the status of the particular user or of the way +in which the particular user actually uses, or expects or is expected +to use, the product. A product is a consumer product regardless of +whether the product has substantial commercial, industrial or +non-consumer uses, unless such uses represent the only significant +mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to +install and execute modified versions of a covered work in that User +Product from a modified version of its Corresponding Source. The +information must suffice to ensure that the continued functioning of +the modified object code is in no case prevented or interfered with +solely because modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or +updates for a work that has been modified or installed by the +recipient, or for the User Product in which it has been modified or +installed. Access to a network may be denied when the modification +itself materially and adversely affects the operation of the network +or violates the rules and protocols for communication across the +network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +#### 7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders +of that material) supplement the terms of this License with terms: + +- a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or +- b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or +- c) Prohibiting misrepresentation of the origin of that material, + or requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or +- d) Limiting the use for publicity purposes of names of licensors + or authors of the material; or +- e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or +- f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions + of it) with contractual assumptions of liability to the recipient, + for any liability that these contractual assumptions directly + impose on those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; the +above requirements apply either way. + +#### 8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your license +from a particular copyright holder is reinstated (a) provisionally, +unless and until the copyright holder explicitly and finally +terminates your license, and (b) permanently, if the copyright holder +fails to notify you of the violation by some reasonable means prior to +60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +#### 9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run +a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +#### 10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +#### 11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims owned +or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within the +scope of its coverage, prohibits the exercise of, or is conditioned on +the non-exercise of one or more of the rights that are specifically +granted under this License. You may not convey a covered work if you +are a party to an arrangement with a third party that is in the +business of distributing software, under which you make payment to the +third party based on the extent of your activity of conveying the +work, and under which the third party grants, to any of the parties +who would receive the covered work from you, a discriminatory patent +license (a) in connection with copies of the covered work conveyed by +you (or copies made from those copies), or (b) primarily for and in +connection with specific products or compilations that contain the +covered work, unless you entered into that arrangement, or that patent +license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +#### 12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under +this License and any other pertinent obligations, then as a +consequence you may not convey it at all. For example, if you agree to +terms that obligate you to collect a royalty for further conveying +from those to whom you convey the Program, the only way you could +satisfy both those terms and this License would be to refrain entirely +from conveying the Program. + +#### 13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +#### 14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions +of the GNU General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in +detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies that a certain numbered version of the GNU General Public +License "or any later version" applies to it, you have the option of +following the terms and conditions either of that numbered version or +of any later version published by the Free Software Foundation. If the +Program does not specify a version number of the GNU General Public +License, you may choose any version ever published by the Free +Software Foundation. + +If the Program specifies that a proxy can decide which future versions +of the GNU General Public License can be used, that proxy's public +statement of acceptance of a version permanently authorizes you to +choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +#### 15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT +WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND +PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR +CORRECTION. + +#### 16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR +CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT +NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR +LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM +TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER +PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +#### 17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +### How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + +To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively state +the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 2017 Go Make Things, LLC + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper +mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) 2017 Go Make Things, LLC + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands \`show w' and \`show c' should show the +appropriate parts of the General Public License. Of course, your +program's commands might be different; for a GUI interface, you would +use an "about box". + +You should also get your employer (if you work as a programmer) or +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. For more information on this, and how to apply and follow +the GNU GPL, see . + +The GNU General Public License does not permit incorporating your +program into proprietary programs. If your program is a subroutine +library, you may consider it more useful to permit linking proprietary +applications with the library. If this is what you want to do, use the +GNU Lesser General Public License instead of this License. But first, +please read . \ No newline at end of file diff --git a/README.md b/README.md index 73cdd4d..ee4711b 100755 --- a/README.md +++ b/README.md @@ -1,269 +1,14 @@ # Smooth Scroll [![Build Status](https://travis-ci.org/cferdinandi/smooth-scroll.svg)](https://travis-ci.org/cferdinandi/smooth-scroll) -A lightweight script to animate scrolling to anchor links. Smooth Scroll works great with [Gumshoe](https://github.com/cferdinandi/gumshoe). - -[Download Smooth Scroll](https://github.com/cferdinandi/smooth-scroll/archive/master.zip) / [View the demo](http://cferdinandi.github.io/smooth-scroll/) - - -
- -### Want to learn how to write your own vanilla JS plugins? Check out ["The Vanilla JS Guidebook"](https://gomakethings.com/vanilla-js-guidebook/) and level-up as a web developer. 🚀 - -
- - - -## Getting Started - -Compiled and production-ready code can be found in the `dist` directory. The `src` directory contains development code. - -### 1. Include Smooth Scroll on your site. - -```html - -``` - -### 2. Add the markup to your HTML. - -Turn anchor links into Smooth Scroll links by adding the `[data-scroll]` data attribute. Give the anchor location an ID just like you normally would. - -```html -Anchor Link -... -Bazinga! -``` - -### 3. Initialize Smooth Scroll. - -In the footer of your page, after the content, initialize Smooth Scroll. And that's it, you're done. Nice work! - -```html - -``` - - - -## Installing with Package Managers - -You can install Smooth Scroll with your favorite package manager. - -* **[NPM](https://www.npmjs.org/):** `npm install cferdinandi/smooth-scroll` -* **[Bower](http://bower.io/):** `bower install https://github.com/cferdinandi/smooth-scroll.git` -* **[Component](http://component.io/):** `component install cferdinandi/smooth-scroll` - - - -## Working with the Source Files - -If you would prefer, you can work with the development code in the `src` directory using the included [Gulp build system](http://gulpjs.com/). This compiles, lints, and minifies code. - -### Dependencies -Make sure these are installed first. - -* [Node.js](http://nodejs.org) -* [Gulp](http://gulpjs.com) `sudo npm install -g gulp` - -### Quick Start - -1. In bash/terminal/command line, `cd` into your project directory. -2. Run `npm install` to install required files. -3. When it's done installing, run one of the task runners to get going: - * `gulp` manually compiles files. - * `gulp watch` automatically compiles files when changes are made and applies changes using [LiveReload](http://livereload.com/). - - - -## Options and Settings - -Smooth Scroll includes smart defaults and works right out of the box. But if you want to customize things, it also has a robust API that provides multiple ways for you to adjust the default options and settings. - -### Global Settings - -You can pass options and callbacks into Smooth Scroll through the `init()` function: - -```javascript -smoothScroll.init({ - selector: '[data-scroll]', // Selector for links (must be a class, ID, data attribute, or element tag) - selectorHeader: null, // Selector for fixed headers (must be a valid CSS selector) [optional] - speed: 500, // Integer. How fast to complete the scroll in milliseconds - easing: 'easeInOutCubic', // Easing pattern to use - offset: 0, // Integer or Function returning an integer. How far to offset the scrolling anchor location in pixels - callback: function ( anchor, toggle ) {} // Function to run after scrolling -}); -``` - -***Note:*** *To programatically add Smooth Scroll to all anchor links on a page, pass `selector: 'a[href^="#"]'` into `init`.* - -#### Easing Options - -**Linear** -*Moves at the same speed from start to finish.* - -* `Linear` - - -**Ease-In** -*Gradually increases in speed.* - -* `easeInQuad` -* `easeInCubic` -* `easeInQuart` -* `easeInQuint` - - -**Ease-In-Out** -*Gradually increases in speed, peaks, and then gradually slows down.* - -* `easeInOutQuad` -* `easeInOutCubic` -* `easeInOutQuart` -* `easeInOutQuint` - - -**Ease-Out** -*Gradually decreases in speed.* - -* `easeOutQuad` -* `easeOutCubic` -* `easeOutQuart` -* `easeOutQuint` - - -Learn more about the different easing patterns and what they do at [easings.net](http://easings.net/). - -### Override settings with data attributes - -Smooth Scroll also lets you override global settings on a link-by-link basis using the `[data-options]` data attribute. - -```html - - Anchor Link - -``` - -***Note:*** *You must use [valid JSON](http://jsonlint.com/) in order for the `data-options` feature to work. Does not support the `callback` method.* - -### Use Smooth Scroll events in your own scripts - -You can also call Smooth Scroll's scroll animation events in your own scripts. - -#### animateScroll() -Animate scrolling to an anchor. - -```javascript -smoothScroll.animateScroll( - anchor, // Node to scroll to. ex. document.querySelector( '#bazinga' ) - toggle, // Node that toggles the animation, OR an integer. ex. document.querySelector( '#toggle' ) - options // Classes and callbacks. Same options as those passed into the init() function. -); -``` - -**Example 1** - -```javascript -var anchor = document.querySelector( '#bazinga' ); -smoothScroll.animateScroll( anchor ); -``` - -**Example 2** - -```javascript -var anchor = document.querySelector( '#bazinga' ); -var toggle = document.querySelector('#toggle'); -var options = { speed: 1000, easing: 'easeOutCubic' }; -smoothScroll.animateScroll( anchor, toggle, options ); -``` - -**Example 3** - -```javascript -// You can optionally pass in a y-position to scroll to as an integer -smoothScroll.animateScroll( 750 ); -``` - -#### destroy() -Destroy the current `smoothScroll.init()`. This is called automatically during the `init` function to remove any existing initializations. - -```javascript -smoothScroll.destroy(); -``` - - -### Fixed Headers - -If you're using a fixed header, Smooth Scroll will automatically offset scroll distances by the header height. Pass in a valid CSS selector for your fixed header as an option to the `init`. - -If you have multiple fixed headers, pass in the last one in the markup. - -```html - -... - -``` - -### Animating links to other pages - -This is an often requested feature, but Smooth Scroll does not include an option to animate scrolling to links on other pages. - -You can attempt to implement it using the API, but it's very difficult to prevent the automatic browser jump when the page loads, and anything I've done to work around it results in weird, janky issues, so I've decided to leave this out of the core. Here's a potential workaround... - -1. Do *not* add the `data-scroll` attribute to links to other pages. Treat them like normal links, and include your anchor link hash as normal. - - ```html - - ``` -2. Add the following script to the footer of your page, after the `smoothScroll.init()` function. - - ```html - - ``` - - -## Browser Compatibility - -Smooth Scroll works in all modern browsers, and IE 9 and above. - -Smooth Scroll is built with modern JavaScript APIs, and uses progressive enhancement. If the JavaScript file fails to load, or if your site is viewed on older and less capable browsers, anchor links will jump the way they normally would. - - -## Known Issues - -### `` styling - -If the `` element has been assigned a height of `100%` or `overflow: hidden`, Smooth Scroll is unable to properly calculate page distances and will not scroll to the right location. The `` element can have a fixed, non-percentage based height (ex. `500px`), or a height of `auto`, and an `overflow` of `visible`. - -### Animating from the bottom - -Animated scrolling links at the very bottom of the page (example: a "scroll to top" link) will stop animated almost immediately after they start when using certain easing patterns. This is an issue that's been around for a while and I've yet to find a good fix for it. I've found that `easeOut*` easing patterns work as expected, but other patterns can cause issues. [See this discussion for more details.](https://github.com/cferdinandi/smooth-scroll/issues/49) +A lightweight script to animate scrolling to anchor links. Smooth Scroll works great with [Gumshoe](https://github.com/cferdinandi/gumshoe). +[View the demo and documentation to get started](http://cferdinandi.github.com/smooth-scroll/). ## How to Contribute -Please review the [contributing guidelines](CONTRIBUTING.md). - +Please review the [contributing guidelines](CONTRIBUTING.md). ## License -The code is available under the [MIT License](LICENSE.md). \ No newline at end of file +The code is available under the [GPLv3 License](LICENSE.md) or a [Commercial License](https://cferdinandi.github.io/smooth-scroll/license#commercial-license). \ No newline at end of file diff --git a/dist/js/smooth-scroll.js b/dist/js/smooth-scroll.js index 3439579..bf4e1a8 100755 --- a/dist/js/smooth-scroll.js +++ b/dist/js/smooth-scroll.js @@ -1,7 +1,7 @@ /*! - * smooth-scroll v10.3.1: Animate scrolling to anchor links + * smooth-scroll v11.0.0: Animate scrolling to anchor links * (c) 2017 Chris Ferdinandi - * MIT License + * GPL-3.0 License * http://github.com/cferdinandi/smooth-scroll */ @@ -27,12 +27,19 @@ // Default settings var defaults = { + // Selectors selector: '[data-scroll]', selectorHeader: null, + + // Speed & Easing speed: 500, - easing: 'easeInOutCubic', offset: 0, - callback: function () {} + easing: 'easeInOutCubic', + easingPatterns: {}, + + // Callback API + before: function () {}, + after: function () {} }; @@ -219,6 +226,8 @@ */ var easingPattern = function ( type, time ) { var pattern; + + // Default Easing Patterns if ( type === 'easeInQuad' ) pattern = time * time; // accelerating from zero velocity if ( type === 'easeOutQuad' ) pattern = time * (2 - time); // decelerating to zero velocity if ( type === 'easeInOutQuad' ) pattern = time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration @@ -231,6 +240,14 @@ if ( type === 'easeInQuint' ) pattern = time * time * time * time * time; // accelerating from zero velocity if ( type === 'easeOutQuint' ) pattern = 1 + (--time) * time * time * time * time; // decelerating to zero velocity if ( type === 'easeInOutQuint' ) pattern = time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration + + // Custom Easing Patterns + if ( settings.easingPatterns[type] ) { + pattern = settings.easingPatterns[type]( time ); + } + + console.log(pattern || time); + return pattern || time; // no easing, no acceleration }; @@ -366,7 +383,7 @@ adjustFocus( anchor, endLocation, isNum ); // Run callback after animation complete - animateSettings.callback( anchor, toggle ); + animateSettings.after( anchor, toggle ); } }; @@ -401,6 +418,9 @@ root.scrollTo( 0, 0 ); } + // Run callback before animation starts + animateSettings.before( anchor, toggle ); + // Start scrolling animation startAnimateScroll(); diff --git a/dist/js/smooth-scroll.min.js b/dist/js/smooth-scroll.min.js index a01d8a3..5161d16 100755 --- a/dist/js/smooth-scroll.min.js +++ b/dist/js/smooth-scroll.min.js @@ -1,2 +1,2 @@ -/*! smooth-scroll v10.3.1 | (c) 2017 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ -!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,l,i={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(;n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},g=function(e,t,n){var o=0;if(e.offsetParent)do{o+=e.offsetTop,e=e.offsetParent}while(e);return o=Math.max(o-t-n,0),Math.min(o,y()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},y=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},v=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};i.animateScroll=function(n,o,c){var i=v(o?o.getAttribute("data-options"):null),u=f(t||s,c||{},i),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=d?n:g(h,a,parseInt("function"==typeof u.offset?u.offset():u.offset,10)),H=I-m,A=y(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,d),u.callback(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,l)};0===e.pageYOffset&&e.scrollTo(0,0),(function(){clearInterval(l),l=setInterval(M,16)})()}};var E=function(t){try{m(decodeURIComponent(e.location.hash))}catch(t){m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),i.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector))&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href)){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return i.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,l=null)},i.init=function(n){u&&(i.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},i})); \ No newline at end of file +/*! smooth-scroll v11.0.0 | (c) 2017 Chris Ferdinandi | GPL-3.0 License | http://github.com/cferdinandi/smooth-scroll */ +!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,i,l={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,offset:0,easing:"easeInOutCubic",easingPatterns:{},before:function(){},after:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(;n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?a+="\\"+t.toString(16)+" ":a+=t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,n){var o;return"easeInQuad"===e&&(o=n*n),"easeOutQuad"===e&&(o=n*(2-n)),"easeInOutQuad"===e&&(o=n<.5?2*n*n:(4-2*n)*n-1),"easeInCubic"===e&&(o=n*n*n),"easeOutCubic"===e&&(o=--n*n*n+1),"easeInOutCubic"===e&&(o=n<.5?4*n*n*n:(n-1)*(2*n-2)*(2*n-2)+1),"easeInQuart"===e&&(o=n*n*n*n),"easeOutQuart"===e&&(o=1- --n*n*n*n),"easeInOutQuart"===e&&(o=n<.5?8*n*n*n*n:1-8*--n*n*n*n),"easeInQuint"===e&&(o=n*n*n*n*n),"easeOutQuint"===e&&(o=1+--n*n*n*n*n),"easeInOutQuint"===e&&(o=n<.5?16*n*n*n*n*n:1+16*--n*n*n*n*n),t.easingPatterns[e]&&(o=t.easingPatterns[e](n)),console.log(o||n),o||n},g=function(e,t,n){var o=0;if(e.offsetParent)do{o+=e.offsetTop,e=e.offsetParent}while(e);return o=Math.max(o-t-n,0),Math.min(o,y()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},y=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},v=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};l.animateScroll=function(n,o,c){var l=v(o?o.getAttribute("data-options"):null),u=f(t||s,c||{},l),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=d?n:g(h,a,parseInt("function"==typeof u.offset?u.offset():u.offset,10)),H=I-m,A=y(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,d),u.after(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,i)};0===e.pageYOffset&&e.scrollTo(0,0),u.before(n,o),(function(){clearInterval(i),i=setInterval(M,16)})()}};var E=function(t){try{m(decodeURIComponent(e.location.hash))}catch(t){m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),l.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector))&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href)){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return l.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,i=null)},l.init=function(n){u&&(l.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},l})); \ No newline at end of file diff --git a/docs/assets/css/custom.css b/docs/assets/css/custom.css new file mode 100755 index 0000000..dbe16cd --- /dev/null +++ b/docs/assets/css/custom.css @@ -0,0 +1,176 @@ +/** + * Typography + */ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; +} + +h1, h2, h3, h4, h5, h6 { + font-weight: bold; +} + + +/** + * Background color + */ + +@media (min-width: 40em) { + body { + background-image: -webkit-linear-gradient(left, #f7f7f7 0%, #f7f7f7 25%, transparent 25%, transparent 100%); + background-image: linear-gradient(to right, #f7f7f7 0, #f7f7f7 25%, transparent 25%, transparent 100%); + } +} + + +/** + * Navigation + */ + +@media (max-width: 40em) { + .list-nav { + margin-left: -0.25em; + margin-right: -0.25em; + padding: 0; + } + + .list-nav > li { + display: inline-block; + margin-left: 0.25em; + margin-right: 0.25em; + } + + .list-nav > li:before { + content: "\00b7"; + margin-right: 0.5em; + } + + .list-nav > li:first-child:before { + content: ""; + margin-right: 0; + } +} + +@media (max-width: 40em) { + .nav { + border-bottom: 1px solid #e5e5e5; + } +} + +.nav-section a.active { + color: #808080; +} + +/* Disable current page nav */ +a.nav-active { + pointer-events: none; + color: #808080; + cursor: not-allowed; +} + +/* Sticky nav */ +@media (min-width: 40em) { + .sticky-header { + background-color: #f7f7f7; + bottom: 0; + overflow-y: auto; + position: fixed; + top: 0; + width: 22.2%; + } + + .sticky-body { + margin-left: 27.8%; + } +} + +@media (min-width: 80em) { + .sticky-header { + width: 17.75em; + } +} + + +/** + * Buttons + */ + +.btn { + background-color: #f7272f; + border-color: #f7272f; +} + +a.btn:active, +a.btn:focus, +a.btn:hover { + background-color: #cb070e; + border-color: #cb070e; +} + + + +/** + * Prism + * Code syntax highlighting by Lea Verou. + * http://prismjs.com/ + */ + +@media screen { + + .token.comment, + .token.prolog, + .token.doctype, + .token.cdata { + color: slategray; + } + + .token.punctuation { + color: #999; + } + + .token.property, + .token.tag, + .token.boolean, + .token.number, + .token.constant, + .token.symbol { + color: #905; + } + + .token.selector, + .token.attr-name, + .token.string, + .token.builtin { + color: #690; + } + + .token.operator, + .token.entity, + .token.url, + .language-css .token.string, + .style .token.string, + .token.variable { + color: #a67f59; + } + + .token.atrule, + .token.attr-value, + .token.keyword { + color: #07a; + } + + + .token.regex, + .token.important { + color: #e90; + } + + .token.important { + font-weight: bold; + } + + .token.entity { + cursor: help; + } + +} \ No newline at end of file diff --git a/docs/assets/css/main.css b/docs/assets/css/main.css new file mode 100755 index 0000000..7e5a18f --- /dev/null +++ b/docs/assets/css/main.css @@ -0,0 +1,1559 @@ +/*! + * Kraken v7.5.2: A lightweight front-end boilerplate + * (c) 2017 Chris Ferdinandi + * MIT License + * http://github.com/cferdinandi/kraken + */ + +/** + * @section Normalize.css + * Normalize.css base with custom code. + * Additional normalize styles incorporated throughout components. + * @link http://necolas.github.io/normalize.css/ + */ +/** + * Mobile screen resizing + * @link http://dev.w3.org/csswg/css-device-adapt/ + */ +@-webkit-viewport { + width: device-width; + zoom: 1.0; +} + +@-moz-viewport { + width: device-width; + zoom: 1.0; +} + +@-ms-viewport { + width: device-width; + zoom: 1.0; +} + +@-o-viewport { + width: device-width; + zoom: 1.0; +} + +@viewport { + width: device-width; + zoom: 1.0; +} + +/** + * Remove the tap delay in webkit + * @link https://medium.com/@adactio/delay-a9df9edceef3#.7dmbl3xow + */ +/* line 23, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +a, .link-block-styled, +button, +input, +select, +textarea, +label, +summary { + -ms-touch-action: manipulation; + touch-action: manipulation; +} + +/** + * Add box sizing to everything + * @link http://www.paulirish.com/2012/box-sizing-border-box-ftw/ + */ +/* line 38, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +*, +*:before, +*:after { + box-sizing: border-box; +} + +/** + * 1. Set default font family to default. + * 2. Force scrollbar display to prevent jumping on pages. + * 3. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ +/* line 51, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +html { + font-family: "Helvetica Neue", Arial, sans-serif; + /* 1 */ + overflow-y: scroll; + /* 2 */ + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; + text-size-adjust: 100%; + /* 3 */ +} + +/** + * Remove default margin. + */ +/* line 60, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +body { + margin: 0; +} + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ +/* line 70, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +article, +aside, +cite, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section { + display: block; +} + +/* + * Add the correct display in all browsers. + */ +/* line 89, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +summary { + display: list-item; +} + +/** + * Correct `inline-block` display not defined in IE 8/9. + */ +/* line 96, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +audio, +canvas, +progress, +video { + display: inline-block; + /* 1 */ +} + +/** + * Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ +/* line 106, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +progress { + vertical-align: baseline; +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ +/* line 114, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Prevent img and video elements from spilling outside of the page on smaller screens. + */ +/* line 122, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +img, +video { + max-width: 100%; + height: auto; +} + +/** + * Prevent iframe, object, and embed elements from spilling outside of the page on smaller screens. + * height: auto causes iframes to smush, so it's omitted here. + */ +/* line 132, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +iframe, +object, +embed { + max-width: 100%; +} + +/** + * Hide the template element in IE, Safari, and Firefox < 22. + */ +/** + * 1. Remove border when inside `a` element in IE 8/9/10. + * 2. Prevents IE from making scaled images look like crap + */ +/* line 149, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +img { + border: 0; + /* 1 */ + -ms-interpolation-mode: bicubic; + /* 2 */ +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ +/* line 157, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +svg:not(:root) { + overflow: hidden; +} + +/** + * Address inconsistent margin. + */ +/* line 164, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +figure { + margin: 0; +} + +/** + * @workaround Remove focus from
element when using tabindex="-1" hack for skipnav link + * @link https://code.google.com/p/chromium/issues/detail?id=37721 + */ +/* line 172, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +.tabindex:focus { + outline: none; +} + +/** + * @section Grid + * Structure and layout + */ +/** + * Base grid styles: single column + */ +/* line 9, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ +.container { + margin-left: auto; + margin-right: auto; + max-width: 80em; + width: 88%; +} + +/* line 16, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ +.row { + margin-left: -1.4%; + margin-right: -1.4%; +} + +/* line 21, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ +.grid-fourth, .grid-third, .grid-half, .grid-two-thirds, .grid-three-fourths, .grid-full, .grid-dynamic { + float: left; + padding-left: 1.4%; + padding-right: 1.4%; + width: 100%; +} + +/** + * Reverses order of grid for content choreography + */ +/* line 38, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ +.grid-flip { + float: right; +} + +/** + * Add columns to grid on bigger screens + */ +@media (min-width: 20em) { + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-xsmall .grid-fourth { + width: 25%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-xsmall .grid-third { + width: 33.33333%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-xsmall .grid-half { + width: 50%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-xsmall .grid-two-thirds { + width: 66.66667%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-xsmall .grid-three-fourths { + width: 75%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-xsmall .grid-full { + width: 100%; + } +} + +@media (min-width: 30em) { + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-small .grid-fourth { + width: 25%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-small .grid-third { + width: 33.33333%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-small .grid-half { + width: 50%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-small .grid-two-thirds { + width: 66.66667%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-small .grid-three-fourths { + width: 75%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-small .grid-full { + width: 100%; + } +} + +@media (min-width: 40em) { + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-fourth { + width: 25%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-third { + width: 33.33333%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-half { + width: 50%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-two-thirds { + width: 66.66667%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-three-fourths { + width: 75%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-full { + width: 100%; + } + /* line 55, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .offset-fourth { + margin-left: 25%; + } + /* line 55, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .offset-third { + margin-left: 33.33333%; + } + /* line 55, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .offset-half { + margin-left: 50%; + } + /* line 55, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .offset-two-thirds { + margin-left: 66.66667%; + } + /* line 55, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .offset-three-fourths { + margin-left: 75%; + } + /* line 55, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .offset-full { + margin-left: 100%; + } +} + +/** + * Dynamic grid + */ +@media (min-width: 20em) { + /* line 71, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-dynamic { + width: 50%; + } +} + +@media (min-width: 30em) { + /* line 71, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-dynamic { + width: 33.33333%; + } +} + +@media (min-width: 40em) { + /* line 71, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-dynamic { + width: 25%; + } +} + +/** + * @section Typography + * Sets font styles for entire site + */ +/* line 6, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +body { + background: #ffffff; + color: #272727; + font-family: "Helvetica Neue", Arial, sans-serif; + font-size: 100%; + line-height: 1.5; +} + +@media (min-width: 40em) { + /* line 6, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ + body { + line-height: 1.5625; + } +} + +/* line 18, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +p { + margin: 0 0 1.5625em; +} + +/** + * Hyperlink styling + * 1. Remove the gray background on active links in IE 10. + * 2. Remove gaps in links underline in iOS 8+ and Safari 8+. + */ +/* line 29, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +a, .link-block-styled { + background-color: transparent; + /* 1 */ + color: #0088cc; + text-decoration: none; + word-wrap: break-word; + -webkit-text-decoration-skip: objects; + /* 2 */ + /** + * Improve readability when focused and also mouse hovered in all browsers. + */ +} + +/* line 39, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +a:active, .link-block-styled:active, a:hover, .link-block-styled:hover, .link-block:hover .link-block-styled { + outline: 0; +} + +/* line 44, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +a:active, .link-block-styled:active, a:focus, .link-block-styled:focus, a:hover, .link-block-styled:hover, .link-block:hover .link-block-styled { + color: #005580; + text-decoration: underline; +} + +/** + * Creates block-level links + */ +/* line 57, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +a.link-block, .link-block.link-block-styled { + color: #272727; + display: block; + text-decoration: none; +} + +/** + * List styling + */ +/* line 76, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +ul, +ol { + margin: 0 0 1.5625em 2em; + padding: 0; +} + +/* line 82, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +ul ul, +ul ol, +ol ol, +ol ul { + margin-bottom: 0; +} + +/* line 89, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +dl, +dd { + margin: 0; + padding: 0; +} + +/* line 95, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +dd { + margin-bottom: 1.5625em; +} + +/* line 99, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +dt { + font-weight: bold; +} + +/** + * Removes list styling. + * For semantic reasons, should only be used on unordered lists. + */ +/* line 107, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +.list-unstyled { + margin-left: 0; + list-style: none; +} + +/** + * Display lists on a single line. + */ +/* line 116, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +.list-inline { + list-style: none; + margin-left: -0.5em; + margin-right: -0.5em; + padding: 0; +} + +/* line 123, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +.list-inline > li { + display: inline; + margin-left: 0.5em; + margin-right: 0.5em; +} + +/** + * Heading styling for h1 through h6 elements. + * Heading class lets you use one heading type for semantics, but style it as another heading type. + */ +/* line 135, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +h1, h2, h3, h4, h5, h6 { + font-weight: normal; + line-height: 1.2; + margin: 0 0 1em; + padding: 1em 0 0; + word-wrap: break-word; +} + +/* line 143, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +h1, +.h1 { + font-size: 1.5em; + padding-top: .5em; +} + +@media (min-width: 40em) { + /* line 143, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ + h1, + .h1 { + font-size: 1.75em; + } +} + +/* line 153, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +h2, +.h2 { + font-size: 1.3125em; +} + +/* line 158, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +h3, +.h3 { + font-size: 1.1875em; +} + +/* line 163, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +h4, h5, h6, +.h4, .h5, .h6 { + font-size: 1em; +} + +/* line 168, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +h4, +.h4 { + text-transform: uppercase; +} + +/** + * Lines, Quotes and Emphasis + */ +/* line 178, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +hr { + border: 0; + border-top: 1px solid #e5e5e5; + border-bottom: 0 solid #ffffff; + box-sizing: content-box; + margin: 2em auto; + overflow: visible; +} + +/** + * Prevent the duplicate application of `bolder` by the next rule in Safari 6. + */ +/* line 190, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +b, +strong { + font-weight: inherit; +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ +/* line 198, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +b, +strong { + font-weight: bolder; +} + +/** + * 1. Remove the bottom border in Firefox 39-. + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ +/* line 207, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +abbr[title] { + border-bottom: none; + /* 1 */ + text-decoration: underline; + /* 2 */ + text-decoration: underline dotted; + /* 2 */ +} + +/** + * Address styling not present in Safari and Chrome. + */ +/* line 216, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +dfn { + font-style: italic; +} + +/** + * Address styling not present in IE 8/9. + */ +/* line 223, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +mark { + background: #ff0; + color: #000000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ +/* line 231, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ +/* line 238, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +/* line 246, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +sup { + top: -0.5em; +} + +/* line 250, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +sub { + bottom: -0.25em; +} + +/** + * Blockquotes + */ +/* line 259, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +blockquote { + font-size: 1.1875em; + font-style: italic; + margin: 0 0 1.5625em; + padding-left: 0.84211em; + padding-right: 0.84211em; +} + +/* line 266, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +blockquote cite { + color: #808080; + font-size: 0.84211em; + padding-top: 1em; +} + +/* line 273, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +blockquote, +q { + quotes: none; +} + +/* line 278, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +blockquote:before, +blockquote:after, +q:before, +q:after { + content: ''; +} + +/** + * @section Code + * Styling for code and preformatted text. + */ +/* line 6, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_code.scss */ +code, +kbd, +pre, +samp { + border-radius: 1px; + font-family: Menlo, Monaco, "Courier New", monospace; + font-size: 0.875em; +} + +/* line 15, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_code.scss */ +code { + background-color: #f7f7f7; + color: #dd1144; + padding: 0.25em; + word-wrap: break-word; +} + +/* line 22, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_code.scss */ +pre { + background-color: #f4f4f4; + display: block; + line-height: 1.5; + margin-bottom: 1.5625em; + overflow: auto; + padding: 0.8125em; + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + white-space: pre-wrap; + word-break: break-all; +} + +/* line 33, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_code.scss */ +pre code { + background-color: transparent; + border: 0; + color: inherit; + font-size: 1em; + padding: 0; +} + +/** + * @section Buttons + * Styling for CSS buttons. + */ +/** + * Primary buttons + */ +/* line 10, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn { + background-color: #0088cc; + border: 1px solid #0088cc; + border-radius: 1px; + color: #ffffff; + display: inline-block; + font-size: 0.9375em; + font-weight: normal; + line-height: 1.2; + margin-right: 0.3125em; + margin-bottom: 0.3125em; + padding: 0.5em 0.6875em; +} + +/* line 23, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn:hover, +a .btn:hover, .link-block-styled .btn:hover, .btn:focus, +a .btn:focus, .link-block-styled .btn:focus, .btn:active, +a .btn:active, .link-block-styled .btn:active, .btn.active { + background-color: #005580; + border-color: #005580; + color: #ffffff; + text-decoration: none; +} + +/** + * Secondary buttons + */ +/* line 41, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn-secondary { + background-color: #808080; + border-color: #808080; +} + +/* line 45, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn-secondary:hover, +a .btn-secondary:hover, .link-block-styled .btn-secondary:hover, .btn-secondary:focus, +a .btn-secondary:focus, .link-block-styled .btn-secondary:focus, .btn-secondary:active, +a .btn-secondary:active, .link-block-styled .btn-secondary:active, .btn-secondary.active { + background-color: #5a5a5a; + border-color: #5a5a5a; +} + +/** + * Active state + */ +/* line 61, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn:active, +.btn.active { + box-shadow: inset 0 0.15625em 0.25em rgba(0, 0, 0, 0.15), 0 1px 0.15625em rgba(0, 0, 0, 0.05); + outline: 0; +} + +/** + * Disabled state + */ +/* line 71, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn.disabled, +.btn[disabled] { + box-shadow: none; + cursor: not-allowed; + opacity: 0.5; + pointer-events: none; +} + +/** + * Button size + */ +/* line 83, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn-large { + font-size: 1em; + line-height: normal; + padding: 0.6875em 0.9375em; +} + +/** + * Block-level buttons + */ +/* line 93, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn-block, +input[type="submit"].btn-block, +input[type="reset"].btn-block, +input[type="button"].btn-block { + display: block; + margin-right: 0; + padding-right: 0; + padding-left: 0; + width: 100%; +} + +/** + * General styles + */ +/* line 108, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn, +button, +html input[type="button"], +input[type="reset"], +input[type="submit"] { + cursor: pointer; + text-align: center; + vertical-align: middle; + /** + * @workaround Override default button styling + * @affected Webkit/Firefox + */ + -webkit-appearance: none; +} + +/** + * Remove right margin on last element and inputs + */ +/* line 129, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn:last-child, +input.btn { + margin-right: 0; +} + +/** + * @section Forms + * Styling for form elements. + */ +/* line 6, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +form, +fieldset { + margin-bottom: 1.5625em; +} + +/* line 11, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +fieldset { + border: 0; + padding: 0; +} + +/* line 16, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +legend, +label { + display: block; + font-weight: normal; + margin: 0 0 0.3125em; + padding: 0; +} + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ +/* line 30, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +button, +input, +optgroup, +select, +textarea { + color: #555555; + /* 1 */ + font: inherit; + /* 2 */ + margin: 0; + /* 3 */ + padding: 0.3125em; +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ +/* line 44, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ +/* line 54, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +button, +select { + text-transform: none; +} + +/* line 59, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +input, +textarea, +select { + border: 1px solid #b8b8b8; + border-radius: 1px; + display: block; + line-height: 1.5; + margin-bottom: 1.1875em; + width: 100%; +} + +@media (min-width: 40em) { + /* line 59, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ + input, + textarea, + select { + line-height: 1.5625; + } +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ +/* line 78, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +optgroup { + font-weight: bold; +} + +/* line 82, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +form button, +form .button { + margin-bottom: 1.1875em; +} + +/* line 87, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +textarea { + height: 12em; + overflow: auto; +} + +/* line 92, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +[type="image"], +[type="checkbox"], +[type="radio"] { + cursor: pointer; + display: inline-block; + height: auto; + margin-bottom: 0.3125em; + padding: 0; + width: auto; +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ +/* line 108, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/* line 113, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +input:focus, +textarea:focus { + border-color: rgba(82, 168, 236, 0.8); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 0.5em rgba(82, 168, 236, 0.6); + outline: 0; + outline: thin dotted \9; +} + +/* line 121, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +[type="file"]:focus, +[type="checkbox"]:focus, +select:focus { + outline: thin dotted; + outline: 0.3125em auto -webkit-focus-ring-color; + outline-offset: -0.125em; +} + +/** + * Remove the inner border and padding in Firefox. + */ +/* line 133, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ +/* line 145, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +button:-moz-focusring, +[type="button"]:-moz-focusring, +[type="reset"]:-moz-focusring, +[type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ +/* line 157, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +::-webkit-file-upload-button { + -webkit-appearance: button; + /* 1 */ + font: inherit; + /* 2 */ +} + +/** + * Inline inputs + */ +/* line 166, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +.input-inline { + display: inline-block; + vertical-align: middle; + width: auto; +} + +/** + * Condensed inputs + */ +/* line 176, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +.input-condensed { + padding: 1px 0.3125em; + font-size: 0.9375em; +} + +/** + * Search + */ +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ +/* line 191, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +[type="search"] { + -webkit-appearance: textfield; + /* 1 */ + outline-offset: -2px; + /* 2 */ +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ +/* line 201, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +[type="search"]::-webkit-search-cancel-button, +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Create rounded search bar + */ +/* line 210, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +.input-search { + width: 85%; + padding-left: 0.9375em; + padding-right: 2.5em; + border-radius: 1.3125em; + transition: width 300ms ease-in; +} + +@media (min-width: 40em) { + /* line 210, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ + .input-search { + width: 65%; + } +} + +/** + * Special styling for search icon as button + */ +/* line 226, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +.btn-search { + display: inline; + color: #808080; + border: none; + background: none; + margin-left: -2.5em; + margin-bottom: 0; +} + +/* line 234, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +.btn-search .icon { + fill: #808080; +} + +/* line 238, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +.btn-search:hover { + color: #5a5a5a; +} + +/* line 241, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +.btn-search:hover .icon { + fill: #5a5a5a; +} + +/** + * @section SVGs + * SVG icon sprite styling. + * @link http://css-tricks.com/svg-sprites-use-better-icon-fonts/ + * @link http://css-tricks.com/svg-use-external-source/ + */ +/** + * Basic styles + * Only displayed when SVGs are supported to avoid large empty spaces + */ +/* line 12, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_svg.scss */ +.icon { + display: inline-block; + fill: currentColor; + height: 0; + width: 0; +} + +/* line 18, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_svg.scss */ +.svg .icon { + height: 1em; + width: 1em; +} + +/** + * Hide fallback text if browser supports SVG + */ +/** + * @section Tables + * Styling for tables + */ +/* line 6, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ +table { + border-collapse: collapse; + border-spacing: 0; + margin-bottom: 1.5625em; + max-width: 100%; + width: 100%; +} + +/* line 14, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ +th, +td { + text-align: left; + padding: 0.5em; +} + +/* line 20, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ +th { + border-bottom: 0.125em solid #e5e5e5; + font-weight: bold; + vertical-align: bottom; +} + +/* line 27, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ +td { + border-top: 1px solid #e5e5e5; + vertical-align: top; +} + +/** + * Adds zebra striping + */ +/* line 35, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ +.table-striped tbody tr:nth-child(odd) { + background-color: #f7f7f7; +} + +/** + * Reduces padding on condensed tables + */ +/* line 43, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ +.table-condensed th, +.table-condensed td { + padding: 0.25em; +} + +/** + * Pure CSS responsive tables + * Adds label to each cell using the [data-label] attribute + * @link https://techblog.livingsocial.com/blog/2015/04/06/responsive-tables-in-pure-css/ + */ +@media (max-width: 40em) { + /* line 57, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ + .table-responsive thead { + display: none; + visibility: hidden; + } + /* line 62, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ + .table-responsive tr { + border-top: 1px solid #ededed; + display: block; + padding: 0.5em; + } + /* line 68, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ + .table-responsive td { + border: 0; + display: block; + padding: 0.25em; + } + /* line 73, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ + .table-responsive td:before { + content: attr(data-label); + display: block; + font-weight: bold; + } +} + +/** + * @section Overrides + * Nudge and tweak alignment, spacing, and visibility. + */ +/** + * Text sizes + */ +/* line 11, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.text-small { + font-size: 0.9375em; +} + +/* line 15, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.text-large { + font-size: 1.1875em; + line-height: 1.4; +} + +@media (min-width: 40em) { + /* line 15, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ + .text-large { + font-size: 1.3125em; + } +} + +/** + * Text colors + */ +/* line 29, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.text-muted { + color: #808080; +} + +/** + * Text alignment + */ +/* line 38, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.text-center { + text-align: center; +} + +/* line 42, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.text-right { + text-align: right; +} + +/* line 46, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.text-left { + text-align: left; +} + +@media (min-width: 40em) { + /* line 51, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ + .text-right-medium { + text-align: right; + } +} + +/** + * Floats + */ +/* line 61, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.float-left { + float: left; +} + +/* line 65, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.float-center { + float: none; + margin-left: auto; + margin-right: auto; +} + +/* line 71, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.float-right { + float: right; +} + +/** + * Margins + */ +/* line 80, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.no-margin-top { + margin-top: 0; +} + +/* line 84, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.no-margin-bottom { + margin-bottom: 0; +} + +/* line 88, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.margin-top { + margin-top: 1.5625em; +} + +/* line 92, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.margin-bottom { + margin-bottom: 1.5625em; +} + +/* line 96, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.margin-bottom-small { + margin-bottom: 0.5em; +} + +/* line 100, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.margin-bottom-large { + margin-bottom: 2em; +} + +/** + * Padding + */ +/* line 109, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.no-padding-top { + padding-top: 0; +} + +/* line 113, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.no-padding-bottom { + padding-bottom: 0; +} + +/* line 117, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.padding-top { + padding-top: 1.5625em; +} + +/* line 121, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.padding-top-small { + padding-top: 0.5em; +} + +/* line 125, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.padding-top-large { + padding-top: 2em; +} + +/* line 129, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.padding-bottom { + padding-bottom: 1.5625em; +} + +/* line 133, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.padding-bottom-small { + padding-bottom: 0.5em; +} + +/* line 137, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.padding-bottom-large { + padding-bottom: 2em; +} + +/** + * Visibility + */ +/** + * Visually hide an element, but leave it available for screen readers + * @link https://github.com/h5bp/html5-boilerplate/blob/master/dist/css/main.css + * @link http://snook.ca/archives/html_and_css/hiding-content-for-accessibility + */ +/* line 151, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.screen-reader, .svg .icon-fallback-text { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + white-space: nowrap; + width: 1px; +} + +/** + * Extends the .screen-reader class to allow the element to be focusable when navigated to via the keyboard + * @link https://github.com/h5bp/html5-boilerplate/blob/master/dist/css/main.css + * @link https://www.drupal.org/node/897638 + */ +/* line 168, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.screen-reader-focusable:active, +.screen-reader-focusable:focus { + clip: auto; + height: auto; + margin: 0; + overflow: visible; + position: static; + white-space: normal; + width: auto; +} + +/** + * @workaround + * @affected IE 8/9/10 + * @link http://juicystudio.com/article/screen-readers-display-none.php + */ +/* line 184, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +[hidden], template { + display: none; + visibility: hidden; +} + +/** + * Contain floats + * The space content is one way to avoid an Opera bug when the `contenteditable` attribute is included anywhere else in the document. + * @link https://github.com/h5bp/html5-boilerplate/blob/master/dist/css/main.css + */ +/* line 196, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.clearfix:before, .container:before, +.row:before, +.clearfix:after, +.container:after, +.row:after { + display: table; + content: " "; +} + +/* line 202, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.clearfix:after, .container:after, +.row:after { + clear: both; +} + +/** + * @section Print + * Styling for printed content. Adapted from HTML5BP. + * @link http://html5boilerplate.com + */ +@media print { + /** + * Universal selector. + * Reset all content to transparent background, black color, and remove box and text shadows. + */ + /* line 13, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + * { + background: transparent !important; + color: #000 !important; + box-shadow: none !important; + text-shadow: none !important; + } + /** + * Specifies page margin + */ + @page { + margin: 0.5cm; + } + /** + * Underline all links + */ + /* line 30, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + a, .link-block-styled, + a:visited, + .link-block-styled:visited { + text-decoration: underline; + } + /** + * Show URL after links + */ + /* line 38, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + a[href]:after, [href].link-block-styled:after { + content: " (" attr(href) ")"; + } + /** + * Don't show URL for internal links + */ + /* line 45, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + a[href^="#"]:after, [href^="#"].link-block-styled:after { + content: ""; + } + /** + * Specifies the minimum number of lines to print at the top and bottom of a page. + */ + /* line 52, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + p, + h1, h2, h3 { + orphans: 3; + widows: 3; + } + /** + * Avoid inserting a page break after headers + */ + /* line 61, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + h1, h2, h3 { + page-break-after: avoid; + } + /** + * Change border color on blockquotes and preformatted text. + * Avoid page breaks inside the content + */ + /* line 69, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + pre, + blockquote { + border-color: #999; + page-break-inside: avoid; + } + /** + * Displayed as a table header row group + */ + /* line 78, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + thead { + display: table-header-group; + } + /** + * Avoid inserting a page break inside table rows and images + */ + /* line 85, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + tr, + img { + page-break-inside: avoid; + } +} diff --git a/docs/assets/js/gumshoe.min.js b/docs/assets/js/gumshoe.min.js new file mode 100755 index 0000000..266bcc3 --- /dev/null +++ b/docs/assets/js/gumshoe.min.js @@ -0,0 +1,2 @@ +/*! gumshoe v3.1.2 | (c) 2016 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/gumshoe */ +!function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.gumshoe=t(e)}("undefined"!=typeof global?global:this.window||this.global,function(e){"use strict";var t,n,o,r,a,c,i={},s="querySelector"in document&&"addEventListener"in e&&"classList"in document.createElement("_"),l=[],u={selector:"[data-gumshoe] a",selectorHeader:"[data-gumshoe-header]",offset:0,activeClass:"active",callback:function(){}},f=function(e,t,n){if("[object Object]"===Object.prototype.toString.call(e))for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(n,e[o],o,e);else for(var r=0,a=e.length;a>r;r++)t.call(n,e[r],r,e)},d=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var r=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&"[object Object]"===Object.prototype.toString.call(n[o])?e[o]=d(!0,e[o],n[o]):e[o]=n[o])};o>n;n++){var a=arguments[n];r(a)}return e},v=function(e){return Math.max(e.scrollHeight,e.offsetHeight,e.clientHeight)},m=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},g=function(e){var n=0;if(e.offsetParent){do n+=e.offsetTop,e=e.offsetParent;while(e)}else n=e.offsetTop;return n=n-a-t.offset,n>=0?n:0},h=function(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},p=function(){l.sort(function(e,t){return e.distance>t.distance?-1:e.distance=o&&h(l[0].target))return H(l[0]),l[0];for(var r=0,a=l.length;a>r;r++){var c=l[r];if(c.distance<=n)return H(c),c}y(),t.callback()};var C=function(){f(l,function(e){e.nav.classList.contains(t.activeClass)&&(c={nav:e.nav,parent:e.parent})})};i.destroy=function(){t&&(e.removeEventListener("resize",L,!1),e.removeEventListener("scroll",L,!1),l=[],t=null,n=null,o=null,r=null,a=null,c=null)};var L=function(e){n||(n=setTimeout(function(){n=null,"scroll"===e.type&&i.getCurrentNav(),"resize"===e.type&&(i.setDistances(),i.getCurrentNav())},66))};return i.init=function(n){s&&(i.destroy(),t=d(u,n||{}),r=document.querySelector(t.selectorHeader),b(),0!==l.length&&(C(),i.setDistances(),i.getCurrentNav(),e.addEventListener("resize",L,!1),e.addEventListener("scroll",L,!1)))},i}); \ No newline at end of file diff --git a/docs/assets/js/highlight-active-nav.js b/docs/assets/js/highlight-active-nav.js new file mode 100755 index 0000000..4aa4981 --- /dev/null +++ b/docs/assets/js/highlight-active-nav.js @@ -0,0 +1,134 @@ +/** + * highlight-active-nav.js + * @description Highlight the active navigation element + * @version 1.0.0 + * @author Chris Ferdinandi + * @license MIT + */ + +(function (root, factory) { + if ( typeof define === 'function' && define.amd ) { + define([], factory(root)); + } else if ( typeof exports === 'object' ) { + module.exports = factory(root); + } else { + root.highlightActiveNav = factory(root); + } +})(typeof global !== 'undefined' ? global : this.window || this.global, function (root) { + + 'use strict'; + + // + // Variables + // + + var highlight = {}; // Object for public APIs + var supports = !!document.querySelector && !!root.addEventListener; // Feature test + var settings; + + // Default settings + var defaults = { + selector: '[data-nav-highlight]', + activeClass: 'nav-active', + urlPrefix: null, + callback: function () {} + }; + + + // + // Methods + // + + /** + * Merge defaults with user options + * @private + * @param {Object} defaults Default settings + * @param {Object} options User options + * @returns {Object} Merged values of defaults and options + */ + var extend = function () { + + // Variables + var extended = {}; + var deep = false; + var i = 0; + var length = arguments.length; + + // Check if a deep merge + if ( Object.prototype.toString.call( arguments[0] ) === '[object Boolean]' ) { + deep = arguments[0]; + i++; + } + + // Merge the object into the extended object + var merge = function (obj) { + for ( var prop in obj ) { + if ( Object.prototype.hasOwnProperty.call( obj, prop ) ) { + // If deep merge and property is an object, merge properties + if ( deep && Object.prototype.toString.call(obj[prop]) === '[object Object]' ) { + extended[prop] = extend( true, extended[prop], obj[prop] ); + } else { + extended[prop] = obj[prop]; + } + } + } + }; + + // Loop through each object and conduct a merge + for ( ; i < length; i++ ) { + var obj = arguments[i]; + merge(obj); + } + + return extended; + + }; + + /** + * Destroy the current initialization. + * @public + */ + highlight.destroy = function () { + if ( !settings ) return; + document.documentElement.classList.remove( settings.initClass ); + settings = null; + container = null; + }; + + /** + * Initialize highlightActiveNav + * @public + * @param {Object} options User settings + */ + highlight.init = function ( options ) { + + // feature test + if ( !supports ) return; + + // Destroy any existing initializations + highlight.destroy(); + + // Merge user options with defaults + settings = extend( defaults, options || {} ); + + // Get the container + var href = settings.urlPrefix ? location.pathname.split( settings.urlPrefix )[1] : location.pathname; + var nav = document.querySelector( settings.selector + ' a[href^="' + href + '"]' ); + if ( !nav ) return; + + // Add class to active nav + nav.className += ' ' + settings.activeClass; + + // Run callback + settings.callback(); + + }; + + + // + // Public APIs + // + + return highlight; + +}); \ No newline at end of file diff --git a/docs/assets/js/prism.js b/docs/assets/js/prism.js new file mode 100755 index 0000000..92b3663 --- /dev/null +++ b/docs/assets/js/prism.js @@ -0,0 +1,21 @@ +/* ============================================================= + + Prism v1.0 + Lightweight, robust, elegant syntax highlighting, by Lea Verou + http://lea.verou.me + + Licensed under MIT License. + http://www.opensource.org/licenses/mit-license.php/ + + * ============================================================= */ + + (function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=t.util.clone(e[i]));return r;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var r=t.util.clone(t.languages[e]);for(var i in n)r[i]=n[i];return r},insertBefore:function(e,n,r,i){i=i||t.languages;var s=i[e],o={};for(var u in s)if(s.hasOwnProperty(u)){if(u==n)for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);o[u]=s[u]}return i[e]=o},DFS:function(e,n){for(var r in e){n.call(e,r,e[r]);t.util.type(e)==="Object"&&t.languages.DFS(e[r],n)}}},highlightAll:function(e,n){var r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');for(var i=0,s;s=r[i++];)t.highlightElement(s,e===!0,n)},highlightElement:function(r,i,s){var o,u,a=r;while(a&&!e.test(a.className))a=a.parentNode;if(a){o=(a.className.match(e)||[,""])[1];u=t.languages[o]}if(!u)return;r.className=r.className.replace(e,"").replace(/\s+/g," ")+" language-"+o;a=r.parentNode;/pre/i.test(a.nodeName)&&(a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+o);var f=r.textContent;if(!f)return;f=f.replace(/&/g,"&").replace(/e.length)break e;if(p instanceof i)continue;a.lastIndex=0;var d=a.exec(p);if(d){l&&(c=d[1].length);var v=d.index-1+c,d=d[0].slice(c),m=d.length,g=v+m,y=p.slice(0,v+1),b=p.slice(g+1),w=[h,1];y&&w.push(y);var E=new i(u,f?t.tokenize(d,f):d);w.push(E);b&&w.push(b);Array.prototype.splice.apply(s,w)}}}return s},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t){this.type=e;this.content=t};n.stringify=function(e,r,i){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]")return e.map(function(t){return n.stringify(t,r,e)}).join("");var s={type:e.type,content:n.stringify(e.content,r,i),tag:"span",classes:["token",e.type],attributes:{},language:r,parent:i};s.type=="comment"&&(s.attributes.spellcheck="true");t.hooks.run("wrap",s);var o="";for(var u in s.attributes)o+=u+'="'+(s.attributes[u]||"")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'" '+o+">"+s.content+""};if(!self.document){self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.tokenize(i,t.languages[r])));self.close()},!1);return}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}})();; + Prism.languages.markup={comment:/<!--[\w\W]*?-->/g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))});; + Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/ig,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,ignore:/&(lt|gt|amp);/gi,punctuation:/[\{\};:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<|<)style[\w\W]*?(>|>)[\w\W]*?(<|<)\/style(>|>)/ig,inside:{tag:{pattern:/(<|<)style[\w\W]*?(>|>)|(<|<)\/style(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});; + Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/ig,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/ig,inside:{punctuation:/\(/}}, number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|(&){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g}; + ; + Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|throw|catch|finally|null|break|continue)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}});Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<|<)script[\w\W]*?(>|>)[\w\W]*?(<|<)\/script(>|>)/ig,inside:{tag:{pattern:/(<|<)script[\w\W]*?(>|>)|(<|<)\/script(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}}); + ; + Prism.languages.php=Prism.languages.extend("clike",{keyword:/\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|extends|private|protected|parent|static|throw|null|echo|print|trait|namespace|use|final|yield|goto|instanceof|finally|try|catch)\b/ig, constant:/\b[A-Z0-9_]{2,}\b/g});Prism.languages.insertBefore("php","keyword",{delimiter:/(\?>|<\?php|<\?)/ig,variable:/(\$\w+)\b/ig,"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/g,lookbehind:!0,inside:{punctuation:/\\/}}});Prism.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/g,lookbehind:!0}}); Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(a){"php"===a.language&&(a.tokenStack=[],a.code=a.code.replace(/(?:<\?php|<\?|<\?php|<\?)[\w\W]*?(?:\?>|\?>)/ig,function(b){a.tokenStack.push(b);return"{{{PHP"+a.tokenStack.length+"}}}"}))}),Prism.hooks.add("after-highlight",function(a){if("php"===a.language){for(var b=0,c;c=a.tokenStack[b];b++)a.highlightedCode=a.highlightedCode.replace("{{{PHP"+(b+1)+"}}}",Prism.highlight(c,a.grammar,"php"));a.element.innerHTML=a.highlightedCode}}), Prism.hooks.add("wrap",function(a){"php"===a.language&&"markup"===a.type&&(a.content=a.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g,'$1'))}),Prism.languages.insertBefore("php","comment",{markup:{pattern:/(<|<)[^?]\/?(.*?)(>|>)/g,inside:Prism.languages.markup},php:/\{\{\{PHP[0-9]+\}\}\}/g}));; + Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,lookbehind:!0},atrule:/@[\w-]+(?=\s+(\(|\{|;))/gi,url:/([-a-z]+-)*url(http://github.com/?=\()/gi,selector:/([^@;\{\}\(\)]?([^@;\{\}\(\)]|&|\#\{\$[-_\w]+\})+)(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/gm});Prism.languages.insertBefore("scss","atrule",{keyword:/@(if|else if|else|for|each|while|import|extend|debug|warn|mixin|include|function|return)|(?=@for\s+\$[-_\w]+\s)+from/i});Prism.languages.insertBefore("scss","property",{variable:/((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i});Prism.languages.insertBefore("scss","ignore",{placeholder:/%[-_\w]+/i,statement:/\B!(default|optional)\b/gi,"boolean":/\b(true|false)\b/g,"null":/\b(null)\b/g,operator:/\s+([-+]{1,2}|={1,2}|!=|\|?\||\?|\*|\/|\%)\s+/g}); + ; \ No newline at end of file diff --git a/docs/assets/js/toc.js b/docs/assets/js/toc.js new file mode 100755 index 0000000..6b03942 --- /dev/null +++ b/docs/assets/js/toc.js @@ -0,0 +1,191 @@ +/** + * tableOfContents.js + * @description Dynamically create a table of contents + * @version 1.0.0 + * @author Chris Ferdinandi + * @license MIT + */ + +(function (root, factory) { + if ( typeof define === 'function' && define.amd ) { + define([], factory(root)); + } else if ( typeof exports === 'object' ) { + module.exports = factory(root); + } else { + root.tableOfContents = factory(root); + } +})(typeof global !== 'undefined' ? global : this.window || this.global, function (root) { + + 'use strict'; + + // + // Variables + // + + var toc = {}; // Object for public APIs + var supports = !!document.querySelector && !!root.addEventListener; // Feature test + var settings, container; + + // Default settings + var defaults = { + container: '[data-toc]', + selectors: '[data-toc-content] h2', + heading: 'Contents', + headingType: 'h2', + headingClass: '', + navClass: '', + linkClass: '', + initClass: 'js-table-of-contents', + callback: function () {} + }; + + + // + // Methods + // + + /** + * A simple forEach() implementation for Arrays, Objects and NodeLists + * @private + * @param {Array|Object|NodeList} collection Collection of items to iterate + * @param {Function} callback Callback function for each iteration + * @param {Array|Object|NodeList} scope Object/NodeList/Array that forEach is iterating over (aka `this`) + */ + var forEach = function (collection, callback, scope) { + if (Object.prototype.toString.call(collection) === '[object Object]') { + for (var prop in collection) { + if (Object.prototype.hasOwnProperty.call(collection, prop)) { + callback.call(scope, collection[prop], prop, collection); + } + } + } else { + for (var i = 0, len = collection.length; i < len; i++) { + callback.call(scope, collection[i], i, collection); + } + } + }; + + /** + * Merge defaults with user options + * @private + * @param {Object} defaults Default settings + * @param {Object} options User options + * @returns {Object} Merged values of defaults and options + */ + var extend = function () { + + // Variables + var extended = {}; + var deep = false; + var i = 0; + var length = arguments.length; + + // Check if a deep merge + if ( Object.prototype.toString.call( arguments[0] ) === '[object Boolean]' ) { + deep = arguments[0]; + i++; + } + + // Merge the object into the extended object + var merge = function (obj) { + for ( var prop in obj ) { + if ( Object.prototype.hasOwnProperty.call( obj, prop ) ) { + // If deep merge and property is an object, merge properties + if ( deep && Object.prototype.toString.call(obj[prop]) === '[object Object]' ) { + extended[prop] = extend( true, extended[prop], obj[prop] ); + } else { + extended[prop] = obj[prop]; + } + } + } + }; + + // Loop through each object and conduct a merge + for ( ; i < length; i++ ) { + var obj = arguments[i]; + merge(obj); + } + + return extended; + + }; + + /** + * Render the Table of Contents + */ + toc.render = function () { + + // Variables + var sections = document.querySelectorAll( settings.selectors ); + var toc = ''; + + if ( sections.length === 0 ) return; + + // Loop through each section and create a link to it + forEach(sections, function (section) { + + // Ignore sections without an id + var id = section.id; + if ( !id ) return; + + // Create section navigation + toc += '
  • ' + section.innerHTML + '
  • '; + + }); + + // Inject table of contents into the DOM + container.innerHTML = '<' + settings.headingType + '>' + settings.heading + '
      ' + toc + '
    '; + + // Run callback + settings.callback(); + + }; + + /** + * Destroy the current initialization. + * @public + */ + toc.destroy = function () { + if ( !settings ) return; + document.documentElement.classList.remove( settings.initClass ); + container.innerHTML = ''; + settings = null; + container = null; + }; + + /** + * Initialize tableOfContents + * @public + * @param {Object} options User settings + */ + toc.init = function ( options ) { + + // feature test + if ( !supports ) return; + + // Destroy any existing initializations + toc.destroy(); + + // Merge user options with defaults + settings = extend( defaults, options || {} ); + + // Get the container + container = document.querySelector( settings.container ); + if ( !container ) return; + + // Add class to HTML element to activate conditional CSS + document.documentElement.classList.add( settings.initClass ); + + // Render the table of contents + toc.render(); + + }; + + + // + // Public APIs + // + + return toc; + +}); \ No newline at end of file diff --git a/docs/browsers.html b/docs/browsers.html new file mode 100755 index 0000000..cbcf76e --- /dev/null +++ b/docs/browsers.html @@ -0,0 +1,104 @@ + + + + + + Smooth Scroll + + + + + + + + + + + + + +
    +
    + + + +

    Browser Compatibility

    +

    Smooth Scroll works in all modern browsers, and IE 9 and above.

    +

    Smooth Scroll is built with modern JavaScript APIs, and uses progressive enhancement. If the JavaScript file fails to load, or if your site is viewed on older and less capable browsers, anchor links will jump the way they normally would.

    +
    + + +

    Known Issues

    +

    <body> styling

    +

    If the <body> element has been assigned a height of 100% or overflow: hidden, Smooth Scroll is unable to properly calculate page distances and will not scroll to the right location. The <body> element can have a fixed, non-percentage based height (ex. 500px), or a height of auto, and an overflow of visible.

    +

    Animating from the bottom

    +

    Animated scrolling links at the very bottom of the page (example: a "scroll to top" link) will stop animated almost immediately after they start when using certain easing patterns. This is an issue that's been around for a while and I've yet to find a good fix for it. I've found that easeOut* easing patterns work as expected, but other patterns can cause issues. See this discussion for more details.

    + + + +
    +
    +
    + + + + + + + + + + + \ No newline at end of file diff --git a/docs/dist/js/smooth-scroll.js b/docs/dist/js/smooth-scroll.js index 3439579..bf4e1a8 100755 --- a/docs/dist/js/smooth-scroll.js +++ b/docs/dist/js/smooth-scroll.js @@ -1,7 +1,7 @@ /*! - * smooth-scroll v10.3.1: Animate scrolling to anchor links + * smooth-scroll v11.0.0: Animate scrolling to anchor links * (c) 2017 Chris Ferdinandi - * MIT License + * GPL-3.0 License * http://github.com/cferdinandi/smooth-scroll */ @@ -27,12 +27,19 @@ // Default settings var defaults = { + // Selectors selector: '[data-scroll]', selectorHeader: null, + + // Speed & Easing speed: 500, - easing: 'easeInOutCubic', offset: 0, - callback: function () {} + easing: 'easeInOutCubic', + easingPatterns: {}, + + // Callback API + before: function () {}, + after: function () {} }; @@ -219,6 +226,8 @@ */ var easingPattern = function ( type, time ) { var pattern; + + // Default Easing Patterns if ( type === 'easeInQuad' ) pattern = time * time; // accelerating from zero velocity if ( type === 'easeOutQuad' ) pattern = time * (2 - time); // decelerating to zero velocity if ( type === 'easeInOutQuad' ) pattern = time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration @@ -231,6 +240,14 @@ if ( type === 'easeInQuint' ) pattern = time * time * time * time * time; // accelerating from zero velocity if ( type === 'easeOutQuint' ) pattern = 1 + (--time) * time * time * time * time; // decelerating to zero velocity if ( type === 'easeInOutQuint' ) pattern = time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration + + // Custom Easing Patterns + if ( settings.easingPatterns[type] ) { + pattern = settings.easingPatterns[type]( time ); + } + + console.log(pattern || time); + return pattern || time; // no easing, no acceleration }; @@ -366,7 +383,7 @@ adjustFocus( anchor, endLocation, isNum ); // Run callback after animation complete - animateSettings.callback( anchor, toggle ); + animateSettings.after( anchor, toggle ); } }; @@ -401,6 +418,9 @@ root.scrollTo( 0, 0 ); } + // Run callback before animation starts + animateSettings.before( anchor, toggle ); + // Start scrolling animation startAnimateScroll(); diff --git a/docs/dist/js/smooth-scroll.min.js b/docs/dist/js/smooth-scroll.min.js index a01d8a3..5161d16 100755 --- a/docs/dist/js/smooth-scroll.min.js +++ b/docs/dist/js/smooth-scroll.min.js @@ -1,2 +1,2 @@ -/*! smooth-scroll v10.3.1 | (c) 2017 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ -!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,l,i={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(;n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},g=function(e,t,n){var o=0;if(e.offsetParent)do{o+=e.offsetTop,e=e.offsetParent}while(e);return o=Math.max(o-t-n,0),Math.min(o,y()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},y=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},v=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};i.animateScroll=function(n,o,c){var i=v(o?o.getAttribute("data-options"):null),u=f(t||s,c||{},i),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=d?n:g(h,a,parseInt("function"==typeof u.offset?u.offset():u.offset,10)),H=I-m,A=y(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,d),u.callback(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,l)};0===e.pageYOffset&&e.scrollTo(0,0),(function(){clearInterval(l),l=setInterval(M,16)})()}};var E=function(t){try{m(decodeURIComponent(e.location.hash))}catch(t){m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),i.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector))&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href)){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return i.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,l=null)},i.init=function(n){u&&(i.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},i})); \ No newline at end of file +/*! smooth-scroll v11.0.0 | (c) 2017 Chris Ferdinandi | GPL-3.0 License | http://github.com/cferdinandi/smooth-scroll */ +!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,i,l={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,offset:0,easing:"easeInOutCubic",easingPatterns:{},before:function(){},after:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(;n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?a+="\\"+t.toString(16)+" ":a+=t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,n){var o;return"easeInQuad"===e&&(o=n*n),"easeOutQuad"===e&&(o=n*(2-n)),"easeInOutQuad"===e&&(o=n<.5?2*n*n:(4-2*n)*n-1),"easeInCubic"===e&&(o=n*n*n),"easeOutCubic"===e&&(o=--n*n*n+1),"easeInOutCubic"===e&&(o=n<.5?4*n*n*n:(n-1)*(2*n-2)*(2*n-2)+1),"easeInQuart"===e&&(o=n*n*n*n),"easeOutQuart"===e&&(o=1- --n*n*n*n),"easeInOutQuart"===e&&(o=n<.5?8*n*n*n*n:1-8*--n*n*n*n),"easeInQuint"===e&&(o=n*n*n*n*n),"easeOutQuint"===e&&(o=1+--n*n*n*n*n),"easeInOutQuint"===e&&(o=n<.5?16*n*n*n*n*n:1+16*--n*n*n*n*n),t.easingPatterns[e]&&(o=t.easingPatterns[e](n)),console.log(o||n),o||n},g=function(e,t,n){var o=0;if(e.offsetParent)do{o+=e.offsetTop,e=e.offsetParent}while(e);return o=Math.max(o-t-n,0),Math.min(o,y()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},y=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},v=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};l.animateScroll=function(n,o,c){var l=v(o?o.getAttribute("data-options"):null),u=f(t||s,c||{},l),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=d?n:g(h,a,parseInt("function"==typeof u.offset?u.offset():u.offset,10)),H=I-m,A=y(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,d),u.after(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,i)};0===e.pageYOffset&&e.scrollTo(0,0),u.before(n,o),(function(){clearInterval(i),i=setInterval(M,16)})()}};var E=function(t){try{m(decodeURIComponent(e.location.hash))}catch(t){m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),l.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector))&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href)){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return l.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,i=null)},l.init=function(n){u&&(l.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},l})); \ No newline at end of file diff --git a/docs/index.html b/docs/index.html old mode 100644 new mode 100755 index e61cf7c..ad16d5f --- a/docs/index.html +++ b/docs/index.html @@ -5,29 +5,59 @@ Smooth Scroll + - + + -
    - - - -
    + + + +
    +
    + + + +

    Smooth Scroll

    +

    Smooth Scroll is a lightweight script to animate scrolling to anchor links. It works great with Gumshoe.

    +
    + +

    Demo

    Linear
    Linear (no other options)
    @@ -84,16 +114,41 @@

    Smooth Scroll

    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .

    -

    Back to the top

    -
    -
    +

    Back to the top

    + + +
    + + + + + + - \ No newline at end of file diff --git a/docs/license.html b/docs/license.html new file mode 100755 index 0000000..6fb2b00 --- /dev/null +++ b/docs/license.html @@ -0,0 +1,212 @@ + + + + + + Smooth Scroll + + + + + + + + + + + + + +
    +
    + + + +

    License

    +

    Smooth Scroll has three types of licenses:

    +
      +
    1. Open Source, for personal and open source projects.
    2. +
    3. Commercial, for commercial projects and applications.
    4. +
    5. OEM, for when this Smooth Scroll will be bundled with a commercial interface builder, SDK, or toolkit.
    6. +
    +
    + + +

    Open Source License

    +

    If you're looking to use Smooth Scroll on an open source or personal project, the code is available under the GPLv3 License. GPLv3 has many terms, but the most important one is that it requires you to license you entire project under the terms of GPLv3 as well:

    +
    +

    You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged.

    +
    +

    You can absolutely use the open source license for commercial projects, but those projects must also be open sourced in their entirety with a GPLv3 license.

    +
    + + +

    Commercial License

    +

    The Commercial License let's you use Smooth Scroll in commercial projects and applications without the provisions of GPLv3. With this license, your code is kept proprietary.

    +
      +
    • You can use Smooth Scroll on as many websites or applications as you'd like.
    • +
    • You can include it in your own commercial products and applications, such as premium CMS themes, plugins, or templates.
    • +
    • Customers and users of your products do not need to purchase their own license, as long as they're not developing their own commercial products with Smooth Scroll.
    • +
    +

    Buy a Commercial License

    +

    Commercial Licenses are priced based on the number of developers working on a project that uses Smooth Scroll. Pay by credit card and instantly receive a PDF of your Commercial License.

    + + + + + + + + + + + + + + + + + + + + + +
    DescriptionPrice
    A Single Developer License can be used by 1 developer. Each individual developer needs to purchase a separate license.Buy a Single Developer License now for $99
    A Team License can be used by up to 8 developers.Buy a Team License now for $399
    An Organization License can be used by an unlimited number of developers.Buy an Organization License now for $999
    + +

    You can read the full text of the Commercial License below. Email me at chris@gomakethings.com with any questions you have about licensing.

    +

    The Commercial License Agreement

    +

    This Software License Agreement (the “Agreement”) is between Go Make Things, LLC (“Go Make Things”) and You (including your agents and affiliates), a commercial licensee of Go Make Things's software. If you have not purchased a Smooth Scroll Commercial License from Go Make Things, these terms do not apply to you, and your use of the Go Make Things software is instead governed by the GNU General Public License, version 3.

    +

    1. Definitions

    +
      +
    • “Application” means any software, application, or elements that Your Licensed Developers develop using the Software or Modifications in accordance with this Agreement.
    • +
    • “End User” means an end user of Your Application who acquires a license to such solely for their own use and not for distribution, resale, user interface design, or software development purposes.
    • +
    • “Licensed Developer” shall mean an individual person permitted to use the Software and make Modifications for your Applications, whether such person is Your employee or a consultant or contractor providing services to You.
    • +
    • “Modification” means any revision, adaptation, or derivative of the Software produced by You.
    • +
    • The “Software” means Smooth Scroll version 11.
    • +
    +

    2. Commercial license grant

    +

    Subject to the terms of this Agreement, Go Make Things grants to You a revocable, non-exclusive, non-transferable license:

    +
      +
    • for [n licensed developers—varies based on the license your purchase] to use the Software to create Modifications and Applications;
    • +
    • for You to distribute the Software and/or Modifications to an unlimited number of End Users solely as integrated into the Applications;
    • +
    • and for End Users to use the Software as incorporated into Your Applications in accordance with the terms of this Agreement.
    • +
    +

    You are entitled to receive all updates to the major version of the Software licensed by you, as well as any later version of the Software that Go Make Things, in writing, explicitly authorizes you to use. (For illustration purposes only, if you purchased a license for version 2.0, this licenses authorizes you to use version 2.9, but not 3.0.) Go Make Things makes no representation that any update will be compatible with your Application.

    +

    3. Ownership

    +

    This is a license agreement and not an agreement for sale. Go Make Things reserves ownership of all intellectual property rights inherent in or relating to the Software and corresponding source code, which include all copyright, patent rights, all rights in relation to registered and unregistered trademarks (including service marks), confidential information (including trade secrets and know-how) and all rights other than those expressly granted by this Agreement.

    +

    You must not remove, obscure or interfere with any copyright, acknowledgment, attribution, trademark, warning or disclaimer statement affixed to, incorporated in or otherwise applied in connection with the Software. Notwithstanding the above, you are permitted to produce, use, and distribute compressed or “minified” copies of the Software that do not bear the notices contained in the Software’s source code, so long as you otherwise comply with the terms of this license.

    +

    4. Prohibited Uses

    +

    Your Application must have substantially different functionality than, and must not compete directly with, the Software.

    +

    You may not distribute the Software or Modifications except as included within Your Application.

    +

    If You produce an Application for a customer, You are responsible for ensuring that your customer does not make use of the Software except with Applications licensed herein.

    +

    Your Application must not enable End Users to produce separate applications that incorporate the Software or Modifications. For example, if Your Application is a development toolkit or library, an application builder, a website builder that can be used to incorporate the Software into a new Application, You must obtain a separate OEM license from Go Make Things.

    +

    5. Termination

    +

    This Agreement and the license granted hereunder shall continue until terminated in accordance with this Section. Unless otherwise specified in this Agreement, the license shall last as long as Your use of the Software is in compliance with the terms herein.

    +

    Go Make Things shall have the right to terminate this Agreement and the license granted hereunder immediately if You breach any of the material terms of this Agreement. Upon termination of this Agreement, all licenses granted to You in this Agreement shall terminate automatically and You shall immediately cease use and distribution of the Software.

    +

    Upon termination of this Agreement, You must cease all use of the Software. If, prior to your breach of this Agreement, you delivered Applications incorporating the Software to Your End Users, those End Users’ licenses shall survive termination.

    +

    6. Disclaimer of Warranties

    +

    TO THE EXTENT PERMITTED BY LAW, GO MAKE THINGS DISCLAIMS ALL WARRANTIES AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE. WE DO NOT GUARANTEE THAT THE OPERATION OF THE SOFTWARE OR YOUR APPLICATION WILL BE UNINTERRUPTED OR ERROR-FREE, AND YOU ACKNOWLEDGE THAT IT IS NOT TECHNICALLY PRACTICABLE FOR US TO DO SO.

    +

    7. Limitation of Liabilities

    +

    TO THE EXTENT PERMITTED BY LAW, IN NO EVENT SHALL GO MAKE THINGS BE LIABLE UNDER ANY LEGAL OR EQUITABLE THEORY FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LAW) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE OR THE CODE IT PRODUCES OR ANY OTHER SUBJECT MATTER RELATING TO THIS AGREEMENT, EVEN IF GO MAKE THINGS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY CASE, GO MAKE THINGS’S ENTIRE LIABILITY WITH RESPECT TO ANY SUBJECT MATTER RELATING TO THIS AGREEMENT SHALL BE LIMITED TO THE GREATER OF: (I) THE AMOUNT ACTUALLY PAID BY YOU FOR THE LICENSE, OR (II) FIVE HUNDRED DOLLARS ($500).

    +

    8. Indemnification

    +

    While redistributing the Software or Modifications thereof as part of Your Application, You may choose to offer acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this Agreement. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, and not on Go Make Things’s behalf.

    +

    You agree to indemnify, hold harmless, and defend Go Make Things and its owners, officers, agents, and affiliates from and against any and all claims, lawsuits and proceedings (collectively “Claims”), and all expenses, costs (including attorney's fees), judgments, damages and other liabilities resulting from such Claims, that arise or result from:

    +
      +
    • your use of the Software in violation of this Agreement;
    • +
    • the use or distribution of Your Application, except to the extent such claim is based solely on the inclusion of the Software therein;
    • +
    • your Modification of the Software’s source code; or
    • +
    • your accepting support, warranty, indemnity, or additional liability as described in the preceding paragraph.
    • +
    +

    9. Payment and Taxes

    +

    All payments under this Agreement are due to Go Make Things upon Your purchase of a license to the Software.

    +

    Each party shall be responsible for all taxes (including, but not limited to, taxes based upon its income) or levies imposed on it under applicable laws, regulations and tax treaties as a result of this Agreement and any payments made hereunder (including those required to be withheld or deducted from payments); provided that You shall be responsible for any value added tax, use tax, sales tax, or similar tax, and shall pay or reimburse Go Make Things for the same upon invoice. Each party shall furnish evidence of such paid taxes as is sufficient to enable the other party to obtain any credits available to it, including original tax withholding certificates.

    +

    10. Miscellaneous

    +

    Software Updates and Upgrades. The license granted herein applies only to the version of the Software available when purchased in connection with the terms of this Agreement, and to any updates and/or upgrades to which You may be entitled. Any previous or subsequent license granted to You for use of the Software shall be governed by the terms and conditions of the agreement entered in connection with purchase or download of that version of the Software.

    +

    Survival. The provisions of sections 4 through 10 will survive termination of this Agreement.

    +

    Compliance with Applicable Laws. You agree that You will comply with all applicable laws and regulations with respect to the Software, including without limitation all export control laws and regulations.

    +

    Marketing. You agree to Go Make Things’s use of Your name, trade name, and trademark, for use in Go Make Things’s marketing materials and its website, solely to identify you as a customer of Go Make Things.

    +

    Assignment. This Agreement may be assigned by Go Make Things in whole or in part and will inure to the benefit of Go Make Things’s successors and assigns. You may not assign or transfer this Agreement without Go Make Things’s prior written consent. Notwithstanding the foregoing, however, if You transfer ownership of an Application to a customer for which it was developed, You may assign this Agreement to that customer (the “Assignee”) provided:

    +
      +
    1. You provide written notice to Go Make Things prior to the effective date of such assignment; and
    2. +
    3. there is a written agreement, wherein the Assignee accepts the terms of this Agreement.
    4. +
    +

    Entire Agreement. The terms and conditions stated herein set forth the entire agreement of the parties and replace and supersede all other contracts, agreements, and understandings, written or oral, relating to the subject matter hereof.

    +

    Severability. In the event that any portion of this Agreement is held to be unenforceable, such portions shall not limit or otherwise modify or affect any other portion of this Agreement.

    +

    Modification; Waiver. This Agreement cannot be amended except by a written instrument executed by Go Make Things.

Go Make Things reserves the right, at any time and from time to time, to update, revise, supplement, and otherwise modify this Agreement and to impose new or additional rules, policies, terms, or conditions on your use of the Software. Such updates, revisions, supplements, modifications, and additional rules, policies, terms, and conditions (collectively referred to in this Agreement as “Additional Terms”) will be effective immediately and incorporated into this Agreement. You will be notified of any Additional Terms in writing. Your continued use of the Software following will be deemed to constitute your acceptance of any and all such Additional Terms. All Additional Terms are hereby incorporated into this Agreement by this reference.

 The failure of Go Make Things to enforce any provision of this Agreement may not be deemed a waiver of that or any other provision of this Agreement.

    +

    Governing Law. This Agreement is subject to, and shall be interpreted and enforced in accordance with, the laws of the Commonwealth of Massachusetts in all respects without regard to conflict of law principles. The Courts of Bristol County, Massachusetts and Norfolk County, Massachusetts shall be the sole and exclusive Courts in which either party may attempt to enforce or establish the existence or scope of any rights, benefits or obligations under this Agreement. The UN Convention on Contracts for the International Sale of Goods is expressly excluded.

    +

    Government Use. If the Software or any related documentation is licensed to the U.S. Government or any agency thereof, it will be considered to be “commercial computer software” or “commercial computer software documentation,” as those terms are used in 48 CFR § 12.212 or 48 CFR § 227.7202, and is being licensed with only those rights as are granted to all other licensees as set forth in this Agreement.

    +
    + + +

    OEM License

    +

    If you'll be including Smooth Scroll in a project that can be used to build new products, websites, or applications—such as a commercial interface builder, SDK, or toolkit—you need to purchase an OEM License.

    +

    The OEM License is customized for you. Please content me chris@gomakethings.com to discuss your project.

    + + + +
    +
    +
    + + + + + + + + + + + \ No newline at end of file diff --git a/docs/options.html b/docs/options.html new file mode 100755 index 0000000..bebdc72 --- /dev/null +++ b/docs/options.html @@ -0,0 +1,241 @@ + + + + + + Smooth Scroll + + + + + + + + + + + + + +
    +
    + + + +

    Options and Settings

    +

    Smooth Scroll includes smart defaults and works right out of the box. But if you want to customize things, it also has a robust API that provides multiple ways for you to adjust the default options and settings.

    +
    + +

    Global Settings

    +

    You can pass options and callbacks into Smooth Scroll through the init() function:

    +
    smoothScroll.init({
    +    // Selectors
    +    selector: '[data-scroll]', // Selector for links (must be a valid CSS selector)
    +    selectorHeader: null, // Selector for fixed headers (must be a valid CSS selector) [optional]
    +
    +    // Speed & Easing
    +    speed: 500, // Integer. How fast to complete the scroll in milliseconds
    +    offset: 0, // Integer or Function returning an integer. How far to offset the scrolling anchor location in pixels
    +    easing: 'easeInOutCubic', // Easing pattern to use
    +
    +    // Custom easing patterns.
    +    // Must be an object with the easing name as the key
    +    // Each pattern must be a function, with `time` as the argument, that returns the pattern
    +    easingPatterns: {
    +        myCustomEasingPattern: function (time) {
    +            return time * (2 - time);
    +        }
    +    }
    +
    +    // Callback API
    +    before: function (anchor, toggle) {}, // Function to run before scrolling starts
    +    after: function (anchor, toggle) {} // Function to run after scrolling completes
    +});
    +
    +

    Note: To programatically add Smooth Scroll to all anchor links on a page, pass selector: 'a[href*="#"]' into init.

    +

    Easing Options

    +

    Linear +Moves at the same speed from start to finish.

    +
      +
    • Linear
    • +
    +

    Ease-In +Gradually increases in speed.

    +
      +
    • easeInQuad
    • +
    • easeInCubic
    • +
    • easeInQuart
    • +
    • easeInQuint
    • +
    +

    Ease-In-Out +Gradually increases in speed, peaks, and then gradually slows down.

    +
      +
    • easeInOutQuad
    • +
    • easeInOutCubic
    • +
    • easeInOutQuart
    • +
    • easeInOutQuint
    • +
    +

    Ease-Out +Gradually decreases in speed.

    +
      +
    • easeOutQuad
    • +
    • easeOutCubic
    • +
    • easeOutQuart
    • +
    • easeOutQuint
    • +
    +

    Learn more about the different easing patterns and what they do at easings.net.

    +
    + + +

    Override settings with data attributes

    +

    Smooth Scroll also lets you override global settings on a link-by-link basis using the [data-options] data attribute.

    +
    <a data-scroll
    +   data-options='{
    +                    "speed": 500,
    +                    "easing": "easeInOutCubic",
    +                    "offset": 0
    +                }'
    +>
    +    Anchor Link
    +</a>
    +
    +

    Note: You must use valid JSON in order for the data-options feature to work. Does not support the callback method.

    +
    + + +

    Use Smooth Scroll events in your own scripts

    +

    You can also call Smooth Scroll's scroll animation events in your own scripts.

    +

    animateScroll()

    +

    Animate scrolling to an anchor.

    +
    smoothScroll.animateScroll(
    +    anchor, // Node to scroll to. ex. document.querySelector( '#bazinga' )
    +    toggle, // Node that toggles the animation, OR an integer. ex. document.querySelector( '#toggle' )
    +    options // Classes and callbacks. Same options as those passed into the init() function.
    +);
    +
    +

    Example 1

    +
    var anchor = document.querySelector( '#bazinga' );
    +smoothScroll.animateScroll( anchor );
    +
    +

    Example 2

    +
    var anchor = document.querySelector( '#bazinga' );
    +var toggle = document.querySelector('#toggle');
    +var options = { speed: 1000, easing: 'easeOutCubic' };
    +smoothScroll.animateScroll( anchor, toggle, options );
    +
    +

    Example 3

    +
    // You can optionally pass in a y-position to scroll to as an integer
    +smoothScroll.animateScroll( 750 );
    +
    +

    destroy()

    +

    Destroy the current smoothScroll.init(). This is called automatically during the init function to remove any existing initializations.

    +
    smoothScroll.destroy();
    +
    +
    + + +

    Fixed Headers

    +

    If you're using a fixed header, Smooth Scroll will automatically offset scroll distances by the header height. Pass in a valid CSS selector for your fixed header as an option to the init.

    +

    If you have multiple fixed headers, pass in the last one in the markup.

    +
    <nav data-scroll-header>
    +    ...
    +</nav>
    +...
    +<script>
    +    smoothScroll.init({
    +        selectorHeader: '[data-scroll-header]'
    +    });
    +</script>
    +
    +
    + + + +

    This is an often requested feature, but Smooth Scroll does not include an option to animate scrolling to links on other pages.

    +

    You can attempt to implement it using the API, but it's very difficult to prevent the automatic browser jump when the page loads, and anything I've done to work around it results in weird, janky issues, so I've decided to leave this out of the core. Here's a potential workaround...

    +
      +
    1. Do not add the data-scroll attribute to links to other pages. Treat them like normal links, and include your anchor link hash as normal.

      +
       <a href="some-page.html#example">
      +
      +
    2. +
    3. Add the following script to the footer of your page, after the smoothScroll.init() function.

      +
       <script>
      +     if ( window.location.hash ) {
      +         var anchor = document.querySelector( window.location.hash ); // Get the anchor
      +         var toggle = document.querySelector( 'a[href*="' + window.location.hash + '"]' ); // Get the toggle (if one exists)
      +         var options = {}; // Any custom options you want to use would go here
      +         smoothScroll.animateScroll( anchor, toggle, options );
      +     }
      + </script>
      +
      +
    4. +
    + + + +
    +
    +
    + + + + + + + + + + + \ No newline at end of file diff --git a/docs/setup.html b/docs/setup.html new file mode 100755 index 0000000..52a7217 --- /dev/null +++ b/docs/setup.html @@ -0,0 +1,110 @@ + + + + + + Smooth Scroll + + + + + + + + + + + + + +
    +
    + + + +

    Getting Started

    +

    Compiled and production-ready code can be found in the dist directory. The src directory contains development code.

    +

    1. Include Smooth Scroll on your site.

    +
    <script src="dist/js/smooth-scroll.js"></script>
    +
    +

    2. Add the markup to your HTML.

    +

    Turn anchor links into Smooth Scroll links by adding the [data-scroll] data attribute. Give the anchor location an ID just like you normally would.

    +
    <a data-scroll href="#bazinga">Anchor Link</a>
    +...
    +<span id="bazinga">Bazinga!</span>
    +
    +

    3. Initialize Smooth Scroll.

    +

    In the footer of your page, after the content, initialize Smooth Scroll. And that's it, you're done. Nice work!

    +
    <script>
    +    smoothScroll.init();
    +</script>
    +
    + + + +
    +
    +
    + + + + + + + + + + + \ No newline at end of file diff --git a/docs/source.html b/docs/source.html new file mode 100644 index 0000000..16ce46f --- /dev/null +++ b/docs/source.html @@ -0,0 +1,112 @@ + + + + + + Smooth Scroll + + + + + + + + + + + + + +
    +
    + + + +

    Working with the Source Files

    +

    If you would prefer, you can work with the development code in the src directory using the included Gulp build system. This compiles, lints, and minifies code.

    +

    Dependencies

    +

    Make sure these are installed first.

    + +

    Quick Start

    +
      +
    1. In bash/terminal/command line, cd into your project directory.
    2. +
    3. Run npm install to install required files.
    4. +
    5. When it's done installing, run one of the task runners to get going:
        +
      • gulp manually compiles files.
      • +
      • gulp watch automatically compiles files when changes are made and applies changes using LiveReload.
      • +
      +
    6. +
    +

    Compiled and production-ready code can be found in the dist directory. The src directory contains development code.

    + + + +
    +
    +
    + + + + + + + + + + + \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 63be8c9..ffadced 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -58,14 +58,14 @@ var banner = { '/*!\n' + ' * <%= package.name %> v<%= package.version %>: <%= package.description %>\n' + ' * (c) ' + new Date().getFullYear() + ' <%= package.author.name %>\n' + - ' * MIT License\n' + + ' * <%= package.license %> License\n' + ' * <%= package.repository.url %>\n' + ' */\n\n', min : '/*!' + ' <%= package.name %> v<%= package.version %>' + ' | (c) ' + new Date().getFullYear() + ' <%= package.author.name %>' + - ' | MIT License' + + ' | <%= package.license %> License' + ' | <%= package.repository.url %>' + ' */\n' }; diff --git a/package.json b/package.json index eca9e45..2671b64 100755 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "smooth-scroll", - "version": "10.3.1", + "version": "11.0.0", "description": "Animate scrolling to anchor links", "main": "./dist/js/smooth-scroll.min.js", "author": { "name": "Chris Ferdinandi", "url": "http://gomakethings.com/" }, - "license": "MIT", + "license": "GPL-3.0", "repository": { "type": "git", "url": "http://github.com/cferdinandi/smooth-scroll" diff --git a/src/docs/_templates/_footer.html b/src/docs/_templates/_footer.html old mode 100644 new mode 100755 index 81c0ea3..13e8518 --- a/src/docs/_templates/_footer.html +++ b/src/docs/_templates/_footer.html @@ -1,13 +1,38 @@ + - - + + + + + + + + - \ No newline at end of file diff --git a/src/docs/_templates/_header.html b/src/docs/_templates/_header.html old mode 100644 new mode 100755 index 2bd0e5c..2eb02ef --- a/src/docs/_templates/_header.html +++ b/src/docs/_templates/_header.html @@ -5,26 +5,52 @@ Smooth Scroll + - + + -
    + + - +
    +
    -
    + + +
    \ No newline at end of file diff --git a/src/docs/assets/css/custom.css b/src/docs/assets/css/custom.css new file mode 100755 index 0000000..dbe16cd --- /dev/null +++ b/src/docs/assets/css/custom.css @@ -0,0 +1,176 @@ +/** + * Typography + */ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; +} + +h1, h2, h3, h4, h5, h6 { + font-weight: bold; +} + + +/** + * Background color + */ + +@media (min-width: 40em) { + body { + background-image: -webkit-linear-gradient(left, #f7f7f7 0%, #f7f7f7 25%, transparent 25%, transparent 100%); + background-image: linear-gradient(to right, #f7f7f7 0, #f7f7f7 25%, transparent 25%, transparent 100%); + } +} + + +/** + * Navigation + */ + +@media (max-width: 40em) { + .list-nav { + margin-left: -0.25em; + margin-right: -0.25em; + padding: 0; + } + + .list-nav > li { + display: inline-block; + margin-left: 0.25em; + margin-right: 0.25em; + } + + .list-nav > li:before { + content: "\00b7"; + margin-right: 0.5em; + } + + .list-nav > li:first-child:before { + content: ""; + margin-right: 0; + } +} + +@media (max-width: 40em) { + .nav { + border-bottom: 1px solid #e5e5e5; + } +} + +.nav-section a.active { + color: #808080; +} + +/* Disable current page nav */ +a.nav-active { + pointer-events: none; + color: #808080; + cursor: not-allowed; +} + +/* Sticky nav */ +@media (min-width: 40em) { + .sticky-header { + background-color: #f7f7f7; + bottom: 0; + overflow-y: auto; + position: fixed; + top: 0; + width: 22.2%; + } + + .sticky-body { + margin-left: 27.8%; + } +} + +@media (min-width: 80em) { + .sticky-header { + width: 17.75em; + } +} + + +/** + * Buttons + */ + +.btn { + background-color: #f7272f; + border-color: #f7272f; +} + +a.btn:active, +a.btn:focus, +a.btn:hover { + background-color: #cb070e; + border-color: #cb070e; +} + + + +/** + * Prism + * Code syntax highlighting by Lea Verou. + * http://prismjs.com/ + */ + +@media screen { + + .token.comment, + .token.prolog, + .token.doctype, + .token.cdata { + color: slategray; + } + + .token.punctuation { + color: #999; + } + + .token.property, + .token.tag, + .token.boolean, + .token.number, + .token.constant, + .token.symbol { + color: #905; + } + + .token.selector, + .token.attr-name, + .token.string, + .token.builtin { + color: #690; + } + + .token.operator, + .token.entity, + .token.url, + .language-css .token.string, + .style .token.string, + .token.variable { + color: #a67f59; + } + + .token.atrule, + .token.attr-value, + .token.keyword { + color: #07a; + } + + + .token.regex, + .token.important { + color: #e90; + } + + .token.important { + font-weight: bold; + } + + .token.entity { + cursor: help; + } + +} \ No newline at end of file diff --git a/src/docs/assets/css/main.css b/src/docs/assets/css/main.css new file mode 100755 index 0000000..7e5a18f --- /dev/null +++ b/src/docs/assets/css/main.css @@ -0,0 +1,1559 @@ +/*! + * Kraken v7.5.2: A lightweight front-end boilerplate + * (c) 2017 Chris Ferdinandi + * MIT License + * http://github.com/cferdinandi/kraken + */ + +/** + * @section Normalize.css + * Normalize.css base with custom code. + * Additional normalize styles incorporated throughout components. + * @link http://necolas.github.io/normalize.css/ + */ +/** + * Mobile screen resizing + * @link http://dev.w3.org/csswg/css-device-adapt/ + */ +@-webkit-viewport { + width: device-width; + zoom: 1.0; +} + +@-moz-viewport { + width: device-width; + zoom: 1.0; +} + +@-ms-viewport { + width: device-width; + zoom: 1.0; +} + +@-o-viewport { + width: device-width; + zoom: 1.0; +} + +@viewport { + width: device-width; + zoom: 1.0; +} + +/** + * Remove the tap delay in webkit + * @link https://medium.com/@adactio/delay-a9df9edceef3#.7dmbl3xow + */ +/* line 23, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +a, .link-block-styled, +button, +input, +select, +textarea, +label, +summary { + -ms-touch-action: manipulation; + touch-action: manipulation; +} + +/** + * Add box sizing to everything + * @link http://www.paulirish.com/2012/box-sizing-border-box-ftw/ + */ +/* line 38, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +*, +*:before, +*:after { + box-sizing: border-box; +} + +/** + * 1. Set default font family to default. + * 2. Force scrollbar display to prevent jumping on pages. + * 3. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ +/* line 51, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +html { + font-family: "Helvetica Neue", Arial, sans-serif; + /* 1 */ + overflow-y: scroll; + /* 2 */ + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; + text-size-adjust: 100%; + /* 3 */ +} + +/** + * Remove default margin. + */ +/* line 60, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +body { + margin: 0; +} + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ +/* line 70, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +article, +aside, +cite, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section { + display: block; +} + +/* + * Add the correct display in all browsers. + */ +/* line 89, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +summary { + display: list-item; +} + +/** + * Correct `inline-block` display not defined in IE 8/9. + */ +/* line 96, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +audio, +canvas, +progress, +video { + display: inline-block; + /* 1 */ +} + +/** + * Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ +/* line 106, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +progress { + vertical-align: baseline; +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ +/* line 114, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Prevent img and video elements from spilling outside of the page on smaller screens. + */ +/* line 122, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +img, +video { + max-width: 100%; + height: auto; +} + +/** + * Prevent iframe, object, and embed elements from spilling outside of the page on smaller screens. + * height: auto causes iframes to smush, so it's omitted here. + */ +/* line 132, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +iframe, +object, +embed { + max-width: 100%; +} + +/** + * Hide the template element in IE, Safari, and Firefox < 22. + */ +/** + * 1. Remove border when inside `a` element in IE 8/9/10. + * 2. Prevents IE from making scaled images look like crap + */ +/* line 149, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +img { + border: 0; + /* 1 */ + -ms-interpolation-mode: bicubic; + /* 2 */ +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ +/* line 157, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +svg:not(:root) { + overflow: hidden; +} + +/** + * Address inconsistent margin. + */ +/* line 164, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +figure { + margin: 0; +} + +/** + * @workaround Remove focus from
    element when using tabindex="-1" hack for skipnav link + * @link https://code.google.com/p/chromium/issues/detail?id=37721 + */ +/* line 172, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_normalize.scss */ +.tabindex:focus { + outline: none; +} + +/** + * @section Grid + * Structure and layout + */ +/** + * Base grid styles: single column + */ +/* line 9, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ +.container { + margin-left: auto; + margin-right: auto; + max-width: 80em; + width: 88%; +} + +/* line 16, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ +.row { + margin-left: -1.4%; + margin-right: -1.4%; +} + +/* line 21, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ +.grid-fourth, .grid-third, .grid-half, .grid-two-thirds, .grid-three-fourths, .grid-full, .grid-dynamic { + float: left; + padding-left: 1.4%; + padding-right: 1.4%; + width: 100%; +} + +/** + * Reverses order of grid for content choreography + */ +/* line 38, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ +.grid-flip { + float: right; +} + +/** + * Add columns to grid on bigger screens + */ +@media (min-width: 20em) { + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-xsmall .grid-fourth { + width: 25%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-xsmall .grid-third { + width: 33.33333%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-xsmall .grid-half { + width: 50%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-xsmall .grid-two-thirds { + width: 66.66667%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-xsmall .grid-three-fourths { + width: 75%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-xsmall .grid-full { + width: 100%; + } +} + +@media (min-width: 30em) { + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-small .grid-fourth { + width: 25%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-small .grid-third { + width: 33.33333%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-small .grid-half { + width: 50%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-small .grid-two-thirds { + width: 66.66667%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-small .grid-three-fourths { + width: 75%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .row-start-small .grid-full { + width: 100%; + } +} + +@media (min-width: 40em) { + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-fourth { + width: 25%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-third { + width: 33.33333%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-half { + width: 50%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-two-thirds { + width: 66.66667%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-three-fourths { + width: 75%; + } + /* line 49, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-full { + width: 100%; + } + /* line 55, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .offset-fourth { + margin-left: 25%; + } + /* line 55, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .offset-third { + margin-left: 33.33333%; + } + /* line 55, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .offset-half { + margin-left: 50%; + } + /* line 55, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .offset-two-thirds { + margin-left: 66.66667%; + } + /* line 55, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .offset-three-fourths { + margin-left: 75%; + } + /* line 55, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .offset-full { + margin-left: 100%; + } +} + +/** + * Dynamic grid + */ +@media (min-width: 20em) { + /* line 71, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-dynamic { + width: 50%; + } +} + +@media (min-width: 30em) { + /* line 71, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-dynamic { + width: 33.33333%; + } +} + +@media (min-width: 40em) { + /* line 71, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_grid.scss */ + .grid-dynamic { + width: 25%; + } +} + +/** + * @section Typography + * Sets font styles for entire site + */ +/* line 6, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +body { + background: #ffffff; + color: #272727; + font-family: "Helvetica Neue", Arial, sans-serif; + font-size: 100%; + line-height: 1.5; +} + +@media (min-width: 40em) { + /* line 6, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ + body { + line-height: 1.5625; + } +} + +/* line 18, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +p { + margin: 0 0 1.5625em; +} + +/** + * Hyperlink styling + * 1. Remove the gray background on active links in IE 10. + * 2. Remove gaps in links underline in iOS 8+ and Safari 8+. + */ +/* line 29, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +a, .link-block-styled { + background-color: transparent; + /* 1 */ + color: #0088cc; + text-decoration: none; + word-wrap: break-word; + -webkit-text-decoration-skip: objects; + /* 2 */ + /** + * Improve readability when focused and also mouse hovered in all browsers. + */ +} + +/* line 39, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +a:active, .link-block-styled:active, a:hover, .link-block-styled:hover, .link-block:hover .link-block-styled { + outline: 0; +} + +/* line 44, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +a:active, .link-block-styled:active, a:focus, .link-block-styled:focus, a:hover, .link-block-styled:hover, .link-block:hover .link-block-styled { + color: #005580; + text-decoration: underline; +} + +/** + * Creates block-level links + */ +/* line 57, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +a.link-block, .link-block.link-block-styled { + color: #272727; + display: block; + text-decoration: none; +} + +/** + * List styling + */ +/* line 76, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +ul, +ol { + margin: 0 0 1.5625em 2em; + padding: 0; +} + +/* line 82, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +ul ul, +ul ol, +ol ol, +ol ul { + margin-bottom: 0; +} + +/* line 89, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +dl, +dd { + margin: 0; + padding: 0; +} + +/* line 95, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +dd { + margin-bottom: 1.5625em; +} + +/* line 99, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +dt { + font-weight: bold; +} + +/** + * Removes list styling. + * For semantic reasons, should only be used on unordered lists. + */ +/* line 107, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +.list-unstyled { + margin-left: 0; + list-style: none; +} + +/** + * Display lists on a single line. + */ +/* line 116, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +.list-inline { + list-style: none; + margin-left: -0.5em; + margin-right: -0.5em; + padding: 0; +} + +/* line 123, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +.list-inline > li { + display: inline; + margin-left: 0.5em; + margin-right: 0.5em; +} + +/** + * Heading styling for h1 through h6 elements. + * Heading class lets you use one heading type for semantics, but style it as another heading type. + */ +/* line 135, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +h1, h2, h3, h4, h5, h6 { + font-weight: normal; + line-height: 1.2; + margin: 0 0 1em; + padding: 1em 0 0; + word-wrap: break-word; +} + +/* line 143, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +h1, +.h1 { + font-size: 1.5em; + padding-top: .5em; +} + +@media (min-width: 40em) { + /* line 143, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ + h1, + .h1 { + font-size: 1.75em; + } +} + +/* line 153, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +h2, +.h2 { + font-size: 1.3125em; +} + +/* line 158, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +h3, +.h3 { + font-size: 1.1875em; +} + +/* line 163, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +h4, h5, h6, +.h4, .h5, .h6 { + font-size: 1em; +} + +/* line 168, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +h4, +.h4 { + text-transform: uppercase; +} + +/** + * Lines, Quotes and Emphasis + */ +/* line 178, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +hr { + border: 0; + border-top: 1px solid #e5e5e5; + border-bottom: 0 solid #ffffff; + box-sizing: content-box; + margin: 2em auto; + overflow: visible; +} + +/** + * Prevent the duplicate application of `bolder` by the next rule in Safari 6. + */ +/* line 190, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +b, +strong { + font-weight: inherit; +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ +/* line 198, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +b, +strong { + font-weight: bolder; +} + +/** + * 1. Remove the bottom border in Firefox 39-. + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ +/* line 207, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +abbr[title] { + border-bottom: none; + /* 1 */ + text-decoration: underline; + /* 2 */ + text-decoration: underline dotted; + /* 2 */ +} + +/** + * Address styling not present in Safari and Chrome. + */ +/* line 216, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +dfn { + font-style: italic; +} + +/** + * Address styling not present in IE 8/9. + */ +/* line 223, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +mark { + background: #ff0; + color: #000000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ +/* line 231, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ +/* line 238, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +/* line 246, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +sup { + top: -0.5em; +} + +/* line 250, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +sub { + bottom: -0.25em; +} + +/** + * Blockquotes + */ +/* line 259, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +blockquote { + font-size: 1.1875em; + font-style: italic; + margin: 0 0 1.5625em; + padding-left: 0.84211em; + padding-right: 0.84211em; +} + +/* line 266, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +blockquote cite { + color: #808080; + font-size: 0.84211em; + padding-top: 1em; +} + +/* line 273, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +blockquote, +q { + quotes: none; +} + +/* line 278, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_typography.scss */ +blockquote:before, +blockquote:after, +q:before, +q:after { + content: ''; +} + +/** + * @section Code + * Styling for code and preformatted text. + */ +/* line 6, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_code.scss */ +code, +kbd, +pre, +samp { + border-radius: 1px; + font-family: Menlo, Monaco, "Courier New", monospace; + font-size: 0.875em; +} + +/* line 15, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_code.scss */ +code { + background-color: #f7f7f7; + color: #dd1144; + padding: 0.25em; + word-wrap: break-word; +} + +/* line 22, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_code.scss */ +pre { + background-color: #f4f4f4; + display: block; + line-height: 1.5; + margin-bottom: 1.5625em; + overflow: auto; + padding: 0.8125em; + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + white-space: pre-wrap; + word-break: break-all; +} + +/* line 33, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_code.scss */ +pre code { + background-color: transparent; + border: 0; + color: inherit; + font-size: 1em; + padding: 0; +} + +/** + * @section Buttons + * Styling for CSS buttons. + */ +/** + * Primary buttons + */ +/* line 10, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn { + background-color: #0088cc; + border: 1px solid #0088cc; + border-radius: 1px; + color: #ffffff; + display: inline-block; + font-size: 0.9375em; + font-weight: normal; + line-height: 1.2; + margin-right: 0.3125em; + margin-bottom: 0.3125em; + padding: 0.5em 0.6875em; +} + +/* line 23, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn:hover, +a .btn:hover, .link-block-styled .btn:hover, .btn:focus, +a .btn:focus, .link-block-styled .btn:focus, .btn:active, +a .btn:active, .link-block-styled .btn:active, .btn.active { + background-color: #005580; + border-color: #005580; + color: #ffffff; + text-decoration: none; +} + +/** + * Secondary buttons + */ +/* line 41, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn-secondary { + background-color: #808080; + border-color: #808080; +} + +/* line 45, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn-secondary:hover, +a .btn-secondary:hover, .link-block-styled .btn-secondary:hover, .btn-secondary:focus, +a .btn-secondary:focus, .link-block-styled .btn-secondary:focus, .btn-secondary:active, +a .btn-secondary:active, .link-block-styled .btn-secondary:active, .btn-secondary.active { + background-color: #5a5a5a; + border-color: #5a5a5a; +} + +/** + * Active state + */ +/* line 61, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn:active, +.btn.active { + box-shadow: inset 0 0.15625em 0.25em rgba(0, 0, 0, 0.15), 0 1px 0.15625em rgba(0, 0, 0, 0.05); + outline: 0; +} + +/** + * Disabled state + */ +/* line 71, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn.disabled, +.btn[disabled] { + box-shadow: none; + cursor: not-allowed; + opacity: 0.5; + pointer-events: none; +} + +/** + * Button size + */ +/* line 83, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn-large { + font-size: 1em; + line-height: normal; + padding: 0.6875em 0.9375em; +} + +/** + * Block-level buttons + */ +/* line 93, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn-block, +input[type="submit"].btn-block, +input[type="reset"].btn-block, +input[type="button"].btn-block { + display: block; + margin-right: 0; + padding-right: 0; + padding-left: 0; + width: 100%; +} + +/** + * General styles + */ +/* line 108, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn, +button, +html input[type="button"], +input[type="reset"], +input[type="submit"] { + cursor: pointer; + text-align: center; + vertical-align: middle; + /** + * @workaround Override default button styling + * @affected Webkit/Firefox + */ + -webkit-appearance: none; +} + +/** + * Remove right margin on last element and inputs + */ +/* line 129, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_buttons.scss */ +.btn:last-child, +input.btn { + margin-right: 0; +} + +/** + * @section Forms + * Styling for form elements. + */ +/* line 6, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +form, +fieldset { + margin-bottom: 1.5625em; +} + +/* line 11, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +fieldset { + border: 0; + padding: 0; +} + +/* line 16, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +legend, +label { + display: block; + font-weight: normal; + margin: 0 0 0.3125em; + padding: 0; +} + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ +/* line 30, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +button, +input, +optgroup, +select, +textarea { + color: #555555; + /* 1 */ + font: inherit; + /* 2 */ + margin: 0; + /* 3 */ + padding: 0.3125em; +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ +/* line 44, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ +/* line 54, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +button, +select { + text-transform: none; +} + +/* line 59, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +input, +textarea, +select { + border: 1px solid #b8b8b8; + border-radius: 1px; + display: block; + line-height: 1.5; + margin-bottom: 1.1875em; + width: 100%; +} + +@media (min-width: 40em) { + /* line 59, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ + input, + textarea, + select { + line-height: 1.5625; + } +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ +/* line 78, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +optgroup { + font-weight: bold; +} + +/* line 82, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +form button, +form .button { + margin-bottom: 1.1875em; +} + +/* line 87, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +textarea { + height: 12em; + overflow: auto; +} + +/* line 92, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +[type="image"], +[type="checkbox"], +[type="radio"] { + cursor: pointer; + display: inline-block; + height: auto; + margin-bottom: 0.3125em; + padding: 0; + width: auto; +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ +/* line 108, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/* line 113, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +input:focus, +textarea:focus { + border-color: rgba(82, 168, 236, 0.8); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 0.5em rgba(82, 168, 236, 0.6); + outline: 0; + outline: thin dotted \9; +} + +/* line 121, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +[type="file"]:focus, +[type="checkbox"]:focus, +select:focus { + outline: thin dotted; + outline: 0.3125em auto -webkit-focus-ring-color; + outline-offset: -0.125em; +} + +/** + * Remove the inner border and padding in Firefox. + */ +/* line 133, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ +/* line 145, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +button:-moz-focusring, +[type="button"]:-moz-focusring, +[type="reset"]:-moz-focusring, +[type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ +/* line 157, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +::-webkit-file-upload-button { + -webkit-appearance: button; + /* 1 */ + font: inherit; + /* 2 */ +} + +/** + * Inline inputs + */ +/* line 166, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +.input-inline { + display: inline-block; + vertical-align: middle; + width: auto; +} + +/** + * Condensed inputs + */ +/* line 176, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +.input-condensed { + padding: 1px 0.3125em; + font-size: 0.9375em; +} + +/** + * Search + */ +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ +/* line 191, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +[type="search"] { + -webkit-appearance: textfield; + /* 1 */ + outline-offset: -2px; + /* 2 */ +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ +/* line 201, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +[type="search"]::-webkit-search-cancel-button, +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Create rounded search bar + */ +/* line 210, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +.input-search { + width: 85%; + padding-left: 0.9375em; + padding-right: 2.5em; + border-radius: 1.3125em; + transition: width 300ms ease-in; +} + +@media (min-width: 40em) { + /* line 210, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ + .input-search { + width: 65%; + } +} + +/** + * Special styling for search icon as button + */ +/* line 226, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +.btn-search { + display: inline; + color: #808080; + border: none; + background: none; + margin-left: -2.5em; + margin-bottom: 0; +} + +/* line 234, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +.btn-search .icon { + fill: #808080; +} + +/* line 238, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +.btn-search:hover { + color: #5a5a5a; +} + +/* line 241, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_forms.scss */ +.btn-search:hover .icon { + fill: #5a5a5a; +} + +/** + * @section SVGs + * SVG icon sprite styling. + * @link http://css-tricks.com/svg-sprites-use-better-icon-fonts/ + * @link http://css-tricks.com/svg-use-external-source/ + */ +/** + * Basic styles + * Only displayed when SVGs are supported to avoid large empty spaces + */ +/* line 12, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_svg.scss */ +.icon { + display: inline-block; + fill: currentColor; + height: 0; + width: 0; +} + +/* line 18, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_svg.scss */ +.svg .icon { + height: 1em; + width: 1em; +} + +/** + * Hide fallback text if browser supports SVG + */ +/** + * @section Tables + * Styling for tables + */ +/* line 6, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ +table { + border-collapse: collapse; + border-spacing: 0; + margin-bottom: 1.5625em; + max-width: 100%; + width: 100%; +} + +/* line 14, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ +th, +td { + text-align: left; + padding: 0.5em; +} + +/* line 20, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ +th { + border-bottom: 0.125em solid #e5e5e5; + font-weight: bold; + vertical-align: bottom; +} + +/* line 27, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ +td { + border-top: 1px solid #e5e5e5; + vertical-align: top; +} + +/** + * Adds zebra striping + */ +/* line 35, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ +.table-striped tbody tr:nth-child(odd) { + background-color: #f7f7f7; +} + +/** + * Reduces padding on condensed tables + */ +/* line 43, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ +.table-condensed th, +.table-condensed td { + padding: 0.25em; +} + +/** + * Pure CSS responsive tables + * Adds label to each cell using the [data-label] attribute + * @link https://techblog.livingsocial.com/blog/2015/04/06/responsive-tables-in-pure-css/ + */ +@media (max-width: 40em) { + /* line 57, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ + .table-responsive thead { + display: none; + visibility: hidden; + } + /* line 62, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ + .table-responsive tr { + border-top: 1px solid #ededed; + display: block; + padding: 0.5em; + } + /* line 68, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ + .table-responsive td { + border: 0; + display: block; + padding: 0.25em; + } + /* line 73, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_tables.scss */ + .table-responsive td:before { + content: attr(data-label); + display: block; + font-weight: bold; + } +} + +/** + * @section Overrides + * Nudge and tweak alignment, spacing, and visibility. + */ +/** + * Text sizes + */ +/* line 11, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.text-small { + font-size: 0.9375em; +} + +/* line 15, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.text-large { + font-size: 1.1875em; + line-height: 1.4; +} + +@media (min-width: 40em) { + /* line 15, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ + .text-large { + font-size: 1.3125em; + } +} + +/** + * Text colors + */ +/* line 29, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.text-muted { + color: #808080; +} + +/** + * Text alignment + */ +/* line 38, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.text-center { + text-align: center; +} + +/* line 42, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.text-right { + text-align: right; +} + +/* line 46, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.text-left { + text-align: left; +} + +@media (min-width: 40em) { + /* line 51, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ + .text-right-medium { + text-align: right; + } +} + +/** + * Floats + */ +/* line 61, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.float-left { + float: left; +} + +/* line 65, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.float-center { + float: none; + margin-left: auto; + margin-right: auto; +} + +/* line 71, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.float-right { + float: right; +} + +/** + * Margins + */ +/* line 80, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.no-margin-top { + margin-top: 0; +} + +/* line 84, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.no-margin-bottom { + margin-bottom: 0; +} + +/* line 88, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.margin-top { + margin-top: 1.5625em; +} + +/* line 92, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.margin-bottom { + margin-bottom: 1.5625em; +} + +/* line 96, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.margin-bottom-small { + margin-bottom: 0.5em; +} + +/* line 100, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.margin-bottom-large { + margin-bottom: 2em; +} + +/** + * Padding + */ +/* line 109, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.no-padding-top { + padding-top: 0; +} + +/* line 113, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.no-padding-bottom { + padding-bottom: 0; +} + +/* line 117, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.padding-top { + padding-top: 1.5625em; +} + +/* line 121, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.padding-top-small { + padding-top: 0.5em; +} + +/* line 125, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.padding-top-large { + padding-top: 2em; +} + +/* line 129, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.padding-bottom { + padding-bottom: 1.5625em; +} + +/* line 133, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.padding-bottom-small { + padding-bottom: 0.5em; +} + +/* line 137, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.padding-bottom-large { + padding-bottom: 2em; +} + +/** + * Visibility + */ +/** + * Visually hide an element, but leave it available for screen readers + * @link https://github.com/h5bp/html5-boilerplate/blob/master/dist/css/main.css + * @link http://snook.ca/archives/html_and_css/hiding-content-for-accessibility + */ +/* line 151, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.screen-reader, .svg .icon-fallback-text { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + white-space: nowrap; + width: 1px; +} + +/** + * Extends the .screen-reader class to allow the element to be focusable when navigated to via the keyboard + * @link https://github.com/h5bp/html5-boilerplate/blob/master/dist/css/main.css + * @link https://www.drupal.org/node/897638 + */ +/* line 168, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.screen-reader-focusable:active, +.screen-reader-focusable:focus { + clip: auto; + height: auto; + margin: 0; + overflow: visible; + position: static; + white-space: normal; + width: auto; +} + +/** + * @workaround + * @affected IE 8/9/10 + * @link http://juicystudio.com/article/screen-readers-display-none.php + */ +/* line 184, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +[hidden], template { + display: none; + visibility: hidden; +} + +/** + * Contain floats + * The space content is one way to avoid an Opera bug when the `contenteditable` attribute is included anywhere else in the document. + * @link https://github.com/h5bp/html5-boilerplate/blob/master/dist/css/main.css + */ +/* line 196, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.clearfix:before, .container:before, +.row:before, +.clearfix:after, +.container:after, +.row:after { + display: table; + content: " "; +} + +/* line 202, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_overrides.scss */ +.clearfix:after, .container:after, +.row:after { + clear: both; +} + +/** + * @section Print + * Styling for printed content. Adapted from HTML5BP. + * @link http://html5boilerplate.com + */ +@media print { + /** + * Universal selector. + * Reset all content to transparent background, black color, and remove box and text shadows. + */ + /* line 13, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + * { + background: transparent !important; + color: #000 !important; + box-shadow: none !important; + text-shadow: none !important; + } + /** + * Specifies page margin + */ + @page { + margin: 0.5cm; + } + /** + * Underline all links + */ + /* line 30, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + a, .link-block-styled, + a:visited, + .link-block-styled:visited { + text-decoration: underline; + } + /** + * Show URL after links + */ + /* line 38, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + a[href]:after, [href].link-block-styled:after { + content: " (" attr(href) ")"; + } + /** + * Don't show URL for internal links + */ + /* line 45, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + a[href^="#"]:after, [href^="#"].link-block-styled:after { + content: ""; + } + /** + * Specifies the minimum number of lines to print at the top and bottom of a page. + */ + /* line 52, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + p, + h1, h2, h3 { + orphans: 3; + widows: 3; + } + /** + * Avoid inserting a page break after headers + */ + /* line 61, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + h1, h2, h3 { + page-break-after: avoid; + } + /** + * Change border color on blockquotes and preformatted text. + * Avoid page breaks inside the content + */ + /* line 69, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + pre, + blockquote { + border-color: #999; + page-break-inside: avoid; + } + /** + * Displayed as a table header row group + */ + /* line 78, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + thead { + display: table-header-group; + } + /** + * Avoid inserting a page break inside table rows and images + */ + /* line 85, /Users/cferdinandi/Documents/Go Make Things LLC/plugins/_template/src/sass/components/_print.scss */ + tr, + img { + page-break-inside: avoid; + } +} diff --git a/src/docs/assets/js/gumshoe.min.js b/src/docs/assets/js/gumshoe.min.js new file mode 100755 index 0000000..266bcc3 --- /dev/null +++ b/src/docs/assets/js/gumshoe.min.js @@ -0,0 +1,2 @@ +/*! gumshoe v3.1.2 | (c) 2016 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/gumshoe */ +!function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.gumshoe=t(e)}("undefined"!=typeof global?global:this.window||this.global,function(e){"use strict";var t,n,o,r,a,c,i={},s="querySelector"in document&&"addEventListener"in e&&"classList"in document.createElement("_"),l=[],u={selector:"[data-gumshoe] a",selectorHeader:"[data-gumshoe-header]",offset:0,activeClass:"active",callback:function(){}},f=function(e,t,n){if("[object Object]"===Object.prototype.toString.call(e))for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(n,e[o],o,e);else for(var r=0,a=e.length;a>r;r++)t.call(n,e[r],r,e)},d=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var r=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&"[object Object]"===Object.prototype.toString.call(n[o])?e[o]=d(!0,e[o],n[o]):e[o]=n[o])};o>n;n++){var a=arguments[n];r(a)}return e},v=function(e){return Math.max(e.scrollHeight,e.offsetHeight,e.clientHeight)},m=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},g=function(e){var n=0;if(e.offsetParent){do n+=e.offsetTop,e=e.offsetParent;while(e)}else n=e.offsetTop;return n=n-a-t.offset,n>=0?n:0},h=function(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},p=function(){l.sort(function(e,t){return e.distance>t.distance?-1:e.distance=o&&h(l[0].target))return H(l[0]),l[0];for(var r=0,a=l.length;a>r;r++){var c=l[r];if(c.distance<=n)return H(c),c}y(),t.callback()};var C=function(){f(l,function(e){e.nav.classList.contains(t.activeClass)&&(c={nav:e.nav,parent:e.parent})})};i.destroy=function(){t&&(e.removeEventListener("resize",L,!1),e.removeEventListener("scroll",L,!1),l=[],t=null,n=null,o=null,r=null,a=null,c=null)};var L=function(e){n||(n=setTimeout(function(){n=null,"scroll"===e.type&&i.getCurrentNav(),"resize"===e.type&&(i.setDistances(),i.getCurrentNav())},66))};return i.init=function(n){s&&(i.destroy(),t=d(u,n||{}),r=document.querySelector(t.selectorHeader),b(),0!==l.length&&(C(),i.setDistances(),i.getCurrentNav(),e.addEventListener("resize",L,!1),e.addEventListener("scroll",L,!1)))},i}); \ No newline at end of file diff --git a/src/docs/assets/js/highlight-active-nav.js b/src/docs/assets/js/highlight-active-nav.js new file mode 100755 index 0000000..4aa4981 --- /dev/null +++ b/src/docs/assets/js/highlight-active-nav.js @@ -0,0 +1,134 @@ +/** + * highlight-active-nav.js + * @description Highlight the active navigation element + * @version 1.0.0 + * @author Chris Ferdinandi + * @license MIT + */ + +(function (root, factory) { + if ( typeof define === 'function' && define.amd ) { + define([], factory(root)); + } else if ( typeof exports === 'object' ) { + module.exports = factory(root); + } else { + root.highlightActiveNav = factory(root); + } +})(typeof global !== 'undefined' ? global : this.window || this.global, function (root) { + + 'use strict'; + + // + // Variables + // + + var highlight = {}; // Object for public APIs + var supports = !!document.querySelector && !!root.addEventListener; // Feature test + var settings; + + // Default settings + var defaults = { + selector: '[data-nav-highlight]', + activeClass: 'nav-active', + urlPrefix: null, + callback: function () {} + }; + + + // + // Methods + // + + /** + * Merge defaults with user options + * @private + * @param {Object} defaults Default settings + * @param {Object} options User options + * @returns {Object} Merged values of defaults and options + */ + var extend = function () { + + // Variables + var extended = {}; + var deep = false; + var i = 0; + var length = arguments.length; + + // Check if a deep merge + if ( Object.prototype.toString.call( arguments[0] ) === '[object Boolean]' ) { + deep = arguments[0]; + i++; + } + + // Merge the object into the extended object + var merge = function (obj) { + for ( var prop in obj ) { + if ( Object.prototype.hasOwnProperty.call( obj, prop ) ) { + // If deep merge and property is an object, merge properties + if ( deep && Object.prototype.toString.call(obj[prop]) === '[object Object]' ) { + extended[prop] = extend( true, extended[prop], obj[prop] ); + } else { + extended[prop] = obj[prop]; + } + } + } + }; + + // Loop through each object and conduct a merge + for ( ; i < length; i++ ) { + var obj = arguments[i]; + merge(obj); + } + + return extended; + + }; + + /** + * Destroy the current initialization. + * @public + */ + highlight.destroy = function () { + if ( !settings ) return; + document.documentElement.classList.remove( settings.initClass ); + settings = null; + container = null; + }; + + /** + * Initialize highlightActiveNav + * @public + * @param {Object} options User settings + */ + highlight.init = function ( options ) { + + // feature test + if ( !supports ) return; + + // Destroy any existing initializations + highlight.destroy(); + + // Merge user options with defaults + settings = extend( defaults, options || {} ); + + // Get the container + var href = settings.urlPrefix ? location.pathname.split( settings.urlPrefix )[1] : location.pathname; + var nav = document.querySelector( settings.selector + ' a[href^="' + href + '"]' ); + if ( !nav ) return; + + // Add class to active nav + nav.className += ' ' + settings.activeClass; + + // Run callback + settings.callback(); + + }; + + + // + // Public APIs + // + + return highlight; + +}); \ No newline at end of file diff --git a/src/docs/assets/js/prism.js b/src/docs/assets/js/prism.js new file mode 100755 index 0000000..92b3663 --- /dev/null +++ b/src/docs/assets/js/prism.js @@ -0,0 +1,21 @@ +/* ============================================================= + + Prism v1.0 + Lightweight, robust, elegant syntax highlighting, by Lea Verou + http://lea.verou.me + + Licensed under MIT License. + http://www.opensource.org/licenses/mit-license.php/ + + * ============================================================= */ + + (function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=t.util.clone(e[i]));return r;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var r=t.util.clone(t.languages[e]);for(var i in n)r[i]=n[i];return r},insertBefore:function(e,n,r,i){i=i||t.languages;var s=i[e],o={};for(var u in s)if(s.hasOwnProperty(u)){if(u==n)for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);o[u]=s[u]}return i[e]=o},DFS:function(e,n){for(var r in e){n.call(e,r,e[r]);t.util.type(e)==="Object"&&t.languages.DFS(e[r],n)}}},highlightAll:function(e,n){var r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');for(var i=0,s;s=r[i++];)t.highlightElement(s,e===!0,n)},highlightElement:function(r,i,s){var o,u,a=r;while(a&&!e.test(a.className))a=a.parentNode;if(a){o=(a.className.match(e)||[,""])[1];u=t.languages[o]}if(!u)return;r.className=r.className.replace(e,"").replace(/\s+/g," ")+" language-"+o;a=r.parentNode;/pre/i.test(a.nodeName)&&(a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+o);var f=r.textContent;if(!f)return;f=f.replace(/&/g,"&").replace(/e.length)break e;if(p instanceof i)continue;a.lastIndex=0;var d=a.exec(p);if(d){l&&(c=d[1].length);var v=d.index-1+c,d=d[0].slice(c),m=d.length,g=v+m,y=p.slice(0,v+1),b=p.slice(g+1),w=[h,1];y&&w.push(y);var E=new i(u,f?t.tokenize(d,f):d);w.push(E);b&&w.push(b);Array.prototype.splice.apply(s,w)}}}return s},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t){this.type=e;this.content=t};n.stringify=function(e,r,i){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]")return e.map(function(t){return n.stringify(t,r,e)}).join("");var s={type:e.type,content:n.stringify(e.content,r,i),tag:"span",classes:["token",e.type],attributes:{},language:r,parent:i};s.type=="comment"&&(s.attributes.spellcheck="true");t.hooks.run("wrap",s);var o="";for(var u in s.attributes)o+=u+'="'+(s.attributes[u]||"")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'" '+o+">"+s.content+""};if(!self.document){self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.tokenize(i,t.languages[r])));self.close()},!1);return}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}})();; + Prism.languages.markup={comment:/<!--[\w\W]*?-->/g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))});; + Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/ig,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,ignore:/&(lt|gt|amp);/gi,punctuation:/[\{\};:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<|<)style[\w\W]*?(>|>)[\w\W]*?(<|<)\/style(>|>)/ig,inside:{tag:{pattern:/(<|<)style[\w\W]*?(>|>)|(<|<)\/style(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});; + Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/ig,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/ig,inside:{punctuation:/\(/}}, number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|(&){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g}; + ; + Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|throw|catch|finally|null|break|continue)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}});Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<|<)script[\w\W]*?(>|>)[\w\W]*?(<|<)\/script(>|>)/ig,inside:{tag:{pattern:/(<|<)script[\w\W]*?(>|>)|(<|<)\/script(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}}); + ; + Prism.languages.php=Prism.languages.extend("clike",{keyword:/\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|extends|private|protected|parent|static|throw|null|echo|print|trait|namespace|use|final|yield|goto|instanceof|finally|try|catch)\b/ig, constant:/\b[A-Z0-9_]{2,}\b/g});Prism.languages.insertBefore("php","keyword",{delimiter:/(\?>|<\?php|<\?)/ig,variable:/(\$\w+)\b/ig,"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/g,lookbehind:!0,inside:{punctuation:/\\/}}});Prism.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/g,lookbehind:!0}}); Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(a){"php"===a.language&&(a.tokenStack=[],a.code=a.code.replace(/(?:<\?php|<\?|<\?php|<\?)[\w\W]*?(?:\?>|\?>)/ig,function(b){a.tokenStack.push(b);return"{{{PHP"+a.tokenStack.length+"}}}"}))}),Prism.hooks.add("after-highlight",function(a){if("php"===a.language){for(var b=0,c;c=a.tokenStack[b];b++)a.highlightedCode=a.highlightedCode.replace("{{{PHP"+(b+1)+"}}}",Prism.highlight(c,a.grammar,"php"));a.element.innerHTML=a.highlightedCode}}), Prism.hooks.add("wrap",function(a){"php"===a.language&&"markup"===a.type&&(a.content=a.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g,'$1'))}),Prism.languages.insertBefore("php","comment",{markup:{pattern:/(<|<)[^?]\/?(.*?)(>|>)/g,inside:Prism.languages.markup},php:/\{\{\{PHP[0-9]+\}\}\}/g}));; + Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,lookbehind:!0},atrule:/@[\w-]+(?=\s+(\(|\{|;))/gi,url:/([-a-z]+-)*url(http://github.com/?=\()/gi,selector:/([^@;\{\}\(\)]?([^@;\{\}\(\)]|&|\#\{\$[-_\w]+\})+)(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/gm});Prism.languages.insertBefore("scss","atrule",{keyword:/@(if|else if|else|for|each|while|import|extend|debug|warn|mixin|include|function|return)|(?=@for\s+\$[-_\w]+\s)+from/i});Prism.languages.insertBefore("scss","property",{variable:/((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i});Prism.languages.insertBefore("scss","ignore",{placeholder:/%[-_\w]+/i,statement:/\B!(default|optional)\b/gi,"boolean":/\b(true|false)\b/g,"null":/\b(null)\b/g,operator:/\s+([-+]{1,2}|={1,2}|!=|\|?\||\?|\*|\/|\%)\s+/g}); + ; \ No newline at end of file diff --git a/src/docs/assets/js/toc.js b/src/docs/assets/js/toc.js new file mode 100755 index 0000000..6b03942 --- /dev/null +++ b/src/docs/assets/js/toc.js @@ -0,0 +1,191 @@ +/** + * tableOfContents.js + * @description Dynamically create a table of contents + * @version 1.0.0 + * @author Chris Ferdinandi + * @license MIT + */ + +(function (root, factory) { + if ( typeof define === 'function' && define.amd ) { + define([], factory(root)); + } else if ( typeof exports === 'object' ) { + module.exports = factory(root); + } else { + root.tableOfContents = factory(root); + } +})(typeof global !== 'undefined' ? global : this.window || this.global, function (root) { + + 'use strict'; + + // + // Variables + // + + var toc = {}; // Object for public APIs + var supports = !!document.querySelector && !!root.addEventListener; // Feature test + var settings, container; + + // Default settings + var defaults = { + container: '[data-toc]', + selectors: '[data-toc-content] h2', + heading: 'Contents', + headingType: 'h2', + headingClass: '', + navClass: '', + linkClass: '', + initClass: 'js-table-of-contents', + callback: function () {} + }; + + + // + // Methods + // + + /** + * A simple forEach() implementation for Arrays, Objects and NodeLists + * @private + * @param {Array|Object|NodeList} collection Collection of items to iterate + * @param {Function} callback Callback function for each iteration + * @param {Array|Object|NodeList} scope Object/NodeList/Array that forEach is iterating over (aka `this`) + */ + var forEach = function (collection, callback, scope) { + if (Object.prototype.toString.call(collection) === '[object Object]') { + for (var prop in collection) { + if (Object.prototype.hasOwnProperty.call(collection, prop)) { + callback.call(scope, collection[prop], prop, collection); + } + } + } else { + for (var i = 0, len = collection.length; i < len; i++) { + callback.call(scope, collection[i], i, collection); + } + } + }; + + /** + * Merge defaults with user options + * @private + * @param {Object} defaults Default settings + * @param {Object} options User options + * @returns {Object} Merged values of defaults and options + */ + var extend = function () { + + // Variables + var extended = {}; + var deep = false; + var i = 0; + var length = arguments.length; + + // Check if a deep merge + if ( Object.prototype.toString.call( arguments[0] ) === '[object Boolean]' ) { + deep = arguments[0]; + i++; + } + + // Merge the object into the extended object + var merge = function (obj) { + for ( var prop in obj ) { + if ( Object.prototype.hasOwnProperty.call( obj, prop ) ) { + // If deep merge and property is an object, merge properties + if ( deep && Object.prototype.toString.call(obj[prop]) === '[object Object]' ) { + extended[prop] = extend( true, extended[prop], obj[prop] ); + } else { + extended[prop] = obj[prop]; + } + } + } + }; + + // Loop through each object and conduct a merge + for ( ; i < length; i++ ) { + var obj = arguments[i]; + merge(obj); + } + + return extended; + + }; + + /** + * Render the Table of Contents + */ + toc.render = function () { + + // Variables + var sections = document.querySelectorAll( settings.selectors ); + var toc = ''; + + if ( sections.length === 0 ) return; + + // Loop through each section and create a link to it + forEach(sections, function (section) { + + // Ignore sections without an id + var id = section.id; + if ( !id ) return; + + // Create section navigation + toc += '
  • ' + section.innerHTML + '
  • '; + + }); + + // Inject table of contents into the DOM + container.innerHTML = '<' + settings.headingType + '>' + settings.heading + '
      ' + toc + '
    '; + + // Run callback + settings.callback(); + + }; + + /** + * Destroy the current initialization. + * @public + */ + toc.destroy = function () { + if ( !settings ) return; + document.documentElement.classList.remove( settings.initClass ); + container.innerHTML = ''; + settings = null; + container = null; + }; + + /** + * Initialize tableOfContents + * @public + * @param {Object} options User settings + */ + toc.init = function ( options ) { + + // feature test + if ( !supports ) return; + + // Destroy any existing initializations + toc.destroy(); + + // Merge user options with defaults + settings = extend( defaults, options || {} ); + + // Get the container + container = document.querySelector( settings.container ); + if ( !container ) return; + + // Add class to HTML element to activate conditional CSS + document.documentElement.classList.add( settings.initClass ); + + // Render the table of contents + toc.render(); + + }; + + + // + // Public APIs + // + + return toc; + +}); \ No newline at end of file diff --git a/src/docs/browsers.md b/src/docs/browsers.md new file mode 100755 index 0000000..8bc0464 --- /dev/null +++ b/src/docs/browsers.md @@ -0,0 +1,18 @@ +# Browser Compatibility + +Smooth Scroll works in all modern browsers, and IE 9 and above. + +Smooth Scroll is built with modern JavaScript APIs, and uses progressive enhancement. If the JavaScript file fails to load, or if your site is viewed on older and less capable browsers, anchor links will jump the way they normally would. + +
    + + +## Known Issues + +### `` styling + +If the `` element has been assigned a height of `100%` or `overflow: hidden`, Smooth Scroll is unable to properly calculate page distances and will not scroll to the right location. The `` element can have a fixed, non-percentage based height (ex. `500px`), or a height of `auto`, and an `overflow` of `visible`. + +### Animating from the bottom + +Animated scrolling links at the very bottom of the page (example: a "scroll to top" link) will stop animated almost immediately after they start when using certain easing patterns. This is an issue that's been around for a while and I've yet to find a good fix for it. I've found that `easeOut*` easing patterns work as expected, but other patterns can cause issues. [See this discussion for more details.](https://github.com/cferdinandi/smooth-scroll/issues/49) \ No newline at end of file diff --git a/src/docs/index.md b/src/docs/index.md old mode 100644 new mode 100755 index e55a541..a850be6 --- a/src/docs/index.md +++ b/src/docs/index.md @@ -1,3 +1,11 @@ +# Smooth Scroll + +Smooth Scroll is a lightweight script to animate scrolling to anchor links. It works great with [Gumshoe](https://github.com/cferdinandi/gumshoe). + +
    + +## Demo +

    Linear
    Linear (no other options)
    diff --git a/src/docs/license.md b/src/docs/license.md new file mode 100755 index 0000000..d796177 --- /dev/null +++ b/src/docs/license.md @@ -0,0 +1,161 @@ +# License + +Smooth Scroll has three types of licenses: + +1. **[Open Source](#open-source-license)**, for personal and open source projects. +2. **[Commercial](#commercial-license)**, for commercial projects and applications. +3. **[OEM](#oem-license)**, for when this Smooth Scroll will be bundled with a commercial interface builder, SDK, or toolkit. + +


    + + +## Open Source License + +If you're looking to use Smooth Scroll on an open source or personal project, the code is available under the [GPLv3 License](https://gomakethings.com/gpl/). GPLv3 has many terms, but the most important one is that it [requires you to license you entire project under the terms of GPLv3 as well](https://gomakethings.com/gpl/#5-conveying-modified-source-versions): + +> You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. + +You can absolutely use the open source license for commercial projects, but those projects must also be open sourced in their entirety with a GPLv3 license. + +
    + + +## Commercial License + +The Commercial License let's you use Smooth Scroll in commercial projects and applications without the provisions of GPLv3. With this license, your code is kept proprietary. + +- You can use Smooth Scroll on as many websites or applications as you'd like. +- You can include it in your own commercial products and applications, such as premium CMS themes, plugins, or templates. +- Customers and users of your products do not need to purchase their own license, as long as they're not developing their own commercial products with Smooth Scroll. + +### Buy a Commercial License + +Commercial Licenses are priced based on the number of developers working on a project that uses Smooth Scroll. Pay by credit card and instantly receive a PDF of your Commercial License. + + + + + + + + + + + + + + + + + + + + + + +
    DescriptionPrice
    A **Single Developer License** can be used by 1 developer. Each individual developer needs to purchase a separate license.Buy a Single Developer License now for $99
    A **Team License** can be used by up to 8 developers.Buy a Team License now for $399
    An **Organization License** can be used by an unlimited number of developers.Buy an Organization License now for $999
    + +You can read the full text of the Commercial License below. Email me at chris@gomakethings.com with any questions you have about licensing. + + +### The Commercial License Agreement + +This Software License Agreement (the **“Agreement”**) is between Go Make Things, LLC (**“Go Make Things”**) and You (including your agents and affiliates), a commercial licensee of Go Make Things's software. If you have not purchased a Smooth Scroll Commercial License from Go Make Things, these terms do not apply to you, and your use of the Go Make Things software is instead governed by the [GNU General Public License, version 3](https://gomakethings.com/gpl/). + +#### 1. Definitions + +- **“Application”** means any software, application, or elements that Your Licensed Developers develop using the Software or Modifications in accordance with this Agreement. +- **“End User”** means an end user of Your Application who acquires a license to such solely for their own use and not for distribution, resale, user interface design, or software development purposes. +- **“Licensed Developer”** shall mean an individual person permitted to use the Software and make Modifications for your Applications, whether such person is Your employee or a consultant or contractor providing services to You. +- **“Modification”** means any revision, adaptation, or derivative of the Software produced by You. +- The **“Software”** means Smooth Scroll version 11. + +#### 2. Commercial license grant + +Subject to the terms of this Agreement, Go Make Things grants to You a revocable, non-exclusive, non-transferable license: +- for [n licensed developers—varies based on the license your purchase] to use the Software to create Modifications and Applications; +- for You to distribute the Software and/or Modifications to an unlimited number of End Users solely as integrated into the Applications; +- and for End Users to use the Software as incorporated into Your Applications in accordance with the terms of this Agreement. + +You are entitled to receive all updates to the major version of the Software licensed by you, as well as any later version of the Software that Go Make Things, in writing, explicitly authorizes you to use. (For illustration purposes only, if you purchased a license for version 2.0, this licenses authorizes you to use version 2.9, but not 3.0.) Go Make Things makes no representation that any update will be compatible with your Application. + +#### 3. Ownership + +This is a license agreement and not an agreement for sale. Go Make Things reserves ownership of all intellectual property rights inherent in or relating to the Software and corresponding source code, which include all copyright, patent rights, all rights in relation to registered and unregistered trademarks (including service marks), confidential information (including trade secrets and know-how) and all rights other than those expressly granted by this Agreement. + +You must not remove, obscure or interfere with any copyright, acknowledgment, attribution, trademark, warning or disclaimer statement affixed to, incorporated in or otherwise applied in connection with the Software. Notwithstanding the above, you are permitted to produce, use, and distribute compressed or “minified” copies of the Software that do not bear the notices contained in the Software’s source code, so long as you otherwise comply with the terms of this license. + +#### 4. Prohibited Uses + +Your Application must have substantially different functionality than, and must not compete directly with, the Software. + +You may not distribute the Software or Modifications except as included within Your Application. + +If You produce an Application for a customer, You are responsible for ensuring that your customer does not make use of the Software except with Applications licensed herein. + +Your Application must not enable End Users to produce separate applications that incorporate the Software or Modifications. For example, if Your Application is a development toolkit or library, an application builder, a website builder that can be used to incorporate the Software into a new Application, You must obtain a separate OEM license from Go Make Things. + +#### 5. Termination + +This Agreement and the license granted hereunder shall continue until terminated in accordance with this Section. Unless otherwise specified in this Agreement, the license shall last as long as Your use of the Software is in compliance with the terms herein. + +Go Make Things shall have the right to terminate this Agreement and the license granted hereunder immediately if You breach any of the material terms of this Agreement. Upon termination of this Agreement, all licenses granted to You in this Agreement shall terminate automatically and You shall immediately cease use and distribution of the Software. + +Upon termination of this Agreement, You must cease all use of the Software. If, prior to your breach of this Agreement, you delivered Applications incorporating the Software to Your End Users, those End Users’ licenses shall survive termination. + +#### 6. Disclaimer of Warranties + +TO THE EXTENT PERMITTED BY LAW, GO MAKE THINGS DISCLAIMS ALL WARRANTIES AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE. WE DO NOT GUARANTEE THAT THE OPERATION OF THE SOFTWARE OR YOUR APPLICATION WILL BE UNINTERRUPTED OR ERROR-FREE, AND YOU ACKNOWLEDGE THAT IT IS NOT TECHNICALLY PRACTICABLE FOR US TO DO SO. + +#### 7. Limitation of Liabilities + +TO THE EXTENT PERMITTED BY LAW, IN NO EVENT SHALL GO MAKE THINGS BE LIABLE UNDER ANY LEGAL OR EQUITABLE THEORY FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LAW) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE OR THE CODE IT PRODUCES OR ANY OTHER SUBJECT MATTER RELATING TO THIS AGREEMENT, EVEN IF GO MAKE THINGS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY CASE, GO MAKE THINGS’S ENTIRE LIABILITY WITH RESPECT TO ANY SUBJECT MATTER RELATING TO THIS AGREEMENT SHALL BE LIMITED TO THE GREATER OF: (I) THE AMOUNT ACTUALLY PAID BY YOU FOR THE LICENSE, OR (II) FIVE HUNDRED DOLLARS ($500). + +#### 8. Indemnification + +While redistributing the Software or Modifications thereof as part of Your Application, You may choose to offer acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this Agreement. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, and not on Go Make Things’s behalf. + +You agree to indemnify, hold harmless, and defend Go Make Things and its owners, officers, agents, and affiliates from and against any and all claims, lawsuits and proceedings (collectively “Claims”), and all expenses, costs (including attorney's fees), judgments, damages and other liabilities resulting from such Claims, that arise or result from: +- your use of the Software in violation of this Agreement; +- the use or distribution of Your Application, except to the extent such claim is based solely on the inclusion of the Software therein; +- your Modification of the Software’s source code; or +- your accepting support, warranty, indemnity, or additional liability as described in the preceding paragraph. + +#### 9. Payment and Taxes + +All payments under this Agreement are due to Go Make Things upon Your purchase of a license to the Software. + +Each party shall be responsible for all taxes (including, but not limited to, taxes based upon its income) or levies imposed on it under applicable laws, regulations and tax treaties as a result of this Agreement and any payments made hereunder (including those required to be withheld or deducted from payments); provided that You shall be responsible for any value added tax, use tax, sales tax, or similar tax, and shall pay or reimburse Go Make Things for the same upon invoice. Each party shall furnish evidence of such paid taxes as is sufficient to enable the other party to obtain any credits available to it, including original tax withholding certificates. + +#### 10. Miscellaneous + +Software Updates and Upgrades. The license granted herein applies only to the version of the Software available when purchased in connection with the terms of this Agreement, and to any updates and/or upgrades to which You may be entitled. Any previous or subsequent license granted to You for use of the Software shall be governed by the terms and conditions of the agreement entered in connection with purchase or download of that version of the Software. + +**Survival.** The provisions of sections 4 through 10 will survive termination of this Agreement. + +**Compliance with Applicable Laws.** You agree that You will comply with all applicable laws and regulations with respect to the Software, including without limitation all export control laws and regulations. + +**Marketing.** You agree to Go Make Things’s use of Your name, trade name, and trademark, for use in Go Make Things’s marketing materials and its website, solely to identify you as a customer of Go Make Things. + +**Assignment.** This Agreement may be assigned by Go Make Things in whole or in part and will inure to the benefit of Go Make Things’s successors and assigns. You may not assign or transfer this Agreement without Go Make Things’s prior written consent. Notwithstanding the foregoing, however, if You transfer ownership of an Application to a customer for which it was developed, You may assign this Agreement to that customer (the “Assignee”) provided: +1. You provide written notice to Go Make Things prior to the effective date of such assignment; and +2. there is a written agreement, wherein the Assignee accepts the terms of this Agreement. + +**Entire Agreement.** The terms and conditions stated herein set forth the entire agreement of the parties and replace and supersede all other contracts, agreements, and understandings, written or oral, relating to the subject matter hereof. + +**Severability.** In the event that any portion of this Agreement is held to be unenforceable, such portions shall not limit or otherwise modify or affect any other portion of this Agreement. + +**Modification; Waiver.** This Agreement cannot be amended except by a written instrument executed by Go Make Things.

Go Make Things reserves the right, at any time and from time to time, to update, revise, supplement, and otherwise modify this Agreement and to impose new or additional rules, policies, terms, or conditions on your use of the Software. Such updates, revisions, supplements, modifications, and additional rules, policies, terms, and conditions (collectively referred to in this Agreement as “Additional Terms”) will be effective immediately and incorporated into this Agreement. You will be notified of any Additional Terms in writing. Your continued use of the Software following will be deemed to constitute your acceptance of any and all such Additional Terms. All Additional Terms are hereby incorporated into this Agreement by this reference.

 The failure of Go Make Things to enforce any provision of this Agreement may not be deemed a waiver of that or any other provision of this Agreement. + +**Governing Law.** This Agreement is subject to, and shall be interpreted and enforced in accordance with, the laws of the Commonwealth of Massachusetts in all respects without regard to conflict of law principles. The Courts of Bristol County, Massachusetts and Norfolk County, Massachusetts shall be the sole and exclusive Courts in which either party may attempt to enforce or establish the existence or scope of any rights, benefits or obligations under this Agreement. The UN Convention on Contracts for the International Sale of Goods is expressly excluded. + +**Government Use.** If the Software or any related documentation is licensed to the U.S. Government or any agency thereof, it will be considered to be “commercial computer software” or “commercial computer software documentation,” as those terms are used in 48 CFR § 12.212 or 48 CFR § 227.7202, and is being licensed with only those rights as are granted to all other licensees as set forth in this Agreement. + +
    + + +## OEM License + +If you'll be including Smooth Scroll in a project that can be used to build new products, websites, or applications—such as a commercial interface builder, SDK, or toolkit—you need to purchase an OEM License. + +The OEM License is customized for you. Please content me chris@gomakethings.com to discuss your project. \ No newline at end of file diff --git a/src/docs/options.md b/src/docs/options.md new file mode 100755 index 0000000..063cc32 --- /dev/null +++ b/src/docs/options.md @@ -0,0 +1,191 @@ +# Options and Settings + +Smooth Scroll includes smart defaults and works right out of the box. But if you want to customize things, it also has a robust API that provides multiple ways for you to adjust the default options and settings. + +
    + +## Global Settings + +You can pass options and callbacks into Smooth Scroll through the `init()` function: + +```javascript +smoothScroll.init({ + // Selectors + selector: '[data-scroll]', // Selector for links (must be a valid CSS selector) + selectorHeader: null, // Selector for fixed headers (must be a valid CSS selector) [optional] + + // Speed & Easing + speed: 500, // Integer. How fast to complete the scroll in milliseconds + offset: 0, // Integer or Function returning an integer. How far to offset the scrolling anchor location in pixels + easing: 'easeInOutCubic', // Easing pattern to use + + // Custom easing patterns. + // Must be an object with the easing name as the key + // Each pattern must be a function, with `time` as the argument, that returns the pattern + easingPatterns: { + myCustomEasingPattern: function (time) { + return time * (2 - time); + } + } + + // Callback API + before: function (anchor, toggle) {}, // Function to run before scrolling starts + after: function (anchor, toggle) {} // Function to run after scrolling completes +}); +``` + +**Note:** To programatically add Smooth Scroll to all anchor links on a page, pass `selector: 'a[href*="#"]'` into `init`. + +### Easing Options + +**Linear** +*Moves at the same speed from start to finish.* + +* `Linear` + + +**Ease-In** +*Gradually increases in speed.* + +* `easeInQuad` +* `easeInCubic` +* `easeInQuart` +* `easeInQuint` + + +**Ease-In-Out** +*Gradually increases in speed, peaks, and then gradually slows down.* + +* `easeInOutQuad` +* `easeInOutCubic` +* `easeInOutQuart` +* `easeInOutQuint` + + +**Ease-Out** +*Gradually decreases in speed.* + +* `easeOutQuad` +* `easeOutCubic` +* `easeOutQuart` +* `easeOutQuint` + + +Learn more about the different easing patterns and what they do at [easings.net](http://easings.net/). + +
    + + +## Override settings with data attributes + +Smooth Scroll also lets you override global settings on a link-by-link basis using the `[data-options]` data attribute. + +```markup + + Anchor Link + +``` + +***Note:*** *You must use [valid JSON](http://jsonlint.com/) in order for the `data-options` feature to work. Does not support the `callback` method.* + +
    + + +## Use Smooth Scroll events in your own scripts + +You can also call Smooth Scroll's scroll animation events in your own scripts. + +### animateScroll() +Animate scrolling to an anchor. + +```javascript +smoothScroll.animateScroll( + anchor, // Node to scroll to. ex. document.querySelector( '#bazinga' ) + toggle, // Node that toggles the animation, OR an integer. ex. document.querySelector( '#toggle' ) + options // Classes and callbacks. Same options as those passed into the init() function. +); +``` + +**Example 1** + +```javascript +var anchor = document.querySelector( '#bazinga' ); +smoothScroll.animateScroll( anchor ); +``` + +**Example 2** + +```javascript +var anchor = document.querySelector( '#bazinga' ); +var toggle = document.querySelector('#toggle'); +var options = { speed: 1000, easing: 'easeOutCubic' }; +smoothScroll.animateScroll( anchor, toggle, options ); +``` + +**Example 3** + +```javascript +// You can optionally pass in a y-position to scroll to as an integer +smoothScroll.animateScroll( 750 ); +``` + +### destroy() +Destroy the current `smoothScroll.init()`. This is called automatically during the `init` function to remove any existing initializations. + +```javascript +smoothScroll.destroy(); +``` + +
    + + +## Fixed Headers + +If you're using a fixed header, Smooth Scroll will automatically offset scroll distances by the header height. Pass in a valid CSS selector for your fixed header as an option to the `init`. + +If you have multiple fixed headers, pass in the last one in the markup. + +```markup + +... + +``` + +
    + + +## Animating links to other pages + +This is an often requested feature, but Smooth Scroll does not include an option to animate scrolling to links on other pages. + +You can attempt to implement it using the API, but it's very difficult to prevent the automatic browser jump when the page loads, and anything I've done to work around it results in weird, janky issues, so I've decided to leave this out of the core. Here's a potential workaround... + +1. Do *not* add the `data-scroll` attribute to links to other pages. Treat them like normal links, and include your anchor link hash as normal. + + ```markup + + ``` +2. Add the following script to the footer of your page, after the `smoothScroll.init()` function. + + ```markup + + ``` \ No newline at end of file diff --git a/src/docs/setup.md b/src/docs/setup.md new file mode 100755 index 0000000..622bf3b --- /dev/null +++ b/src/docs/setup.md @@ -0,0 +1,30 @@ +# Getting Started + +Compiled and production-ready code can be found in the `dist` directory. The `src` directory contains development code. + + +## 1. Include Smooth Scroll on your site. + +```markup + +``` + +## 2. Add the markup to your HTML. + +Turn anchor links into Smooth Scroll links by adding the `[data-scroll]` data attribute. Give the anchor location an ID just like you normally would. + +```markup +Anchor Link +... +Bazinga! +``` + +## 3. Initialize Smooth Scroll. + +In the footer of your page, after the content, initialize Smooth Scroll. And that's it, you're done. Nice work! + +```markup + +``` \ No newline at end of file diff --git a/src/docs/source.md b/src/docs/source.md new file mode 100644 index 0000000..36f1707 --- /dev/null +++ b/src/docs/source.md @@ -0,0 +1,19 @@ +# Working with the Source Files + +If you would prefer, you can work with the development code in the `src` directory using the included [Gulp build system](http://gulpjs.com/). This compiles, lints, and minifies code. + +## Dependencies +Make sure these are installed first. + +* [Node.js](http://nodejs.org) +* [Gulp](http://gulpjs.com) `sudo npm install -g gulp` + +## Quick Start + +1. In bash/terminal/command line, `cd` into your project directory. +2. Run `npm install` to install required files. +3. When it's done installing, run one of the task runners to get going: + * `gulp` manually compiles files. + * `gulp watch` automatically compiles files when changes are made and applies changes using [LiveReload](http://livereload.com/). + +Compiled and production-ready code can be found in the `dist` directory. The `src` directory contains development code. \ No newline at end of file diff --git a/src/js/smooth-scroll.js b/src/js/smooth-scroll.js index 2dae938..ef29536 100755 --- a/src/js/smooth-scroll.js +++ b/src/js/smooth-scroll.js @@ -20,12 +20,19 @@ // Default settings var defaults = { + // Selectors selector: '[data-scroll]', selectorHeader: null, + + // Speed & Easing speed: 500, - easing: 'easeInOutCubic', offset: 0, - callback: function () {} + easing: 'easeInOutCubic', + easingPatterns: {}, + + // Callback API + before: function () {}, + after: function () {} }; @@ -212,6 +219,8 @@ */ var easingPattern = function ( type, time ) { var pattern; + + // Default Easing Patterns if ( type === 'easeInQuad' ) pattern = time * time; // accelerating from zero velocity if ( type === 'easeOutQuad' ) pattern = time * (2 - time); // decelerating to zero velocity if ( type === 'easeInOutQuad' ) pattern = time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration @@ -224,6 +233,14 @@ if ( type === 'easeInQuint' ) pattern = time * time * time * time * time; // accelerating from zero velocity if ( type === 'easeOutQuint' ) pattern = 1 + (--time) * time * time * time * time; // decelerating to zero velocity if ( type === 'easeInOutQuint' ) pattern = time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration + + // Custom Easing Patterns + if ( settings.easingPatterns[type] ) { + pattern = settings.easingPatterns[type]( time ); + } + + console.log(pattern || time); + return pattern || time; // no easing, no acceleration }; @@ -359,7 +376,7 @@ adjustFocus( anchor, endLocation, isNum ); // Run callback after animation complete - animateSettings.callback( anchor, toggle ); + animateSettings.after( anchor, toggle ); } }; @@ -394,6 +411,9 @@ root.scrollTo( 0, 0 ); } + // Run callback before animation starts + animateSettings.before( anchor, toggle ); + // Start scrolling animation startAnimateScroll(); From 105c2ac1f858878551f4c1dac5867ef304fa47f4 Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Mon, 1 May 2017 17:19:42 -0400 Subject: [PATCH 006/104] Updated docs (#325) --- docs/browsers.html | 2 +- docs/index.html | 2 +- docs/license.html | 4 ++-- docs/options.html | 2 +- docs/setup.html | 2 +- docs/source.html | 2 +- src/docs/_templates/_footer.html | 2 +- src/docs/license.md | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/browsers.html b/docs/browsers.html index cbcf76e..74a456e 100755 --- a/docs/browsers.html +++ b/docs/browsers.html @@ -96,7 +96,7 @@

    Animating from the bottom

    offset: 5 }); highlightActiveNav.init({ - urlPrefix: '/kraken/' + urlPrefix: '/smooth-scroll/' }); diff --git a/docs/index.html b/docs/index.html index ad16d5f..56c4214 100755 --- a/docs/index.html +++ b/docs/index.html @@ -146,7 +146,7 @@

    Demo

    offset: 5 }); highlightActiveNav.init({ - urlPrefix: '/kraken/' + urlPrefix: '/smooth-scroll/' }); diff --git a/docs/license.html b/docs/license.html index 6fb2b00..dfa2845 100755 --- a/docs/license.html +++ b/docs/license.html @@ -118,7 +118,7 @@

    1. Definitions

    2. Commercial license grant

    Subject to the terms of this Agreement, Go Make Things grants to You a revocable, non-exclusive, non-transferable license:

      -
    • for [n licensed developers—varies based on the license your purchase] to use the Software to create Modifications and Applications;
    • +
    • for [n Licensed Developers—varies based on the license your purchase] to use the Software to create Modifications and Applications;
    • for You to distribute the Software and/or Modifications to an unlimited number of End Users solely as integrated into the Applications;
    • and for End Users to use the Software as incorporated into Your Applications in accordance with the terms of this Agreement.
    @@ -204,7 +204,7 @@

    OEM License

    offset: 5 }); highlightActiveNav.init({ - urlPrefix: '/kraken/' + urlPrefix: '/smooth-scroll/' }); diff --git a/docs/options.html b/docs/options.html index bebdc72..ebc6deb 100755 --- a/docs/options.html +++ b/docs/options.html @@ -233,7 +233,7 @@ offset: 5 }); highlightActiveNav.init({ - urlPrefix: '/kraken/' + urlPrefix: '/smooth-scroll/' }); diff --git a/docs/setup.html b/docs/setup.html index 52a7217..ef4aa0a 100755 --- a/docs/setup.html +++ b/docs/setup.html @@ -102,7 +102,7 @@

    3. Initialize Smooth Scroll.

    offset: 5 }); highlightActiveNav.init({ - urlPrefix: '/kraken/' + urlPrefix: '/smooth-scroll/' }); diff --git a/docs/source.html b/docs/source.html index 16ce46f..959d49c 100644 --- a/docs/source.html +++ b/docs/source.html @@ -104,7 +104,7 @@

    Quick Start

    offset: 5 }); highlightActiveNav.init({ - urlPrefix: '/kraken/' + urlPrefix: '/smooth-scroll/' }); diff --git a/src/docs/_templates/_footer.html b/src/docs/_templates/_footer.html index 13e8518..56e51ed 100755 --- a/src/docs/_templates/_footer.html +++ b/src/docs/_templates/_footer.html @@ -30,7 +30,7 @@ offset: 5 }); highlightActiveNav.init({ - urlPrefix: '/kraken/' + urlPrefix: '/smooth-scroll/' }); diff --git a/src/docs/license.md b/src/docs/license.md index d796177..7ece076 100755 --- a/src/docs/license.md +++ b/src/docs/license.md @@ -73,7 +73,7 @@ This Software License Agreement (the **“Agreement”**) is between Go Make Thi #### 2. Commercial license grant Subject to the terms of this Agreement, Go Make Things grants to You a revocable, non-exclusive, non-transferable license: -- for [n licensed developers—varies based on the license your purchase] to use the Software to create Modifications and Applications; +- for [n Licensed Developers—varies based on the license your purchase] to use the Software to create Modifications and Applications; - for You to distribute the Software and/or Modifications to an unlimited number of End Users solely as integrated into the Applications; - and for End Users to use the Software as incorporated into Your Applications in accordance with the terms of this Agreement. From f40cf094140cb1166b1968e22e53cd2e84658f61 Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Mon, 1 May 2017 17:22:37 -0400 Subject: [PATCH 007/104] Development (#326) * Updated docs * fixed typo --- docs/license.html | 2 +- src/docs/license.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/license.html b/docs/license.html index dfa2845..5e13706 100755 --- a/docs/license.html +++ b/docs/license.html @@ -99,7 +99,7 @@

    Buy a Commercial License

    An Organization License can be used by an unlimited number of developers. - Buy an Organization License now for $999 + Buy an Organization License now for $999 diff --git a/src/docs/license.md b/src/docs/license.md index 7ece076..3096ae4 100755 --- a/src/docs/license.md +++ b/src/docs/license.md @@ -50,7 +50,7 @@ Commercial Licenses are priced based on the number of developers working on a pr An **Organization License** can be used by an unlimited number of developers. - Buy an Organization License now for $999 + Buy an Organization License now for $999 From f586e2624c291169f8869cf92ac6f060d3f679c3 Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Mon, 1 May 2017 17:25:47 -0400 Subject: [PATCH 008/104] Create CNAME --- docs/CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 0000000..2a2cd4d --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +smooth-scroll.gomakethings.com \ No newline at end of file From a6c945abdebc0945702dd846fd2f5bc7d11d303f Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Mon, 1 May 2017 17:30:34 -0400 Subject: [PATCH 009/104] Delete CNAME --- docs/CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index 2a2cd4d..0000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -smooth-scroll.gomakethings.com \ No newline at end of file From d2680cab69c778e9b8d54016b82bb42fa6680f4b Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Mon, 1 May 2017 17:42:12 -0400 Subject: [PATCH 010/104] Create CNAME --- docs/CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 0000000..2a2cd4d --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +smooth-scroll.gomakethings.com \ No newline at end of file From b7f88a5eb65ffc8d8fefb59ac340742034e689fe Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Mon, 1 May 2017 17:49:43 -0400 Subject: [PATCH 011/104] Development (#327) * Updated docs * fixed typo * Added CNAME config * Updated * Added CNAME --- CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100755 CNAME diff --git a/CNAME b/CNAME new file mode 100755 index 0000000..3610aa3 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +https://smooth-scroll.gomakethings.com \ No newline at end of file From 7fef8029068cdad5b2d3579bb4615d9c93c33504 Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Mon, 1 May 2017 17:59:27 -0400 Subject: [PATCH 012/104] Delete CNAME --- docs/CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index 2a2cd4d..0000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -smooth-scroll.gomakethings.com \ No newline at end of file From 9728da76cf98d2fcacaca62b55f94c65eb74d6ff Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Mon, 1 May 2017 18:00:21 -0400 Subject: [PATCH 013/104] Updated CNAME (#328) * Updated CNAME * Removed CNAME --- gulpfile.js | 1 + 1 file changed, 1 insertion(+) diff --git a/gulpfile.js b/gulpfile.js index ffadced..7af77fe 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -147,6 +147,7 @@ gulp.task('copy:assets', ['clean:docs'], function() { .pipe(gulp.dest(paths.docs.output + '/assets')); }); + // Remove prexisting content from docs folder gulp.task('clean:docs', function () { return del.sync(paths.docs.output); From e5c48d475cca647ec9ba32521942577ef5a194dd Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Mon, 1 May 2017 18:02:32 -0400 Subject: [PATCH 014/104] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ee4711b..5832886 100755 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A lightweight script to animate scrolling to anchor links. Smooth Scroll works great with [Gumshoe](https://github.com/cferdinandi/gumshoe). -[View the demo and documentation to get started](http://cferdinandi.github.com/smooth-scroll/). +[View the demo and documentation to get started](https://cferdinandi.github.io/smooth-scroll/). ## How to Contribute @@ -11,4 +11,4 @@ Please review the [contributing guidelines](CONTRIBUTING.md). ## License -The code is available under the [GPLv3 License](LICENSE.md) or a [Commercial License](https://cferdinandi.github.io/smooth-scroll/license#commercial-license). \ No newline at end of file +The code is available under the [GPLv3 License](LICENSE.md) or a [Commercial License](https://cferdinandi.github.io/smooth-scroll/license#commercial-license). From 49d7020373e3f7056de30a61743540fc7f722658 Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Mon, 1 May 2017 19:23:57 -0400 Subject: [PATCH 015/104] Development (#329) * Updated CNAME * Removed CNAME * v11.0.1 Removed console.log() --- dist/js/smooth-scroll.js | 4 +--- dist/js/smooth-scroll.min.js | 4 ++-- docs/dist/js/smooth-scroll.js | 4 +--- docs/dist/js/smooth-scroll.min.js | 4 ++-- package.json | 2 +- src/js/smooth-scroll.js | 2 -- 6 files changed, 7 insertions(+), 13 deletions(-) diff --git a/dist/js/smooth-scroll.js b/dist/js/smooth-scroll.js index bf4e1a8..d763bc6 100755 --- a/dist/js/smooth-scroll.js +++ b/dist/js/smooth-scroll.js @@ -1,5 +1,5 @@ /*! - * smooth-scroll v11.0.0: Animate scrolling to anchor links + * smooth-scroll v11.0.1: Animate scrolling to anchor links * (c) 2017 Chris Ferdinandi * GPL-3.0 License * http://github.com/cferdinandi/smooth-scroll @@ -246,8 +246,6 @@ pattern = settings.easingPatterns[type]( time ); } - console.log(pattern || time); - return pattern || time; // no easing, no acceleration }; diff --git a/dist/js/smooth-scroll.min.js b/dist/js/smooth-scroll.min.js index 5161d16..184687a 100755 --- a/dist/js/smooth-scroll.min.js +++ b/dist/js/smooth-scroll.min.js @@ -1,2 +1,2 @@ -/*! smooth-scroll v11.0.0 | (c) 2017 Chris Ferdinandi | GPL-3.0 License | http://github.com/cferdinandi/smooth-scroll */ -!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,i,l={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,offset:0,easing:"easeInOutCubic",easingPatterns:{},before:function(){},after:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(;n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?a+="\\"+t.toString(16)+" ":a+=t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,n){var o;return"easeInQuad"===e&&(o=n*n),"easeOutQuad"===e&&(o=n*(2-n)),"easeInOutQuad"===e&&(o=n<.5?2*n*n:(4-2*n)*n-1),"easeInCubic"===e&&(o=n*n*n),"easeOutCubic"===e&&(o=--n*n*n+1),"easeInOutCubic"===e&&(o=n<.5?4*n*n*n:(n-1)*(2*n-2)*(2*n-2)+1),"easeInQuart"===e&&(o=n*n*n*n),"easeOutQuart"===e&&(o=1- --n*n*n*n),"easeInOutQuart"===e&&(o=n<.5?8*n*n*n*n:1-8*--n*n*n*n),"easeInQuint"===e&&(o=n*n*n*n*n),"easeOutQuint"===e&&(o=1+--n*n*n*n*n),"easeInOutQuint"===e&&(o=n<.5?16*n*n*n*n*n:1+16*--n*n*n*n*n),t.easingPatterns[e]&&(o=t.easingPatterns[e](n)),console.log(o||n),o||n},g=function(e,t,n){var o=0;if(e.offsetParent)do{o+=e.offsetTop,e=e.offsetParent}while(e);return o=Math.max(o-t-n,0),Math.min(o,y()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},y=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},v=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};l.animateScroll=function(n,o,c){var l=v(o?o.getAttribute("data-options"):null),u=f(t||s,c||{},l),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=d?n:g(h,a,parseInt("function"==typeof u.offset?u.offset():u.offset,10)),H=I-m,A=y(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,d),u.after(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,i)};0===e.pageYOffset&&e.scrollTo(0,0),u.before(n,o),(function(){clearInterval(i),i=setInterval(M,16)})()}};var E=function(t){try{m(decodeURIComponent(e.location.hash))}catch(t){m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),l.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector))&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href)){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return l.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,i=null)},l.init=function(n){u&&(l.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},l})); \ No newline at end of file +/*! smooth-scroll v11.0.1 | (c) 2017 Chris Ferdinandi | GPL-3.0 License | http://github.com/cferdinandi/smooth-scroll */ +!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,i,l={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,offset:0,easing:"easeInOutCubic",easingPatterns:{},before:function(){},after:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(;n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?a+="\\"+t.toString(16)+" ":a+=t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,n){var o;return"easeInQuad"===e&&(o=n*n),"easeOutQuad"===e&&(o=n*(2-n)),"easeInOutQuad"===e&&(o=n<.5?2*n*n:(4-2*n)*n-1),"easeInCubic"===e&&(o=n*n*n),"easeOutCubic"===e&&(o=--n*n*n+1),"easeInOutCubic"===e&&(o=n<.5?4*n*n*n:(n-1)*(2*n-2)*(2*n-2)+1),"easeInQuart"===e&&(o=n*n*n*n),"easeOutQuart"===e&&(o=1- --n*n*n*n),"easeInOutQuart"===e&&(o=n<.5?8*n*n*n*n:1-8*--n*n*n*n),"easeInQuint"===e&&(o=n*n*n*n*n),"easeOutQuint"===e&&(o=1+--n*n*n*n*n),"easeInOutQuint"===e&&(o=n<.5?16*n*n*n*n*n:1+16*--n*n*n*n*n),t.easingPatterns[e]&&(o=t.easingPatterns[e](n)),o||n},g=function(e,t,n){var o=0;if(e.offsetParent)do{o+=e.offsetTop,e=e.offsetParent}while(e);return o=Math.max(o-t-n,0),Math.min(o,y()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},y=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},v=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};l.animateScroll=function(n,o,c){var l=v(o?o.getAttribute("data-options"):null),u=f(t||s,c||{},l),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=d?n:g(h,a,parseInt("function"==typeof u.offset?u.offset():u.offset,10)),H=I-m,A=y(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,d),u.after(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,i)};0===e.pageYOffset&&e.scrollTo(0,0),u.before(n,o),(function(){clearInterval(i),i=setInterval(M,16)})()}};var E=function(t){try{m(decodeURIComponent(e.location.hash))}catch(t){m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),l.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector))&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href)){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return l.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,i=null)},l.init=function(n){u&&(l.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},l})); \ No newline at end of file diff --git a/docs/dist/js/smooth-scroll.js b/docs/dist/js/smooth-scroll.js index bf4e1a8..d763bc6 100755 --- a/docs/dist/js/smooth-scroll.js +++ b/docs/dist/js/smooth-scroll.js @@ -1,5 +1,5 @@ /*! - * smooth-scroll v11.0.0: Animate scrolling to anchor links + * smooth-scroll v11.0.1: Animate scrolling to anchor links * (c) 2017 Chris Ferdinandi * GPL-3.0 License * http://github.com/cferdinandi/smooth-scroll @@ -246,8 +246,6 @@ pattern = settings.easingPatterns[type]( time ); } - console.log(pattern || time); - return pattern || time; // no easing, no acceleration }; diff --git a/docs/dist/js/smooth-scroll.min.js b/docs/dist/js/smooth-scroll.min.js index 5161d16..184687a 100755 --- a/docs/dist/js/smooth-scroll.min.js +++ b/docs/dist/js/smooth-scroll.min.js @@ -1,2 +1,2 @@ -/*! smooth-scroll v11.0.0 | (c) 2017 Chris Ferdinandi | GPL-3.0 License | http://github.com/cferdinandi/smooth-scroll */ -!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,i,l={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,offset:0,easing:"easeInOutCubic",easingPatterns:{},before:function(){},after:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(;n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?a+="\\"+t.toString(16)+" ":a+=t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,n){var o;return"easeInQuad"===e&&(o=n*n),"easeOutQuad"===e&&(o=n*(2-n)),"easeInOutQuad"===e&&(o=n<.5?2*n*n:(4-2*n)*n-1),"easeInCubic"===e&&(o=n*n*n),"easeOutCubic"===e&&(o=--n*n*n+1),"easeInOutCubic"===e&&(o=n<.5?4*n*n*n:(n-1)*(2*n-2)*(2*n-2)+1),"easeInQuart"===e&&(o=n*n*n*n),"easeOutQuart"===e&&(o=1- --n*n*n*n),"easeInOutQuart"===e&&(o=n<.5?8*n*n*n*n:1-8*--n*n*n*n),"easeInQuint"===e&&(o=n*n*n*n*n),"easeOutQuint"===e&&(o=1+--n*n*n*n*n),"easeInOutQuint"===e&&(o=n<.5?16*n*n*n*n*n:1+16*--n*n*n*n*n),t.easingPatterns[e]&&(o=t.easingPatterns[e](n)),console.log(o||n),o||n},g=function(e,t,n){var o=0;if(e.offsetParent)do{o+=e.offsetTop,e=e.offsetParent}while(e);return o=Math.max(o-t-n,0),Math.min(o,y()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},y=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},v=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};l.animateScroll=function(n,o,c){var l=v(o?o.getAttribute("data-options"):null),u=f(t||s,c||{},l),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=d?n:g(h,a,parseInt("function"==typeof u.offset?u.offset():u.offset,10)),H=I-m,A=y(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,d),u.after(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,i)};0===e.pageYOffset&&e.scrollTo(0,0),u.before(n,o),(function(){clearInterval(i),i=setInterval(M,16)})()}};var E=function(t){try{m(decodeURIComponent(e.location.hash))}catch(t){m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),l.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector))&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href)){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return l.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,i=null)},l.init=function(n){u&&(l.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},l})); \ No newline at end of file +/*! smooth-scroll v11.0.1 | (c) 2017 Chris Ferdinandi | GPL-3.0 License | http://github.com/cferdinandi/smooth-scroll */ +!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,i,l={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,offset:0,easing:"easeInOutCubic",easingPatterns:{},before:function(){},after:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(;n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?a+="\\"+t.toString(16)+" ":a+=t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,n){var o;return"easeInQuad"===e&&(o=n*n),"easeOutQuad"===e&&(o=n*(2-n)),"easeInOutQuad"===e&&(o=n<.5?2*n*n:(4-2*n)*n-1),"easeInCubic"===e&&(o=n*n*n),"easeOutCubic"===e&&(o=--n*n*n+1),"easeInOutCubic"===e&&(o=n<.5?4*n*n*n:(n-1)*(2*n-2)*(2*n-2)+1),"easeInQuart"===e&&(o=n*n*n*n),"easeOutQuart"===e&&(o=1- --n*n*n*n),"easeInOutQuart"===e&&(o=n<.5?8*n*n*n*n:1-8*--n*n*n*n),"easeInQuint"===e&&(o=n*n*n*n*n),"easeOutQuint"===e&&(o=1+--n*n*n*n*n),"easeInOutQuint"===e&&(o=n<.5?16*n*n*n*n*n:1+16*--n*n*n*n*n),t.easingPatterns[e]&&(o=t.easingPatterns[e](n)),o||n},g=function(e,t,n){var o=0;if(e.offsetParent)do{o+=e.offsetTop,e=e.offsetParent}while(e);return o=Math.max(o-t-n,0),Math.min(o,y()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},y=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},v=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};l.animateScroll=function(n,o,c){var l=v(o?o.getAttribute("data-options"):null),u=f(t||s,c||{},l),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=d?n:g(h,a,parseInt("function"==typeof u.offset?u.offset():u.offset,10)),H=I-m,A=y(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,d),u.after(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,i)};0===e.pageYOffset&&e.scrollTo(0,0),u.before(n,o),(function(){clearInterval(i),i=setInterval(M,16)})()}};var E=function(t){try{m(decodeURIComponent(e.location.hash))}catch(t){m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),l.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector))&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href)){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return l.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,i=null)},l.init=function(n){u&&(l.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},l})); \ No newline at end of file diff --git a/package.json b/package.json index 2671b64..974e812 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smooth-scroll", - "version": "11.0.0", + "version": "11.0.1", "description": "Animate scrolling to anchor links", "main": "./dist/js/smooth-scroll.min.js", "author": { diff --git a/src/js/smooth-scroll.js b/src/js/smooth-scroll.js index ef29536..e99e192 100755 --- a/src/js/smooth-scroll.js +++ b/src/js/smooth-scroll.js @@ -239,8 +239,6 @@ pattern = settings.easingPatterns[type]( time ); } - console.log(pattern || time); - return pattern || time; // no easing, no acceleration }; From 7e50f4badd2a7c1e3a41dc19f7dc51256ad3128b Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Tue, 2 May 2017 10:42:41 -0400 Subject: [PATCH 016/104] Create CNAME --- docs/CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 0000000..5baa2b7 --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +smoothscroll.gomakethings.com From 16174f6f6e349235873b7f7c7254df50f9c459d1 Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Tue, 2 May 2017 10:43:04 -0400 Subject: [PATCH 017/104] Delete CNAME --- docs/CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index 5baa2b7..0000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -smoothscroll.gomakethings.com From 5c9442bd5d209ce1706486874015c13b21a539a1 Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Tue, 2 May 2017 10:43:33 -0400 Subject: [PATCH 018/104] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5832886..c34a920 100755 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A lightweight script to animate scrolling to anchor links. Smooth Scroll works great with [Gumshoe](https://github.com/cferdinandi/gumshoe). -[View the demo and documentation to get started](https://cferdinandi.github.io/smooth-scroll/). +[View the demo and documentation to get started](). ## How to Contribute From 2a65c7c57a1b04f491a5653f4dbaec3b6603682a Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Tue, 2 May 2017 10:43:40 -0400 Subject: [PATCH 019/104] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c34a920..5832886 100755 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A lightweight script to animate scrolling to anchor links. Smooth Scroll works great with [Gumshoe](https://github.com/cferdinandi/gumshoe). -[View the demo and documentation to get started](). +[View the demo and documentation to get started](https://cferdinandi.github.io/smooth-scroll/). ## How to Contribute From b0cb0d23379ca1fbce99c435f0e266b5f9e0c671 Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Tue, 2 May 2017 11:32:06 -0400 Subject: [PATCH 020/104] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5832886..3865e01 100755 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A lightweight script to animate scrolling to anchor links. Smooth Scroll works great with [Gumshoe](https://github.com/cferdinandi/gumshoe). -[View the demo and documentation to get started](https://cferdinandi.github.io/smooth-scroll/). +[View the demo and documentation to get started](https://cferdinandi.github.io/smooth-scroll/index). ## How to Contribute From c06118831241c45392e8ab886b081e07954e5e75 Mon Sep 17 00:00:00 2001 From: Chris Ferdinandi Date: Tue, 2 May 2017 13:54:03 -0400 Subject: [PATCH 021/104] v2.0.2 (#330) - Updated docs - Fixed bug with new custom easing patterns --- CNAME | 1 - README.md | 4 +- dist/js/smooth-scroll.js | 34 +++--- dist/js/smooth-scroll.min.js | 4 +- docs/assets/img/favicon.ico | Bin 0 -> 8348 bytes docs/assets/js/houdini.min.js | 2 + docs/browsers.html | 9 +- docs/dist/js/smooth-scroll.js | 34 +++--- docs/dist/js/smooth-scroll.min.js | 4 +- docs/extras.html | 171 ++++++++++++++++++++++++++++++ docs/index.html | 8 +- docs/license.html | 12 ++- docs/options.html | 37 ++----- docs/setup.html | 39 ++++++- docs/source.html | 112 ------------------- package.json | 2 +- src/docs/_templates/_footer.html | 2 +- src/docs/_templates/_header.html | 6 +- src/docs/assets/img/favicon.ico | Bin 0 -> 8348 bytes src/docs/assets/js/houdini.min.js | 2 + src/docs/browsers.md | 2 + src/docs/extras.md | 85 +++++++++++++++ src/docs/license.md | 4 +- src/docs/options.md | 35 +----- src/docs/setup.md | 34 +++++- src/docs/source.md | 19 ---- src/js/smooth-scroll.js | 32 +++--- 27 files changed, 425 insertions(+), 269 deletions(-) delete mode 100755 CNAME create mode 100755 docs/assets/img/favicon.ico create mode 100644 docs/assets/js/houdini.min.js create mode 100644 docs/extras.html delete mode 100644 docs/source.html create mode 100755 src/docs/assets/img/favicon.ico create mode 100644 src/docs/assets/js/houdini.min.js create mode 100644 src/docs/extras.md delete mode 100644 src/docs/source.md diff --git a/CNAME b/CNAME deleted file mode 100755 index 3610aa3..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -https://smooth-scroll.gomakethings.com \ No newline at end of file diff --git a/README.md b/README.md index 3865e01..ee4711b 100755 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A lightweight script to animate scrolling to anchor links. Smooth Scroll works great with [Gumshoe](https://github.com/cferdinandi/gumshoe). -[View the demo and documentation to get started](https://cferdinandi.github.io/smooth-scroll/index). +[View the demo and documentation to get started](http://cferdinandi.github.com/smooth-scroll/). ## How to Contribute @@ -11,4 +11,4 @@ Please review the [contributing guidelines](CONTRIBUTING.md). ## License -The code is available under the [GPLv3 License](LICENSE.md) or a [Commercial License](https://cferdinandi.github.io/smooth-scroll/license#commercial-license). +The code is available under the [GPLv3 License](LICENSE.md) or a [Commercial License](https://cferdinandi.github.io/smooth-scroll/license#commercial-license). \ No newline at end of file diff --git a/dist/js/smooth-scroll.js b/dist/js/smooth-scroll.js index d763bc6..e48e2b1 100755 --- a/dist/js/smooth-scroll.js +++ b/dist/js/smooth-scroll.js @@ -1,5 +1,5 @@ /*! - * smooth-scroll v11.0.1: Animate scrolling to anchor links + * smooth-scroll v11.0.2: Animate scrolling to anchor links * (c) 2017 Chris Ferdinandi * GPL-3.0 License * http://github.com/cferdinandi/smooth-scroll @@ -224,26 +224,26 @@ * @param {Number} time Time animation should take to complete * @returns {Number} */ - var easingPattern = function ( type, time ) { + var easingPattern = function ( settings, time ) { var pattern; // Default Easing Patterns - if ( type === 'easeInQuad' ) pattern = time * time; // accelerating from zero velocity - if ( type === 'easeOutQuad' ) pattern = time * (2 - time); // decelerating to zero velocity - if ( type === 'easeInOutQuad' ) pattern = time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration - if ( type === 'easeInCubic' ) pattern = time * time * time; // accelerating from zero velocity - if ( type === 'easeOutCubic' ) pattern = (--time) * time * time + 1; // decelerating to zero velocity - if ( type === 'easeInOutCubic' ) pattern = time < 0.5 ? 4 * time * time * time : (time - 1) * (2 * time - 2) * (2 * time - 2) + 1; // acceleration until halfway, then deceleration - if ( type === 'easeInQuart' ) pattern = time * time * time * time; // accelerating from zero velocity - if ( type === 'easeOutQuart' ) pattern = 1 - (--time) * time * time * time; // decelerating to zero velocity - if ( type === 'easeInOutQuart' ) pattern = time < 0.5 ? 8 * time * time * time * time : 1 - 8 * (--time) * time * time * time; // acceleration until halfway, then deceleration - if ( type === 'easeInQuint' ) pattern = time * time * time * time * time; // accelerating from zero velocity - if ( type === 'easeOutQuint' ) pattern = 1 + (--time) * time * time * time * time; // decelerating to zero velocity - if ( type === 'easeInOutQuint' ) pattern = time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration + if ( settings.easing === 'easeInQuad' ) pattern = time * time; // accelerating from zero velocity + if ( settings.easing === 'easeOutQuad' ) pattern = time * (2 - time); // decelerating to zero velocity + if ( settings.easing === 'easeInOutQuad' ) pattern = time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration + if ( settings.easing === 'easeInCubic' ) pattern = time * time * time; // accelerating from zero velocity + if ( settings.easing === 'easeOutCubic' ) pattern = (--time) * time * time + 1; // decelerating to zero velocity + if ( settings.easing === 'easeInOutCubic' ) pattern = time < 0.5 ? 4 * time * time * time : (time - 1) * (2 * time - 2) * (2 * time - 2) + 1; // acceleration until halfway, then deceleration + if ( settings.easing === 'easeInQuart' ) pattern = time * time * time * time; // accelerating from zero velocity + if ( settings.easing === 'easeOutQuart' ) pattern = 1 - (--time) * time * time * time; // decelerating to zero velocity + if ( settings.easing === 'easeInOutQuart' ) pattern = time < 0.5 ? 8 * time * time * time * time : 1 - 8 * (--time) * time * time * time; // acceleration until halfway, then deceleration + if ( settings.easing === 'easeInQuint' ) pattern = time * time * time * time * time; // accelerating from zero velocity + if ( settings.easing === 'easeOutQuint' ) pattern = 1 + (--time) * time * time * time * time; // decelerating to zero velocity + if ( settings.easing === 'easeInOutQuint' ) pattern = time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration // Custom Easing Patterns - if ( settings.easingPatterns[type] ) { - pattern = settings.easingPatterns[type]( time ); + if ( settings.easingPatterns[settings.easing] ) { + pattern = settings.easingPatterns[settings.easing]( time ); } return pattern || time; // no easing, no acceleration @@ -394,7 +394,7 @@ timeLapsed += 16; percentage = ( timeLapsed / parseInt(animateSettings.speed, 10) ); percentage = ( percentage > 1 ) ? 1 : percentage; - position = startLocation + ( distance * easingPattern(animateSettings.easing, percentage) ); + position = startLocation + ( distance * easingPattern(animateSettings, percentage) ); root.scrollTo( 0, Math.floor(position) ); stopAnimateScroll(position, endLocation, animationInterval); }; diff --git a/dist/js/smooth-scroll.min.js b/dist/js/smooth-scroll.min.js index 184687a..736d520 100755 --- a/dist/js/smooth-scroll.min.js +++ b/dist/js/smooth-scroll.min.js @@ -1,2 +1,2 @@ -/*! smooth-scroll v11.0.1 | (c) 2017 Chris Ferdinandi | GPL-3.0 License | http://github.com/cferdinandi/smooth-scroll */ -!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,i,l={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,offset:0,easing:"easeInOutCubic",easingPatterns:{},before:function(){},after:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(;n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?a+="\\"+t.toString(16)+" ":a+=t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,n){var o;return"easeInQuad"===e&&(o=n*n),"easeOutQuad"===e&&(o=n*(2-n)),"easeInOutQuad"===e&&(o=n<.5?2*n*n:(4-2*n)*n-1),"easeInCubic"===e&&(o=n*n*n),"easeOutCubic"===e&&(o=--n*n*n+1),"easeInOutCubic"===e&&(o=n<.5?4*n*n*n:(n-1)*(2*n-2)*(2*n-2)+1),"easeInQuart"===e&&(o=n*n*n*n),"easeOutQuart"===e&&(o=1- --n*n*n*n),"easeInOutQuart"===e&&(o=n<.5?8*n*n*n*n:1-8*--n*n*n*n),"easeInQuint"===e&&(o=n*n*n*n*n),"easeOutQuint"===e&&(o=1+--n*n*n*n*n),"easeInOutQuint"===e&&(o=n<.5?16*n*n*n*n*n:1+16*--n*n*n*n*n),t.easingPatterns[e]&&(o=t.easingPatterns[e](n)),o||n},g=function(e,t,n){var o=0;if(e.offsetParent)do{o+=e.offsetTop,e=e.offsetParent}while(e);return o=Math.max(o-t-n,0),Math.min(o,y()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},y=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},v=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};l.animateScroll=function(n,o,c){var l=v(o?o.getAttribute("data-options"):null),u=f(t||s,c||{},l),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=d?n:g(h,a,parseInt("function"==typeof u.offset?u.offset():u.offset,10)),H=I-m,A=y(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,d),u.after(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,i)};0===e.pageYOffset&&e.scrollTo(0,0),u.before(n,o),(function(){clearInterval(i),i=setInterval(M,16)})()}};var E=function(t){try{m(decodeURIComponent(e.location.hash))}catch(t){m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),l.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector))&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href)){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return l.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,i=null)},l.init=function(n){u&&(l.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},l})); \ No newline at end of file +/*! smooth-scroll v11.0.2 | (c) 2017 Chris Ferdinandi | GPL-3.0 License | http://github.com/cferdinandi/smooth-scroll */ +!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,i,c,l={},s="querySelector"in document&&"addEventListener"in e,u={selector:"[data-scroll]",selectorHeader:null,speed:500,offset:0,easing:"easeInOutCubic",easingPatterns:{},before:function(){},after:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(;n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",i=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===i?a+="\\"+t.toString(16)+" ":a+=t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,t){var n;return"easeInQuad"===e.easing&&(n=t*t),"easeOutQuad"===e.easing&&(n=t*(2-t)),"easeInOutQuad"===e.easing&&(n=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e.easing&&(n=t*t*t),"easeOutCubic"===e.easing&&(n=--t*t*t+1),"easeInOutCubic"===e.easing&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e.easing&&(n=t*t*t*t),"easeOutQuart"===e.easing&&(n=1- --t*t*t*t),"easeInOutQuart"===e.easing&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e.easing&&(n=t*t*t*t*t),"easeOutQuint"===e.easing&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e.easing&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),e.easingPatterns[e.easing]&&(n=e.easingPatterns[e.easing](t)),n||t},g=function(e,t,n){var o=0;if(e.offsetParent)do{o+=e.offsetTop,e=e.offsetParent}while(e);return o=Math.max(o-t-n,0),Math.min(o,y()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},y=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},v=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};l.animateScroll=function(n,o,i){var l=v(o?o.getAttribute("data-options"):null),s=f(t||u,i||{},l),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;s.selectorHeader&&!r&&(r=document.querySelector(s.selectorHeader)),a||(a=O(r));var b,E,I=d?n:g(h,a,parseInt("function"==typeof s.offset?s.offset():s.offset,10)),H=I-m,A=y(),j=0,C=function(t,r,a){var i=e.pageYOffset;(t==r||i==r||e.innerHeight+i>=A)&&(clearInterval(a),S(n,r,d),s.after(n,o))},M=function(){j+=16,b=j/parseInt(s.speed,10),b=b>1?1:b,E=m+H*p(s,b),e.scrollTo(0,Math.floor(E)),C(E,I,c)};0===e.pageYOffset&&e.scrollTo(0,0),s.before(n,o),(function(){clearInterval(c),c=setInterval(M,16)})()}};var E=function(t){try{m(decodeURIComponent(e.location.hash))}catch(t){m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),l.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector))&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href)){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var i=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",i),n.id="",void(e.location.hash.substring(1)===i?E():e.location.hash=i)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){i||(i=setTimeout((function(){i=null,a=O(r)}),66))};return l.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,i=null,c=null)},l.init=function(n){s&&(l.destroy(),t=f(u,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},l})); \ No newline at end of file diff --git a/docs/assets/img/favicon.ico b/docs/assets/img/favicon.ico new file mode 100755 index 0000000000000000000000000000000000000000..9c988977c83ec5e7090270bbe8b2cfd06850c1f4 GIT binary patch literal 8348 zcmeI0Sx8h-7{~9}PGu`mR61mttuGQKzL==vJ}wF2v(Rfuv=D(%P)|N&5tZ~1f)r8E zQ$4oOhO}!t=0o68ViD~%{r;CZbh*xqGou#76+X^6-}!(4Z@K4u_d1s4vr;U--(vJz zS+gxG)3U7DjP`n>WmPiILI=dkL!|fq{;vwu)z!_asHjLQDk@r9Sy?&rZ)8_oT)e)d zq~rkO4gB^O78ZU91OlJY^)g;z+{fO^v5uv*v@{d$cH|d1hsw&zLd-+>vPE<0w1@61 z_*QgF#v%^*wjm$H4R5HtyxjIhz9FZ`zxIR)WBak&I+_@;KVtlbb9;;KB!0^n+vHEe zx`pRah3+(SJ6019y8X$-0AD-j%I2q*-^lAAve0nB+pL%*_}pdmVA8?2m}epmxQ?3r zct*I7%TCSHt23Iee@EN;YP*5-{3NEI9*}%03 zxn-Uc@f1bkGP<0coN3&t*NT^%pJr!gPcnP%5#AB~%LbpRaJ>oFpo6|K!OdmXU^nUf zDtGv=7=5HMUjMQsr^n(Xju7(|k@%#;e?@h5bx0zcXgKK;@b3fLE6!jrsQbAw8ZWpt z#Mvq#*4@!?(zAcqoIm2;8w2YDyI-96K8a0Q3~bz63FIF)XEY%BttN+Ve0K3%IvF1! z@6g%LlzE?Y+C%q*`Lq1|{Ke7u64g_?WpMUZRaM!~Q1?l`(b+(hTMM?cduMFw?`seKo+9ofmbdo7(tYCmK2o+2}lU!(d6qwd07gQ6bk ztOvqz)f@d-kN7xMTU#sthuz%denxv>4!QTnYAwGtH8pylpLcWO_nKVYtXw4nT&b|J;Hu(u{W+~kne#D%2WP`;RSW?)?HBVVSOT@gpvSrzSW2H ze)^&FCSm=Vb#qfwQ%Vw)Ntxg?lN!|UJoMe^Pm07d`sWqU?*#l@VE;n!uYM=s49(|G z%}b;h-1#Y-yWPkuTfmpi-)>??f}Gr!8c9ingPf2-@^9^S?GOGc!4 z!nU8d^EdIeP8jU(V}D(9#%%7zJ!A;%GU?2pdX;(xzAqV_MtVpma>t=df%__451ilY zaIOmX_yz~o{=SCywoBKjUJXyW(c?FjS_jF~uU?Uxn>$ne1V3F!hvw3055DEXqMvT; zog>dn@8XAW4T1fRe1l)}4&t2S#73F>z-JI&llhilzDKcv_eHT8rUrizyF18T=4Xci zVkn4z3o>XR#IAD`Fzb;<@CDd^!FM{(Zw2e`*yoI7=iH|T$FP4-&E8|%?A(iYj_q1_ kR>zC?a9#zx3V0RpD&SSXtAJMluL52Lyb5>~7<~nP1E8Zd6#xJL literal 0 HcmV?d00001 diff --git a/docs/assets/js/houdini.min.js b/docs/assets/js/houdini.min.js new file mode 100644 index 0000000..2f1b226 --- /dev/null +++ b/docs/assets/js/houdini.min.js @@ -0,0 +1,2 @@ +/*! Houdini v9.4.0 | (c) 2017 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/houdini */ +!(function(t,e){"function"==typeof define&&define.amd?define([],e(t)):"object"==typeof exports?module.exports=e(t):t.houdini=e(t)})("undefined"!=typeof global?global:this.window||this.global,(function(t){"use strict";var e,o,n={},c="querySelector"in document&&"addEventListener"in t&&"classList"in document.createElement("_"),a={selectorToggle:"[data-collapse]",selectorContent:".collapse",toggleActiveClass:"active",contentActiveClass:"active",initClass:"js-houdini",stopVideo:!0,callbackOpen:function(){},callbackClose:function(){}},i=function(t,e,o){if("[object Object]"===Object.prototype.toString.call(t))for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.call(o,t[n],n,t);else for(var c=0,a=t.length;c=0&&e.item(o)!==this;);return o>-1});t&&t!==document;t=t.parentNode)if(t.matches(e))return t;return null},l=function(t){"#"===t.charAt(0)&&(t=t.substr(1));for(var e,o=String(t),n=o.length,c=-1,a="",i=o.charCodeAt(0);++c=1&&e<=31||127==e||0===c&&e>=48&&e<=57||1===c&&e>=48&&e<=57&&45===i?a+="\\"+e.toString(16)+" ":a+=e>=128||45===e||95===e||e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122?o.charAt(c):"\\"+o.charAt(c)}return"#"+a},u=function(t,e){if(e.stopVideo&&t.classList.contains(e.contentActiveClass)){var o=t.querySelector("iframe"),n=t.querySelector("video");if(o){var c=o.src;o.src=c}n&&n.pause()}},d=function(e,o){if(!e.hasAttribute("data-houdini-no-focus")){if(!e.classList.contains(o.contentActiveClass))return void(e.hasAttribute("data-houdini-focused")&&e.removeAttribute("tabindex"));var n={x:t.pageXOffset,y:t.pageYOffset};e.focus(),document.activeElement.id!==e.id&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-houdini-focused",!0),e.focus()),t.scrollTo(n.x,n.y)}};n.closeContent=function(t,o,n){var c=r(e||a,n||{}),i=document.querySelector(l(t));i&&(u(i,c),o&&o.classList.remove(c.toggleActiveClass),i.classList.remove(c.contentActiveClass),d(i,c),e.callbackClose(i,o))},n.openContent=function(t,o,c){var s=r(e||a,c||{}),u=document.querySelector(l(t)),f=o&&o.hasAttribute("data-group")?document.querySelectorAll('[data-group="'+o.getAttribute("data-group")+'"]'):[];u&&(i(f,(function(t){n.closeContent(t.hash,t)})),o&&o.classList.add(s.toggleActiveClass),u.classList.add(s.contentActiveClass),d(u,s),u.removeAttribute("data-houdini-no-focus"),s.callbackOpen(u,o))};var f=function(c){var a=t.location.hash;if(o&&(o.id=o.getAttribute("data-collapse-id"),o=null),a){var i=document.querySelector(e.selectorToggle+'[href*="'+a+'"]');n.openContent(a,i)}},h=function(c){if(0===c.button&&!c.metaKey&&!c.ctrlKey){var a=s(c.target,e.selectorToggle);if(a&&a.hash){if(a.classList.contains(e.toggleActiveClass))return c.preventDefault(),void n.closeContent(a.hash,a);o=document.querySelector(a.hash),o&&(o.setAttribute("data-collapse-id",o.id),o.id="",a.hash===t.location.hash&&(c.preventDefault(),f()))}}},v=function(n){if((o=s(n.target,e.selectorContent))&&!o.classList.contains(e.contentActiveClass)){var c=o.id;if(o.setAttribute("data-collapse-id",c),o.setAttribute("data-houdini-no-focus",!0),o.id="",c===t.location.hash.substring(1))return void f();t.location.hash=c}};return n.destroy=function(){e&&(document.documentElement.classList.remove(e.initClass),document.removeEventListener("click",h,!1),document.removeEventListener("focus",v,!0),t.removeEventListener("hashchange",f,!1),e=null,o=null)},n.init=function(o){c&&(n.destroy(),e=r(a,o||{}),document.documentElement.classList.add(e.initClass),document.addEventListener("click",h,!1),document.addEventListener("focus",v,!0),t.addEventListener("hashchange",f,!1),f())},n})); \ No newline at end of file diff --git a/docs/browsers.html b/docs/browsers.html index 74a456e..d933079 100755 --- a/docs/browsers.html +++ b/docs/browsers.html @@ -7,6 +7,10 @@ + + + + @@ -43,8 +47,8 @@
  • Download
  • Demo
  • Getting Started
  • -
  • Working with Source
  • Options & Settings
  • +
  • Extras
  • Browser Compatibility
  • License
  • @@ -54,6 +58,7 @@

    Browser Compatibility

    +

    Supported Browsers

    Smooth Scroll works in all modern browsers, and IE 9 and above.

    Smooth Scroll is built with modern JavaScript APIs, and uses progressive enhancement. If the JavaScript file fails to load, or if your site is viewed on older and less capable browsers, anchor links will jump the way they normally would.


    @@ -96,7 +101,7 @@

    Animating from the bottom

    offset: 5 }); highlightActiveNav.init({ - urlPrefix: '/smooth-scroll/' + urlPrefix: '/kraken/' }); diff --git a/docs/dist/js/smooth-scroll.js b/docs/dist/js/smooth-scroll.js index d763bc6..e48e2b1 100755 --- a/docs/dist/js/smooth-scroll.js +++ b/docs/dist/js/smooth-scroll.js @@ -1,5 +1,5 @@ /*! - * smooth-scroll v11.0.1: Animate scrolling to anchor links + * smooth-scroll v11.0.2: Animate scrolling to anchor links * (c) 2017 Chris Ferdinandi * GPL-3.0 License * http://github.com/cferdinandi/smooth-scroll @@ -224,26 +224,26 @@ * @param {Number} time Time animation should take to complete * @returns {Number} */ - var easingPattern = function ( type, time ) { + var easingPattern = function ( settings, time ) { var pattern; // Default Easing Patterns - if ( type === 'easeInQuad' ) pattern = time * time; // accelerating from zero velocity - if ( type === 'easeOutQuad' ) pattern = time * (2 - time); // decelerating to zero velocity - if ( type === 'easeInOutQuad' ) pattern = time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration - if ( type === 'easeInCubic' ) pattern = time * time * time; // accelerating from zero velocity - if ( type === 'easeOutCubic' ) pattern = (--time) * time * time + 1; // decelerating to zero velocity - if ( type === 'easeInOutCubic' ) pattern = time < 0.5 ? 4 * time * time * time : (time - 1) * (2 * time - 2) * (2 * time - 2) + 1; // acceleration until halfway, then deceleration - if ( type === 'easeInQuart' ) pattern = time * time * time * time; // accelerating from zero velocity - if ( type === 'easeOutQuart' ) pattern = 1 - (--time) * time * time * time; // decelerating to zero velocity - if ( type === 'easeInOutQuart' ) pattern = time < 0.5 ? 8 * time * time * time * time : 1 - 8 * (--time) * time * time * time; // acceleration until halfway, then deceleration - if ( type === 'easeInQuint' ) pattern = time * time * time * time * time; // accelerating from zero velocity - if ( type === 'easeOutQuint' ) pattern = 1 + (--time) * time * time * time * time; // decelerating to zero velocity - if ( type === 'easeInOutQuint' ) pattern = time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration + if ( settings.easing === 'easeInQuad' ) pattern = time * time; // accelerating from zero velocity + if ( settings.easing === 'easeOutQuad' ) pattern = time * (2 - time); // decelerating to zero velocity + if ( settings.easing === 'easeInOutQuad' ) pattern = time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration + if ( settings.easing === 'easeInCubic' ) pattern = time * time * time; // accelerating from zero velocity + if ( settings.easing === 'easeOutCubic' ) pattern = (--time) * time * time + 1; // decelerating to zero velocity + if ( settings.easing === 'easeInOutCubic' ) pattern = time < 0.5 ? 4 * time * time * time : (time - 1) * (2 * time - 2) * (2 * time - 2) + 1; // acceleration until halfway, then deceleration + if ( settings.easing === 'easeInQuart' ) pattern = time * time * time * time; // accelerating from zero velocity + if ( settings.easing === 'easeOutQuart' ) pattern = 1 - (--time) * time * time * time; // decelerating to zero velocity + if ( settings.easing === 'easeInOutQuart' ) pattern = time < 0.5 ? 8 * time * time * time * time : 1 - 8 * (--time) * time * time * time; // acceleration until halfway, then deceleration + if ( settings.easing === 'easeInQuint' ) pattern = time * time * time * time * time; // accelerating from zero velocity + if ( settings.easing === 'easeOutQuint' ) pattern = 1 + (--time) * time * time * time * time; // decelerating to zero velocity + if ( settings.easing === 'easeInOutQuint' ) pattern = time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration // Custom Easing Patterns - if ( settings.easingPatterns[type] ) { - pattern = settings.easingPatterns[type]( time ); + if ( settings.easingPatterns[settings.easing] ) { + pattern = settings.easingPatterns[settings.easing]( time ); } return pattern || time; // no easing, no acceleration @@ -394,7 +394,7 @@ timeLapsed += 16; percentage = ( timeLapsed / parseInt(animateSettings.speed, 10) ); percentage = ( percentage > 1 ) ? 1 : percentage; - position = startLocation + ( distance * easingPattern(animateSettings.easing, percentage) ); + position = startLocation + ( distance * easingPattern(animateSettings, percentage) ); root.scrollTo( 0, Math.floor(position) ); stopAnimateScroll(position, endLocation, animationInterval); }; diff --git a/docs/dist/js/smooth-scroll.min.js b/docs/dist/js/smooth-scroll.min.js index 184687a..736d520 100755 --- a/docs/dist/js/smooth-scroll.min.js +++ b/docs/dist/js/smooth-scroll.min.js @@ -1,2 +1,2 @@ -/*! smooth-scroll v11.0.1 | (c) 2017 Chris Ferdinandi | GPL-3.0 License | http://github.com/cferdinandi/smooth-scroll */ -!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,i,l={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,offset:0,easing:"easeInOutCubic",easingPatterns:{},before:function(){},after:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(;n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?a+="\\"+t.toString(16)+" ":a+=t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,n){var o;return"easeInQuad"===e&&(o=n*n),"easeOutQuad"===e&&(o=n*(2-n)),"easeInOutQuad"===e&&(o=n<.5?2*n*n:(4-2*n)*n-1),"easeInCubic"===e&&(o=n*n*n),"easeOutCubic"===e&&(o=--n*n*n+1),"easeInOutCubic"===e&&(o=n<.5?4*n*n*n:(n-1)*(2*n-2)*(2*n-2)+1),"easeInQuart"===e&&(o=n*n*n*n),"easeOutQuart"===e&&(o=1- --n*n*n*n),"easeInOutQuart"===e&&(o=n<.5?8*n*n*n*n:1-8*--n*n*n*n),"easeInQuint"===e&&(o=n*n*n*n*n),"easeOutQuint"===e&&(o=1+--n*n*n*n*n),"easeInOutQuint"===e&&(o=n<.5?16*n*n*n*n*n:1+16*--n*n*n*n*n),t.easingPatterns[e]&&(o=t.easingPatterns[e](n)),o||n},g=function(e,t,n){var o=0;if(e.offsetParent)do{o+=e.offsetTop,e=e.offsetParent}while(e);return o=Math.max(o-t-n,0),Math.min(o,y()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},y=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},v=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};l.animateScroll=function(n,o,c){var l=v(o?o.getAttribute("data-options"):null),u=f(t||s,c||{},l),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=d?n:g(h,a,parseInt("function"==typeof u.offset?u.offset():u.offset,10)),H=I-m,A=y(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,d),u.after(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,i)};0===e.pageYOffset&&e.scrollTo(0,0),u.before(n,o),(function(){clearInterval(i),i=setInterval(M,16)})()}};var E=function(t){try{m(decodeURIComponent(e.location.hash))}catch(t){m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),l.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector))&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href)){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return l.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,i=null)},l.init=function(n){u&&(l.destroy(),t=f(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},l})); \ No newline at end of file +/*! smooth-scroll v11.0.2 | (c) 2017 Chris Ferdinandi | GPL-3.0 License | http://github.com/cferdinandi/smooth-scroll */ +!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,i,c,l={},s="querySelector"in document&&"addEventListener"in e,u={selector:"[data-scroll]",selectorHeader:null,speed:500,offset:0,easing:"easeInOutCubic",easingPatterns:{},before:function(){},after:function(){}},f=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(;n=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",i=n.charCodeAt(0);++r=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===i?a+="\\"+t.toString(16)+" ":a+=t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,t){var n;return"easeInQuad"===e.easing&&(n=t*t),"easeOutQuad"===e.easing&&(n=t*(2-t)),"easeInOutQuad"===e.easing&&(n=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e.easing&&(n=t*t*t),"easeOutCubic"===e.easing&&(n=--t*t*t+1),"easeInOutCubic"===e.easing&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e.easing&&(n=t*t*t*t),"easeOutQuart"===e.easing&&(n=1- --t*t*t*t),"easeInOutQuart"===e.easing&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e.easing&&(n=t*t*t*t*t),"easeOutQuint"===e.easing&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e.easing&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),e.easingPatterns[e.easing]&&(n=e.easingPatterns[e.easing](t)),n||t},g=function(e,t,n){var o=0;if(e.offsetParent)do{o+=e.offsetTop,e=e.offsetParent}while(e);return o=Math.max(o-t-n,0),Math.min(o,y()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},y=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},v=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?d(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};l.animateScroll=function(n,o,i){var l=v(o?o.getAttribute("data-options"):null),s=f(t||u,i||{},l),d="[object Number]"===Object.prototype.toString.call(n),h=d||!n.tagName?null:n;if(d||h){var m=e.pageYOffset;s.selectorHeader&&!r&&(r=document.querySelector(s.selectorHeader)),a||(a=O(r));var b,E,I=d?n:g(h,a,parseInt("function"==typeof s.offset?s.offset():s.offset,10)),H=I-m,A=y(),j=0,C=function(t,r,a){var i=e.pageYOffset;(t==r||i==r||e.innerHeight+i>=A)&&(clearInterval(a),S(n,r,d),s.after(n,o))},M=function(){j+=16,b=j/parseInt(s.speed,10),b=b>1?1:b,E=m+H*p(s,b),e.scrollTo(0,Math.floor(E)),C(E,I,c)};0===e.pageYOffset&&e.scrollTo(0,0),s.before(n,o),(function(){clearInterval(c),c=setInterval(M,16)})()}};var E=function(t){try{m(decodeURIComponent(e.location.hash))}catch(t){m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),l.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector))&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href)){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var i=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",i),n.id="",void(e.location.hash.substring(1)===i?E():e.location.hash=i)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){i||(i=setTimeout((function(){i=null,a=O(r)}),66))};return l.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,i=null,c=null)},l.init=function(n){s&&(l.destroy(),t=f(u,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},l})); \ No newline at end of file diff --git a/docs/extras.html b/docs/extras.html new file mode 100644 index 0000000..5448790 --- /dev/null +++ b/docs/extras.html @@ -0,0 +1,171 @@ + + + + + + Smooth Scroll + + + + + + + + + + + + + + + + + +
    +
    + + + +

    Extras

    +

    Frequently asked questions, code snippets, and more to help you get the most out of Smooth Scroll.

    +
    + + +

    This, unfortunately, cannot be done well.

    +

    Most browsers instantly jump you to the anchor location when you load a page. You could use scrollTo(0, 0) to pull users back up to the top, and then manually use the smoothScroll.animateScroll() method, but in my experience, it results in a visible jump on the page that's a worse experience than the default browser behavior.

    +
    + +

    Scrolling without updating the URL

    +

    Smooth Scroll is designed to progressively enhance anchor links while offloading as much to the browser as possible. In it's current implementation, it relies on hashchange events (which occur whenever a # changes in the URL) to trigger the scrolling behavior.

    +

    A benefit of this approach is that it preserves browser history and let's users navigate between anchors with the forward and back buttons on the browsers, just like you would normally.

    +

    However, I know certain front-end frameworks also use URL hashes for their own internal processes. While I view this as an anti-pattern, and won't bake hashless anchor links into Smooth Scroll's core, you can enable scrolling without updating the URL via the Smooth Scroll API.

    +

    Here's a relatively lightweight helper function that listens for click events and uses the smoothScroll.animateScroll() method to scroll to the anchor. If you use this, you should not need initialize Smooth Scroll with smoothScroll.init().

    +
    var smoothScrollWithoutHash = function (selector, settings) {
    +
    +    /**
    +     * Get the closest matching element up the DOM tree.
    +     * @private
    +     * @param  {Element} elem     Starting element
    +     * @param  {String}  selector Selector to match against
    +     * @return {Boolean|Element}  Returns null if not match found
    +     */
    +    var getClosest = function ( elem, selector ) {
    +
    +        // Element.matches() polyfill
    +        if (!Element.prototype.matches) {
    +            Element.prototype.matches =
    +                Element.prototype.matchesSelector ||
    +                Element.prototype.mozMatchesSelector ||
    +                Element.prototype.msMatchesSelector ||
    +                Element.prototype.oMatchesSelector ||
    +                Element.prototype.webkitMatchesSelector ||
    +                function(s) {
    +                    var matches = (this.document || this.ownerDocument).querySelectorAll(s),
    +                        i = matches.length;
    +                    while (--i >= 0 && matches.item(i) !== this) {}
    +                    return i > -1;
    +                };
    +        }
    +
    +        // Get closest match
    +        for ( ; elem && elem !== document; elem = elem.parentNode ) {
    +            if ( elem.matches( selector ) ) return elem;
    +        }
    +
    +        return null;
    +
    +    };
    +
    +
    +    /**
    +     * If smooth scroll element clicked, animate scroll
    +     * @private
    +     */
    +    var clickHandler = function (event) {
    +        var toggle = getClosest( event.target, selector );
    +        console.log(toggle);
    +        if ( !toggle || toggle.tagName.toLowerCase() !== 'a' ) return;
    +        console.log(toggle.hash);
    +        var anchor = document.querySelector( toggle.hash );
    +        if ( !anchor ) return;
    +
    +        event.preventDefault(); // Prevent default click event
    +        smoothScroll.animateScroll( anchor, toggle, settings || {} ); // Animate scroll
    +    };
    +
    +    window.addEventListener('click', clickHandler, false );
    +
    +};
    +
    +// Run our function
    +smoothScrollWithoutHash( 'a[href*="#"]' );
    +
    +
    + + +
    + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 56c4214..3125eff 100755 --- a/docs/index.html +++ b/docs/index.html @@ -7,6 +7,10 @@ + + + + @@ -43,8 +47,8 @@
  • Download
  • Demo
  • Getting Started
  • -
  • Working with Source
  • Options & Settings
  • +
  • Extras
  • Browser Compatibility
  • License
  • @@ -146,7 +150,7 @@

    Demo

    offset: 5 }); highlightActiveNav.init({ - urlPrefix: '/smooth-scroll/' + urlPrefix: '/kraken/' }); diff --git a/docs/license.html b/docs/license.html index 5e13706..60b847c 100755 --- a/docs/license.html +++ b/docs/license.html @@ -7,6 +7,10 @@ + + + + @@ -43,8 +47,8 @@
  • Download
  • Demo
  • Getting Started
  • -
  • Working with Source
  • Options & Settings
  • +
  • Extras
  • Browser Compatibility
  • License
  • @@ -99,7 +103,7 @@

    Buy a Commercial License

    An Organization License can be used by an unlimited number of developers. - Buy an Organization License now for $999 + Buy an Organization License now for $999 @@ -118,7 +122,7 @@

    1. Definitions

    2. Commercial license grant

    Subject to the terms of this Agreement, Go Make Things grants to You a revocable, non-exclusive, non-transferable license:

      -
    • for [n Licensed Developers—varies based on the license your purchase] to use the Software to create Modifications and Applications;
    • +
    • for [n licensed developers—varies based on the license your purchase] to use the Software to create Modifications and Applications;
    • for You to distribute the Software and/or Modifications to an unlimited number of End Users solely as integrated into the Applications;
    • and for End Users to use the Software as incorporated into Your Applications in accordance with the terms of this Agreement.
    @@ -204,7 +208,7 @@

    OEM License

    offset: 5 }); highlightActiveNav.init({ - urlPrefix: '/smooth-scroll/' + urlPrefix: '/kraken/' }); diff --git a/docs/options.html b/docs/options.html index ebc6deb..02bb9c0 100755 --- a/docs/options.html +++ b/docs/options.html @@ -7,6 +7,10 @@ + + + + @@ -43,8 +47,8 @@
  • Download
  • Demo
  • Getting Started
  • -
  • Working with Source
  • Options & Settings
  • +
  • Extras
  • Browser Compatibility
  • License
  • @@ -130,7 +134,7 @@

    Override settings with data attr Anchor Link </a> -

    Note: You must use valid JSON in order for the data-options feature to work. Does not support the callback method.

    +

    Note: You must use valid JSON in order for the data-options feature to work. Does not support the before and after callback methods, or the easingPatterns object.


    @@ -139,8 +143,8 @@

    Use Smooth Scroll events i

    animateScroll()

    Animate scrolling to an anchor.

    smoothScroll.animateScroll(
    -    anchor, // Node to scroll to. ex. document.querySelector( '#bazinga' )
    -    toggle, // Node that toggles the animation, OR an integer. ex. document.querySelector( '#toggle' )
    +    anchor, // Node to scroll to, OR an integer. ex. document.querySelector( '#bazinga' )
    +    toggle, // Node that toggles the animation. ex. document.querySelector( '#toggle' )
         options // Classes and callbacks. Same options as those passed into the init() function.
     );
     
    @@ -178,29 +182,6 @@

    Fixed Headers

    }); </script> -
    - - - -

    This is an often requested feature, but Smooth Scroll does not include an option to animate scrolling to links on other pages.

    -

    You can attempt to implement it using the API, but it's very difficult to prevent the automatic browser jump when the page loads, and anything I've done to work around it results in weird, janky issues, so I've decided to leave this out of the core. Here's a potential workaround...

    -
      -
    1. Do not add the data-scroll attribute to links to other pages. Treat them like normal links, and include your anchor link hash as normal.

      -
       <a href="some-page.html#example">
      -
      -
    2. -
    3. Add the following script to the footer of your page, after the smoothScroll.init() function.

      -
       <script>
      -     if ( window.location.hash ) {
      -         var anchor = document.querySelector( window.location.hash ); // Get the anchor
      -         var toggle = document.querySelector( 'a[href*="' + window.location.hash + '"]' ); // Get the toggle (if one exists)
      -         var options = {}; // Any custom options you want to use would go here
      -         smoothScroll.animateScroll( anchor, toggle, options );
      -     }
      - </script>
      -
      -
    4. -