diff --git a/html/js/datetime/.gitignore b/html/js/datetime/.gitignore new file mode 100644 index 000000000..7bf6eb18f --- /dev/null +++ b/html/js/datetime/.gitignore @@ -0,0 +1,2 @@ +bower_components +node_modules diff --git a/html/js/datetime/.jscs.json b/html/js/datetime/.jscs.json new file mode 100644 index 000000000..1ce31f827 --- /dev/null +++ b/html/js/datetime/.jscs.json @@ -0,0 +1,63 @@ +{ + "requireCurlyBraces": [ + "if", + "else", + "for", + "while", + "do", + "try", + "catch" + ], + "requireSpaceAfterKeywords": [ + "if", + "else", + "for", + "while", + "do", + "switch", + "return", + "try", + "catch" + ], + "requireSpaceBeforeBlockStatements": true, + "requireParenthesesAroundIIFE": true, + "requireSpacesInConditionalExpression": true, + "requireSpacesInAnonymousFunctionExpression": { + "beforeOpeningRoundBrace": true, + "beforeOpeningCurlyBrace": true + }, + "requireSpacesInNamedFunctionExpression": { + "beforeOpeningCurlyBrace": true + }, + "disallowSpacesInNamedFunctionExpression": { + "beforeOpeningRoundBrace": true + }, + "requireMultipleVarDecl": "onevar", + "requireBlocksOnNewline": true, + "disallowPaddingNewlinesInBlocks": true, + "disallowEmptyBlocks": true, + "disallowSpacesInsideObjectBrackets": true, + "disallowSpacesInsideArrayBrackets": true, + "disallowSpacesInsideParentheses": true, + "requireCommaBeforeLineBreak": true, + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforeBinaryOperators": [ + "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", + "&=", "|=", "^=", + + "+", "-", "*", "/", "%", "<<", ">>", ">>>", "&", + "|", "^", "&&", "||", "===", "==", ">=", + "<=", "<", ">", "!=", "!==" + ], + "requireSpaceAfterBinaryOperators": true, + "requireCamelCaseOrUpperCaseIdentifiers": "ignoreProperties", + "disallowKeywords": ["with"], + "disallowMultipleLineStrings": true, + "validateLineBreaks": "LF", + "validateIndentation": 4, + "disallowTrailingWhitespace": true, + "disallowTrailingComma": true, + "requireLineFeedAtFileEnd": true, + "requireCapitalizedConstructors": true +} diff --git a/html/js/datetime/.npmignore b/html/js/datetime/.npmignore new file mode 100644 index 000000000..d3bbad7a0 --- /dev/null +++ b/html/js/datetime/.npmignore @@ -0,0 +1,12 @@ +/assets +/_includes +/_layouts +/.gitignore +/node_modules +/Makefile +/test +/build +*.log +*.swp +*~ +*.tgz diff --git a/html/js/datetime/.travis.yml b/html/js/datetime/.travis.yml new file mode 100644 index 000000000..ed8ba11eb --- /dev/null +++ b/html/js/datetime/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - 0.10 + +before_script: + - npm install -g grunt-cli + +script: grunt build:travis diff --git a/html/js/datetime/CONTRIBUTING.md b/html/js/datetime/CONTRIBUTING.md new file mode 100644 index 000000000..461fef02d --- /dev/null +++ b/html/js/datetime/CONTRIBUTING.md @@ -0,0 +1,32 @@ +Submitting Issues +================= + +If you are submitting a bug, please test and/or fork [this jsfiddle](http://jsfiddle.net/kmbo576p/) demonstrating the issue. Code issues and fringe case bugs that do not include a jsfiddle (or similar) will be closed. + +Contributing code +================= + +To contribute, fork the library and install grunt and dependencies. You need [node](http://nodejs.org/); use [nvm](https://github.com/creationix/nvm) or [nenv](https://github.com/ryuone/nenv) to install it. + +```bash +git clone https://github.com/Eonasdan/bootstrap-datetimepicker.git +cd bootstrap-datetimepicker +npm install -g grunt-cli +npm install +git checkout development # all patches against development branch, please! +grunt # this runs tests and jshint +``` + +Very important notes +==================== + + * **Pull requests to the `master` branch will be closed.** Please submit all pull requests to the `development` branch. + * **Do not include the minified files in your pull request.** Don't worry, we'll build them when we cut a release. + +Grunt tasks +=========== + +We use Grunt for managing the build. Here are some useful Grunt tasks: + + * `grunt` The default task lints the code and runs the tests. You should make sure you do this before submitting a PR. + * `grunt build` Compiles the less stylesheet and minifies the javascript source in build directory. diff --git a/html/js/datetime/Gruntfile.js b/html/js/datetime/Gruntfile.js new file mode 100644 index 000000000..cf1ade14c --- /dev/null +++ b/html/js/datetime/Gruntfile.js @@ -0,0 +1,155 @@ +module.exports = function (grunt) { + 'use strict'; + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + + uglify : { + target: { + files: { + 'build/js/bootstrap-datetimepicker.min.js' : 'src/js/bootstrap-datetimepicker.js' + } + }, + options: { + mangle: true, + compress: { + dead_code: false // jshint ignore:line + }, + output: { + ascii_only: true // jshint ignore:line + }, + report: 'min', + preserveComments: 'some' + } + }, + + jshint: { + all: [ + 'Gruntfile.js', 'src/js/*.js' + ], + options: { + 'browser' : true, + 'node' : true, + 'boss' : false, + 'curly' : true, + 'debug' : false, + 'devel' : false, + 'eqeqeq' : true, + 'bitwise' : true, + 'eqnull' : true, + 'evil' : false, + 'forin' : true, + 'immed' : false, + 'laxbreak' : false, + 'newcap' : true, + 'noarg' : true, + 'noempty' : false, + 'nonew' : false, + 'onevar' : true, + 'plusplus' : false, + 'regexp' : false, + 'undef' : true, + 'sub' : true, + 'strict' : true, + 'unused' : true, + 'white' : true, + 'es3' : true, + 'camelcase' : true, + 'quotmark' : 'single', + 'globals': { + 'define': false, + 'jQuery': false, + 'moment': false + } + } + }, + + jscs: { + all: [ + 'Gruntfile.js', 'src/js/*.js' + ], + options: { + config: '.jscs.json' + } + }, + + less: { + production: { + options: { + cleancss: true + }, + files: { + 'build/css/bootstrap-datetimepicker.min.css': 'src/less/bootstrap-datetimepicker-build.less' + } + }, + development: { + files: { + 'build/css/bootstrap-datetimepicker.css': 'src/less/bootstrap-datetimepicker-build.less' + } + } + } + + }); + + grunt.loadTasks('tasks'); + + // These plugins provide necessary tasks. + require('load-grunt-tasks')(grunt); + + // Default task. + grunt.registerTask('default', ['jshint', 'jscs']); + + // travis build task + grunt.registerTask('build:travis', [ + // code style + 'jshint', 'jscs' + ]); + + // Task to be run when building + grunt.registerTask('build', [ + 'jshint', 'jscs', 'uglify', 'less' + ]); + + grunt.registerTask('nuget', 'Create a nuget package', function () { + var target = grunt.option('target') || 'less', done = this.async(); + if (target === 'less') { + grunt.util.spawn({ + cmd: 'src/nuget/nuget.exe', + args: [ + 'pack', + 'src/nuget/Bootstrap.v3.Datetimepicker.nuspec', + '-OutputDirectory', + 'build/nuget', + '-Version', + grunt.config.get('pkg').version + ] + }, function (error, result) { + if (error) { + grunt.log.error(error); + } else { + grunt.log.write(result); + } + done(); + }); + } + else { + grunt.util.spawn({ + cmd: 'src/nuget/nuget.exe', + args: [ + 'pack', + 'src/nuget/Bootstrap.v3.Datetimepicker.CSS.nuspec', + '-OutputDirectory', + 'build/nuget', + '-Version', + grunt.config.get('pkg').version + ] + }, function (error, result) { + if (error) { + grunt.log.error(error); + } else { + grunt.log.write(result); + } + done(); + }); + } + }); +}; diff --git a/html/js/datetime/LICENSE b/html/js/datetime/LICENSE new file mode 100644 index 000000000..47f5de70e --- /dev/null +++ b/html/js/datetime/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Eonasdan, nikoskalogridis + +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. diff --git a/html/js/datetime/README.md b/html/js/datetime/README.md new file mode 100644 index 000000000..dbe1d698a --- /dev/null +++ b/html/js/datetime/README.md @@ -0,0 +1,17 @@ +# Bootstrap v3 datetimepicker widget ![GitHub version](https://badge.fury.io/gh/Eonasdan%2Fbootstrap-datetimepicker.png)   ![Travis](https://travis-ci.org/Eonasdan/bootstrap-datetimepicker.svg?branch=development) + +![DateTimePicker](http://i.imgur.com/nfnvh5g.png) + +## [View the manual and demos](http://eonasdan.github.io/bootstrap-datetimepicker/) + +## Submitting Issues +Please test and/or fork [this jsfiddle](http://jsfiddle.net/kmbo576p/) with an example of your issue before you post an issue here. + +## Where do you use this? +I'd love to know if your public site is using this plugin and list your logo on the documentation site. Please email me `eonasdan at outlook dot com`. Do not submit issue/feature request to this email, they will be ignored. + +## [Installation instructions](https://github.com/Eonasdan/bootstrap-datetimepicker/wiki/Installation) +Installation instructions has been moved to the wiki + +## [Change Log](https://github.com/Eonasdan/bootstrap-datetimepicker/wiki/Change-Log) +The change log has moved to the wiki diff --git a/html/js/datetime/bower.json b/html/js/datetime/bower.json new file mode 100644 index 000000000..aaf6fcb12 --- /dev/null +++ b/html/js/datetime/bower.json @@ -0,0 +1,35 @@ +{ + "name": "eonasdan-bootstrap-datetimepicker", + "version": "3.1.3", + "main": [ + "build/css/bootstrap-datetimepicker.min.css", + "build/js/bootstrap-datetimepicker.min.js" + ], + "dependencies": { + "jquery": ">=1.8.3", + "bootstrap": ">= 3.0", + "moment": ">=2.8.0" + }, + "homepage": "https://github.com/Eonasdan/bootstrap-datetimepicker", + "authors": [ + "Eonasdan" + ], + "description": "bootstrap3 datetimepicker", + "keywords": [ + "twitter-bootstrap", + "bootstrap", + "datepicker", + "datetimepicker", + "timepicker", + "moment" + ], + "license": "MIT", + "private": false, + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/html/js/datetime/build/css/bootstrap-datetimepicker.css b/html/js/datetime/build/css/bootstrap-datetimepicker.css new file mode 100644 index 000000000..bd37b08b3 --- /dev/null +++ b/html/js/datetime/build/css/bootstrap-datetimepicker.css @@ -0,0 +1,238 @@ +/*! + * Datetimepicker for Bootstrap v3 +//! version : 3.1.3 + * https://github.com/Eonasdan/bootstrap-datetimepicker/ + */ +.bootstrap-datetimepicker-widget { + top: 0; + left: 0; + width: 250px; + padding: 4px; + margin-top: 1px; + z-index: 99999 !important; + border-radius: 4px; +} +.bootstrap-datetimepicker-widget.timepicker-sbs { + width: 600px; +} +.bootstrap-datetimepicker-widget.bottom:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-bottom-color: rgba(0, 0, 0, 0.2); + position: absolute; + top: -7px; + left: 7px; +} +.bootstrap-datetimepicker-widget.bottom:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid white; + position: absolute; + top: -6px; + left: 8px; +} +.bootstrap-datetimepicker-widget.top:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-top: 7px solid #ccc; + border-top-color: rgba(0, 0, 0, 0.2); + position: absolute; + bottom: -7px; + left: 6px; +} +.bootstrap-datetimepicker-widget.top:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 6px solid white; + position: absolute; + bottom: -6px; + left: 7px; +} +.bootstrap-datetimepicker-widget .dow { + width: 14.2857%; +} +.bootstrap-datetimepicker-widget.pull-right:before { + left: auto; + right: 6px; +} +.bootstrap-datetimepicker-widget.pull-right:after { + left: auto; + right: 7px; +} +.bootstrap-datetimepicker-widget > ul { + list-style-type: none; + margin: 0; +} +.bootstrap-datetimepicker-widget a[data-action] { + padding: 6px 0; +} +.bootstrap-datetimepicker-widget a[data-action]:active { + box-shadow: none; +} +.bootstrap-datetimepicker-widget .timepicker-hour, +.bootstrap-datetimepicker-widget .timepicker-minute, +.bootstrap-datetimepicker-widget .timepicker-second { + width: 54px; + font-weight: bold; + font-size: 1.2em; + margin: 0; +} +.bootstrap-datetimepicker-widget button[data-action] { + padding: 6px; +} +.bootstrap-datetimepicker-widget table[data-hour-format="12"] .separator { + width: 4px; + padding: 0; + margin: 0; +} +.bootstrap-datetimepicker-widget .datepicker > div { + display: none; +} +.bootstrap-datetimepicker-widget .picker-switch { + text-align: center; +} +.bootstrap-datetimepicker-widget table { + width: 100%; + margin: 0; +} +.bootstrap-datetimepicker-widget td, +.bootstrap-datetimepicker-widget th { + text-align: center; + border-radius: 4px; +} +.bootstrap-datetimepicker-widget td { + height: 54px; + line-height: 54px; + width: 54px; +} +.bootstrap-datetimepicker-widget td.cw { + font-size: 10px; + height: 20px; + line-height: 20px; + color: #777777; +} +.bootstrap-datetimepicker-widget td.day { + height: 20px; + line-height: 20px; + width: 20px; +} +.bootstrap-datetimepicker-widget td.day:hover, +.bootstrap-datetimepicker-widget td.hour:hover, +.bootstrap-datetimepicker-widget td.minute:hover, +.bootstrap-datetimepicker-widget td.second:hover { + background: #eeeeee; + cursor: pointer; +} +.bootstrap-datetimepicker-widget td.old, +.bootstrap-datetimepicker-widget td.new { + color: #777777; +} +.bootstrap-datetimepicker-widget td.today { + position: relative; +} +.bootstrap-datetimepicker-widget td.today:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-bottom: 7px solid #428bca; + border-top-color: rgba(0, 0, 0, 0.2); + position: absolute; + bottom: 4px; + right: 4px; +} +.bootstrap-datetimepicker-widget td.active, +.bootstrap-datetimepicker-widget td.active:hover { + background-color: #428bca; + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} +.bootstrap-datetimepicker-widget td.active.today:before { + border-bottom-color: #fff; +} +.bootstrap-datetimepicker-widget td.disabled, +.bootstrap-datetimepicker-widget td.disabled:hover { + background: none; + color: #777777; + cursor: not-allowed; +} +.bootstrap-datetimepicker-widget td span { + display: inline-block; + width: 54px; + height: 54px; + line-height: 54px; + margin: 2px 1.5px; + cursor: pointer; + border-radius: 4px; +} +.bootstrap-datetimepicker-widget td span:hover { + background: #eeeeee; +} +.bootstrap-datetimepicker-widget td span.active { + background-color: #428bca; + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} +.bootstrap-datetimepicker-widget td span.old { + color: #777777; +} +.bootstrap-datetimepicker-widget td span.disabled, +.bootstrap-datetimepicker-widget td span.disabled:hover { + background: none; + color: #777777; + cursor: not-allowed; +} +.bootstrap-datetimepicker-widget th { + height: 20px; + line-height: 20px; + width: 20px; +} +.bootstrap-datetimepicker-widget th.picker-switch { + width: 145px; +} +.bootstrap-datetimepicker-widget th.next, +.bootstrap-datetimepicker-widget th.prev { + font-size: 21px; +} +.bootstrap-datetimepicker-widget th.disabled, +.bootstrap-datetimepicker-widget th.disabled:hover { + background: none; + color: #777777; + cursor: not-allowed; +} +.bootstrap-datetimepicker-widget thead tr:first-child th { + cursor: pointer; +} +.bootstrap-datetimepicker-widget thead tr:first-child th:hover { + background: #eeeeee; +} +.input-group.date .input-group-addon span { + display: block; + cursor: pointer; + width: 16px; + height: 16px; +} +.bootstrap-datetimepicker-widget.left-oriented:before { + left: auto; + right: 6px; +} +.bootstrap-datetimepicker-widget.left-oriented:after { + left: auto; + right: 7px; +} +.bootstrap-datetimepicker-widget ul.list-unstyled li div.timepicker div.timepicker-picker table.table-condensed tbody > tr > td { + padding: 0px !important; +} +@media screen and (max-width: 767px) { + .bootstrap-datetimepicker-widget.timepicker-sbs { + width: 283px; + } +} diff --git a/html/js/datetime/build/css/bootstrap-datetimepicker.min.css b/html/js/datetime/build/css/bootstrap-datetimepicker.min.css new file mode 100644 index 000000000..cf838a3c2 --- /dev/null +++ b/html/js/datetime/build/css/bootstrap-datetimepicker.min.css @@ -0,0 +1,5 @@ +/*! + * Datetimepicker for Bootstrap v3 +//! version : 3.1.3 + * https://github.com/Eonasdan/bootstrap-datetimepicker/ + */.bootstrap-datetimepicker-widget{top:0;left:0;width:250px;padding:4px;margin-top:1px;z-index:99999!important;border-radius:4px}.bootstrap-datetimepicker-widget.timepicker-sbs{width:600px}.bootstrap-datetimepicker-widget.bottom:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-bottom-color:rgba(0,0,0,.2);position:absolute;top:-7px;left:7px}.bootstrap-datetimepicker-widget.bottom:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;position:absolute;top:-6px;left:8px}.bootstrap-datetimepicker-widget.top:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-top:7px solid #ccc;border-top-color:rgba(0,0,0,.2);position:absolute;bottom:-7px;left:6px}.bootstrap-datetimepicker-widget.top:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #fff;position:absolute;bottom:-6px;left:7px}.bootstrap-datetimepicker-widget .dow{width:14.2857%}.bootstrap-datetimepicker-widget.pull-right:before{left:auto;right:6px}.bootstrap-datetimepicker-widget.pull-right:after{left:auto;right:7px}.bootstrap-datetimepicker-widget>ul{list-style-type:none;margin:0}.bootstrap-datetimepicker-widget a[data-action]{padding:6px 0}.bootstrap-datetimepicker-widget a[data-action]:active{box-shadow:none}.bootstrap-datetimepicker-widget .timepicker-hour,.bootstrap-datetimepicker-widget .timepicker-minute,.bootstrap-datetimepicker-widget .timepicker-second{width:54px;font-weight:700;font-size:1.2em;margin:0}.bootstrap-datetimepicker-widget button[data-action]{padding:6px}.bootstrap-datetimepicker-widget table[data-hour-format="12"] .separator{width:4px;padding:0;margin:0}.bootstrap-datetimepicker-widget .datepicker>div{display:none}.bootstrap-datetimepicker-widget .picker-switch{text-align:center}.bootstrap-datetimepicker-widget table{width:100%;margin:0}.bootstrap-datetimepicker-widget td,.bootstrap-datetimepicker-widget th{text-align:center;border-radius:4px}.bootstrap-datetimepicker-widget td{height:54px;line-height:54px;width:54px}.bootstrap-datetimepicker-widget td.cw{font-size:10px;height:20px;line-height:20px;color:#777}.bootstrap-datetimepicker-widget td.day{height:20px;line-height:20px;width:20px}.bootstrap-datetimepicker-widget td.day:hover,.bootstrap-datetimepicker-widget td.hour:hover,.bootstrap-datetimepicker-widget td.minute:hover,.bootstrap-datetimepicker-widget td.second:hover{background:#eee;cursor:pointer}.bootstrap-datetimepicker-widget td.old,.bootstrap-datetimepicker-widget td.new{color:#777}.bootstrap-datetimepicker-widget td.today{position:relative}.bootstrap-datetimepicker-widget td.today:before{content:'';display:inline-block;border-left:7px solid transparent;border-bottom:7px solid #428bca;border-top-color:rgba(0,0,0,.2);position:absolute;bottom:4px;right:4px}.bootstrap-datetimepicker-widget td.active,.bootstrap-datetimepicker-widget td.active:hover{background-color:#428bca;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.bootstrap-datetimepicker-widget td.active.today:before{border-bottom-color:#fff}.bootstrap-datetimepicker-widget td.disabled,.bootstrap-datetimepicker-widget td.disabled:hover{background:0 0;color:#777;cursor:not-allowed}.bootstrap-datetimepicker-widget td span{display:inline-block;width:54px;height:54px;line-height:54px;margin:2px 1.5px;cursor:pointer;border-radius:4px}.bootstrap-datetimepicker-widget td span:hover{background:#eee}.bootstrap-datetimepicker-widget td span.active{background-color:#428bca;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.bootstrap-datetimepicker-widget td span.old{color:#777}.bootstrap-datetimepicker-widget td span.disabled,.bootstrap-datetimepicker-widget td span.disabled:hover{background:0 0;color:#777;cursor:not-allowed}.bootstrap-datetimepicker-widget th{height:20px;line-height:20px;width:20px}.bootstrap-datetimepicker-widget th.picker-switch{width:145px}.bootstrap-datetimepicker-widget th.next,.bootstrap-datetimepicker-widget th.prev{font-size:21px}.bootstrap-datetimepicker-widget th.disabled,.bootstrap-datetimepicker-widget th.disabled:hover{background:0 0;color:#777;cursor:not-allowed}.bootstrap-datetimepicker-widget thead tr:first-child th{cursor:pointer}.bootstrap-datetimepicker-widget thead tr:first-child th:hover{background:#eee}.input-group.date .input-group-addon span{display:block;cursor:pointer;width:16px;height:16px}.bootstrap-datetimepicker-widget.left-oriented:before{left:auto;right:6px}.bootstrap-datetimepicker-widget.left-oriented:after{left:auto;right:7px}.bootstrap-datetimepicker-widget ul.list-unstyled li div.timepicker div.timepicker-picker table.table-condensed tbody>tr>td{padding:0!important}@media screen and (max-width:767px){.bootstrap-datetimepicker-widget.timepicker-sbs{width:283px}} \ No newline at end of file diff --git a/html/js/datetime/build/js/bootstrap-datetimepicker.min.js b/html/js/datetime/build/js/bootstrap-datetimepicker.min.js new file mode 100644 index 000000000..cdba4b105 --- /dev/null +++ b/html/js/datetime/build/js/bootstrap-datetimepicker.min.js @@ -0,0 +1 @@ +!function(a,b){"use strict";if("function"==typeof define&&define.amd)define(["jquery","moment"],b);else if("object"==typeof exports)b(require("jquery"),require("moment"));else{if(!jQuery)throw new Error("bootstrap-datetimepicker requires jQuery to be loaded first");if(!moment)throw new Error("bootstrap-datetimepicker requires moment.js to be loaded first");b(a.jQuery,moment)}}(this,function(a,b){"use strict";if("undefined"==typeof b)throw new Error("momentjs is required");var c=0,d=function(d,e){var f,g=a.fn.datetimepicker.defaults,h={time:"glyphicon glyphicon-time",date:"glyphicon glyphicon-calendar",up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},i=this,j=!1,k=function(){var f,j,k=!1;if(i.options=a.extend({},g,e),i.options.icons=a.extend({},h,i.options.icons),i.element=a(d),m(),!i.options.pickTime&&!i.options.pickDate)throw new Error("Must choose at least one picker");if(i.id=c++,b.locale(i.options.language),i.date=b(),i.unset=!1,i.isInput=i.element.is("input"),i.component=!1,i.element.hasClass("input-group")&&(i.component=i.element.find(0===i.element.find(".datepickerbutton").size()?'[class^="input-group-"]':".datepickerbutton")),i.format=i.options.format,f=b().localeData(),i.format||(i.format=i.options.pickDate?f.longDateFormat("L"):"",i.options.pickDate&&i.options.pickTime&&(i.format+=" "),i.format+=i.options.pickTime?f.longDateFormat("LT"):"",i.options.useSeconds&&(-1!==f.longDateFormat("LT").indexOf(" A")?i.format=i.format.split(" A")[0]+":ss A":i.format+=":ss")),i.use24hours=i.format.toLowerCase().indexOf("a")<0&&i.format.indexOf("h")<0,i.component&&(k=i.component.find("span")),i.options.pickTime&&k&&k.addClass(i.options.icons.time),i.options.pickDate&&k&&(k.removeClass(i.options.icons.time),k.addClass(i.options.icons.date)),i.options.widgetParent="string"==typeof i.options.widgetParent&&i.options.widgetParent||i.element.parents().filter(function(){return"scroll"===a(this).css("overflow-y")}).get(0)||"body",i.widget=a(Q()).appendTo(i.options.widgetParent),i.minViewMode=i.options.minViewMode||0,"string"==typeof i.minViewMode)switch(i.minViewMode){case"months":i.minViewMode=1;break;case"years":i.minViewMode=2;break;default:i.minViewMode=0}if(i.viewMode=i.options.viewMode||0,"string"==typeof i.viewMode)switch(i.viewMode){case"months":i.viewMode=1;break;case"years":i.viewMode=2;break;default:i.viewMode=0}i.viewMode=Math.max(i.viewMode,i.minViewMode),i.options.disabledDates=O(i.options.disabledDates),i.options.enabledDates=O(i.options.enabledDates),i.startViewMode=i.viewMode,i.setMinDate(i.options.minDate),i.setMaxDate(i.options.maxDate),r(),s(),u(),v(),w(),q(),E(),l().prop("disabled")||F(),""!==i.options.defaultDate&&""===l().val()&&i.setValue(i.options.defaultDate),1!==i.options.minuteStepping&&(j=i.options.minuteStepping,i.date.minutes(Math.round(i.date.minutes()/j)*j%60).seconds(0))},l=function(){var a;if(i.isInput)return i.element;if(a=i.element.find(".datepickerinput"),0===a.size())a=i.element.find("input");else if(!a.is("input"))throw new Error('CSS class "datepickerinput" cannot be applied to non input element');return a},m=function(){var a;a=i.element.is("input")?i.element.data():i.element.find("input").data(),void 0!==a.dateFormat&&(i.options.format=a.dateFormat),void 0!==a.datePickdate&&(i.options.pickDate=a.datePickdate),void 0!==a.datePicktime&&(i.options.pickTime=a.datePicktime),void 0!==a.dateUseminutes&&(i.options.useMinutes=a.dateUseminutes),void 0!==a.dateUseseconds&&(i.options.useSeconds=a.dateUseseconds),void 0!==a.dateUsecurrent&&(i.options.useCurrent=a.dateUsecurrent),void 0!==a.calendarWeeks&&(i.options.calendarWeeks=a.calendarWeeks),void 0!==a.dateMinutestepping&&(i.options.minuteStepping=a.dateMinutestepping),void 0!==a.dateMindate&&(i.options.minDate=a.dateMindate),void 0!==a.dateMaxdate&&(i.options.maxDate=a.dateMaxdate),void 0!==a.dateShowtoday&&(i.options.showToday=a.dateShowtoday),void 0!==a.dateCollapse&&(i.options.collapse=a.dateCollapse),void 0!==a.dateLanguage&&(i.options.language=a.dateLanguage),void 0!==a.dateDefaultdate&&(i.options.defaultDate=a.dateDefaultdate),void 0!==a.dateDisableddates&&(i.options.disabledDates=a.dateDisableddates),void 0!==a.dateEnableddates&&(i.options.enabledDates=a.dateEnableddates),void 0!==a.dateIcons&&(i.options.icons=a.dateIcons),void 0!==a.dateUsestrict&&(i.options.useStrict=a.dateUsestrict),void 0!==a.dateDirection&&(i.options.direction=a.dateDirection),void 0!==a.dateSidebyside&&(i.options.sideBySide=a.dateSidebyside),void 0!==a.dateDaysofweekdisabled&&(i.options.daysOfWeekDisabled=a.dateDaysofweekdisabled)},n=function(){var b,c="absolute",d=i.component?i.component.offset():i.element.offset(),e=a(window);i.width=i.component?i.component.outerWidth():i.element.outerWidth(),d.top=d.top+i.element.outerHeight(),"up"===i.options.direction?b="top":"bottom"===i.options.direction?b="bottom":"auto"===i.options.direction&&(b=d.top+i.widget.height()>e.height()+e.scrollTop()&&i.widget.height()+i.element.outerHeight()"),e=b.weekdaysMin();if(i.options.calendarWeeks===!0&&d.append('#'),0===b().localeData()._week.dow)for(c=0;7>c;c++)d.append(''+e[c]+"");else for(c=1;8>c;c++)d.append(7===c?''+e[0]+"":''+e[c]+"");i.widget.find(".datepicker-days thead").append(d)},s=function(){b.locale(i.options.language);var a,c="",d=b.monthsShort();for(a=0;12>a;a++)c+=''+d[a]+"";i.widget.find(".datepicker-months td").append(c)},t=function(){if(i.options.pickDate){b.locale(i.options.language);var c,d,e,f,g,h,j,k,l,m=i.viewDate.year(),n=i.viewDate.month(),o=i.options.minDate.year(),p=i.options.minDate.month(),q=i.options.maxDate.year(),r=i.options.maxDate.month(),s=[],t=b.months();for(i.widget.find(".datepicker-days").find(".disabled").removeClass("disabled"),i.widget.find(".datepicker-months").find(".disabled").removeClass("disabled"),i.widget.find(".datepicker-years").find(".disabled").removeClass("disabled"),i.widget.find(".datepicker-days th:eq(1)").text(t[n]+" "+m),d=b(i.viewDate,i.format,i.options.useStrict).subtract(1,"months"),j=d.daysInMonth(),d.date(j).startOf("week"),(m===o&&p>=n||o>m)&&i.widget.find(".datepicker-days th:eq(0)").addClass("disabled"),(m===q&&n>=r||m>q)&&i.widget.find(".datepicker-days th:eq(2)").addClass("disabled"),e=b(d).add(42,"d");d.isBefore(e);){if(d.weekday()===b().startOf("week").weekday()&&(f=a(""),s.push(f),i.options.calendarWeeks===!0&&f.append(''+d.week()+"")),g="",d.year()m||d.year()===m&&d.month()>n)&&(g+=" new"),d.isSame(b({y:i.date.year(),M:i.date.month(),d:i.date.date()}))&&(g+=" active"),(M(d,"day")||!N(d))&&(g+=" disabled"),i.options.showToday===!0&&d.isSame(b(),"day")&&(g+=" today"),i.options.daysOfWeekDisabled)for(h=0;h'+d.date()+""),c=d.date(),d.add(1,"d"),c===d.date()&&d.add(1,"d")}for(i.widget.find(".datepicker-days tbody").empty().append(s),l=i.date.year(),t=i.widget.find(".datepicker-months").find("th:eq(1)").text(m).end().find("span").removeClass("active"),l===m&&t.eq(i.date.month()).addClass("active"),o>m-1&&i.widget.find(".datepicker-months th:eq(0)").addClass("disabled"),m+1>q&&i.widget.find(".datepicker-months th:eq(2)").addClass("disabled"),h=0;12>h;h++)m===o&&p>h||o>m?a(t[h]).addClass("disabled"):(m===q&&h>r||m>q)&&a(t[h]).addClass("disabled");for(s="",m=10*parseInt(m/10,10),k=i.widget.find(".datepicker-years").find("th:eq(1)").text(m+"-"+(m+9)).parents("table").find("td"),i.widget.find(".datepicker-years").find("th").removeClass("disabled"),o>m&&i.widget.find(".datepicker-years").find("th:eq(0)").addClass("disabled"),m+9>q&&i.widget.find(".datepicker-years").find("th:eq(2)").addClass("disabled"),m-=1,h=-1;11>h;h++)s+='m||m>q?" disabled":"")+'">'+m+"",m+=1;k.html(s)}},u=function(){b.locale(i.options.language);var a,c,d,e=i.widget.find(".timepicker .timepicker-hours table"),f="";if(e.parent().hide(),i.use24hours)for(a=0,c=0;6>c;c+=1){for(f+="",d=0;4>d;d+=1)f+=''+P(a.toString())+"",a++;f+=""}else for(a=1,c=0;3>c;c+=1){for(f+="",d=0;4>d;d+=1)f+=''+P(a.toString())+"",a++;f+=""}e.html(f)},v=function(){var a,b,c=i.widget.find(".timepicker .timepicker-minutes table"),d="",e=0,f=i.options.minuteStepping;for(c.parent().hide(),1===f&&(f=5),a=0;ab;b+=1)60>e?(d+=''+P(e.toString())+"",e+=f):d+="";d+=""}c.html(d)},w=function(){var a,b,c=i.widget.find(".timepicker .timepicker-seconds table"),d="",e=0;for(c.parent().hide(),a=0;3>a;a++){for(d+="",b=0;4>b;b+=1)d+=''+P(e.toString())+"",e+=5;d+=""}c.html(d)},x=function(){if(i.date){var a=i.widget.find(".timepicker span[data-time-component]"),b=i.date.hours(),c=i.date.format("A");i.use24hours||(0===b?b=12:12!==b&&(b%=12),i.widget.find(".timepicker [data-action=togglePeriod]").text(c)),a.filter("[data-time-component=hours]").text(P(b)),a.filter("[data-time-component=minutes]").text(P(i.date.minutes())),a.filter("[data-time-component=seconds]").text(P(i.date.second()))}},y=function(c){c.stopPropagation(),c.preventDefault(),i.unset=!1;var d,e,f,g,h=a(c.target).closest("span, td, th"),j=b(i.date);if(1===h.length&&!h.is(".disabled"))switch(h[0].nodeName.toLowerCase()){case"th":switch(h[0].className){case"picker-switch":E(1);break;case"prev":case"next":f=R.modes[i.viewMode].navStep,"prev"===h[0].className&&(f=-1*f),i.viewDate.add(f,R.modes[i.viewMode].navFnc),t()}break;case"span":h.is(".month")?(d=h.parent().find("span").index(h),i.viewDate.month(d)):(e=parseInt(h.text(),10)||0,i.viewDate.year(e)),i.viewMode===i.minViewMode&&(i.date=b({y:i.viewDate.year(),M:i.viewDate.month(),d:i.viewDate.date(),h:i.date.hours(),m:i.date.minutes(),s:i.date.seconds()}),K(),o(j,c.type)),E(-1),t();break;case"td":h.is(".day")&&(g=parseInt(h.text(),10)||1,d=i.viewDate.month(),e=i.viewDate.year(),h.is(".old")?0===d?(d=11,e-=1):d-=1:h.is(".new")&&(11===d?(d=0,e+=1):d+=1),i.date=b({y:e,M:d,d:g,h:i.date.hours(),m:i.date.minutes(),s:i.date.seconds()}),i.viewDate=b({y:e,M:d,d:Math.min(28,g)}),t(),K(),o(j,c.type))}},z={incrementHours:function(){L("add","hours",1)},incrementMinutes:function(){L("add","minutes",i.options.minuteStepping)},incrementSeconds:function(){L("add","seconds",1)},decrementHours:function(){L("subtract","hours",1)},decrementMinutes:function(){L("subtract","minutes",i.options.minuteStepping)},decrementSeconds:function(){L("subtract","seconds",1)},togglePeriod:function(){var a=i.date.hours();a>=12?a-=12:a+=12,i.date.hours(a)},showPicker:function(){i.widget.find(".timepicker > div:not(.timepicker-picker)").hide(),i.widget.find(".timepicker .timepicker-picker").show()},showHours:function(){i.widget.find(".timepicker .timepicker-picker").hide(),i.widget.find(".timepicker .timepicker-hours").show()},showMinutes:function(){i.widget.find(".timepicker .timepicker-picker").hide(),i.widget.find(".timepicker .timepicker-minutes").show()},showSeconds:function(){i.widget.find(".timepicker .timepicker-picker").hide(),i.widget.find(".timepicker .timepicker-seconds").show()},selectHour:function(b){var c=parseInt(a(b.target).text(),10);i.use24hours||(i.date.hours()>=12?12!==c&&(c+=12):12===c&&(c=0)),i.date.hours(c),z.showPicker.call(i)},selectMinute:function(b){i.date.minutes(parseInt(a(b.target).text(),10)),z.showPicker.call(i)},selectSecond:function(b){i.date.seconds(parseInt(a(b.target).text(),10)),z.showPicker.call(i)}},A=function(c){var d=b(i.date),e=a(c.currentTarget).data("action"),f=z[e].apply(i,arguments);return B(c),i.date||(i.date=b({y:1970})),K(),x(),o(d,c.type),f},B=function(a){a.stopPropagation(),a.preventDefault()},C=function(a){27===a.keyCode&&i.hide()},D=function(c){b.locale(i.options.language);var d=a(c.target),e=b(i.date),f=b(d.val(),i.format,i.options.useStrict);f.isValid()&&!M(f)&&N(f)?(q(),i.setValue(f),o(e,c.type),K()):(i.viewDate=e,i.unset=!0,o(e,c.type),p(f))},E=function(a){a&&(i.viewMode=Math.max(i.minViewMode,Math.min(2,i.viewMode+a))),i.widget.find(".datepicker > div").hide().filter(".datepicker-"+R.modes[i.viewMode].clsName).show()},F=function(){var b,c,d,e,f;i.widget.on("click",".datepicker *",a.proxy(y,this)),i.widget.on("click","[data-action]",a.proxy(A,this)),i.widget.on("mousedown",a.proxy(B,this)),i.element.on("keydown",a.proxy(C,this)),i.options.pickDate&&i.options.pickTime&&i.widget.on("click.togglePicker",".accordion-toggle",function(g){if(g.stopPropagation(),b=a(this),c=b.closest("ul"),d=c.find(".in"),e=c.find(".collapse:not(.in)"),d&&d.length){if(f=d.data("collapse"),f&&f.transitioning)return;d.collapse("hide"),e.collapse("show"),b.find("span").toggleClass(i.options.icons.time+" "+i.options.icons.date),i.component&&i.component.find("span").toggleClass(i.options.icons.time+" "+i.options.icons.date)}}),i.isInput?i.element.on({click:a.proxy(i.show,this),focus:a.proxy(i.show,this),change:a.proxy(D,this),blur:a.proxy(i.hide,this)}):(i.element.on({change:a.proxy(D,this)},"input"),i.component?(i.component.on("click",a.proxy(i.show,this)),i.component.on("mousedown",a.proxy(B,this))):i.element.on("click",a.proxy(i.show,this)))},G=function(){a(window).on("resize.datetimepicker"+i.id,a.proxy(n,this)),i.isInput||a(document).on("mousedown.datetimepicker"+i.id,a.proxy(i.hide,this))},H=function(){i.widget.off("click",".datepicker *",i.click),i.widget.off("click","[data-action]"),i.widget.off("mousedown",i.stopEvent),i.options.pickDate&&i.options.pickTime&&i.widget.off("click.togglePicker"),i.isInput?i.element.off({focus:i.show,change:D,click:i.show,blur:i.hide}):(i.element.off({change:D},"input"),i.component?(i.component.off("click",i.show),i.component.off("mousedown",i.stopEvent)):i.element.off("click",i.show))},I=function(){a(window).off("resize.datetimepicker"+i.id),i.isInput||a(document).off("mousedown.datetimepicker"+i.id)},J=function(){if(i.element){var b,c=i.element.parents(),d=!1;for(b=0;b0?d:!1},P=function(a){return a=a.toString(),a.length>=2?a:"0"+a},Q=function(){var a='‹›',b='',c='
'+a+'
'+a+b+'
'+a+b+"
",d="";return i.options.pickDate&&i.options.pickTime?(d='
',d+=i.options.sideBySide?'
'+c+'
'+S.getTemplate()+"
":'
    '+c+'
  • '+S.getTemplate()+"
",d+="
"):i.options.pickTime?'":'"},R={modes:[{clsName:"days",navFnc:"month",navStep:1},{clsName:"months",navFnc:"year",navStep:1},{clsName:"years",navFnc:"year",navStep:10}]},S={hourTemplate:'',minuteTemplate:'',secondTemplate:''};S.getTemplate=function(){return'
"+(i.options.useSeconds?'':"")+(i.use24hours?"":'')+" "+(i.options.useSeconds?'":"")+(i.use24hours?"":'')+'"+(i.options.useSeconds?'':"")+(i.use24hours?"":'')+'
'+(i.options.useMinutes?'':"")+"
"+S.hourTemplate+' :'+(i.options.useMinutes?S.minuteTemplate:'00')+":'+S.secondTemplate+"
'+(i.options.useMinutes?'':"")+"
'+(i.options.useSeconds?'
':"")},i.destroy=function(){H(),I(),i.widget.remove(),i.element.removeData("DateTimePicker"),i.component&&i.component.removeData("DateTimePicker")},i.show=function(a){if(!l().prop("disabled")){if(i.options.useCurrent&&""===l().val()){if(1!==i.options.minuteStepping){var c=b(),d=i.options.minuteStepping;c.minutes(Math.round(c.minutes()/d)*d%60).seconds(0),i.setValue(c.format(i.format))}else i.setValue(b().format(i.format));o("",a.type)}a&&"click"===a.type&&i.isInput&&i.widget.hasClass("picker-open")||(i.widget.hasClass("picker-open")?(i.widget.hide(),i.widget.removeClass("picker-open")):(i.widget.show(),i.widget.addClass("picker-open")),i.height=i.component?i.component.outerHeight():i.element.outerHeight(),n(),i.element.trigger({type:"dp.show",date:b(i.date)}),G(),a&&B(a))}},i.disable=function(){var a=l();a.prop("disabled")||(a.prop("disabled",!0),H())},i.enable=function(){var a=l();a.prop("disabled")&&(a.prop("disabled",!1),F())},i.hide=function(){var a,c,d=i.widget.find(".collapse");for(a=0;a=1.8.3", + "bootstrap" : ">=3.0", + "moment": ">=2.8.0" + } +} diff --git a/html/js/datetime/composer.json b/html/js/datetime/composer.json new file mode 100644 index 000000000..cf5646145 --- /dev/null +++ b/html/js/datetime/composer.json @@ -0,0 +1,30 @@ +{ + "name": "eonasdan/bootstrap-datetimepicker", + "type": "component", + "version": "3.1.3", + "description": "Date/time picker widget based on twitter bootstrap", + "keywords": [ + "bootstrap", + "datetimepicker" + ], + "homepage": "http://eonasdan.github.io/bootstrap-datetimepicker/", + "license": "MIT", + "require": { + "robloach/component-installer": "*", + "components/jquery": ">=1.9.1", + "components/bootstrap": "3.*", + "moment/moment": ">=2.8" + }, + "extra": { + "component": { + "scripts": [ + "src/js/bootstrap-datetimepicker.js" + ], + "files": [ + "build/js/bootstrap-datetimepicker.min.js", + "build/css/bootstrap-datetimepicker.css", + "build/css/bootstrap-datetimepicker.min.css" + ] + } + } +} diff --git a/html/js/datetime/package.json b/html/js/datetime/package.json new file mode 100644 index 000000000..3c2afba97 --- /dev/null +++ b/html/js/datetime/package.json @@ -0,0 +1,35 @@ +{ + "name": "bootstrap-datetimepicker", + "main": "src/js/bootstrap-datetimepicker.js", + "version": "3.1.3", + "repository": { + "type": "git", + "url": "https://github.com/eonasdan/bootstrap-datetimepicker.git" + }, + "bugs": { + "url": "https://github.com/eonasdan/bootstrap-datetimepicker/issues" + }, + "keywords": [ + "twitter-bootstrap", + "bootstrap", + "datepicker", + "datetimepicker", + "timepicker", + "moment" + ], + "dependencies": { + "moment": "~2.8.1", + "bootstrap": "^3.0", + "jquery": "^1.8.3" + }, + "devDependencies": { + "grunt": "latest", + "grunt-contrib-jshint": "latest", + "grunt-contrib-uglify": "latest", + "grunt-jscs": "latest", + "load-grunt-tasks": "latest", + "grunt-string-replace": "latest", + "grunt-contrib-less": "latest", + "bootstrap": "latest" + } +} diff --git a/html/js/datetime/src/js/bootstrap-datetimepicker.js b/html/js/datetime/src/js/bootstrap-datetimepicker.js new file mode 100644 index 000000000..44abcc1fe --- /dev/null +++ b/html/js/datetime/src/js/bootstrap-datetimepicker.js @@ -0,0 +1,1384 @@ +/* +//! version : 3.1.3 +========================================================= +bootstrap-datetimepicker.js +https://github.com/Eonasdan/bootstrap-datetimepicker +========================================================= +The MIT License (MIT) + +Copyright (c) 2014 Jonathan Peterson + +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. +*/ +;(function (root, factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // AMD is used - Register as an anonymous module. + define(['jquery', 'moment'], factory); + } else if (typeof exports === 'object') { + factory(require('jquery'), require('moment')); + } + else { + // Neither AMD or CommonJS used. Use global variables. + if (!jQuery) { + throw new Error('bootstrap-datetimepicker requires jQuery to be loaded first'); + } + if (!moment) { + throw new Error('bootstrap-datetimepicker requires moment.js to be loaded first'); + } + factory(root.jQuery, moment); + } +}(this, function ($, moment) { + 'use strict'; + if (typeof moment === 'undefined') { + throw new Error('momentjs is required'); + } + + var dpgId = 0, + + DateTimePicker = function (element, options) { + var defaults = $.fn.datetimepicker.defaults, + + icons = { + time: 'glyphicon glyphicon-time', + date: 'glyphicon glyphicon-calendar', + up: 'glyphicon glyphicon-chevron-up', + down: 'glyphicon glyphicon-chevron-down' + }, + + picker = this, + errored = false, + dDate, + + init = function () { + var icon = false, localeData, rInterval; + picker.options = $.extend({}, defaults, options); + picker.options.icons = $.extend({}, icons, picker.options.icons); + + picker.element = $(element); + + dataToOptions(); + + if (!(picker.options.pickTime || picker.options.pickDate)) { + throw new Error('Must choose at least one picker'); + } + + picker.id = dpgId++; + moment.locale(picker.options.language); + picker.date = moment(); + picker.unset = false; + picker.isInput = picker.element.is('input'); + picker.component = false; + + if (picker.element.hasClass('input-group')) { + if (picker.element.find('.datepickerbutton').size() === 0) {//in case there is more then one 'input-group-addon' Issue #48 + picker.component = picker.element.find('[class^="input-group-"]'); + } + else { + picker.component = picker.element.find('.datepickerbutton'); + } + } + picker.format = picker.options.format; + + localeData = moment().localeData(); + + if (!picker.format) { + picker.format = (picker.options.pickDate ? localeData.longDateFormat('L') : ''); + if (picker.options.pickDate && picker.options.pickTime) { + picker.format += ' '; + } + picker.format += (picker.options.pickTime ? localeData.longDateFormat('LT') : ''); + if (picker.options.useSeconds) { + if (localeData.longDateFormat('LT').indexOf(' A') !== -1) { + picker.format = picker.format.split(' A')[0] + ':ss A'; + } + else { + picker.format += ':ss'; + } + } + } + picker.use24hours = (picker.format.toLowerCase().indexOf('a') < 0 && picker.format.indexOf('h') < 0); + + if (picker.component) { + icon = picker.component.find('span'); + } + + if (picker.options.pickTime) { + if (icon) { + icon.addClass(picker.options.icons.time); + } + } + if (picker.options.pickDate) { + if (icon) { + icon.removeClass(picker.options.icons.time); + icon.addClass(picker.options.icons.date); + } + } + + picker.options.widgetParent = + typeof picker.options.widgetParent === 'string' && picker.options.widgetParent || + picker.element.parents().filter(function () { + return 'scroll' === $(this).css('overflow-y'); + }).get(0) || + 'body'; + + picker.widget = $(getTemplate()).appendTo(picker.options.widgetParent); + + picker.minViewMode = picker.options.minViewMode || 0; + if (typeof picker.minViewMode === 'string') { + switch (picker.minViewMode) { + case 'months': + picker.minViewMode = 1; + break; + case 'years': + picker.minViewMode = 2; + break; + default: + picker.minViewMode = 0; + break; + } + } + picker.viewMode = picker.options.viewMode || 0; + if (typeof picker.viewMode === 'string') { + switch (picker.viewMode) { + case 'months': + picker.viewMode = 1; + break; + case 'years': + picker.viewMode = 2; + break; + default: + picker.viewMode = 0; + break; + } + } + + picker.viewMode = Math.max(picker.viewMode, picker.minViewMode); + + picker.options.disabledDates = indexGivenDates(picker.options.disabledDates); + picker.options.enabledDates = indexGivenDates(picker.options.enabledDates); + + picker.startViewMode = picker.viewMode; + picker.setMinDate(picker.options.minDate); + picker.setMaxDate(picker.options.maxDate); + fillDow(); + fillMonths(); + fillHours(); + fillMinutes(); + fillSeconds(); + update(); + showMode(); + if (!getPickerInput().prop('disabled')) { + attachDatePickerEvents(); + } + if (picker.options.defaultDate !== '' && getPickerInput().val() === '') { + picker.setValue(picker.options.defaultDate); + } + if (picker.options.minuteStepping !== 1) { + rInterval = picker.options.minuteStepping; + picker.date.minutes((Math.round(picker.date.minutes() / rInterval) * rInterval) % 60).seconds(0); + } + }, + + getPickerInput = function () { + var input; + + if (picker.isInput) { + return picker.element; + } + input = picker.element.find('.datepickerinput'); + if (input.size() === 0) { + input = picker.element.find('input'); + } + else if (!input.is('input')) { + throw new Error('CSS class "datepickerinput" cannot be applied to non input element'); + } + return input; + }, + + dataToOptions = function () { + var eData; + if (picker.element.is('input')) { + eData = picker.element.data(); + } + else { + eData = picker.element.find('input').data(); + } + if (eData.dateFormat !== undefined) { + picker.options.format = eData.dateFormat; + } + if (eData.datePickdate !== undefined) { + picker.options.pickDate = eData.datePickdate; + } + if (eData.datePicktime !== undefined) { + picker.options.pickTime = eData.datePicktime; + } + if (eData.dateUseminutes !== undefined) { + picker.options.useMinutes = eData.dateUseminutes; + } + if (eData.dateUseseconds !== undefined) { + picker.options.useSeconds = eData.dateUseseconds; + } + if (eData.dateUsecurrent !== undefined) { + picker.options.useCurrent = eData.dateUsecurrent; + } + if (eData.calendarWeeks !== undefined) { + picker.options.calendarWeeks = eData.calendarWeeks; + } + if (eData.dateMinutestepping !== undefined) { + picker.options.minuteStepping = eData.dateMinutestepping; + } + if (eData.dateMindate !== undefined) { + picker.options.minDate = eData.dateMindate; + } + if (eData.dateMaxdate !== undefined) { + picker.options.maxDate = eData.dateMaxdate; + } + if (eData.dateShowtoday !== undefined) { + picker.options.showToday = eData.dateShowtoday; + } + if (eData.dateCollapse !== undefined) { + picker.options.collapse = eData.dateCollapse; + } + if (eData.dateLanguage !== undefined) { + picker.options.language = eData.dateLanguage; + } + if (eData.dateDefaultdate !== undefined) { + picker.options.defaultDate = eData.dateDefaultdate; + } + if (eData.dateDisableddates !== undefined) { + picker.options.disabledDates = eData.dateDisableddates; + } + if (eData.dateEnableddates !== undefined) { + picker.options.enabledDates = eData.dateEnableddates; + } + if (eData.dateIcons !== undefined) { + picker.options.icons = eData.dateIcons; + } + if (eData.dateUsestrict !== undefined) { + picker.options.useStrict = eData.dateUsestrict; + } + if (eData.dateDirection !== undefined) { + picker.options.direction = eData.dateDirection; + } + if (eData.dateSidebyside !== undefined) { + picker.options.sideBySide = eData.dateSidebyside; + } + if (eData.dateDaysofweekdisabled !== undefined) { + picker.options.daysOfWeekDisabled = eData.dateDaysofweekdisabled; + } + }, + + place = function () { + var position = 'absolute', + offset = picker.component ? picker.component.offset() : picker.element.offset(), + $window = $(window), + placePosition; + + picker.width = picker.component ? picker.component.outerWidth() : picker.element.outerWidth(); + offset.top = offset.top + picker.element.outerHeight(); + + if (picker.options.direction === 'up') { + placePosition = 'top'; + } else if (picker.options.direction === 'bottom') { + placePosition = 'bottom'; + } else if (picker.options.direction === 'auto') { + if (offset.top + picker.widget.height() > $window.height() + $window.scrollTop() && picker.widget.height() + picker.element.outerHeight() < offset.top) { + placePosition = 'top'; + } else { + placePosition = 'bottom'; + } + } + if (placePosition === 'top') { + offset.bottom = $window.height() - offset.top + picker.element.outerHeight() + 3; + picker.widget.addClass('top').removeClass('bottom'); + } else { + offset.top += 1; + picker.widget.addClass('bottom').removeClass('top'); + } + + if (picker.options.width !== undefined) { + picker.widget.width(picker.options.width); + } + + if (picker.options.orientation === 'left') { + picker.widget.addClass('left-oriented'); + offset.left = offset.left - picker.widget.width() + 20; + } + + if (isInFixed()) { + position = 'fixed'; + offset.top -= $window.scrollTop(); + offset.left -= $window.scrollLeft(); + } + + if ($window.width() < offset.left + picker.widget.outerWidth()) { + offset.right = $window.width() - offset.left - picker.width; + offset.left = 'auto'; + picker.widget.addClass('pull-right'); + } else { + offset.right = 'auto'; + picker.widget.removeClass('pull-right'); + } + + if (placePosition === 'top') { + picker.widget.css({ + position: position, + bottom: offset.bottom, + top: 'auto', + left: offset.left, + right: offset.right + }); + } else { + picker.widget.css({ + position: position, + top: offset.top, + bottom: 'auto', + left: offset.left, + right: offset.right + }); + } + }, + + notifyChange = function (oldDate, eventType) { + if (moment(picker.date).isSame(moment(oldDate)) && !errored) { + return; + } + errored = false; + picker.element.trigger({ + type: 'dp.change', + date: moment(picker.date), + oldDate: moment(oldDate) + }); + + if (eventType !== 'change') { + picker.element.change(); + } + }, + + notifyError = function (date) { + errored = true; + picker.element.trigger({ + type: 'dp.error', + date: moment(date, picker.format, picker.options.useStrict) + }); + }, + + update = function (newDate) { + moment.locale(picker.options.language); + var dateStr = newDate; + if (!dateStr) { + dateStr = getPickerInput().val(); + if (dateStr) { + picker.date = moment(dateStr, picker.format, picker.options.useStrict); + } + if (!picker.date) { + picker.date = moment(); + } + } + picker.viewDate = moment(picker.date).startOf('month'); + fillDate(); + fillTime(); + }, + + fillDow = function () { + moment.locale(picker.options.language); + var html = $(''), weekdaysMin = moment.weekdaysMin(), i; + if (picker.options.calendarWeeks === true) { + html.append('#'); + } + if (moment().localeData()._week.dow === 0) { // starts on Sunday + for (i = 0; i < 7; i++) { + html.append('' + weekdaysMin[i] + ''); + } + } else { + for (i = 1; i < 8; i++) { + if (i === 7) { + html.append('' + weekdaysMin[0] + ''); + } else { + html.append('' + weekdaysMin[i] + ''); + } + } + } + picker.widget.find('.datepicker-days thead').append(html); + }, + + fillMonths = function () { + moment.locale(picker.options.language); + var html = '', i, monthsShort = moment.monthsShort(); + for (i = 0; i < 12; i++) { + html += '' + monthsShort[i] + ''; + } + picker.widget.find('.datepicker-months td').append(html); + }, + + fillDate = function () { + if (!picker.options.pickDate) { + return; + } + moment.locale(picker.options.language); + var year = picker.viewDate.year(), + month = picker.viewDate.month(), + startYear = picker.options.minDate.year(), + startMonth = picker.options.minDate.month(), + endYear = picker.options.maxDate.year(), + endMonth = picker.options.maxDate.month(), + currentDate, + prevMonth, nextMonth, html = [], row, clsName, i, days, yearCont, currentYear, months = moment.months(); + + picker.widget.find('.datepicker-days').find('.disabled').removeClass('disabled'); + picker.widget.find('.datepicker-months').find('.disabled').removeClass('disabled'); + picker.widget.find('.datepicker-years').find('.disabled').removeClass('disabled'); + + picker.widget.find('.datepicker-days th:eq(1)').text( + months[month] + ' ' + year); + + prevMonth = moment(picker.viewDate, picker.format, picker.options.useStrict).subtract(1, 'months'); + days = prevMonth.daysInMonth(); + prevMonth.date(days).startOf('week'); + if ((year === startYear && month <= startMonth) || year < startYear) { + picker.widget.find('.datepicker-days th:eq(0)').addClass('disabled'); + } + if ((year === endYear && month >= endMonth) || year > endYear) { + picker.widget.find('.datepicker-days th:eq(2)').addClass('disabled'); + } + + nextMonth = moment(prevMonth).add(42, 'd'); + while (prevMonth.isBefore(nextMonth)) { + if (prevMonth.weekday() === moment().startOf('week').weekday()) { + row = $(''); + html.push(row); + if (picker.options.calendarWeeks === true) { + row.append('' + prevMonth.week() + ''); + } + } + clsName = ''; + if (prevMonth.year() < year || (prevMonth.year() === year && prevMonth.month() < month)) { + clsName += ' old'; + } else if (prevMonth.year() > year || (prevMonth.year() === year && prevMonth.month() > month)) { + clsName += ' new'; + } + if (prevMonth.isSame(moment({y: picker.date.year(), M: picker.date.month(), d: picker.date.date()}))) { + clsName += ' active'; + } + if (isInDisableDates(prevMonth, 'day') || !isInEnableDates(prevMonth)) { + clsName += ' disabled'; + } + if (picker.options.showToday === true) { + if (prevMonth.isSame(moment(), 'day')) { + clsName += ' today'; + } + } + if (picker.options.daysOfWeekDisabled) { + for (i = 0; i < picker.options.daysOfWeekDisabled.length; i++) { + if (prevMonth.day() === picker.options.daysOfWeekDisabled[i]) { + clsName += ' disabled'; + break; + } + } + } + row.append('' + prevMonth.date() + ''); + + currentDate = prevMonth.date(); + prevMonth.add(1, 'd'); + + if (currentDate === prevMonth.date()) { + prevMonth.add(1, 'd'); + } + } + picker.widget.find('.datepicker-days tbody').empty().append(html); + currentYear = picker.date.year(); + months = picker.widget.find('.datepicker-months').find('th:eq(1)').text(year).end().find('span').removeClass('active'); + if (currentYear === year) { + months.eq(picker.date.month()).addClass('active'); + } + if (year - 1 < startYear) { + picker.widget.find('.datepicker-months th:eq(0)').addClass('disabled'); + } + if (year + 1 > endYear) { + picker.widget.find('.datepicker-months th:eq(2)').addClass('disabled'); + } + for (i = 0; i < 12; i++) { + if ((year === startYear && startMonth > i) || (year < startYear)) { + $(months[i]).addClass('disabled'); + } else if ((year === endYear && endMonth < i) || (year > endYear)) { + $(months[i]).addClass('disabled'); + } + } + + html = ''; + year = parseInt(year / 10, 10) * 10; + yearCont = picker.widget.find('.datepicker-years').find( + 'th:eq(1)').text(year + '-' + (year + 9)).parents('table').find('td'); + picker.widget.find('.datepicker-years').find('th').removeClass('disabled'); + if (startYear > year) { + picker.widget.find('.datepicker-years').find('th:eq(0)').addClass('disabled'); + } + if (endYear < year + 9) { + picker.widget.find('.datepicker-years').find('th:eq(2)').addClass('disabled'); + } + year -= 1; + for (i = -1; i < 11; i++) { + html += '' + year + ''; + year += 1; + } + yearCont.html(html); + }, + + fillHours = function () { + moment.locale(picker.options.language); + var table = picker.widget.find('.timepicker .timepicker-hours table'), html = '', current, i, j; + table.parent().hide(); + if (picker.use24hours) { + current = 0; + for (i = 0; i < 6; i += 1) { + html += ''; + for (j = 0; j < 4; j += 1) { + html += '' + padLeft(current.toString()) + ''; + current++; + } + html += ''; + } + } + else { + current = 1; + for (i = 0; i < 3; i += 1) { + html += ''; + for (j = 0; j < 4; j += 1) { + html += '' + padLeft(current.toString()) + ''; + current++; + } + html += ''; + } + } + table.html(html); + }, + + fillMinutes = function () { + var table = picker.widget.find('.timepicker .timepicker-minutes table'), html = '', current = 0, i, j, step = picker.options.minuteStepping; + table.parent().hide(); + if (step === 1) { + step = 5; + } + for (i = 0; i < Math.ceil(60 / step / 4) ; i++) { + html += ''; + for (j = 0; j < 4; j += 1) { + if (current < 60) { + html += '' + padLeft(current.toString()) + ''; + current += step; + } else { + html += ''; + } + } + html += ''; + } + table.html(html); + }, + + fillSeconds = function () { + var table = picker.widget.find('.timepicker .timepicker-seconds table'), html = '', current = 0, i, j; + table.parent().hide(); + for (i = 0; i < 3; i++) { + html += ''; + for (j = 0; j < 4; j += 1) { + html += '' + padLeft(current.toString()) + ''; + current += 5; + } + html += ''; + } + table.html(html); + }, + + fillTime = function () { + if (!picker.date) { + return; + } + var timeComponents = picker.widget.find('.timepicker span[data-time-component]'), + hour = picker.date.hours(), + period = picker.date.format('A'); + if (!picker.use24hours) { + if (hour === 0) { + hour = 12; + } else if (hour !== 12) { + hour = hour % 12; + } + picker.widget.find('.timepicker [data-action=togglePeriod]').text(period); + } + timeComponents.filter('[data-time-component=hours]').text(padLeft(hour)); + timeComponents.filter('[data-time-component=minutes]').text(padLeft(picker.date.minutes())); + timeComponents.filter('[data-time-component=seconds]').text(padLeft(picker.date.second())); + }, + + click = function (e) { + e.stopPropagation(); + e.preventDefault(); + picker.unset = false; + var target = $(e.target).closest('span, td, th'), month, year, step, day, oldDate = moment(picker.date); + if (target.length === 1) { + if (!target.is('.disabled')) { + switch (target[0].nodeName.toLowerCase()) { + case 'th': + switch (target[0].className) { + case 'picker-switch': + showMode(1); + break; + case 'prev': + case 'next': + step = dpGlobal.modes[picker.viewMode].navStep; + if (target[0].className === 'prev') { + step = step * -1; + } + picker.viewDate.add(step, dpGlobal.modes[picker.viewMode].navFnc); + fillDate(); + break; + } + break; + case 'span': + if (target.is('.month')) { + month = target.parent().find('span').index(target); + picker.viewDate.month(month); + } else { + year = parseInt(target.text(), 10) || 0; + picker.viewDate.year(year); + } + if (picker.viewMode === picker.minViewMode) { + picker.date = moment({ + y: picker.viewDate.year(), + M: picker.viewDate.month(), + d: picker.viewDate.date(), + h: picker.date.hours(), + m: picker.date.minutes(), + s: picker.date.seconds() + }); + set(); + notifyChange(oldDate, e.type); + } + showMode(-1); + fillDate(); + break; + case 'td': + if (target.is('.day')) { + day = parseInt(target.text(), 10) || 1; + month = picker.viewDate.month(); + year = picker.viewDate.year(); + if (target.is('.old')) { + if (month === 0) { + month = 11; + year -= 1; + } else { + month -= 1; + } + } else if (target.is('.new')) { + if (month === 11) { + month = 0; + year += 1; + } else { + month += 1; + } + } + picker.date = moment({ + y: year, + M: month, + d: day, + h: picker.date.hours(), + m: picker.date.minutes(), + s: picker.date.seconds() + } + ); + picker.viewDate = moment({ + y: year, M: month, d: Math.min(28, day) + }); + fillDate(); + set(); + notifyChange(oldDate, e.type); + } + break; + } + } + } + }, + + actions = { + incrementHours: function () { + checkDate('add', 'hours', 1); + }, + + incrementMinutes: function () { + checkDate('add', 'minutes', picker.options.minuteStepping); + }, + + incrementSeconds: function () { + checkDate('add', 'seconds', 1); + }, + + decrementHours: function () { + checkDate('subtract', 'hours', 1); + }, + + decrementMinutes: function () { + checkDate('subtract', 'minutes', picker.options.minuteStepping); + }, + + decrementSeconds: function () { + checkDate('subtract', 'seconds', 1); + }, + + togglePeriod: function () { + var hour = picker.date.hours(); + if (hour >= 12) { + hour -= 12; + } else { + hour += 12; + } + picker.date.hours(hour); + }, + + showPicker: function () { + picker.widget.find('.timepicker > div:not(.timepicker-picker)').hide(); + picker.widget.find('.timepicker .timepicker-picker').show(); + }, + + showHours: function () { + picker.widget.find('.timepicker .timepicker-picker').hide(); + picker.widget.find('.timepicker .timepicker-hours').show(); + }, + + showMinutes: function () { + picker.widget.find('.timepicker .timepicker-picker').hide(); + picker.widget.find('.timepicker .timepicker-minutes').show(); + }, + + showSeconds: function () { + picker.widget.find('.timepicker .timepicker-picker').hide(); + picker.widget.find('.timepicker .timepicker-seconds').show(); + }, + + selectHour: function (e) { + var hour = parseInt($(e.target).text(), 10); + if (!picker.use24hours) { + if (picker.date.hours() >= 12) { + if (hour !== 12) { + hour += 12; + } + } else { + if (hour === 12) { + hour = 0; + } + } + } + picker.date.hours(hour); + actions.showPicker.call(picker); + }, + + selectMinute: function (e) { + picker.date.minutes(parseInt($(e.target).text(), 10)); + actions.showPicker.call(picker); + }, + + selectSecond: function (e) { + picker.date.seconds(parseInt($(e.target).text(), 10)); + actions.showPicker.call(picker); + } + }, + + doAction = function (e) { + var oldDate = moment(picker.date), + action = $(e.currentTarget).data('action'), + rv = actions[action].apply(picker, arguments); + stopEvent(e); + if (!picker.date) { + picker.date = moment({y: 1970}); + } + set(); + fillTime(); + notifyChange(oldDate, e.type); + return rv; + }, + + stopEvent = function (e) { + e.stopPropagation(); + e.preventDefault(); + }, + + keydown = function (e) { + if (e.keyCode === 27) { // allow escape to hide picker + picker.hide(); + } + }, + + change = function (e) { + moment.locale(picker.options.language); + var input = $(e.target), oldDate = moment(picker.date), newDate = moment(input.val(), picker.format, picker.options.useStrict); + if (newDate.isValid() && !isInDisableDates(newDate) && isInEnableDates(newDate)) { + update(); + picker.setValue(newDate); + notifyChange(oldDate, e.type); + set(); + } + else { + picker.viewDate = oldDate; + picker.unset = true; + notifyChange(oldDate, e.type); + notifyError(newDate); + } + }, + + showMode = function (dir) { + if (dir) { + picker.viewMode = Math.max(picker.minViewMode, Math.min(2, picker.viewMode + dir)); + } + picker.widget.find('.datepicker > div').hide().filter('.datepicker-' + dpGlobal.modes[picker.viewMode].clsName).show(); + }, + + attachDatePickerEvents = function () { + var $this, $parent, expanded, closed, collapseData; + picker.widget.on('click', '.datepicker *', $.proxy(click, this)); // this handles date picker clicks + picker.widget.on('click', '[data-action]', $.proxy(doAction, this)); // this handles time picker clicks + picker.widget.on('mousedown', $.proxy(stopEvent, this)); + picker.element.on('keydown', $.proxy(keydown, this)); + if (picker.options.pickDate && picker.options.pickTime) { + picker.widget.on('click.togglePicker', '.accordion-toggle', function (e) { + e.stopPropagation(); + $this = $(this); + $parent = $this.closest('ul'); + expanded = $parent.find('.in'); + closed = $parent.find('.collapse:not(.in)'); + + if (expanded && expanded.length) { + collapseData = expanded.data('collapse'); + if (collapseData && collapseData.transitioning) { + return; + } + expanded.collapse('hide'); + closed.collapse('show'); + $this.find('span').toggleClass(picker.options.icons.time + ' ' + picker.options.icons.date); + if (picker.component) { + picker.component.find('span').toggleClass(picker.options.icons.time + ' ' + picker.options.icons.date); + } + } + }); + } + if (picker.isInput) { + picker.element.on({ + 'click': $.proxy(picker.show, this), + 'focus': $.proxy(picker.show, this), + 'change': $.proxy(change, this), + 'blur': $.proxy(picker.hide, this) + }); + } else { + picker.element.on({ + 'change': $.proxy(change, this) + }, 'input'); + if (picker.component) { + picker.component.on('click', $.proxy(picker.show, this)); + picker.component.on('mousedown', $.proxy(stopEvent, this)); + } else { + picker.element.on('click', $.proxy(picker.show, this)); + } + } + }, + + attachDatePickerGlobalEvents = function () { + $(window).on( + 'resize.datetimepicker' + picker.id, $.proxy(place, this)); + if (!picker.isInput) { + $(document).on( + 'mousedown.datetimepicker' + picker.id, $.proxy(picker.hide, this)); + } + }, + + detachDatePickerEvents = function () { + picker.widget.off('click', '.datepicker *', picker.click); + picker.widget.off('click', '[data-action]'); + picker.widget.off('mousedown', picker.stopEvent); + if (picker.options.pickDate && picker.options.pickTime) { + picker.widget.off('click.togglePicker'); + } + if (picker.isInput) { + picker.element.off({ + 'focus': picker.show, + 'change': change, + 'click': picker.show, + 'blur' : picker.hide + }); + } else { + picker.element.off({ + 'change': change + }, 'input'); + if (picker.component) { + picker.component.off('click', picker.show); + picker.component.off('mousedown', picker.stopEvent); + } else { + picker.element.off('click', picker.show); + } + } + }, + + detachDatePickerGlobalEvents = function () { + $(window).off('resize.datetimepicker' + picker.id); + if (!picker.isInput) { + $(document).off('mousedown.datetimepicker' + picker.id); + } + }, + + isInFixed = function () { + if (picker.element) { + var parents = picker.element.parents(), inFixed = false, i; + for (i = 0; i < parents.length; i++) { + if ($(parents[i]).css('position') === 'fixed') { + inFixed = true; + break; + } + } + return inFixed; + } else { + return false; + } + }, + + set = function () { + moment.locale(picker.options.language); + var formatted = ''; + if (!picker.unset) { + formatted = moment(picker.date).format(picker.format); + } + getPickerInput().val(formatted); + picker.element.data('date', formatted); + if (!picker.options.pickTime) { + picker.hide(); + } + }, + + checkDate = function (direction, unit, amount) { + moment.locale(picker.options.language); + var newDate; + if (direction === 'add') { + newDate = moment(picker.date); + if (newDate.hours() === 23) { + newDate.add(amount, unit); + } + newDate.add(amount, unit); + } + else { + newDate = moment(picker.date).subtract(amount, unit); + } + if (isInDisableDates(moment(newDate.subtract(amount, unit))) || isInDisableDates(newDate)) { + notifyError(newDate.format(picker.format)); + return; + } + + if (direction === 'add') { + picker.date.add(amount, unit); + } + else { + picker.date.subtract(amount, unit); + } + picker.unset = false; + }, + + isInDisableDates = function (date, timeUnit) { + moment.locale(picker.options.language); + var maxDate = moment(picker.options.maxDate, picker.format, picker.options.useStrict), + minDate = moment(picker.options.minDate, picker.format, picker.options.useStrict); + + if (timeUnit) { + maxDate = maxDate.endOf(timeUnit); + minDate = minDate.startOf(timeUnit); + } + + if (date.isAfter(maxDate) || date.isBefore(minDate)) { + return true; + } + if (picker.options.disabledDates === false) { + return false; + } + return picker.options.disabledDates[date.format('YYYY-MM-DD')] === true; + }, + isInEnableDates = function (date) { + moment.locale(picker.options.language); + if (picker.options.enabledDates === false) { + return true; + } + return picker.options.enabledDates[date.format('YYYY-MM-DD')] === true; + }, + + indexGivenDates = function (givenDatesArray) { + // Store given enabledDates and disabledDates as keys. + // This way we can check their existence in O(1) time instead of looping through whole array. + // (for example: picker.options.enabledDates['2014-02-27'] === true) + var givenDatesIndexed = {}, givenDatesCount = 0, i; + for (i = 0; i < givenDatesArray.length; i++) { + if (moment.isMoment(givenDatesArray[i]) || givenDatesArray[i] instanceof Date) { + dDate = moment(givenDatesArray[i]); + } else { + dDate = moment(givenDatesArray[i], picker.format, picker.options.useStrict); + } + if (dDate.isValid()) { + givenDatesIndexed[dDate.format('YYYY-MM-DD')] = true; + givenDatesCount++; + } + } + if (givenDatesCount > 0) { + return givenDatesIndexed; + } + return false; + }, + + padLeft = function (string) { + string = string.toString(); + if (string.length >= 2) { + return string; + } + return '0' + string; + }, + + getTemplate = function () { + var + headTemplate = + '' + + '' + + '‹›' + + '' + + '', + contTemplate = + '', + template = '
' + + '' + headTemplate + '
' + + '
' + + '
' + + '' + headTemplate + contTemplate + '
' + + '
' + + '
' + + '' + headTemplate + contTemplate + '
' + + '
', + ret = ''; + if (picker.options.pickDate && picker.options.pickTime) { + ret = ''; + return ret; + } + if (picker.options.pickTime) { + return ( + '' + ); + } + return ( + '' + ); + }, + + dpGlobal = { + modes: [ + { + clsName: 'days', + navFnc: 'month', + navStep: 1 + }, + { + clsName: 'months', + navFnc: 'year', + navStep: 1 + }, + { + clsName: 'years', + navFnc: 'year', + navStep: 10 + } + ] + }, + + tpGlobal = { + hourTemplate: '', + minuteTemplate: '', + secondTemplate: '' + }; + + tpGlobal.getTemplate = function () { + return ( + '
' + + '' + + '' + + '' + + '' + + '' + + (picker.options.useSeconds ? + '' : '') + + (picker.use24hours ? '' : '') + + '' + + '' + + ' ' + + '' + + ' ' + + (picker.options.useSeconds ? + '' : '') + + (picker.use24hours ? '' : '' + + '') + + '' + + '' + + '' + + '' + + '' + + (picker.options.useSeconds ? + '' : '') + + (picker.use24hours ? '' : '') + + '' + + '
' + (picker.options.useMinutes ? '' : '') + '
' + tpGlobal.hourTemplate + ':' + (picker.options.useMinutes ? tpGlobal.minuteTemplate : '00') + ':' + tpGlobal.secondTemplate + '
' + (picker.options.useMinutes ? '' : '') + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + (picker.options.useSeconds ? + '
' : '') + ); + }; + + picker.destroy = function () { + detachDatePickerEvents(); + detachDatePickerGlobalEvents(); + picker.widget.remove(); + picker.element.removeData('DateTimePicker'); + if (picker.component) { + picker.component.removeData('DateTimePicker'); + } + }; + + picker.show = function (e) { + if (getPickerInput().prop('disabled')) { + return; + } + if (picker.options.useCurrent) { + if (getPickerInput().val() === '') { + if (picker.options.minuteStepping !== 1) { + var mDate = moment(), + rInterval = picker.options.minuteStepping; + mDate.minutes((Math.round(mDate.minutes() / rInterval) * rInterval) % 60).seconds(0); + picker.setValue(mDate.format(picker.format)); + } else { + picker.setValue(moment().format(picker.format)); + } + notifyChange('', e.type); + } + } + // if this is a click event on the input field and picker is already open don't hide it + if (e && e.type === 'click' && picker.isInput && picker.widget.hasClass('picker-open')) { + return; + } + if (picker.widget.hasClass('picker-open')) { + picker.widget.hide(); + picker.widget.removeClass('picker-open'); + } + else { + picker.widget.show(); + picker.widget.addClass('picker-open'); + } + picker.height = picker.component ? picker.component.outerHeight() : picker.element.outerHeight(); + place(); + picker.element.trigger({ + type: 'dp.show', + date: moment(picker.date) + }); + attachDatePickerGlobalEvents(); + if (e) { + stopEvent(e); + } + }; + + picker.disable = function () { + var input = getPickerInput(); + if (input.prop('disabled')) { + return; + } + input.prop('disabled', true); + detachDatePickerEvents(); + }; + + picker.enable = function () { + var input = getPickerInput(); + if (!input.prop('disabled')) { + return; + } + input.prop('disabled', false); + attachDatePickerEvents(); + }; + + picker.hide = function () { + // Ignore event if in the middle of a picker transition + var collapse = picker.widget.find('.collapse'), i, collapseData; + for (i = 0; i < collapse.length; i++) { + collapseData = collapse.eq(i).data('collapse'); + if (collapseData && collapseData.transitioning) { + return; + } + } + picker.widget.hide(); + picker.widget.removeClass('picker-open'); + picker.viewMode = picker.startViewMode; + showMode(); + picker.element.trigger({ + type: 'dp.hide', + date: moment(picker.date) + }); + detachDatePickerGlobalEvents(); + }; + + picker.setValue = function (newDate) { + moment.locale(picker.options.language); + if (!newDate) { + picker.unset = true; + set(); + } else { + picker.unset = false; + } + if (!moment.isMoment(newDate)) { + newDate = (newDate instanceof Date) ? moment(newDate) : moment(newDate, picker.format, picker.options.useStrict); + } else { + newDate = newDate.locale(picker.options.language); + } + if (newDate.isValid()) { + picker.date = newDate; + set(); + picker.viewDate = moment({y: picker.date.year(), M: picker.date.month()}); + fillDate(); + fillTime(); + } + else { + notifyError(newDate); + } + }; + + picker.getDate = function () { + if (picker.unset) { + return null; + } + return moment(picker.date); + }; + + picker.setDate = function (date) { + var oldDate = moment(picker.date); + if (!date) { + picker.setValue(null); + } else { + picker.setValue(date); + } + notifyChange(oldDate, 'function'); + }; + + picker.setDisabledDates = function (dates) { + picker.options.disabledDates = indexGivenDates(dates); + if (picker.viewDate) { + update(); + } + }; + + picker.setEnabledDates = function (dates) { + picker.options.enabledDates = indexGivenDates(dates); + if (picker.viewDate) { + update(); + } + }; + + picker.setMaxDate = function (date) { + if (date === undefined) { + return; + } + if (moment.isMoment(date) || date instanceof Date) { + picker.options.maxDate = moment(date); + } else { + picker.options.maxDate = moment(date, picker.format, picker.options.useStrict); + } + if (picker.viewDate) { + update(); + } + }; + + picker.setMinDate = function (date) { + if (date === undefined) { + return; + } + if (moment.isMoment(date) || date instanceof Date) { + picker.options.minDate = moment(date); + } else { + picker.options.minDate = moment(date, picker.format, picker.options.useStrict); + } + if (picker.viewDate) { + update(); + } + }; + + init(); + }; + + $.fn.datetimepicker = function (options) { + return this.each(function () { + var $this = $(this), + data = $this.data('DateTimePicker'); + if (!data) { + $this.data('DateTimePicker', new DateTimePicker(this, options)); + } + }); + }; + + $.fn.datetimepicker.defaults = { + format: false, + pickDate: true, + pickTime: true, + useMinutes: true, + useSeconds: false, + useCurrent: true, + calendarWeeks: false, + minuteStepping: 1, + minDate: moment({y: 1900}), + maxDate: moment().add(100, 'y'), + showToday: true, + collapse: true, + language: moment.locale(), + defaultDate: '', + disabledDates: false, + enabledDates: false, + icons: {}, + useStrict: false, + direction: 'auto', + sideBySide: false, + daysOfWeekDisabled: [], + widgetParent: false + }; +})); diff --git a/html/js/datetime/src/less/bootstrap-datetimepicker-build.less b/html/js/datetime/src/less/bootstrap-datetimepicker-build.less new file mode 100644 index 000000000..4a1737015 --- /dev/null +++ b/html/js/datetime/src/less/bootstrap-datetimepicker-build.less @@ -0,0 +1,5 @@ +// Import boostrap variables including default color palette and fonts +@import "../../node_modules/bootstrap/less/variables.less"; + +// Import datepicker component +@import "bootstrap-datetimepicker.less"; diff --git a/html/js/datetime/src/less/bootstrap-datetimepicker.less b/html/js/datetime/src/less/bootstrap-datetimepicker.less new file mode 100755 index 000000000..14eb9da54 --- /dev/null +++ b/html/js/datetime/src/less/bootstrap-datetimepicker.less @@ -0,0 +1,294 @@ +/*! + * Datetimepicker for Bootstrap v3 +//! version : 3.1.3 + * https://github.com/Eonasdan/bootstrap-datetimepicker/ + */ +.bootstrap-datetimepicker-widget { + top: 0; + left: 0; + width: 250px; + padding: 4px; + margin-top: 1px; + z-index: 99999 !important; + border-radius: @border-radius-base; + + &.timepicker-sbs { + width: 600px; + } + + &.bottom { + &:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-bottom-color: rgba(0,0,0,.2); + position: absolute; + top: -7px; + left: 7px; + } + + &:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid white; + position: absolute; + top: -6px; + left: 8px; + } + } + + &.top { + &:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-top: 7px solid #ccc; + border-top-color: rgba(0,0,0,.2); + position: absolute; + bottom: -7px; + left: 6px; + } + + &:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 6px solid white; + position: absolute; + bottom: -6px; + left: 7px; + } + } + + & .dow { + width: 14.2857%; + } + + &.pull-right { + &:before { + left: auto; + right: 6px; + } + + &:after { + left: auto; + right: 7px; + } + } + + >ul { + list-style-type: none; + margin: 0; + } + + a[data-action] { + padding: 6px 0; + } + + a[data-action]:active { + box-shadow: none; + } + + .timepicker-hour, .timepicker-minute, .timepicker-second { + width: 54px; + font-weight: bold; + font-size: 1.2em; + margin: 0; + } + + button[data-action] { + padding: 6px; + } + + table[data-hour-format="12"] .separator { + width: 4px; + padding: 0; + margin: 0; + } + + .datepicker > div { + display: none; + } + + .picker-switch { + text-align: center; + } + + table { + width: 100%; + margin: 0; + } + + td, + th { + text-align: center; + border-radius: @border-radius-base; + } + + td { + height: 54px; + line-height: 54px; + width: 54px; + + &.cw + { + font-size: 10px; + height: 20px; + line-height: 20px; + color: @gray-light; + } + + &.day + { + height: 20px; + line-height: 20px; + width: 20px; + } + + &.day:hover, + &.hour:hover, + &.minute:hover, + &.second:hover { + background: @gray-lighter; + cursor: pointer; + } + + &.old, + &.new { + color: @gray-light; + } + + &.today { + position: relative; + + &:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-bottom: 7px solid @btn-primary-bg; + border-top-color: rgba(0, 0, 0, 0.2); + position: absolute; + bottom: 4px; + right: 4px; + } + } + + &.active, + &.active:hover { + background-color: @btn-primary-bg; + color: @btn-primary-color; + text-shadow: 0 -1px 0 rgba(0,0,0,.25); + } + + &.active.today:before { + border-bottom-color: #fff; + } + + &.disabled, + &.disabled:hover { + background: none; + color: @gray-light; + cursor: not-allowed; + } + + span { + display: inline-block; + width: 54px; + height: 54px; + line-height: 54px; + margin: 2px 1.5px; + cursor: pointer; + border-radius: @border-radius-base; + + &:hover { + background: @gray-lighter; + } + + &.active { + background-color: @btn-primary-bg; + color: @btn-primary-color; + text-shadow: 0 -1px 0 rgba(0,0,0,.25); + } + + &.old { + color: @gray-light; + } + + &.disabled, + &.disabled:hover { + background: none; + color: @gray-light; + cursor: not-allowed; + } + } + } + + th { + height: 20px; + line-height: 20px; + width: 20px; + + &.picker-switch { + width: 145px; + } + + &.next, + &.prev { + font-size: @font-size-base * 1.5; + } + + &.disabled, + &.disabled:hover { + background: none; + color: @gray-light; + cursor: not-allowed; + } + } + + thead tr:first-child th { + cursor: pointer; + + &:hover { + background: @gray-lighter; + } + } +} + +.input-group { + &.date { + .input-group-addon span { + display: block; + cursor: pointer; + width: 16px; + height: 16px; + } + } +} + +.bootstrap-datetimepicker-widget.left-oriented { + &:before { + left: auto; + right: 6px; + } + + &:after { + left: auto; + right: 7px; + } +} + +.bootstrap-datetimepicker-widget ul.list-unstyled li div.timepicker div.timepicker-picker table.table-condensed tbody > tr > td { + padding: 0px !important; +} + +@media screen and (max-width: 767px) { + .bootstrap-datetimepicker-widget.timepicker-sbs { + width: 283px; + } +} diff --git a/html/js/datetime/src/nuget/Bootstrap.v3.Datetimepicker.CSS.nuspec b/html/js/datetime/src/nuget/Bootstrap.v3.Datetimepicker.CSS.nuspec new file mode 100644 index 000000000..4192e1eb7 --- /dev/null +++ b/html/js/datetime/src/nuget/Bootstrap.v3.Datetimepicker.CSS.nuspec @@ -0,0 +1,30 @@ + + + + Bootstrap.v3.Datetimepicker.CSS + 3.1.2 + Bootstrap 3 Datetimepicker CSS + Eonasdan + Eonasdan + https://github.com/Eonasdan/bootstrap-datetimepicker + false + A date/time picker component designed to work with Bootstrap 3 and Momentjs. + +For usage, installation and demos see Project Site on GitHub + +For CSS version install Bootstrap.v3.Datetimepicker.CSS + Check the change log on Github at https://github.com/Eonasdan/bootstrap-datetimepicker/wiki/Change-Log + bootstrap date time picker datetimepicker datepicker jquery + + + + + + + + + + + + + \ No newline at end of file diff --git a/html/js/datetime/src/nuget/Bootstrap.v3.Datetimepicker.nuspec b/html/js/datetime/src/nuget/Bootstrap.v3.Datetimepicker.nuspec new file mode 100644 index 000000000..267ec06a4 --- /dev/null +++ b/html/js/datetime/src/nuget/Bootstrap.v3.Datetimepicker.nuspec @@ -0,0 +1,30 @@ + + + + Bootstrap.v3.Datetimepicker + 3.1.2 + Bootstrap 3 Datetimepicker + Eonasdan + Eonasdan + https://github.com/Eonasdan/bootstrap-datetimepicker + false + A date/time picker component designed to work with Bootstrap 3 and Momentjs. + +For usage, installation and demos see Project Site on GitHub + +For CSS version install Bootstrap.v3.Datetimepicker.CSS + Check the change log on Github at https://github.com/Eonasdan/bootstrap-datetimepicker/wiki/Change-Log + bootstrap date time picker datetimepicker datepicker jquery + + + + + + + + + + + + + \ No newline at end of file diff --git a/html/js/datetime/src/nuget/NuGet.exe b/html/js/datetime/src/nuget/NuGet.exe new file mode 100644 index 000000000..c41a0d0de Binary files /dev/null and b/html/js/datetime/src/nuget/NuGet.exe differ diff --git a/html/js/datetime/src/nuget/install.ps1 b/html/js/datetime/src/nuget/install.ps1 new file mode 100644 index 000000000..b0443b27c --- /dev/null +++ b/html/js/datetime/src/nuget/install.ps1 @@ -0,0 +1,2 @@ +# install.ps1 +$DTE.ItemOperations.Navigate("https://github.com/Eonasdan/bootstrap-datetimepicker#change-log", $DTE.vsNavigateOptions.vsNavigateOptionsNewWindow) diff --git a/html/js/datetime/tasks/bump_version.js b/html/js/datetime/tasks/bump_version.js new file mode 100644 index 000000000..fcb934517 --- /dev/null +++ b/html/js/datetime/tasks/bump_version.js @@ -0,0 +1,88 @@ +module.exports = function (grunt) { + grunt.registerTask('bump_version', function (version) { + if (!version || version.split('.').length !== 3) { + grunt.fail.fatal("malformed version. Use\n\n grunt bump_version:1.2.3") + } + + grunt.config('string-replace.bootstrap-datetimepicker-js', { + files: {'src/js/bootstrap-datetimepicker.js': 'src/js/bootstrap-datetimepicker.js'}, + options: { + replacements: [ + { + pattern: /\/\/! version : .*/, + replacement: '//! version : ' + version + } + ] + } + }); + + grunt.config('string-replace.bootstrap-datetimepicker-css', { + files: {'src/less/bootstrap-datetimepicker.less': 'src/less/bootstrap-datetimepicker.less'}, + options: { + replacements: [ + { + pattern: /\/\/! version : .*/, + replacement: '//! version : ' + version + } + ] + } + }); + + grunt.config('string-replace.package-json', { + files: {'package.json': 'package.json'}, + options: { + replacements: [ + { + pattern: /"version": .*/, + replacement: '"version": "' + version + '",' + } + ] + } + }); + + grunt.config('string-replace.bower-json', { + files: {'bower.json': 'bower.json'}, + options: { + replacements: [ + { + pattern: /"version": .*/, + replacement: '"version": "' + version + '",' + } + ] + } + }); + + grunt.config('string-replace.component-json', { + files: {'component.json': 'component.json'}, + options: { + replacements: [ + { + pattern: /"version": .*/, + replacement: '"version": "' + version + '",' + } + ] + } + }); + + grunt.config('string-replace.composer-json', { + files: {'composer.json': 'composer.json'}, + options: { + replacements: [ + { + pattern: /"version": .*/, + replacement: '"version": "' + version + '",' + } + ] + } + }); + + grunt.task.run([ + 'string-replace:bootstrap-datetimepicker-js', + 'string-replace:bootstrap-datetimepicker-css', + 'string-replace:package-json', + 'string-replace:bower-json', + 'string-replace:component-json', + 'string-replace:composer-json' + ]); + }); +};