Skip to content

Commit f077aa1

Browse files
committed
Update grunt plugins and bump version.
1 parent 6568da7 commit f077aa1

File tree

6 files changed

+66
-37
lines changed

6 files changed

+66
-37
lines changed

Gruntfile.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,26 +93,21 @@ module.exports = function(grunt) {
9393
}
9494
},
9595
version: {
96-
patch: {
96+
97+
files: {
9798
src: [
9899
'package.json',
99100
'src/jquery.<%= pluginName %>.js',
100101
'jquery.<%= pluginName %>.js'
101-
],
102-
options: {
103-
release: 'patch'
104-
}
105-
},
106-
same: {
107-
src: ['package.json', 'src/jquery.<%= pluginName %>.js', 'jquery.<%= pluginName %>.js']
102+
]
108103
},
109-
bannerPatch: {
104+
banner: {
110105
src: ['jquery.<%= pluginName %>.js'],
111106
options: {
112-
prefix: '- v',
113-
release: 'patch'
107+
prefix: '- v'
114108
}
115-
}
109+
},
110+
116111
}
117112
});
118113

@@ -125,8 +120,8 @@ module.exports = function(grunt) {
125120
grunt.file.write('index.html', head + doc + foot);
126121
});
127122

128-
grunt.registerTask('build', ['jshint', 'concat', 'version:same', 'uglify', 'docs']);
129-
grunt.registerTask('patch', ['jshint', 'concat', 'version:bannerPatch', 'version:patch', 'uglify']);
123+
grunt.registerTask('build', ['jshint', 'concat', 'version', 'uglify', 'docs']);
124+
grunt.registerTask('patch', ['jshint', 'concat', 'version::patch', 'uglify']);
130125
grunt.registerTask('default', ['build']);
131126

132127
grunt.loadNpmTasks('grunt-contrib-jshint');

index.html

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

jquery.smooth-scroll.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* jQuery Smooth Scroll - v1.6.0 - 2015-12-22
2+
* jQuery Smooth Scroll - v1.6.1 - 2015-12-26
33
* https://github.com/kswedberg/jquery-smooth-scroll
44
* Copyright (c) 2015 Karl Swedberg
55
* Licensed MIT
@@ -18,7 +18,7 @@
1818
}
1919
}(function ($) {
2020

21-
var version = '1.6.0',
21+
var version = '1.6.1',
2222
optionOverrides = {},
2323
defaults = {
2424
exclude: [],
@@ -133,8 +133,7 @@
133133
});
134134
}
135135

136-
var opts = $.extend({}, $.fn.smoothScroll.defaults, options),
137-
locationPath = $.smoothScroll.filterPath(location.pathname);
136+
var opts = $.extend({}, $.fn.smoothScroll.defaults, options);
138137

