Skip to content

Commit bb224d2

Browse files
author
Eonasdan
committed
minor changes
1 parent d4e5daa commit bb224d2

File tree

6 files changed

+274
-88
lines changed

6 files changed

+274
-88
lines changed

.jscs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"requireBlocksOnNewline": true,
3737
"disallowPaddingNewlinesInBlocks": true,
3838
"disallowEmptyBlocks": true,
39-
"disallowSpacesInsideObjectBrackets": true,
39+
"disallowSpacesInsideObjectBrackets": false,
4040
"disallowSpacesInsideArrayBrackets": true,
4141
"disallowSpacesInsideParentheses": true,
4242
"requireCommaBeforeLineBreak": true,

Gruntfile.js

Lines changed: 33 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ module.exports = function (grunt) {
22
'use strict';
33
grunt.initConfig({
44
pkg: grunt.file.readJSON('package.json'),
5-
6-
uglify : {
5+
uglify: {
76
target: {
87
files: {
9-
'build/js/bootstrap-datetimepicker.min.js' : 'src/js/bootstrap-datetimepicker.js'
8+
'build/js/bootstrap-datetimepicker.min.js': 'src/js/bootstrap-datetimepicker.js'
109
}
1110
},
1211
options: {
@@ -21,41 +20,40 @@ module.exports = function (grunt) {
2120
preserveComments: 'some'
2221
}
2322
},
24-
2523
jshint: {
2624
all: [
2725
'Gruntfile.js', 'src/js/*.js', 'test/*.js'
2826
],
2927
options: {
30-
'browser' : true,
31-
'node' : true,
32-
'jquery' : true,
33-
'boss' : false,
34-
'curly' : true,
35-
'debug' : false,
36-
'devel' : false,
37-
'eqeqeq' : true,
38-
'bitwise' : true,
39-
'eqnull' : true,
40-
'evil' : false,
41-
'forin' : true,
42-
'immed' : false,
43-
'laxbreak' : false,
44-
'newcap' : true,
45-
'noarg' : true,
46-
'noempty' : false,
47-
'nonew' : false,
48-
'onevar' : true,
49-
'plusplus' : false,
50-
'regexp' : false,
51-
'undef' : true,
52-
'sub' : true,
53-
'strict' : true,
54-
'unused' : true,
55-
'white' : true,
56-
'es3' : true,
57-
'camelcase' : true,
58-
'quotmark' : 'single',
28+
'browser': true,
29+
'node': true,
30+
'jquery': true,
31+
'boss': false,
32+
'curly': true,
33+
'debug': false,
34+
'devel': false,
35+
'eqeqeq': true,
36+
'bitwise': true,
37+
'eqnull': true,
38+
'evil': false,
39+
'forin': true,
40+
'immed': false,
41+
'laxbreak': false,
42+
'newcap': true,
43+
'noarg': true,
44+
'noempty': false,
45+
'nonew': false,
46+
'onevar': true,
47+
'plusplus': false,
48+
'regexp': false,
49+
'undef': true,
50+
'sub': true,
51+
'strict': true,
52+
'unused': true,
53+
'white': true,
54+
'es3': true,
55+
'camelcase': true,
56+
'quotmark': 'single',
5957
'globals': {
6058
'define': false,
6159
'moment': false,
@@ -72,7 +70,6 @@ module.exports = function (grunt) {
7270
}
7371
}
7472
},
75-
7673
jscs: {
7774
all: [
7875
'Gruntfile.js', 'src/js/*.js', 'test/*.js'
@@ -81,7 +78,6 @@ module.exports = function (grunt) {
8178
config: '.jscs.json'
8279
}
8380
},
84-
8581
less: {
8682
production: {
8783
options: {
@@ -102,21 +98,18 @@ module.exports = function (grunt) {
10298
}
10399
}
104100
},
105-
106101
env: {
107102
paris: {
108-
TZ : 'Europe/Paris' // sets env for phantomJS https://github.com/ariya/phantomjs/issues/10379#issuecomment-36058589
103+
TZ: 'Europe/Paris' // sets env for phantomJS https://github.com/ariya/phantomjs/issues/10379#issuecomment-36058589
109104
}
110105
},
111-
112106
connect: {
113107
server: {
114108
options: {
115109
port: 8099
116110
}
117111
}
118112
},
119-
120113
jasmine: {
121114
customTemplate: {
122115
src: 'src/js/*.js',
@@ -139,7 +132,6 @@ module.exports = function (grunt) {
139132
}
140133
}
141134
},
142-
143135
nugetpack: {
144136
less: {
145137
src: 'src/nuget/Bootstrap.v3.Datetimepicker.nuspec',
@@ -165,13 +157,8 @@ module.exports = function (grunt) {
165157
grunt.loadNpmTasks('grunt-contrib-jasmine');
166158
grunt.loadNpmTasks('grunt-nuget');
167159

168-
// These plugins provide necessary tasks.
169160
require('load-grunt-tasks')(grunt);
170-
171-
// Default task.
172161
grunt.registerTask('default', ['jshint', 'jscs', 'less', 'env:paris', 'connect', 'jasmine']);
173-
174-
// travis build task
175162
grunt.registerTask('build:travis', [
176163
// code style
177164
'jshint', 'jscs',
@@ -182,9 +169,7 @@ module.exports = function (grunt) {
182169
]);
183170

184171
// Task to be run when building
185-
grunt.registerTask('build', [
186-
'jshint', 'jscs', 'uglify', 'less'
187-
]);
172+
grunt.registerTask('build', ['jshint', 'jscs', 'uglify', 'less']);
188173

189174
grunt.registerTask('test', ['jshint', 'jscs', 'uglify', 'less', 'env:paris', 'connect', 'jasmine']);
190175

build/css/bootstrap-datetimepicker.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
.bootstrap-datetimepicker-widget.dropdown-menu.bottom:before {
3636
border-left: 7px solid transparent;
3737
border-right: 7px solid transparent;
38-
border-bottom: 7px solid #cccccc;
38+
border-bottom: 7px solid #ccc;
3939
border-bottom-color: rgba(0, 0, 0, 0.2);
4040
top: -7px;
4141
left: 7px;
@@ -50,7 +50,7 @@
5050
.bootstrap-datetimepicker-widget.dropdown-menu.top:before {
5151
border-left: 7px solid transparent;
5252
border-right: 7px solid transparent;
53-
border-top: 7px solid #cccccc;
53+
border-top: 7px solid #ccc;
5454
border-top-color: rgba(0, 0, 0, 0.2);
5555
bottom: -7px;
5656
left: 6px;
@@ -310,7 +310,7 @@
310310
.bootstrap-datetimepicker-widget table td.active,
311311
.bootstrap-datetimepicker-widget table td.active:hover {
312312
background-color: #337ab7;
313-
color: #ffffff;
313+
color: #fff;
314314
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
315315
}
316316
.bootstrap-datetimepicker-widget table td.active.today:before {
@@ -336,7 +336,7 @@
336336
}
337337
.bootstrap-datetimepicker-widget table td span.active {
338338
background-color: #337ab7;
339-
color: #ffffff;
339+
color: #fff;
340340
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
341341
}
342342
.bootstrap-datetimepicker-widget table td span.old {

build/js/bootstrap-datetimepicker.min.js

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

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
"description": "A date/time picker component designed to work with Bootstrap 3 and Momentjs. For usage, installation and demos see Project Site on GitHub",
1515
"devDependencies": {
1616
"grunt": "latest",
17-
"grunt-contrib-connect": "^0.11.2",
18-
"grunt-contrib-jasmine": "^0.7.0",
17+
"grunt-contrib-connect": "^1.0.1",
18+
"grunt-contrib-jasmine": "^1.0.3",
1919
"grunt-contrib-jshint": "latest",
2020
"grunt-contrib-less": "latest",
2121
"grunt-contrib-uglify": "latest",
2222
"grunt-env": "^0.4.4",
2323
"grunt-jscs": "latest",
24-
"grunt-nuget": "^0.1.4",
24+
"grunt-nuget": "^0.1.5",
2525
"grunt-string-replace": "latest",
2626
"load-grunt-tasks": "latest"
2727
},

src/js/bootstrap-datetimepicker.js

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@
132132
* Private functions
133133
*
134134
********************************************************************************/
135+
136+
hasTimeZone = function () {
137+
return moment.tz !== undefined && options.timeZone !== undefined && options.timeZone !== null && options.timeZone !== '';
138+
},
139+
135140
getMoment = function (d) {
136141
var returnMoment;
137142

@@ -178,10 +183,6 @@
178183
return (isEnabled('h') || isEnabled('m') || isEnabled('s'));
179184
},
180185

181-
hasTimeZone = function () {
182-
return moment.tz !== undefined && options.timeZone !== undefined && options.timeZone !== null && options.timeZone !== '';
183-
},
184-
185186
hasDate = function () {
186187
return (isEnabled('y') || isEnabled('M') || isEnabled('d'));
187188
},
@@ -233,13 +234,11 @@
233234

234235
if (isEnabled('h')) {
235236
topRow.append($('<td>')
236-
.append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.incrementHour}).addClass('btn').attr('data-action', 'incrementHours')
237-
.append($('<span>').addClass(options.icons.up))));
237+
.append($('<a>').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.incrementHour }).addClass('btn').attr('data-action', 'incrementHours').append($('<span>').addClass(options.icons.up))));
238238
middleRow.append($('<td>')
239-
.append($('<span>').addClass('timepicker-hour').attr({'data-time-component': 'hours', 'title': options.tooltips.pickHour}).attr('data-action', 'showHours')));
239+
.append($('<span>').addClass('timepicker-hour').attr({ 'data-time-component': 'hours', 'title': options.tooltips.pickHour }).attr('data-action', 'showHours')));
240240
bottomRow.append($('<td>')
241-
.append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.decrementHour}).addClass('btn').attr('data-action', 'decrementHours')
242-
.append($('<span>').addClass(options.icons.down))));
241+
.append($('<a>').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.decrementHour }).addClass('btn').attr('data-action', 'decrementHours').append($('<span>').addClass(options.icons.down))));
243242
}
244243
if (isEnabled('m')) {
245244
if (isEnabled('h')) {
@@ -248,12 +247,12 @@
248247
bottomRow.append($('<td>').addClass('separator'));
249248
}
250249
topRow.append($('<td>')
251-
.append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.incrementMinute}).addClass('btn').attr('data-action', 'incrementMinutes')
250+
.append($('<a>').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.incrementMinute }).addClass('btn').attr('data-action', 'incrementMinutes')
252251
.append($('<span>').addClass(options.icons.up))));
253252
middleRow.append($('<td>')
254-
.append($('<span>').addClass('timepicker-minute').attr({'data-time-component': 'minutes', 'title': options.tooltips.pickMinute}).attr('data-action', 'showMinutes')));
253+
.append($('<span>').addClass('timepicker-minute').attr({ 'data-time-component': 'minutes', 'title': options.tooltips.pickMinute }).attr('data-action', 'showMinutes')));
255254
bottomRow.append($('<td>')
256-
.append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.decrementMinute}).addClass('btn').attr('data-action', 'decrementMinutes')
255+
.append($('<a>').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.decrementMinute }).addClass('btn').attr('data-action', 'decrementMinutes')
257256
.append($('<span>').addClass(options.icons.down))));
258257
}
259258
if (isEnabled('s')) {
@@ -263,19 +262,19 @@
263262
bottomRow.append($('<td>').addClass('separator'));
264263
}
265264
topRow.append($('<td>')
266-
.append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.incrementSecond}).addClass('btn').attr('data-action', 'incrementSeconds')
265+
.append($('<a>').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.incrementSecond }).addClass('btn').attr('data-action', 'incrementSeconds')
267266
.append($('<span>').addClass(options.icons.up))));
268267
middleRow.append($('<td>')
269-
.append($('<span>').addClass('timepicker-second').attr({'data-time-component': 'seconds', 'title': options.tooltips.pickSecond}).attr('data-action', 'showSeconds')));
268+
.append($('<span>').addClass('timepicker-second').attr({ 'data-time-component': 'seconds', 'title': options.tooltips.pickSecond }).attr('data-action', 'showSeconds')));
270269
bottomRow.append($('<td>')
271-
.append($('<a>').attr({href: '#', tabindex: '-1', 'title': options.tooltips.decrementSecond}).addClass('btn').attr('data-action', 'decrementSeconds')
270+
.append($('<a>').attr({ href: '#', tabindex: '-1', 'title': options.tooltips.decrementSecond }).addClass('btn').attr('data-action', 'decrementSeconds')
272271
.append($('<span>').addClass(options.icons.down))));
273272
}
274273

