diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..397c25a810 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "public/vendor/bootstrap-datepicker"] + path = public/vendor/bootstrap-datepicker + url = https://github.com/eternicode/bootstrap-datepicker.git diff --git a/public/bootstrap-datepicker/.gitignore b/public/bootstrap-datepicker/.gitignore new file mode 100644 index 0000000000..e46fcb2aaf --- /dev/null +++ b/public/bootstrap-datepicker/.gitignore @@ -0,0 +1,2 @@ +instrumented/ +tests/coverage.html diff --git a/public/bootstrap-datepicker/.hgignore b/public/bootstrap-datepicker/.hgignore new file mode 100644 index 0000000000..e46fcb2aaf --- /dev/null +++ b/public/bootstrap-datepicker/.hgignore @@ -0,0 +1,2 @@ +instrumented/ +tests/coverage.html diff --git a/public/bootstrap-datepicker/.travis.yml b/public/bootstrap-datepicker/.travis.yml new file mode 100644 index 0000000000..7851a083bd --- /dev/null +++ b/public/bootstrap-datepicker/.travis.yml @@ -0,0 +1,4 @@ +before_script: + - cd ./tests + - echo "new Date().toString();" | phantomjs +script: phantomjs run-qunit.js tests.html diff --git a/public/bootstrap-datepicker/CHANGELOG.md b/public/bootstrap-datepicker/CHANGELOG.md new file mode 100644 index 0000000000..522f94b80f --- /dev/null +++ b/public/bootstrap-datepicker/CHANGELOG.md @@ -0,0 +1,24 @@ +Changelog +========= + +v1.0.1 +--------- + +* Support for [Bower](http://twitter.github.com/bower/) + +v1.0.0 +------ + +Initial release: + +* format option +* weekStart option +* calendarWeeks option +* startDate / endDate options +* daysOfWeekDisabled option +* autoclose option +* startView / mnViewMode options +* todayBtn / todayHighlight options +* keyboardNavigation option +* language option +* forceParse option diff --git a/public/bootstrap-datepicker/LICENSE b/public/bootstrap-datepicker/LICENSE new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/public/bootstrap-datepicker/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/public/bootstrap-datepicker/README.md b/public/bootstrap-datepicker/README.md new file mode 100644 index 0000000000..ba68643cc6 --- /dev/null +++ b/public/bootstrap-datepicker/README.md @@ -0,0 +1,431 @@ +# bootstrap-datepicker [![Build Status](https://travis-ci.org/eternicode/bootstrap-datepicker.png?branch=master)](https://travis-ci.org/eternicode/bootstrap-datepicker) + +This is a fork of Stefan Petre's [original code](http://www.eyecon.ro/bootstrap-datepicker/); +thanks go to him for getting this thing started! + +Please note that this fork is not used on Stefan's page at this time, nor is it maintained or +contributed to by him (yet?) + +Versions are incremented according to [semver](http://semver.org/). + +# Requirements + +* [Bootstrap](http://twitter.github.com/bootstrap/) 2.0.4+ +* [jQuery](http://jquery.com/) 1.7.1+ + +These are the specific versions bootstrap-datpicker is tested against (`js` files) and built against (`css` files). Use other versions at your own risk. + +# Example + +Attached to a field with the format specified via options: + +```html + +``` +```javascript +$('.datepicker').datepicker({ + format: 'mm-dd-yyyy' +}); +``` + +Attached to a field with the format specified via data tag: + +```html + +``` +```javascript +$('.datepicker').datepicker(); +``` + +As component: + +```html +
+ + +
+``` +```javascript +$('.datepicker').datepicker(); +``` + +Attached to non-field element, using events to work with the date values. + +```html +
+ Oh snap! +
+ + + + + + + + + + + + + +
+ Start date + Change + + End date + Change +
2012-02-202012-02-25
+``` +```javascript +var startDate = new Date(2012,1,20); +var endDate = new Date(2012,1,25); +$('#date-start') + .datepicker() + .on('changeDate', function(ev){ + if (ev.date.valueOf() > endDate.valueOf()){ + $('#alert').show().find('strong').text('The start date must be before the end date.'); + } else { + $('#alert').hide(); + startDate = new Date(ev.date); + $('#date-start-display').text($('#date-start').data('date')); + } + $('#date-start').datepicker('hide'); + }); +$('#date-end') + .datepicker() + .on('changeDate', function(ev){ + if (ev.date.valueOf() < startDate.valueOf()){ + $('#alert').show().find('strong').text('The end date must be after the start date.'); + } else { + $('#alert').hide(); + endDate = new Date(ev.date); + $('#date-end-display').text($('#date-end').data('date')); + } + $('#date-end').datepicker('hide'); + }); +``` + +As inline datepicker: + +```html +
+``` +```javascript +$('.datepicker').datepicker(); +``` + + +# Using bootstrap-datepicker.js + +Call the datepicker via javascript: + +```javascript +$('.datepicker').datepicker() +``` + +## Dependencies + +Requires bootstrap's dropdown component (`dropdowns.less`) for some styles, and bootstrap's sprites (`sprites.less` and associated images) for arrows. + +A standalone .css file (including necessary dropdown styles and alternative, text-based arrows) can be generated by running `build/build_standalone.less` through the `lessc` compiler: + +```bash +$ lessc build/build_standalone.less datepicker.css +``` + +## Options + +All options that take a "Date" can handle a `Date` object; a String formatted according to the given `format`; or a timedelta relative to today, eg '-1d', '+6m +1y', etc, where valid units are 'd' (day), 'w' (week), 'm' (month), and 'y' (year). + +### format + +String. Default: 'mm/dd/yyyy' + +The date format, combination of d, dd, D, DD, m, mm, M, MM, yy, yyyy. + +* d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05. +* D, DD: Abbreviated and full weekday names, respectively. Eg, Mon, Monday. +* m, mm: Numeric month, no leading zero and leading zero, respectively. Eg, 7, 07. +* M, MM: Abbreviated and full month names, respectively. Eg, Jan, January +* yy, yyyy: 2- and 4-digit years, respectively. Eg, 12, 2012. + +### weekStart + +Integer. Default: 0 + +Day of the week start. 0 (Sunday) to 6 (Saturday) + +### calendarWeeks + +Boolean. Default: false + +Whether or not to show week numbers to the left of week rows. + +### startDate + +Date. Default: Beginning of time + +The earliest date that may be selected; all earlier dates will be disabled. + +### endDate + +Date. Default: End of time + +The latest date that may be selected; all later dates will be disabled. + +### daysOfWeekDisabled + +String, Array. Default: '', [] + +Days of the week that should be disabled. Values are 0 (Sunday) to 6 (Saturday). Multiple values should be comma-separated. Example: disable weekends: `'0,6'` or `[0,6]`. + +### autoclose + +Boolean. Default: false + +Whether or not to close the datepicker immediately when a date is selected. + +### startView + +Number, String. Default: 0, 'month' + +The view that the datepicker should show when it is opened. Accepts values of 0 or 'month' for month view (the default), 1 or 'year' for the 12-month overview, and 2 or 'decade' for the 10-year overview. Useful for date-of-birth datepickers. + +### minViewMode + +Number, String. Default: 0, 'days' + +Set a limit for the view mode. Accepts: 'days' or 0, 'months' or 1, and 'years' or 2. +Gives the ability to pick only a month or an year. The day is set to the 1st for 'months', and the month is set to January for 'years'. + +### todayBtn + +Boolean, "linked". Default: false + +If true or "linked", displays a "Today" button at the bottom of the datepicker to select the current date. If true, the "Today" button will only move the current date into view; if "linked", the current date will also be selected. + +### todayHighlight + +Boolean. Default: false + +If true, highlights the current date. + +### keyboardNavigation + +Boolean. Default: true + +Whether or not to allow date navigation by arrow keys. + +### language + +String. Default: 'en' + +The IETF code (eg "en" for English, "pt-BR" for Brazilian Portuguese) of the language to use for month and day names. These will also be used as the input's value (and subsequently sent to the server in the case of form submissions). If a full code (eg "de-DE") is supplied the picker will first check for an "de-DE" language and if not found will fallback and check for a "de" language. If an unknown language code is given, English will be used. See I18N below. + +### forceParse + +Boolean. Default: true + +Whether or not to force parsing of the input value when the picker is closed. That is, when an invalid date is left in the input field by the user, the picker will forcibly parse that value, and set the input's value to the new, valid date, conforming to the given `format`. + +## Markup + +Format a component. + +```html +
+ + +
+``` + +## Methods + +### .datepicker(options) + +Initializes an datepicker. + +### remove + +Arguments: None + +Remove the datepicker. Removes attached events, internal attached objects, and +added HTML elements. + +```javascript +$('.datepicker').datepicker('remove'); +``` + +### show + +Arguments: None + +Show the datepicker. + +```javascript +$('.datepicker').datepicker('show'); +``` + +### hide + +Arguments: None + +Hide the datepicker. + +```javascript +$('.datepicker').datepicker('hide'); +``` + +### update + +Arguments: + +* date (String|Date) + +Update the datepicker with given argument or the current input value. + +```javascript +$('.datepicker').datepicker('update'); +``` + +### setStartDate + +Arguments: + +* startDate (String) + +Sets a new lower date limit on the datepicker. + +```javascript +$('.datepicker').datepicker('setStartDate', '2012-01-01'); +``` + +Omit startDate (or provide an otherwise falsey value) to unset the limit. + +```javascript +$('.datepicker').datepicker('setStartDate'); +$('.datepicker').datepicker('setStartDate', null); +``` + +### setEndDate + +Arguments: + +* endDate (String) + +Sets a new upper date limit on the datepicker. + +```javascript +$('.datepicker').datepicker('setEndDate', '2012-12-31'); +``` + +Omit endDate (or provide an otherwise falsey value) to unset the limit. + +```javascript +$('.datepicker').datepicker('setEndDate'); +$('.datepicker').datepicker('setEndDate', null); +``` + +### setDaysOfWeekDisabled + +Arguments: + +* daysOfWeekDisabled (String|Array) + +Sets the days of week that should be disabled. + +```javascript +$('.datepicker').datepicker('setDaysOfWeekDisabled', [0,6]); +``` + +Omit daysOfWeekDisabled (or provide an otherwise falsey value) to unset the disabled days. + +```javascript +$('.datepicker').datepicker('setDaysOfWeekDisabled'); +$('.datepicker').datepicker('setDaysOfWeekDisabled', null); +``` + +## Events + +Datepicker class exposes a few events for manipulating the dates. + +### show + +Fired when the date picker is displayed. + +### hide + +Fired when the date picker is hidden. + +### changeDate + +Fired when the date is changed. + +```javascript +$('#date-end') + .datepicker() + .on('changeDate', function(ev){ + if (ev.date.valueOf() < date-start-display.valueOf()){ + .... + } + }); +``` + +### changeYear + +Fired when the *view* year is changed from decade view. + +### changeMonth + +Fired when the *view* month is changed from year view. + +## Keyboard support + +The datepicker includes some keyboard navigation: + +### up, down, left, right arrow keys + +By themselves, left/right will move backward/forward one day, up/down will move back/forward one week. + +With the shift key, up/left will move backward one month, down/right will move forward one month. + +With the ctrl key, up/left will move backward one year, down/right will move forward oone year. + +Shift+ctrl behaves the same as ctrl -- that is, it does not change both month and year simultaneously, only the year. + +### escape + +The escape key can be used to hide and re-show the datepicker; this is necessary if the user wants to manually edit the value. + +### enter + +When the picker is visible, enter will simply hide it. When the picker is not visible, enter will have normal effects -- submitting the current form, etc. + +## I18N + +The plugin supports i18n for the month and weekday names and the `weekStart` option. The default is English ('en'); other available translations are avilable in the `js/locales/` directory, simply include your desired locale after the plugin. To add more languages, simply add a key to `$.fn.datepicker.dates`, before calling `.datepicker()`. Example: + +```javascript +$.fn.datepicker.dates['en'] = { + days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], + daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], + daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], + months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + today: "Today" +}; +``` + +Right-to-left languages may also include `rtl: true` to make the calendar display appropriately. + +If your browser (or those of your users) is displaying characters wrong, chances are the browser is loading the javascript file with a non-unicode encoding. Simply add `charset="UTF-8"` to your `script` tag: + +```html + +``` + +```javascript +$('.datepicker').datepicker({ + language: XX //as you defined in bootstrap-datepicker.XX.js +}); +``` diff --git a/public/bootstrap-datepicker/build/build.less b/public/bootstrap-datepicker/build/build.less new file mode 100644 index 0000000000..517405056c --- /dev/null +++ b/public/bootstrap-datepicker/build/build.less @@ -0,0 +1,66 @@ +// Datepicker .less buildfile. Includes select mixins/variables from bootstrap +// and imports the included datepicker.less to output a minimal datepicker.css +// +// Usage: +// lessc build.less datepicker.css +// +// Variables and mixins copied from bootstrap 2.0.2 + +// Variables +@grayLight: #999; +@grayLighter: #eee; +@white: #fff; +@linkColor: #08c; +@btnPrimaryBackground: @linkColor; +@orange: #f89406; + +// Mixins + +// Border Radius +.border-radius(@radius: 5px) { + -webkit-border-radius: @radius; + -moz-border-radius: @radius; + border-radius: @radius; +} + +// Button backgrounds +.buttonBackground(@startColor, @endColor) { + .gradientBar(@startColor, @endColor); + .reset-filter(); + &:hover, &:active, &.active, &.disabled, &[disabled] { + background-color: @endColor; + } + &:active, + &.active { + background-color: darken(@endColor, 10%) e("\9"); + } +} + +// Reset filters for IE +.reset-filter() { + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} + +// Gradient Bar Colors for buttons and alerts +.gradientBar(@primaryColor, @secondaryColor) { + #gradient > .vertical(@primaryColor, @secondaryColor); + border-color: @secondaryColor @secondaryColor darken(@secondaryColor, 15%); + border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) fadein(rgba(0,0,0,.1), 15%); +} + +// Gradients +#gradient { + .vertical(@startColor: #555, @endColor: #333) { + background-color: mix(@startColor, @endColor, 60%); + background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+ + background-image: -ms-linear-gradient(top, @startColor, @endColor); // IE10 + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+ + background-image: -webkit-linear-gradient(top, @startColor, @endColor); // Safari 5.1+, Chrome 10+ + background-image: -o-linear-gradient(top, @startColor, @endColor); // Opera 11.10 + background-image: linear-gradient(top, @startColor, @endColor); // The standard + background-repeat: repeat-x; + filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor)); // IE9 and down + } +} + +@import "../less/datepicker.less"; diff --git a/public/bootstrap-datepicker/build/build_standalone.less b/public/bootstrap-datepicker/build/build_standalone.less new file mode 100644 index 0000000000..b0dc24b704 --- /dev/null +++ b/public/bootstrap-datepicker/build/build_standalone.less @@ -0,0 +1,69 @@ +// Datepicker standalone .less buildfile. Includes all necessary mixins/variables/rules from bootstrap +// and imports the included datepicker.less to output a minimal standalone datepicker.css +// +// Usage: +// lessc build_standalone.less datepicker.css +// +// Variables, mixins, and rules copied from bootstrap 2.0.2 + +@import "build.less"; + +// Dropdown css + +@zindexDropdown: 1000; +@grayDark: #333; +@baseLineHeight: 18px; +@tableBackground: transparent; // overall background-color +@dropdownBackground: @white; +@dropdownBorder: rgba(0,0,0,.2); +@dropdownLinkColor: @grayDark; +@dropdownLinkColorHover: @white; +@dropdownLinkBackgroundHover: @linkColor; + +// Drop shadows +.box-shadow(@shadow) { + -webkit-box-shadow: @shadow; + -moz-box-shadow: @shadow; + box-shadow: @shadow; +} + +// The dropdown menu (ul) +// ---------------------- +.datepicker.dropdown-menu { + position: absolute; + top: 100%; + left: 0; + z-index: @zindexDropdown; + float: left; + display: none; // none by default, but block on "open" of the menu + min-width: 160px; + list-style: none; + background-color: @dropdownBackground; + border: 1px solid #ccc; + border: 1px solid rgba(0,0,0,.2); + .border-radius(5px); + .box-shadow(0 5px 10px rgba(0,0,0,.2)); + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; + *border-right-width: 2px; + *border-bottom-width: 2px; + + // Normally inherited from bootstrap's `body` + color: #333333; + font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; + font-size:13px; + line-height: @baseLineHeight; + + th, td { + padding: 4px 5px; + } +} + +// Alternative arrows +// May require `charset="UTF-8"` in your `` tag +.datepicker { + .prev, .next {font-style:normal;} + .prev:after {content:"«";} + .next:after {content:"»";} +} diff --git a/public/bootstrap-datepicker/component.json b/public/bootstrap-datepicker/component.json new file mode 100644 index 0000000000..9ed69146f7 --- /dev/null +++ b/public/bootstrap-datepicker/component.json @@ -0,0 +1,9 @@ +{ + "name": "bootstrap-datepicker", + "version": "1.0.0", + "main": ["js/bootstrap-datepicker.js","css/datepicker.css"], + "dependencies": { + "jquery" : ">=1.7.1", + "bootstrap" : ">=2.0.4 <3.0" + } +} diff --git a/public/bootstrap-datepicker/css/datepicker.css b/public/bootstrap-datepicker/css/datepicker.css new file mode 100644 index 0000000000..296507b0ef --- /dev/null +++ b/public/bootstrap-datepicker/css/datepicker.css @@ -0,0 +1,301 @@ +/*! + * Datepicker for Bootstrap + * + * Copyright 2012 Stefan Petre + * Improvements by Andrew Rowls + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ +.datepicker { + padding: 4px; + /*margin-top: 1px;*/ + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + direction: ltr; + /*.dow { + border-top: 1px solid #ddd !important; + }*/ + +} +.datepicker-inline { + width: 220px; +} +.datepicker.datepicker-rtl { + direction: rtl; +} +.datepicker.datepicker-rtl table tr td span { + float: right; +} +.datepicker-dropdown { + top: 0; + left: 0; +} +.datepicker-dropdown: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: 6px; +} +.datepicker-dropdown:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #ffffff; + position: absolute; + top: -6px; + left: 7px; +} +.datepicker > div { + display: none; +} +.datepicker.days div.datepicker-days { + display: block; +} +.datepicker.months div.datepicker-months { + display: block; +} +.datepicker.years div.datepicker-years { + display: block; +} +.datepicker table { + margin: 0; +} +.datepicker td, +.datepicker th { + text-align: center; + width: 20px; + height: 20px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + border: none; +} +.table-striped .datepicker table tr td, +.table-striped .datepicker table tr th { + background-color: transparent; +} +.datepicker table tr td.day:hover { + background: #eeeeee; + cursor: pointer; +} +.datepicker table tr td.old, +.datepicker table tr td.new { + color: #999999; +} +.datepicker table tr td.disabled, +.datepicker table tr td.disabled:hover { + background: none; + color: #999999; + cursor: default; +} +.datepicker table tr td.today, +.datepicker table tr td.today:hover, +.datepicker table tr td.today.disabled, +.datepicker table tr td.today.disabled:hover { + background-color: #fde19a; + background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a); + background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a)); + background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a); + background-image: -o-linear-gradient(top, #fdd49a, #fdf59a); + background-image: linear-gradient(top, #fdd49a, #fdf59a); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0); + border-color: #fdf59a #fdf59a #fbed50; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); +} +.datepicker table tr td.today:hover, +.datepicker table tr td.today:hover:hover, +.datepicker table tr td.today.disabled:hover, +.datepicker table tr td.today.disabled:hover:hover, +.datepicker table tr td.today:active, +.datepicker table tr td.today:hover:active, +.datepicker table tr td.today.disabled:active, +.datepicker table tr td.today.disabled:hover:active, +.datepicker table tr td.today.active, +.datepicker table tr td.today:hover.active, +.datepicker table tr td.today.disabled.active, +.datepicker table tr td.today.disabled:hover.active, +.datepicker table tr td.today.disabled, +.datepicker table tr td.today:hover.disabled, +.datepicker table tr td.today.disabled.disabled, +.datepicker table tr td.today.disabled:hover.disabled, +.datepicker table tr td.today[disabled], +.datepicker table tr td.today:hover[disabled], +.datepicker table tr td.today.disabled[disabled], +.datepicker table tr td.today.disabled:hover[disabled] { + background-color: #fdf59a; +} +.datepicker table tr td.today:active, +.datepicker table tr td.today:hover:active, +.datepicker table tr td.today.disabled:active, +.datepicker table tr td.today.disabled:hover:active, +.datepicker table tr td.today.active, +.datepicker table tr td.today:hover.active, +.datepicker table tr td.today.disabled.active, +.datepicker table tr td.today.disabled:hover.active { + background-color: #fbf069 \9; +} +.datepicker table tr td.active, +.datepicker table tr td.active:hover, +.datepicker table tr td.active.disabled, +.datepicker table tr td.active.disabled:hover { + background-color: #006dcc; + background-image: -moz-linear-gradient(top, #0088cc, #0044cc); + background-image: -ms-linear-gradient(top, #0088cc, #0044cc); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); + background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); + background-image: -o-linear-gradient(top, #0088cc, #0044cc); + background-image: linear-gradient(top, #0088cc, #0044cc); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); + border-color: #0044cc #0044cc #002a80; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); + color: #fff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} +.datepicker table tr td.active:hover, +.datepicker table tr td.active:hover:hover, +.datepicker table tr td.active.disabled:hover, +.datepicker table tr td.active.disabled:hover:hover, +.datepicker table tr td.active:active, +.datepicker table tr td.active:hover:active, +.datepicker table tr td.active.disabled:active, +.datepicker table tr td.active.disabled:hover:active, +.datepicker table tr td.active.active, +.datepicker table tr td.active:hover.active, +.datepicker table tr td.active.disabled.active, +.datepicker table tr td.active.disabled:hover.active, +.datepicker table tr td.active.disabled, +.datepicker table tr td.active:hover.disabled, +.datepicker table tr td.active.disabled.disabled, +.datepicker table tr td.active.disabled:hover.disabled, +.datepicker table tr td.active[disabled], +.datepicker table tr td.active:hover[disabled], +.datepicker table tr td.active.disabled[disabled], +.datepicker table tr td.active.disabled:hover[disabled] { + background-color: #0044cc; +} +.datepicker table tr td.active:active, +.datepicker table tr td.active:hover:active, +.datepicker table tr td.active.disabled:active, +.datepicker table tr td.active.disabled:hover:active, +.datepicker table tr td.active.active, +.datepicker table tr td.active:hover.active, +.datepicker table tr td.active.disabled.active, +.datepicker table tr td.active.disabled:hover.active { + background-color: #003399 \9; +} +.datepicker table tr td span { + display: block; + width: 23%; + height: 54px; + line-height: 54px; + float: left; + margin: 1%; + cursor: pointer; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.datepicker table tr td span:hover { + background: #eeeeee; +} +.datepicker table tr td span.disabled, +.datepicker table tr td span.disabled:hover { + background: none; + color: #999999; + cursor: default; +} +.datepicker table tr td span.active, +.datepicker table tr td span.active:hover, +.datepicker table tr td span.active.disabled, +.datepicker table tr td span.active.disabled:hover { + background-color: #006dcc; + background-image: -moz-linear-gradient(top, #0088cc, #0044cc); + background-image: -ms-linear-gradient(top, #0088cc, #0044cc); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); + background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); + background-image: -o-linear-gradient(top, #0088cc, #0044cc); + background-image: linear-gradient(top, #0088cc, #0044cc); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); + border-color: #0044cc #0044cc #002a80; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); + color: #fff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} +.datepicker table tr td span.active:hover, +.datepicker table tr td span.active:hover:hover, +.datepicker table tr td span.active.disabled:hover, +.datepicker table tr td span.active.disabled:hover:hover, +.datepicker table tr td span.active:active, +.datepicker table tr td span.active:hover:active, +.datepicker table tr td span.active.disabled:active, +.datepicker table tr td span.active.disabled:hover:active, +.datepicker table tr td span.active.active, +.datepicker table tr td span.active:hover.active, +.datepicker table tr td span.active.disabled.active, +.datepicker table tr td span.active.disabled:hover.active, +.datepicker table tr td span.active.disabled, +.datepicker table tr td span.active:hover.disabled, +.datepicker table tr td span.active.disabled.disabled, +.datepicker table tr td span.active.disabled:hover.disabled, +.datepicker table tr td span.active[disabled], +.datepicker table tr td span.active:hover[disabled], +.datepicker table tr td span.active.disabled[disabled], +.datepicker table tr td span.active.disabled:hover[disabled] { + background-color: #0044cc; +} +.datepicker table tr td span.active:active, +.datepicker table tr td span.active:hover:active, +.datepicker table tr td span.active.disabled:active, +.datepicker table tr td span.active.disabled:hover:active, +.datepicker table tr td span.active.active, +.datepicker table tr td span.active:hover.active, +.datepicker table tr td span.active.disabled.active, +.datepicker table tr td span.active.disabled:hover.active { + background-color: #003399 \9; +} +.datepicker table tr td span.old { + color: #999999; +} +.datepicker th.switch { + width: 145px; +} +.datepicker thead tr:first-child th, +.datepicker tfoot tr:first-child th { + cursor: pointer; +} +.datepicker thead tr:first-child th:hover, +.datepicker tfoot tr:first-child th:hover { + background: #eeeeee; +} +.datepicker .cw { + font-size: 10px; + width: 12px; + padding: 0 2px 0 5px; + vertical-align: middle; +} +.datepicker thead tr:first-child th.cw { + cursor: default; + background-color: transparent; +} +.input-append.date .add-on i, +.input-prepend.date .add-on i { + display: block; + cursor: pointer; + width: 16px; + height: 16px; +} diff --git a/public/bootstrap-datepicker/js/bootstrap-datepicker.js b/public/bootstrap-datepicker/js/bootstrap-datepicker.js new file mode 100644 index 0000000000..553194b7ba --- /dev/null +++ b/public/bootstrap-datepicker/js/bootstrap-datepicker.js @@ -0,0 +1,1018 @@ +/* ========================================================= + * bootstrap-datepicker.js + * http://www.eyecon.ro/bootstrap-datepicker + * ========================================================= + * Copyright 2012 Stefan Petre + * Improvements by Andrew Rowls + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================= */ + +!function( $ ) { + + function UTCDate(){ + return new Date(Date.UTC.apply(Date, arguments)); + } + function UTCToday(){ + var today = new Date(); + return UTCDate(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate()); + } + + // Picker object + + var Datepicker = function(element, options) { + var that = this; + + this.element = $(element); + this.language = options.language||this.element.data('date-language')||"en"; + this.language = this.language in dates ? this.language : this.language.split('-')[0]; //Check if "de-DE" style date is available, if not language should fallback to 2 letter code eg "de" + this.language = this.language in dates ? this.language : "en"; + this.isRTL = dates[this.language].rtl||false; + this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||dates[this.language].format||'mm/dd/yyyy'); + this.isInline = false; + this.isInput = this.element.is('input'); + this.component = this.element.is('.date') ? this.element.find('.add-on') : false; + this.hasInput = this.component && this.element.find('input').length; + if(this.component && this.component.length === 0) + this.component = false; + + this._attachEvents(); + + this.forceParse = true; + if ('forceParse' in options) { + this.forceParse = options.forceParse; + } else if ('dateForceParse' in this.element.data()) { + this.forceParse = this.element.data('date-force-parse'); + } + + + this.picker = $(DPGlobal.template) + .appendTo(this.isInline ? this.element : 'body') + .on({ + click: $.proxy(this.click, this), + mousedown: $.proxy(this.mousedown, this) + }); + + if(this.isInline) { + this.picker.addClass('datepicker-inline'); + } else { + this.picker.addClass('datepicker-dropdown dropdown-menu'); + } + if (this.isRTL){ + this.picker.addClass('datepicker-rtl'); + this.picker.find('.prev i, .next i') + .toggleClass('icon-arrow-left icon-arrow-right'); + } + $(document).on('mousedown', function (e) { + // Clicked outside the datepicker, hide it + if ($(e.target).closest('.datepicker.datepicker-inline, .datepicker.datepicker-dropdown').length === 0) { + that.hide(); + } + }); + + this.autoclose = false; + if ('autoclose' in options) { + this.autoclose = options.autoclose; + } else if ('dateAutoclose' in this.element.data()) { + this.autoclose = this.element.data('date-autoclose'); + } + + this.keyboardNavigation = true; + if ('keyboardNavigation' in options) { + this.keyboardNavigation = options.keyboardNavigation; + } else if ('dateKeyboardNavigation' in this.element.data()) { + this.keyboardNavigation = this.element.data('date-keyboard-navigation'); + } + + this.viewMode = this.startViewMode = 0; + switch(options.startView || this.element.data('date-start-view')){ + case 2: + case 'decade': + this.viewMode = this.startViewMode = 2; + break; + case 1: + case 'year': + this.viewMode = this.startViewMode = 1; + break; + } + + this.minViewMode = options.minViewMode||this.element.data('date-min-view-mode')||0; + if (typeof this.minViewMode === 'string') { + switch (this.minViewMode) { + case 'months': + this.minViewMode = 1; + break; + case 'years': + this.minViewMode = 2; + break; + default: + this.minViewMode = 0; + break; + } + } + + this.viewMode = this.startViewMode = Math.max(this.startViewMode, this.minViewMode); + + this.todayBtn = (options.todayBtn||this.element.data('date-today-btn')||false); + this.todayHighlight = (options.todayHighlight||this.element.data('date-today-highlight')||false); + + this.calendarWeeks = false; + if ('calendarWeeks' in options) { + this.calendarWeeks = options.calendarWeeks; + } else if ('dateCalendarWeeks' in this.element.data()) { + this.calendarWeeks = this.element.data('date-calendar-weeks'); + } + if (this.calendarWeeks) + this.picker.find('tfoot th.today') + .attr('colspan', function(i, val){ + return parseInt(val) + 1; + }); + + this.weekStart = ((options.weekStart||this.element.data('date-weekstart')||dates[this.language].weekStart||0) % 7); + this.weekEnd = ((this.weekStart + 6) % 7); + this.startDate = -Infinity; + this.endDate = Infinity; + this.daysOfWeekDisabled = []; + this.setStartDate(options.startDate||this.element.data('date-startdate')); + this.setEndDate(options.endDate||this.element.data('date-enddate')); + this.setDaysOfWeekDisabled(options.daysOfWeekDisabled||this.element.data('date-days-of-week-disabled')); + this.fillDow(); + this.fillMonths(); + this.update(); + this.showMode(); + + if(this.isInline) { + this.show(); + } + }; + + Datepicker.prototype = { + constructor: Datepicker, + + _events: [], + _attachEvents: function(){ + this._detachEvents(); + if (this.isInput) { // single input + this._events = [ + [this.element, { + focus: $.proxy(this.show, this), + keyup: $.proxy(this.update, this), + keydown: $.proxy(this.keydown, this) + }] + ]; + } + else if (this.component && this.hasInput){ // component: input + button + this._events = [ + // For components that are not readonly, allow keyboard nav + [this.element.find('input'), { + focus: $.proxy(this.show, this), + keyup: $.proxy(this.update, this), + keydown: $.proxy(this.keydown, this) + }], + [this.component, { + click: $.proxy(this.show, this) + }] + ]; + } + else if (this.element.is('div')) { // inline datepicker + this.isInline = true; + } + else { + this._events = [ + [this.element, { + click: $.proxy(this.show, this) + }] + ]; + } + for (var i=0, el, ev; i this.endDate) { + this.viewDate = new Date(this.endDate); + } else { + this.viewDate = new Date(this.date); + } + this.fill(); + }, + + fillDow: function(){ + var dowCnt = this.weekStart, + html = ''; + if(this.calendarWeeks){ + var cell = ' '; + html += cell; + this.picker.find('.datepicker-days thead tr:first-child').prepend(cell); + } + while (dowCnt < this.weekStart + 7) { + html += ''+dates[this.language].daysMin[(dowCnt++)%7]+''; + } + html += ''; + this.picker.find('.datepicker-days thead').append(html); + }, + + fillMonths: function(){ + var html = '', + i = 0; + while (i < 12) { + html += ''+dates[this.language].monthsShort[i++]+''; + } + this.picker.find('.datepicker-months td').html(html); + }, + + fill: function() { + var d = new Date(this.viewDate), + year = d.getUTCFullYear(), + month = d.getUTCMonth(), + startYear = this.startDate !== -Infinity ? this.startDate.getUTCFullYear() : -Infinity, + startMonth = this.startDate !== -Infinity ? this.startDate.getUTCMonth() : -Infinity, + endYear = this.endDate !== Infinity ? this.endDate.getUTCFullYear() : Infinity, + endMonth = this.endDate !== Infinity ? this.endDate.getUTCMonth() : Infinity, + currentDate = this.date && this.date.valueOf(), + today = new Date(); + this.picker.find('.datepicker-days thead th.switch') + .text(dates[this.language].months[month]+' '+year); + this.picker.find('tfoot th.today') + .text(dates[this.language].today) + .toggle(this.todayBtn !== false); + this.updateNavArrows(); + this.fillMonths(); + var prevMonth = UTCDate(year, month-1, 28,0,0,0,0), + day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth()); + prevMonth.setUTCDate(day); + prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7)%7); + var nextMonth = new Date(prevMonth); + nextMonth.setUTCDate(nextMonth.getUTCDate() + 42); + nextMonth = nextMonth.valueOf(); + var html = []; + var clsName; + while(prevMonth.valueOf() < nextMonth) { + if (prevMonth.getUTCDay() == this.weekStart) { + html.push(''); + if(this.calendarWeeks){ + // ISO 8601: First week contains first thursday. + // ISO also states week starts on Monday, but we can be more abstract here. + var + // Start of current week: based on weekstart/current date + ws = new Date(+prevMonth + (this.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5), + // Thursday of this week + th = new Date(+ws + (7 + 4 - ws.getUTCDay()) % 7 * 864e5), + // First Thursday of year, year from thursday + yth = new Date(+(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5), + // Calendar week: ms between thursdays, div ms per day, div 7 days + calWeek = (th - yth) / 864e5 / 7 + 1; + html.push(''+ calWeek +''); + + } + } + clsName = ''; + if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() < month)) { + clsName += ' old'; + } else if (prevMonth.getUTCFullYear() > year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() > month)) { + clsName += ' new'; + } + // Compare internal UTC date with local today, not UTC today + if (this.todayHighlight && + prevMonth.getUTCFullYear() == today.getFullYear() && + prevMonth.getUTCMonth() == today.getMonth() && + prevMonth.getUTCDate() == today.getDate()) { + clsName += ' today'; + } + if (currentDate && prevMonth.valueOf() == currentDate) { + clsName += ' active'; + } + if (prevMonth.valueOf() < this.startDate || prevMonth.valueOf() > this.endDate || + $.inArray(prevMonth.getUTCDay(), this.daysOfWeekDisabled) !== -1) { + clsName += ' disabled'; + } + html.push(''+prevMonth.getUTCDate() + ''); + if (prevMonth.getUTCDay() == this.weekEnd) { + html.push(''); + } + prevMonth.setUTCDate(prevMonth.getUTCDate()+1); + } + this.picker.find('.datepicker-days tbody').empty().append(html.join('')); + var currentYear = this.date && this.date.getUTCFullYear(); + + var months = this.picker.find('.datepicker-months') + .find('th:eq(1)') + .text(year) + .end() + .find('span').removeClass('active'); + if (currentYear && currentYear == year) { + months.eq(this.date.getUTCMonth()).addClass('active'); + } + if (year < startYear || year > endYear) { + months.addClass('disabled'); + } + if (year == startYear) { + months.slice(0, startMonth).addClass('disabled'); + } + if (year == endYear) { + months.slice(endMonth+1).addClass('disabled'); + } + + html = ''; + year = parseInt(year/10, 10) * 10; + var yearCont = this.picker.find('.datepicker-years') + .find('th:eq(1)') + .text(year + '-' + (year + 9)) + .end() + .find('td'); + year -= 1; + for (var i = -1; i < 11; i++) { + html += ''+year+''; + year += 1; + } + yearCont.html(html); + }, + + updateNavArrows: function() { + var d = new Date(this.viewDate), + year = d.getUTCFullYear(), + month = d.getUTCMonth(); + switch (this.viewMode) { + case 0: + if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear() && month <= this.startDate.getUTCMonth()) { + this.picker.find('.prev').css({visibility: 'hidden'}); + } else { + this.picker.find('.prev').css({visibility: 'visible'}); + } + if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear() && month >= this.endDate.getUTCMonth()) { + this.picker.find('.next').css({visibility: 'hidden'}); + } else { + this.picker.find('.next').css({visibility: 'visible'}); + } + break; + case 1: + case 2: + if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()) { + this.picker.find('.prev').css({visibility: 'hidden'}); + } else { + this.picker.find('.prev').css({visibility: 'visible'}); + } + if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()) { + this.picker.find('.next').css({visibility: 'hidden'}); + } else { + this.picker.find('.next').css({visibility: 'visible'}); + } + break; + } + }, + + click: function(e) { + e.stopPropagation(); + e.preventDefault(); + var target = $(e.target).closest('span, td, th'); + if (target.length == 1) { + switch(target[0].nodeName.toLowerCase()) { + case 'th': + switch(target[0].className) { + case 'switch': + this.showMode(1); + break; + case 'prev': + case 'next': + var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1); + switch(this.viewMode){ + case 0: + this.viewDate = this.moveMonth(this.viewDate, dir); + break; + case 1: + case 2: + this.viewDate = this.moveYear(this.viewDate, dir); + break; + } + this.fill(); + break; + case 'today': + var date = new Date(); + date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); + + this.showMode(-2); + var which = this.todayBtn == 'linked' ? null : 'view'; + this._setDate(date, which); + break; + } + break; + case 'span': + if (!target.is('.disabled')) { + this.viewDate.setUTCDate(1); + if (target.is('.month')) { + var day = 1; + var month = target.parent().find('span').index(target); + var year = this.viewDate.getUTCFullYear(); + this.viewDate.setUTCMonth(month); + this.element.trigger({ + type: 'changeMonth', + date: this.viewDate + }); + if ( this.minViewMode == 1 ) { + this._setDate(UTCDate(year, month, day,0,0,0,0)); + } + } else { + var year = parseInt(target.text(), 10)||0; + var day = 1; + var month = 0; + this.viewDate.setUTCFullYear(year); + this.element.trigger({ + type: 'changeYear', + date: this.viewDate + }); + if ( this.minViewMode == 2 ) { + this._setDate(UTCDate(year, month, day,0,0,0,0)); + } + } + this.showMode(-1); + this.fill(); + } + break; + case 'td': + if (target.is('.day') && !target.is('.disabled')){ + var day = parseInt(target.text(), 10)||1; + var year = this.viewDate.getUTCFullYear(), + month = this.viewDate.getUTCMonth(); + 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; + } + } + this._setDate(UTCDate(year, month, day,0,0,0,0)); + } + break; + } + } + }, + + _setDate: function(date, which){ + if (!which || which == 'date') + this.date = date; + if (!which || which == 'view') + this.viewDate = date; + this.fill(); + this.setValue(); + this.element.trigger({ + type: 'changeDate', + date: this.date + }); + var element; + if (this.isInput) { + element = this.element; + } else if (this.component){ + element = this.element.find('input'); + } + if (element) { + element.change(); + if (this.autoclose && (!which || which == 'date')) { + this.hide(); + } + } + }, + + moveMonth: function(date, dir){ + if (!dir) return date; + var new_date = new Date(date.valueOf()), + day = new_date.getUTCDate(), + month = new_date.getUTCMonth(), + mag = Math.abs(dir), + new_month, test; + dir = dir > 0 ? 1 : -1; + if (mag == 1){ + test = dir == -1 + // If going back one month, make sure month is not current month + // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02) + ? function(){ return new_date.getUTCMonth() == month; } + // If going forward one month, make sure month is as expected + // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02) + : function(){ return new_date.getUTCMonth() != new_month; }; + new_month = month + dir; + new_date.setUTCMonth(new_month); + // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11 + if (new_month < 0 || new_month > 11) + new_month = (new_month + 12) % 12; + } else { + // For magnitudes >1, move one month at a time... + for (var i=0; i= this.startDate && date <= this.endDate; + }, + + keydown: function(e){ + if (this.picker.is(':not(:visible)')){ + if (e.keyCode == 27) // allow escape to hide and re-show picker + this.show(); + return; + } + var dateChanged = false, + dir, day, month, + newDate, newViewDate; + switch(e.keyCode){ + case 27: // escape + this.hide(); + e.preventDefault(); + break; + case 37: // left + case 39: // right + if (!this.keyboardNavigation) break; + dir = e.keyCode == 37 ? -1 : 1; + if (e.ctrlKey){ + newDate = this.moveYear(this.date, dir); + newViewDate = this.moveYear(this.viewDate, dir); + } else if (e.shiftKey){ + newDate = this.moveMonth(this.date, dir); + newViewDate = this.moveMonth(this.viewDate, dir); + } else { + newDate = new Date(this.date); + newDate.setUTCDate(this.date.getUTCDate() + dir); + newViewDate = new Date(this.viewDate); + newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir); + } + if (this.dateWithinRange(newDate)){ + this.date = newDate; + this.viewDate = newViewDate; + this.setValue(); + this.update(); + e.preventDefault(); + dateChanged = true; + } + break; + case 38: // up + case 40: // down + if (!this.keyboardNavigation) break; + dir = e.keyCode == 38 ? -1 : 1; + if (e.ctrlKey){ + newDate = this.moveYear(this.date, dir); + newViewDate = this.moveYear(this.viewDate, dir); + } else if (e.shiftKey){ + newDate = this.moveMonth(this.date, dir); + newViewDate = this.moveMonth(this.viewDate, dir); + } else { + newDate = new Date(this.date); + newDate.setUTCDate(this.date.getUTCDate() + dir * 7); + newViewDate = new Date(this.viewDate); + newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir * 7); + } + if (this.dateWithinRange(newDate)){ + this.date = newDate; + this.viewDate = newViewDate; + this.setValue(); + this.update(); + e.preventDefault(); + dateChanged = true; + } + break; + case 13: // enter + this.hide(); + e.preventDefault(); + break; + case 9: // tab + this.hide(); + break; + } + if (dateChanged){ + this.element.trigger({ + type: 'changeDate', + date: this.date + }); + var element; + if (this.isInput) { + element = this.element; + } else if (this.component){ + element = this.element.find('input'); + } + if (element) { + element.change(); + } + } + }, + + showMode: function(dir) { + if (dir) { + this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + dir)); + } + /* + vitalets: fixing bug of very special conditions: + jquery 1.7.1 + webkit + show inline datepicker in bootstrap popover. + Method show() does not set display css correctly and datepicker is not shown. + Changed to .css('display', 'block') solve the problem. + See https://github.com/vitalets/x-editable/issues/37 + + In jquery 1.7.2+ everything works fine. + */ + //this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show(); + this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).css('display', 'block'); + this.updateNavArrows(); + } + }; + + $.fn.datepicker = function ( option ) { + var args = Array.apply(null, arguments); + args.shift(); + return this.each(function () { + var $this = $(this), + data = $this.data('datepicker'), + options = typeof option == 'object' && option; + if (!data) { + $this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options)))); + } + if (typeof option == 'string' && typeof data[option] == 'function') { + data[option].apply(data, args); + } + }); + }; + + $.fn.datepicker.defaults = { + }; + $.fn.datepicker.Constructor = Datepicker; + var dates = $.fn.datepicker.dates = { + en: { + days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], + daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], + daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], + months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + today: "Today" + } + }; + + var DPGlobal = { + modes: [ + { + clsName: 'days', + navFnc: 'Month', + navStep: 1 + }, + { + clsName: 'months', + navFnc: 'FullYear', + navStep: 1 + }, + { + clsName: 'years', + navFnc: 'FullYear', + navStep: 10 + }], + isLeapYear: function (year) { + return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)); + }, + getDaysInMonth: function (year, month) { + return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; + }, + validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g, + nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g, + parseFormat: function(format){ + // IE treats \0 as a string end in inputs (truncating the value), + // so it's a bad format delimiter, anyway + var separators = format.replace(this.validParts, '\0').split('\0'), + parts = format.match(this.validParts); + if (!separators || !separators.length || !parts || parts.length === 0){ + throw new Error("Invalid date format."); + } + return {separators: separators, parts: parts}; + }, + parseDate: function(date, format, language) { + if (date instanceof Date) return date; + if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)) { + var part_re = /([\-+]\d+)([dmwy])/, + parts = date.match(/([\-+]\d+)([dmwy])/g), + part, dir; + date = new Date(); + for (var i=0; i'+ + ''+ + ''+ + ''+ + ''+ + ''+ + '', + contTemplate: '', + footTemplate: '' + }; + DPGlobal.template = '
'+ + '
'+ + ''+ + DPGlobal.headTemplate+ + ''+ + DPGlobal.footTemplate+ + '
'+ + '
'+ + '
'+ + ''+ + DPGlobal.headTemplate+ + DPGlobal.contTemplate+ + DPGlobal.footTemplate+ + '
'+ + '
'+ + '
'+ + ''+ + DPGlobal.headTemplate+ + DPGlobal.contTemplate+ + DPGlobal.footTemplate+ + '
'+ + '
'+ + '
'; + + $.fn.datepicker.DPGlobal = DPGlobal; + +}( window.jQuery ); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.bg.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.bg.js new file mode 100644 index 0000000000..6837afd9cb --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.bg.js @@ -0,0 +1,14 @@ +/** + * Bulgarian translation for bootstrap-datepicker + * Apostol Apostolov + */ +;(function($){ + $.fn.datepicker.dates['bg'] = { + days: ["Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота", "Неделя"], + daysShort: ["Нед", "Пон", "Вто", "Сря", "Чет", "Пет", "Съб", "Нед"], + daysMin: ["Н", "П", "В", "С", "Ч", "П", "С", "Н"], + months: ["Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"], + monthsShort: ["Ян", "Фев", "Мар", "Апр", "Май", "Юни", "Юли", "Авг", "Сеп", "Окт", "Ное", "Дек"], + today: "днес" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.ca.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.ca.js new file mode 100644 index 0000000000..3fc4d844a5 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.ca.js @@ -0,0 +1,14 @@ +/** + * Catalan translation for bootstrap-datepicker + * J. Garcia + */ +;(function($){ + $.fn.datepicker.dates['ca'] = { + days: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte", "Diumenge"], + daysShort: ["Diu", "Dil", "Dmt", "Dmc", "Dij", "Div", "Dis", "Diu"], + daysMin: ["dg", "dl", "dt", "dc", "dj", "dv", "ds", "dg"], + months: ["Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"], + monthsShort: ["Gen", "Feb", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Oct", "Nov", "Des"], + today: "Avui" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.cs.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.cs.js new file mode 100644 index 0000000000..f76a2c0824 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.cs.js @@ -0,0 +1,15 @@ +/** + * Czech translation for bootstrap-datepicker + * Matěj Koubík + * Fixes by Michal Remiš + */ +;(function($){ + $.fn.datepicker.dates['cs'] = { + days: ["Neděle", "Pondělí", "Úterý", "Středa", "Čtvrtek", "Pátek", "Sobota", "Neděle"], + daysShort: ["Ned", "Pon", "Úte", "Stř", "Čtv", "Pát", "Sob", "Ned"], + daysMin: ["Ne", "Po", "Út", "St", "Čt", "Pá", "So", "Ne"], + months: ["Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"], + monthsShort: ["Led", "Úno", "Bře", "Dub", "Kvě", "Čer", "Čnc", "Srp", "Zář", "Říj", "Lis", "Pro"], + today: "Dnes" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.da.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.da.js new file mode 100644 index 0000000000..6307be5f69 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.da.js @@ -0,0 +1,14 @@ +/** + * Danish translation for bootstrap-datepicker + * Christian Pedersen + */ +;(function($){ + $.fn.datepicker.dates['da'] = { + days: ["Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"], + daysShort: ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør", "Søn"], + daysMin: ["Sø", "Ma", "Ti", "On", "To", "Fr", "Lø", "Sø"], + months: ["Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December"], + monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"], + today: "I Dag" + }; +}(jQuery)); \ No newline at end of file diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.de.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.de.js new file mode 100644 index 0000000000..3d491a2755 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.de.js @@ -0,0 +1,16 @@ +/** + * German translation for bootstrap-datepicker + * Sam Zurcher + */ +;(function($){ + $.fn.datepicker.dates['de'] = { + days: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"], + daysShort: ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam", "Son"], + daysMin: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"], + months: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], + monthsShort: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"], + today: "Heute", + weekStart: 1, + format: "dd.mm.yyyy" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.el.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.el.js new file mode 100644 index 0000000000..551ce0500a --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.el.js @@ -0,0 +1,13 @@ +/** +* Greek translation for bootstrap-datepicker +*/ +;(function($){ + $.fn.datepicker.dates['el'] = { + days: ["Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο", "Κυριακή"], + daysShort: ["Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ", "Κυρ"], + daysMin: ["Κυ", "Δε", "Τρ", "Τε", "Πε", "Πα", "Σα", "Κυ"], + months: ["Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος"], + monthsShort: ["Ιαν", "Φεβ", "Μαρ", "Απρ", "Μάι", "Ιουν", "Ιουλ", "Αυγ", "Σεπ", "Οκτ", "Νοε", "Δεκ"], + today: "Σήμερα" + }; +}(jQuery)); \ No newline at end of file diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.es.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.es.js new file mode 100644 index 0000000000..72176902d1 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.es.js @@ -0,0 +1,14 @@ +/** + * Spanish translation for bootstrap-datepicker + * Bruno Bonamin + */ +;(function($){ + $.fn.datepicker.dates['es'] = { + days: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo"], + daysShort: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb", "Dom"], + daysMin: ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa", "Do"], + months: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"], + monthsShort: ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"], + today: "Hoy" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.fi.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.fi.js new file mode 100644 index 0000000000..e13e6b9321 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.fi.js @@ -0,0 +1,14 @@ +/** + * Finnish translation for bootstrap-datepicker + * Jaakko Salonen + */ +;(function($){ + $.fn.datepicker.dates['fi'] = { + days: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai", "sunnuntai"], + daysShort: ["sun", "maa", "tii", "kes", "tor", "per", "lau", "sun"], + daysMin: ["su", "ma", "ti", "ke", "to", "pe", "la", "su"], + months: ["tammikuu", "helmikuu", "maaliskuu", "huhtikuu", "toukokuu", "kesäkuu", "heinäkuu", "elokuu", "syyskuu", "lokakuu", "marraskuu", "joulukuu"], + monthsShort: ["tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", "syy", "lok", "mar", "jou"], + today: "tänään" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.fr.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.fr.js new file mode 100644 index 0000000000..498babebda --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.fr.js @@ -0,0 +1,16 @@ +/** + * French translation for bootstrap-datepicker + * Nico Mollet + */ +;(function($){ + $.fn.datepicker.dates['fr'] = { + days: ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"], + daysShort: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam", "Dim"], + daysMin: ["D", "L", "Ma", "Me", "J", "V", "S", "D"], + months: ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"], + monthsShort: ["Jan", "Fev", "Mar", "Avr", "Mai", "Jui", "Jul", "Aou", "Sep", "Oct", "Nov", "Dec"], + today: "Aujourd'hui", + weekStart: 1, + format: "dd/mm/yyyy" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.he.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.he.js new file mode 100644 index 0000000000..2e17393b12 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.he.js @@ -0,0 +1,15 @@ +/** + * Hebrew translation for bootstrap-datepicker + * Sagie Maoz + */ +;(function($){ + $.fn.datepicker.dates['he'] = { + days: ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת", "ראשון"], + daysShort: ["א", "ב", "ג", "ד", "ה", "ו", "ש", "א"], + daysMin: ["א", "ב", "ג", "ד", "ה", "ו", "ש", "א"], + months: ["ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר"], + monthsShort: ["ינו", "פבר", "מרץ", "אפר", "מאי", "יונ", "יול", "אוג", "ספט", "אוק", "נוב", "דצמ"], + today: "היום", + rtl: true + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.hr.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.hr.js new file mode 100644 index 0000000000..8d13d11cdd --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.hr.js @@ -0,0 +1,13 @@ +/** + * Croatian localisation + */ +;(function($){ + $.fn.datepicker.dates['hr'] = { + days: ["Nedjelja", "Ponedjelja", "Utorak", "Srijeda", "Četrtak", "Petak", "Subota", "Nedjelja"], + daysShort: ["Ned", "Pon", "Uto", "Srr", "Čet", "Pet", "Sub", "Ned"], + daysMin: ["Ne", "Po", "Ut", "Sr", "Če", "Pe", "Su", "Ne"], + months: ["Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"], + monthsShort: ["Sije", "Velj", "Ožu", "Tra", "Svi", "Lip", "Jul", "Kol", "Ruj", "Lis", "Stu", "Pro"], + today: "Danas" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.hu.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.hu.js new file mode 100644 index 0000000000..bf5308a136 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.hu.js @@ -0,0 +1,16 @@ +/** + * Hungarian translation for bootstrap-datepicker + * Sotus László + */ +;(function($){ + $.fn.datepicker.dates['hu'] = { + days: ["Vasárnap", "Hétfő", "Kedd", "Szerda", "Csütörtök", "Péntek", "Szombat", "Vasárnap"], + daysShort: ["Vas", "Hét", "Ked", "Sze", "Csü", "Pén", "Szo", "Vas"], + daysMin: ["Va", "Hé", "Ke", "Sz", "Cs", "Pé", "Sz", "Va"], + months: ["Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December"], + monthsShort: ["Jan", "Feb", "Már", "Ápr", "Máj", "Jún", "Júl", "Aug", "Sze", "Okt", "Nov", "Dec"], + today: "Ma", + weekStart: 1, + format: "yyyy.mm.dd" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.id.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.id.js new file mode 100644 index 0000000000..d48aa4813d --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.id.js @@ -0,0 +1,13 @@ +/** + * Bahasa translation for bootstrap-datepicker + * Azwar Akbar + */ +;(function($){ + $.fn.datepicker.dates['id'] = { + days: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu"], + daysShort: ["Mgu", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab", "Mgu"], + daysMin: ["Mg", "Sn", "Sl", "Ra", "Ka", "Ju", "Sa", "Mg"], + months: ["Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"], + monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Ags", "Sep", "Okt", "Nov", "Des"] + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.is.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.is.js new file mode 100644 index 0000000000..0e57a91681 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.is.js @@ -0,0 +1,14 @@ +/** + * Icelandic translation for bootstrap-datepicker + * Hinrik Örn Sigurðsson + */ +;(function($){ + $.fn.datepicker.dates['is'] = { + days: ["Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur", "Sunnudagur"], + daysShort: ["Sun", "Mán", "Þri", "Mið", "Fim", "Fös", "Lau", "Sun"], + daysMin: ["Su", "Má", "Þr", "Mi", "Fi", "Fö", "La", "Su"], + months: ["Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember"], + monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maí", "Jún", "Júl", "Ágú", "Sep", "Okt", "Nóv", "Des"], + today: "Í Dag" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.it.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.it.js new file mode 100644 index 0000000000..8209f2a2b7 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.it.js @@ -0,0 +1,16 @@ +/** + * Italian translation for bootstrap-datepicker + * Enrico Rubboli + */ +;(function($){ + $.fn.datepicker.dates['it'] = { + days: ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato", "Domenica"], + daysShort: ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab", "Dom"], + daysMin: ["Do", "Lu", "Ma", "Me", "Gi", "Ve", "Sa", "Do"], + months: ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"], + monthsShort: ["Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"], + today: "Oggi", + weekStart: 1, + format: "dd/mm/yyyy" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.ja.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.ja.js new file mode 100644 index 0000000000..ed0bc0f9db --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.ja.js @@ -0,0 +1,15 @@ +/** + * Japanese translation for bootstrap-datepicker + * Norio Suzuki + */ +;(function($){ + $.fn.datepicker.dates['ja'] = { + days: ["日曜", "月曜", "火曜", "水曜", "木曜", "金曜", "土曜", "日曜"], + daysShort: ["日", "月", "火", "水", "木", "金", "土", "日"], + daysMin: ["日", "月", "火", "水", "木", "金", "土", "日"], + months: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], + monthsShort: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], + today: "今日", + format: "yyyy/mm/dd" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.kr.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.kr.js new file mode 100644 index 0000000000..183a88d159 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.kr.js @@ -0,0 +1,13 @@ +/** + * Korean translation for bootstrap-datepicker + * Gu Youn + */ +;(function($){ + $.fn.datepicker.dates['kr'] = { + days: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일", "일요일"], + daysShort: ["일", "월", "화", "수", "목", "금", "토", "일"], + daysMin: ["일", "월", "화", "수", "목", "금", "토", "일"], + months: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"], + monthsShort: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"] + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.lt.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.lt.js new file mode 100644 index 0000000000..11c1b3ad41 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.lt.js @@ -0,0 +1,16 @@ +/** + * Lithuanian translation for bootstrap-datepicker + * Šarūnas Gliebus + */ + +;(function($){ + $.fn.datepicker.dates['lt'] = { + days: ["Sekmadienis", "Pirmadienis", "Antradienis", "Trečiadienis", "Ketvirtadienis", "Penktadienis", "Šeštadienis", "Sekmadienis"], + daysShort: ["S", "Pr", "A", "T", "K", "Pn", "Š", "S"], + daysMin: ["Sk", "Pr", "An", "Tr", "Ke", "Pn", "Št", "Sk"], + months: ["Sausis", "Vasaris", "Kovas", "Balandis", "Gegužė", "Birželis", "Liepa", "Rugpjūtis", "Rugsėjis", "Spalis", "Lapkritis", "Gruodis"], + monthsShort: ["Sau", "Vas", "Kov", "Bal", "Geg", "Bir", "Lie", "Rugp", "Rugs", "Spa", "Lap", "Gru"], + today: "Šiandien", + weekStart: 1 + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.lv.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.lv.js new file mode 100644 index 0000000000..cc75fe0bf7 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.lv.js @@ -0,0 +1,16 @@ +/** + * Latvian translation for bootstrap-datepicker + * Artis Avotins + */ + +;(function($){ + $.fn.datepicker.dates['lv'] = { + days: ["Svētdiena", "Pirmdiena", "Otrdiena", "Trešdiena", "Ceturtdiena", "Piektdiena", "Sestdiena", "Svētdiena"], + daysShort: ["Sv", "P", "O", "T", "C", "Pk", "S", "Sv"], + daysMin: ["Sv", "Pr", "Ot", "Tr", "Ce", "Pk", "St", "Sv"], + months: ["Janvāris", "Februāris", "Marts", "Aprīlis", "Maijs", "Jūnijs", "Jūlijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris"], + monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mai", "Jūn", "Jūl", "Aug", "Sep", "Okt", "Nov", "Dec."], + today: "Šodien", + weekStart: 1 + }; +}(jQuery)); \ No newline at end of file diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.ms.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.ms.js new file mode 100644 index 0000000000..fa3a21a54d --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.ms.js @@ -0,0 +1,14 @@ +/** + * Malay translation for bootstrap-datepicker + * Ateman Faiz + */ +;(function($){ + $.fn.datepicker.dates['ms'] = { + days: ["Ahad", "Isnin", "Selasa", "Rabu", "Khamis", "Jumaat", "Sabtu", "Ahad"], + daysShort: ["Aha", "Isn", "Sel", "Rab", "Kha", "Jum", "Sab", "Aha"], + daysMin: ["Ah", "Is", "Se", "Ra", "Kh", "Ju", "Sa", "Ah"], + months: ["Januari", "Februari", "Mac", "April", "Mei", "Jun", "Julai", "Ogos", "September", "Oktober", "November", "Disember"], + monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Ogo", "Sep", "Okt", "Nov", "Dis"], + today: "Hari Ini" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.nb.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.nb.js new file mode 100644 index 0000000000..fb9fe2a10b --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.nb.js @@ -0,0 +1,14 @@ +/** + * Norwegian (bokmål) translation for bootstrap-datepicker + * Fredrik Sundmyhr + */ +;(function($){ + $.fn.datepicker.dates['nb'] = { + days: ["Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"], + daysShort: ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør", "Søn"], + daysMin: ["Sø", "Ma", "Ti", "On", "To", "Fr", "Lø", "Sø"], + months: ["Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"], + monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Des"], + today: "I Dag" + }; +}(jQuery)); \ No newline at end of file diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.nl.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.nl.js new file mode 100644 index 0000000000..13a2f1a358 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.nl.js @@ -0,0 +1,14 @@ +/** + * Dutch translation for bootstrap-datepicker + * Reinier Goltstein + */ +;(function($){ + $.fn.datepicker.dates['nl'] = { + days: ["Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag", "Zondag"], + daysShort: ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za", "Zo"], + daysMin: ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za", "Zo"], + months: ["Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "December"], + monthsShort: ["Jan", "Feb", "Mrt", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"], + today: "Vandaag" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.pl.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.pl.js new file mode 100644 index 0000000000..f3fff8c8ff --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.pl.js @@ -0,0 +1,15 @@ +/** + * Polish translation for bootstrap-datepicker + * Robert + */ +;(function($){ + $.fn.datepicker.dates['pl'] = { + days: ["Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota", "Niedziela"], + daysShort: ["Nie", "Pn", "Wt", "Śr", "Czw", "Pt", "So", "Nie"], + daysMin: ["N", "Pn", "Wt", "Śr", "Cz", "Pt", "So", "N"], + months: ["Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień"], + monthsShort: ["Sty", "Lu", "Mar", "Kw", "Maj", "Cze", "Lip", "Sie", "Wrz", "Pa", "Lis", "Gru"], + today: "Dzisiaj", + weekStart: 1 + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.pt-BR.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.pt-BR.js new file mode 100644 index 0000000000..8d1fc27789 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.pt-BR.js @@ -0,0 +1,14 @@ +/** + * Brazilian translation for bootstrap-datepicker + * Cauan Cabral + */ +;(function($){ + $.fn.datepicker.dates['pt-BR'] = { + days: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado", "Domingo"], + daysShort: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb", "Dom"], + daysMin: ["Do", "Se", "Te", "Qu", "Qu", "Se", "Sa", "Do"], + months: ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"], + monthsShort: ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"], + today: "Hoje" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.pt.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.pt.js new file mode 100644 index 0000000000..64179e8fcb --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.pt.js @@ -0,0 +1,14 @@ +/** + * Portuguese translation for bootstrap-datepicker + * Original code: Cauan Cabral + * Tiago Melo + */ +;(function($){ + $.fn.datepicker.dates['pt'] = { + days: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado", "Domingo"], + daysShort: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb", "Dom"], + daysMin: ["Do", "Se", "Te", "Qu", "Qu", "Se", "Sa", "Do"], + months: ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"], + monthsShort: ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"] + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.ro.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.ro.js new file mode 100644 index 0000000000..03c1a47216 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.ro.js @@ -0,0 +1,15 @@ +/** + * Romanian translation for bootstrap-datepicker + * Cristian Vasile + */ +;(function($){ + $.fn.datepicker.dates['ro'] = { + days: ["Duminică", "Luni", "Marţi", "Miercuri", "Joi", "Vineri", "Sâmbătă", "Duminică"], + daysShort: ["Dum", "Lun", "Mar", "Mie", "Joi", "Vin", "Sâm", "Dum"], + daysMin: ["Du", "Lu", "Ma", "Mi", "Jo", "Vi", "Sâ", "Du"], + months: ["Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"], + monthsShort: ["Ian", "Feb", "Mar", "Apr", "Mai", "Iun", "Iul", "Aug", "Sep", "Oct", "Nov", "Dec"], + today: "Astăzi", + weekStart: 1 + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.rs-latin.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.rs-latin.js new file mode 100644 index 0000000000..1e0523d7aa --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.rs-latin.js @@ -0,0 +1,14 @@ +/** + * Serbian latin translation for bootstrap-datepicker + * Bojan Milosavlević + */ +;(function($){ + $.fn.datepicker.dates['rs'] = { + days: ["Nedelja","Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota", "Nedelja"], + daysShort: ["Ned", "Pon", "Uto", "Sre", "Čet", "Pet", "Sub", "Ned"], + daysMin: ["N", "Po", "U", "Sr", "Č", "Pe", "Su", "N"], + months: ["Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"], + monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Avg", "Sep", "Okt", "Nov", "Dec"], + today: "Danas" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.rs.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.rs.js new file mode 100644 index 0000000000..6b65747332 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.rs.js @@ -0,0 +1,14 @@ +/** + * Serbian cyrillic translation for bootstrap-datepicker + * Bojan Milosavlević + */ +;(function($){ + $.fn.datepicker.dates['rs'] = { + days: ["Недеља","Понедељак", "Уторак", "Среда", "Четвртак", "Петак", "Субота", "Недеља"], + daysShort: ["Нед", "Пон", "Уто", "Сре", "Чет", "Пет", "Суб", "Нед"], + daysMin: ["Н", "По", "У", "Ср", "Ч", "Пе", "Су", "Н"], + months: ["Јануар", "Фебруар", "Март", "Април", "Мај", "Јун", "Јул", "Август", "Септембар", "Октобар", "Новембар", "Децембар"], + monthsShort: ["Јан", "Феб", "Мар", "Апр", "Мај", "Јун", "Јул", "Авг", "Сеп", "Окт", "Нов", "Дец"], + today: "Данас" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.ru.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.ru.js new file mode 100644 index 0000000000..9404cfff41 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.ru.js @@ -0,0 +1,14 @@ +/** + * Russian translation for bootstrap-datepicker + * Victor Taranenko + */ +;(function($){ + $.fn.datepicker.dates['ru'] = { + days: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота", "Воскресенье"], + daysShort: ["Вск", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Суб", "Вск"], + daysMin: ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"], + months: ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"], + monthsShort: ["Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек"], + today: "Сегодня" + }; +}(jQuery)); \ No newline at end of file diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.sk.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.sk.js new file mode 100644 index 0000000000..c48032a562 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.sk.js @@ -0,0 +1,15 @@ +/** + * Slovak translation for bootstrap-datepicker + * Marek Lichtner + * Fixes by Michal Remiš + */ +;(function($){ + $.fn.datepicker.dates["sk"] = { + days: ["Nedeľa", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatok", "Sobota", "Nedeľa"], + daysShort: ["Ned", "Pon", "Uto", "Str", "Štv", "Pia", "Sob", "Ned"], + daysMin: ["Ne", "Po", "Ut", "St", "Št", "Pia", "So", "Ne"], + months: ["Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"], + monthsShort: ["Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec"], + today: "Dnes" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.sl.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.sl.js new file mode 100644 index 0000000000..41b0e06033 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.sl.js @@ -0,0 +1,14 @@ +/** + * Slovene translation for bootstrap-datepicker + * Gregor Rudolf + */ +;(function($){ + $.fn.datepicker.dates['sl'] = { + days: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Četrtek", "Petek", "Sobota", "Nedelja"], + daysShort: ["Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob", "Ned"], + daysMin: ["Ne", "Po", "To", "Sr", "Če", "Pe", "So", "Ne"], + months: ["Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December"], + monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Avg", "Sep", "Okt", "Nov", "Dec"], + today: "Danes" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.sv.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.sv.js new file mode 100644 index 0000000000..5cb1d0ce34 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.sv.js @@ -0,0 +1,14 @@ +/** + * Swedish translation for bootstrap-datepicker + * Patrik Ragnarsson + */ +;(function($){ + $.fn.datepicker.dates['sv'] = { + days: ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag", "Söndag"], + daysShort: ["Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör", "Sön"], + daysMin: ["Sö", "Må", "Ti", "On", "To", "Fr", "Lö", "Sö"], + months: ["Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"], + monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"], + today: "I Dag" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.sw.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.sw.js new file mode 100644 index 0000000000..622e0ef0d7 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.sw.js @@ -0,0 +1,15 @@ +/** + * Swahili translation for bootstrap-datepicker + * Edwin Mugendi + * Source: http://scriptsource.org/cms/scripts/page.php?item_id=entry_detail&uid=xnfaqyzcku + */ +;(function($){ + $.fn.datepicker.dates['sw'] = { + days: ["Jumapili", "Jumatatu", "Jumanne", "Jumatano", "Alhamisi", "Ijumaa", "Jumamosi", "Jumapili"], + daysShort: ["J2", "J3", "J4", "J5", "Alh", "Ij", "J1", "J2"], + daysMin: ["2", "3", "4", "5", "A", "I", "1", "2"], + months: ["Januari", "Februari", "Machi", "Aprili", "Mei", "Juni", "Julai", "Agosti", "Septemba", "Oktoba", "Novemba", "Desemba"], + monthsShort: ["Jan", "Feb", "Mac", "Apr", "Mei", "Jun", "Jul", "Ago", "Sep", "Okt", "Nov", "Des"], + today: "Leo" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.th.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.th.js new file mode 100644 index 0000000000..562b063c50 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.th.js @@ -0,0 +1,14 @@ +/** + * Thai translation for bootstrap-datepicker + * Suchau Jiraprapot + */ +;(function($){ + $.fn.datepicker.dates['th'] = { + days: ["อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัส", "ศุกร์", "เสาร์", "อาทิตย์"], + daysShort: ["อา", "จ", "อ", "พ", "พฤ", "ศ", "ส", "อา"], + daysMin: ["อา", "จ", "อ", "พ", "พฤ", "ศ", "ส", "อา"], + months: ["มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"], + monthsShort: ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."], + today: "วันนี้" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.tr.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.tr.js new file mode 100644 index 0000000000..e46eced9f4 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.tr.js @@ -0,0 +1,15 @@ +/** + * Turkish translation for bootstrap-datepicker + * Serkan Algur + */ +;(function($){ + $.fn.datepicker.dates['tr'] = { + days: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi", "Pazar"], + daysShort: ["Pz", "Pzt", "Sal", "Çrş", "Prş", "Cu", "Cts", "Pz"], + daysMin: ["Pz", "Pzt", "Sa", "Çr", "Pr", "Cu", "Ct", "Pz"], + months: ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"], + monthsShort: ["Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara"], + today: "Bugün" + }; +}(jQuery)); + diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.uk.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.uk.js new file mode 100644 index 0000000000..bbd0c73dfa --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.uk.js @@ -0,0 +1,14 @@ +/** + * Ukrainian translation for bootstrap-datepicker + * Andrey Vityuk + */ +;(function($){ + $.fn.datepicker.dates['uk'] = { + days: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота", "Неділя"], + daysShort: ["Нед", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Суб", "Нед"], + daysMin: ["Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Нд"], + months: ["Січень", "Лютий", "Березень", "Квітень", "Травень", "Червень", "Липень", "Серпень", "Вересень", "Жовтень", "Листопад", "Грудень"], + monthsShort: ["Січ", "Лют", "Бер", "Кві", "Тра", "Чер", "Лип", "Сер", "Вер", "Жов", "Лис", "Гру"], + today: "Сьогодні" + }; +}(jQuery)); \ No newline at end of file diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-CN.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-CN.js new file mode 100644 index 0000000000..7cdcd03d04 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-CN.js @@ -0,0 +1,14 @@ +/** + * Simplified Chinese translation for bootstrap-datepicker + * Yuan Cheung + */ +;(function($){ + $.fn.datepicker.dates['zh-CN'] = { + days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"], + daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"], + daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"], + months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], + monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], + today: "今日" + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-TW.js b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-TW.js new file mode 100644 index 0000000000..d21afc1289 --- /dev/null +++ b/public/bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-TW.js @@ -0,0 +1,13 @@ +/** + * Traditional Chinese translation for bootstrap-datepicker + * Rung-Sheng Jang + */ +;(function($){ + $.fn.datepicker.dates['zh-TW'] = { + days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"], + daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"], + daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"], + months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], + monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"] + }; +}(jQuery)); diff --git a/public/bootstrap-datepicker/less/datepicker.less b/public/bootstrap-datepicker/less/datepicker.less new file mode 100644 index 0000000000..bebe0b1147 --- /dev/null +++ b/public/bootstrap-datepicker/less/datepicker.less @@ -0,0 +1,181 @@ +/*! + * Datepicker for Bootstrap + * + * Copyright 2012 Stefan Petre + * Improvements by Andrew Rowls + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ + +.datepicker { + padding: 4px; + margin-top: 1px; + .border-radius(4px); + &-inline { + width: 220px; + } + direction: ltr; + &&-rtl { + direction: rtl; + table tr td span { + float: right; + } + } + &-dropdown { + top: 0; + left: 0; + &: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: 6px; + } + &: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: 7px; + } + } + >div { + display: none; + } + &.days div.datepicker-days { + display: block; + } + &.months div.datepicker-months { + display: block; + } + &.years div.datepicker-years { + display: block; + } + table{ + margin: 0; + } + td, + th{ + text-align: center; + width: 20px; + height: 20px; + .border-radius(4px); + + border: none; + } + // Inline display inside a table presents some problems with + // border and background colors. + .table-striped & table tr { + td, th { + background-color:transparent; + } + } + table tr td { + &.day:hover { + background: @grayLighter; + cursor: pointer; + } + &.old, + &.new { + color: @grayLight; + } + &.disabled, + &.disabled:hover { + background: none; + color: @grayLight; + cursor: default; + } + &.today, + &.today:hover, + &.today.disabled, + &.today.disabled:hover { + @todayBackground: lighten(@orange, 30%); + .buttonBackground(@todayBackground, spin(@todayBackground, 20)); + color: #000 !important; + } + &.active, + &.active:hover, + &.active.disabled, + &.active.disabled:hover { + .buttonBackground(@btnPrimaryBackground, spin(@btnPrimaryBackground, 20)); + color: #fff; + text-shadow: 0 -1px 0 rgba(0,0,0,.25); + } + span { + display: block; + width: 23%; + height: 54px; + line-height: 54px; + float: left; + margin: 1%; + cursor: pointer; + .border-radius(4px); + &:hover { + background: @grayLighter; + } + &.disabled, + &.disabled:hover { + background:none; + color: @grayLight; + cursor: default; + } + &.active, + &.active:hover, + &.active.disabled, + &.active.disabled:hover { + .buttonBackground(@btnPrimaryBackground, spin(@btnPrimaryBackground, 20)); + color: #fff; + text-shadow: 0 -1px 0 rgba(0,0,0,.25); + } + &.old { + color: @grayLight; + } + } + } + + th.switch { + width: 145px; + } + + thead tr:first-child th, + tfoot tr:first-child th { + cursor: pointer; + &:hover{ + background: @grayLighter; + } + } + /*.dow { + border-top: 1px solid #ddd !important; + }*/ + + // Basic styling for calendar-week cells + .cw { + font-size: 10px; + width: 12px; + padding: 0 2px 0 5px; + vertical-align: middle; + } + thead tr:first-child th.cw { + cursor: default; + background-color: transparent; + } +} +.input-append, +.input-prepend { + &.date { + .add-on i { + display: block; + cursor: pointer; + width: 16px; + height: 16px; + } + } +} diff --git a/public/bootstrap-datepicker/tests/README.md b/public/bootstrap-datepicker/tests/README.md new file mode 100644 index 0000000000..6f48f2bdda --- /dev/null +++ b/public/bootstrap-datepicker/tests/README.md @@ -0,0 +1,55 @@ +Unit tests, written with [QUnit](http://docs.jquery.com/QUnit), are used to +expose bugs for squashing, prevent bugs from respawning, and suppress new +bugs when adding new features and making changes. + +# Running the tests + +The simplest way to run the tests is to open `tests/tests.html` in your browser. +The test suites will automatically run themselves and present their results. + +To run the tests from the command line, download and install +[PhantomJS](http://phantomjs.org/), and run `run-qunit.js` with it: + + $ cd tests/ + $ phantomjs run-qunit.js tests.html + +Failed tests and their failed assertions will be printed to the console. A +results summary will be printed at the end. + +To generate coverage statistics, use [JSCoverage](http://siliconforks.com/jscoverage/) +to instrument the js files: + + $ cd tests/ + $ jscoverage ../js/ ../instrumented/ + $ phantomjs run-qunit.js tests.html + +Coverage percentage will be included in the output summary, and a highlighted +line-by-line html file will be generated. + +# Shout-out + +Thanks to Rod @ While One Fork for the +[CIS guide](http://whileonefork.blogspot.com/2011/10/integrating-javascript-tests-into-cli.html) +on putting the above together. + +# Adding tests + +Tests go in js files in the `tests/suites/` directory tree. QUnit organizes +tests into suites called "modules"; there is one module per js file. If the +tests you are adding do not fit into an existing module, create a new one at +`tests/suites/.js`, where `` is a broad yet +descriptive name for the suite. If tests have many year-specific cases (ie, +behave differently in leap years vs normal years, or have specific buggy +behavior in a certain year), create the module in a new directory, +`tests/suites//.js`, where `` is the decriptive +name and `` is the four-digit year the tests pertain to. + +In order for new tests to be run, they must be imported into `tests/tests.html`. +Find the script includes headed by the html comment ``, and +add a new one to the list which includes the new js files. + +# Can I use this? + +By all means, please do! Just note that I stopped working on this structure +once it fit my needs, there's no real support for it, and it may change in the +future. Otherwise, have at it. diff --git a/public/bootstrap-datepicker/tests/_coverage.html b/public/bootstrap-datepicker/tests/_coverage.html new file mode 100644 index 0000000000..33d838de0e --- /dev/null +++ b/public/bootstrap-datepicker/tests/_coverage.html @@ -0,0 +1,26 @@ + + + + + + + +COLORIZED_LINE_HTML + + + + diff --git a/public/bootstrap-datepicker/tests/assets/coverage.js b/public/bootstrap-datepicker/tests/assets/coverage.js new file mode 100644 index 0000000000..2e5704bc83 --- /dev/null +++ b/public/bootstrap-datepicker/tests/assets/coverage.js @@ -0,0 +1,48 @@ +(function(){ + //we want this at global scope so outside callers can find it. In a more realistic implementation we + //should probably put it in a namespace. + window.getCoverageByLine = function(silent) { + var key = null; + var lines = null; + var source = null; + //look for code coverage data + if (typeof window._$jscoverage === 'object') { + for (key in _$jscoverage) {} + lines = _$jscoverage[key]; + } + + if (!lines && !silent) { + console.log('code coverage data is NOT available'); + } + + return { 'key': key, 'lines': lines }; + }; + + QUnit.done = function(t) { + var cvgInfo = getCoverageByLine(true); + if (!!cvgInfo.key) { + var testableLines = 0; + var testedLines = 0; + var untestableLines = 0; + for (lineIdx in cvgInfo.lines) { + var cvg = cvgInfo.lines[lineIdx]; + if (typeof cvg === 'number') { + testableLines += 1; + if (cvg > 0) { + testedLines += 1; + } + } else { + untestableLines += 1; + } + } + var coverage = '' + Math.floor(100 * testedLines / testableLines) + '%'; + + var result = document.getElementById('qunit-testresult'); + if (result != null) { + result.innerHTML = result.innerHTML + ' ' + coverage + ' test coverage of ' + cvgInfo.key; + } else { + console.log('can\'t find test-result element to update'); + } + } + }; +}()); \ No newline at end of file diff --git a/public/bootstrap-datepicker/tests/assets/jquery-1.7.1.min.js b/public/bootstrap-datepicker/tests/assets/jquery-1.7.1.min.js new file mode 100644 index 0000000000..198b3ff07d --- /dev/null +++ b/public/bootstrap-datepicker/tests/assets/jquery-1.7.1.min.js @@ -0,0 +1,4 @@ +/*! jQuery v1.7.1 jquery.com | jquery.org/license */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
"+""+"
",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
t
",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; +f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() +{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/public/bootstrap-datepicker/tests/assets/mock.js b/public/bootstrap-datepicker/tests/assets/mock.js new file mode 100644 index 0000000000..b1d1340038 --- /dev/null +++ b/public/bootstrap-datepicker/tests/assets/mock.js @@ -0,0 +1,26 @@ +;(function(){ + +window.patch_date = function patch(f){ + var NativeDate = window.Date; + var date = function date(y,m,d,h,i,s,j){ + switch(arguments.length){ + case 0: return date.now ? new NativeDate(date.now) : new NativeDate(); + case 1: return new NativeDate(y); + case 2: return new NativeDate(y,m); + case 3: return new NativeDate(y,m,d); + case 4: return new NativeDate(y,m,d,h); + case 5: return new NativeDate(y,m,d,h,i); + case 6: return new NativeDate(y,m,d,h,i,s); + case 7: return new NativeDate(y,y,m,d,h,i,s,j); + } + }; + date.UTC = NativeDate.UTC; + return function(){ + Array.prototype.push.call(arguments, date); + window.Date = date; + res = f.apply(this, arguments); + window.Date = NativeDate; + } +} + +}()); \ No newline at end of file diff --git a/public/bootstrap-datepicker/tests/assets/qunit-logging.js b/public/bootstrap-datepicker/tests/assets/qunit-logging.js new file mode 100644 index 0000000000..5bef1a5246 --- /dev/null +++ b/public/bootstrap-datepicker/tests/assets/qunit-logging.js @@ -0,0 +1,29 @@ +// Dummy logging calls (ie, if tests are run in IE) +window.console = window.console || {}; +window.console.log = window.console.log || function(){}; +window.console.debug = window.console.debug || function(){}; +window.console.info = window.console.info || function(){}; +window.console.warn = window.console.warn || function(){}; +window.console.error = window.console.error || function(){}; + +(function() { + var modName, testName; + + //arg: { name } + QUnit.testStart = function(t) { + modName = t.module; + testName = t.name; + }; + + //arg: { name, failed, passed, total } + QUnit.testDone = function(t) { + if (t.failed) + console.log('Test "' + t.module + ': ' + t.name + '" completed: ' + (0 === t.failed ? 'pass' : 'FAIL') + '\n') + }; + + //{ result, actual, expected, message } + QUnit.log = function(t) { + if (!t.result) + console.log('Test "' + modName + ': ' + testName + '" assertion failed. Expected <' + t.expected + '> Actual <' + t.actual + '>' + (t.message ? ': \'' + t.message + '\'' : '')); + }; +}()); diff --git a/public/bootstrap-datepicker/tests/assets/qunit.css b/public/bootstrap-datepicker/tests/assets/qunit.css new file mode 100644 index 0000000000..b948bae1c4 --- /dev/null +++ b/public/bootstrap-datepicker/tests/assets/qunit.css @@ -0,0 +1,235 @@ +/** + * QUnit v1.5.0 - A JavaScript Unit Testing Framework + * + * http://docs.jquery.com/QUnit + * + * Copyright (c) 2012 John Resig, Jörn Zaefferer + * Dual licensed under the MIT (MIT-LICENSE.txt) + * or GPL (GPL-LICENSE.txt) licenses. + */ + +/** Font Family and Sizes */ + +#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult { + font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; +} + +#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } +#qunit-tests { font-size: smaller; } + + +/** Resets */ + +#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult { + margin: 0; + padding: 0; +} + + +/** Header */ + +#qunit-header { + padding: 0.5em 0 0.5em 1em; + + color: #8699a4; + background-color: #0d3349; + + font-size: 1.5em; + line-height: 1em; + font-weight: normal; + + border-radius: 15px 15px 0 0; + -moz-border-radius: 15px 15px 0 0; + -webkit-border-top-right-radius: 15px; + -webkit-border-top-left-radius: 15px; +} + +#qunit-header a { + text-decoration: none; + color: #c2ccd1; +} + +#qunit-header a:hover, +#qunit-header a:focus { + color: #fff; +} + +#qunit-header label { + display: inline-block; +} + +#qunit-banner { + height: 5px; +} + +#qunit-testrunner-toolbar { + padding: 0.5em 0 0.5em 2em; + color: #5E740B; + background-color: #eee; +} + +#qunit-userAgent { + padding: 0.5em 0 0.5em 2.5em; + background-color: #2b81af; + color: #fff; + text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; +} + + +/** Tests: Pass/Fail */ + +#qunit-tests { + list-style-position: inside; +} + +#qunit-tests li { + padding: 0.4em 0.5em 0.4em 2.5em; + border-bottom: 1px solid #fff; + list-style-position: inside; +} + +#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running { + display: none; +} + +#qunit-tests li strong { + cursor: pointer; +} + +#qunit-tests li a { + padding: 0.5em; + color: #c2ccd1; + text-decoration: none; +} +#qunit-tests li a:hover, +#qunit-tests li a:focus { + color: #000; +} + +#qunit-tests ol { + margin-top: 0.5em; + padding: 0.5em; + + background-color: #fff; + + border-radius: 15px; + -moz-border-radius: 15px; + -webkit-border-radius: 15px; + + box-shadow: inset 0px 2px 13px #999; + -moz-box-shadow: inset 0px 2px 13px #999; + -webkit-box-shadow: inset 0px 2px 13px #999; +} + +#qunit-tests table { + border-collapse: collapse; + margin-top: .2em; +} + +#qunit-tests th { + text-align: right; + vertical-align: top; + padding: 0 .5em 0 0; +} + +#qunit-tests td { + vertical-align: top; +} + +#qunit-tests pre { + margin: 0; + white-space: pre-wrap; + word-wrap: break-word; +} + +#qunit-tests del { + background-color: #e0f2be; + color: #374e0c; + text-decoration: none; +} + +#qunit-tests ins { + background-color: #ffcaca; + color: #500; + text-decoration: none; +} + +/*** Test Counts */ + +#qunit-tests b.counts { color: black; } +#qunit-tests b.passed { color: #5E740B; } +#qunit-tests b.failed { color: #710909; } + +#qunit-tests li li { + margin: 0.5em; + padding: 0.4em 0.5em 0.4em 0.5em; + background-color: #fff; + border-bottom: none; + list-style-position: inside; +} + +/*** Passing Styles */ + +#qunit-tests li li.pass { + color: #5E740B; + background-color: #fff; + border-left: 26px solid #C6E746; +} + +#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; } +#qunit-tests .pass .test-name { color: #366097; } + +#qunit-tests .pass .test-actual, +#qunit-tests .pass .test-expected { color: #999999; } + +#qunit-banner.qunit-pass { background-color: #C6E746; } + +/*** Failing Styles */ + +#qunit-tests li li.fail { + color: #710909; + background-color: #fff; + border-left: 26px solid #EE5757; + white-space: pre; +} + +#qunit-tests > li:last-child { + border-radius: 0 0 15px 15px; + -moz-border-radius: 0 0 15px 15px; + -webkit-border-bottom-right-radius: 15px; + -webkit-border-bottom-left-radius: 15px; +} + +#qunit-tests .fail { color: #000000; background-color: #EE5757; } +#qunit-tests .fail .test-name, +#qunit-tests .fail .module-name { color: #000000; } + +#qunit-tests .fail .test-actual { color: #EE5757; } +#qunit-tests .fail .test-expected { color: green; } + +#qunit-banner.qunit-fail { background-color: #EE5757; } + + +/** Result */ + +#qunit-testresult { + padding: 0.5em 0.5em 0.5em 2.5em; + + color: #2b81af; + background-color: #D2E0E6; + + border-bottom: 1px solid white; +} +#qunit-testresult .module-name { + font-weight: bold; +} + +/** Fixture */ + +#qunit-fixture { + position: absolute; + top: -10000px; + left: -10000px; + width: 1000px; + height: 1000px; +} diff --git a/public/bootstrap-datepicker/tests/assets/qunit.js b/public/bootstrap-datepicker/tests/assets/qunit.js new file mode 100644 index 0000000000..66dd721542 --- /dev/null +++ b/public/bootstrap-datepicker/tests/assets/qunit.js @@ -0,0 +1,1669 @@ +/** + * QUnit v1.5.0 - A JavaScript Unit Testing Framework + * + * http://docs.jquery.com/QUnit + * + * Copyright (c) 2012 John Resig, Jörn Zaefferer + * Dual licensed under the MIT (MIT-LICENSE.txt) + * or GPL (GPL-LICENSE.txt) licenses. + */ + +(function(window) { + +var defined = { + setTimeout: typeof window.setTimeout !== "undefined", + sessionStorage: (function() { + var x = "qunit-test-string"; + try { + sessionStorage.setItem(x, x); + sessionStorage.removeItem(x); + return true; + } catch(e) { + return false; + } + }()) +}; + +var testId = 0, + toString = Object.prototype.toString, + hasOwn = Object.prototype.hasOwnProperty; + +var Test = function(name, testName, expected, async, callback) { + this.name = name; + this.testName = testName; + this.expected = expected; + this.async = async; + this.callback = callback; + this.assertions = []; +}; +Test.prototype = { + init: function() { + var tests = id("qunit-tests"); + if (tests) { + var b = document.createElement("strong"); + b.innerHTML = "Running " + this.name; + var li = document.createElement("li"); + li.appendChild( b ); + li.className = "running"; + li.id = this.id = "test-output" + testId++; + tests.appendChild( li ); + } + }, + setup: function() { + if (this.module != config.previousModule) { + if ( config.previousModule ) { + runLoggingCallbacks('moduleDone', QUnit, { + name: config.previousModule, + failed: config.moduleStats.bad, + passed: config.moduleStats.all - config.moduleStats.bad, + total: config.moduleStats.all + } ); + } + config.previousModule = this.module; + config.moduleStats = { all: 0, bad: 0 }; + runLoggingCallbacks( 'moduleStart', QUnit, { + name: this.module + } ); + } else if (config.autorun) { + runLoggingCallbacks( 'moduleStart', QUnit, { + name: this.module + } ); + } + + config.current = this; + this.testEnvironment = extend({ + setup: function() {}, + teardown: function() {} + }, this.moduleTestEnvironment); + + runLoggingCallbacks( 'testStart', QUnit, { + name: this.testName, + module: this.module + }); + + // allow utility functions to access the current test environment + // TODO why?? + QUnit.current_testEnvironment = this.testEnvironment; + + if ( !config.pollution ) { + saveGlobal(); + } + if ( config.notrycatch ) { + this.testEnvironment.setup.call(this.testEnvironment); + return; + } + try { + this.testEnvironment.setup.call(this.testEnvironment); + } catch(e) { + QUnit.pushFailure( "Setup failed on " + this.testName + ": " + e.message, extractStacktrace( e, 1 ) ); + } + }, + run: function() { + config.current = this; + + var running = id("qunit-testresult"); + + if ( running ) { + running.innerHTML = "Running:
" + this.name; + } + + if ( this.async ) { + QUnit.stop(); + } + + if ( config.notrycatch ) { + this.callback.call(this.testEnvironment); + return; + } + try { + this.callback.call(this.testEnvironment); + } catch(e) { + QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + ": " + e.message, extractStacktrace( e, 1 ) ); + // else next test will carry the responsibility + saveGlobal(); + + // Restart the tests if they're blocking + if ( config.blocking ) { + QUnit.start(); + } + } + }, + teardown: function() { + config.current = this; + if ( config.notrycatch ) { + this.testEnvironment.teardown.call(this.testEnvironment); + return; + } else { + try { + this.testEnvironment.teardown.call(this.testEnvironment); + } catch(e) { + QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + e.message, extractStacktrace( e, 1 ) ); + } + } + checkPollution(); + }, + finish: function() { + config.current = this; + if ( this.expected != null && this.expected != this.assertions.length ) { + QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" ); + } else if ( this.expected == null && !this.assertions.length ) { + QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions." ); + } + + var good = 0, bad = 0, + li, i, + tests = id("qunit-tests"); + + config.stats.all += this.assertions.length; + config.moduleStats.all += this.assertions.length; + + if ( tests ) { + var ol = document.createElement("ol"); + + for ( i = 0; i < this.assertions.length; i++ ) { + var assertion = this.assertions[i]; + + li = document.createElement("li"); + li.className = assertion.result ? "pass" : "fail"; + li.innerHTML = assertion.message || (assertion.result ? "okay" : "failed"); + ol.appendChild( li ); + + if ( assertion.result ) { + good++; + } else { + bad++; + config.stats.bad++; + config.moduleStats.bad++; + } + } + + // store result when possible + if ( QUnit.config.reorder && defined.sessionStorage ) { + if (bad) { + sessionStorage.setItem("qunit-test-" + this.module + "-" + this.testName, bad); + } else { + sessionStorage.removeItem("qunit-test-" + this.module + "-" + this.testName); + } + } + + if (bad === 0) { + ol.style.display = "none"; + } + + var b = document.createElement("strong"); + b.innerHTML = this.name + " (" + bad + ", " + good + ", " + this.assertions.length + ")"; + + var a = document.createElement("a"); + a.innerHTML = "Rerun"; + a.href = QUnit.url({ filter: getText([b]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") }); + + addEvent(b, "click", function() { + var next = b.nextSibling.nextSibling, + display = next.style.display; + next.style.display = display === "none" ? "block" : "none"; + }); + + addEvent(b, "dblclick", function(e) { + var target = e && e.target ? e.target : window.event.srcElement; + if ( target.nodeName.toLowerCase() == "span" || target.nodeName.toLowerCase() == "b" ) { + target = target.parentNode; + } + if ( window.location && target.nodeName.toLowerCase() === "strong" ) { + window.location = QUnit.url({ filter: getText([target]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") }); + } + }); + + li = id(this.id); + li.className = bad ? "fail" : "pass"; + li.removeChild( li.firstChild ); + li.appendChild( b ); + li.appendChild( a ); + li.appendChild( ol ); + + } else { + for ( i = 0; i < this.assertions.length; i++ ) { + if ( !this.assertions[i].result ) { + bad++; + config.stats.bad++; + config.moduleStats.bad++; + } + } + } + + QUnit.reset(); + + runLoggingCallbacks( 'testDone', QUnit, { + name: this.testName, + module: this.module, + failed: bad, + passed: this.assertions.length - bad, + total: this.assertions.length + } ); + }, + + queue: function() { + var test = this; + synchronize(function() { + test.init(); + }); + function run() { + // each of these can by async + synchronize(function() { + test.setup(); + }); + synchronize(function() { + test.run(); + }); + synchronize(function() { + test.teardown(); + }); + synchronize(function() { + test.finish(); + }); + } + // defer when previous test run passed, if storage is available + var bad = QUnit.config.reorder && defined.sessionStorage && +sessionStorage.getItem("qunit-test-" + this.module + "-" + this.testName); + if (bad) { + run(); + } else { + synchronize(run, true); + } + } + +}; + +var QUnit = { + + // call on start of module test to prepend name to all tests + module: function(name, testEnvironment) { + config.currentModule = name; + config.currentModuleTestEnviroment = testEnvironment; + }, + + asyncTest: function(testName, expected, callback) { + if ( arguments.length === 2 ) { + callback = expected; + expected = null; + } + + QUnit.test(testName, expected, callback, true); + }, + + test: function(testName, expected, callback, async) { + var name = '' + escapeInnerText(testName) + ''; + + if ( arguments.length === 2 ) { + callback = expected; + expected = null; + } + + if ( config.currentModule ) { + name = '' + config.currentModule + ": " + name; + } + + if ( !validTest(config.currentModule + ": " + testName) ) { + return; + } + + var test = new Test(name, testName, expected, async, callback); + test.module = config.currentModule; + test.moduleTestEnvironment = config.currentModuleTestEnviroment; + test.queue(); + }, + + // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. + expect: function(asserts) { + config.current.expected = asserts; + }, + + // Asserts true. + // @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); + ok: function(result, msg) { + if (!config.current) { + throw new Error("ok() assertion outside test context, was " + sourceFromStacktrace(2)); + } + result = !!result; + var details = { + result: result, + message: msg + }; + msg = escapeInnerText(msg || (result ? "okay" : "failed")); + if ( !result ) { + var source = sourceFromStacktrace(2); + if (source) { + details.source = source; + msg += '
Source:
' + escapeInnerText(source) + '
'; + } + } + runLoggingCallbacks( 'log', QUnit, details ); + config.current.assertions.push({ + result: result, + message: msg + }); + }, + + // Checks that the first two arguments are equal, with an optional message. Prints out both actual and expected values. + // @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." ); + equal: function(actual, expected, message) { + QUnit.push(expected == actual, actual, expected, message); + }, + + notEqual: function(actual, expected, message) { + QUnit.push(expected != actual, actual, expected, message); + }, + + deepEqual: function(actual, expected, message) { + QUnit.push(QUnit.equiv(actual, expected), actual, expected, message); + }, + + notDeepEqual: function(actual, expected, message) { + QUnit.push(!QUnit.equiv(actual, expected), actual, expected, message); + }, + + strictEqual: function(actual, expected, message) { + QUnit.push(expected === actual, actual, expected, message); + }, + + notStrictEqual: function(actual, expected, message) { + QUnit.push(expected !== actual, actual, expected, message); + }, + + raises: function(block, expected, message) { + var actual, ok = false; + + if (typeof expected === 'string') { + message = expected; + expected = null; + } + + try { + block.call(config.current.testEnvironment); + } catch (e) { + actual = e; + } + + if (actual) { + // we don't want to validate thrown error + if (!expected) { + ok = true; + // expected is a regexp + } else if (QUnit.objectType(expected) === "regexp") { + ok = expected.test(actual); + // expected is a constructor + } else if (actual instanceof expected) { + ok = true; + // expected is a validation function which returns true is validation passed + } else if (expected.call({}, actual) === true) { + ok = true; + } + } + + QUnit.ok(ok, message); + }, + + start: function(count) { + config.semaphore -= count || 1; + if (config.semaphore > 0) { + // don't start until equal number of stop-calls + return; + } + if (config.semaphore < 0) { + // ignore if start is called more often then stop + config.semaphore = 0; + } + // A slight delay, to avoid any current callbacks + if ( defined.setTimeout ) { + window.setTimeout(function() { + if (config.semaphore > 0) { + return; + } + if ( config.timeout ) { + clearTimeout(config.timeout); + } + + config.blocking = false; + process(true); + }, 13); + } else { + config.blocking = false; + process(true); + } + }, + + stop: function(count) { + config.semaphore += count || 1; + config.blocking = true; + + if ( config.testTimeout && defined.setTimeout ) { + clearTimeout(config.timeout); + config.timeout = window.setTimeout(function() { + QUnit.ok( false, "Test timed out" ); + config.semaphore = 1; + QUnit.start(); + }, config.testTimeout); + } + } +}; + +//We want access to the constructor's prototype +(function() { + function F(){} + F.prototype = QUnit; + QUnit = new F(); + //Make F QUnit's constructor so that we can add to the prototype later + QUnit.constructor = F; +}()); + +// deprecated; still export them to window to provide clear error messages +// next step: remove entirely +QUnit.equals = function() { + QUnit.push(false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead"); +}; +QUnit.same = function() { + QUnit.push(false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead"); +}; + +// Maintain internal state +var config = { + // The queue of tests to run + queue: [], + + // block until document ready + blocking: true, + + // when enabled, show only failing tests + // gets persisted through sessionStorage and can be changed in UI via checkbox + hidepassed: false, + + // by default, run previously failed tests first + // very useful in combination with "Hide passed tests" checked + reorder: true, + + // by default, modify document.title when suite is done + altertitle: true, + + urlConfig: ['noglobals', 'notrycatch'], + + //logging callback queues + begin: [], + done: [], + log: [], + testStart: [], + testDone: [], + moduleStart: [], + moduleDone: [] +}; + +// Load paramaters +(function() { + var location = window.location || { search: "", protocol: "file:" }, + params = location.search.slice( 1 ).split( "&" ), + length = params.length, + urlParams = {}, + current; + + if ( params[ 0 ] ) { + for ( var i = 0; i < length; i++ ) { + current = params[ i ].split( "=" ); + current[ 0 ] = decodeURIComponent( current[ 0 ] ); + // allow just a key to turn on a flag, e.g., test.html?noglobals + current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; + urlParams[ current[ 0 ] ] = current[ 1 ]; + } + } + + QUnit.urlParams = urlParams; + config.filter = urlParams.filter; + + // Figure out if we're running the tests from a server or not + QUnit.isLocal = location.protocol === 'file:'; +}()); + +// Expose the API as global variables, unless an 'exports' +// object exists, in that case we assume we're in CommonJS - export everything at the end +if ( typeof exports === "undefined" || typeof require === "undefined" ) { + extend(window, QUnit); + window.QUnit = QUnit; +} + +// define these after exposing globals to keep them in these QUnit namespace only +extend(QUnit, { + config: config, + + // Initialize the configuration options + init: function() { + extend(config, { + stats: { all: 0, bad: 0 }, + moduleStats: { all: 0, bad: 0 }, + started: +new Date(), + updateRate: 1000, + blocking: false, + autostart: true, + autorun: false, + filter: "", + queue: [], + semaphore: 0 + }); + + var qunit = id( "qunit" ); + if ( qunit ) { + qunit.innerHTML = + '

' + escapeInnerText( document.title ) + '

' + + '

' + + '
' + + '

' + + '
    '; + } + + var tests = id( "qunit-tests" ), + banner = id( "qunit-banner" ), + result = id( "qunit-testresult" ); + + if ( tests ) { + tests.innerHTML = ""; + } + + if ( banner ) { + banner.className = ""; + } + + if ( result ) { + result.parentNode.removeChild( result ); + } + + if ( tests ) { + result = document.createElement( "p" ); + result.id = "qunit-testresult"; + result.className = "result"; + tests.parentNode.insertBefore( result, tests ); + result.innerHTML = 'Running...
     '; + } + }, + + // Resets the test setup. Useful for tests that modify the DOM. + // If jQuery is available, uses jQuery's html(), otherwise just innerHTML. + reset: function() { + if ( window.jQuery ) { + jQuery( "#qunit-fixture" ).html( config.fixture ); + } else { + var main = id( 'qunit-fixture' ); + if ( main ) { + main.innerHTML = config.fixture; + } + } + }, + + // Trigger an event on an element. + // @example triggerEvent( document.body, "click" ); + triggerEvent: function( elem, type, event ) { + if ( document.createEvent ) { + event = document.createEvent("MouseEvents"); + event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, + 0, 0, 0, 0, 0, false, false, false, false, 0, null); + elem.dispatchEvent( event ); + + } else if ( elem.fireEvent ) { + elem.fireEvent("on"+type); + } + }, + + // Safe object type checking + is: function( type, obj ) { + return QUnit.objectType( obj ) == type; + }, + + objectType: function( obj ) { + if (typeof obj === "undefined") { + return "undefined"; + + // consider: typeof null === object + } + if (obj === null) { + return "null"; + } + + var type = toString.call( obj ).match(/^\[object\s(.*)\]$/)[1] || ''; + + switch (type) { + case 'Number': + if (isNaN(obj)) { + return "nan"; + } + return "number"; + case 'String': + case 'Boolean': + case 'Array': + case 'Date': + case 'RegExp': + case 'Function': + return type.toLowerCase(); + } + if (typeof obj === "object") { + return "object"; + } + return undefined; + }, + + push: function(result, actual, expected, message) { + if (!config.current) { + throw new Error("assertion outside test context, was " + sourceFromStacktrace()); + } + var details = { + result: result, + message: message, + actual: actual, + expected: expected + }; + + message = escapeInnerText(message) || (result ? "okay" : "failed"); + message = '' + message + ""; + var output = message; + if (!result) { + expected = escapeInnerText(QUnit.jsDump.parse(expected)); + actual = escapeInnerText(QUnit.jsDump.parse(actual)); + output += ''; + if (actual != expected) { + output += ''; + output += ''; + } + var source = sourceFromStacktrace(); + if (source) { + details.source = source; + output += ''; + } + output += "
    Expected:
    ' + expected + '
    Result:
    ' + actual + '
    Diff:
    ' + QUnit.diff(expected, actual) +'
    Source:
    ' + escapeInnerText(source) + '
    "; + } + + runLoggingCallbacks( 'log', QUnit, details ); + + config.current.assertions.push({ + result: !!result, + message: output + }); + }, + + pushFailure: function(message, source) { + var details = { + result: false, + message: message + }; + var output = escapeInnerText(message); + if (source) { + details.source = source; + output += '
    Source:
    ' + escapeInnerText(source) + '
    '; + } + runLoggingCallbacks( 'log', QUnit, details ); + config.current.assertions.push({ + result: false, + message: output + }); + }, + + url: function( params ) { + params = extend( extend( {}, QUnit.urlParams ), params ); + var querystring = "?", + key; + for ( key in params ) { + if ( !hasOwn.call( params, key ) ) { + continue; + } + querystring += encodeURIComponent( key ) + "=" + + encodeURIComponent( params[ key ] ) + "&"; + } + return window.location.pathname + querystring.slice( 0, -1 ); + }, + + extend: extend, + id: id, + addEvent: addEvent +}); + +//QUnit.constructor is set to the empty F() above so that we can add to it's prototype later +//Doing this allows us to tell if the following methods have been overwritten on the actual +//QUnit object, which is a deprecated way of using the callbacks. +extend(QUnit.constructor.prototype, { + // Logging callbacks; all receive a single argument with the listed properties + // run test/logs.html for any related changes + begin: registerLoggingCallback('begin'), + // done: { failed, passed, total, runtime } + done: registerLoggingCallback('done'), + // log: { result, actual, expected, message } + log: registerLoggingCallback('log'), + // testStart: { name } + testStart: registerLoggingCallback('testStart'), + // testDone: { name, failed, passed, total } + testDone: registerLoggingCallback('testDone'), + // moduleStart: { name } + moduleStart: registerLoggingCallback('moduleStart'), + // moduleDone: { name, failed, passed, total } + moduleDone: registerLoggingCallback('moduleDone') +}); + +if ( typeof document === "undefined" || document.readyState === "complete" ) { + config.autorun = true; +} + +QUnit.load = function() { + runLoggingCallbacks( 'begin', QUnit, {} ); + + // Initialize the config, saving the execution queue + var oldconfig = extend({}, config); + QUnit.init(); + extend(config, oldconfig); + + config.blocking = false; + + var urlConfigHtml = '', len = config.urlConfig.length; + for ( var i = 0, val; i < len; i++ ) { + val = config.urlConfig[i]; + config[val] = QUnit.urlParams[val]; + urlConfigHtml += ''; + } + + var userAgent = id("qunit-userAgent"); + if ( userAgent ) { + userAgent.innerHTML = navigator.userAgent; + } + var banner = id("qunit-header"); + if ( banner ) { + banner.innerHTML = ' ' + banner.innerHTML + ' ' + urlConfigHtml; + addEvent( banner, "change", function( event ) { + var params = {}; + params[ event.target.name ] = event.target.checked ? true : undefined; + window.location = QUnit.url( params ); + }); + } + + var toolbar = id("qunit-testrunner-toolbar"); + if ( toolbar ) { + var filter = document.createElement("input"); + filter.type = "checkbox"; + filter.id = "qunit-filter-pass"; + addEvent( filter, "click", function() { + var ol = document.getElementById("qunit-tests"); + if ( filter.checked ) { + ol.className = ol.className + " hidepass"; + } else { + var tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " "; + ol.className = tmp.replace(/ hidepass /, " "); + } + if ( defined.sessionStorage ) { + if (filter.checked) { + sessionStorage.setItem("qunit-filter-passed-tests", "true"); + } else { + sessionStorage.removeItem("qunit-filter-passed-tests"); + } + } + }); + if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) { + filter.checked = true; + var ol = document.getElementById("qunit-tests"); + ol.className = ol.className + " hidepass"; + } + toolbar.appendChild( filter ); + + var label = document.createElement("label"); + label.setAttribute("for", "qunit-filter-pass"); + label.innerHTML = "Hide passed tests"; + toolbar.appendChild( label ); + } + + var main = id('qunit-fixture'); + if ( main ) { + config.fixture = main.innerHTML; + } + + if (config.autostart) { + QUnit.start(); + } +}; + +addEvent(window, "load", QUnit.load); + +// addEvent(window, "error") gives us a useless event object +window.onerror = function( message, file, line ) { + if ( QUnit.config.current ) { + QUnit.pushFailure( message, file + ":" + line ); + } else { + QUnit.test( "global failure", function() { + QUnit.pushFailure( message, file + ":" + line ); + }); + } +}; + +function done() { + config.autorun = true; + + // Log the last module results + if ( config.currentModule ) { + runLoggingCallbacks( 'moduleDone', QUnit, { + name: config.currentModule, + failed: config.moduleStats.bad, + passed: config.moduleStats.all - config.moduleStats.bad, + total: config.moduleStats.all + } ); + } + + var banner = id("qunit-banner"), + tests = id("qunit-tests"), + runtime = +new Date() - config.started, + passed = config.stats.all - config.stats.bad, + html = [ + 'Tests completed in ', + runtime, + ' milliseconds.
    ', + '', + passed, + ' tests of ', + config.stats.all, + ' passed, ', + config.stats.bad, + ' failed.' + ].join(''); + + if ( banner ) { + banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass"); + } + + if ( tests ) { + id( "qunit-testresult" ).innerHTML = html; + } + + if ( config.altertitle && typeof document !== "undefined" && document.title ) { + // show ✖ for good, ✔ for bad suite result in title + // use escape sequences in case file gets loaded with non-utf-8-charset + document.title = [ + (config.stats.bad ? "\u2716" : "\u2714"), + document.title.replace(/^[\u2714\u2716] /i, "") + ].join(" "); + } + + // clear own sessionStorage items if all tests passed + if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { + var key; + for ( var i = 0; i < sessionStorage.length; i++ ) { + key = sessionStorage.key( i++ ); + if ( key.indexOf("qunit-test-") === 0 ) { + sessionStorage.removeItem( key ); + } + } + } + + runLoggingCallbacks( 'done', QUnit, { + failed: config.stats.bad, + passed: passed, + total: config.stats.all, + runtime: runtime + } ); +} + +function validTest( name ) { + var filter = config.filter, + run = false; + + if ( !filter ) { + return true; + } + + var not = filter.charAt( 0 ) === "!"; + if ( not ) { + filter = filter.slice( 1 ); + } + + if ( name.indexOf( filter ) !== -1 ) { + return !not; + } + + if ( not ) { + run = true; + } + + return run; +} + +// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) +// Later Safari and IE10 are supposed to support error.stack as well +// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack +function extractStacktrace( e, offset ) { + offset = offset || 3; + if (e.stacktrace) { + // Opera + return e.stacktrace.split("\n")[offset + 3]; + } else if (e.stack) { + // Firefox, Chrome + var stack = e.stack.split("\n"); + if (/^error$/i.test(stack[0])) { + stack.shift(); + } + return stack[offset]; + } else if (e.sourceURL) { + // Safari, PhantomJS + // hopefully one day Safari provides actual stacktraces + // exclude useless self-reference for generated Error objects + if ( /qunit.js$/.test( e.sourceURL ) ) { + return; + } + // for actual exceptions, this is useful + return e.sourceURL + ":" + e.line; + } +} +function sourceFromStacktrace(offset) { + try { + throw new Error(); + } catch ( e ) { + return extractStacktrace( e, offset ); + } +} + +function escapeInnerText(s) { + if (!s) { + return ""; + } + s = s + ""; + return s.replace(/[\&<>]/g, function(s) { + switch(s) { + case "&": return "&"; + case "<": return "<"; + case ">": return ">"; + default: return s; + } + }); +} + +function synchronize( callback, last ) { + config.queue.push( callback ); + + if ( config.autorun && !config.blocking ) { + process(last); + } +} + +function process( last ) { + function next() { + process( last ); + } + var start = new Date().getTime(); + config.depth = config.depth ? config.depth + 1 : 1; + + while ( config.queue.length && !config.blocking ) { + if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { + config.queue.shift()(); + } else { + window.setTimeout( next, 13 ); + break; + } + } + config.depth--; + if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { + done(); + } +} + +function saveGlobal() { + config.pollution = []; + + if ( config.noglobals ) { + for ( var key in window ) { + if ( !hasOwn.call( window, key ) ) { + continue; + } + config.pollution.push( key ); + } + } +} + +function checkPollution( name ) { + var old = config.pollution; + saveGlobal(); + + var newGlobals = diff( config.pollution, old ); + if ( newGlobals.length > 0 ) { + QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") ); + } + + var deletedGlobals = diff( old, config.pollution ); + if ( deletedGlobals.length > 0 ) { + QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") ); + } +} + +// returns a new Array with the elements that are in a but not in b +function diff( a, b ) { + var result = a.slice(); + for ( var i = 0; i < result.length; i++ ) { + for ( var j = 0; j < b.length; j++ ) { + if ( result[i] === b[j] ) { + result.splice(i, 1); + i--; + break; + } + } + } + return result; +} + +function extend(a, b) { + for ( var prop in b ) { + if ( b[prop] === undefined ) { + delete a[prop]; + + // Avoid "Member not found" error in IE8 caused by setting window.constructor + } else if ( prop !== "constructor" || a !== window ) { + a[prop] = b[prop]; + } + } + + return a; +} + +function addEvent(elem, type, fn) { + if ( elem.addEventListener ) { + elem.addEventListener( type, fn, false ); + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, fn ); + } else { + fn(); + } +} + +function id(name) { + return !!(typeof document !== "undefined" && document && document.getElementById) && + document.getElementById( name ); +} + +function registerLoggingCallback(key){ + return function(callback){ + config[key].push( callback ); + }; +} + +// Supports deprecated method of completely overwriting logging callbacks +function runLoggingCallbacks(key, scope, args) { + //debugger; + var callbacks; + if ( QUnit.hasOwnProperty(key) ) { + QUnit[key].call(scope, args); + } else { + callbacks = config[key]; + for( var i = 0; i < callbacks.length; i++ ) { + callbacks[i].call( scope, args ); + } + } +} + +// Test for equality any JavaScript type. +// Author: Philippe Rathé +QUnit.equiv = (function() { + + var innerEquiv; // the real equiv function + var callers = []; // stack to decide between skip/abort functions + var parents = []; // stack to avoiding loops from circular referencing + + // Call the o related callback with the given arguments. + function bindCallbacks(o, callbacks, args) { + var prop = QUnit.objectType(o); + if (prop) { + if (QUnit.objectType(callbacks[prop]) === "function") { + return callbacks[prop].apply(callbacks, args); + } else { + return callbacks[prop]; // or undefined + } + } + } + + var getProto = Object.getPrototypeOf || function (obj) { + return obj.__proto__; + }; + + var callbacks = (function () { + + // for string, boolean, number and null + function useStrictEquality(b, a) { + if (b instanceof a.constructor || a instanceof b.constructor) { + // to catch short annotaion VS 'new' annotation of a + // declaration + // e.g. var i = 1; + // var j = new Number(1); + return a == b; + } else { + return a === b; + } + } + + return { + "string" : useStrictEquality, + "boolean" : useStrictEquality, + "number" : useStrictEquality, + "null" : useStrictEquality, + "undefined" : useStrictEquality, + + "nan" : function(b) { + return isNaN(b); + }, + + "date" : function(b, a) { + return QUnit.objectType(b) === "date" && a.valueOf() === b.valueOf(); + }, + + "regexp" : function(b, a) { + return QUnit.objectType(b) === "regexp" && + // the regex itself + a.source === b.source && + // and its modifers + a.global === b.global && + // (gmi) ... + a.ignoreCase === b.ignoreCase && + a.multiline === b.multiline; + }, + + // - skip when the property is a method of an instance (OOP) + // - abort otherwise, + // initial === would have catch identical references anyway + "function" : function() { + var caller = callers[callers.length - 1]; + return caller !== Object && typeof caller !== "undefined"; + }, + + "array" : function(b, a) { + var i, j, loop; + var len; + + // b could be an object literal here + if (QUnit.objectType(b) !== "array") { + return false; + } + + len = a.length; + if (len !== b.length) { // safe and faster + return false; + } + + // track reference to avoid circular references + parents.push(a); + for (i = 0; i < len; i++) { + loop = false; + for (j = 0; j < parents.length; j++) { + if (parents[j] === a[i]) { + loop = true;// dont rewalk array + } + } + if (!loop && !innerEquiv(a[i], b[i])) { + parents.pop(); + return false; + } + } + parents.pop(); + return true; + }, + + "object" : function(b, a) { + var i, j, loop; + var eq = true; // unless we can proove it + var aProperties = [], bProperties = []; // collection of + // strings + + // comparing constructors is more strict than using + // instanceof + if (a.constructor !== b.constructor) { + // Allow objects with no prototype to be equivalent to + // objects with Object as their constructor. + if (!((getProto(a) === null && getProto(b) === Object.prototype) || + (getProto(b) === null && getProto(a) === Object.prototype))) + { + return false; + } + } + + // stack constructor before traversing properties + callers.push(a.constructor); + // track reference to avoid circular references + parents.push(a); + + for (i in a) { // be strict: don't ensures hasOwnProperty + // and go deep + loop = false; + for (j = 0; j < parents.length; j++) { + if (parents[j] === a[i]) { + // don't go down the same path twice + loop = true; + } + } + aProperties.push(i); // collect a's properties + + if (!loop && !innerEquiv(a[i], b[i])) { + eq = false; + break; + } + } + + callers.pop(); // unstack, we are done + parents.pop(); + + for (i in b) { + bProperties.push(i); // collect b's properties + } + + // Ensures identical properties name + return eq && innerEquiv(aProperties.sort(), bProperties.sort()); + } + }; + }()); + + innerEquiv = function() { // can take multiple arguments + var args = Array.prototype.slice.apply(arguments); + if (args.length < 2) { + return true; // end transition + } + + return (function(a, b) { + if (a === b) { + return true; // catch the most you can + } else if (a === null || b === null || typeof a === "undefined" || + typeof b === "undefined" || + QUnit.objectType(a) !== QUnit.objectType(b)) { + return false; // don't lose time with error prone cases + } else { + return bindCallbacks(a, callbacks, [ b, a ]); + } + + // apply transition with (1..n) arguments + }(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length - 1))); + }; + + return innerEquiv; + +}()); + +/** + * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | + * http://flesler.blogspot.com Licensed under BSD + * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008 + * + * @projectDescription Advanced and extensible data dumping for Javascript. + * @version 1.0.0 + * @author Ariel Flesler + * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html} + */ +QUnit.jsDump = (function() { + function quote( str ) { + return '"' + str.toString().replace(/"/g, '\\"') + '"'; + } + function literal( o ) { + return o + ''; + } + function join( pre, arr, post ) { + var s = jsDump.separator(), + base = jsDump.indent(), + inner = jsDump.indent(1); + if ( arr.join ) { + arr = arr.join( ',' + s + inner ); + } + if ( !arr ) { + return pre + post; + } + return [ pre, inner + arr, base + post ].join(s); + } + function array( arr, stack ) { + var i = arr.length, ret = new Array(i); + this.up(); + while ( i-- ) { + ret[i] = this.parse( arr[i] , undefined , stack); + } + this.down(); + return join( '[', ret, ']' ); + } + + var reName = /^function (\w+)/; + + var jsDump = { + parse: function( obj, type, stack ) { //type is used mostly internally, you can fix a (custom)type in advance + stack = stack || [ ]; + var parser = this.parsers[ type || this.typeOf(obj) ]; + type = typeof parser; + var inStack = inArray(obj, stack); + if (inStack != -1) { + return 'recursion('+(inStack - stack.length)+')'; + } + //else + if (type == 'function') { + stack.push(obj); + var res = parser.call( this, obj, stack ); + stack.pop(); + return res; + } + // else + return (type == 'string') ? parser : this.parsers.error; + }, + typeOf: function( obj ) { + var type; + if ( obj === null ) { + type = "null"; + } else if (typeof obj === "undefined") { + type = "undefined"; + } else if (QUnit.is("RegExp", obj)) { + type = "regexp"; + } else if (QUnit.is("Date", obj)) { + type = "date"; + } else if (QUnit.is("Function", obj)) { + type = "function"; + } else if (typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined") { + type = "window"; + } else if (obj.nodeType === 9) { + type = "document"; + } else if (obj.nodeType) { + type = "node"; + } else if ( + // native arrays + toString.call( obj ) === "[object Array]" || + // NodeList objects + ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) ) + ) { + type = "array"; + } else { + type = typeof obj; + } + return type; + }, + separator: function() { + return this.multiline ? this.HTML ? '
    ' : '\n' : this.HTML ? ' ' : ' '; + }, + indent: function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing + if ( !this.multiline ) { + return ''; + } + var chr = this.indentChar; + if ( this.HTML ) { + chr = chr.replace(/\t/g,' ').replace(/ /g,' '); + } + return new Array( this._depth_ + (extra||0) ).join(chr); + }, + up: function( a ) { + this._depth_ += a || 1; + }, + down: function( a ) { + this._depth_ -= a || 1; + }, + setParser: function( name, parser ) { + this.parsers[name] = parser; + }, + // The next 3 are exposed so you can use them + quote: quote, + literal: literal, + join: join, + // + _depth_: 1, + // This is the list of parsers, to modify them, use jsDump.setParser + parsers: { + window: '[Window]', + document: '[Document]', + error: '[ERROR]', //when no parser is found, shouldn't happen + unknown: '[Unknown]', + 'null': 'null', + 'undefined': 'undefined', + 'function': function( fn ) { + var ret = 'function', + name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE + if ( name ) { + ret += ' ' + name; + } + ret += '('; + + ret = [ ret, QUnit.jsDump.parse( fn, 'functionArgs' ), '){'].join(''); + return join( ret, QUnit.jsDump.parse(fn,'functionCode'), '}' ); + }, + array: array, + nodelist: array, + 'arguments': array, + object: function( map, stack ) { + var ret = [ ], keys, key, val, i; + QUnit.jsDump.up(); + if (Object.keys) { + keys = Object.keys( map ); + } else { + keys = []; + for (key in map) { keys.push( key ); } + } + keys.sort(); + for (i = 0; i < keys.length; i++) { + key = keys[ i ]; + val = map[ key ]; + ret.push( QUnit.jsDump.parse( key, 'key' ) + ': ' + QUnit.jsDump.parse( val, undefined, stack ) ); + } + QUnit.jsDump.down(); + return join( '{', ret, '}' ); + }, + node: function( node ) { + var open = QUnit.jsDump.HTML ? '<' : '<', + close = QUnit.jsDump.HTML ? '>' : '>'; + + var tag = node.nodeName.toLowerCase(), + ret = open + tag; + + for ( var a in QUnit.jsDump.DOMAttrs ) { + var val = node[QUnit.jsDump.DOMAttrs[a]]; + if ( val ) { + ret += ' ' + a + '=' + QUnit.jsDump.parse( val, 'attribute' ); + } + } + return ret + close + open + '/' + tag + close; + }, + functionArgs: function( fn ) {//function calls it internally, it's the arguments part of the function + var l = fn.length; + if ( !l ) { + return ''; + } + + var args = new Array(l); + while ( l-- ) { + args[l] = String.fromCharCode(97+l);//97 is 'a' + } + return ' ' + args.join(', ') + ' '; + }, + key: quote, //object calls it internally, the key part of an item in a map + functionCode: '[code]', //function calls it internally, it's the content of the function + attribute: quote, //node calls it internally, it's an html attribute value + string: quote, + date: quote, + regexp: literal, //regex + number: literal, + 'boolean': literal + }, + DOMAttrs:{//attributes to dump from nodes, name=>realName + id:'id', + name:'name', + 'class':'className' + }, + HTML:false,//if true, entities are escaped ( <, >, \t, space and \n ) + indentChar:' ',//indentation unit + multiline:true //if true, items in a collection, are separated by a \n, else just a space. + }; + + return jsDump; +}()); + +// from Sizzle.js +function getText( elems ) { + var ret = "", elem; + + for ( var i = 0; elems[i]; i++ ) { + elem = elems[i]; + + // Get the text from text nodes and CDATA nodes + if ( elem.nodeType === 3 || elem.nodeType === 4 ) { + ret += elem.nodeValue; + + // Traverse everything else, except comment nodes + } else if ( elem.nodeType !== 8 ) { + ret += getText( elem.childNodes ); + } + } + + return ret; +} + +//from jquery.js +function inArray( elem, array ) { + if ( array.indexOf ) { + return array.indexOf( elem ); + } + + for ( var i = 0, length = array.length; i < length; i++ ) { + if ( array[ i ] === elem ) { + return i; + } + } + + return -1; +} + +/* + * Javascript Diff Algorithm + * By John Resig (http://ejohn.org/) + * Modified by Chu Alan "sprite" + * + * Released under the MIT license. + * + * More Info: + * http://ejohn.org/projects/javascript-diff-algorithm/ + * + * Usage: QUnit.diff(expected, actual) + * + * QUnit.diff("the quick brown fox jumped over", "the quick fox jumps over") == "the quick brown fox jumped jumps over" + */ +QUnit.diff = (function() { + function diff(o, n) { + var ns = {}; + var os = {}; + var i; + + for (i = 0; i < n.length; i++) { + if (ns[n[i]] == null) { + ns[n[i]] = { + rows: [], + o: null + }; + } + ns[n[i]].rows.push(i); + } + + for (i = 0; i < o.length; i++) { + if (os[o[i]] == null) { + os[o[i]] = { + rows: [], + n: null + }; + } + os[o[i]].rows.push(i); + } + + for (i in ns) { + if ( !hasOwn.call( ns, i ) ) { + continue; + } + if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) { + n[ns[i].rows[0]] = { + text: n[ns[i].rows[0]], + row: os[i].rows[0] + }; + o[os[i].rows[0]] = { + text: o[os[i].rows[0]], + row: ns[i].rows[0] + }; + } + } + + for (i = 0; i < n.length - 1; i++) { + if (n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null && + n[i + 1] == o[n[i].row + 1]) { + n[i + 1] = { + text: n[i + 1], + row: n[i].row + 1 + }; + o[n[i].row + 1] = { + text: o[n[i].row + 1], + row: i + 1 + }; + } + } + + for (i = n.length - 1; i > 0; i--) { + if (n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null && + n[i - 1] == o[n[i].row - 1]) { + n[i - 1] = { + text: n[i - 1], + row: n[i].row - 1 + }; + o[n[i].row - 1] = { + text: o[n[i].row - 1], + row: i - 1 + }; + } + } + + return { + o: o, + n: n + }; + } + + return function(o, n) { + o = o.replace(/\s+$/, ''); + n = n.replace(/\s+$/, ''); + var out = diff(o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/)); + + var str = ""; + var i; + + var oSpace = o.match(/\s+/g); + if (oSpace == null) { + oSpace = [" "]; + } + else { + oSpace.push(" "); + } + var nSpace = n.match(/\s+/g); + if (nSpace == null) { + nSpace = [" "]; + } + else { + nSpace.push(" "); + } + + if (out.n.length === 0) { + for (i = 0; i < out.o.length; i++) { + str += '' + out.o[i] + oSpace[i] + ""; + } + } + else { + if (out.n[0].text == null) { + for (n = 0; n < out.o.length && out.o[n].text == null; n++) { + str += '' + out.o[n] + oSpace[n] + ""; + } + } + + for (i = 0; i < out.n.length; i++) { + if (out.n[i].text == null) { + str += '' + out.n[i] + nSpace[i] + ""; + } + else { + var pre = ""; + + for (n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++) { + pre += '' + out.o[n] + oSpace[n] + ""; + } + str += " " + out.n[i].text + nSpace[i] + pre; + } + } + } + + return str; + }; +}()); + +// for CommonJS enviroments, export everything +if ( typeof exports !== "undefined" || typeof require !== "undefined" ) { + extend(exports, QUnit); +} + +// get at whatever the global object is, like window in browsers +}( (function() {return this;}.call()) )); diff --git a/public/bootstrap-datepicker/tests/assets/utils.js b/public/bootstrap-datepicker/tests/assets/utils.js new file mode 100644 index 0000000000..6f9cac58f4 --- /dev/null +++ b/public/bootstrap-datepicker/tests/assets/utils.js @@ -0,0 +1,21 @@ +function UTCDate(){ + return new Date(Date.UTC.apply(Date, arguments)); +} + + +function format_date(date){ + var y = date.getUTCFullYear(), + m = date.getUTCMonth() + 1, + d = date.getUTCDate(), + h = date.getUTCHours(), + i = date.getUTCMinutes(), + s = date.getUTCSeconds(), + l = date.getUTCMilliseconds(); + function z(i){return (i <= 9 ? '0'+i : i);} + return y+'-'+z(m)+'-'+z(d)+' '+z(h)+':'+z(i)+':'+z(s)+'.'+z(l); +} + + +function datesEqual(actual, expected, message){ + QUnit.push(QUnit.equiv(actual, expected), format_date(actual), format_date(expected), message); +} diff --git a/public/bootstrap-datepicker/tests/run-qunit.js b/public/bootstrap-datepicker/tests/run-qunit.js new file mode 100644 index 0000000000..effdc3f10c --- /dev/null +++ b/public/bootstrap-datepicker/tests/run-qunit.js @@ -0,0 +1,157 @@ +var system = require('system'); + +/** + * Wait until the test condition is true or a timeout occurs. Useful for waiting + * on a server response or for a ui change (fadeIn, etc.) to occur. + * + * @param testFx javascript condition that evaluates to a boolean, + * it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or + * as a callback function. + * @param onReady what to do when testFx condition is fulfilled, + * it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or + * as a callback function. + * @param timeOutMillis the max amount of time to wait. If not specified, 3 sec is used. + */ +function waitFor(testFx, onReady, timeOutMillis) { + var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 10001, //< Default Max Timout is 3s + start = new Date().getTime(), + condition = false, + interval = setInterval(function() { + if ( (new Date().getTime() - start < maxtimeOutMillis) && !condition ) { + // If not time-out yet and condition not yet fulfilled + condition = (typeof(testFx) === "string" ? eval(testFx) : testFx()); //< defensive code + } else { + if(!condition) { + // If condition still not fulfilled (timeout but condition is 'false') + console.log("'waitFor()' timeout"); + phantom.exit(1); + } else { + // Condition fulfilled (timeout and/or condition is 'true') + //console.log("'waitFor()' finished in " + (new Date().getTime() - start) + "ms."); + typeof(onReady) === "string" ? eval(onReady) : onReady(); //< Do what it's supposed to do once the condition is fulfilled + clearInterval(interval); //< Stop this interval + } + } + }, 100); //< repeat check every 100ms +}; + +if (system.args.length !== 2) { + console.log('Usage: run-qunit.js URL'); + phantom.exit(1); +} + +var fs = require('fs'); +var page = require('webpage').create(); + +// Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this") +page.onConsoleMessage = function(msg) { + console.log(msg); +}; +page.onError = function (msg, trace) { + console.log(msg); + trace.forEach(function(item) { + console.log(' ', item.file, ':', item.line); + }) +} + +var _openPath = phantom.args[0].replace(/^.*(\\|\/)/, ''); +var openPath = _openPath; +var origdir = '../js/'; +var basedir = '../instrumented/'; +var coverageBase = fs.read('_coverage.html'); + +if (fs.exists(basedir)){ + var script = /<\/script>/g, + src = /src=(["'])(.*?)\1/, + contents = fs.read(openPath), + _contents = contents, + srcs = [], + s; + while (script.exec(contents)){ + s = src.exec(RegExp.lastMatch)[2]; + if (s && s.indexOf(origdir) != -1) + _contents = _contents.replace(s, s.replace(origdir, basedir)) + } + if (_contents != contents){ + openPath += '.cov.html'; + fs.write(openPath, _contents); + } +} + +page.open(openPath, function(status){ + if (status !== "success") { + console.log("Unable to access network"); + phantom.exit(1); + } else { + // Inject instrumented sources if they exist + if (fs.exists(basedir)) + for (var i=0; i0 ? 'hit' : 'miss'); + } else { + hitmiss = ' ' + 'undef'; + } + var htmlLine = fileLines[idx] + if (!source) + htmlLine = htmlLine.replace('<', '<').replace('>', '>'); + colorized += '
    ' + htmlLine + '
    \n'; + }; + colorized = coverageBase.replace('COLORIZED_LINE_HTML', colorized); + + fs.write('coverage.html', colorized, 'w'); + + console.log('Coverage for ' + coverageInfo.key + ' in coverage.html'); + } + if (_openPath != openPath) + fs.remove(openPath); + + var failedNum = page.evaluate(function(){ + var el = document.getElementById('qunit-testresult'); + console.log(el.innerText); + try { + return el.getElementsByClassName('failed')[0].innerHTML; + } catch (e) { } + return 10000; + }); + phantom.exit((parseInt(failedNum, 10) > 0) ? 1 : 0); + }); + } +}); + +function readFileLines(filename) { + var stream = fs.open(filename, 'r'); + var lines = []; + var line; + while (!stream.atEnd()) { + lines.push(stream.readLine()); + } + stream.close(); + + return lines; +} + diff --git a/public/bootstrap-datepicker/tests/suites/calendar-weeks.js b/public/bootstrap-datepicker/tests/suites/calendar-weeks.js new file mode 100644 index 0000000000..6c466f1d1b --- /dev/null +++ b/public/bootstrap-datepicker/tests/suites/calendar-weeks.js @@ -0,0 +1,48 @@ +module('Calendar Weeks', { + setup: function(){ + this.input = $('') + .appendTo('#qunit-fixture') + .val('2013-01-14') + .datepicker({ + format: 'yyyy-mm-dd', + calendarWeeks: true + }) + .focus(); // Activate for visibility checks + this.dp = this.input.data('datepicker') + this.picker = this.dp.picker; + }, + teardown: function(){ + this.picker.remove(); + } +}); + +test('adds cw header column', function(){ + var target = this.picker.find('.datepicker-days thead th:first-child'); + ok(target.hasClass('cw'), 'First column heading is from cw column'); +}); + +test('adds calendar week cells to each day row', function(){ + var target = this.picker.find('.datepicker-days tbody tr'); + + expect(target.length); + target.each(function(i){ + var t = $(this).children().first(); + ok(t.hasClass('cw'), "First column is cw column"); + }); +}); + +test('displays correct calendar week', function(){ + var target = this.picker.find('.datepicker-days tbody tr'); + + expect(target.length); + target.each(function(i){ + var t = $(this).children().first(); + equal(t.text(), i+1, "Displays correct calendar weeks"); + }); +}); + +test('it prepends column to switcher thead row', function(){ + var target = this.picker.find('.datepicker-days thead tr:first-child'); + equal(target.children().length, 4, 'first row has 4 columns'); + ok(target.children().first().hasClass('cw'), 'cw column is prepended'); +}); diff --git a/public/bootstrap-datepicker/tests/suites/component.js b/public/bootstrap-datepicker/tests/suites/component.js new file mode 100644 index 0000000000..aa5687fc0f --- /dev/null +++ b/public/bootstrap-datepicker/tests/suites/component.js @@ -0,0 +1,166 @@ +module('Component', { + setup: function(){ + this.component = $('
    '+ + ''+ + ''+ + '
    ') + .appendTo('#qunit-fixture') + .datepicker({format: "dd-mm-yyyy"}); + this.input = this.component.find('input'); + this.addon = this.component.find('.add-on'); + this.dp = this.component.data('datepicker') + this.picker = this.dp.picker; + }, + teardown: function(){ + this.picker.remove(); + } +}); + + +test('Component gets date/viewDate from input value', function(){ + datesEqual(this.dp.date, UTCDate(2012, 1, 12)); + datesEqual(this.dp.viewDate, UTCDate(2012, 1, 12)); +}); + +test('Activation by component', function(){ + ok(!this.picker.is(':visible')); + this.addon.click(); + ok(this.picker.is(':visible')); +}); + +test('simple keyboard nav test', function(){ + var target; + + // Keyboard nav only works with non-readonly inputs + this.input.removeAttr('readonly'); + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'February 2012', 'Title is "February 2012"'); + datesEqual(this.dp.date, UTCDate(2012, 1, 12)); + datesEqual(this.dp.viewDate, UTCDate(2012, 1, 12)); + + // Focus/open + this.addon.click(); + + // Navigation: -1 day, left arrow key + this.input.trigger({ + type: 'keydown', + keyCode: 37 + }); + datesEqual(this.dp.viewDate, UTCDate(2012, 1, 11)); + datesEqual(this.dp.date, UTCDate(2012, 1, 11)); + // Month not changed + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'February 2012', 'Title is "February 2012"'); + + // Navigation: +1 month, shift + right arrow key + this.input.trigger({ + type: 'keydown', + keyCode: 39, + shiftKey: true + }); + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 11)); + datesEqual(this.dp.date, UTCDate(2012, 2, 11)); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2012', 'Title is "March 2012"'); + + // Navigation: -1 year, ctrl + left arrow key + this.input.trigger({ + type: 'keydown', + keyCode: 37, + ctrlKey: true + }); + datesEqual(this.dp.viewDate, UTCDate(2011, 2, 11)); + datesEqual(this.dp.date, UTCDate(2011, 2, 11)); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2011', 'Title is "March 2011"'); +}); + +test('setValue', function(){ + this.dp.date = UTCDate(2012, 2, 13) + this.dp.setValue() + datesEqual(this.dp.date, UTCDate(2012, 2, 13)); + equal(this.input.val(), '13-03-2012'); +}); + +test('update', function(){ + this.input.val('13-03-2012'); + this.dp.update() + datesEqual(this.dp.date, UTCDate(2012, 2, 13)); +}); + +test('Navigating to/from decade view', function(){ + var target; + + this.addon.click(); + this.input.val('31-03-2012'); + this.dp.update(); + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + ok(target.is(':visible'), 'View switcher is visible'); + + target.click(); + ok(this.picker.find('.datepicker-months').is(':visible'), 'Month picker is visible'); + equal(this.dp.viewMode, 1); + // Not modified when switching modes + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 31)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); + + target = this.picker.find('.datepicker-months thead th.switch'); + ok(target.is(':visible'), 'View switcher is visible'); + + target.click(); + ok(this.picker.find('.datepicker-years').is(':visible'), 'Year picker is visible'); + equal(this.dp.viewMode, 2); + // Not modified when switching modes + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 31)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); + + // Change years to test internal state changes + target = this.picker.find('.datepicker-years tbody span:contains(2011)'); + target.click(); + equal(this.dp.viewMode, 1); + // Only viewDate modified + datesEqual(this.dp.viewDate, UTCDate(2011, 2, 1)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); + + target = this.picker.find('.datepicker-months tbody span:contains(Apr)'); + target.click(); + equal(this.dp.viewMode, 0); + // Only viewDate modified + datesEqual(this.dp.viewDate, UTCDate(2011, 3, 1)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); +}); + +test('Selecting date resets viewDate and date', function(){ + var target; + + this.addon.click(); + this.input.val('31-03-2012'); + this.dp.update(); + + // Rendered correctly + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days tbody td:first'); + equal(target.text(), '26'); // Should be Feb 26 + + // Updated internally on click + target.click(); + datesEqual(this.dp.viewDate, UTCDate(2012, 1, 26)) + datesEqual(this.dp.date, UTCDate(2012, 1, 26)) + + // Re-rendered on click + target = this.picker.find('.datepicker-days tbody td:first'); + equal(target.text(), '29'); // Should be Jan 29 +}); + +test('"remove" removes associated HTML', function(){ + var datepickerDivSelector = '.datepicker'; + + //there should be one datepicker initiated so that means one hidden .datepicker div + equal($(datepickerDivSelector).length, 1); + this.component.datepicker('remove'); + equal($(datepickerDivSelector).length, 0);//hidden HTML should be gone +}); diff --git a/public/bootstrap-datepicker/tests/suites/events.js b/public/bootstrap-datepicker/tests/suites/events.js new file mode 100644 index 0000000000..0df5886292 --- /dev/null +++ b/public/bootstrap-datepicker/tests/suites/events.js @@ -0,0 +1,80 @@ +module('Events', { + setup: function(){ + this.input = $('') + .appendTo('#qunit-fixture') + .datepicker({format: "dd-mm-yyyy"}) + .focus(); // Activate for visibility checks + this.dp = this.input.data('datepicker') + this.picker = this.dp.picker; + }, + teardown: function(){ + this.picker.remove(); + } +}); + +test('Selecting a year from decade view triggers pickYear', function(){ + var target, + triggered = 0; + + this.input.on('changeYear', function(){ + triggered++; + }); + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + ok(target.is(':visible'), 'View switcher is visible'); + + target.click(); + ok(this.picker.find('.datepicker-months').is(':visible'), 'Month picker is visible'); + equal(this.dp.viewMode, 1); + // Not modified when switching modes + datesEqual(this.dp.viewDate, UTCDate(2011, 2, 31)); + datesEqual(this.dp.date, UTCDate(2011, 2, 31)); + + target = this.picker.find('.datepicker-months thead th.switch'); + ok(target.is(':visible'), 'View switcher is visible'); + + target.click(); + ok(this.picker.find('.datepicker-years').is(':visible'), 'Year picker is visible'); + equal(this.dp.viewMode, 2); + // Not modified when switching modes + datesEqual(this.dp.viewDate, UTCDate(2011, 2, 31)); + datesEqual(this.dp.date, UTCDate(2011, 2, 31)); + + // Change years to test internal state changes + target = this.picker.find('.datepicker-years tbody span:contains(2010)'); + target.click(); + equal(this.dp.viewMode, 1); + // Only viewDate modified + datesEqual(this.dp.viewDate, UTCDate(2010, 2, 1)); + datesEqual(this.dp.date, UTCDate(2011, 2, 31)); + equal(triggered, 1); +}); + +test('Selecting a month from year view triggers pickMonth', function(){ + var target, + triggered = 0; + + this.input.on('changeMonth', function(){ + triggered++; + }); + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + ok(target.is(':visible'), 'View switcher is visible'); + + target.click(); + ok(this.picker.find('.datepicker-months').is(':visible'), 'Month picker is visible'); + equal(this.dp.viewMode, 1); + // Not modified when switching modes + datesEqual(this.dp.viewDate, UTCDate(2011, 2, 31)); + datesEqual(this.dp.date, UTCDate(2011, 2, 31)); + + target = this.picker.find('.datepicker-months tbody span:contains(Apr)'); + target.click(); + equal(this.dp.viewMode, 0); + // Only viewDate modified + datesEqual(this.dp.viewDate, UTCDate(2011, 3, 1)); + datesEqual(this.dp.date, UTCDate(2011, 2, 31)); + equal(triggered, 1); +}); diff --git a/public/bootstrap-datepicker/tests/suites/formats.js b/public/bootstrap-datepicker/tests/suites/formats.js new file mode 100644 index 0000000000..0bfd2dd8cb --- /dev/null +++ b/public/bootstrap-datepicker/tests/suites/formats.js @@ -0,0 +1,226 @@ +module('Formats', { + setup: function(){ + this.input = $('').appendTo('#qunit-fixture'); + this.date = UTCDate(2012, 2, 15, 0, 0, 0, 0); // March 15, 2012 + }, + teardown: function(){ + this.input.data('datepicker').picker.remove(); + } +}); + +test('d: Day of month, no leading zero.', function(){ + this.input + .val('2012-03-05') + .datepicker({format: 'yyyy-mm-d'}) + .datepicker('setValue'); + equal(this.input.val().split('-')[2], '5'); +}); + +test('dd: Day of month, leading zero.', function(){ + this.input + .val('2012-03-5') + .datepicker({format: 'yyyy-mm-dd'}) + .datepicker('setValue'); + equal(this.input.val().split('-')[2], '05'); +}); + +test('D: Day of week, short.', function(){ + this.input + .val('2012-03-05') + .datepicker({format: 'yyyy-mm-dd-D'}) + .datepicker('setValue'); + equal(this.input.val().split('-')[3], 'Mon'); +}); + +test('DD: Day of week, long.', function(){ + this.input + .val('2012-03-05') + .datepicker({format: 'yyyy-mm-dd-DD'}) + .datepicker('setValue'); + equal(this.input.val().split('-')[3], 'Monday'); +}); + +test('m: Month, no leading zero.', function(){ + this.input + .val('2012-03-05') + .datepicker({format: 'yyyy-m-dd'}) + .datepicker('setValue'); + equal(this.input.val().split('-')[1], '3'); +}); + +test('mm: Month, leading zero.', function(){ + this.input + .val('2012-3-5') + .datepicker({format: 'yyyy-mm-dd'}) + .datepicker('setValue'); + equal(this.input.val().split('-')[1], '03'); +}); + +test('M: Month shortname.', function(){ + this.input + .val('2012-Mar-05') + .datepicker({format: 'yyyy-M-dd'}) + .datepicker('setValue'); + equal(this.input.val().split('-')[1], 'Mar'); +}); + +test('MM: Month full name.', function(){ + this.input + .val('2012-March-5') + .datepicker({format: 'yyyy-MM-dd'}) + .datepicker('setValue'); + equal(this.input.val().split('-')[1], 'March'); +}); + +test('yy: Year, two-digit.', function(){ + this.input + .val('2012-03-05') + .datepicker({format: 'yy-mm-dd'}) + .datepicker('setValue'); + equal(this.input.val().split('-')[0], '12'); +}); + +test('yyyy: Year, four-digit.', function(){ + this.input + .val('2012-03-5') + .datepicker({format: 'yyyy-mm-dd'}) + .datepicker('setValue'); + equal(this.input.val().split('-')[0], '2012'); +}); + +test('dd-mm-yyyy: Regression: Prevent potential month overflow in small-to-large formats (Mar 31, 2012 -> Mar 01, 2012)', function(){ + this.input + .val('31-03-2012') + .datepicker({format: 'dd-mm-yyyy'}) + .datepicker('setValue'); + equal(this.input.val(), '31-03-2012'); +}); + +test('dd-mm-yyyy: Leap day', function(){ + this.input + .val('29-02-2012') + .datepicker({format: 'dd-mm-yyyy'}) + .datepicker('setValue'); + equal(this.input.val(), '29-02-2012'); +}); + +test('yyyy-mm-dd: Alternative format', function(){ + this.input + .val('2012-02-12') + .datepicker({format: 'yyyy-mm-dd'}) + .datepicker('setValue'); + equal(this.input.val(), '2012-02-12'); +}); + +test('yyyy-MM-dd: Regression: Infinite loop when numbers used for month', function(){ + this.input + .val('2012-02-12') + .datepicker({format: 'yyyy-MM-dd'}) + .datepicker('setValue'); + equal(this.input.val(), '2012-February-12'); +}); + +test('+1d: Tomorrow', patch_date(function(Date){ + Date.now = UTCDate(2012, 2, 15); + this.input + .val('+1d') + .datepicker({format: 'dd-mm-yyyy'}) + .datepicker('setValue'); + equal(this.input.val(), '16-03-2012'); +})); + +test('-1d: Yesterday', patch_date(function(Date){ + Date.now = UTCDate(2012, 2, 15); + this.input + .val('-1d') + .datepicker({format: 'dd-mm-yyyy'}) + .datepicker('setValue'); + equal(this.input.val(), '14-03-2012'); +})); + +test('+1w: Next week', patch_date(function(Date){ + Date.now = UTCDate(2012, 2, 15); + this.input + .val('+1w') + .datepicker({format: 'dd-mm-yyyy'}) + .datepicker('setValue'); + equal(this.input.val(), '22-03-2012'); +})); + +test('-1w: Last week', patch_date(function(Date){ + Date.now = UTCDate(2012, 2, 15); + this.input + .val('-1w') + .datepicker({format: 'dd-mm-yyyy'}) + .datepicker('setValue'); + equal(this.input.val(), '08-03-2012'); +})); + +test('+1m: Next month', patch_date(function(Date){ + Date.now = UTCDate(2012, 2, 15); + this.input + .val('+1m') + .datepicker({format: 'dd-mm-yyyy'}) + .datepicker('setValue'); + equal(this.input.val(), '15-04-2012'); +})); + +test('-1m: Last month', patch_date(function(Date){ + Date.now = UTCDate(2012, 2, 15); + this.input + .val('-1m') + .datepicker({format: 'dd-mm-yyyy'}) + .datepicker('setValue'); + equal(this.input.val(), '15-02-2012'); +})); + +test('+1y: Next year', patch_date(function(Date){ + Date.now = UTCDate(2012, 2, 15); + this.input + .val('+1y') + .datepicker({format: 'dd-mm-yyyy'}) + .datepicker('setValue'); + equal(this.input.val(), '15-03-2013'); +})); + +test('-1y: Last year', patch_date(function(Date){ + Date.now = UTCDate(2012, 2, 15); + this.input + .val('-1y') + .datepicker({format: 'dd-mm-yyyy'}) + .datepicker('setValue'); + equal(this.input.val(), '15-03-2011'); +})); + +test('-1y +2m: Multiformat', patch_date(function(Date){ + Date.now = UTCDate(2012, 2, 15); + this.input + .val('-1y +2m') + .datepicker({format: 'dd-mm-yyyy'}) + .datepicker('setValue'); + equal(this.input.val(), '15-05-2011'); +})); + +test('Regression: End-of-month bug', patch_date(function(Date){ + Date.now = UTCDate(2012, 4, 31); + this.input + .val('29-02-2012') + .datepicker({format: 'dd-mm-yyyy'}) + .datepicker('setValue'); + equal(this.input.val(), '29-02-2012'); +})); + +test('Invalid formats are force-parsed into a valid date on tab', patch_date(function(Date){ + Date.now = UTCDate(2012, 4, 31); + this.input + .val('44-44-4444') + .datepicker({format: 'yyyy-MM-dd'}) + .focus(); + + this.input.trigger({ + type: 'keydown', + keyCode: 9 + }); + + equal(this.input.val(), '56-September-30'); +})); diff --git a/public/bootstrap-datepicker/tests/suites/inline.js b/public/bootstrap-datepicker/tests/suites/inline.js new file mode 100644 index 0000000000..5a3e7fed6d --- /dev/null +++ b/public/bootstrap-datepicker/tests/suites/inline.js @@ -0,0 +1,28 @@ +module('Inline', { + setup: function(){ + this.component = $('
    ') + .appendTo('#qunit-fixture') + .datepicker({format: "dd-mm-yyyy"}); + this.dp = this.component.data('datepicker') + this.picker = this.dp.picker; + }, + teardown: function(){ + this.picker.remove(); + } +}); + + +test('Picker gets date/viewDate from data-date attr', function(){ + datesEqual(this.dp.date, UTCDate(2012, 1, 12)); + datesEqual(this.dp.viewDate, UTCDate(2012, 1, 12)); +}); + + +test('Visible after init', function(){ + ok(this.picker.is(':visible')); +}); + +test('update', function(){ + this.dp.update('13-03-2012') + datesEqual(this.dp.date, UTCDate(2012, 2, 13)); +}); diff --git a/public/bootstrap-datepicker/tests/suites/keyboard_navigation/2011.js b/public/bootstrap-datepicker/tests/suites/keyboard_navigation/2011.js new file mode 100644 index 0000000000..77d33c5e7e --- /dev/null +++ b/public/bootstrap-datepicker/tests/suites/keyboard_navigation/2011.js @@ -0,0 +1,86 @@ +module('Keyboard Navigation 2011', { + setup: function(){ + /* + Tests start with picker on March 31, 2011. Fun facts: + + * March 1, 2011 was on a Tuesday + * March 31, 2011 was on a Thursday + */ + this.input = $('') + .appendTo('#qunit-fixture') + .datepicker({format: "dd-mm-yyyy"}) + .focus(); // Activate for visibility checks + this.dp = this.input.data('datepicker') + this.picker = this.dp.picker; + }, + teardown: function(){ + this.picker.remove(); + } +}); + +test('Regression: by week (up/down arrows); up from Mar 6, 2011 should go to Feb 27, 2011', function(){ + var target; + + this.input.val('06-03-2011').datepicker('update'); + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2011', 'Title is "March 2011"'); + datesEqual(this.dp.viewDate, UTCDate(2011, 2, 6)); + datesEqual(this.dp.date, UTCDate(2011, 2, 6)); + + // Navigation: -1 week, up arrow key + this.input.trigger({ + type: 'keydown', + keyCode: 38 + }); + datesEqual(this.dp.viewDate, UTCDate(2011, 1, 27)); + datesEqual(this.dp.date, UTCDate(2011, 1, 27)); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'February 2011', 'Title is "February 2011"'); +}); + +test('Regression: by day (left/right arrows); left from Mar 1, 2011 should go to Feb 28, 2011', function(){ + var target; + + this.input.val('01-03-2011').datepicker('update'); + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2011', 'Title is "March 2011"'); + datesEqual(this.dp.viewDate, UTCDate(2011, 2, 1)); + datesEqual(this.dp.date, UTCDate(2011, 2, 1)); + + // Navigation: -1 day left arrow key + this.input.trigger({ + type: 'keydown', + keyCode: 37 + }); + datesEqual(this.dp.viewDate, UTCDate(2011, 1, 28)); + datesEqual(this.dp.date, UTCDate(2011, 1, 28)); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'February 2011', 'Title is "February 2011"'); +}); + +test('Regression: by month (shift + left/right arrows); left from Mar 15, 2011 should go to Feb 15, 2011', function(){ + var target; + + this.input.val('15-03-2011').datepicker('update'); + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2011', 'Title is "March 2011"'); + datesEqual(this.dp.viewDate, UTCDate(2011, 2, 15)); + datesEqual(this.dp.date, UTCDate(2011, 2, 15)); + + // Navigation: -1 month, shift + left arrow key + this.input.trigger({ + type: 'keydown', + keyCode: 37, + shiftKey: true + }); + datesEqual(this.dp.viewDate, UTCDate(2011, 1, 15)); + datesEqual(this.dp.date, UTCDate(2011, 1, 15)); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'February 2011', 'Title is "February 2011"'); +}); diff --git a/public/bootstrap-datepicker/tests/suites/keyboard_navigation/2012.js b/public/bootstrap-datepicker/tests/suites/keyboard_navigation/2012.js new file mode 100644 index 0000000000..8d3fef215e --- /dev/null +++ b/public/bootstrap-datepicker/tests/suites/keyboard_navigation/2012.js @@ -0,0 +1,410 @@ +module('Keyboard Navigation 2012', { + setup: function(){ + /* + Tests start with picker on March 31, 2012. Fun facts: + + * February 1, 2012 was on a Wednesday + * February 29, 2012 was on a Wednesday + * March 1, 2012 was on a Thursday + * March 31, 2012 was on a Saturday + */ + this.input = $('') + .appendTo('#qunit-fixture') + .datepicker({format: "dd-mm-yyyy"}) + .focus(); // Activate for visibility checks + this.dp = this.input.data('datepicker') + this.picker = this.dp.picker; + }, + teardown: function(){ + this.picker.remove(); + } +}); + + +test('by day (right/left arrows)', function(){ + var target; + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2012', 'Title is "March 2012"'); + + // Navigation: -1 day, left arrow key + this.input.trigger({ + type: 'keydown', + keyCode: 37 + }); + // Both updated on keyboard navigation + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 30)); + datesEqual(this.dp.date, UTCDate(2012, 2, 30)); + // Month not changed + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2012', 'Title is "March 2012"'); + + // Navigation: +1 day, right arrow key + for (var i=0; i<2; i++) + this.input.trigger({ + type: 'keydown', + keyCode: 39 + }); + datesEqual(this.dp.viewDate, UTCDate(2012, 3, 1)); + datesEqual(this.dp.date, UTCDate(2012, 3, 1)); + // Month changed: April 1 (this is not a joke!) + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'April 2012', 'Title is "April 2012"'); +}); + +test('by week (up/down arrows)', function(){ + var target; + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2012', 'Title is "March 2012"'); + + // Navigation: -1 week, up arrow key + this.input.trigger({ + type: 'keydown', + keyCode: 38 + }); + // Both updated on keyboard navigation + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 24)); + datesEqual(this.dp.date, UTCDate(2012, 2, 24)); + // Month not changed + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2012', 'Title is "March 2012"'); + + // Navigation: +1 week, down arrow key + for (var i=0; i<2; i++) + this.input.trigger({ + type: 'keydown', + keyCode: 40 + }); + datesEqual(this.dp.viewDate, UTCDate(2012, 3, 7)); + datesEqual(this.dp.date, UTCDate(2012, 3, 7)); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'April 2012', 'Title is "April 2012"'); +}); + +test('by month, v1 (shift + left/right arrows)', function(){ + var target; + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2012', 'Title is "March 2012"'); + + // Navigation: -1 month, shift + left arrow key + this.input.trigger({ + type: 'keydown', + keyCode: 37, + shiftKey: true + }); + // Both updated on keyboard navigation, w/ graceful date ends + datesEqual(this.dp.viewDate, UTCDate(2012, 1, 29)); + datesEqual(this.dp.date, UTCDate(2012, 1, 29)); + // Month not changed + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'February 2012', 'Title is "February 2012"'); + + // Navigation: +1 month, shift + right arrow key + for (var i=0; i<2; i++) + this.input.trigger({ + type: 'keydown', + keyCode: 39, + shiftKey: true + }); + datesEqual(this.dp.viewDate, UTCDate(2012, 3, 29)); + datesEqual(this.dp.date, UTCDate(2012, 3, 29)); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'April 2012', 'Title is "April 2012"'); +}); + +test('by month, v2 (shift + up/down arrows)', function(){ + var target; + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2012', 'Title is "March 2012"'); + + // Navigation: -1 month, shift + up arrow key + this.input.trigger({ + type: 'keydown', + keyCode: 38, + shiftKey: true + }); + // Both updated on keyboard navigation, w/ graceful date ends + datesEqual(this.dp.viewDate, UTCDate(2012, 1, 29)); + datesEqual(this.dp.date, UTCDate(2012, 1, 29)); + // Month not changed + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'February 2012', 'Title is "February 2012"'); + + // Navigation: +1 month, shift + down arrow key + for (var i=0; i<2; i++) + this.input.trigger({ + type: 'keydown', + keyCode: 40, + shiftKey: true + }); + datesEqual(this.dp.viewDate, UTCDate(2012, 3, 29)); + datesEqual(this.dp.date, UTCDate(2012, 3, 29)); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'April 2012', 'Title is "April 2012"'); +}); + +test('by year, v1 (ctrl + left/right arrows)', function(){ + var target; + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2012', 'Title is "March 2012"'); + + // Navigation: -1 year, ctrl + left arrow key + this.input.trigger({ + type: 'keydown', + keyCode: 37, + ctrlKey: true + }); + // Both updated on keyboard navigation + datesEqual(this.dp.viewDate, UTCDate(2011, 2, 31)); + datesEqual(this.dp.date, UTCDate(2011, 2, 31)); + // Month not changed + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2011', 'Title is "March 2011"'); + + // Navigation: +1 year, ctrl + right arrow key + for (var i=0; i<2; i++) + this.input.trigger({ + type: 'keydown', + keyCode: 39, + ctrlKey: true + }); + datesEqual(this.dp.viewDate, UTCDate(2013, 2, 31)); + datesEqual(this.dp.date, UTCDate(2013, 2, 31)); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2013', 'Title is "March 2013"'); +}); + +test('by year, v2 (ctrl + up/down arrows)', function(){ + var target; + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2012', 'Title is "March 2012"'); + + // Navigation: -1 year, ctrl + up arrow key + this.input.trigger({ + type: 'keydown', + keyCode: 38, + ctrlKey: true + }); + // Both updated on keyboard navigation + datesEqual(this.dp.viewDate, UTCDate(2011, 2, 31)); + datesEqual(this.dp.date, UTCDate(2011, 2, 31)); + // Month not changed + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2011', 'Title is "March 2011"'); + + // Navigation: +1 year, ctrl + down arrow key + for (var i=0; i<2; i++) + this.input.trigger({ + type: 'keydown', + keyCode: 40, + ctrlKey: true + }); + datesEqual(this.dp.viewDate, UTCDate(2013, 2, 31)); + datesEqual(this.dp.date, UTCDate(2013, 2, 31)); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2013', 'Title is "March 2013"'); +}); + +test('by year, v3 (ctrl + shift + left/right arrows)', function(){ + var target; + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2012', 'Title is "March 2012"'); + + // Navigation: -1 year, ctrl + left arrow key + this.input.trigger({ + type: 'keydown', + keyCode: 37, + ctrlKey: true, + shiftKey: true + }); + // Both updated on keyboard navigation + datesEqual(this.dp.viewDate, UTCDate(2011, 2, 31)); + datesEqual(this.dp.date, UTCDate(2011, 2, 31)); + // Month not changed + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2011', 'Title is "March 2011"'); + + // Navigation: +1 year, ctrl + right arrow key + for (var i=0; i<2; i++) + this.input.trigger({ + type: 'keydown', + keyCode: 39, + ctrlKey: true, + shiftKey: true + }); + datesEqual(this.dp.viewDate, UTCDate(2013, 2, 31)); + datesEqual(this.dp.date, UTCDate(2013, 2, 31)); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2013', 'Title is "March 2013"'); +}); + +test('by year, v4 (ctrl + shift + up/down arrows)', function(){ + var target; + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2012', 'Title is "March 2012"'); + + // Navigation: -1 year, ctrl + up arrow key + this.input.trigger({ + type: 'keydown', + keyCode: 38, + ctrlKey: true, + shiftKey: true + }); + // Both updated on keyboard navigation + datesEqual(this.dp.viewDate, UTCDate(2011, 2, 31)); + datesEqual(this.dp.date, UTCDate(2011, 2, 31)); + // Month not changed + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2011', 'Title is "March 2011"'); + + // Navigation: +1 year, ctrl + down arrow key + for (var i=0; i<2; i++) + this.input.trigger({ + type: 'keydown', + keyCode: 40, + ctrlKey: true, + shiftKey: true + }); + datesEqual(this.dp.viewDate, UTCDate(2013, 2, 31)); + datesEqual(this.dp.date, UTCDate(2013, 2, 31)); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2013', 'Title is "March 2013"'); +}); + +test('by year, from leap day', function(){ + var target; + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + + this.input.val('29-02-2012').datepicker('update'); + datesEqual(this.dp.viewDate, UTCDate(2012, 1, 29)); + datesEqual(this.dp.date, UTCDate(2012, 1, 29)); + equal(target.text(), 'February 2012', 'Title is "February 2012"'); + + // Navigation: -1 year + this.input.trigger({ + type: 'keydown', + keyCode: 37, + ctrlKey: true + }); + // Both updated on keyboard navigation; graceful month-end + datesEqual(this.dp.viewDate, UTCDate(2011, 1, 28)); + datesEqual(this.dp.date, UTCDate(2011, 1, 28)); + // Month not changed + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'February 2011', 'Title is "February 2011"'); + + // Navigation: +1 year, back to leap year + this.input.trigger({ + type: 'keydown', + keyCode: 39, + ctrlKey: true + }); + // Both updated on keyboard navigation; graceful month-end + datesEqual(this.dp.viewDate, UTCDate(2012, 1, 28)); + datesEqual(this.dp.date, UTCDate(2012, 1, 28)); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'February 2012', 'Title is "February 2012"'); + + // Navigation: +1 year + this.input.trigger({ + type: 'keydown', + keyCode: 39, + ctrlKey: true + }); + // Both updated on keyboard navigation; graceful month-end + datesEqual(this.dp.viewDate, UTCDate(2013, 1, 28)); + datesEqual(this.dp.date, UTCDate(2013, 1, 28)); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'February 2013', 'Title is "February 2013"'); +}); + +test('Selection (enter)', function(){ + var target; + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2012', 'Title is "March 2012"'); + + // Navigation: -1 day, left arrow key + this.input.trigger({ + type: 'keydown', + keyCode: 37 + }); + // Both updated on keyboard navigation + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 30)); + datesEqual(this.dp.date, UTCDate(2012, 2, 30)); + // Month not changed + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2012', 'Title is "March 2012"'); + + // Selection: Enter + this.input.trigger({ + type: 'keydown', + keyCode: 13 + }); + // Both updated on keyboard navigation + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 30)); + datesEqual(this.dp.date, UTCDate(2012, 2, 30)); + // Month not changed + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2012', 'Title is "March 2012"'); + + ok(this.picker.is(':not(:visible)'), 'Picker is hidden'); +}); + +test('Toggle hide/show (escape); navigation while hidden is suppressed', function(){ + var target; + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + equal(target.text(), 'March 2012', 'Title is "March 2012"'); + + ok(this.picker.is(':visible'), 'Picker is visible'); + + // Hide + this.input.trigger({ + type: 'keydown', + keyCode: 27 + }); + + ok(this.picker.is(':not(:visible)'), 'Picker is hidden'); + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 31)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); + + // left arrow key, *doesn't* navigate + this.input.trigger({ + type: 'keydown', + keyCode: 37 + }); + + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 31)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); + + // Show + this.input.trigger({ + type: 'keydown', + keyCode: 27 + }); + + ok(this.picker.is(':visible'), 'Picker is visible'); + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 31)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); +}); + diff --git a/public/bootstrap-datepicker/tests/suites/keyboard_navigation/all.js b/public/bootstrap-datepicker/tests/suites/keyboard_navigation/all.js new file mode 100644 index 0000000000..6c00fd472c --- /dev/null +++ b/public/bootstrap-datepicker/tests/suites/keyboard_navigation/all.js @@ -0,0 +1,26 @@ +module('Keyboard Navigation (All)', { + setup: function(){ + this.input = $('') + .appendTo('#qunit-fixture') + .datepicker({format: "dd-mm-yyyy"}) + .focus(); // Activate for visibility checks + this.dp = this.input.data('datepicker') + this.picker = this.dp.picker; + }, + teardown: function(){ + this.picker.remove(); + } +}); + +test('TAB hides picker', function(){ + var target; + + ok(this.picker.is(':visible'), 'Picker is visible'); + + this.input.trigger({ + type: 'keydown', + keyCode: 9 + }); + + ok(this.picker.is(':not(:visible)'), 'Picker is hidden'); +}); diff --git a/public/bootstrap-datepicker/tests/suites/mouse_navigation/2011.js b/public/bootstrap-datepicker/tests/suites/mouse_navigation/2011.js new file mode 100644 index 0000000000..de461afd39 --- /dev/null +++ b/public/bootstrap-datepicker/tests/suites/mouse_navigation/2011.js @@ -0,0 +1,66 @@ +module('Mouse Navigation 2011', { + setup: function(){ + /* + Tests start with picker on March 31, 2011. + */ + this.input = $('') + .appendTo('#qunit-fixture') + .datepicker({format: "dd-mm-yyyy"}) + .focus(); // Activate for visibility checks + this.dp = this.input.data('datepicker') + this.picker = this.dp.picker; + }, + teardown: function(){ + this.picker.remove(); + } +}); + +test('Selecting date from previous month while in January changes month and year displayed', function(){ + var target; + + this.input.val('01-01-2011'); + this.dp.update(); + datesEqual(this.dp.viewDate, UTCDate(2011, 0, 1)) + datesEqual(this.dp.date, UTCDate(2011, 0, 1)) + + // Rendered correctly + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days tbody td:first'); + equal(target.text(), '26'); // Should be Dec 26 + equal(this.picker.find('.datepicker-days thead th.switch').text(), 'January 2011'); + + // Updated internally on click + target.click(); + equal(this.picker.find('.datepicker-days thead th.switch').text(), 'December 2010'); + datesEqual(this.dp.viewDate, UTCDate(2010, 11, 26)) + datesEqual(this.dp.date, UTCDate(2010, 11, 26)) + + // Re-rendered on click + target = this.picker.find('.datepicker-days tbody td:first'); + equal(target.text(), '28'); // Should be Nov 28 +}); + +test('Selecting date from next month while in December changes month and year displayed', function(){ + var target; + + this.input.val('01-12-2010'); + this.dp.update(); + datesEqual(this.dp.viewDate, UTCDate(2010, 11, 1)) + datesEqual(this.dp.date, UTCDate(2010, 11, 1)) + + // Rendered correctly + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days tbody td:last'); + equal(target.text(), '8'); // Should be Jan 8 + equal(this.picker.find('.datepicker-days thead th.switch').text(), 'December 2010'); + + // Updated internally on click + target.click(); + equal(this.picker.find('.datepicker-days thead th.switch').text(), 'January 2011'); + datesEqual(this.dp.viewDate, UTCDate(2011, 0, 8)) + datesEqual(this.dp.date, UTCDate(2011, 0, 8)) + + // Re-rendered on click + target = this.picker.find('.datepicker-days tbody td:first'); + equal(target.text(), '26'); // Should be Dec 26 +}); diff --git a/public/bootstrap-datepicker/tests/suites/mouse_navigation/2012.js b/public/bootstrap-datepicker/tests/suites/mouse_navigation/2012.js new file mode 100644 index 0000000000..25dfb1ae5e --- /dev/null +++ b/public/bootstrap-datepicker/tests/suites/mouse_navigation/2012.js @@ -0,0 +1,251 @@ +module('Mouse Navigation 2012', { + setup: function(){ + /* + Tests start with picker on March 31, 2012. Fun facts: + + * February 1, 2012 was on a Wednesday + * February 29, 2012 was on a Wednesday + * March 1, 2012 was on a Thursday + * March 31, 2012 was on a Saturday + */ + this.input = $('') + .appendTo('#qunit-fixture') + .datepicker({format: "dd-mm-yyyy"}) + .focus(); // Activate for visibility checks + this.dp = this.input.data('datepicker') + this.picker = this.dp.picker; + }, + teardown: function(){ + this.picker.remove(); + } +}); + +test('Selecting date resets viewDate and date', function(){ + var target; + + // Rendered correctly + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days tbody td:nth(7)'); + equal(target.text(), '4'); // Should be Mar 4 + + // Updated internally on click + target.click(); + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 4)) + datesEqual(this.dp.date, UTCDate(2012, 2, 4)) + + // Re-rendered on click + target = this.picker.find('.datepicker-days tbody td:first'); + equal(target.text(), '26'); // Should be Feb 29 +}); + +test('Navigating next/prev by month', function(){ + var target; + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.prev'); + ok(target.is(':visible'), 'Month:prev nav is visible'); + + // Updated internally on click + target.click(); + // Should handle month-length changes gracefully + datesEqual(this.dp.viewDate, UTCDate(2012, 1, 29)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); + + // Re-rendered on click + target = this.picker.find('.datepicker-days tbody td:first'); + equal(target.text(), '29'); // Should be Jan 29 + + target = this.picker.find('.datepicker-days thead th.next'); + ok(target.is(':visible'), 'Month:next nav is visible'); + + // Updated internally on click + target.click().click(); + // Graceful moonth-end handling carries over + datesEqual(this.dp.viewDate, UTCDate(2012, 3, 29)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); + + // Re-rendered on click + target = this.picker.find('.datepicker-days tbody td:first'); + equal(target.text(), '25'); // Should be Mar 25 + // (includes "old" days at start of month, even if that's all the first week-row consists of) +}); + +test('Navigating to/from year view', function(){ + var target; + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + ok(target.is(':visible'), 'View switcher is visible'); + + target.click(); + ok(this.picker.find('.datepicker-months').is(':visible'), 'Month picker is visible'); + equal(this.dp.viewMode, 1); + // Not modified when switching modes + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 31)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); + + // Change months to test internal state + target = this.picker.find('.datepicker-months tbody span:contains(Apr)'); + target.click(); + equal(this.dp.viewMode, 0); + // Only viewDate modified + datesEqual(this.dp.viewDate, UTCDate(2012, 3, 1)); // Apr 30 + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); +}); + +test('Navigating to/from decade view', function(){ + var target; + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + ok(target.is(':visible'), 'View switcher is visible'); + + target.click(); + ok(this.picker.find('.datepicker-months').is(':visible'), 'Month picker is visible'); + equal(this.dp.viewMode, 1); + // Not modified when switching modes + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 31)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); + + target = this.picker.find('.datepicker-months thead th.switch'); + ok(target.is(':visible'), 'View switcher is visible'); + + target.click(); + ok(this.picker.find('.datepicker-years').is(':visible'), 'Year picker is visible'); + equal(this.dp.viewMode, 2); + // Not modified when switching modes + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 31)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); + + // Change years to test internal state changes + target = this.picker.find('.datepicker-years tbody span:contains(2011)'); + target.click(); + equal(this.dp.viewMode, 1); + // Only viewDate modified + datesEqual(this.dp.viewDate, UTCDate(2011, 2, 1)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); + + target = this.picker.find('.datepicker-months tbody span:contains(Apr)'); + target.click(); + equal(this.dp.viewMode, 0); + // Only viewDate modified + datesEqual(this.dp.viewDate, UTCDate(2011, 3, 1)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); +}); + +test('Navigating prev/next in year view', function(){ + var target; + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + ok(target.is(':visible'), 'View switcher is visible'); + + target.click(); + ok(this.picker.find('.datepicker-months').is(':visible'), 'Month picker is visible'); + equal(this.dp.viewMode, 1); + equal(this.picker.find('.datepicker-months thead th.switch').text(), '2012'); + // Not modified when switching modes + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 31)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); + + // Go to next year (2013) + target = this.picker.find('.datepicker-months thead th.next'); + target.click(); + equal(this.picker.find('.datepicker-months thead th.switch').text(), '2013'); + // Only viewDate modified + datesEqual(this.dp.viewDate, UTCDate(2013, 2, 31)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); + + // Go to prev year (x2 == 2011) + target = this.picker.find('.datepicker-months thead th.prev'); + target.click().click(); + equal(this.picker.find('.datepicker-months thead th.switch').text(), '2011'); + // Only viewDate modified + datesEqual(this.dp.viewDate, UTCDate(2011, 2, 31)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); +}); + +test('Navigating prev/next in decade view', function(){ + var target; + + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days thead th.switch'); + ok(target.is(':visible'), 'View switcher is visible'); + + target.click(); + ok(this.picker.find('.datepicker-months').is(':visible'), 'Month picker is visible'); + equal(this.dp.viewMode, 1); + // Not modified when switching modes + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 31)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); + + target = this.picker.find('.datepicker-months thead th.switch'); + ok(target.is(':visible'), 'View switcher is visible'); + + target.click(); + ok(this.picker.find('.datepicker-years').is(':visible'), 'Year picker is visible'); + equal(this.dp.viewMode, 2); + equal(this.picker.find('.datepicker-years thead th.switch').text(), '2010-2019'); + // Not modified when switching modes + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 31)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); + + // Go to next decade (2020-29) + target = this.picker.find('.datepicker-years thead th.next'); + target.click(); + equal(this.picker.find('.datepicker-years thead th.switch').text(), '2020-2029'); + // Only viewDate modified + datesEqual(this.dp.viewDate, UTCDate(2022, 2, 31)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); + + // Go to prev year (x2 == 2000-09) + target = this.picker.find('.datepicker-years thead th.prev'); + target.click().click(); + equal(this.picker.find('.datepicker-years thead th.switch').text(), '2000-2009'); + // Only viewDate modified + datesEqual(this.dp.viewDate, UTCDate(2002, 2, 31)); + datesEqual(this.dp.date, UTCDate(2012, 2, 31)); +}); + +test('Selecting date from previous month resets viewDate and date, changing month displayed', function(){ + var target; + + // Rendered correctly + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days tbody td:first'); + equal(target.text(), '26'); // Should be Feb 26 + equal(this.picker.find('.datepicker-days thead th.switch').text(), 'March 2012'); + + // Updated internally on click + target.click(); + equal(this.picker.find('.datepicker-days thead th.switch').text(), 'February 2012'); + datesEqual(this.dp.viewDate, UTCDate(2012, 1, 26)) + datesEqual(this.dp.date, UTCDate(2012, 1, 26)) + + // Re-rendered on click + target = this.picker.find('.datepicker-days tbody td:first'); + equal(target.text(), '29'); // Should be Jan 29 +}); + +test('Selecting date from next month resets viewDate and date, changing month displayed', function(){ + var target; + + this.input.val('01-04-2012'); + this.dp.update(); + + // Rendered correctly + equal(this.dp.viewMode, 0); + target = this.picker.find('.datepicker-days tbody td:last'); + equal(target.text(), '5'); // Should be May 5 + equal(this.picker.find('.datepicker-days thead th.switch').text(), 'April 2012'); + + // Updated internally on click + target.click(); + equal(this.picker.find('.datepicker-days thead th.switch').text(), 'May 2012'); + datesEqual(this.dp.viewDate, UTCDate(2012, 4, 5)) + datesEqual(this.dp.date, UTCDate(2012, 4, 5)) + + // Re-rendered on click + target = this.picker.find('.datepicker-days tbody td:first'); + equal(target.text(), '29'); // Should be Apr 29 +}); diff --git a/public/bootstrap-datepicker/tests/suites/mouse_navigation/all.js b/public/bootstrap-datepicker/tests/suites/mouse_navigation/all.js new file mode 100644 index 0000000000..0dc7502f7f --- /dev/null +++ b/public/bootstrap-datepicker/tests/suites/mouse_navigation/all.js @@ -0,0 +1,33 @@ +module('Mouse Navigation (All)', { + setup: function(){ + this.input = $('') + .appendTo('#qunit-fixture') + .datepicker({format: "dd-mm-yyyy"}) + .focus(); // Activate for visibility checks + this.dp = this.input.data('datepicker') + this.picker = this.dp.picker; + }, + teardown: function(){ + this.picker.remove(); + } +}); + +test('Clicking datepicker does not hide datepicker', function(){ + ok(this.picker.is(':visible'), 'Picker is visible'); + this.picker.trigger('mousedown'); + ok(this.picker.is(':visible'), 'Picker is still visible'); +}); + +test('Clicking outside datepicker hides datepicker', function(){ + var $otherelement = $('
    '); + $('body').append($otherelement); + + ok(this.picker.is(':visible'), 'Picker is visible'); + this.input.trigger('click'); + ok(this.picker.is(':visible'), 'Picker is still visible'); + + $otherelement.trigger('mousedown'); + ok(this.picker.is(':not(:visible)'), 'Picker is hidden'); + + $otherelement.remove(); +}); diff --git a/public/bootstrap-datepicker/tests/suites/options.js b/public/bootstrap-datepicker/tests/suites/options.js new file mode 100644 index 0000000000..2cb33b9792 --- /dev/null +++ b/public/bootstrap-datepicker/tests/suites/options.js @@ -0,0 +1,285 @@ +module('Options', { + setup: function(){}, + teardown: function(){ + return + $('#qunit-fixture *').each(function(){ + var t = $(this); + if ('datepicker' in t.data()) + t.data('datepicker').picker.remove(); + }); + } +}); + +test('Autoclose', function(){ + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05') + .datepicker({ + format: 'yyyy-mm-dd', + autoclose: true + }), + dp = input.data('datepicker'), + picker = dp.picker, + target; + + + input.focus(); + ok(picker.is(':visible'), 'Picker is visible'); + target = picker.find('.datepicker-days tbody td:nth(7)'); + equal(target.text(), '4'); // Mar 4 + + target.click(); + ok(picker.is(':not(:visible)'), 'Picker is hidden'); + datesEqual(dp.date, UTCDate(2012, 2, 4)); + datesEqual(dp.viewDate, UTCDate(2012, 2, 4)); +}); + +test('Startview: year view (integer)', function(){ + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05') + .datepicker({ + format: 'yyyy-mm-dd', + startView: 1 + }), + dp = input.data('datepicker'), + picker = dp.picker, + target; + + input.focus(); + ok(picker.find('.datepicker-days').is(':not(:visible)'), 'Days view hidden'); + ok(picker.find('.datepicker-months').is(':visible'), 'Months view visible'); + ok(picker.find('.datepicker-years').is(':not(:visible)'), 'Years view hidden'); +}); + +test('Startview: year view (string)', function(){ + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05') + .datepicker({ + format: 'yyyy-mm-dd', + startView: 'year' + }), + dp = input.data('datepicker'), + picker = dp.picker, + target; + + input.focus(); + ok(picker.find('.datepicker-days').is(':not(:visible)'), 'Days view hidden'); + ok(picker.find('.datepicker-months').is(':visible'), 'Months view visible'); + ok(picker.find('.datepicker-years').is(':not(:visible)'), 'Years view hidden'); +}); + +test('Startview: decade view (integer)', function(){ + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05') + .datepicker({ + format: 'yyyy-mm-dd', + startView: 2 + }), + dp = input.data('datepicker'), + picker = dp.picker, + target; + + input.focus(); + ok(picker.find('.datepicker-days').is(':not(:visible)'), 'Days view hidden'); + ok(picker.find('.datepicker-months').is(':not(:visible)'), 'Months view hidden'); + ok(picker.find('.datepicker-years').is(':visible'), 'Years view visible'); +}); + +test('Startview: decade view (string)', function(){ + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05') + .datepicker({ + format: 'yyyy-mm-dd', + startView: 'decade' + }), + dp = input.data('datepicker'), + picker = dp.picker, + target; + + input.focus(); + ok(picker.find('.datepicker-days').is(':not(:visible)'), 'Days view hidden'); + ok(picker.find('.datepicker-months').is(':not(:visible)'), 'Months view hidden'); + ok(picker.find('.datepicker-years').is(':visible'), 'Years view visible'); +}); + +test('Today Button: today button not default', function(){ + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05') + .datepicker({ + format: 'yyyy-mm-dd' + }), + dp = input.data('datepicker'), + picker = dp.picker, + target; + + input.focus(); + ok(picker.find('.datepicker-days').is(':visible'), 'Days view visible'); + ok(picker.find('.datepicker-days tfoot .today').is(':not(:visible)'), 'Today button not visible'); +}); + +test('Today Button: today visibility when enabled', function(){ + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05') + .datepicker({ + format: 'yyyy-mm-dd', + todayBtn: true + }), + dp = input.data('datepicker'), + picker = dp.picker, + target; + + input.focus(); + ok(picker.find('.datepicker-days').is(':visible'), 'Days view visible'); + ok(picker.find('.datepicker-days tfoot .today').is(':visible'), 'Today button visible'); + + picker.find('.datepicker-days thead th.switch').click(); + ok(picker.find('.datepicker-months').is(':visible'), 'Months view visible'); + ok(picker.find('.datepicker-months tfoot .today').is(':visible'), 'Today button visible'); + + picker.find('.datepicker-months thead th.switch').click(); + ok(picker.find('.datepicker-years').is(':visible'), 'Years view visible'); + ok(picker.find('.datepicker-years tfoot .today').is(':visible'), 'Today button visible'); +}); + +test('Today Button: data-api', function(){ + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05') + .datepicker({ + format: 'yyyy-mm-dd' + }), + dp = input.data('datepicker'), + picker = dp.picker, + target; + + input.focus(); + ok(picker.find('.datepicker-days').is(':visible'), 'Days view visible'); + ok(picker.find('.datepicker-days tfoot .today').is(':visible'), 'Today button visible'); +}); + +test('Today Button: moves to today\'s date', function(){ + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05') + .datepicker({ + format: 'yyyy-mm-dd', + todayBtn: true + }), + dp = input.data('datepicker'), + picker = dp.picker, + target; + + input.focus(); + ok(picker.find('.datepicker-days').is(':visible'), 'Days view visible'); + ok(picker.find('.datepicker-days tfoot .today').is(':visible'), 'Today button visible'); + + target = picker.find('.datepicker-days tfoot .today'); + target.click(); + + var d = new Date(), + today = UTCDate(d.getFullYear(), d.getMonth(), d.getDate()); + datesEqual(dp.viewDate, today); + datesEqual(dp.date, UTCDate(2012, 2, 5)); +}); + +test('Today Button: "linked" selects today\'s date', function(){ + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05') + .datepicker({ + format: 'yyyy-mm-dd', + todayBtn: "linked" + }), + dp = input.data('datepicker'), + picker = dp.picker, + target; + + input.focus(); + ok(picker.find('.datepicker-days').is(':visible'), 'Days view visible'); + ok(picker.find('.datepicker-days tfoot .today').is(':visible'), 'Today button visible'); + + target = picker.find('.datepicker-days tfoot .today'); + target.click(); + + var d = new Date(), + today = UTCDate(d.getFullYear(), d.getMonth(), d.getDate()); + datesEqual(dp.viewDate, today); + datesEqual(dp.date, today); +}); + +test('Today Highlight: today\'s date is not highlighted by default', patch_date(function(Date){ + Date.now = UTCDate(2012, 2, 15); + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05') + .datepicker({ + format: 'yyyy-mm-dd' + }), + dp = input.data('datepicker'), + picker = dp.picker, + target; + + input.focus(); + ok(picker.find('.datepicker-days').is(':visible'), 'Days view visible'); + equal(picker.find('.datepicker-days thead .switch').text(), 'March 2012', 'Title is "March 2012"'); + + target = picker.find('.datepicker-days tbody td:contains(15)'); + ok(!target.hasClass('today'), 'Today is not marked with "today" class'); + target = picker.find('.datepicker-days tbody td:contains(14)'); + ok(!target.hasClass('today'), 'Yesterday is not marked with "today" class'); + target = picker.find('.datepicker-days tbody td:contains(16)'); + ok(!target.hasClass('today'), 'Tomorrow is not marked with "today" class'); +})); + +test('Today Highlight: today\'s date is highlighted when not active', patch_date(function(Date){ + Date.now = new Date(2012, 2, 15); + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05') + .datepicker({ + format: 'yyyy-mm-dd', + todayHighlight: true + }), + dp = input.data('datepicker'), + picker = dp.picker, + target; + + input.focus(); + ok(picker.find('.datepicker-days').is(':visible'), 'Days view visible'); + equal(picker.find('.datepicker-days thead .switch').text(), 'March 2012', 'Title is "March 2012"'); + + target = picker.find('.datepicker-days tbody td:contains(15)'); + ok(target.hasClass('today'), 'Today is marked with "today" class'); + target = picker.find('.datepicker-days tbody td:contains(14)'); + ok(!target.hasClass('today'), 'Yesterday is not marked with "today" class'); + target = picker.find('.datepicker-days tbody td:contains(16)'); + ok(!target.hasClass('today'), 'Tomorrow is not marked with "today" class'); +})); + +test('DaysOfWeekDisabled', function(){ + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-10-26') + .datepicker({ + format: 'yyyy-mm-dd', + daysOfWeekDisabled: '1,5' + }), + dp = input.data('datepicker'), + picker = dp.picker, + target; + + + input.focus(); + target = picker.find('.datepicker-days tbody td:nth(22)'); + ok(target.hasClass('disabled'), 'Day of week is disabled'); + target = picker.find('.datepicker-days tbody td:nth(24)'); + ok(!target.hasClass('disabled'), 'Day of week is enabled'); + target = picker.find('.datepicker-days tbody td:nth(26)'); + ok(target.hasClass('disabled'), 'Day of week is disabled'); +}); diff --git a/public/bootstrap-datepicker/tests/tests.html b/public/bootstrap-datepicker/tests/tests.html new file mode 100644 index 0000000000..bab4d9a702 --- /dev/null +++ b/public/bootstrap-datepicker/tests/tests.html @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    bootstrap-datepicker

    +

    +
    +

    +
      +
      + + \ No newline at end of file diff --git a/public/vendor/bootstrap-datepicker b/public/vendor/bootstrap-datepicker new file mode 160000 index 0000000000..3f12c74bcd --- /dev/null +++ b/public/vendor/bootstrap-datepicker @@ -0,0 +1 @@ +Subproject commit 3f12c74bcd5a0d6763951ce14450c8727b661bc9 diff --git a/src/app/browser.coffee b/src/app/browser.coffee index 0c853fa8cf..716743e47d 100644 --- a/src/app/browser.coffee +++ b/src/app/browser.coffee @@ -15,6 +15,7 @@ module.exports.resetDom = (model) -> window.DERBY.app.dom.clear() restoreRefs(model) window.DERBY.app.view.render(model) + $('.datepicker').datepicker(); module.exports.app = (appExports, model) -> loadJavaScripts(model) @@ -22,6 +23,7 @@ module.exports.app = (appExports, model) -> setupTooltips(model) setupTour(model) setupGrowlNotifications(model) unless model.get('_view.mobileDevice') + $('.datepicker').datepicker(); ### Loads JavaScript files from (1) public/js/* and (2) external sources @@ -37,6 +39,7 @@ loadJavaScripts = (model) -> require '../../public/js/bootstrap.min' #http://twitter.github.com/bootstrap/assets/js/bootstrap.min.js require '../../public/js/jquery.cookie' #https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js require '../../public/js/bootstrap-tour' #https://raw.github.com/pushly/bootstrap-tour/master/bootstrap-tour.js + require '../../public/vendor/bootstrap-datepicker/js/bootstrap-datepicker' require '../../public/js/jquery.bootstrap-growl.min' # JS files not needed right away (google charts) or entirely optional (analytics) diff --git a/views/app/index.html b/views/app/index.html index e0699eeec1..a7f9d6013f 100644 --- a/views/app/index.html +++ b/views/app/index.html @@ -13,6 +13,7 @@ do a find for the string after "→" + {#if _loggedIn} @@ -622,7 +623,7 @@ do a find for the string after "→" {#if _user.flags.enableDueDates}
      - +
      {/} {/}