139138
var clickHandler = function(event) {
140139
var link = this,
@@ -145,8 +144,10 @@
145144
elCounter = 0, ewlCounter = 0,
146145
include = true,
147146
clickOpts = {},
147+
locationPath = $.smoothScroll.filterPath(location.pathname),
148+
linkPath = $.smoothScroll.filterPath(link.pathname),
148149
hostMatch = ((location.hostname === link.hostname) || !link.hostname),
149-
pathMatch = thisOpts.scrollTarget || ( $.smoothScroll.filterPath(link.pathname) === locationPath ),
150+
pathMatch = thisOpts.scrollTarget || ( linkPath === locationPath ),
150151
thisHash = escapeSelector(link.hash);
151152

152153
if ( !thisOpts.scrollTarget && (!hostMatch || !pathMatch || !thisHash) ) {

jquery.smooth-scroll.min.js

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,40 @@
11
/*!
2-
* jQuery Smooth Scroll - v1.6.0 - 2015-12-22
2+
* jQuery Smooth Scroll - v1.6.0 - 2015-12-26
33
* https://github.com/kswedberg/jquery-smooth-scroll
44
* Copyright (c) 2015 Karl Swedberg
55
* Licensed MIT
66
*/
7-
(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?e(require("jquery")):e(jQuery)})(function(e){function t(e){return e.replace(/(:|\.|\/)/g,"\\$1")}var l="1.6.0",o={},n={exclude:[],excludeWithin:[],offset:0,direction:"top",delegateSelector:null,scrollElement:null,scrollTarget:null,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficient:2,preventDefault:!0},s=function(t){var l=[],o=!1,n=t.dir&&"left"===t.dir?"scrollLeft":"scrollTop";return this.each(function(){var t=e(this);if(this!==document&&this!==window)return!document.scrollingElement||this!==document.documentElement&&this!==document.body?(t[n]()>0?l.push(this):(t[n](1),o=t[n]()>0,o&&l.push(this),t[n](0)),void 0):(l.push(document.scrollingElement),!1)}),l.length||this.each(function(){"BODY"===this.nodeName&&(l=[this])}),"first"===t.el&&l.length>1&&(l=[l[0]]),l};e.fn.extend({scrollable:function(e){var t=s.call(this,{dir:e});return this.pushStack(t)},firstScrollable:function(e){var t=s.call(this,{el:"first",dir:e});return this.pushStack(t)},smoothScroll:function(l,o){if(l=l||{},"options"===l)return o?this.each(function(){var t=e(this),l=e.extend(t.data("ssOpts")||{},o);e(this).data("ssOpts",l)}):this.first().data("ssOpts");var n=e.extend({},e.fn.smoothScroll.defaults,l),s=e.smoothScroll.filterPath(location.pathname),r=function(l){var o=this,r=e(this),i=e.extend({},n,r.data("ssOpts")||{}),c=n.exclude,a=i.excludeWithin,f=0,u=0,h=!0,d={},m=location.hostname===o.hostname||!o.hostname,p=i.scrollTarget||e.smoothScroll.filterPath(o.pathname)===s,g=t(o.hash);if(i.scrollTarget||m&&p&&g){for(;h&&c.length>f;)r.is(t(c[f++]))&&(h=!1);for(;h&&a.length>u;)r.closest(a[u++]).length&&(h=!1)}else h=!1;h&&(i.preventDefault&&l.preventDefault(),e.extend(d,i,{scrollTarget:i.scrollTarget||g,link:o}),e.smoothScroll(d))};return null!==l.delegateSelector?this.undelegate(l.delegateSelector,"click.smoothscroll").delegate(l.delegateSelector,"click.smoothscroll",r):this.unbind("click.smoothscroll").bind("click.smoothscroll",r),this}}),e.smoothScroll=function(t,l){if("options"===t&&"object"==typeof l)return e.extend(o,l);var n,s,r,i,c,a=0,f="offset",u="scrollTop",h={},d={};"number"==typeof t?(n=e.extend({link:null},e.fn.smoothScroll.defaults,o),r=t):(n=e.extend({link:null},e.fn.smoothScroll.defaults,t||{},o),n.scrollElement&&(f="position","static"===n.scrollElement.css("position")&&n.scrollElement.css("position","relative"))),u="left"===n.direction?"scrollLeft":u,n.scrollElement?(s=n.scrollElement,/^(?:HTML|BODY)$/.test(s[0].nodeName)||(a=s[u]())):s=e("html, body").firstScrollable(n.direction),n.beforeScroll.call(s,n),r="number"==typeof t?t:l||e(n.scrollTarget)[f]()&&e(n.scrollTarget)[f]()[n.direction]||0,h[u]=r+a+n.offset,i=n.speed,"auto"===i&&(c=Math.abs(h[u]-s[u]()),i=c/n.autoCoefficient),d={duration:i,easing:n.easing,complete:function(){n.afterScroll.call(n.link,n)}},n.step&&(d.step=n.step),s.length?s.stop().animate(h,d):n.afterScroll.call(n.link,n)},e.smoothScroll.version=l,e.smoothScroll.filterPath=function(e){return e=e||"",e.replace(/^\//,"").replace(/(?:index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")},e.fn.smoothScroll.defaults=n});
7+
!function(a){"function"==typeof define&&define.amd?
8+
// AMD. Register as an anonymous module.
9+
define(["jquery"],a):a("object"==typeof module&&module.exports?require("jquery"):jQuery)}(function(a){function b(a){return a.replace(/(:|\.|\/)/g,"\\$1")}var c="1.6.0",d={},e={exclude:[],excludeWithin:[],offset:0,
10+
// one of 'top' or 'left'
11+
direction:"top",
12+
// if set, bind click events through delegation
13+
// supported since jQuery 1.4.2
14+
delegateSelector:null,
15+
// jQuery set of elements you wish to scroll (for $.smoothScroll).
16+
// if null (default), $('html, body').firstScrollable() is used.
17+
scrollElement:null,
18+
// only use if you want to override default behavior
19+
scrollTarget:null,
20+
// fn(opts) function to be called before scrolling occurs.
21+
// `this` is the element(s) being scrolled
22+
beforeScroll:function(){},
23+
// fn(opts) function to be called after scrolling occurs.
24+
// `this` is the triggering element
25+
afterScroll:function(){},easing:"swing",speed:400,
26+
// coefficient for "auto" speed
27+
autoCoefficient:2,
28+
// $.fn.smoothScroll only: whether to prevent the default click action
29+
preventDefault:!0},f=function(b){var c=[],d=!1,e=b.dir&&"left"===b.dir?"scrollLeft":"scrollTop";
30+
// If no scrollable elements, fall back to <body>,
31+
// if it's in the jQuery collection
32+
// (doing this because Safari sets scrollTop async,
33+
// so can't set it to 1 and immediately get the value.)
34+
// Use the first scrollable element if we're calling firstScrollable()
35+
return this.each(function(){var b=a(this);if(this!==document&&this!==window)
36+
// if scroll(Top|Left) === 0, nudge the element 1px and see if it moves
37+
// then put it back, of course
38+
return!document.scrollingElement||this!==document.documentElement&&this!==document.body?void(b[e]()>0?c.push(this):(b[e](1),d=b[e]()>0,d&&c.push(this),b[e](0))):(c.push(document.scrollingElement),!1)}),c.length||this.each(function(){"BODY"===this.nodeName&&(c=[this])}),"first"===b.el&&c.length>1&&(c=[c[0]]),c};a.fn.extend({scrollable:function(a){var b=f.call(this,{dir:a});return this.pushStack(b)},firstScrollable:function(a){var b=f.call(this,{el:"first",dir:a});return this.pushStack(b)},smoothScroll:function(c,d){if(c=c||{},"options"===c)return d?this.each(function(){var b=a(this),c=a.extend(b.data("ssOpts")||{},d);a(this).data("ssOpts",c)}):this.first().data("ssOpts");var e=a.extend({},a.fn.smoothScroll.defaults,c),f=function(c){var d=this,f=a(this),g=a.extend({},e,f.data("ssOpts")||{}),h=e.exclude,i=g.excludeWithin,j=0,k=0,l=!0,m={},n=a.smoothScroll.filterPath(location.pathname),o=a.smoothScroll.filterPath(d.pathname),p=location.hostname===d.hostname||!d.hostname,q=g.scrollTarget||o===n,r=b(d.hash);if(g.scrollTarget||p&&q&&r){for(;l&&j<h.length;)f.is(b(h[j++]))&&(l=!1);for(;l&&k<i.length;)f.closest(i[k++]).length&&(l=!1)}else l=!1;l&&(g.preventDefault&&c.preventDefault(),a.extend(m,g,{scrollTarget:g.scrollTarget||r,link:d}),a.smoothScroll(m))};return null!==c.delegateSelector?this.undelegate(c.delegateSelector,"click.smoothscroll").delegate(c.delegateSelector,"click.smoothscroll",f):this.unbind("click.smoothscroll").bind("click.smoothscroll",f),this}}),a.smoothScroll=function(b,c){if("options"===b&&"object"==typeof c)return a.extend(d,c);var e,f,g,h,i,j=0,k="offset",l="scrollTop",m={},n={};"number"==typeof b?(e=a.extend({link:null},a.fn.smoothScroll.defaults,d),g=b):(e=a.extend({link:null},a.fn.smoothScroll.defaults,b||{},d),e.scrollElement&&(k="position","static"===e.scrollElement.css("position")&&e.scrollElement.css("position","relative"))),l="left"===e.direction?"scrollLeft":l,e.scrollElement?(f=e.scrollElement,/^(?:HTML|BODY)$/.test(f[0].nodeName)||(j=f[l]())):f=a("html, body").firstScrollable(e.direction),e.beforeScroll.call(f,e),g="number"==typeof b?b:c||a(e.scrollTarget)[k]()&&a(e.scrollTarget)[k]()[e.direction]||0,m[l]=g+j+e.offset,h=e.speed,"auto"===h&&(i=Math.abs(m[l]-f[l]()),h=i/e.autoCoefficient),n={duration:h,easing:e.easing,complete:function(){e.afterScroll.call(e.link,e)}},e.step&&(n.step=e.step),f.length?f.stop().animate(m,n):e.afterScroll.call(e.link,e)},a.smoothScroll.version=c,a.smoothScroll.filterPath=function(a){return a=a||"",a.replace(/^\//,"").replace(/(?:index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")},
39+
// default options
40+
a.fn.smoothScroll.defaults=e});

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jquery-smooth-scroll",
33
"title": "jQuery Smooth Scroll",
4-
"version": "1.6.0",
4+
"version": "1.6.1",
55
"scripts": {},
66
"main": "jquery.smooth-scroll.js",
77
"author": {
@@ -22,16 +22,16 @@
2222
"jquery": ">=1.4.2"
2323
},
2424
"devDependencies": {
25-
"grunt": "~0.4.0",
26-
"grunt-contrib-concat": "~0.5.0",
27-
"grunt-contrib-jshint": "~0.1.1",
28-
"grunt-contrib-uglify": "~0.2.0",
29-
"grunt-contrib-watch": "~0.3.1",
30-
"grunt-shell": "~0.2",
31-
"grunt-version": "~0.1.1",
32-
"marked": "^0.3.2",
33-
"node-syntaxhighlighter": "~0.8.1",
34-
"qunitjs": "^1.15.0"
25+
"grunt": "^0.4.5",
26+
"grunt-contrib-concat": "^0.5.1",
27+
"grunt-contrib-jshint": "^0.11.3",
28+
"grunt-contrib-uglify": "^0.11.0",
29+
"grunt-contrib-watch": "^0.6.1",
30+
"grunt-shell": "^1.1.2",
31+
"grunt-version": "^1.0.0",
32+
"marked": "^0.3.5",
33+
"node-syntaxhighlighter": "^0.8.1",
34+
"qunitjs": "^1.20.0"
3535
},
3636
"keywords": [
3737
"jQuery",

src/jquery.smooth-scroll.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(function($) {
2-
var version = '1.6.0',
2+
var version = '1.6.1',
33
optionOverrides = {},
44
defaults = {
55
exclude: [],

0 commit comments

Comments
 (0)