275274
if (!use24Hours) {
276275
topRow.append($('<td>').addClass('separator'));
277276
middleRow.append($('<td>')
278-
.append($('<button>').addClass('btn btn-primary').attr({'data-action': 'togglePeriod', tabindex: '-1', 'title': options.tooltips.togglePeriod})));
277+
.append($('<button>').addClass('btn btn-primary').attr({ 'data-action': 'togglePeriod', tabindex: '-1', 'title': options.tooltips.togglePeriod })));
279278
bottomRow.append($('<td>').addClass('separator'));
280279
}
281280

@@ -309,16 +308,16 @@
309308
getToolbar = function () {
310309
var row = [];
311310
if (options.showTodayButton) {
312-
row.push($('<td>').append($('<a>').attr({'data-action': 'today', 'title': options.tooltips.today}).append($('<span>').addClass(options.icons.today))));
311+
row.push($('<td>').append($('<a>').attr({ 'data-action': 'today', 'title': options.tooltips.today }).append($('<span>').addClass(options.icons.today))));
313312
}
314313
if (!options.sideBySide && hasDate() && hasTime()) {
315-
row.push($('<td>').append($('<a>').attr({'data-action': 'togglePicker', 'title': options.tooltips.selectTime}).append($('<span>').addClass(options.icons.time))));
314+
row.push($('<td>').append($('<a>').attr({ 'data-action': 'togglePicker', 'title': options.tooltips.selectTime }).append($('<span>').addClass(options.icons.time))));
316315
}
317316
if (options.showClear) {
318-
row.push($('<td>').append($('<a>').attr({'data-action': 'clear', 'title': options.tooltips.clear}).append($('<span>').addClass(options.icons.clear))));
317+
row.push($('<td>').append($('<a>').attr({ 'data-action': 'clear', 'title': options.tooltips.clear }).append($('<span>').addClass(options.icons.clear))));
319318
}
320319
if (options.showClose) {
321-
row.push($('<td>').append($('<a>').attr({'data-action': 'close', 'title': options.tooltips.close}).append($('<span>').addClass(options.icons.close))));
320+
row.push($('<td>').append($('<a>').attr({ 'data-action': 'close', 'title': options.tooltips.close }).append($('<span>').addClass(options.icons.close))));
322321
}
323322
return $('<table>').addClass('table-condensed').append($('<tbody>').append($('<tr>').append(row)));
324323
},
@@ -644,7 +643,7 @@
644643
updateDecades = function () {
645644
var decadesView = widget.find('.datepicker-decades'),
646645
decadesViewHeader = decadesView.find('th'),
647-
startDecade = moment({y: viewDate.year() - (viewDate.year() % 100) - 1}),
646+
startDecade = moment({ y: viewDate.year() - (viewDate.year() % 100) - 1 }),
648647
endDecade = startDecade.clone().add(100, 'y'),
649648
startedAt = startDecade.clone(),
650649
minDateDecade = false,
@@ -657,13 +656,13 @@
657656

658657
decadesView.find('.disabled').removeClass('disabled');
659658

660-
if (startDecade.isSame(moment({y: 1900})) || (options.minDate && options.minDate.isAfter(startDecade, 'y'))) {
659+
if (startDecade.isSame(moment({ y: 1900 })) || (options.minDate && options.minDate.isAfter(startDecade, 'y'))) {
661660
decadesViewHeader.eq(0).addClass('disabled');
662661
}
663662

664663
decadesViewHeader.eq(1).text(startDecade.year() + '-' + endDecade.year());
665664

666-
if (startDecade.isSame(moment({y: 2000})) || (options.maxDate && options.maxDate.isBefore(endDecade, 'y'))) {
665+
if (startDecade.isSame(moment({ y: 2000 })) || (options.maxDate && options.maxDate.isBefore(endDecade, 'y'))) {
667666
decadesViewHeader.eq(2).addClass('disabled');
668667
}
669668

@@ -2293,10 +2292,9 @@
22932292
};
22942293
/**
22952294
* Returns the component's model current viewDate, a moment object or null if not set. Passing a null value unsets the components model current moment. Parsing of the newDate parameter is made using moment library with the options.format and options.useStrict components configuration.
2296-
* @param {Takes string, viewDate, moment, null parameter.} newDate
2297-
* @returns {viewDate.clone()}
2295+
* @param {Takes string, viewDate, moment, null parameter.} newDate
2296+
* @returns {viewDate.clone()}
22982297
*/
2299-
23002298
picker.viewDate = function (newDate) {
23012299
if (arguments.length === 0) {
23022300
return viewDate.clone();
@@ -2377,20 +2375,18 @@
23772375
/**
23782376
* See (http://jquery.com/).
23792377
* @name jQuery
2380-
* @class
2378+
* @class
23812379
* See the jQuery Library (http://jquery.com/) for full details. This just
23822380
* documents the function and classes that are added to jQuery by this plug-in.
23832381
*/
2384-
23852382
/**
23862383
* See (http://jquery.com/)
23872384
* @name fn
2388-
* @class
2385+
* @class
23892386
* See the jQuery Library (http://jquery.com/) for full details. This just
23902387
* documents the function and classes that are added to jQuery by this plug-in.
23912388
* @memberOf jQuery
23922389
*/
2393-
23942390
/**
23952391
* Show comments
23962392
* @class datetimepicker

0 commit comments

Comments
 (0)