Skip to content

Commit 80d0ffc

Browse files
version number in docs, js now gruntified, add sliderAccess to dist
1 parent 724b78e commit 80d0ffc

9 files changed

+119
-9
lines changed

Gruntfile.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ module.exports = function(grunt) {
2020
files: [
2121
//{ src: 'src/index.html', dest: 'dist/index.html' },
2222
{ src: 'src/<%= pkg.name %>.css', dest: 'dist/<%= pkg.name %>.css' },
23+
{ src: 'src/jquery-ui-sliderAccess.js', dest: 'dist/jquery-ui-sliderAccess.js' },
2324
{ src: 'src/i18n/jquery-ui-timepicker-*.js', dest: 'dist/i18n/', expand:true, flatten: true }
2425
]
2526
}
@@ -64,6 +65,22 @@ module.exports = function(grunt) {
6465
dest: 'dist/<%= pkg.name %>.min.css'
6566
}
6667
},
68+
replace: {
69+
dist: {
70+
options: {
71+
variables: {
72+
version: '<%= pkg.version %>',
73+
timestamp: '<%= grunt.template.today("yyyy-mm-dd") %>'
74+
},
75+
prefix: '@@'
76+
},
77+
files: [
78+
{ src: 'dist/<%= pkg.name %>.js', dest: 'dist/<%= pkg.name %>.js' },
79+
{ src: 'dist/<%= pkg.name %>.css', dest: 'dist/<%= pkg.name %>.css' },
80+
{ src: 'dist/index.html', dest: 'dist/index.html' }
81+
]
82+
}
83+
},
6784
jasmine: {
6885
src: 'src/<%= pkg.name %>.js',
6986
options: {
@@ -116,13 +133,14 @@ module.exports = function(grunt) {
116133
grunt.loadNpmTasks('grunt-contrib-clean');
117134
grunt.loadNpmTasks('grunt-contrib-concat');
118135
grunt.loadNpmTasks('grunt-contrib-copy');
136+
grunt.loadNpmTasks('grunt-replace');
119137
grunt.loadNpmTasks('grunt-contrib-uglify');
120138
grunt.loadNpmTasks('grunt-contrib-cssmin');
121139
grunt.loadNpmTasks('grunt-contrib-jasmine');
122140
grunt.loadNpmTasks('grunt-contrib-jshint');
123141
grunt.loadNpmTasks('grunt-contrib-watch');
124142

125143
// Default task.
126-
grunt.registerTask('default', ['jshint', 'jasmine', 'clean', 'copy', 'concat', 'uglify', 'cssmin']);
144+
grunt.registerTask('default', ['jshint', 'jasmine', 'clean', 'copy', 'concat', 'replace', 'uglify', 'cssmin']);
127145

128146
};

dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ <h3>Requirements</h3>
126126
<h3>Version</h3>
127127
<p>Version 1.3.2</p>
128128

129-
<p>Last updated on 07/07/2013</p>
129+
<p>Last updated on 2013-07-30</p>
130130
<p>jQuery Timepicker Addon is currently available for use in all personal or commercial projects under the MIT license.</p>
131131
<p><a href="http://trentrichardson.com/Impromptu/MIT-LICENSE.txt" title="MIT License">MIT License</a></p>
132132

dist/jquery-ui-sliderAccess.js

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* jQuery UI Slider Access
3+
* By: Trent Richardson [http://trentrichardson.com]
4+
* Version 0.3
5+
* Last Modified: 10/20/2012
6+
*
7+
* Copyright 2011 Trent Richardson
8+
* Dual licensed under the MIT and GPL licenses.
9+
* http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
10+
* http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
11+
*
12+
*/
13+
(function($){
14+
15+
$.fn.extend({
16+
sliderAccess: function(options){
17+
options = options || {};
18+
options.touchonly = options.touchonly !== undefined? options.touchonly : true; // by default only show it if touch device
19+
20+
if(options.touchonly === true && !("ontouchend" in document)){
21+
return $(this);
22+
}
23+
24+
return $(this).each(function(i,obj){
25+
var $t = $(this),
26+
o = $.extend({},{
27+
where: 'after',
28+
step: $t.slider('option','step'),
29+
upIcon: 'ui-icon-plus',
30+
downIcon: 'ui-icon-minus',
31+
text: false,
32+
upText: '+',
33+
downText: '-',
34+
buttonset: true,
35+
buttonsetTag: 'span',
36+
isRTL: false
37+
}, options),
38+
$buttons = $('<'+ o.buttonsetTag +' class="ui-slider-access">'+
39+
'<button data-icon="'+ o.downIcon +'" data-step="'+ (o.isRTL? o.step : o.step*-1) +'">'+ o.downText +'</button>'+
40+
'<button data-icon="'+ o.upIcon +'" data-step="'+ (o.isRTL? o.step*-1 : o.step) +'">'+ o.upText +'</button>'+
41+
'</'+ o.buttonsetTag +'>');
42+
43+
$buttons.children('button').each(function(j, jobj){
44+
var $jt = $(this);
45+
$jt.button({
46+
text: o.text,
47+
icons: { primary: $jt.data('icon') }
48+
})
49+
.click(function(e){
50+
var step = $jt.data('step'),
51+
curr = $t.slider('value'),
52+
newval = curr += step*1,
53+
minval = $t.slider('option','min'),
54+
maxval = $t.slider('option','max'),
55+
slidee = $t.slider("option", "slide") || function(){},
56+
stope = $t.slider("option", "stop") || function(){};
57+
58+
e.preventDefault();
59+
60+
if(newval < minval || newval > maxval){
61+
return;
62+
}
63+
64+
$t.slider('value', newval);
65+
66+
slidee.call($t, null, { value: newval });
67+
stope.call($t, null, { value: newval });
68+
});
69+
});
70+
71+
// before or after
72+
$t[o.where]($buttons);
73+
74+
if(o.buttonset){
75+
$buttons.removeClass('ui-corner-right').removeClass('ui-corner-left').buttonset();
76+
$buttons.eq(0).addClass('ui-corner-left');
77+
$buttons.eq(1).addClass('ui-corner-right');
78+
}
79+
80+
// adjust the width so we don't break the original layout
81+
var bOuterWidth = $buttons.css({
82+
marginLeft: ((o.where === 'after' && !o.isRTL) || (o.where === 'before' && o.isRTL)? 10:0),
83+
marginRight: ((o.where === 'before' && !o.isRTL) || (o.where === 'after' && o.isRTL)? 10:0)
84+
}).outerWidth(true) + 5;
85+
var tOuterWidth = $t.outerWidth(true);
86+
$t.css('display','inline-block').width(tOuterWidth-bOuterWidth);
87+
});
88+
}
89+
});
90+
91+
})(jQuery);

dist/jquery-ui-timepicker-addon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! jQuery Timepicker Addon - v1.3.2 - 2013-07-29
1+
/*! jQuery Timepicker Addon - v1.3.2 - 2013-07-30
22
* http://trentrichardson.com/examples/timepicker
33
* Copyright (c) 2013 Trent Richardson; Licensed MIT */
44
(function ($) {

dist/jquery-ui-timepicker-addon.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jquery-ui-timepicker-addon.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"grunt-contrib-clean": "~0.4.0",
1717
"grunt-contrib-copy": "~0.4.0",
1818
"grunt-contrib-cssmin": "~0.6.0",
19+
"grunt-replace": "~0.4.4",
1920
"grunt": "~0.4.1"
2021
}
2122
}

src/docs/intro.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ <h3>Requirements</h3>
4949

5050
<br />
5151
<h3>Version</h3>
52-
<p>Version 1.3.2</p>
52+
<p>Version @@version</p>
5353

54-
<p>Last updated on 07/07/2013</p>
54+
<p>Last updated on @@timestamp</p>
5555
<p>jQuery Timepicker Addon is currently available for use in all personal or commercial projects under the MIT license.</p>
5656
<p><a href="http://trentrichardson.com/Impromptu/MIT-LICENSE.txt" title="MIT License">MIT License</a></p>
5757

src/jquery-ui-timepicker-addon.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
$.extend($.ui, {
2424
timepicker: {
25-
version: "1.3.2"
25+
version: "@@version"
2626
}
2727
});
2828

@@ -2126,6 +2126,6 @@
21262126
/*
21272127
* Keep up with the version
21282128
*/
2129-
$.timepicker.version = "1.3.2";
2129+
$.timepicker.version = "@@version";
21302130

21312131
})(jQuery);

0 commit comments

Comments
 (0)