Compare commits

...

95 Commits

Author SHA1 Message Date
REJack
e0670bb49c prep version 2019-08-14 13:17:23 +02:00
REJack
1ccb77f77a removed bootstrap-timepicker from package.json
(due it doesn't deliver dist files via bower/npm)
2019-08-14 13:09:21 +02:00
REJack
0261303218 updated bower components
- removed bootstrap-timepicker from bower.json (due it doesn't deliver dist files via bower/npm)
- updated fullcalendar to 3.10.1
- updated raphael to 2.3.0
2019-08-14 13:08:57 +02:00
REJack
b0416228a4 prep version 2019-08-13 08:57:25 +02:00
REJack
7b6e000dc6 fixed control-sidebar slide option
- renamed `slide` to `controlsidebarSlide` to avoid bootstrap js error
- reworked js to get slide false working without transition
- added .control-sidebar-hold-transition
2019-08-11 14:02:35 +02:00
REJack
d3a213afda updated bootstrap-slider to 10.6.2 (according to docs & package.json)
- updated bower.json
- updated package.json & package-lock.json
- added slider color options in build/less/miscellaneous.less
- updated bower_components
- updated pages/UI/sliders.html
- updated plugins files
2019-08-11 10:57:32 +02:00
REJack
3e4b0cdcb7 prep version to v2.4.16-pre 2019-08-09 13:42:32 +02:00
REJack
a3b070f1f9 updated npm devDependencies to reduce audit's
- updated Gruntfile.js
- rebuild dist files
2019-08-09 13:40:20 +02:00
REJack
d38b8fe970 updated bower.json 2019-08-09 13:38:43 +02:00
REJack
785cd511fd updated bower components
- updated bootstrap-datepicker to 1.9.0
- updated chart.js to 1.1.1
- updated ckeditor to 4.12.1
- updated jquery to 3.4.1
- updated raphael to 2.2.7
- updated select2 to 4.0.8
2019-08-09 13:38:10 +02:00
Raphael Jackstadt
239be16dac Merge pull request #2192 from philip/patch-1
Remove changelog.md link
2019-08-07 10:28:37 +02:00
Raphael Jackstadt
643d3e56f0 Merge pull request #2175 from phansys/semver
Trust semver constraints at `package.json` and `bower.json`
2019-08-07 10:28:12 +02:00
Philip Olson
76251ebd5e Remove changelog.md link
This file (changelog.md) no longer appears active; removing reference from README.md
2019-08-02 10:21:10 -07:00
Javier Spagnoletti
054c1f6936 Trust semver constraints at package.json and bower.json 2019-07-18 14:44:39 -03:00
Raphael Jackstadt
94aeea7ea7 Merge pull request #2174 from phansys/travis
Build on Travis CI
2019-07-18 12:35:53 +02:00
Javier Spagnoletti
72d14332eb Build on Travis CI 2019-07-17 11:52:40 -03:00
REJack
78d0c11374 bump version 2019-07-16 17:40:03 +02:00
REJack
7a2364e507 a simple try to fix ENOTFOUND Package @dev not found error 2019-07-16 17:17:54 +02:00
REJack
c3dc529221 bump version 2019-07-16 14:48:50 +02:00
REJack
d61cbbd627 fixed content-wrapper height calculation if footer isn't there 2019-07-16 14:45:30 +02:00
REJack
6c711a05ef prep version
- changes version to 2.4.13
- updated package.json
- updated build/less/AdminLTE.less & AdminLTE-without-plugins.less
- rebuilt dist files
- updated version in demo pages
2019-07-15 19:36:15 +02:00
REJack
6a5fa5a9d9 fixed collapsed sidebar-menu's sub menu indicator(angle) on hover 2019-07-15 19:20:45 +02:00
REJack
fd7ef956a0 rebuild dist js files 2019-07-15 19:17:28 +02:00
REJack
74315469c4 added .hidden-xs to .box-tools searchbar to avoid overlapping 2019-07-15 18:48:15 +02:00
REJack
e7f1f77dce added ability to use brand-logo with text instead of only a text logo 2019-07-15 18:42:23 +02:00
REJack
737f1c4ae5 added ability to use img logo instead of text logo 2019-07-15 18:10:26 +02:00
REJack
c9ae045e25 changed bootstrap-slider from * to @dev to avoid minimum-stability error 2019-07-11 15:53:16 +02:00
REJack
97348104dd added parent height:auto on tree expand to avoid child overlapping 2019-07-11 14:30:56 +02:00
REJack
b9efcc0f98 added asset packagist to composer.json 2019-07-11 13:39:56 +02:00
REJack
33ecce7207 changed content-wrapper calc() from % to vh & added content-wrapper calc() with collapsed header 2019-07-10 20:38:45 +02:00
REJack
b90ae59dc1 added ability to use fontawesome 5 icon on sidebar-toggle 2019-07-10 19:41:21 +02:00
REJack
639fa9e923 fixed multilevel collapse for child treeview menu 2019-07-09 13:17:28 +02:00
REJack
070193e486 updated select2 to latest version (v4.0.7) 2019-07-08 19:24:08 +02:00
REJack
9b29fa6cf0 prep version to v2.4.13-pre inside demo files 2019-07-08 13:40:53 +02:00
REJack
a1734eabda fixed scroll top bug in fixed layout mode 2019-07-08 13:37:49 +02:00
REJack
f6a5d05c90 prep version to v2.4.13-pre 2019-07-08 13:35:22 +02:00
Aigars Silkalns
b1edd9eaf8 Updated footer info
Updated version info in the footer and changed copyright text to the current one.
2019-06-18 15:15:46 +03:00
REJack
7309e2e5d5 bump version 2019-06-11 13:52:23 +02:00
REJack
af70f05345 added height auto to .login-page & .register-page 2019-06-11 12:14:18 +02:00
REJack
90b65eac6d bump version to v2.4.12-pre 2019-06-11 12:13:34 +02:00
REJack
340bbbaf93 fixed strange navigation menu behavior + dark space on reloads (#2126)
- changed height: 0px to height: auto for uk.treeview-menu to fix not smooth treeview closing
- fixed .content-wrapper calc, it returned -2% before
- changed order of js file generation
- rebuild dist files
2019-06-11 11:59:05 +02:00
REJack
67044517c3 fixed npm audit error 2019-06-11 11:53:48 +02:00
REJack
445a9c3e83 updated README.md
- changed github links to ColorlibHQ
- removed Donations part
2019-06-06 13:50:39 +02:00
REJack
7dda778f61 updated copyright in css & js files
- updated repository url in package.json
- updated copyright infos for js in Gruntfile.js
- updated copyright infos for css in AdminLTE.less & AdminLTE-without-plugins.less
- rebuild dist files
2019-06-06 11:32:52 +02:00
REJack
b2e020413d fixed sidebar menu tree dropdown always open
- added code from #2001 thanks @CoderSquirrel

Closes #1854 & #2001
2019-06-06 11:07:56 +02:00
REJack
2226c0e7cf fixed drag and drop breaking adminlte's design
- updated ControlSidebar.js to hide control sidebar instead of only moving it
- updated dashboard.js to use containment in sortable()
- added display none to control sidebar content in index.html

(Closes #1924)
2019-06-06 10:59:10 +02:00
REJack
3254b3b60f fixed missing time in "Date and time range" picker
Closes #2027
2019-06-06 10:05:15 +02:00
REJack
6f953ee8da updated dist files 2019-06-05 14:20:04 +02:00
REJack
b4fa509976 fixed ionicons path in docs (closes #2044) 2019-05-22 11:07:13 +02:00
REJack
c6720a8790 changed hr border color to @gray instead of @gray-lighter 2019-05-21 20:50:51 +02:00
REJack
c7509cfe70 package.json prep for v2.4.11 2019-05-21 19:02:47 +02:00
REJack
054c89ea53 changed min-height to calc in .content-wrapper 2019-05-21 12:34:52 +02:00
Aigars Silkalns
19113c3cbc Merge pull request #2093 from Imbuzi/patch-1
Update adminlte.js
2019-04-10 17:36:47 +03:00
Nicolas Bourasseau
17f46f4eca Update adminlte.js
Fixing bug throwing error "Uncaught ReferenceError: expandingEvent is not defined" when collapsing .box .
2019-04-10 16:34:28 +02:00
Aigars Silkalns
1d943023e3 Merge pull request #2091 from yohaneslumentut/skin-black-light-fixing
Fix layout skin-black-light height inconsistence
2019-04-08 13:48:39 +03:00
Yohanes Lumentut
4b9b563f42 Fix layout skin-black-light height inconsistence 2019-04-06 23:44:17 +07:00
Aigars Silkalns
bf86dc34e2 Merge pull request #2067 from Lowhearth/treeview-expand
Treeview expand
2019-03-24 19:43:28 +02:00
Aigars Silkalns
100a35f3ce Merge pull request #2076 from hirayama-onagigawa-computing/fix_box_widget_collapsing
Fix typo which breaks BoxWidget collapsing.
2019-03-24 19:42:50 +02:00
平山 度
998a1ff4be Fix typo which breaks BoxWidget collapsing. 2019-03-15 17:33:15 +09:00
Abdullah Almsaeed
4672183ea0 Bump version 2019-03-11 14:01:44 -04:00
Abdullah Almsaeed
4325d22a47 Allow zip file to include HTML and plugin files 2019-03-11 14:00:11 -04:00
Daniel Vilanova Yamuza
f8fe281c43 Fixed formatting 2019-02-24 15:23:09 +01:00
Daniel Vilanova Yamuza
68834fc648 Now the collapse and expand event are triggered after the event loop, Fixes #2019 2019-02-24 15:16:53 +01:00
Abdullah Almsaeed
f0edf90f88 Bump version 2019-02-18 07:29:19 -05:00
Abdullah Almsaeed
661398920d Upgrade bootstrap to 3.4.1 2019-02-18 07:28:41 -05:00
tbaragao
da1ec8ee33 Add Collapsing, Expanding and Removing Events (#2024)
Add Collapsing, Expanding and Removing Events
2019-01-31 13:10:32 -05:00
zacks
e691c465e3 add gitattributes (#2017)
* build(composer): add archive

* chore(gitattributes): add .gitattributes
2019-01-31 13:09:33 -05:00
Kevin Papst
5c3bc4e6a6 added Symfony 4 compatible AdminLTE bundle (#2012) 2019-01-31 13:08:39 -05:00
Evan Pratten
659d1eb18a Update index.html (#2006) 2019-01-31 13:08:10 -05:00
Olda Horák
cbda6b5c3b fix for issue #1976 (#1981)
* issue1976

* issue1976_grunt_js
2019-01-31 13:05:10 -05:00
kasarla shirisha
113a3b4c8e #1947 fixed content-wrapper height (#1948)
* fixed content-wrapper height

* updated content wrapper height
2018-08-22 14:40:03 -04:00
Abdullah Almsaeed
d9e6830184 Fix #1864 2018-07-15 14:48:11 -04:00
Abdullah Almsaeed
059c74fe83 Compile for production 2018-07-15 11:12:52 -04:00
Abdullah Almsaeed
b50004f17c Fix #1616 2018-07-15 11:11:21 -04:00
Abdullah Almsaeed
d04c596dc0 Compile for production 2018-07-15 11:03:30 -04:00
hendimarcos
43b92296a2 fix(skins): ISSUE 1925 - black layout, but font logo on the top is blue. (#1926)
https://github.com/almasaeed2010/AdminLTE/issues/1925
2018-07-15 11:00:33 -04:00
Abdullah Almsaeed
89d24bd778 bump version 2018-07-14 17:47:25 -04:00
Abdullah Almsaeed
c618c2814f Merge #1847 2018-07-14 17:40:00 -04:00
OKAZAKI EITARO
1339932caa Fixed an issue where height becomes NaN when there is no main-header (#1847) 2018-07-14 17:39:38 -04:00
Filip Chalupa
2de87c8ab8 Update npmignore: don't ignore bower_components (#1784)
- without them the npm package is crippled

- it's hard to import admin-lte less files since many of them reference missing bower_components
2018-07-14 17:38:59 -04:00
Abdullah Almsaeed
eb9098c2c8 Merge #1756 2018-07-14 17:37:49 -04:00
Abdullah Almsaeed
60eb217689 Merge branch 'master' of https://github.com/almasaeed2010/AdminLTE 2018-07-14 17:32:49 -04:00
Abdullah Almsaeed
5a4e022541 Merge 2018-07-14 17:32:34 -04:00
Kyle Spearrin
58ef2125b6 fix control sidebar top padding (#1525) 2018-07-14 17:30:00 -04:00
Abdullah Almsaeed
4215f97f7a Bump version 2018-07-14 17:14:30 -04:00
Abdullah Almsaeed
9baf70fde2 Update version 2018-07-14 17:12:36 -04:00
Abdullah Almsaeed
8ee5087b13 Run bower update 2018-07-14 17:11:55 -04:00
Farid Inawan
78a4398dde Update Timepicker (#1354)
With the new one, the widget is not hidden in scrolling container
2018-07-14 17:04:14 -04:00
Ivan
e38376ec15 Fixed multilevel menu inconguence on opening/closing (#1817) 2018-05-05 18:10:33 -04:00
Abdullah Almsaeed
79057e15c1 Fix issue #1842 2018-04-08 09:32:26 -04:00
Abdullah Almsaeed
17dee622be Bump version in package.json 2018-03-17 13:07:06 -04:00
Abdullah Almsaeed
342c3cc865 Update dependencies 2018-03-17 13:06:37 -04:00
Abdullah Almsaeed
88acf9c14f Fix composer versioning error 2018-02-04 08:53:33 -05:00
Abdullah Almsaeed
0e5b536102 Fix composer jquery conflict issue #1741 2018-02-04 08:52:33 -05:00
Alexander Wunschik
9431039bf5 replaced boxed-bg images with static color 2017-06-06 10:51:25 +02:00
2067 changed files with 149045 additions and 98416 deletions

5
.gitattributes vendored Normal file
View File

@@ -0,0 +1,5 @@
* text=auto
/.github export-ignore
.gitattributes export-ignore
.gitignore export-ignore

View File

@@ -1,3 +1,2 @@
bower_components/
documentation/
composer.json
composer.json

24
.travis.yml Normal file
View File

@@ -0,0 +1,24 @@
language: node_js
node_js:
- 8
- 9
- 10
- 11
- 12
env:
- INSTALL=bower
- INSTALL=yarn
- INSTALL=npm
matrix:
fast_finish: true
install:
- if [ "bower" == $INSTALL ]; then yarn global add bower && bower install; fi
- if [ "yarn" == $INSTALL ]; then yarn install; fi
- if [ "npm" == $INSTALL ]; then npm install; fi
script:
- echo 'Tests must be configured'

View File

@@ -112,8 +112,10 @@ module.exports = function (grunt) { // jshint ignore:line
// Uglify task info. Compress the js files.
uglify: {
options : {
mangle : true,
preserveComments: 'some'
mangle : true,
output: {
comments: 'some'
},
},
production: {
files: {
@@ -132,9 +134,8 @@ module.exports = function (grunt) { // jshint ignore:line
+ '* should be included in all pages. It controls some layout\n'
+ '* options and implements exclusive AdminLTE plugins.\n'
+ '*\n'
+ '* @Author Almsaeed Studio\n'
+ '* @Support <https://www.almsaeedstudio.com>\n'
+ '* @Email <abdullah@almsaeedstudio.com>\n'
+ '* @author Colorlib\n'
+ '* @support <https://github.com/ColorlibHQ/AdminLTE/issues>\n'
+ '* @version <%= pkg.version %>\n'
+ '* @repository <%= pkg.repository.url %>\n'
+ '* @license MIT <http://opensource.org/licenses/MIT>\n'
@@ -150,10 +151,10 @@ module.exports = function (grunt) { // jshint ignore:line
'build/js/BoxWidget.js',
'build/js/ControlSidebar.js',
'build/js/DirectChat.js',
'build/js/Layout.js',
'build/js/PushMenu.js',
'build/js/TodoList.js',
'build/js/Tree.js'
'build/js/Tree.js',
'build/js/Layout.js',
],
dest: 'dist/js/adminlte.js'
}

View File

@@ -1,6 +1,7 @@
Introduction
============
[![Build Status](https://img.shields.io/travis/ColorlibHQ/AdminLTE.svg)](https://travis-ci.org/ColorlibHQ/AdminLTE)
![Bower version](https://img.shields.io/bower/v/adminlte.svg)
[![npm version](https://img.shields.io/npm/v/admin-lte.svg)](https://www.npmjs.com/package/admin-lte)
[![Packagist](https://img.shields.io/packagist/v/almasaeed2010/adminlte.svg)](https://packagist.org/packages/almasaeed2010/adminlte)
@@ -39,10 +40,10 @@ AdminLTE is an open source project by [AdminLTE.IO](https://adminlte.io) that is
reserves the right to change the license of future releases. Wondering what you can or can't do? View the [license guide](https://adminlte.io/docs/license).
### Legacy Releases
AdminLTE 1.x can be easily upgraded to 2.x using [this guide](https://adminlte.io/themes/AdminLTE/documentation/index.html#upgrade), but if you intend to keep using AdminLTE 1.x, you can download the latest release from the [releases](https://github.com/almasaeed2010/AdminLTE/releases) section above.
AdminLTE 1.x can be easily upgraded to 2.x using [this guide](https://adminlte.io/themes/AdminLTE/documentation/index.html#upgrade), but if you intend to keep using AdminLTE 1.x, you can download the latest release from the [releases](https://github.com/ColorlibHQ/AdminLTE/releases) section above.
### Change log
**For the most recent change log, visit the [releases page](https://github.com/almasaeed2010/AdminLTE/releases) or the [changelog file](https://github.com/almasaeed2010/AdminLTE/blob/master/changelog.md).** We will add detailed release notes to each new release.
**For the most recent change log, visit the [releases page](https://github.com/ColorlibHQ/AdminLTE/releases).** We will add detailed release notes to each new release.
### Image Credits
- [Pixeden](http://www.pixeden.com/psd-web-elements/flat-responsive-showcase-psd)
@@ -50,8 +51,3 @@ AdminLTE 1.x can be easily upgraded to 2.x using [this guide](https://adminlte.i
- [Pickaface](http://pickaface.net/)
- [Unsplash](https://unsplash.com/)
- [Uifaces](http://uifaces.com/)
### Donations
Donations are **greatly appreciated!**
[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif "AdminLTE Presentation")](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=629XCUSXBHCBC "Donate")

View File

@@ -31,35 +31,34 @@
"documentation"
],
"dependencies": {
"bootstrap-slider": "*",
"chart.js": "1.0.*",
"ckeditor": "^4.7.0",
"chart.js": "^1.0",
"ckeditor": "^4.7",
"bootstrap-colorpicker": "^2.5.1",
"bootstrap": "^3.3.7",
"jquery": "^3.2.1",
"bootstrap": "^3.4",
"jquery": "^3.4.1",
"datatables.net": "^1.10.15",
"datatables.net-bs": "^2.1.1",
"bootstrap-datepicker": "^1.7.0",
"bootstrap-datepicker": "^1.7",
"bootstrap-daterangepicker": "^2.1.25",
"moment": "^2.18.1",
"fastclick": "^1.0.6",
"Flot": "flot#^0.8.3",
"fullcalendar": "^3.4.0",
"fullcalendar": "^3.4",
"inputmask": "jquery.inputmask#^3.3.7",
"ion.rangeSlider": "ionrangeslider#^2.2.0",
"jvectormap": "^2.0.4",
"ion.rangeSlider": "ionrangeslider#^2.2",
"jvectormap": "^1.2.2",
"jquery-knob": "^1.2.13",
"morris.js": "^0.5.1",
"PACE": "pace#^1.0.2",
"select2": "^4.0.3",
"select2": "^4.0.7",
"jquery-slimscroll": "slimscroll#^1.3.8",
"bootstrap-timepicker": "^0.5.2",
"jquery-sparkline": "^2.1.3",
"font-awesome": "^4.7.0",
"font-awesome": "^4.7",
"Ionicons": "ionicons#^2.0.1",
"jquery-ui": "1.11.4"
"jquery-ui": "1.11.4",
"seiyria-bootstrap-slider": "^10.6.2"
},
"resolutions": {
"jquery": "^3.2.1"
"jquery": "^3.4.1"
}
}

View File

@@ -1,29 +1,12 @@
{
"name": "bootstrap-colorpicker",
"main": [
"dist/css/bootstrap-colorpicker.css",
"dist/js/bootstrap-colorpicker.js"
],
"dependencies": {
"jquery": ">=1.10"
},
"ignore": [
"\\.*",
"/index.html",
"/package.json",
"/composer.json",
"/Gruntfile.js",
"/.travis.yml",
"/travis.sh",
"/server.js"
],
"homepage": "https://github.com/itsjavi/bootstrap-colorpicker",
"version": "2.5.1",
"_release": "2.5.1",
"version": "2.5.3",
"_release": "2.5.3",
"_resolution": {
"type": "version",
"tag": "2.5.1",
"commit": "db978b4d8c3436cdaed6e3a1a065f9f47bb686b1"
"tag": "2.5.3",
"commit": "525cd6a0aa26ae95803bbf34d231c4163136a314"
},
"_source": "https://github.com/itsjavi/bootstrap-colorpicker.git",
"_target": "^2.5.1",

View File

@@ -0,0 +1,11 @@
# EditorConfig is awesome: http://EditorConfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

View File

@@ -0,0 +1,47 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team members through their social media sites or at _git @ itsjavi.com_.
The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View File

@@ -12,8 +12,10 @@ For feature requests, suggestions or ideas, add `[SUGGESTION]` before the title
the following guidelines.
### Steps to submit an issue
- Try to reproduce your problem in a separated environment, like in JSFiddle,
[here is a template for it](http://jsfiddle.net/itsjavi/0vopxm13/), that you can fork in the same page.
These steps are mandatory. Issues that are not clear or are not clearly reproduceable with a live example will be closed.
- Reproduce your problem in a separated environment, like in JSFiddle,
[here is a template for it](http://jsfiddle.net/0vopxm13/157/), that you can fork in the same page.
It already includes the required JS and CSS files.
- Before posting your issue, consider adding this information:
* Expected behaviour: what should happen?
@@ -27,14 +29,14 @@ the following guidelines.
Patches and new features are welcome!
- Prerequisites: having `node`, `npm`, `bower` and `grunt` installed in your machine.
- After a fresh clone for your fork, you need to run `npm install && bower install` inside the project's root folder.
- Prerequisites: having `node`, `npm`, `yarn` and `grunt` installed in your machine.
- After a fresh clone for your fork, you need to run `yarn install` inside the project's root folder.
- For checking your changes in the browser you can execute `node serve` and navigate to http://localhost:5000/
- Before any commit run always `grunt` inside the project's root folder, to update the dist files
(never modify them manually).
- Do not change the plugin coding style.
- Check that the index.html demos aren't broken (modify if necessary).
- Test your code at least in Chrome, Firefox and IE >= 10 / Edge.
- Test your code at least in Chrome, Firefox and Edge.
- Any new feature should come with updated docs if applicable (a demonstration).
- Generate the `/dist` files executing `grunt` before your Pull Request.
- Push to your fork and submit the pull request.

View File

@@ -0,0 +1,51 @@
<!--
THIS TEMPLATE IS MANDATORY!!
Thank you for your contribution to bootstrap-colorpicker! Please replace {Please write here *} with your description.
Please note that issues not following this template may be potentially discarded if they are not easily reproduceable
with live examples (in case of code issues) and/or the description is not clear enough.
-->
### Brief description
{Please write here a summary of the issue}
<!--
The following sections are only mandatory for bug reports.
For feature requests and other kind of tickets, you only need to fill the first section,
optionally with additional comments and examples.
-->
### Which software are you using?
- bootstrap-colorpicker version: {Please write here}
- bootstrap version: {Please write here}
- jQuery version: {Please write here}
- Browser name and version: {Please write here}
- Operative System name an version: {Please write here}
### What's the expected or desirable behavior?
{Please write here in case of code-related issues or remove this section}
### What's the actual current behavior?
{Please write here in case of code-related issues or remove this section}
### Are there some other related issues or PRs?
{Please write here if applicable the issue numbers or remove this section}
### Steps to reproduce
{Please write here in case of code-related issues or remove this section}
<!--
Live examples are MANDATORY for code-related issues
You have a JsFiddle template here: http://jsfiddle.net/0vopxm13/157/ which is using the latest master version of the library.
-->
*Live example*: {Please write here a link to your JsFiddle example}
### Additional Comments (if any)
{Please write here}

View File

@@ -0,0 +1,38 @@
<!--
THIS TEMPLATE IS MANDATORY!!
Thank you for your contribution to bootstrap-colorpicker! Please replace {Please write here} with your description.
Please note that PRs not following this template may be potentially discarded if they are not clear enough.
-->
### Is your PR fixing an issue or introduces a new feature?
{Please write here}
### In case of fix, how this PR fixes the problem?
{Please write here only in case of fix PR or remove the section}
{Please also mention the related issue numbers you are trying to close, if applicable}
### In case of new feature, what are the benefits and use cases?
{Please write here only in case of feature PR or remove the section}
### Check list
Please mark with `x` inside the `[ ]` for anything that applies to this PR.
- [ ] All tests passed in travis-ci
- [ ] Regenerated the `dist` files via `grunt`
- [ ] All documentation examples are still working after testing them via `node serve`
- [ ] Added an example in the documentation for the newly introduced feature
- [ ] Provided an example via JsFiddle in the description of this PR
- [ ] Tested at least with latest Chrome, Firefox and Mobile (iOS Safari and/or Chrome for Android)
- [ ] This PR also introduces coding style changes (indentation, etc), in a separated commit
- [ ] The commit history is understandable and grouped into the minimum number of commits possible
- [ ] I've followed all other [`CONTRIBUTING.md`](.github/CONTRIBUTING.md#pull-requests) guidelines for Pull Requests.
### Additional Comments (if any)
{Please write here}

View File

@@ -0,0 +1,13 @@
*~
.DS_Store
.DS_Store*
ehthumbs.db
Thumbs.db
*.log
/node_modules/
/bower_components/
/nbproject/
static_server.js
*.php
.idea
package-lock.json

View File

@@ -0,0 +1,18 @@
{
"bitwise": false,
"browser": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"esnext": true,
"immed": true,
"jquery": true,
"latedef": true,
"newcap": true,
"noarg": true,
"node": true,
"strict": false,
"trailing": true,
"undef": true,
"predef" : ["define"]
}

View File

@@ -0,0 +1,21 @@
*~
.DS_Store
.DS_Store*
ehthumbs.db
Thumbs.db
*.log
/node_modules/
/bower_components/
/nbproject/
/gh-pages/
/package-lock.json
Gruntfile.js
/build
/docs
/tests
/spec
.*
/src/docs
*.psd
*.ai
composer.json

View File

@@ -0,0 +1,13 @@
language: node_js
node_js:
- "6"
- "8"
before_script:
- npm install -g grunt-cli
- curl -o- -L https://yarnpkg.com/install.sh | bash
script:
- yarn install
- grunt --verbose
# Check that files didn't change after running grunt. It should be run before pushing any code change.
- if ! git diff --name-only --quiet -- dist docs src index.html --; then echo \"Files where modified after grunt execution!!...\"; exit 1; fi

View File

@@ -0,0 +1,188 @@
'use strict';
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
less: {
dist: {
options: {
strictMath: true,
sourceMap: true,
outputSourceFiles: true,
sourceMapURL: '<%= pkg.name %>.css.map',
sourceMapFilename: 'dist/css/<%= pkg.name %>.css.map'
},
src: 'src/less/colorpicker.less',
dest: 'dist/css/<%= pkg.name %>.css'
}
},
cssmin: {
options: {
compatibility: 'ie8',
keepSpecialComments: '*',
sourceMap: true,
advanced: false
},
dist: {
src: 'dist/css/<%= pkg.name %>.css',
dest: 'dist/css/<%= pkg.name %>.min.css'
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
files: [
'Gruntfile.js',
'docs/docs.js',
'dist/js/<%= pkg.name %>.js'
]
},
jsbeautifier: {
options: {
js: {
braceStyle: "collapse",
breakChainedMethods: false,
e4x: false,
evalCode: false,
indentChar: " ",
indentLevel: 0,
indentSize: 2,
indentWithTabs: false,
jslintHappy: false,
keepArrayIndentation: false,
keepFunctionIndentation: false,
maxPreserveNewlines: 2,
preserveNewlines: true,
spaceBeforeConditional: true,
spaceInParen: false,
unescapeStrings: false,
wrapLineLength: 0,
endWithNewline: true
}
},
src: ['src/js/*.js', 'docs/docs.js'],
dist: ['dist/js/<%= pkg.name %>.js']
},
combine: {
js: {
input: 'src/js/colorpicker-plugin-wrapper.js',
output: 'dist/js/<%= pkg.name %>.js',
tokens: [{
token: "//@version",
string: '<%= pkg.version %>'
}, {
token: "//@colorpicker-color",
file: 'src/js/colorpicker-color.js'
}, {
token: "//@colorpicker-defaults",
file: 'src/js/colorpicker-defaults.js'
}, {
token: "//@colorpicker-component",
file: 'src/js/colorpicker-component.js'
}]
},
less: {
input: 'src/less/colorpicker.less',
output: 'src/less/colorpicker.less',
tokens: [{
token: "//@version",
string: '<%= pkg.version %>'
}]
}
},
strip_code: {
src: {
src: 'dist/js/*.js'
}
},
uglify: {
options: {
banner: '/*!\n * Bootstrap Colorpicker v<%= pkg.version %>\n' +
' * https://itsjavi.com/bootstrap-colorpicker/\n */\n'
},
dist: {
files: {
'dist/js/<%= pkg.name %>.min.js': [
'dist/js/<%= pkg.name %>.js'
]
}
}
},
watch: {
less: {
files: [
'src/less/*.less'
],
tasks: ['combine:less', 'less', 'cssmin']
},
js: {
files: [
'src/js/*.js',
'docs/docs.js'
],
tasks: ['jsbeautifier:src', 'combine:js', 'jsbeautifier:dist', 'uglify', 'jshint']
},
handlebars: {
files: [
'docs/*.hbs',
'docs/**/*.hbs',
'docs/helpers/**/*.js'
],
tasks: ['assemble']
}
},
assemble: {
options: {
assets: 'docs/assets',
helpers: ['docs/helpers/code'],
partials: ['docs/includes/**/*.hbs'],
layout: ['docs/layout.hbs'],
data: ['package.json'],
flatten: true
},
site: {
src: ['docs/pages/*.hbs'],
dest: './'
}
},
clean: {
dist: [
'dist/css/*',
'dist/js/*',
'index_new.html'
]
}
});
// Load tasks
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-jsbeautifier');
grunt.loadNpmTasks('grunt-combine');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-assemble');
grunt.loadNpmTasks('grunt-strip-code');
// Register tasks
grunt.registerTask('default', [
'clean',
'combine:less',
'less',
'cssmin',
'jsbeautifier:src',
'combine:js',
'jsbeautifier:dist',
'strip_code',
'uglify',
'assemble',
'jshint'
]);
grunt.registerTask('dev', [
'watch'
]);
};

View File

@@ -1,24 +1,24 @@
# Bootstrap Colorpicker 2
Fancy and customizable color picker plugin for Twitter Bootstrap
Simple and customizable colorpicker component for Twitter Bootstrap.
[![Build Status](https://travis-ci.org/itsjavi/bootstrap-colorpicker.svg?branch=master)](https://travis-ci.org/itsjavi/bootstrap-colorpicker)
[![Build Status](https://api.travis-ci.org/farbelous/bootstrap-colorpicker.svg?branch=v2.x)](https://travis-ci.org/farbelous/bootstrap-colorpicker)
## Installation
For downloading the source code, you have many choices:
- Downloading the [latest source code ZIP file](https://github.com/itsjavi/bootstrap-colorpicker/archive/master.zip)
- Cloning the source code: `git clone https://github.com/itsjavi/bootstrap-colorpicker.git`
- Installing via Bower: `bower install bootstrap-colorpicker`
- Downloading the [latest v2.x source code ZIP file](https://github.com/farbelous/bootstrap-colorpicker/archive/v2.x.zip)
- Cloning the source code: `git clone https://github.com/farbelous/bootstrap-colorpicker.git`
- Installing via NPM: `npm install bootstrap-colorpicker`
- Installing via Yarn: `yarn add bootstrap-colorpicker`
- Installing via Composer: `composer require itsjavi/bootstrap-colorpicker`
## Getting started
- For using the plugin you will only need the files under the `dist` folder
- You can read the [documentation here](https://itsjavi.com/bootstrap-colorpicker/)
- [Documentation and demos](https://farbelous.github.io/bootstrap-colorpicker/v2/)
## Contributing and reporting issues
If you want to contribute to the source code or report issues and suggestions, please read the [CONTRIBUTING.md](CONTRIBUTING.md) guidelines first. Some steps are mandatory in order to accept a Pull Request.
If you want to contribute to the source code or report issues and suggestions, please read the [CONTRIBUTING.md](.github/CONTRIBUTING.md) guidelines first. Some steps are mandatory in order to accept a Pull Request.
## Credits
Originally written by [Stefan Petre](http://www.eyecon.ro/)

View File

@@ -1,20 +0,0 @@
{
"name": "bootstrap-colorpicker",
"main": [
"dist/css/bootstrap-colorpicker.css",
"dist/js/bootstrap-colorpicker.js"
],
"dependencies": {
"jquery": ">=1.10"
},
"ignore": [
"\\.*",
"/index.html",
"/package.json",
"/composer.json",
"/Gruntfile.js",
"/.travis.yml",
"/travis.sh",
"/server.js"
]
}

View File

@@ -0,0 +1,15 @@
{
"name": "itsjavi/bootstrap-colorpicker",
"description": "Fancy and customizable colorpicker plugin for Twitter Bootstrap",
"license": "Apache License Version 2.0",
"authors": [
{
"name": "Javier Aguilar",
"homepage": "https://itsjavi.com"
}
],
"minimum-stability": "dev",
"require": {
"components/jquery" : ">=1.10"
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"version":3,"sources":["src/less/colorpicker.less"],"names":[],"mappings":";;;;;;;;AAqBA,wBACE,MAAA,MACA,OAAA,MAXA,iBAAsB,iDAatB,OAAA,UACA,MAAA,KACA,0BACE,QAAA,MACA,OAAA,IACA,MAAA,IACA,OAAA,IAAA,MAAA,KAfF,sBAAA,IACA,mBAAA,IACA,cAAA,IAeE,SAAA,SACA,IAAA,EACA,KAAA,EACA,OAAA,KAAA,EAAA,EAAA,KACA,4BACE,QAAA,MACA,OAAA,IACA,MAAA,IACA,OAAA,IAAA,MAAA,KAzBJ,sBAAA,IACA,mBAAA,IACA,cAAA,IA8BF,mBADA,iBAEE,MAAA,KACA,OAAA,MACA,MAAA,KACA,OAAA,WACA,YAAA,IACA,cAAA,IAIiB,qBADF,mBAEf,QAAA,MACA,OAAA,IACA,WAAA,KACA,WAAA,IAAA,MAAA,KACA,SAAA,SACA,IAAA,EACA,KAAA,EACA,MAAA,KACA,WAAA,KAGF,iBA1DE,iBAAsB,0CA8DxB,mBA9DE,iBAAsB,4CAgEtB,QAAA,KAKF,mBADA,iBADA,wBAGE,gBAAA,QAGF,aACE,QAAA,IACA,UAAA,MACA,WAAA,IAxEA,sBAAA,IACA,mBAAA,IACA,cAAA,IAwEA,QAAA,KAIU,mBADA,oBAEV,QAAA,MACA,QAAA,GACA,YAAA,EAGU,mBACV,MAAA,KAGU,oBACV,QAAA,GACA,QAAA,aACA,YAAA,IAAA,MAAA,YACA,aAAA,IAAA,MAAA,YACA,cAAA,IAAA,MAAA,KACA,oBAAA,eACA,SAAA,SACA,IAAA,KACA,KAAA,IAGU,mBACV,QAAA,GACA,QAAA,aACA,YAAA,IAAA,MAAA,YACA,aAAA,IAAA,MAAA,YACA,cAAA,IAAA,MAAA,KACA,SAAA,SACA,IAAA,KACA,KAAA,IAGW,iBACX,SAAA,SAGU,oCACV,UAAA,MAGkC,uDAClC,QAAA,MAGF,mBACE,OAAA,KACA,WAAA,IACA,MAAA,KAlIA,iBAAsB,4CAoItB,oBAAA,EAAA,KAGiB,uBACjB,OAAA,KAGF,uBACE,QAAA,KACA,OAAA,KACA,WAAA,IACA,MAAA,KAGqB,yBACrB,OAAA,QACA,MAAA,KACA,OAAA,KACA,MAAA,KAGuB,2BACvB,YAAA,IAI2B,+BADW,0CAEtC,QAAA,aACA,OAAA,QACA,OAAA,KACA,eAAA,SACA,MAAA,KAGU,gCACV,SAAA,SACA,QAAA,aACA,MAAA,KACA,QAAA,KAGU,oCACV,MAAA,MACA,UAAA,MACA,OAAA,KAGkC,4DAClC,cAAA,IAGkC,uDAClC,MAAA,MAIkC,uDADA,qDAElC,MAAA,MACA,OAAA,KACA,MAAA,KACA,OAAA,WACA,YAAA,EACA,cAAA,IAIqD,yDADF,uDAEnD,QAAA,MACA,OAAA,KACA,WAAA,KACA,SAAA,SACA,IAAA,EACA,KAAA,EACA,MAAA,IACA,OAAA,KACA,WAAA,EAGkC,qDAlNlC,iBAAsB,qDAsNY,uDAtNlC,iBAAsB,uDA0NN,0BAChB,KAAA,KACA,MAAA,IAGgB,yBAChB,KAAA,KACA,MAAA,IAGmB,6BACnB,aAAA,EACA,YAAA,EAGmB,4BACnB,aAAA,EACA,YAAA,EAQC,uCAAA,qCAAA,4CAAA,2CAAA,iCACC,QAAA,MASD,sCAAA,oCAAA,2CAAA,0CAAA,gCACC,QAAA,KAIe,wCACjB,QAAA"}
{"version":3,"sources":["src/less/colorpicker.less"],"names":[],"mappings":";;;;;;;;AAoBA,wBACE,MAAA,MACA,OAAA,MAXA,iBAAsB,g7KAatB,OAAA,UACA,MAAA,KACA,0BACE,QAAA,MACA,OAAA,IACA,MAAA,IACA,OAAA,IAAA,MAAA,KAfF,sBAAA,IACA,mBAAA,IACA,cAAA,IAeE,SAAA,SACA,IAAA,EACA,KAAA,EACA,OAAA,KAAA,EAAA,EAAA,KACA,4BACE,QAAA,MACA,OAAA,IACA,MAAA,IACA,OAAA,IAAA,MAAA,KAzBJ,sBAAA,IACA,mBAAA,IACA,cAAA,IA8BF,mBADA,iBAEE,MAAA,KACA,OAAA,MACA,MAAA,KACA,OAAA,WACA,YAAA,IACA,cAAA,IAIiB,qBADF,mBAEf,QAAA,MACA,OAAA,IACA,WAAA,KACA,WAAA,IAAA,MAAA,KACA,SAAA,SACA,IAAA,EACA,KAAA,EACA,MAAA,KACA,WAAA,KAGF,iBA1DE,iBAAsB,4rBA8DxB,mBA9DE,iBAAsB,wqBAgEtB,QAAA,KAKF,mBADA,iBADA,wBAGE,gBAAA,QAGF,aACE,QAAA,IACA,UAAA,MACA,WAAA,IAxEA,sBAAA,IACA,mBAAA,IACA,cAAA,IAwEA,QAAA,KAIU,mBADA,oBAEV,QAAA,MACA,QAAA,GACA,YAAA,EAGU,mBACV,MAAA,KAGU,oBACV,QAAA,GACA,QAAA,aACA,YAAA,IAAA,MAAA,YACA,aAAA,IAAA,MAAA,YACA,cAAA,IAAA,MAAA,KACA,oBAAA,eACA,SAAA,SACA,IAAA,KACA,KAAA,IAGU,mBACV,QAAA,GACA,QAAA,aACA,YAAA,IAAA,MAAA,YACA,aAAA,IAAA,MAAA,YACA,cAAA,IAAA,MAAA,KACA,SAAA,SACA,IAAA,KACA,KAAA,IAGW,iBACX,SAAA,SAGU,oCACV,UAAA,MAGkC,uDAClC,QAAA,MAGF,mBACE,OAAA,KACA,WAAA,IACA,MAAA,KAlIA,iBAAsB,wqBAoItB,oBAAA,EAAA,KAGiB,uBACjB,OAAA,KAGF,uBACE,QAAA,KACA,OAAA,KACA,WAAA,IACA,MAAA,KAGqB,yBACrB,OAAA,QACA,MAAA,KACA,OAAA,KACA,MAAA,KAGuB,2BACvB,YAAA,IAI2B,+BADW,0CAEtC,QAAA,aACA,OAAA,QACA,OAAA,KACA,eAAA,SACA,MAAA,KAGU,gCACV,SAAA,SACA,QAAA,aACA,MAAA,KACA,QAAA,KAGU,oCACV,MAAA,MACA,UAAA,MACA,OAAA,KAGkC,4DAClC,cAAA,IAGkC,uDAClC,MAAA,MAIkC,uDADA,qDAElC,MAAA,MACA,OAAA,KACA,MAAA,KACA,OAAA,WACA,YAAA,EACA,cAAA,IAIqD,yDADF,uDAEnD,QAAA,MACA,OAAA,KACA,WAAA,KACA,SAAA,SACA,IAAA,EACA,KAAA,EACA,MAAA,IACA,OAAA,KACA,WAAA,EAGkC,qDAlNlC,iBAAsB,4pBAsNY,uDAtNlC,iBAAsB,owBA0NN,0BAChB,KAAA,KACA,MAAA,IAGgB,yBAChB,KAAA,KACA,MAAA,IAGmB,6BACnB,aAAA,EACA,YAAA,EAGmB,4BACnB,aAAA,EACA,YAAA,EAQC,uCAAA,qCAAA,4CAAA,2CAAA,iCACC,QAAA,MASD,sCAAA,oCAAA,2CAAA,0CAAA,gCACC,QAAA,KAIe,wCACjB,QAAA"}

View File

@@ -1,5 +1,5 @@
/*!
* Bootstrap Colorpicker v2.5.1
* Bootstrap Colorpicker v2.5.2
* https://itsjavi.com/bootstrap-colorpicker/
*
* Originally written by (c) 2012 Stefan Petre
@@ -38,14 +38,9 @@
val, predefinedColors, fallbackColor, fallbackFormat, hexNumberSignPrefix) {
this.fallbackValue = fallbackColor ?
(
fallbackColor && (typeof fallbackColor.h !== 'undefined') ?
fallbackColor :
this.value = {
h: 0,
s: 0,
b: 0,
a: 1
}
(typeof fallbackColor === 'string') ?
this.parse(fallbackColor) :
fallbackColor
) :
null;
@@ -345,21 +340,26 @@
a: a
};
},
toHex: function(h, s, b, a) {
if (arguments.length === 0) {
toHex: function(ignoreFormat, h, s, b, a) {
if (arguments.length <= 1) {
h = this.value.h;
s = this.value.s;
b = this.value.b;
a = this.value.a;
}
var prefix = '#';
var rgb = this.toRGB(h, s, b, a);
if (this.rgbaIsTransparent(rgb)) {
return 'transparent';
}
var hexStr = (this.hexNumberSignPrefix ? '#' : '') + (
if (!ignoreFormat) {
prefix = (this.hexNumberSignPrefix ? '#' : '');
}
var hexStr = prefix + (
(1 << 24) +
(parseInt(rgb.r) << 16) +
(parseInt(rgb.g) << 8) +
@@ -397,10 +397,10 @@
};
},
toAlias: function(r, g, b, a) {
var c, rgb = (arguments.length === 0) ? this.toHex() : this.toHex(r, g, b, a);
var c, rgb = (arguments.length === 0) ? this.toHex(true) : this.toHex(true, r, g, b, a);
// support predef. colors in non-hex format too, as defined in the alias itself
var original = this.origFormat === 'alias' ? rgb : this.toString(this.origFormat, false);
var original = this.origFormat === 'alias' ? rgb : this.toString(false, this.origFormat);
for (var alias in this.colors) {
c = this.colors[alias].toLowerCase().trim();
@@ -475,6 +475,9 @@
* @returns {Object} Object containing h,s,b,a,format properties or FALSE if failed to parse
*/
parse: function(strVal) {
if (typeof strVal !== 'string') {
return this.fallbackValue;
}
if (arguments.length === 0) {
return false;
}
@@ -525,9 +528,10 @@
*
* @param {string} [format] (default: rgba)
* @param {boolean} [translateAlias] Return real color for pre-defined (non-standard) aliases (default: false)
* @param {boolean} [forceRawValue] Forces hashtag prefix when getting hex color (default: false)
* @returns {String}
*/
toString: function(format, translateAlias) {
toString: function(forceRawValue, format, translateAlias) {
format = format || this.origFormat || this.fallbackFormat;
translateAlias = translateAlias || false;
@@ -563,7 +567,7 @@
break;
case 'hex':
{
return this.toHex();
return this.toHex(forceRawValue);
}
break;
case 'alias':
@@ -571,7 +575,7 @@
c = this.toAlias();
if (c === false) {
return this.toString(this.getValidFallbackFormat());
return this.toString(forceRawValue, this.getValidFallbackFormat());
}
if (translateAlias && !(c in Color.webColors) && (c in this.predefinedColors)) {
@@ -787,6 +791,8 @@
this.updateData(this.color);
}
this.disabled = false;
// Setup picker
var $picker = this.picker = $(this.options.template);
if (this.options.customClass) {
@@ -855,7 +861,7 @@
'keyup.colorpicker': $.proxy(this.keyup, this)
});
this.input.on({
'change.colorpicker': $.proxy(this.change, this)
'input.colorpicker': $.proxy(this.change, this)
});
if (this.component === false) {
this.element.on({
@@ -975,12 +981,12 @@
});
},
updateData: function(val) {
val = val || this.color.toString(this.format, false);
val = val || this.color.toString(false, this.format);
this.element.data('color', val);
return val;
},
updateInput: function(val) {
val = val || this.color.toString(this.format, false);
val = val || this.color.toString(false, this.format);
if (this.input !== false) {
this.input.prop('value', val);
this.input.trigger('change');
@@ -1011,13 +1017,13 @@
});
this.picker.find('.colorpicker-saturation')
.css('backgroundColor', (this.options.hexNumberSignPrefix ? '' : '#') + this.color.toHex(this.color.value.h, 1, 1, 1));
.css('backgroundColor', this.color.toHex(true, this.color.value.h, 1, 1, 1));
this.picker.find('.colorpicker-alpha')
.css('backgroundColor', (this.options.hexNumberSignPrefix ? '' : '#') + this.color.toHex());
.css('backgroundColor', this.color.toHex(true));
this.picker.find('.colorpicker-color, .colorpicker-color div')
.css('backgroundColor', this.color.toString(this.format, true));
.css('backgroundColor', this.color.toString(true, this.format));
return val;
},
@@ -1034,16 +1040,16 @@
var icn = this.component.find('i').eq(0);
if (icn.length > 0) {
icn.css({
'backgroundColor': color.toString(this.format, true)
'backgroundColor': color.toString(true, this.format)
});
} else {
this.component.css({
'backgroundColor': color.toString(this.format, true)
'backgroundColor': color.toString(true, this.format)
});
}
}
return color.toString(this.format, false);
return color.toString(false, this.format);
},
update: function(force) {
var val;
@@ -1099,34 +1105,31 @@
return (this.input !== false);
},
isDisabled: function() {
if (this.hasInput()) {
return (this.input.prop('disabled') === true);
}
return false;
return this.disabled;
},
disable: function() {
if (this.hasInput()) {
this.input.prop('disabled', true);
this.element.trigger({
type: 'disable',
color: this.color,
value: this.getValue()
});
return true;
}
return false;
this.disabled = true;
this.element.trigger({
type: 'disable',
color: this.color,
value: this.getValue()
});
return true;
},
enable: function() {
if (this.hasInput()) {
this.input.prop('disabled', false);
this.element.trigger({
type: 'enable',
color: this.color,
value: this.getValue()
});
return true;
}
return false;
this.disabled = false;
this.element.trigger({
type: 'enable',
color: this.color,
value: this.getValue()
});
return true;
},
currentSlider: null,
mousePointer: {
@@ -1245,7 +1248,24 @@
return false;
},
change: function(e) {
this.keyup(e);
this.color = this.createColor(this.input.val());
// Change format dynamically
// Only occurs if user choose the dynamic format by
// setting option format to false
if (this.color.origFormat && this.options.format === false) {
this.format = this.color.origFormat;
}
if (this.getValue(false) !== false) {
this.updateData();
this.updateComponent();
this.updatePicker();
}
this.element.trigger({
type: 'changeColor',
color: this.color,
value: this.input.val()
});
},
keyup: function(e) {
if ((e.keyCode === 38)) {
@@ -1258,20 +1278,8 @@
this.color.value.a = Math.round((this.color.value.a - 0.01) * 100) / 100;
}
this.update(true);
} else {
this.color = this.createColor(this.input.val());
// Change format dynamically
// Only occurs if user choose the dynamic format by
// setting option format to false
if (this.color.origFormat && this.options.format === false) {
this.format = this.color.origFormat;
}
if (this.getValue(false) !== false) {
this.updateData();
this.updateComponent();
this.updatePicker();
}
}
this.element.trigger({
type: 'changeColor',
color: this.color,

File diff suppressed because one or more lines are too long

View File

@@ -2,41 +2,18 @@
<article class="col-md-12">
<hr>
<div class="social">
<a href="https://github.com/itsjavi/bootstrap-colorpicker/" target="_blank"
class="btn btn-default btn-sm"><span class="octicon octicon-mark-github"></span> Source code</a>
<a href="https://github.com/itsjavi/bootstrap-colorpicker/archive/master.zip" target="_blank"
class="btn btn-success btn-sm"><i class="glyphicon glyphicon-download-alt"></i> Download latest</a>
<div class="share-btn share-btn-twitter">
<a href="https://twitter.com/share" class="twitter-share-button" data-size="large" data-related="itsjaviaguilar"
data-hashtags="bootstrap">Tweet</a>
<script>!function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + '://platform.twitter.com/widgets.js';
fjs.parentNode.insertBefore(js, fjs);
}
}(document, 'script', 'twitter-wjs');</script>
</div>
<div class="share-btn share-btn-google-plus">
<!-- Place this tag where you want the +1 button to render. -->
<div class="g-plusone" data-size="large"></div>
<!-- Place this tag after the last +1 button tag. -->
<script type="text/javascript">
(function () {
var po = document.createElement('script');
po.type = 'text/javascript';
po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
})();
</script>
</div>
<a href="https://github.com/farbelous/bootstrap-colorpicker/" target="_blank"
class="btn btn-default btn-sm"><span class="octicon octicon-mark-github"></span>
Source code
</a>
<a href="https://github.com/farbelous/bootstrap-colorpicker/releases" target="_blank"
class="btn btn-default btn-sm">
Latest Releases
</a>
<a href="https://github.com/farbelous/bootstrap-colorpicker/archive/2.5.2.zip" target="_blank"
class="btn btn-success btn-sm"><i class="glyphicon glyphicon-download-alt"></i>
Download v2.5.2
</a>
</div>
<hr>
</article>

View File

@@ -6,12 +6,19 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Colorpicker for Twitter Bootstrap</title>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-85082661-5"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date()); gtag('config', 'UA-85082661-5');
</script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css" rel="stylesheet">
<link href="dist/css/bootstrap-colorpicker.min.css" rel="stylesheet">
<link href="docs/assets/main.css" rel="stylesheet">
<script src="//code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="//code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="dist/js/bootstrap-colorpicker.js"></script>
</head>

View File

@@ -11,6 +11,11 @@
href="https://twitter.com/stefanpetre/" target="_blank">Stefan Petre</a> and maintained by
<a href="https://itsjavi.com/" target="_blank">Javi Aguilar</a> and the Github community.
</p>
<p class="alert alert-warning">
<b>NOTE</b> That this is an older version of the library documentation, please check
the project <a href="https://github.com/farbelous/bootstrap-colorpicker/blob/master/README.md">README</a>
to find the documentation for the newer and latest versions.
</p>
</article>
</div>
{{> social }}

View File

@@ -0,0 +1,794 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Colorpicker for Twitter Bootstrap</title>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-85082661-5"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date()); gtag('config', 'UA-85082661-5');
</script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css" rel="stylesheet">
<link href="dist/css/bootstrap-colorpicker.min.css" rel="stylesheet">
<link href="docs/assets/main.css" rel="stylesheet">
<script src="//code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="dist/js/bootstrap-colorpicker.js"></script>
</head>
<body>
<div class="container">
<div class="page-header">
<h1><i class="glyphicon glyphicon-tint"></i> Bootstrap Colorpicker 2.5.2
<small>for Twitter Bootstrap</small>
</h1>
</div>
<div class="row">
<article class="col-md-12">
<p>
Fancy and customizable colorpicker plugin for Twitter Bootstrap.
Originally written by <a
href="https://twitter.com/stefanpetre/" target="_blank">Stefan Petre</a> and maintained by
<a href="https://itsjavi.com/" target="_blank">Javi Aguilar</a> and the Github community.
</p>
<p class="alert alert-warning">
<b>NOTE</b> That this is an older version of the library documentation, please check
the project <a href="https://github.com/farbelous/bootstrap-colorpicker/blob/master/README.md">README</a>
to find the documentation for the newer and latest versions.
</p>
</article>
</div>
<div class="row">
<article class="col-md-12">
<hr>
<div class="social">
<a href="https://github.com/farbelous/bootstrap-colorpicker/" target="_blank"
class="btn btn-default btn-sm"><span class="octicon octicon-mark-github"></span>
Source code
</a>
<a href="https://github.com/farbelous/bootstrap-colorpicker/releases" target="_blank"
class="btn btn-default btn-sm">
Latest Releases
</a>
<a href="https://github.com/farbelous/bootstrap-colorpicker/archive/2.5.2.zip" target="_blank"
class="btn btn-success btn-sm"><i class="glyphicon glyphicon-download-alt"></i>
Download v2.5.2
</a>
</div>
<hr>
</article>
</div>
<div class="row">
<div class="col-md-7">
<h2>Documentation</h2>
<hr>
<p>Call the colopicker via javascript:</p>
<pre class="well">$('.sample-selector').colorpicker({ /*options...*/ });</pre>
<h3>Options</h3>
<p>
You can set colorpicker options either as a plugin parameter or data-* attributes
</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 50px;">Type</th>
<th style="width: 100px;">Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>format</td>
<td>string</td>
<td>false</td>
<td>If not false, forces the color format to be hex, rgb or rgba, otherwise the format is
automatically detected.
</td>
</tr>
<tr>
<td>color</td>
<td>string</td>
<td>false</td>
<td>If not false, sets the color to this value.</td>
</tr>
<tr>
<td>container</td>
<td>string or jQuery Element</td>
<td>false</td>
<td>If not false, the picker will be contained inside this element, otherwise it will be
appended to the document body.
</td>
</tr>
<tr>
<td>component</td>
<td>string or jQuery Element</td>
<td>'.add-on, .input-group-addon'</td>
<td>Children selector for the component or element that trigger the colorpicker and which
background color will change (needs an inner &lt;i&gt; element).
</td>
</tr>
<tr>
<td>input</td>
<td>string or jQuery Element</td>
<td>'input'</td>
<td>Children selector for the input that will store the picker selected value.</td>
</tr>
<tr>
<td>hexNumberSignPrefix</td>
<td>boolean</td>
<td>true</td>
<td>If true, put a '&num;' (number sign) before hex strings.
</td>
</tr>
<tr>
<td>horizontal</td>
<td>boolean</td>
<td>false</td>
<td>If true, the hue and alpha channel bars will be rendered horizontally, above the saturation
selector.
</td>
</tr>
<tr>
<td>inline</td>
<td>boolean</td>
<td>false</td>
<td>If true, forces to show the colorpicker as an inline element.</td>
</tr>
<tr>
<td>sliders</td>
<td>object</td>
<td><abbr title='please, read the source code to see this value'>[...]</abbr></td>
<td>Vertical sliders configuration (read source code if you really need to tweak this).</td>
</tr>
<tr>
<td>slidersHorz</td>
<td>object</td>
<td><abbr title='please, read the source code to see this value'>[...]</abbr></td>
<td>Horizontal sliders configuration (read source code if you really need to tweak this).</td>
</tr>
<tr>
<td>template</td>
<td>string</td>
<td><abbr title='please, read the source code to see this value'>[...]</abbr></td>
<td>Customizes the default colorpicker HTML template.</td>
</tr>
<tr>
<td>align</td>
<td>string</td>
<td>'right'</td>
<td>By default, the colorpicker is aligned to the right of the input. If you need to switch it
to the left, set align to 'left'.
</td>
</tr>
<tr>
<td>customClass</td>
<td>string</td>
<td>null</td>
<td>Adds this class to the colorpicker widget.</td>
</tr>
<tr>
<td>colorSelectors</td>
<td>object</td>
<td>null</td>
<td>List of pre selected colors (hex format). If you choose one of these colors, the alias is returned instead of the hex
code.
</td>
</tr>
<tr>
<td>fallbackColor</td>
<td>string</td>
<td>null</td>
<td>
Fallback color string that will be applied when the color failed to be parsed.
If <var>null</var>, it will keep the current color if any.
</td>
</tr>
<tr>
<td>fallbackFormat</td>
<td>string</td>
<td>hex</td>
<td>
Fallback color format (e.g. when not specified or for alias mode, when selecting non aliased colors)
</td>
</tr>
</tbody>
</table>
<h3>jQuery API Methods</h3>
<p>General usage methods</p>
<h4>.colorpicker(options)</h4>
<p>Initializes an colorpicker.</p>
<h4>.colorpicker('getValue', defaultValue)</h4>
<p>Gets the value from the input or the data attribute (if has no input), otherwise returns the default
value, which defaults to #000000 if not specified.</p>
<h4>.colorpicker('setValue', value)</h4>
<p>Set a new value for the color picker (also updates everything). Triggers 'changeColor' event.</p>
<h4>.colorpicker('show')</h4>
<p>Show the color picker</p>
<h4>.colorpicker('hide')</h4>
<p>Hide the color picker</p>
<h4>.colorpicker('reposition')</h4>
<p>Updates the color picker's position relative to the element</p>
<h4>.colorpicker('update')</h4>
<p>Refreshes the widget colors (this is done automatically)</p>
<h4>.colorpicker('enable')</h4>
<p>Enable the color picker.</p>
<h4>.colorpicker('disable')</h4>
<p>Disable the color picker.</p>
<h4>.colorpicker('destroy')</h4>
<p>Destroys the colorpicker widget and unbind all .colorpicker events from the element and component</p>
<h4>.data('colorpicker')</h4>
<p>Access to the colorpicker API directly</p>
<h4>.data('colorpicker').color</h4>
<p>Access to the colorpicker Color object information</p>
<hr>
<h3>Color object methods</h3>
<p>Each triggered events have a color object (avaliable through event.color, see the example at the
bottom) used internally by the picker. This object has several useful methods. These are the more
commonly used:</p>
<h4>.setColor(value)</h4>
<p>Set a new color. The value is parsed and tries to do a quess on the format.</p>
<h4>.setHue(value)</h4>
<p>Set the HUE with a value between 0 and 1.</p>
<h4>.setSaturation(value)</h4>
<p>Set the saturation with a value between 0 and 1.</p>
<h4>.setBrightness(value)</h4>
<p>Set the brightness with a value between 0 and 1.</p>
<h4>.setAlpha(value)</h4>
<p>Set the transparency with a value between 0 and 1.</p>
<h4>.toRGB()</h4>
<p>Returns a hash with red, green, blue and alpha.</p>
<h4>.toHex()</h4>
<p>Returns a string with HEX format for the current color.</p>
<h4>.toHSL()</h4>
<p>Returns a hash with HSLA values.</p>
<hr>
<h3>Events</h3>
<p>The colorpicker plugin exposes some events</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 150px;">Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>create</td>
<td>This event fires immediately when the color picker is created.</td>
</tr>
<tr>
<td>showPicker</td>
<td>This event fires immediately when the color picker is displayed.</td>
</tr>
<tr>
<td>hidePicker</td>
<td>This event is fired immediately when the color picker is hidden.</td>
</tr>
<tr>
<td>changeColor</td>
<td>This event is fired when the color is changed.</td>
</tr>
<tr>
<td>disable</td>
<td>This event is fired immediately when the color picker is disabled, except if it was
initialized as disabled.
</td>
</tr>
<tr>
<td>enable</td>
<td>This event is fired immediately when the color picker is enabled, except upon
initialization.
</td>
</tr>
<tr>
<td>destroy</td>
<td>This event fires immediately when the color picker is destroyed.</td>
</tr>
</tbody>
</table>
</div>
<div class="col-md-5">
<h2>Examples</h2>
<hr>
<div class="example">
<div class="example-title">Simple input field</div>
<div class="example-content well">
<div class="example-content-widget">
<input id="cp1" type="text" class="form-control" value="#5367ce"/>
<script>
$(function () {
$('#cp1').colorpicker();
});
</script>
</div>
<button type="button" class="btn btn-link btn-xs example-code-toggle" data-toggle="button">View source</button>
<div class="example-code">&lt;input id=&quot;cp1&quot; type=&quot;text&quot; class=&quot;form-control&quot; value=&quot;#5367ce&quot; &#x2F;&gt;
&lt;script&gt;
$(function() {
$(&#39;#cp1&#39;).colorpicker();
});
&lt;&#x2F;script&gt;</div> </div>
</div>
<div class="example">
<div class="example-title">As a component</div>
<div class="example-content well">
<div class="example-content-widget">
<div id="cp2" class="input-group colorpicker-component">
<input type="text" value="#00AABB" class="form-control"/>
<span class="input-group-addon"><i></i></span>
</div>
<script>
$(function () {
$('#cp2').colorpicker();
});
</script>
</div>
<button type="button" class="btn btn-link btn-xs example-code-toggle" data-toggle="button">View source</button>
<div class="example-code">&lt;div id=&quot;cp2&quot; class=&quot;input-group colorpicker-component&quot;&gt;
&lt;input type=&quot;text&quot; value=&quot;#00AABB&quot; class=&quot;form-control&quot; &#x2F;&gt;
&lt;span class=&quot;input-group-addon&quot;&gt;&lt;i&gt;&lt;&#x2F;i&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;div&gt;
&lt;script&gt;
$(function() {
$(&#39;#cp2&#39;).colorpicker();
});
&lt;&#x2F;script&gt;</div> </div>
</div>
<div class="example">
<div class="example-title">With custom options</div>
<div class="example-description">Sample overriding the initial color and format</div>
<div class="example-content well">
<div class="example-content-widget">
<div id="cp3" class="input-group colorpicker-component">
<input type="text" value="#00AABB" class="form-control"/>
<span class="input-group-addon"><i></i></span>
</div>
<script>
$(function () {
$('#cp3').colorpicker({
color: '#AA3399',
format: 'rgb'
});
});
</script>
</div>
<button type="button" class="btn btn-link btn-xs example-code-toggle" data-toggle="button">View source</button>
<div class="example-code">&lt;div id=&quot;cp3&quot; class=&quot;input-group colorpicker-component&quot;&gt;
&lt;input type=&quot;text&quot; value=&quot;#00AABB&quot; class=&quot;form-control&quot; &#x2F;&gt;
&lt;span class=&quot;input-group-addon&quot;&gt;&lt;i&gt;&lt;&#x2F;i&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;div&gt;
&lt;script&gt;
$(function() {
$(&#39;#cp3&#39;).colorpicker({
color: &#39;#AA3399&#39;,
format: &#39;rgb&#39;
});
});
&lt;&#x2F;script&gt;</div> </div>
</div>
<div class="example">
<div class="example-title">Working with events</div>
<div class="example-content well">
<div class="example-content-widget">
<a href="#" class="btn btn-default" id="cp4">Change background color</a>
<script>
$(function () {
$('#cp4').colorpicker().on('changeColor', function (e) {
$('body')[0].style.backgroundColor = e.color.toString('rgba');
});
});
</script>
</div>
<button type="button" class="btn btn-link btn-xs example-code-toggle" data-toggle="button">View source</button>
<div class="example-code">&lt;a href=&quot;#&quot; class=&quot;btn btn-default&quot; id=&quot;cp4&quot;&gt;Change background color&lt;&#x2F;a&gt;
&lt;script&gt;
$(function() {
$(&#39;#cp4&#39;).colorpicker().on(&#39;changeColor&#39;, function(e) {
$(&#39;body&#39;)[0].style.backgroundColor = e.color.toString(
&#39;rgba&#39;);
});
});
&lt;&#x2F;script&gt;</div> </div>
</div>
<div class="example">
<div class="example-title">Transparent color support</div>
<div class="example-content well">
<div class="example-content-widget">
<input type="text" class="form-control" id="cp5"/>
<script>
$(function () {
$('#cp5').colorpicker({
color: "transparent",
format: "hex"
});
});
</script>
</div>
<button type="button" class="btn btn-link btn-xs example-code-toggle" data-toggle="button">View source</button>
<div class="example-code">&lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;cp5&quot; &#x2F;&gt;
&lt;script&gt;
$(function() {
$(&#39;#cp5&#39;).colorpicker({
color: &quot;transparent&quot;,
format: &quot;hex&quot;
});
});
&lt;&#x2F;script&gt;</div> </div>
</div>
<div class="example">
<div class="example-title">Horizontal mode</div>
<div class="example-content well">
<div class="example-content-widget">
<input type="text" class="form-control" id="cp6" />
<script>
$(function () {
$('#cp6').colorpicker({
color: "#88cc33",
horizontal: true
});
});
</script>
</div>
<button type="button" class="btn btn-link btn-xs example-code-toggle" data-toggle="button">View source</button>
<div class="example-code">&lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;cp6&quot; &#x2F;&gt;
&lt;script&gt;
$(function() {
$(&#39;#cp6&#39;).colorpicker({
color: &quot;#88cc33&quot;,
horizontal: true
});
});
&lt;&#x2F;script&gt;</div> </div>
</div>
<div class="example">
<div class="example-title">Inline mode</div>
<div class="example-content well">
<div class="example-content-widget">
<div id="cp7" class="inl-bl"></div>
<style>
.inl-bl {
display: inline-block;
}
</style>
<script>
$(function () {
$('#cp7').colorpicker({
color:'#ffaa00',
container: true,
inline:true
});
});
</script>
</div>
<button type="button" class="btn btn-link btn-xs example-code-toggle" data-toggle="button">View source</button>
<div class="example-code">&lt;div id=&quot;cp7&quot; class=&quot;inl-bl&quot;&gt;&lt;&#x2F;div&gt;
&lt;style&gt;
.inl-bl {
display: inline-block;
}
&lt;&#x2F;style&gt;
&lt;script&gt;
$(function() {
$(&#39;#cp7&#39;).colorpicker({
color: &#39;#ffaa00&#39;,
container: true,
inline: true
});
});
&lt;&#x2F;script&gt;</div> </div>
</div>
<div class="example">
<div class="example-title">Aliased color palette</div>
<div class="example-content well">
<div class="example-content-widget">
<div id="cp8" data-format="alias" class="input-group colorpicker-component">
<input type="text" value="primary" class="form-control"/>
<span class="input-group-addon"><i></i></span>
</div>
<script>
$(function () {
$('#cp8').colorpicker({
colorSelectors: {
'black': '#000000',
'white': '#ffffff',
'red': '#FF0000',
'default': '#777777',
'primary': '#337ab7',
'success': '#5cb85c',
'info': '#5bc0de',
'warning': '#f0ad4e',
'danger': '#d9534f'
}
});
});
</script>
</div>
<button type="button" class="btn btn-link btn-xs example-code-toggle" data-toggle="button">View source</button>
<div class="example-code">&lt;div id=&quot;cp8&quot; data-format=&quot;alias&quot; class=&quot;input-group colorpicker-component&quot;&gt;
&lt;input type=&quot;text&quot; value=&quot;primary&quot; class=&quot;form-control&quot; &#x2F;&gt;
&lt;span class=&quot;input-group-addon&quot;&gt;&lt;i&gt;&lt;&#x2F;i&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;div&gt;
&lt;script&gt;
$(function() {
$(&#39;#cp8&#39;).colorpicker({
colorSelectors: {
&#39;black&#39;: &#39;#000000&#39;,
&#39;white&#39;: &#39;#ffffff&#39;,
&#39;red&#39;: &#39;#FF0000&#39;,
&#39;default&#39;: &#39;#777777&#39;,
&#39;primary&#39;: &#39;#337ab7&#39;,
&#39;success&#39;: &#39;#5cb85c&#39;,
&#39;info&#39;: &#39;#5bc0de&#39;,
&#39;warning&#39;: &#39;#f0ad4e&#39;,
&#39;danger&#39;: &#39;#d9534f&#39;
}
});
});
&lt;&#x2F;script&gt;</div> </div>
</div>
<div class="example">
<div class="example-title">Customized widget size</div>
<div class="example-description">Also showing the support of HTML color names</div>
<div class="example-content well">
<div class="example-content-widget">
<input id="cp9" type="text" class="form-control" value="pink"/>
<style>
.colorpicker-2x .colorpicker-saturation {
width: 200px;
height: 200px;
}
.colorpicker-2x .colorpicker-hue,
.colorpicker-2x .colorpicker-alpha {
width: 30px;
height: 200px;
}
.colorpicker-2x .colorpicker-color,
.colorpicker-2x .colorpicker-color div {
height: 30px;
}
</style>
<script>
$(function () {
$('#cp9').colorpicker({
customClass: 'colorpicker-2x',
sliders: {
saturation: {
maxLeft: 200,
maxTop: 200
},
hue: {
maxTop: 200
},
alpha: {
maxTop: 200
}
}
});
});
</script>
</div>
<button type="button" class="btn btn-link btn-xs example-code-toggle" data-toggle="button">View source</button>
<div class="example-code">&lt;input id=&quot;cp9&quot; type=&quot;text&quot; class=&quot;form-control&quot; value=&quot;pink&quot; &#x2F;&gt;
&lt;style&gt;
.colorpicker-2x .colorpicker-saturation {
width: 200px;
height: 200px;
}
.colorpicker-2x .colorpicker-hue,
.colorpicker-2x .colorpicker-alpha {
width: 30px;
height: 200px;
}
.colorpicker-2x .colorpicker-color,
.colorpicker-2x .colorpicker-color div {
height: 30px;
}
&lt;&#x2F;style&gt;
&lt;script&gt;
$(function() {
$(&#39;#cp9&#39;).colorpicker({
customClass: &#39;colorpicker-2x&#39;,
sliders: {
saturation: {
maxLeft: 200,
maxTop: 200
},
hue: {
maxTop: 200
},
alpha: {
maxTop: 200
}
}
});
});
&lt;&#x2F;script&gt;</div> </div>
</div>
<div class="example">
<div class="example-title">Disabled / enabled status</div>
<div class="example-content well">
<div class="example-content-widget">
<div id="cp10" class="input-group colorpicker-component">
<input disabled type="text" value="" class="form-control"/>
<span class="input-group-addon"><i></i></span>
</div>
<br>
<p>
<a class="btn btn-sm btn-default enable-button" href="#">Enable</a>
<a class="btn btn-sm btn-default disable-button" href="#">Disable</a>
</p>
<script>
$(function () {
$(".disable-button").click(function(e) {
e.preventDefault();
$("#cp10").colorpicker('disable');
});
$(".enable-button").click(function(e) {
e.preventDefault();
$("#cp10").colorpicker('enable');
});
$('#cp10').colorpicker();
});
</script>
</div>
<button type="button" class="btn btn-link btn-xs example-code-toggle" data-toggle="button">View source</button>
<div class="example-code">&lt;div id=&quot;cp10&quot; class=&quot;input-group colorpicker-component&quot;&gt;
&lt;input disabled type=&quot;text&quot; value=&quot;&quot; class=&quot;form-control&quot; &#x2F;&gt;
&lt;span class=&quot;input-group-addon&quot;&gt;&lt;i&gt;&lt;&#x2F;i&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;div&gt;
&lt;br&gt;
&lt;p&gt;
&lt;a class=&quot;btn btn-sm btn-default enable-button&quot; href=&quot;#&quot;&gt;Enable&lt;&#x2F;a&gt;
&lt;a class=&quot;btn btn-sm btn-default disable-button&quot; href=&quot;#&quot;&gt;Disable&lt;&#x2F;a&gt;
&lt;&#x2F;p&gt;
&lt;script&gt;
$(function() {
$(&quot;.disable-button&quot;).click(function(e) {
e.preventDefault();
$(&quot;#cp10&quot;).colorpicker(&#39;disable&#39;);
});
$(&quot;.enable-button&quot;).click(function(e) {
e.preventDefault();
$(&quot;#cp10&quot;).colorpicker(&#39;enable&#39;);
});
$(&#39;#cp10&#39;).colorpicker();
});
&lt;&#x2F;script&gt;</div> </div>
</div>
<div class="example">
<div class="example-title">Inside a modal</div>
<div class="example-content well">
<div class="example-content-widget">
<button class="btn btn-primary btn-md" data-toggle="modal" data-target="#myModal">
Show modal
</button>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div id="cp11" class="input-group colorpicker-component">
<input type="text" value="" class="form-control"/>
<span class="input-group-addon"><i></i></span>
</div>
</div>
</div>
</div>
</div>
<script>
$(function () {
$('#cp11').colorpicker();
});
</script>
</div>
<button type="button" class="btn btn-link btn-xs example-code-toggle" data-toggle="button">View source</button>
<div class="example-code">&lt;button class=&quot;btn btn-primary btn-md&quot; data-toggle=&quot;modal&quot; data-target=&quot;#myModal&quot;&gt;
Show modal
&lt;&#x2F;button&gt;
&lt;div class=&quot;modal fade&quot; id=&quot;myModal&quot; tabindex=&quot;-1&quot; role=&quot;dialog&quot; aria-labelledby=&quot;myModalLabel&quot;
aria-hidden=&quot;true&quot;&gt;
&lt;div class=&quot;modal-dialog&quot;&gt;
&lt;div class=&quot;modal-content&quot;&gt;
&lt;div class=&quot;modal-body&quot;&gt;
&lt;div id=&quot;cp11&quot; class=&quot;input-group colorpicker-component&quot;&gt;
&lt;input type=&quot;text&quot; value=&quot;&quot; class=&quot;form-control&quot; &#x2F;&gt;
&lt;span class=&quot;input-group-addon&quot;&gt;&lt;i&gt;&lt;&#x2F;i&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;div&gt;
&lt;&#x2F;div&gt;
&lt;&#x2F;div&gt;
&lt;&#x2F;div&gt;
&lt;&#x2F;div&gt;
&lt;script&gt;
$(function() {
$(&#39;#cp11&#39;).colorpicker();
});
&lt;&#x2F;script&gt;</div> </div>
</div>
<script>
$(function () {
$('.example-code-toggle').on('click', function () {
$(this).parent().find('.example-code').toggle();
});
});
</script>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,48 @@
{
"name": "bootstrap-colorpicker",
"version": "2.5.3",
"description": "Fancy and customizable colorpicker plugin for Twitter Bootstrap",
"main": "./dist/js/bootstrap-colorpicker.js",
"homepage": "https://itsjavi.com/bootstrap-colorpicker/",
"repository": {
"type": "git",
"url": "https://github.com/itsjavi/bootstrap-colorpicker.git"
},
"bugs": {
"url": "https://github.com/itsjavi/bootstrap-colorpicker/issues"
},
"keywords": [
"bootstrap",
"colorpicker"
],
"author": "Javier Aguilar",
"license": "Apache-2.0",
"licenses": [
{
"type": "Apache-2.0",
"url": "http://opensource.org/licenses/Apache-2.0"
}
],
"dependencies": {
"jquery": ">=1.10"
},
"scripts": {
"test": "jasmine"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-assemble": "~0.4.0",
"grunt-combine": "~0.8.3",
"grunt-contrib-clean": "~1.0.0",
"grunt-contrib-cssmin": "~1.0.1",
"grunt-contrib-jshint": "~1.0.0",
"grunt-contrib-less": "~1.2.0",
"grunt-contrib-uglify": "~1.0.0",
"grunt-contrib-watch": "~1.0.0",
"grunt-jsbeautifier": "~0.2.10",
"grunt-strip-code": "^1.0.6",
"jasmine": "^2.6.0",
"jquery": ">=1.10",
"jsdom": "^10.1.0"
}
}

View File

@@ -0,0 +1,11 @@
var Color = require("../../src/js/colorpicker-color.js");
it("should return color in raw format", function(){
var color = new Color('aabbcc');
expect(color.toHex(true)).toEqual("#aabbcc");
});
it("should return color formatted", function(){
var color = new Color('aabbcc');
expect(color.toHex()).toEqual("aabbcc");
});

View File

@@ -0,0 +1,11 @@
{
"spec_dir": "spec",
"spec_files": [
"**/*[sS]pec.js"
],
"helpers": [
"helpers/**/*.js"
],
"stopSpecOnExpectationFailure": false,
"random": false
}

View File

@@ -1,3 +1,10 @@
/* test-code */
if (typeof module === "object" && typeof module.exports === "object") {
var jsdom = require("jsdom");
var JSDOM = jsdom.JSDOM;
var $ = require('jquery')((new JSDOM('<!DOCTYPE html><p>Hello world</p>')).window);
}
/* end-test-code */
/**
* Color manipulation helper class
*
@@ -12,14 +19,9 @@ var Color = function(
val, predefinedColors, fallbackColor, fallbackFormat, hexNumberSignPrefix) {
this.fallbackValue = fallbackColor ?
(
fallbackColor && (typeof fallbackColor.h !== 'undefined') ?
fallbackColor :
this.value = {
h: 0,
s: 0,
b: 0,
a: 1
}
(typeof fallbackColor === 'string') ?
this.parse(fallbackColor) :
fallbackColor
) :
null;
@@ -319,21 +321,26 @@ Color.prototype = {
a: a
};
},
toHex: function(h, s, b, a) {
if (arguments.length === 0) {
toHex: function(ignoreFormat, h, s, b, a) {
if (arguments.length <= 1) {
h = this.value.h;
s = this.value.s;
b = this.value.b;
a = this.value.a;
}
var prefix = '#';
var rgb = this.toRGB(h, s, b, a);
if (this.rgbaIsTransparent(rgb)) {
return 'transparent';
}
var hexStr = (this.hexNumberSignPrefix ? '#' : '') + (
if (!ignoreFormat) {
prefix = (this.hexNumberSignPrefix ? '#' : '');
}
var hexStr = prefix + (
(1 << 24) +
(parseInt(rgb.r) << 16) +
(parseInt(rgb.g) << 8) +
@@ -371,10 +378,10 @@ Color.prototype = {
};
},
toAlias: function(r, g, b, a) {
var c, rgb = (arguments.length === 0) ? this.toHex() : this.toHex(r, g, b, a);
var c, rgb = (arguments.length === 0) ? this.toHex(true) : this.toHex(true, r, g, b, a);
// support predef. colors in non-hex format too, as defined in the alias itself
var original = this.origFormat === 'alias' ? rgb : this.toString(this.origFormat, false);
var original = this.origFormat === 'alias' ? rgb : this.toString(false, this.origFormat);
for (var alias in this.colors) {
c = this.colors[alias].toLowerCase().trim();
@@ -449,6 +456,9 @@ Color.prototype = {
* @returns {Object} Object containing h,s,b,a,format properties or FALSE if failed to parse
*/
parse: function(strVal) {
if (typeof strVal !== 'string') {
return this.fallbackValue;
}
if (arguments.length === 0) {
return false;
}
@@ -499,9 +509,10 @@ Color.prototype = {
*
* @param {string} [format] (default: rgba)
* @param {boolean} [translateAlias] Return real color for pre-defined (non-standard) aliases (default: false)
* @param {boolean} [forceRawValue] Forces hashtag prefix when getting hex color (default: false)
* @returns {String}
*/
toString: function(format, translateAlias) {
toString: function(forceRawValue, format, translateAlias) {
format = format || this.origFormat || this.fallbackFormat;
translateAlias = translateAlias || false;
@@ -537,7 +548,7 @@ Color.prototype = {
break;
case 'hex':
{
return this.toHex();
return this.toHex(forceRawValue);
}
break;
case 'alias':
@@ -545,7 +556,7 @@ Color.prototype = {
c = this.toAlias();
if (c === false) {
return this.toString(this.getValidFallbackFormat());
return this.toString(forceRawValue, this.getValidFallbackFormat());
}
if (translateAlias && !(c in Color.webColors) && (c in this.predefinedColors)) {
@@ -660,3 +671,6 @@ Color.prototype = {
return false;
}
};
/* test-code */
module.exports = Color;
/* end-test-code */

View File

@@ -32,6 +32,8 @@ var Colorpicker = function(element, options) {
this.updateData(this.color);
}
this.disabled = false;
// Setup picker
var $picker = this.picker = $(this.options.template);
if (this.options.customClass) {
@@ -100,7 +102,7 @@ var Colorpicker = function(element, options) {
'keyup.colorpicker': $.proxy(this.keyup, this)
});
this.input.on({
'change.colorpicker': $.proxy(this.change, this)
'input.colorpicker': $.proxy(this.change, this)
});
if (this.component === false) {
this.element.on({
@@ -220,12 +222,12 @@ Colorpicker.prototype = {
});
},
updateData: function(val) {
val = val || this.color.toString(this.format, false);
val = val || this.color.toString(false, this.format);
this.element.data('color', val);
return val;
},
updateInput: function(val) {
val = val || this.color.toString(this.format, false);
val = val || this.color.toString(false, this.format);
if (this.input !== false) {
this.input.prop('value', val);
this.input.trigger('change');
@@ -256,13 +258,13 @@ Colorpicker.prototype = {
});
this.picker.find('.colorpicker-saturation')
.css('backgroundColor', (this.options.hexNumberSignPrefix ? '' : '#') + this.color.toHex(this.color.value.h, 1, 1, 1));
.css('backgroundColor', this.color.toHex(true, this.color.value.h, 1, 1, 1));
this.picker.find('.colorpicker-alpha')
.css('backgroundColor', (this.options.hexNumberSignPrefix ? '' : '#') + this.color.toHex());
.css('backgroundColor', this.color.toHex(true));
this.picker.find('.colorpicker-color, .colorpicker-color div')
.css('backgroundColor', this.color.toString(this.format, true));
.css('backgroundColor', this.color.toString(true, this.format));
return val;
},
@@ -279,16 +281,16 @@ Colorpicker.prototype = {
var icn = this.component.find('i').eq(0);
if (icn.length > 0) {
icn.css({
'backgroundColor': color.toString(this.format, true)
'backgroundColor': color.toString(true, this.format)
});
} else {
this.component.css({
'backgroundColor': color.toString(this.format, true)
'backgroundColor': color.toString(true, this.format)
});
}
}
return color.toString(this.format, false);
return color.toString(false, this.format);
},
update: function(force) {
var val;
@@ -344,34 +346,31 @@ Colorpicker.prototype = {
return (this.input !== false);
},
isDisabled: function() {
if (this.hasInput()) {
return (this.input.prop('disabled') === true);
}
return false;
return this.disabled;
},
disable: function() {
if (this.hasInput()) {
this.input.prop('disabled', true);
this.element.trigger({
type: 'disable',
color: this.color,
value: this.getValue()
});
return true;
}
return false;
this.disabled = true;
this.element.trigger({
type: 'disable',
color: this.color,
value: this.getValue()
});
return true;
},
enable: function() {
if (this.hasInput()) {
this.input.prop('disabled', false);
this.element.trigger({
type: 'enable',
color: this.color,
value: this.getValue()
});
return true;
}
return false;
this.disabled = false;
this.element.trigger({
type: 'enable',
color: this.color,
value: this.getValue()
});
return true;
},
currentSlider: null,
mousePointer: {
@@ -490,7 +489,24 @@ Colorpicker.prototype = {
return false;
},
change: function(e) {
this.keyup(e);
this.color = this.createColor(this.input.val());
// Change format dynamically
// Only occurs if user choose the dynamic format by
// setting option format to false
if (this.color.origFormat && this.options.format === false) {
this.format = this.color.origFormat;
}
if (this.getValue(false) !== false) {
this.updateData();
this.updateComponent();
this.updatePicker();
}
this.element.trigger({
type: 'changeColor',
color: this.color,
value: this.input.val()
});
},
keyup: function(e) {
if ((e.keyCode === 38)) {
@@ -503,20 +519,8 @@ Colorpicker.prototype = {
this.color.value.a = Math.round((this.color.value.a - 0.01) * 100) / 100;
}
this.update(true);
} else {
this.color = this.createColor(this.input.val());
// Change format dynamically
// Only occurs if user choose the dynamic format by
// setting option format to false
if (this.color.origFormat && this.options.format === false) {
this.format = this.color.origFormat;
}
if (this.getValue(false) !== false) {
this.updateData();
this.updateComponent();
this.updatePicker();
}
}
this.element.trigger({
type: 'changeColor',
color: this.color,

View File

@@ -1,5 +1,5 @@
/*!
* Bootstrap Colorpicker v2.5.1
* Bootstrap Colorpicker v2.5.2
* https://itsjavi.com/bootstrap-colorpicker/
*
* Originally written by (c) 2012 Stefan Petre

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -10,14 +10,14 @@
},
"ignore": [],
"homepage": "https://github.com/eternicode/bootstrap-datepicker",
"version": "1.7.1",
"_release": "1.7.1",
"version": "1.9.0",
"_release": "1.9.0",
"_resolution": {
"type": "version",
"tag": "v1.7.1",
"commit": "9008cc328620c1695a0c95d036e57d356fca5c03"
"tag": "v1.9.0",
"commit": "fb8776d65825068b9f914ab37d6fd847c951f488"
},
"_source": "https://github.com/eternicode/bootstrap-datepicker.git",
"_target": "^1.7.0",
"_target": "^1.7",
"_originalSource": "bootstrap-datepicker"
}

View File

@@ -1,4 +1,4 @@
# EditorConfig is awesome: http://EditorConfig.org
# EditorConfig is awesome: https://editorconfig.org
root = true

View File

@@ -1,9 +1,7 @@
sudo: false
language: node_js
node_js:
- "6"
- "12"
before_script:
- npm install -g grunt-cli

View File

@@ -1,6 +1,24 @@
Changelog
=========
1.9.0
-----
## Features
* Added clearDates for clears range (#2114)
## Bugfix
* Hide today button when before start or after end date (#2474)
* Fix navigation buttons states (#2277)
* Fix updateNavArrows bug (#2230)
## Locales
### Bugfix
* Added monthsTitle to Latvian locale (#2255)
* Rename en-CA locale file to match the rest of the files (#2217)
* Fix cs locale date format (#2275)
* Added translation for months (fixing the default 'en' locale) (#2271)
1.7.1
-----
@@ -49,7 +67,7 @@ Changelog
* en-IE (#1800)
* ar-tn (#1863)
* Added Sinhala (si) locale (#2025)
* Occitan locale (#2024 + #2026)
* Occitan locale (#2024 + #2026)
* [l10n]Add breton translation (#2028)
* Added Tajik language (#2117)
* Add Uzbek latin and cyrill locales (#2152)
@@ -112,19 +130,19 @@ Features
* Replace arrow entities for glyphicon + template + libs snippets (Fixes: #610 #833 #1007)
* added class .disabled to dow header
* Rename "remove" to "destroy" and create alias
Bugfix
* Month/year view keyboard navigation
* fix changeMonth, changeYear not triggered when selecting day from prev/next month
* Fix default arrows for BS2 and screenshots (for docs)
* Extend beforeShowMonth event functionality to work like beforeShowDay and beforeShowYear
Locale changes
* Correct date format for ko locale
* Add en-AU (Australian English) locale
Repository
* Add CSS sourcemap
@@ -143,17 +161,17 @@ Bugfixes
* Use document scrollTop instead of body scrollTop when using the body container
* Fix focus for disabled week days (Fixes: #1365, #1187, #1648)
* Fixes enableOnReadOnly bug when datepicker is of type component
Translations
* Added missing translations for slovak translation. (Fixes: #1521)
* Added missing date format for norwegian (nb) locale (Fixes #1690)
* Armenian translation short names
* adding Today translation, default date format for the lithuanian translation
Docs
* Document data-api on container
* Added docs for the different stylesheet files. (Fixes #1459)
Repository
* Enable travis container builds for faster builds
@@ -181,7 +199,7 @@ Features
Bugfixes:
* Scrolling on mobile device closes datepicker
* Use $.on() instead $.bind()
* Fixed right-click and edit-menu paste
* Fixed right-click and edit-menu paste
* Ported prototype fix for Prototype Compability
* Fixed issue with startview year
* Fixed padding inconsistency with twitter bootstrap 3
@@ -190,10 +208,10 @@ Bugfixes:
* Fixes the issue with a date change firing mulitple change events
* removed hard dependency on bootstrap (because of twbs-sass package)
* Clearing the date should reset to defaultViewDate
* Datepicker orientation mix up - top = bottom and bottom = top
* Datepicker orientation mix up - top = bottom and bottom = top
* Fix cursor thead styles
* Fix date-reset issue when navigating to next with invalid date
* Using orientation:auto but date picker still appears above, cut off, when there plenty of space below.
* Using orientation:auto but date picker still appears above, cut off, when there plenty of space below.
* lots of orientation fixes
Locale changes:
@@ -275,16 +293,16 @@ Repo changes:
* Add package name and version to npm package.json
Bugfixes:
* Remove font-family declaration for datepicker
* Remove font-family declaration for datepicker
* Don't deselect date unless datepicker is multidate
* Removed comment from compiled CSS.
* Don't clear input after typing date and hitting Enter when keyboard nav is disabled
* Fixing the ui displaying 'undefined nan' when typing dates in Firefox & IE
* Reset tooltip to a default empty value
* Fix colspan if calendarWeeks & clearBtn are true
* Fixing the ui displaying 'undefined nan' when typing dates in Firefox & IE
* Reset tooltip to a default empty value
* Fix colspan if calendarWeeks & clearBtn are true
* Removed fixed width and height in large and small group addon
* z-index calculation should not stop at first element
* Fix IE8 bug with Array#splice with one argument
* Fix IE8 bug with Array#splice with one argument
Documentation:
* ghpages: jQuery js not being loaded when using HTTPS
@@ -306,7 +324,7 @@ Updated languages:
* Fixed Albanian translation typo's
* Add missing clear and format localization value for Russian translation
* Updated Serbian translation
* Fixed Ukrainian iso code to uk instead of ua
* Fixed Ukrainian iso code to uk instead of ua
* Updated greek translation
* Update Catalan and Spanish localizations
* Added missing armenian translations
@@ -351,7 +369,7 @@ Locale changes:
* De-duplicated Ukrainian files from `uk` and `ua` to just `ua`
Repository changes:
* Documentation has been moved from the base `README.md` file to the `docs/` folder, and been re-written to use sphinx docs. The docs are now viewable online at http://bootstrap-datepicker.readthedocs.org/. The [gh-pages](http://eternicode.github.io/bootstrap-datepicker/) branch has been reduced to the sandbox demo.
* Documentation has been moved from the base `README.md` file to the `docs/` folder, and been re-written to use sphinx docs. The docs are now viewable online at https://bootstrap-datepicker.readthedocs.org/. The [gh-pages](https://uxsolutions.github.io/bootstrap-datepicker/) branch has been reduced to the sandbox demo.
* Changed the js file header to point at repo/demo/docs urls instead of eyecon.ro
* The css files are now the output of the standalone build scripts instead of `build/build.less` etc.
* `composer.json` now supports component-installer
@@ -399,11 +417,11 @@ Locale changes:
1.1.3
----------
Clicking the clear button now triggers the input's `change` and datepicker's `changeDate` events.
Fixed a bug that broke the event-attached `format` function.
1.1.2
----------
@@ -465,7 +483,7 @@ Small optimizations release
v1.0.1
------
* Support for [Bower](http://twitter.github.com/bower/)
* Support for [Bower](https://bower.io/)
* Component pickers are now aligned under the input, not the add-on element.
* Japanese locale now has "today" and "format".
* "remove" method removes `.data().date` if the datepicker is on a non-input.

View File

@@ -67,8 +67,5 @@ members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
This Code of Conduct is adapted from the [Contributor Covenant](https://contributor-covenant.org), version 1.4,
available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>

View File

@@ -2,14 +2,14 @@
## Support requests
The issue tracker is not the place for support requests. If you get stuck with bootstrap-datepicker, it's very likely that the fine folks at [StackOverflow](http://stackoverflow.com/) will be able to help you; simply describe the problem you're having and provide them a link to the repo (so they know what code you're using). Another option is to post to the [bootstrap-datepicker google group](https://groups.google.com/group/bootstrap-datepicker).
The issue tracker is not the place for support requests. If you get stuck with bootstrap-datepicker, it's very likely that the fine folks at [StackOverflow](https://stackoverflow.com/) will be able to help you; simply describe the problem you're having and provide them a link to the repo (so they know what code you're using). Another option is to post to the [bootstrap-datepicker google group](https://groups.google.com/group/bootstrap-datepicker).
## Issues
If you've found a bug in bootstrap-datepicker, we want to know about it! However, please keep the following in mind:
* This is not the bootstrap-datepicker from [eyecon.ro](http://www.eyecon.ro/bootstrap-datepicker/). Stefan provided the initial code for bootstrap-datepicker, but this repo is divergent from his codebase. Please make sure you're using either the latest tagged version or the latest master from https://github.com/uxsolutions/bootstrap-datepicker/.
* A working example of the bug you've found is *much* easier to work with than a description alone. If possible, please provide a link to a demonstration of the bug, perhaps using http://jsfiddle.net/ .
* This is not the bootstrap-datepicker from [eyecon.ro](https://www.eyecon.ro/bootstrap-datepicker/). Stefan provided the initial code for bootstrap-datepicker, but this repo is divergent from his codebase. Please make sure you're using either the latest tagged version or the latest master from https://github.com/uxsolutions/bootstrap-datepicker/.
* A working example of the bug you've found is *much* easier to work with than a description alone. If possible, please provide a link to a demonstration of the bug, perhaps using https://jsfiddle.net/ .
* CDN-backed assets can be found at http://bsdp-assets.blackcherry.us/ . These should be used *only* for building test cases, as they may be removed or changed at any time.
* Finally, it's possible someone else has already reported the same bug you have. Please search the issue tracker for similar issues before posting your own. Thanks!

View File

@@ -1,5 +1,5 @@
/*!
* Datepicker for Bootstrap v1.7.1 (https://github.com/uxsolutions/bootstrap-datepicker)
* Datepicker for Bootstrap v1.9.0 (https://github.com/uxsolutions/bootstrap-datepicker)
*
* Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

View File

@@ -1,5 +1,5 @@
/*!
* Datepicker for Bootstrap v1.7.1 (https://github.com/uxsolutions/bootstrap-datepicker)
* Datepicker for Bootstrap v1.9.0 (https://github.com/uxsolutions/bootstrap-datepicker)
*
* Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

View File

@@ -1,5 +1,5 @@
/*!
* Datepicker for Bootstrap v1.7.1 (https://github.com/uxsolutions/bootstrap-datepicker)
* Datepicker for Bootstrap v1.9.0 (https://github.com/uxsolutions/bootstrap-datepicker)
*
* Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

View File

@@ -1,5 +1,5 @@
/*!
* Datepicker for Bootstrap v1.7.1 (https://github.com/uxsolutions/bootstrap-datepicker)
* Datepicker for Bootstrap v1.9.0 (https://github.com/uxsolutions/bootstrap-datepicker)
*
* Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

View File

@@ -1,5 +1,5 @@
/*!
* Datepicker for Bootstrap v1.7.1 (https://github.com/uxsolutions/bootstrap-datepicker)
* Datepicker for Bootstrap v1.9.0 (https://github.com/uxsolutions/bootstrap-datepicker)
*
* Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/
@@ -676,7 +676,6 @@ fieldset[disabled] .datepicker table tr td span.active.disabled:hover.focus {
min-width: 16px;
padding: 4px 5px;
line-height: 1.42857143;
text-shadow: 0 1px 0 #fff;
border-width: 1px 0;
margin-left: -5px;
margin-right: -5px;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
/*!
* Datepicker for Bootstrap v1.7.1 (https://github.com/uxsolutions/bootstrap-datepicker)
* Datepicker for Bootstrap v1.9.0 (https://github.com/uxsolutions/bootstrap-datepicker)
*
* Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/
@@ -676,7 +676,6 @@ fieldset[disabled] .datepicker table tr td span.active.disabled:hover.focus {
min-width: 16px;
padding: 4px 5px;
line-height: 1.42857143;
text-shadow: 0 1px 0 #fff;
border-width: 1px 0;
margin-left: -5px;
margin-right: -5px;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,12 +1,12 @@
/*!
* Datepicker for Bootstrap v1.7.1 (https://github.com/uxsolutions/bootstrap-datepicker)
* Datepicker for Bootstrap v1.9.0 (https://github.com/uxsolutions/bootstrap-datepicker)
*
* Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/
(function(factory){
if (typeof define === "function" && define.amd) {
define(["jquery"], factory);
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof exports === 'object') {
factory(require('jquery'));
} else {
@@ -89,6 +89,10 @@
var Datepicker = function(element, options){
$.data(element, 'datepicker', this);
this._events = [];
this._secondaryEvents = [];
this._process_options(options);
this.dates = new DateArray();
@@ -98,7 +102,7 @@
this.element = $(element);
this.isInput = this.element.is('input');
this.inputField = this.isInput ? this.element : this.element.find('input');
this.component = this.element.hasClass('date') ? this.element.find('.add-on, .input-group-addon, .btn') : false;
this.component = this.element.hasClass('date') ? this.element.find('.add-on, .input-group-addon, .input-group-append, .input-group-prepend, .btn') : false;
if (this.component && this.component.length === 0)
this.component = false;
this.isInline = !this.component && this.element.is('div');
@@ -308,8 +312,6 @@
o.defaultViewDate = UTCToday();
}
},
_events: [],
_secondaryEvents: [],
_applyEvents: function(evs){
for (var i=0, el, ch, ev; i < evs.length; i++){
el = evs[i][0];
@@ -465,7 +467,7 @@
},
show: function(){
if (this.inputField.prop('disabled') || (this.inputField.prop('readonly') && this.o.enableOnReadonly === false))
if (this.inputField.is(':disabled') || (this.inputField.prop('readonly') && this.o.enableOnReadonly === false))
return;
if (!this.isInline)
this.picker.appendTo(this.o.container);
@@ -962,7 +964,9 @@
endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
todaytxt = dates[this.o.language].today || dates['en'].today || '',
cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
titleFormat = dates[this.o.language].titleFormat || dates['en'].titleFormat,
titleFormat = dates[this.o.language].titleFormat || dates['en'].titleFormat,
todayDate = UTCToday(),
titleBtnVisible = (this.o.todayBtn === true || this.o.todayBtn === 'linked') && todayDate >= this.o.startDate && todayDate <= this.o.endDate && !this.weekOfDateIsDisabled(todayDate),
tooltip,
before;
if (isNaN(year) || isNaN(month))
@@ -971,7 +975,7 @@
.text(DPGlobal.formatDate(d, titleFormat, this.o.language));
this.picker.find('tfoot .today')
.text(todaytxt)
.css('display', this.o.todayBtn === true || this.o.todayBtn === 'linked' ? 'table-cell' : 'none');
.css('display', titleBtnVisible ? 'table-cell' : 'none');
this.picker.find('tfoot .clear')
.text(cleartxt)
.css('display', this.o.clearBtn === true ? 'table-cell' : 'none');
@@ -1141,10 +1145,6 @@
nextIsDisabled,
factor = 1;
switch (this.viewMode){
case 0:
prevIsDisabled = year <= startYear && month <= startMonth;
nextIsDisabled = year >= endYear && month >= endMonth;
break;
case 4:
factor *= 10;
/* falls through */
@@ -1156,7 +1156,11 @@
/* falls through */
case 1:
prevIsDisabled = Math.floor(year / factor) * factor <= startYear;
nextIsDisabled = Math.floor(year / factor) * factor + factor >= endYear;
nextIsDisabled = Math.floor(year / factor) * factor + factor > endYear;
break;
case 0:
prevIsDisabled = year <= startYear && month <= startMonth;
nextIsDisabled = year >= endYear && month >= endMonth;
break;
}
@@ -1532,6 +1536,11 @@
p.setRange(range);
});
},
clearDates: function(){
$.each(this.pickers, function(i, p){
p.clearDates();
});
},
dateUpdated: function(e){
// `this.updating` is a workaround for preventing infinite recursion
// between `changeDate` triggering and `setUTCDate` calling. Until
@@ -1998,7 +2007,7 @@
/* DATEPICKER VERSION
* =================== */
$.fn.datepicker.version = '1.7.1';
$.fn.datepicker.version = '1.9.0';
$.fn.datepicker.deprecated = function(msg){
var console = window.console;

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
!function(a){a.fn.datepicker.dates["en-CA"]={days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],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",monthsTitle:"Months",clear:"Clear",weekStart:0,format:"yyyy-mm-dd"}}(jQuery);
!function(a){a.fn.datepicker.dates["en-CA"]={days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],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",monthsTitle:"Months",clear:"Clear",weekStart:0,format:"yyyy-mm-dd"},a.fn.datepicker.deprecated("This filename doesn't follow the convention, use bootstrap-datepicker.en-CA.js instead.")}(jQuery);

View File

@@ -1 +1 @@
!function(a){a.fn.datepicker.dates.az={days:["Bazar","Bazar ertəsi","Çərşənbə axşamı","Çərşənbə","Cümə axşamı","Cümə","Şənbə"],daysShort:["B.","B.e","Ç.a","Ç.","C.a","C.","Ş."],daysMin:["B.","B.e","Ç.a","Ç.","C.a","C.","Ş."],months:["Yanvar","Fevral","Mart","Aprel","May","İyun","İyul","Avqust","Sentyabr","Oktyabr","Noyabr","Dekabr"],monthsShort:["Yan","Fev","Mar","Apr","May","İyun","İyul","Avq","Sen","Okt","Noy","Dek"],today:"Bu gün",weekStart:1}}(jQuery);
!function(a){a.fn.datepicker.dates.az={days:["Bazar","Bazar ertəsi","Çərşənbə axşamı","Çərşənbə","Cümə axşamı","Cümə","Şənbə"],daysShort:["B.","B.e","Ç.a","Ç.","C.a","C.","Ş."],daysMin:["B.","B.e","Ç.a","Ç.","C.a","C.","Ş."],months:["Yanvar","Fevral","Mart","Aprel","May","İyun","İyul","Avqust","Sentyabr","Oktyabr","Noyabr","Dekabr"],monthsShort:["Yan","Fev","Mar","Apr","May","İyun","İyul","Avq","Sen","Okt","Noy","Dek"],today:"Bu gün",weekStart:1,clear:"Təmizlə",monthsTitle:"Aylar"}}(jQuery);

View File

@@ -0,0 +1 @@
!function(a){a.fn.datepicker.dates.bm={days:["Kari","Ntɛnɛn","Tarata","Araba","Alamisa","Juma","Sibiri"],daysShort:["Kar","Ntɛ","Tar","Ara","Ala","Jum","Sib"],daysMin:["Ka","Nt","Ta","Ar","Al","Ju","Si"],months:["Zanwuyekalo","Fewuruyekalo","Marisikalo","Awirilikalo","Mɛkalo","Zuwɛnkalo","Zuluyekalo","Utikalo","Sɛtanburukalo","ɔkutɔburukalo","Nowanburukalo","Desanburukalo"],monthsShort:["Zan","Few","Mar","Awi","Mɛ","Zuw","Zul","Uti","Sɛt","ɔku","Now","Des"],today:"Bi",monthsTitle:"Kalo",clear:"Ka jɔsi",weekStart:1,format:"dd/mm/yyyy"}}(jQuery);

View File

@@ -1 +1 @@
!function(a){a.fn.datepicker.dates.cs={days:["Neděle","Pondělí","Úterý","Středa","Čtvrtek","Pátek","Sobota"],daysShort:["Ned","Pon","Úte","Stř","Čtv","Pát","Sob"],daysMin:["Ne","Po","Út","St","Čt","Pá","So"],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",clear:"Vymazat",monthsTitle:"Měsíc",weekStart:1,format:"dd.m.yyyy"}}(jQuery);
!function(a){a.fn.datepicker.dates.cs={days:["Neděle","Pondělí","Úterý","Středa","Čtvrtek","Pátek","Sobota"],daysShort:["Ned","Pon","Úte","Stř","Čtv","Pát","Sob"],daysMin:["Ne","Po","Út","St","Čt","Pá","So"],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",clear:"Vymazat",monthsTitle:"Měsíc",weekStart:1,format:"dd.mm.yyyy"}}(jQuery);

View File

@@ -1 +1 @@
!function(a){a.fn.datepicker.dates.da={days:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"],daysShort:["Søn","Man","Tir","Ons","Tor","Fre","Lør"],daysMin:["Sø","Ma","Ti","On","To","Fr","Lø"],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",weekStart:1,clear:"Nulstil",format:"dd/mm/yyyy"}}(jQuery);
!function(a){a.fn.datepicker.dates.da={days:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"],daysShort:["Søn","Man","Tir","Ons","Tor","Fre","Lør"],daysMin:["Sø","Ma","Ti","On","To","Fr","Lø"],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",weekStart:1,clear:"Nulstil",format:"dd/mm/yyyy",monthsTitle:"Måneder"}}(jQuery);

View File

@@ -0,0 +1 @@
!function(a){a.fn.datepicker.dates["en-CA"]={days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],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",monthsTitle:"Months",clear:"Clear",weekStart:0,format:"yyyy-mm-dd"}}(jQuery);

View File

@@ -1 +1 @@
!function(a){a.fn.datepicker.dates.lv={days:["Svētdiena","Pirmdiena","Otrdiena","Trešdiena","Ceturtdiena","Piektdiena","Sestdiena"],daysShort:["Sv","P","O","T","C","Pk","S"],daysMin:["Sv","Pr","Ot","Tr","Ce","Pk","Se"],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",clear:"Nodzēst",weekStart:1}}(jQuery);
!function(a){a.fn.datepicker.dates.lv={days:["Svētdiena","Pirmdiena","Otrdiena","Trešdiena","Ceturtdiena","Piektdiena","Sestdiena"],daysShort:["Sv","P","O","T","C","Pk","S"],daysMin:["Sv","Pr","Ot","Tr","Ce","Pk","Se"],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"],monthsTitle:"Mēneši",today:"Šodien",clear:"Nodzēst",weekStart:1}}(jQuery);

View File

@@ -1 +0,0 @@
!function(a){a.fn.datepicker.dates.nb={days:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"],daysShort:["Søn","Man","Tir","Ons","Tor","Fre","Lør"],daysMin:["Sø","Ma","Ti","On","To","Fr","Lø"],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",format:"dd.mm.yyyy"}}(jQuery);

View File

@@ -1 +1 @@
!function(a){a.fn.datepicker.dates.no={days:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"],daysShort:["Søn","Man","Tir","Ons","Tor","Fre","Lør"],daysMin:["Sø","Ma","Ti","On","To","Fr","Lø"],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",clear:"Nullstill",weekStart:1,format:"dd.mm.yyyy"}}(jQuery);
!function(a){a.fn.datepicker.dates.no={days:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],daysShort:["søn","man","tir","ons","tor","fre","lør"],daysMin:["sø","ma","ti","on","to","fr","lø"],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",monthsTitle:"Måneder",clear:"Nullstill",weekStart:1,format:"dd.mm.yyyy"}}(jQuery);

View File

@@ -1 +1 @@
!function(a){a.fn.datepicker.dates.sq={days:["E Diel","E Hënë","E Martē","E Mërkurë","E Enjte","E Premte","E Shtunë"],daysShort:["Die","Hën","Mar","Mër","Enj","Pre","Shtu"],daysMin:["Di","Hë","Ma","Më","En","Pr","Sht"],months:["Janar","Shkurt","Mars","Prill","Maj","Qershor","Korrik","Gusht","Shtator","Tetor","Nëntor","Dhjetor"],monthsShort:["Jan","Shk","Mar","Pri","Maj","Qer","Korr","Gu","Sht","Tet","Nën","Dhjet"],today:"Sot"}}(jQuery);
!function(a){a.fn.datepicker.dates.sq={days:["E Diel","E Hënë","E Martē","E Mërkurë","E Enjte","E Premte","E Shtunë"],daysShort:["Die","Hën","Mar","Mër","Enj","Pre","Shtu"],daysMin:["Di","Hë","Ma","Më","En","Pr","Sht"],months:["Janar","Shkurt","Mars","Prill","Maj","Qershor","Korrik","Gusht","Shtator","Tetor","Nëntor","Dhjetor"],monthsShort:["Jan","Shk","Mar","Pri","Maj","Qer","Korr","Gu","Sht","Tet","Nën","Dhjet"],monthsTitle:"Muaj",today:"Sot",weekStart:1,format:"dd/mm/yyyy",clear:"Pastro"}}(jQuery);

View File

@@ -1 +1 @@
!function(a){a.fn.datepicker.dates.sv={days:["Söndag","Måndag","Tisdag","Onsdag","Torsdag","Fredag","Lördag"],daysShort:["Sön","Mån","Tis","Ons","Tor","Fre","Lör"],daysMin:["Sö","Må","Ti","On","To","Fr","Lö"],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:"Idag",format:"yyyy-mm-dd",weekStart:1,clear:"Rensa"}}(jQuery);
!function(a){a.fn.datepicker.dates.sv={days:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"],daysShort:["sön","mån","tis","ons","tor","fre","lör"],daysMin:["sö","må","ti","on","to","fr","lö"],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:"Idag",format:"yyyy-mm-dd",weekStart:1,clear:"Rensa"}}(jQuery);

View File

@@ -0,0 +1 @@
!function(a){a.fn.datepicker.dates.tk={days:["Ýekşenbe","Duşenbe","Sişenbe","Çarşenbe","Penşenbe","Anna","Şenbe"],daysShort:["Ýek","Duş","Siş","Çar","Pen","Ann","Şen"],daysMin:["Ýe","Du","Si","Ça","Pe","An","Şe"],months:["Ýanwar","Fewral","Mart","Aprel","Maý","Iýun","Iýul","Awgust","Sentýabr","Oktýabr","Noýabr","Dekabr"],monthsShort:["Ýan","Few","Mar","Apr","Maý","Iýn","Iýl","Awg","Sen","Okt","Noý","Dek"],today:"Bu gün",monthsTitle:"Aýlar",clear:"Aýyr",weekStart:1,format:"dd.mm.yyyy"}}(jQuery);

View File

@@ -1 +1 @@
!function(a){a.fn.datepicker.dates["zh-CN"]={days:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],daysShort:["周日","周一","周二","周三","周四","周五","周六"],daysMin:["日","一","二","三","四","五","六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthsShort:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],today:"今",clear:"清除",format:"yyyymmdd",titleFormat:"yyyy年mm月",weekStart:1}}(jQuery);
!function(a){a.fn.datepicker.dates["zh-CN"]={days:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],daysShort:["周日","周一","周二","周三","周四","周五","周六"],daysMin:["日","一","二","三","四","五","六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthsShort:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],today:"今天",monthsTitle:"选择月份",clear:"清除",format:"yyyy-mm-dd",titleFormat:"yyyy年mm月",weekStart:1}}(jQuery);

View File

@@ -17,4 +17,4 @@ $ make html
The docs will be generated, the output files will be placed in the `_build/html/` directory, and can be browsed (locally) with any browser.
The docs can also be found online at <http://bootstrap-datepicker.readthedocs.org/>.
The docs can also be found online at <https://bootstrap-datepicker.readthedocs.org/>.

View File

@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="script/common.css">
<script src="script/common.js"></script>
<script>
function setup(){
$('input').datepicker({
format: 'mm-dd-yyyy',
showWeekDays: false
});
}
</script>
</head>
<body data-capture="input, .datepicker">
<div class="row">
<div class="col-sm-offset-4 col-sm-3">
<input type="text" class="form-control" value="03-03-2013">
</div>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -6,9 +6,9 @@ Bootstrap-datepicker provides a flexible datepicker widget in the Bootstrap styl
.. figure:: _static/screenshots/demo_head.png
:align: center
Versions are incremented according to `semver <http://semver.org/>`_.
Versions are incremented according to `semver <https://semver.org/>`_.
`Online Demo <https://eternicode.github.io/bootstrap-datepicker/>`_
`Online Demo <https://uxsolutions.github.io/bootstrap-datepicker>`_
Requirements

View File

@@ -449,6 +449,9 @@ Boolean. Default: true
If false, the datepicker will not append the names of the weekdays to its view. Default behavior is appending the weekdays.
.. figure:: _static/screenshots/option_showweekdays.png
:align: center
title
-----

View File

@@ -18,8 +18,8 @@
* ========================================================= */
(function(factory){
if (typeof define === "function" && define.amd) {
define(["jquery"], factory);
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof exports === 'object') {
factory(require('jquery'));
} else {
@@ -102,6 +102,10 @@
var Datepicker = function(element, options){
$.data(element, 'datepicker', this);
this._events = [];
this._secondaryEvents = [];
this._process_options(options);
this.dates = new DateArray();
@@ -111,7 +115,7 @@
this.element = $(element);
this.isInput = this.element.is('input');
this.inputField = this.isInput ? this.element : this.element.find('input');
this.component = this.element.hasClass('date') ? this.element.find('.add-on, .input-group-addon, .btn') : false;
this.component = this.element.hasClass('date') ? this.element.find('.add-on, .input-group-addon, .input-group-append, .input-group-prepend, .btn') : false;
if (this.component && this.component.length === 0)
this.component = false;
this.isInline = !this.component && this.element.is('div');
@@ -321,8 +325,6 @@
o.defaultViewDate = UTCToday();
}
},
_events: [],
_secondaryEvents: [],
_applyEvents: function(evs){
for (var i=0, el, ch, ev; i < evs.length; i++){
el = evs[i][0];
@@ -478,7 +480,7 @@
},
show: function(){
if (this.inputField.prop('disabled') || (this.inputField.prop('readonly') && this.o.enableOnReadonly === false))
if (this.inputField.is(':disabled') || (this.inputField.prop('readonly') && this.o.enableOnReadonly === false))
return;
if (!this.isInline)
this.picker.appendTo(this.o.container);
@@ -975,7 +977,9 @@
endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
todaytxt = dates[this.o.language].today || dates['en'].today || '',
cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
titleFormat = dates[this.o.language].titleFormat || dates['en'].titleFormat,
titleFormat = dates[this.o.language].titleFormat || dates['en'].titleFormat,
todayDate = UTCToday(),
titleBtnVisible = (this.o.todayBtn === true || this.o.todayBtn === 'linked') && todayDate >= this.o.startDate && todayDate <= this.o.endDate && !this.weekOfDateIsDisabled(todayDate),
tooltip,
before;
if (isNaN(year) || isNaN(month))
@@ -984,7 +988,7 @@
.text(DPGlobal.formatDate(d, titleFormat, this.o.language));
this.picker.find('tfoot .today')
.text(todaytxt)
.css('display', this.o.todayBtn === true || this.o.todayBtn === 'linked' ? 'table-cell' : 'none');
.css('display', titleBtnVisible ? 'table-cell' : 'none');
this.picker.find('tfoot .clear')
.text(cleartxt)
.css('display', this.o.clearBtn === true ? 'table-cell' : 'none');
@@ -1154,10 +1158,6 @@
nextIsDisabled,
factor = 1;
switch (this.viewMode){
case 0:
prevIsDisabled = year <= startYear && month <= startMonth;
nextIsDisabled = year >= endYear && month >= endMonth;
break;
case 4:
factor *= 10;
/* falls through */
@@ -1169,7 +1169,11 @@
/* falls through */
case 1:
prevIsDisabled = Math.floor(year / factor) * factor <= startYear;
nextIsDisabled = Math.floor(year / factor) * factor + factor >= endYear;
nextIsDisabled = Math.floor(year / factor) * factor + factor > endYear;
break;
case 0:
prevIsDisabled = year <= startYear && month <= startMonth;
nextIsDisabled = year >= endYear && month >= endMonth;
break;
}
@@ -1545,6 +1549,11 @@
p.setRange(range);
});
},
clearDates: function(){
$.each(this.pickers, function(i, p){
p.clearDates();
});
},
dateUpdated: function(e){
// `this.updating` is a workaround for preventing infinite recursion
// between `changeDate` triggering and `setUTCDate` calling. Until
@@ -2011,7 +2020,7 @@
/* DATEPICKER VERSION
* =================== */
$.fn.datepicker.version = '1.7.1';
$.fn.datepicker.version = '1.9.0';
$.fn.datepicker.deprecated = function(msg){
var console = window.console;

View File

@@ -1,6 +1,7 @@
/**
* Canadian English translation for bootstrap-datepicker
* Mike Nacey <mnacey@gmail.com>
* DEPRECATED: This filename doesn't follow the convention, use bootstrap-datepicker.en-CA.js instead
*/
;(function($){
$.fn.datepicker.dates['en-CA'] = {
@@ -15,4 +16,7 @@
weekStart: 0,
format: "yyyy-mm-dd"
};
$.fn.datepicker.deprecated('This filename doesn\'t follow the convention, use bootstrap-datepicker.en-CA.js instead.');
}(jQuery));

View File

@@ -7,6 +7,8 @@
months: ["Yanvar", "Fevral", "Mart", "Aprel", "May", "İyun", "İyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr"],
monthsShort: ["Yan", "Fev", "Mar", "Apr", "May", "İyun", "İyul", "Avq", "Sen", "Okt", "Noy", "Dek"],
today: "Bu gün",
weekStart: 1
weekStart: 1,
clear: "Təmizlə",
monthsTitle: 'Aylar'
};
}(jQuery));

View File

@@ -0,0 +1,18 @@
/**
* Bamanankan (bm) translation for bootstrap-datepicker
* Fatou Fall <fatou@medicmobile.org>
*/
;(function($){
$.fn.datepicker.dates['bm'] = {
days: ["Kari","Ntɛnɛn","Tarata","Araba","Alamisa","Juma","Sibiri"],
daysShort: ["Kar","Ntɛ","Tar","Ara","Ala","Jum","Sib"],
daysMin: ["Ka","Nt","Ta","Ar","Al","Ju","Si"],
months: ["Zanwuyekalo","Fewuruyekalo","Marisikalo","Awirilikalo","Mɛkalo","Zuwɛnkalo","Zuluyekalo","Utikalo","Sɛtanburukalo","ɔkutɔburukalo","Nowanburukalo","Desanburukalo"],
monthsShort: ["Zan","Few","Mar","Awi","Mɛ","Zuw","Zul","Uti","Sɛt","ɔku","Now","Des"],
today: "Bi",
monthsTitle: "Kalo",
clear: "Ka jɔsi",
weekStart: 1,
format: "dd/mm/yyyy"
};
}(jQuery));

View File

@@ -14,6 +14,6 @@
clear: "Vymazat",
monthsTitle: "Měsíc",
weekStart: 1,
format: "dd.m.yyyy"
format: "dd.mm.yyyy"
};
}(jQuery));

View File

@@ -13,6 +13,7 @@
today: "I Dag",
weekStart: 1,
clear: "Nulstil",
format: "dd/mm/yyyy"
format: "dd/mm/yyyy",
monthsTitle:"Måneder"
};
}(jQuery));

View File

@@ -0,0 +1,18 @@
/**
* Canadian English translation for bootstrap-datepicker
* Mike Nacey <mnacey@gmail.com>
*/
;(function($){
$.fn.datepicker.dates['en-CA'] = {
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
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",
monthsTitle: "Months",
clear: "Clear",
weekStart: 0,
format: "yyyy-mm-dd"
};
}(jQuery));

View File

@@ -10,6 +10,7 @@
daysMin: ["Sv", "Pr", "Ot", "Tr", "Ce", "Pk", "Se"],
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"],
monthsTitle: "Mēneši",
today: "Šodien",
clear: "Nodzēst",
weekStart: 1

View File

@@ -1,15 +0,0 @@
/**
* Norwegian (bokmål) translation for bootstrap-datepicker
* Fredrik Sundmyhr <http://github.com/fsundmyhr>
*/
;(function($){
$.fn.datepicker.dates['nb'] = {
days: ["Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag"],
daysShort: ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"],
daysMin: ["Sø", "Ma", "Ti", "On", "To", "Fr", "Lø"],
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",
format: "dd.mm.yyyy"
};
}(jQuery));

View File

@@ -1,14 +1,16 @@
/**
* Norwegian translation for bootstrap-datepicker
**/
* Norwegian translation for bootstrap-datepicker
* George Gooding <george@nettsentrisk.no>
*/
;(function($){
$.fn.datepicker.dates['no'] = {
days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
daysShort: ['Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'],
daysMin: ['Sø', 'Ma', 'Ti', 'On', 'To', 'Fr', 'Lø'],
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',
days: ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'],
daysShort: ['søn', 'man', 'tir', 'ons', 'tor', 'fre', 'lør'],
daysMin: ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø'],
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',
monthsTitle: 'Måneder',
clear: 'Nullstill',
weekStart: 1,
format: 'dd.mm.yyyy'

View File

@@ -9,7 +9,11 @@
daysMin: ["Di", "Hë", "Ma", "Më", "En", "Pr", "Sht"],
months: ["Janar", "Shkurt", "Mars", "Prill", "Maj", "Qershor", "Korrik", "Gusht", "Shtator", "Tetor", "Nëntor", "Dhjetor"],
monthsShort: ["Jan", "Shk", "Mar", "Pri", "Maj", "Qer", "Korr", "Gu", "Sht", "Tet", "Nën", "Dhjet"],
today: "Sot"
monthsTitle: "Muaj",
today: "Sot",
weekStart: 1,
format: "dd/mm/yyyy",
clear: "Pastro"
};
}(jQuery));

View File

@@ -4,11 +4,11 @@
*/
;(function($){
$.fn.datepicker.dates['sv'] = {
days: ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"],
daysShort: ["Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"],
daysMin: ["Sö", "Må", "Ti", "On", "To", "Fr", "Lö"],
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"],
days: ["söndag", "måndag", "tisdag", "onsdag", "torsdag", "fredag", "lördag"],
daysShort: ["sön", "mån", "tis", "ons", "tor", "fre", "lör"],
daysMin: ["sö", "må", "ti", "on", "to", "fr", "lö"],
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: "Idag",
format: "yyyy-mm-dd",
weekStart: 1,

View File

@@ -0,0 +1,18 @@
/**
* Turkmen translation for bootstrap-datepicker
* N'Bayramberdiyev <nbayramberdiyev@outlook.com>
*/
;(function($){
$.fn.datepicker.dates['tk'] = {
days: ["Ýekşenbe", "Duşenbe", "Sişenbe", "Çarşenbe", "Penşenbe", "Anna", "Şenbe"],
daysShort: ["Ýek", "Duş", "Siş", "Çar", "Pen", "Ann", "Şen"],
daysMin: ["Ýe", "Du", "Si", "Ça", "Pe", "An", "Şe"],
months: ["Ýanwar", "Fewral", "Mart", "Aprel", "Maý", "Iýun", "Iýul", "Awgust", "Sentýabr", "Oktýabr", "Noýabr", "Dekabr"],
monthsShort: ["Ýan", "Few", "Mar", "Apr", "Maý", "Iýn", "Iýl", "Awg", "Sen", "Okt", "Noý", "Dek"],
today: "Bu gün",
monthsTitle: "Aýlar",
clear: "Aýyr",
weekStart: 1,
format: "dd.mm.yyyy"
};
}(jQuery));

View File

@@ -6,12 +6,13 @@
$.fn.datepicker.dates['zh-CN'] = {
days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
daysMin: ["日", "一", "二", "三", "四", "五", "六"],
daysMin: ["日", "一", "二", "三", "四", "五", "六"],
months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
monthsShort: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
today: "今",
today: "今",
monthsTitle: "选择月份",
clear: "清除",
format: "yyyymmdd",
format: "yyyy-mm-dd",
titleFormat: "yyyy年mm月",
weekStart: 1
};

View File

@@ -250,7 +250,6 @@
min-width: 16px;
padding: 4px 5px;
line-height: @line-height-base;
text-shadow: 0 1px 0 #fff;
border-width: 1px 0;
margin-left: -5px;
margin-right: -5px;

View File

@@ -1,7 +1,7 @@
{
"name": "bootstrap-datepicker",
"description": "A datepicker for Bootstrap",
"version": "1.7.1",
"version": "1.9.0",
"license": "Apache-2.0",
"keywords": [
"datepicker",
@@ -28,10 +28,10 @@
"jquery": ">=1.7.1 <4.0.0"
},
"devDependencies": {
"grunt": "^1.0.1",
"grunt": "^1.0.4",
"grunt-banner": "~0.6.0",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-compress": "^1.4.1",
"grunt-contrib-compress": "^1.5.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-csslint": "^2.0.0",
"grunt-contrib-cssmin": "^1.0.2",
@@ -42,7 +42,7 @@
"grunt-jscs": "^3.0.1",
"grunt-string-replace": "^1.3.1",
"load-grunt-tasks": "^3.5.2",
"phantomjs-prebuilt": "~2.1.8",
"phantomjs-prebuilt": "~2.1.16",
"time-grunt": "^1.4.0"
}
}

View File

@@ -1,11 +1,15 @@
module('Component', {
setup: function(){
this.component = $('<div class="input-append date" id="datepicker">'+
'<input size="16" type="text" value="12-02-2012" readonly>'+
'<span class="add-on"><i class="icon-th"></i></span>'+
'</div>')
.appendTo('#qunit-fixture')
.datepicker({format: "dd-mm-yyyy"});
this.fieldset = $('<fieldset>' +
'<div class="input-append date" id="datepicker">'+
'<input size="16" type="text" value="12-02-2012" readonly>'+
'<span class="add-on"><i class="icon-th"></i></span>'+
'</div>' +
'<fieldset>')
.appendTo('#qunit-fixture');
this.component = this.fieldset.find('.input-append')
.datepicker({format: "dd-mm-yyyy"});
this.input = this.component.find('input');
this.addon = this.component.find('.add-on');
this.dp = this.component.data('datepicker');
@@ -34,6 +38,9 @@ test('Dont activation (by disabled) by component', function(){
this.addon.click();
ok(!this.picker.is(':visible'));
this.input.prop('disabled', false);
this.fieldset.prop('disabled', true);
this.addon.click();
ok(!this.picker.is(':visible'));
});
test('simple keyboard nav test', function(){

View File

@@ -281,6 +281,309 @@ test('Today Button: today visibility when enabled', function(){
ok(picker.find('.datepicker-years tfoot .today').is(':visible'), 'Today button visible');
});
test('Today Button: today invisible when enabled and startDate is after today', function () {
var startDate = new Date();
startDate.setDate(startDate.getDate() + 1);
var input = $('<input />')
.appendTo('#qunit-fixture')
.val('2012-03-05')
.datepicker({
format: 'yyyy-mm-dd',
startDate: startDate,
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(':not(:visible)'), 'Today button not visible');
picker.find('.datepicker-days thead th.datepicker-switch').click();
ok(picker.find('.datepicker-months').is(':visible'), 'Months view visible');
ok(picker.find('.datepicker-months tfoot .today').is(':not(:visible)'), 'Today button not visible');
picker.find('.datepicker-months thead th.datepicker-switch').click();
ok(picker.find('.datepicker-years').is(':visible'), 'Years view visible');
ok(picker.find('.datepicker-years tfoot .today').is(':not(:visible)'), 'Today button not visible');
});
test('Today Button: today invisible when enabled and endDate is before today', function () {
var endDate = new Date();
endDate.setDate(endDate.getDate() - 1);
var input = $('<input />')
.appendTo('#qunit-fixture')
.val('2012-03-05')
.datepicker({
format: 'yyyy-mm-dd',
endDate: endDate,
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(':not(:visible)'), 'Today button not visible');
picker.find('.datepicker-days thead th.datepicker-switch').click();
ok(picker.find('.datepicker-months').is(':visible'), 'Months view visible');
ok(picker.find('.datepicker-months tfoot .today').is(':not(:visible)'), 'Today button not visible');
picker.find('.datepicker-months thead th.datepicker-switch').click();
ok(picker.find('.datepicker-years').is(':visible'), 'Years view visible');
ok(picker.find('.datepicker-years tfoot .today').is(':not(:visible)'), 'Today button not visible');
});
test('Today Button: today visible when enabled and today is between startDate and enDate', function () {
var startDate = new Date();
startDate.setDate(startDate.getDate() - 1);
var endDate = new Date();
endDate.setDate(endDate.getDate() + 1);
var input = $('<input />')
.appendTo('#qunit-fixture')
.val('2012-03-05')
.datepicker({
format: 'yyyy-mm-dd',
startDate: startDate,
endDate: endDate,
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.datepicker-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.datepicker-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: today visible when enabled and daysOfWeekDisabled does not include current day', function () {
var input = $('<input />')
.appendTo('#qunit-fixture')
.val('2012-03-05')
.datepicker({
format: 'yyyy-mm-dd',
daysOfWeekDisabled: [(new Date().getDay() + 1) % 7],
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.datepicker-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.datepicker-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: today invisible when enabled and daysOfWeekDisabled includes current day', function () {
var input = $('<input />')
.appendTo('#qunit-fixture')
.val('2012-03-05')
.datepicker({
format: 'yyyy-mm-dd',
daysOfWeekDisabled: [new Date().getDay()],
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(':not(:visible)'), 'Today button not visible');
picker.find('.datepicker-days thead th.datepicker-switch').click();
ok(picker.find('.datepicker-months').is(':visible'), 'Months view visible');
ok(picker.find('.datepicker-months tfoot .today').is(':not(:visible)'), 'Today button not visible');
picker.find('.datepicker-months thead th.datepicker-switch').click();
ok(picker.find('.datepicker-years').is(':visible'), 'Years view visible');
ok(picker.find('.datepicker-years tfoot .today').is(':not(:visible)'), 'Today button not visible');
});
test('Today Button: today visibility when linked', function () {
var input = $('<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');
picker.find('.datepicker-days thead th.datepicker-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.datepicker-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: today invisible when linked and startDate is after today', function () {
var startDate = new Date();
startDate.setDate(startDate.getDate() + 1);
var input = $('<input />')
.appendTo('#qunit-fixture')
.val('2012-03-05')
.datepicker({
format: 'yyyy-mm-dd',
startDate: startDate,
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(':not(:visible)'), 'Today button not visible');
picker.find('.datepicker-days thead th.datepicker-switch').click();
ok(picker.find('.datepicker-months').is(':visible'), 'Months view visible');
ok(picker.find('.datepicker-months tfoot .today').is(':not(:visible)'), 'Today button not visible');
picker.find('.datepicker-months thead th.datepicker-switch').click();
ok(picker.find('.datepicker-years').is(':visible'), 'Years view visible');
ok(picker.find('.datepicker-years tfoot .today').is(':not(:visible)'), 'Today button not visible');
});
test('Today Button: today invisible when linked and endDate is before today', function () {
var endDate = new Date();
endDate.setDate(endDate.getDate() - 1);
var input = $('<input />')
.appendTo('#qunit-fixture')
.val('2012-03-05')
.datepicker({
format: 'yyyy-mm-dd',
endDate: endDate,
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(':not(:visible)'), 'Today button not visible');
picker.find('.datepicker-days thead th.datepicker-switch').click();
ok(picker.find('.datepicker-months').is(':visible'), 'Months view visible');
ok(picker.find('.datepicker-months tfoot .today').is(':not(:visible)'), 'Today button not visible');
picker.find('.datepicker-months thead th.datepicker-switch').click();
ok(picker.find('.datepicker-years').is(':visible'), 'Years view visible');
ok(picker.find('.datepicker-years tfoot .today').is(':not(:visible)'), 'Today button not visible');
});
test('Today Button: today visible when linked and today is between startDate and enDate', function () {
var startDate = new Date();
startDate.setDate(startDate.getDate() - 1);
var endDate = new Date();
endDate.setDate(endDate.getDate() + 1);
var input = $('<input />')
.appendTo('#qunit-fixture')
.val('2012-03-05')
.datepicker({
format: 'yyyy-mm-dd',
startDate: startDate,
endDate: endDate,
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');
picker.find('.datepicker-days thead th.datepicker-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.datepicker-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: today visible when linked and daysOfWeekDisabled does not include current day', function () {
var input = $('<input />')
.appendTo('#qunit-fixture')
.val('2012-03-05')
.datepicker({
format: 'yyyy-mm-dd',
daysOfWeekDisabled: [(new Date().getDay + 1) % 7],
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');
picker.find('.datepicker-days thead th.datepicker-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.datepicker-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: today invisible when linked and daysOfWeekDisabled includes current day', function () {
var input = $('<input />')
.appendTo('#qunit-fixture')
.val('2012-03-05')
.datepicker({
format: 'yyyy-mm-dd',
daysOfWeekDisabled: [new Date().getDay()],
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(':not(:visible)'), 'Today button not visible');
picker.find('.datepicker-days thead th.datepicker-switch').click();
ok(picker.find('.datepicker-months').is(':visible'), 'Months view visible');
ok(picker.find('.datepicker-months tfoot .today').is(':not(:visible)'), 'Today button not visible');
picker.find('.datepicker-months thead th.datepicker-switch').click();
ok(picker.find('.datepicker-years').is(':visible'), 'Years view visible');
ok(picker.find('.datepicker-years tfoot .today').is(':not(:visible)'), 'Today button not visible');
});
test('Today Button: data-api', function(){
var input = $('<input data-date-today-btn="true" />')
.appendTo('#qunit-fixture')
@@ -1626,13 +1929,13 @@ test('Nav arrow html templates .prev click', function () {
equal(target.text(), '2011');
});
test('Visibility of the prev and next arrows for decade/century/millenium views with startDate and endDate', function(){
test('Visibility of the prev and next arrows for year/decade/century/millenium views with startDate and endDate', function(){
var input = $('<input />')
.appendTo('#qunit-fixture')
.val('01/01/2015')
.datepicker({
format: 'dd/mm/yyyy',
startView: 2,
startView: 1,
startDate: '01/12/2014',
endDate: '01/12/2016'
}),
@@ -1642,24 +1945,102 @@ test('Visibility of the prev and next arrows for decade/century/millenium views
input.focus();
target = picker.find('.datepicker-months thead th.prev');
ok(!target.hasClass('disabled'), 'Prev switcher is not hidden');
target = picker.find('.datepicker-months thead th.next');
ok(!target.hasClass('disabled'), 'Next switcher is not hidden');
picker.find('.datepicker-months thead th.datepicker-switch').trigger('click');
target = picker.find('.datepicker-years thead th.prev');
ok(target.hasClass('disabled'), 'Prev switcher is hidden');
target = picker.find('.datepicker-years thead th.next');
ok(target.hasClass('disabled'), 'Next switcher is hidden');
picker.find('.datepicker-years thead th.datepicker-switch').click();
picker.find('.datepicker-years thead th.datepicker-switch').trigger('click');
target = picker.find('.datepicker-decades thead th.prev');
ok(target.hasClass('disabled'), 'Prev switcher is hidden');
target = picker.find('.datepicker-decades thead th.next');
ok(target.hasClass('disabled'), 'Next switcher is hidden');
picker.find('.datepicker-decades thead th.datepicker-switch').click();
picker.find('.datepicker-decades thead th.datepicker-switch').trigger('click');
target = picker.find('.datepicker-centuries thead th.prev');
ok(target.hasClass('disabled'), 'Prev switcher is hidden');
target = picker.find('.datepicker-centuries thead th.next');
ok(target.hasClass('disabled'), 'Next switcher is hidden');
});
test('Visibility of the prev arrow for month/year/decade/century/millenium views with startDate eq value', function(){
var input = $('<input />')
.appendTo('#qunit-fixture')
.val('01/01/2014')
.datepicker({
format: 'dd/mm/yyyy',
startView: 0,
startDate: '01/01/2014'
}),
dp = input.data('datepicker'),
picker = dp.picker,
target;
input.focus();
target = picker.find('.datepicker-days thead th.prev');
ok(target.hasClass('disabled'), 'Prev switcher is not hidden');
picker.find('.datepicker-days thead th.datepicker-switch').trigger('click');
target = picker.find('.datepicker-months thead th.prev');
ok(target.hasClass('disabled'), 'Prev switcher is not hidden');
picker.find('.datepicker-months thead th.datepicker-switch').trigger('click');
target = picker.find('.datepicker-years thead th.prev');
ok(target.hasClass('disabled'), 'Prev switcher is hidden');
picker.find('.datepicker-years thead th.datepicker-switch').trigger('click');
target = picker.find('.datepicker-decades thead th.prev');
ok(target.hasClass('disabled'), 'Prev switcher is hidden');
picker.find('.datepicker-decades thead th.datepicker-switch').trigger('click');
target = picker.find('.datepicker-centuries thead th.prev');
ok(target.hasClass('disabled'), 'Prev switcher is hidden');
});
test('Visibility of the next arrow for month/year/decade/century/millenium views with endDate eq value', function(){
var input = $('<input />')
.appendTo('#qunit-fixture')
.val('31/12/1999')
.datepicker({
format: 'dd/mm/yyyy',
startView: 0,
endDate: '31/12/1999'
}),
dp = input.data('datepicker'),
picker = dp.picker,
target;
input.focus();
target = picker.find('.datepicker-days thead th.next');
ok(target.hasClass('disabled'), 'Next switcher is not hidden');
picker.find('.datepicker-days thead th.datepicker-switch').trigger('click');
target = picker.find('.datepicker-months thead th.next');
ok(target.hasClass('disabled'), 'Next switcher is not hidden');
picker.find('.datepicker-months thead th.datepicker-switch').trigger('click');
target = picker.find('.datepicker-years thead th.next');
ok(target.hasClass('disabled'), 'Next switcher is hidden');
picker.find('.datepicker-years thead th.datepicker-switch').trigger('click');
target = picker.find('.datepicker-decades thead th.next');
ok(target.hasClass('disabled'), 'Next switcher is hidden');
picker.find('.datepicker-decades thead th.datepicker-switch').trigger('click');
target = picker.find('.datepicker-centuries thead th.next');
ok(target.hasClass('disabled'), 'Next switcher is hidden');
});
test('date cells (outdated)', function(){
var input = $('<input />')
.appendTo('#qunit-fixture')

View File

@@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="assets/qunit.css" />
<link rel="stylesheet" href="assets/qunit.css">
<script src="assets/qunit.js"></script>
<!-- console.log for test failures: enable locally if you need extra debug info-->
<!--<script src="assets/qunit-logging.js"></script>-->

File diff suppressed because it is too large Load Diff

View File

@@ -1,33 +0,0 @@
{
"name": "bootstrap-slider",
"main": [
"bootstrap-slider.js",
"slider.css"
],
"homepage": "https://github.com/pammacdotnet/bootstrap-slider",
"authors": [
"pammacdotnet"
],
"description": "Eyecon Slider for Bootstrap",
"keywords": [
"slider",
"bootstrap"
],
"license": "Apache",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"_release": "879a98dcd0",
"_resolution": {
"type": "branch",
"branch": "master",
"commit": "879a98dcd0923107363861e56423f3cc1c2472e7"
},
"_source": "https://github.com/pammacdotnet/bootstrap-slider.git",
"_target": "*",
"_originalSource": "bootstrap-slider"
}

View File

@@ -1,26 +0,0 @@
Bootstrap Slider
=============
Fork of eyecon's [bootstrap-slider](http://www.eyecon.ro/bootstrap-slider/).
Specially remastered for iLIME Project @ UNIR Research. More info:
[http://blogs.unir.net/elearning/telsock-research-group/](http://)
![ScreenShot](https://raw.github.com/pammacdotnet/bootstrap-slider/master/locks.png)
Changes
----------
Current changes include:
+ Better responsive support
+ Updated look and feel
+ Minor layout tweaks
+ Removed built-in handle types
+ Bower install
+ Limits and locks

View File

@@ -1,427 +0,0 @@
/* =========================================================
* bootstrap-slider.js v2.0.0
* http://www.eyecon.ro/bootstrap-slider
* =========================================================
* Copyright 2012 Stefan Petre
*
* 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( $ ) {
var Slider = function(element, options) {
this.dragLocked = false;
this.limit = 100000;
this.element = $(element).hide();
this.picker = $('<div class="slider">'+
'<div class="slider-track">'+
'<div class="slider-selection"></div>'+
'<div class="slider-handle"></div>'+
'<div class="slider-handle"></div>'+
'</div>'+
'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'+
'</div>')
.insertBefore(this.element)
.append(this.element);
this.id = this.element.data('slider-id')||options.id;
if (this.id) {
this.picker[0].id = this.id;
}
if (typeof Modernizr !== 'undefined' && Modernizr.touch) {
this.touchCapable = true;
}
var tooltip = this.element.data('slider-tooltip')||options.tooltip;
this.tooltip = this.picker.find('.tooltip');
this.tooltipInner = this.tooltip.find('div.tooltip-inner');
this.orientation = this.element.data('slider-orientation')||options.orientation;
switch(this.orientation) {
case 'vertical':
this.picker.addClass('slider-vertical');
this.stylePos = 'top';
this.mousePos = 'pageY';
this.sizePos = 'offsetHeight';
this.tooltip.addClass('right')[0].style.left = '100%';
break;
default:
this.picker
.addClass('slider-horizontal')
.css('width', this.element.outerWidth());
this.orientation = 'horizontal';
this.stylePos = 'left';
this.mousePos = 'pageX';
this.sizePos = 'offsetWidth';
this.tooltip.addClass('top')[0].style.top = -this.tooltip.outerHeight() - 14 + 'px';
break;
}
this.min = this.element.data('slider-min')||options.min;
this.max = this.element.data('slider-max')||options.max;
this.step = this.element.data('slider-step')||options.step;
this.value = this.element.data('slider-value')||options.value;
if (this.value[1]) {
this.range = true;
}
this.selection = this.element.data('slider-selection')||options.selection;
this.selectionEl = this.picker.find('.slider-selection');
if (this.selection === 'none') {
this.selectionEl.addClass('hide');
}
this.selectionElStyle = this.selectionEl[0].style;
this.handle1 = this.picker.find('.slider-handle:first');
this.handle1Stype = this.handle1[0].style;
this.handle2 = this.picker.find('.slider-handle:last');
this.handle2Stype = this.handle2[0].style;
var handle = this.element.data('slider-handle')||options.handle;
switch(handle) {
case 'round':
this.handle1.addClass('round');
this.handle2.addClass('round');
break
case 'triangle':
this.handle1.addClass('triangle');
this.handle2.addClass('triangle');
break
}
if (this.range) {
this.value[0] = Math.max(this.min, Math.min(this.max, this.value[0]));
this.value[1] = Math.max(this.min, Math.min(this.max, this.value[1]));
} else {
this.value = [ Math.max(this.min, Math.min(this.max, this.value))];
this.handle2.addClass('hide');
if (this.selection == 'after') {
this.value[1] = this.max;
} else {
this.value[1] = this.min;
}
}
this.diff = this.max - this.min;
this.percentage = [
(this.value[0]-this.min)*100/this.diff,
(this.value[1]-this.min)*100/this.diff,
this.step*100/this.diff
];
this.offset = this.picker.offset();
this.size = this.picker[0][this.sizePos];
this.formater = options.formater;
this.reversed = this.element.data('slider-reversed')||options.reversed;
this.layout();
if (this.touchCapable) {
// Touch: Bind touch events:
this.picker.on({
touchstart: $.proxy(this.mousedown, this)
});
} else {
this.picker.on({
mousedown: $.proxy(this.mousedown, this)
});
}
if (tooltip === 'show') {
this.picker.on({
mouseenter: $.proxy(this.showTooltip, this),
mouseleave: $.proxy(this.hideTooltip, this)
});
} else {
this.tooltip.addClass('hide');
}
};
Slider.prototype = {
constructor: Slider,
over: false,
inDrag: false,
showTooltip: function(){
this.tooltip.addClass('in');
//var left = Math.round(this.percent*this.width);
//this.tooltip.css('left', left - this.tooltip.outerWidth()/2);
this.over = true;
},
hideTooltip: function(){
if (this.inDrag === false) {
this.tooltip.removeClass('in');
}
this.over = false;
},
layout: function(){
var positionPercentages;
if(this.reversed) {
positionPercentages = [ this.percentage[1] - this.percentage[0], this.percentage[1] ];
} else {
positionPercentages = [ this.percentage[0], this.percentage[1] ];
}
this.handle1Stype[this.stylePos] = positionPercentages[0]+'%';
this.handle2Stype[this.stylePos] = positionPercentages[1]+'%';
if (this.orientation == 'vertical') {
this.selectionElStyle.top = Math.min(positionPercentages[0], positionPercentages[1]) +'%';
this.selectionElStyle.height = Math.abs(positionPercentages[0] - positionPercentages[1]) +'%';
} else {
this.selectionElStyle.left = Math.min(positionPercentages[0], positionPercentages[1]) +'%';
this.selectionElStyle.width = Math.abs(positionPercentages[0] - positionPercentages[1]) +'%';
}
if (this.range) {
this.tooltipInner.text(
this.formater(this.value[0]) +
' : ' +
this.formater(this.value[1])
);
this.tooltip[0].style[this.stylePos] = this.size * (positionPercentages[0] + (positionPercentages[1] - positionPercentages[0])/2)/100 - (this.orientation === 'vertical' ? this.tooltip.outerHeight()/2 : this.tooltip.outerWidth()/2) +'px';
} else {
this.tooltipInner.text(
this.formater(this.value[0])
);
this.tooltip[0].style[this.stylePos] = this.size * positionPercentages[0]/100 - (this.orientation === 'vertical' ? this.tooltip.outerHeight()/2 : this.tooltip.outerWidth()/2) +'px';
}
},
mousedown: function(ev) {
if (!this.dragLocked){
// Touch: Get the original event:
if (this.touchCapable && ev.type === 'touchstart') {
ev = ev.originalEvent;
}
this.offset = this.picker.offset();
this.size = this.picker[0][this.sizePos];
var percentage = this.getPercentage(ev);
if (this.range) {
var diff1 = Math.abs(this.percentage[0] - percentage);
var diff2 = Math.abs(this.percentage[1] - percentage);
this.dragged = (diff1 < diff2) ? 0 : 1;
} else {
this.dragged = 0;
}
this.percentage[this.dragged] = this.reversed ? this.percentage[1] - percentage : percentage;
this.layout();
if (this.touchCapable) {
// Touch: Bind touch events:
$(document).on({
touchmove: $.proxy(this.mousemove, this),
touchend: $.proxy(this.mouseup, this)
});
} else {
$(document).on({
mousemove: $.proxy(this.mousemove, this),
mouseup: $.proxy(this.mouseup, this)
});
}
this.inDrag = true;
var val = this.calculateValue();
this.setValue(val);
this.element.trigger({
type: 'slideStart',
value: val
}).trigger({
type: 'slide',
value: val
});
return false;
}
},
mousemove: function(ev) {
// Touch: Get the original event:
if (!this.dragLocked){
if (this.touchCapable && ev.type === 'touchmove') {
ev = ev.originalEvent;
}
var percentage = this.getPercentage(ev);
if (this.range) {
if (this.dragged === 0 && this.percentage[1] < percentage) {
this.percentage[0] = this.percentage[1];
this.dragged = 1;
} else if (this.dragged === 1 && this.percentage[0] > percentage) {
this.percentage[1] = this.percentage[0];
this.dragged = 0;
}
}
x = this.reversed ? this.percentage[1] - percentage : percentage;
if (x > this.limit) {
return ;
}
this.percentage[this.dragged] = x;
this.layout();
var val = this.calculateValue();
this.setValue(val);
this.element
.trigger({
type: 'slide',
value: val
})
.data('value', val)
.prop('value', val);
return false;
}
},
mouseup: function(ev) {
if (this.touchCapable) {
// Touch: Bind touch events:
$(document).off({
touchmove: this.mousemove,
touchend: this.mouseup
});
} else {
$(document).off({
mousemove: this.mousemove,
mouseup: this.mouseup
});
}
this.inDrag = false;
if (this.over == false) {
this.hideTooltip();
}
this.element;
var val = this.calculateValue();
this.layout();
this.element
.trigger({
type: 'slideStop',
value: val
})
.data('value', val)
.prop('value', val);
return false;
},
calculateValue: function() {
var val;
if (this.range) {
val = [
(this.min + Math.round((this.diff * this.percentage[0]/100)/this.step)*this.step),
(this.min + Math.round((this.diff * this.percentage[1]/100)/this.step)*this.step)
];
this.value = val;
} else {
val = (this.min + Math.round((this.diff * this.percentage[0]/100)/this.step)*this.step);
this.value = [val, this.value[1]];
}
return val;
},
getPercentage: function(ev) {
if (this.touchCapable) {
ev = ev.touches[0];
}
var percentage = (ev[this.mousePos] - this.offset[this.stylePos])*100/this.size;
percentage = Math.round(percentage/this.percentage[2])*this.percentage[2];
return Math.max(0, Math.min(100, percentage));
},
getValue: function() {
if (this.range) {
return this.value;
}
return this.value[0];
},
setLimit: function(val) {
this.limit = val;
},
setDragLocked: function(val) {
this.dragLocked = val;
},
getDragLocked: function(val) {
return this.dragLocked;
},
setValue: function(val) {
this.value = val;
if (this.range) {
this.value[0] = Math.max(this.min, Math.min(this.max, this.value[0]));
this.value[1] = Math.max(this.min, Math.min(this.max, this.value[1]));
} else {
this.value = [ Math.max(this.min, Math.min(this.max, this.value))];
this.handle2.addClass('hide');
if (this.selection == 'after') {
this.value[1] = this.max;
} else {
this.value[1] = this.min;
}
}
this.diff = this.max - this.min;
this.percentage = [
(this.value[0]-this.min)*100/this.diff,
(this.value[1]-this.min)*100/this.diff,
this.step*100/this.diff
];
this.layout();
},
destroy: function(){
this.element.show().insertBefore(this.picker);
this.picker.remove();
},
};
$.fn.slider = function ( option, val ) {
return this.each(function () {
var $this = $(this),
data = $this.data('slider'),
options = typeof option === 'object' && option;
if (!data) {
$this.data('slider', (data = new Slider(this, $.extend({}, $.fn.slider.defaults,options))));
}
if (typeof option == 'string') {
data[option](val);
}
})
};
$.fn.slider.defaults = {
min: 0,
max: 10,
step: 1,
orientation: 'horizontal',
value: 5,
selection: 'before',
tooltip: 'show',
handle: 'round',
reversed : false,
limit: 100000,
dragLocked: false,
formater: function(value) {
return value;
}
};
$.fn.slider.Constructor = Slider;
}( window.jQuery );

View File

@@ -1,22 +0,0 @@
{
"name": "bootstrap-slider",
"main": ["bootstrap-slider.js", "slider.css"],
"version": "2.0.0",
"homepage": "https://github.com/pammacdotnet/bootstrap-slider",
"authors": [
"pammacdotnet"
],
"description": "Eyecon Slider for Bootstrap",
"keywords": [
"slider",
"bootstrap"
],
"license": "Apache",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Some files were not shown because too many files have changed in this diff Show More