Skip to content

Commit 385f8ce

Browse files
committed
Removed unneeded dependencies.
Also updated Gulp build
1 parent 88ba8c3 commit 385f8ce

22 files changed

+9664
-1315
lines changed

dist/_closest.polyfill.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*!
2+
* smooth-scroll v15.1.1
3+
* Animate scrolling to anchor links
4+
* (c) 2018 Chris Ferdinandi
5+
* MIT License
6+
* http://github.com/cferdinandi/smooth-scroll
7+
*/
8+
9+
/**
10+
* closest() polyfill
11+
* @link https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
12+
*/
13+
if (window.Element && !Element.prototype.closest) {
14+
Element.prototype.closest = function(s) {
15+
var matches = (this.document || this.ownerDocument).querySelectorAll(s),
16+
i,
17+
el = this;
18+
do {
19+
i = matches.length;
20+
while (--i >= 0 && matches.item(i) !== el) {}
21+
} while ((i < 0) && (el = el.parentElement));
22+
return el;
23+
};
24+
}

dist/_closest.polyfill.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/_customEvent.polyfill.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*!
2+
* smooth-scroll v15.1.1
3+
* Animate scrolling to anchor links
4+
* (c) 2018 Chris Ferdinandi
5+
* MIT License
6+
* http://github.com/cferdinandi/smooth-scroll
7+
*/
8+
9+
/**
10+
* CustomEvent() polyfill
11+
* https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
12+
*/
13+
(function () {
14+
15+
if (typeof window.CustomEvent === "function") return false;
16+
17+
function CustomEvent(event, params) {
18+
params = params || { bubbles: false, cancelable: false, detail: undefined };
19+
var evt = document.createEvent('CustomEvent');
20+
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
21+
return evt;
22+
}
23+
24+
CustomEvent.prototype = window.Event.prototype;
25+
26+
window.CustomEvent = CustomEvent;
27+
})();

dist/_customEvent.polyfill.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*!
2+
* smooth-scroll v15.1.1
3+
* Animate scrolling to anchor links
4+
* (c) 2018 Chris Ferdinandi
5+
* MIT License
6+
* http://github.com/cferdinandi/smooth-scroll
7+
*/
8+
9+
/**
10+
* requestAnimationFrame() polyfill
11+
* By Erik Möller. Fixes from Paul Irish and Tino Zijdel.
12+
* @link http://paulirish.com/2011/requestanimationframe-for-smart-animating/
13+
* @link http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
14+
* @license MIT
15+
*/
16+
(function() {
17+
var lastTime = 0;
18+
var vendors = ['ms', 'moz', 'webkit', 'o'];
19+
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
20+
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
21+
window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] ||
22+
window[vendors[x]+'CancelRequestAnimationFrame'];
23+
}
24+
25+
if (!window.requestAnimationFrame) {
26+
window.requestAnimationFrame = function(callback, element) {
27+
var currTime = new Date().getTime();
28+
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
29+
var id = window.setTimeout((function() { callback(currTime + timeToCall); }),
30+
timeToCall);
31+
lastTime = currTime + timeToCall;
32+
return id;
33+
};
34+
}
35+
36+
if (!window.cancelAnimationFrame) {
37+
window.cancelAnimationFrame = function(id) {
38+
clearTimeout(id);
39+
};
40+
}
41+
}());

dist/_requestAnimationFrame.polyfill.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/smooth-scroll.js

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*!
2-
* smooth-scroll v15.1.0: Animate scrolling to anchor links
2+
* smooth-scroll v15.1.1
3+
* Animate scrolling to anchor links
34
* (c) 2018 Chris Ferdinandi
45
* MIT License
56
* http://github.com/cferdinandi/smooth-scroll
@@ -105,21 +106,6 @@
105106
return parseInt(window.getComputedStyle(elem).height, 10);
106107
};
107108

108-
/**
109-
* Decode a URI, with error check
110-
* @param {String} hash The URI to decode
111-
* @return {String} A decoded URI (or the original string if an error is thrown)
112-
*/
113-
var decode = function (hash) {
114-
var decoded;
115-
try {
116-
decoded = decodeURIComponent(hash);
117-
} catch(e) {
118-
decoded = hash;
119-
}
120-
return decoded;
121-
};
122-
123109
/**
124110
* Escape special characters for use with querySelector
125111
* @author Mathias Bynens
@@ -196,13 +182,7 @@
196182
}
197183

198184
// Return sanitized hash
199-
var hash;
200-
try {
201-
hash = decodeURIComponent('#' + result);
202-
} catch(e) {
203-
hash = '#' + result;
204-
}
205-
return hash;
185+
return '#' + result;
206186

207187
};
208188

@@ -535,7 +515,7 @@
535515
if (toggle.hostname !== window.location.hostname || toggle.pathname !== window.location.pathname || !/#/.test(toggle.href)) return;
536516

537517
// Get an escaped version of the hash
538-
var hash = escapeCharacters(decode(toggle.hash));
518+
var hash = escapeCharacters(toggle.hash);
539519

540520
// Get the anchored element
541521
var anchor = settings.topOnEmptyHash && hash === '#' ? document.documentElement : document.querySelector(hash);
@@ -568,7 +548,7 @@
568548
// Get the anchor
569549
var anchor = history.state.anchor;
570550
if (anchor && anchor !== 0) {
571-
anchor = document.querySelector(escapeCharacters(decode(history.state.anchor)));
551+
anchor = document.querySelector(escapeCharacters(history.state.anchor));
572552
if (!anchor) return;
573553
}
574554

dist/smooth-scroll.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)