adminlte_rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +51 -0
- data/Rakefile +10 -0
- data/adminlte_rails.gemspec +27 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/adminlte_rails.rb +5 -0
- data/lib/adminlte_rails/engine.rb +7 -0
- data/lib/adminlte_rails/version.rb +3 -0
- data/vendor/assets/javascripts/adminlte.js +3 -0
- data/vendor/assets/javascripts/adminlte.min.js +3 -0
- data/vendor/assets/javascripts/adminlte/adminlte.js +1129 -0
- data/vendor/assets/javascripts/adminlte/adminlte.min.js +14 -0
- data/vendor/assets/javascripts/adminlte/plugins/bootstrap-colorpicker/bootstrap-colorpicker.js +1319 -0
- data/vendor/assets/javascripts/adminlte/plugins/bootstrap-colorpicker/bootstrap-colorpicker.min.js +5 -0
- data/vendor/assets/javascripts/adminlte/plugins/bootstrap-datepicker/bootstrap-datepicker.js +2030 -0
- data/vendor/assets/javascripts/adminlte/plugins/bootstrap-datepicker/bootstrap-datepicker.min.js +8 -0
- data/vendor/assets/javascripts/adminlte/plugins/bootstrap-daterangepicker/bootstrap-daterangepicker.js +1653 -0
- data/vendor/assets/javascripts/adminlte/plugins/bootstrap-slider/bootstrap-slider.js +427 -0
- data/vendor/assets/javascripts/adminlte/plugins/bootstrap-timepicker/bootstrap-timepicker.js +1177 -0
- data/vendor/assets/javascripts/adminlte/plugins/bootstrap/bootstrap.js +2377 -0
- data/vendor/assets/javascripts/adminlte/plugins/bootstrap/bootstrap.min.js +7 -0
- data/vendor/assets/javascripts/adminlte/plugins/jquery/jquery.js +10364 -0
- data/vendor/assets/javascripts/adminlte/plugins/jquery/jquery.min.js +2 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/.bower.json +24 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/.editorconfig +6 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/.github/CONTRIBUTING.md +203 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/.github/ISSUE_TEMPLATE.md +20 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/.github/PULL_REQUEST_TEMPLATE.md +13 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/.gitignore +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/.jshintignore +4 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/.jshintrc +25 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/.travis.yml +22 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/CHANGELOG.md +272 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/Gruntfile.js +380 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/LICENSE.md +21 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/README.md +123 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/bower.json +13 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/component.json +19 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/composer.json +25 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/css/select2.css +484 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/css/select2.min.css +1 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/af.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/ar.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/az.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/bg.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/bs.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/ca.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/cs.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/da.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/de.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/dsb.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/el.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/en.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/es.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/et.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/eu.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/fa.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/fi.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/fr.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/gl.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/he.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/hi.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/hr.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/hsb.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/hu.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/hy.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/id.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/is.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/it.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/ja.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/km.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/ko.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/lt.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/lv.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/mk.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/ms.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/nb.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/nl.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/pl.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/ps.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/pt-BR.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/pt.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/ro.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/ru.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/sk.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/sl.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/sr-Cyrl.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/sr.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/sv.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/th.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/tr.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/uk.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/vi.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/zh-CN.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/i18n/zh-TW.js +3 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/select2.full.js +6457 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/select2.full.min.js +1 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/select2.js +5746 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/dist/js/select2.min.js +1 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/docs/README.md +1 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/docs/announcements-4.0.html +12 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/docs/community.html +12 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/docs/examples.html +12 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/docs/index.html +12 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/docs/options-old.html +12 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/docs/options.html +12 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/package.json +73 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/select2.jquery.json +32 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/banner.end.js +6 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/banner.start.js +6 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/jquery.mousewheel.shim.js +6 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/jquery.select2.js +57 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/jquery.shim.js +14 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/compat/containerCss.js +56 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/compat/dropdownCss.js +56 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/compat/initSelection.js +42 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/compat/inputData.js +127 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/compat/matcher.js +42 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/compat/query.js +26 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/compat/utils.js +43 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/core.js +612 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/data/ajax.js +109 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/data/array.js +79 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/data/base.js +40 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/data/maximumInputLength.js +31 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/data/maximumSelectionLength.js +31 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/data/minimumInputLength.js +30 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/data/select.js +285 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/data/tags.js +128 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/data/tokenizer.js +116 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/defaults.js +396 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/diacritics.js +847 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/dropdown.js +42 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/dropdown/attachBody.js +222 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/dropdown/attachContainer.js +18 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/dropdown/closeOnSelect.js +35 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/dropdown/hidePlaceholder.js +42 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/dropdown/infiniteScroll.js +89 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/dropdown/minimumResultsForSearch.js +39 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/dropdown/search.js +101 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/dropdown/selectOnClose.js +50 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/dropdown/stopPropagation.js +38 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/af.js +44 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/ar.js +30 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/az.js +27 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/bg.js +47 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/bs.js +55 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/ca.js +52 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/cs.js +61 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/da.js +36 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/de.js +40 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/dsb.js +48 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/el.js +52 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/en.js +44 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/es.js +52 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/et.js +53 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/eu.js +51 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/fa.js +38 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/fi.js +30 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/fr.js +33 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/gl.js +39 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/he.js +56 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/hi.js +39 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/hr.js +44 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/hsb.js +48 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/hu.js +30 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/hy.js +38 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/id.js +30 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/is.js +41 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/it.js +48 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/ja.js +36 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/km.js +36 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/ko.js +36 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/lt.js +52 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/lv.js +51 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/mk.js +47 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/ms.js +30 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/nb.js +32 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/nl.js +43 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/pl.js +45 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/ps.js +45 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/pt-BR.js +46 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/pt.js +40 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/ro.js +46 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/ru.js +58 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/sk.js +59 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/sl.js +54 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/sr-Cyrl.js +55 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/sr.js +55 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/sv.js +37 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/th.js +36 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/tr.js +36 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/uk.js +43 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/vi.js +37 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/zh-CN.js +36 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/i18n/zh-TW.js +33 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/keys.js +25 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/options.js +122 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/results.js +523 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/selection/allowClear.js +97 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/selection/base.js +158 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/selection/clickMask.js +29 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/selection/eventRelay.js +45 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/selection/multiple.js +109 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/selection/placeholder.js +49 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/selection/search.js +222 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/selection/single.js +99 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/selection/stopPropagation.js +38 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/translation.js +36 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/select2/utils.js +276 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/wrapper.end.js +12 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/js/wrapper.start.js +38 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/scss/_dropdown.scss +73 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/scss/_multiple.scss +35 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/scss/_single.scss +34 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/scss/core.scss +48 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/scss/mixins/_gradients.scss +13 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/scss/theme/classic/_defaults.scss +34 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/scss/theme/classic/_multiple.scss +93 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/scss/theme/classic/_single.scss +124 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/scss/theme/classic/layout.scss +64 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/scss/theme/default/_multiple.scss +98 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/scss/theme/default/_single.scss +83 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/src/scss/theme/default/layout.scss +97 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/a11y/search-tests.js +51 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/a11y/selection-tests.js +154 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/data/array-tests.js +318 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/data/base-tests.js +29 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/data/inputData-tests.js +158 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/data/maximumInputLength-tests.js +138 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/data/maximumSelectionLength-tests.js +202 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/data/minimumInputLength-tests.js +138 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/data/select-tests.js +489 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/data/tags-tests.js +276 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/data/tokenizer-tests.js +219 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/dropdown/dropdownCss-tests.js +104 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/dropdown/positioning-tests.js +177 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/dropdown/selectOnClose-tests.js +137 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/dropdown/stopPropagation-tests.js +33 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/helpers.js +46 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/integration.html +21 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/integration/dom-changes.js +257 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/integration/jquery-calls.js +30 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/integration/select2-methods.js +139 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/options/ajax-tests.js +32 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/options/data-tests.js +44 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/options/deprecated-tests.js +250 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/options/translation-tests.js +28 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/options/width-tests.js +66 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/results/focusing-tests.js +138 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/selection/allowClear-tests.js +218 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/selection/containerCss-tests.js +104 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/selection/multiple-tests.js +149 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/selection/placeholder-tests.js +74 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/selection/search-tests.js +191 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/selection/single-tests.js +117 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/selection/stopPropagation-tests.js +33 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/unit.html +95 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/utils/decorator-tests.js +189 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/utils/escapeMarkup-tests.js +36 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/vendor/jquery-1.7.2.js +9404 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/vendor/qunit-1.23.1.css +305 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/tests/vendor/qunit-1.23.1.js +4334 -0
- data/vendor/assets/javascripts/adminlte/plugins/select2/vendor/jquery-2.1.0.js +9111 -0
- data/vendor/assets/stylesheets/adminlte.min.scss +27 -0
- data/vendor/assets/stylesheets/adminlte.scss +6 -0
- data/vendor/assets/stylesheets/adminlte/adminlte.css +4977 -0
- data/vendor/assets/stylesheets/adminlte/adminlte.min.css +7 -0
- data/vendor/assets/stylesheets/adminlte/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/stylesheets/adminlte/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/stylesheets/adminlte/fonts/fontawesome-webfont.svg +2671 -0
- data/vendor/assets/stylesheets/adminlte/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/stylesheets/adminlte/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/stylesheets/adminlte/fonts/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/stylesheets/adminlte/fonts/glyphicons-halflings-regular.eot +0 -0
- data/vendor/assets/stylesheets/adminlte/fonts/glyphicons-halflings-regular.svg +288 -0
- data/vendor/assets/stylesheets/adminlte/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/vendor/assets/stylesheets/adminlte/fonts/glyphicons-halflings-regular.woff +0 -0
- data/vendor/assets/stylesheets/adminlte/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/vendor/assets/stylesheets/adminlte/plugins/bootstrap-colorpicker/bootstrap-colorpicker.css +230 -0
- data/vendor/assets/stylesheets/adminlte/plugins/bootstrap-datepicker/bootstrap-datepicker.css +477 -0
- data/vendor/assets/stylesheets/adminlte/plugins/bootstrap-datepicker/bootstrap-datepicker.standalone.css +510 -0
- data/vendor/assets/stylesheets/adminlte/plugins/bootstrap-datepicker/bootstrap-datepicker3.css +684 -0
- data/vendor/assets/stylesheets/adminlte/plugins/bootstrap-datepicker/bootstrap-datepicker3.standalone.css +713 -0
- data/vendor/assets/stylesheets/adminlte/plugins/bootstrap-daterangepicker/bootstrap-daterangepicker.css +269 -0
- data/vendor/assets/stylesheets/adminlte/plugins/bootstrap-slider/bootstrap-slider.css +178 -0
- data/vendor/assets/stylesheets/adminlte/plugins/bootstrap-timepicker/bootstrap-timepicker.less +172 -0
- data/vendor/assets/stylesheets/adminlte/plugins/bootstrap/bootstrap.css.map +1 -0
- data/vendor/assets/stylesheets/adminlte/plugins/bootstrap/bootstrap.scss +6757 -0
- data/vendor/assets/stylesheets/adminlte/plugins/font-awesome/font-awesome.scss +2341 -0
- data/vendor/assets/stylesheets/adminlte/plugins/select2/select2.css +484 -0
- data/vendor/assets/stylesheets/adminlte/skins/_all-skins.css +1781 -0
- data/vendor/assets/stylesheets/adminlte/skins/_all-skins.min.css +1 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-black-light.css +171 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-black-light.min.css +1 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-black.css +161 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-black.min.css +1 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-blue-light.css +163 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-blue-light.min.css +1 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-blue.css +142 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-blue.min.css +1 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-green-light.css +152 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-green-light.min.css +1 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-green.css +134 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-green.min.css +1 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-purple-light.css +152 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-purple-light.min.css +1 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-purple.css +134 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-purple.min.css +1 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-red-light.css +152 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-red-light.min.css +1 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-red.css +134 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-red.min.css +1 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-yellow-light.css +152 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-yellow-light.min.css +1 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-yellow.css +134 -0
- data/vendor/assets/stylesheets/adminlte/skins/skin-yellow.min.css +1 -0
- metadata +408 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
/*! AdminLTE app.js
|
2
|
+
* ================
|
3
|
+
* Main JS application file for AdminLTE v2. This file
|
4
|
+
* should be included in all pages. It controls some layout
|
5
|
+
* options and implements exclusive AdminLTE plugins.
|
6
|
+
*
|
7
|
+
* @Author Almsaeed Studio
|
8
|
+
* @Support <https://www.almsaeedstudio.com>
|
9
|
+
* @Email <abdullah@almsaeedstudio.com>
|
10
|
+
* @version 2.4.2
|
11
|
+
* @repository git://github.com/almasaeed2010/AdminLTE.git
|
12
|
+
* @license MIT <http://opensource.org/licenses/MIT>
|
13
|
+
*/
|
14
|
+
if("undefined"==typeof jQuery)throw new Error("AdminLTE requires jQuery");+function(a){"use strict";function b(b){return this.each(function(){var e=a(this),g=e.data(c);if(!g){var h=a.extend({},d,e.data(),"object"==typeof b&&b);e.data(c,g=new f(e,h))}if("string"==typeof g){if(void 0===g[b])throw new Error("No method named "+b);g[b]()}})}var c="lte.boxrefresh",d={source:"",params:{},trigger:".refresh-btn",content:".box-body",loadInContent:!0,responseType:"",overlayTemplate:'<div class="overlay"><div class="fa fa-refresh fa-spin"></div></div>',onLoadStart:function(){},onLoadDone:function(a){return a}},e={data:'[data-widget="box-refresh"]'},f=function(b,c){if(this.element=b,this.options=c,this.$overlay=a(c.overlay),""===c.source)throw new Error("Source url was not defined. Please specify a url in your BoxRefresh source option.");this._setUpListeners(),this.load()};f.prototype.load=function(){this._addOverlay(),this.options.onLoadStart.call(a(this)),a.get(this.options.source,this.options.params,function(b){this.options.loadInContent&&a(this.options.content).html(b),this.options.onLoadDone.call(a(this),b),this._removeOverlay()}.bind(this),""!==this.options.responseType&&this.options.responseType)},f.prototype._setUpListeners=function(){a(this.element).on("click",e.trigger,function(a){a&&a.preventDefault(),this.load()}.bind(this))},f.prototype._addOverlay=function(){a(this.element).append(this.$overlay)},f.prototype._removeOverlay=function(){a(this.element).remove(this.$overlay)};var g=a.fn.boxRefresh;a.fn.boxRefresh=b,a.fn.boxRefresh.Constructor=f,a.fn.boxRefresh.noConflict=function(){return a.fn.boxRefresh=g,this},a(window).on("load",function(){a(e.data).each(function(){b.call(a(this))})})}(jQuery),function(a){"use strict";function b(b){return this.each(function(){var e=a(this),f=e.data(c);if(!f){var g=a.extend({},d,e.data(),"object"==typeof b&&b);e.data(c,f=new h(e,g))}if("string"==typeof b){if(void 0===f[b])throw new Error("No method named "+b);f[b]()}})}var c="lte.boxwidget",d={animationSpeed:500,collapseTrigger:'[data-widget="collapse"]',removeTrigger:'[data-widget="remove"]',collapseIcon:"fa-minus",expandIcon:"fa-plus",removeIcon:"fa-times"},e={data:".box",collapsed:".collapsed-box",header:".box-header",body:".box-body",footer:".box-footer",tools:".box-tools"},f={collapsed:"collapsed-box"},g={collapsed:"collapsed.boxwidget",expanded:"expanded.boxwidget",removed:"removed.boxwidget"},h=function(a,b){this.element=a,this.options=b,this._setUpListeners()};h.prototype.toggle=function(){a(this.element).is(e.collapsed)?this.expand():this.collapse()},h.prototype.expand=function(){var b=a.Event(g.expanded),c=this.options.collapseIcon,d=this.options.expandIcon;a(this.element).removeClass(f.collapsed),a(this.element).children(e.header+", "+e.body+", "+e.footer).children(e.tools).find("."+d).removeClass(d).addClass(c),a(this.element).children(e.body+", "+e.footer).slideDown(this.options.animationSpeed,function(){a(this.element).trigger(b)}.bind(this))},h.prototype.collapse=function(){var b=a.Event(g.collapsed),c=this.options.collapseIcon,d=this.options.expandIcon;a(this.element).children(e.header+", "+e.body+", "+e.footer).children(e.tools).find("."+c).removeClass(c).addClass(d),a(this.element).children(e.body+", "+e.footer).slideUp(this.options.animationSpeed,function(){a(this.element).addClass(f.collapsed),a(this.element).trigger(b)}.bind(this))},h.prototype.remove=function(){var b=a.Event(g.removed);a(this.element).slideUp(this.options.animationSpeed,function(){a(this.element).trigger(b),a(this.element).remove()}.bind(this))},h.prototype._setUpListeners=function(){var b=this;a(this.element).on("click",this.options.collapseTrigger,function(c){return c&&c.preventDefault(),b.toggle(a(this)),!1}),a(this.element).on("click",this.options.removeTrigger,function(c){return c&&c.preventDefault(),b.remove(a(this)),!1})};var i=a.fn.boxWidget;a.fn.boxWidget=b,a.fn.boxWidget.Constructor=h,a.fn.boxWidget.noConflict=function(){return a.fn.boxWidget=i,this},a(window).on("load",function(){a(e.data).each(function(){b.call(a(this))})})}(jQuery),function(a){"use strict";function b(b){return this.each(function(){var e=a(this),f=e.data(c);if(!f){var g=a.extend({},d,e.data(),"object"==typeof b&&b);e.data(c,f=new h(e,g))}"string"==typeof b&&f.toggle()})}var c="lte.controlsidebar",d={slide:!0},e={sidebar:".control-sidebar",data:'[data-toggle="control-sidebar"]',open:".control-sidebar-open",bg:".control-sidebar-bg",wrapper:".wrapper",content:".content-wrapper",boxed:".layout-boxed"},f={open:"control-sidebar-open",fixed:"fixed"},g={collapsed:"collapsed.controlsidebar",expanded:"expanded.controlsidebar"},h=function(a,b){this.element=a,this.options=b,this.hasBindedResize=!1,this.init()};h.prototype.init=function(){a(this.element).is(e.data)||a(this).on("click",this.toggle),this.fix(),a(window).resize(function(){this.fix()}.bind(this))},h.prototype.toggle=function(b){b&&b.preventDefault(),this.fix(),a(e.sidebar).is(e.open)||a("body").is(e.open)?this.collapse():this.expand()},h.prototype.expand=function(){this.options.slide?a(e.sidebar).addClass(f.open):a("body").addClass(f.open),a(this.element).trigger(a.Event(g.expanded))},h.prototype.collapse=function(){a("body, "+e.sidebar).removeClass(f.open),a(this.element).trigger(a.Event(g.collapsed))},h.prototype.fix=function(){a("body").is(e.boxed)&&this._fixForBoxed(a(e.bg))},h.prototype._fixForBoxed=function(b){b.css({position:"absolute",height:a(e.wrapper).height()})};var i=a.fn.controlSidebar;a.fn.controlSidebar=b,a.fn.controlSidebar.Constructor=h,a.fn.controlSidebar.noConflict=function(){return a.fn.controlSidebar=i,this},a(document).on("click",e.data,function(c){c&&c.preventDefault(),b.call(a(this),"toggle")})}(jQuery),function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data(c);e||d.data(c,e=new f(d)),"string"==typeof b&&e.toggle(d)})}var c="lte.directchat",d={data:'[data-widget="chat-pane-toggle"]',box:".direct-chat"},e={open:"direct-chat-contacts-open"},f=function(a){this.element=a};f.prototype.toggle=function(a){a.parents(d.box).first().toggleClass(e.open)};var g=a.fn.directChat;a.fn.directChat=b,a.fn.directChat.Constructor=f,a.fn.directChat.noConflict=function(){return a.fn.directChat=g,this},a(document).on("click",d.data,function(c){c&&c.preventDefault(),b.call(a(this),"toggle")})}(jQuery),function(a){"use strict";function b(b){return this.each(function(){var e=a(this),f=e.data(c);if(!f){var h=a.extend({},d,e.data(),"object"==typeof b&&b);e.data(c,f=new g(h))}if("string"==typeof b){if(void 0===f[b])throw new Error("No method named "+b);f[b]()}})}var c="lte.layout",d={slimscroll:!0,resetHeight:!0},e={wrapper:".wrapper",contentWrapper:".content-wrapper",layoutBoxed:".layout-boxed",mainFooter:".main-footer",mainHeader:".main-header",sidebar:".sidebar",controlSidebar:".control-sidebar",fixed:".fixed",sidebarMenu:".sidebar-menu",logo:".main-header .logo"},f={fixed:"fixed",holdTransition:"hold-transition"},g=function(a){this.options=a,this.bindedResize=!1,this.activate()};g.prototype.activate=function(){this.fix(),this.fixSidebar(),a("body").removeClass(f.holdTransition),this.options.resetHeight&&a("body, html, "+e.wrapper).css({height:"auto","min-height":"100%"}),this.bindedResize||(a(window).resize(function(){this.fix(),this.fixSidebar(),a(e.logo+", "+e.sidebar).one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){this.fix(),this.fixSidebar()}.bind(this))}.bind(this)),this.bindedResize=!0),a(e.sidebarMenu).on("expanded.tree",function(){this.fix(),this.fixSidebar()}.bind(this)),a(e.sidebarMenu).on("collapsed.tree",function(){this.fix(),this.fixSidebar()}.bind(this))},g.prototype.fix=function(){a(e.layoutBoxed+" > "+e.wrapper).css("overflow","hidden");var b=a(e.mainFooter).outerHeight()||0,c=a(e.mainHeader).outerHeight()+b,d=a(window).height(),g=a(e.sidebar).height()||0;if(a("body").hasClass(f.fixed))a(e.contentWrapper).css("min-height",d-b);else{var h;d>=g?(a(e.contentWrapper).css("min-height",d-c),h=d-c):(a(e.contentWrapper).css("min-height",g),h=g);var i=a(e.controlSidebar);void 0!==i&&i.height()>h&&a(e.contentWrapper).css("min-height",i.height())}},g.prototype.fixSidebar=function(){if(!a("body").hasClass(f.fixed))return void(void 0!==a.fn.slimScroll&&a(e.sidebar).slimScroll({destroy:!0}).height("auto"));this.options.slimscroll&&void 0!==a.fn.slimScroll&&a(e.sidebar).slimScroll({height:a(window).height()-a(e.mainHeader).height()+"px"})};var h=a.fn.layout;a.fn.layout=b,a.fn.layout.Constuctor=g,a.fn.layout.noConflict=function(){return a.fn.layout=h,this},a(window).on("load",function(){b.call(a("body"))})}(jQuery),function(a){"use strict";function b(b){return this.each(function(){var e=a(this),f=e.data(c);if(!f){var g=a.extend({},d,e.data(),"object"==typeof b&&b);e.data(c,f=new h(g))}"toggle"===b&&f.toggle()})}var c="lte.pushmenu",d={collapseScreenSize:767,expandOnHover:!1,expandTransitionDelay:200},e={collapsed:".sidebar-collapse",open:".sidebar-open",mainSidebar:".main-sidebar",contentWrapper:".content-wrapper",searchInput:".sidebar-form .form-control",button:'[data-toggle="push-menu"]',mini:".sidebar-mini",expanded:".sidebar-expanded-on-hover",layoutFixed:".fixed"},f={collapsed:"sidebar-collapse",open:"sidebar-open",mini:"sidebar-mini",expanded:"sidebar-expanded-on-hover",expandFeature:"sidebar-mini-expand-feature",layoutFixed:"fixed"},g={expanded:"expanded.pushMenu",collapsed:"collapsed.pushMenu"},h=function(a){this.options=a,this.init()};h.prototype.init=function(){(this.options.expandOnHover||a("body").is(e.mini+e.layoutFixed))&&(this.expandOnHover(),a("body").addClass(f.expandFeature)),a(e.contentWrapper).click(function(){a(window).width()<=this.options.collapseScreenSize&&a("body").hasClass(f.open)&&this.close()}.bind(this)),a(e.searchInput).click(function(a){a.stopPropagation()})},h.prototype.toggle=function(){var b=a(window).width(),c=!a("body").hasClass(f.collapsed);b<=this.options.collapseScreenSize&&(c=a("body").hasClass(f.open)),c?this.close():this.open()},h.prototype.open=function(){a(window).width()>this.options.collapseScreenSize?a("body").removeClass(f.collapsed).trigger(a.Event(g.expanded)):a("body").addClass(f.open).trigger(a.Event(g.expanded))},h.prototype.close=function(){a(window).width()>this.options.collapseScreenSize?a("body").addClass(f.collapsed).trigger(a.Event(g.collapsed)):a("body").removeClass(f.open+" "+f.collapsed).trigger(a.Event(g.collapsed))},h.prototype.expandOnHover=function(){a(e.mainSidebar).hover(function(){a("body").is(e.mini+e.collapsed)&&a(window).width()>this.options.collapseScreenSize&&this.expand()}.bind(this),function(){a("body").is(e.expanded)&&this.collapse()}.bind(this))},h.prototype.expand=function(){setTimeout(function(){a("body").removeClass(f.collapsed).addClass(f.expanded)},this.options.expandTransitionDelay)},h.prototype.collapse=function(){setTimeout(function(){a("body").removeClass(f.expanded).addClass(f.collapsed)},this.options.expandTransitionDelay)};var i=a.fn.pushMenu;a.fn.pushMenu=b,a.fn.pushMenu.Constructor=h,a.fn.pushMenu.noConflict=function(){return a.fn.pushMenu=i,this},a(document).on("click",e.button,function(c){c.preventDefault(),b.call(a(this),"toggle")}),a(window).on("load",function(){b.call(a(e.button))})}(jQuery),function(a){"use strict";function b(b){return this.each(function(){var e=a(this),f=e.data(c);if(!f){var h=a.extend({},d,e.data(),"object"==typeof b&&b);e.data(c,f=new g(e,h))}if("string"==typeof f){if(void 0===f[b])throw new Error("No method named "+b);f[b]()}})}var c="lte.todolist",d={onCheck:function(a){return a},onUnCheck:function(a){return a}},e={data:'[data-widget="todo-list"]'},f={done:"done"},g=function(a,b){this.element=a,this.options=b,this._setUpListeners()};g.prototype.toggle=function(a){if(a.parents(e.li).first().toggleClass(f.done),!a.prop("checked"))return void this.unCheck(a);this.check(a)},g.prototype.check=function(a){this.options.onCheck.call(a)},g.prototype.unCheck=function(a){this.options.onUnCheck.call(a)},g.prototype._setUpListeners=function(){var b=this;a(this.element).on("change ifChanged","input:checkbox",function(){b.toggle(a(this))})};var h=a.fn.todoList;a.fn.todoList=b,a.fn.todoList.Constructor=g,a.fn.todoList.noConflict=function(){return a.fn.todoList=h,this},a(window).on("load",function(){a(e.data).each(function(){b.call(a(this))})})}(jQuery),function(a){"use strict";function b(b){return this.each(function(){var e=a(this);if(!e.data(c)){var f=a.extend({},d,e.data(),"object"==typeof b&&b);e.data(c,new h(e,f))}})}var c="lte.tree",d={animationSpeed:500,accordion:!0,followLink:!1,trigger:".treeview a"},e={tree:".tree",treeview:".treeview",treeviewMenu:".treeview-menu",open:".menu-open, .active",li:"li",data:'[data-widget="tree"]',active:".active"},f={open:"menu-open",tree:"tree"},g={collapsed:"collapsed.tree",expanded:"expanded.tree"},h=function(b,c){this.element=b,this.options=c,a(this.element).addClass(f.tree),a(e.treeview+e.active,this.element).addClass(f.open),this._setUpListeners()};h.prototype.toggle=function(a,b){var c=a.next(e.treeviewMenu),d=a.parent(),g=d.hasClass(f.open);d.is(e.treeview)&&(this.options.followLink&&"#"!==a.attr("href")||b.preventDefault(),g?this.collapse(c,d):this.expand(c,d))},h.prototype.expand=function(b,c){var d=a.Event(g.expanded);if(this.options.accordion){var h=c.siblings(e.open),i=h.children(e.treeviewMenu);this.collapse(i,h)}c.addClass(f.open),b.slideDown(this.options.animationSpeed,function(){a(this.element).trigger(d)}.bind(this))},h.prototype.collapse=function(b,c){var d=a.Event(g.collapsed);b.find(e.open).removeClass(f.open),c.removeClass(f.open),b.slideUp(this.options.animationSpeed,function(){b.find(e.open+" > "+e.treeview).slideUp(),a(this.element).trigger(d)}.bind(this))},h.prototype._setUpListeners=function(){var b=this;a(this.element).on("click",this.options.trigger,function(c){b.toggle(a(this),c)})};var i=a.fn.tree;a.fn.tree=b,a.fn.tree.Constructor=h,a.fn.tree.noConflict=function(){return a.fn.tree=i,this},a(window).on("load",function(){a(e.data).each(function(){b.call(a(this))})})}(jQuery);
|
data/vendor/assets/javascripts/adminlte/plugins/bootstrap-colorpicker/bootstrap-colorpicker.js
ADDED
@@ -0,0 +1,1319 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap Colorpicker v2.5.1
|
3
|
+
* https://itsjavi.com/bootstrap-colorpicker/
|
4
|
+
*
|
5
|
+
* Originally written by (c) 2012 Stefan Petre
|
6
|
+
* Licensed under the Apache License v2.0
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0.txt
|
8
|
+
*
|
9
|
+
*/
|
10
|
+
|
11
|
+
(function(root, factory) {
|
12
|
+
if (typeof define === 'function' && define.amd) {
|
13
|
+
// AMD. Register as an anonymous module unless amdModuleId is set
|
14
|
+
define(["jquery"], function(jq) {
|
15
|
+
return (factory(jq));
|
16
|
+
});
|
17
|
+
} else if (typeof exports === 'object') {
|
18
|
+
// Node. Does not work with strict CommonJS, but
|
19
|
+
// only CommonJS-like environments that support module.exports,
|
20
|
+
// like Node.
|
21
|
+
module.exports = factory(require("jquery"));
|
22
|
+
} else if (jQuery && !jQuery.fn.colorpicker) {
|
23
|
+
factory(jQuery);
|
24
|
+
}
|
25
|
+
}(this, function($) {
|
26
|
+
'use strict';
|
27
|
+
/**
|
28
|
+
* Color manipulation helper class
|
29
|
+
*
|
30
|
+
* @param {Object|String} [val]
|
31
|
+
* @param {Object} [predefinedColors]
|
32
|
+
* @param {String|null} [fallbackColor]
|
33
|
+
* @param {String|null} [fallbackFormat]
|
34
|
+
* @param {Boolean} [hexNumberSignPrefix]
|
35
|
+
* @constructor
|
36
|
+
*/
|
37
|
+
var Color = function(
|
38
|
+
val, predefinedColors, fallbackColor, fallbackFormat, hexNumberSignPrefix) {
|
39
|
+
this.fallbackValue = fallbackColor ?
|
40
|
+
(
|
41
|
+
fallbackColor && (typeof fallbackColor.h !== 'undefined') ?
|
42
|
+
fallbackColor :
|
43
|
+
this.value = {
|
44
|
+
h: 0,
|
45
|
+
s: 0,
|
46
|
+
b: 0,
|
47
|
+
a: 1
|
48
|
+
}
|
49
|
+
) :
|
50
|
+
null;
|
51
|
+
|
52
|
+
this.fallbackFormat = fallbackFormat ? fallbackFormat : 'rgba';
|
53
|
+
|
54
|
+
this.hexNumberSignPrefix = hexNumberSignPrefix === true;
|
55
|
+
|
56
|
+
this.value = this.fallbackValue;
|
57
|
+
|
58
|
+
this.origFormat = null; // original string format
|
59
|
+
|
60
|
+
this.predefinedColors = predefinedColors ? predefinedColors : {};
|
61
|
+
|
62
|
+
// We don't want to share aliases across instances so we extend new object
|
63
|
+
this.colors = $.extend({}, Color.webColors, this.predefinedColors);
|
64
|
+
|
65
|
+
if (val) {
|
66
|
+
if (typeof val.h !== 'undefined') {
|
67
|
+
this.value = val;
|
68
|
+
} else {
|
69
|
+
this.setColor(String(val));
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
if (!this.value) {
|
74
|
+
// Initial value is always black if no arguments are passed or val is empty
|
75
|
+
this.value = {
|
76
|
+
h: 0,
|
77
|
+
s: 0,
|
78
|
+
b: 0,
|
79
|
+
a: 1
|
80
|
+
};
|
81
|
+
}
|
82
|
+
};
|
83
|
+
|
84
|
+
Color.webColors = { // 140 predefined colors from the HTML Colors spec
|
85
|
+
"aliceblue": "f0f8ff",
|
86
|
+
"antiquewhite": "faebd7",
|
87
|
+
"aqua": "00ffff",
|
88
|
+
"aquamarine": "7fffd4",
|
89
|
+
"azure": "f0ffff",
|
90
|
+
"beige": "f5f5dc",
|
91
|
+
"bisque": "ffe4c4",
|
92
|
+
"black": "000000",
|
93
|
+
"blanchedalmond": "ffebcd",
|
94
|
+
"blue": "0000ff",
|
95
|
+
"blueviolet": "8a2be2",
|
96
|
+
"brown": "a52a2a",
|
97
|
+
"burlywood": "deb887",
|
98
|
+
"cadetblue": "5f9ea0",
|
99
|
+
"chartreuse": "7fff00",
|
100
|
+
"chocolate": "d2691e",
|
101
|
+
"coral": "ff7f50",
|
102
|
+
"cornflowerblue": "6495ed",
|
103
|
+
"cornsilk": "fff8dc",
|
104
|
+
"crimson": "dc143c",
|
105
|
+
"cyan": "00ffff",
|
106
|
+
"darkblue": "00008b",
|
107
|
+
"darkcyan": "008b8b",
|
108
|
+
"darkgoldenrod": "b8860b",
|
109
|
+
"darkgray": "a9a9a9",
|
110
|
+
"darkgreen": "006400",
|
111
|
+
"darkkhaki": "bdb76b",
|
112
|
+
"darkmagenta": "8b008b",
|
113
|
+
"darkolivegreen": "556b2f",
|
114
|
+
"darkorange": "ff8c00",
|
115
|
+
"darkorchid": "9932cc",
|
116
|
+
"darkred": "8b0000",
|
117
|
+
"darksalmon": "e9967a",
|
118
|
+
"darkseagreen": "8fbc8f",
|
119
|
+
"darkslateblue": "483d8b",
|
120
|
+
"darkslategray": "2f4f4f",
|
121
|
+
"darkturquoise": "00ced1",
|
122
|
+
"darkviolet": "9400d3",
|
123
|
+
"deeppink": "ff1493",
|
124
|
+
"deepskyblue": "00bfff",
|
125
|
+
"dimgray": "696969",
|
126
|
+
"dodgerblue": "1e90ff",
|
127
|
+
"firebrick": "b22222",
|
128
|
+
"floralwhite": "fffaf0",
|
129
|
+
"forestgreen": "228b22",
|
130
|
+
"fuchsia": "ff00ff",
|
131
|
+
"gainsboro": "dcdcdc",
|
132
|
+
"ghostwhite": "f8f8ff",
|
133
|
+
"gold": "ffd700",
|
134
|
+
"goldenrod": "daa520",
|
135
|
+
"gray": "808080",
|
136
|
+
"green": "008000",
|
137
|
+
"greenyellow": "adff2f",
|
138
|
+
"honeydew": "f0fff0",
|
139
|
+
"hotpink": "ff69b4",
|
140
|
+
"indianred": "cd5c5c",
|
141
|
+
"indigo": "4b0082",
|
142
|
+
"ivory": "fffff0",
|
143
|
+
"khaki": "f0e68c",
|
144
|
+
"lavender": "e6e6fa",
|
145
|
+
"lavenderblush": "fff0f5",
|
146
|
+
"lawngreen": "7cfc00",
|
147
|
+
"lemonchiffon": "fffacd",
|
148
|
+
"lightblue": "add8e6",
|
149
|
+
"lightcoral": "f08080",
|
150
|
+
"lightcyan": "e0ffff",
|
151
|
+
"lightgoldenrodyellow": "fafad2",
|
152
|
+
"lightgrey": "d3d3d3",
|
153
|
+
"lightgreen": "90ee90",
|
154
|
+
"lightpink": "ffb6c1",
|
155
|
+
"lightsalmon": "ffa07a",
|
156
|
+
"lightseagreen": "20b2aa",
|
157
|
+
"lightskyblue": "87cefa",
|
158
|
+
"lightslategray": "778899",
|
159
|
+
"lightsteelblue": "b0c4de",
|
160
|
+
"lightyellow": "ffffe0",
|
161
|
+
"lime": "00ff00",
|
162
|
+
"limegreen": "32cd32",
|
163
|
+
"linen": "faf0e6",
|
164
|
+
"magenta": "ff00ff",
|
165
|
+
"maroon": "800000",
|
166
|
+
"mediumaquamarine": "66cdaa",
|
167
|
+
"mediumblue": "0000cd",
|
168
|
+
"mediumorchid": "ba55d3",
|
169
|
+
"mediumpurple": "9370d8",
|
170
|
+
"mediumseagreen": "3cb371",
|
171
|
+
"mediumslateblue": "7b68ee",
|
172
|
+
"mediumspringgreen": "00fa9a",
|
173
|
+
"mediumturquoise": "48d1cc",
|
174
|
+
"mediumvioletred": "c71585",
|
175
|
+
"midnightblue": "191970",
|
176
|
+
"mintcream": "f5fffa",
|
177
|
+
"mistyrose": "ffe4e1",
|
178
|
+
"moccasin": "ffe4b5",
|
179
|
+
"navajowhite": "ffdead",
|
180
|
+
"navy": "000080",
|
181
|
+
"oldlace": "fdf5e6",
|
182
|
+
"olive": "808000",
|
183
|
+
"olivedrab": "6b8e23",
|
184
|
+
"orange": "ffa500",
|
185
|
+
"orangered": "ff4500",
|
186
|
+
"orchid": "da70d6",
|
187
|
+
"palegoldenrod": "eee8aa",
|
188
|
+
"palegreen": "98fb98",
|
189
|
+
"paleturquoise": "afeeee",
|
190
|
+
"palevioletred": "d87093",
|
191
|
+
"papayawhip": "ffefd5",
|
192
|
+
"peachpuff": "ffdab9",
|
193
|
+
"peru": "cd853f",
|
194
|
+
"pink": "ffc0cb",
|
195
|
+
"plum": "dda0dd",
|
196
|
+
"powderblue": "b0e0e6",
|
197
|
+
"purple": "800080",
|
198
|
+
"red": "ff0000",
|
199
|
+
"rosybrown": "bc8f8f",
|
200
|
+
"royalblue": "4169e1",
|
201
|
+
"saddlebrown": "8b4513",
|
202
|
+
"salmon": "fa8072",
|
203
|
+
"sandybrown": "f4a460",
|
204
|
+
"seagreen": "2e8b57",
|
205
|
+
"seashell": "fff5ee",
|
206
|
+
"sienna": "a0522d",
|
207
|
+
"silver": "c0c0c0",
|
208
|
+
"skyblue": "87ceeb",
|
209
|
+
"slateblue": "6a5acd",
|
210
|
+
"slategray": "708090",
|
211
|
+
"snow": "fffafa",
|
212
|
+
"springgreen": "00ff7f",
|
213
|
+
"steelblue": "4682b4",
|
214
|
+
"tan": "d2b48c",
|
215
|
+
"teal": "008080",
|
216
|
+
"thistle": "d8bfd8",
|
217
|
+
"tomato": "ff6347",
|
218
|
+
"turquoise": "40e0d0",
|
219
|
+
"violet": "ee82ee",
|
220
|
+
"wheat": "f5deb3",
|
221
|
+
"white": "ffffff",
|
222
|
+
"whitesmoke": "f5f5f5",
|
223
|
+
"yellow": "ffff00",
|
224
|
+
"yellowgreen": "9acd32",
|
225
|
+
"transparent": "transparent"
|
226
|
+
};
|
227
|
+
|
228
|
+
Color.prototype = {
|
229
|
+
constructor: Color,
|
230
|
+
colors: {}, // merged web and predefined colors
|
231
|
+
predefinedColors: {},
|
232
|
+
/**
|
233
|
+
* @return {Object}
|
234
|
+
*/
|
235
|
+
getValue: function() {
|
236
|
+
return this.value;
|
237
|
+
},
|
238
|
+
/**
|
239
|
+
* @param {Object} val
|
240
|
+
*/
|
241
|
+
setValue: function(val) {
|
242
|
+
this.value = val;
|
243
|
+
},
|
244
|
+
_sanitizeNumber: function(val) {
|
245
|
+
if (typeof val === 'number') {
|
246
|
+
return val;
|
247
|
+
}
|
248
|
+
if (isNaN(val) || (val === null) || (val === '') || (val === undefined)) {
|
249
|
+
return 1;
|
250
|
+
}
|
251
|
+
if (val === '') {
|
252
|
+
return 0;
|
253
|
+
}
|
254
|
+
if (typeof val.toLowerCase !== 'undefined') {
|
255
|
+
if (val.match(/^\./)) {
|
256
|
+
val = "0" + val;
|
257
|
+
}
|
258
|
+
return Math.ceil(parseFloat(val) * 100) / 100;
|
259
|
+
}
|
260
|
+
return 1;
|
261
|
+
},
|
262
|
+
isTransparent: function(strVal) {
|
263
|
+
if (!strVal || !(typeof strVal === 'string' || strVal instanceof String)) {
|
264
|
+
return false;
|
265
|
+
}
|
266
|
+
strVal = strVal.toLowerCase().trim();
|
267
|
+
return (strVal === 'transparent') || (strVal.match(/#?00000000/)) || (strVal.match(/(rgba|hsla)\(0,0,0,0?\.?0\)/));
|
268
|
+
},
|
269
|
+
rgbaIsTransparent: function(rgba) {
|
270
|
+
return ((rgba.r === 0) && (rgba.g === 0) && (rgba.b === 0) && (rgba.a === 0));
|
271
|
+
},
|
272
|
+
// parse a string to HSB
|
273
|
+
/**
|
274
|
+
* @protected
|
275
|
+
* @param {String} strVal
|
276
|
+
* @returns {boolean} Returns true if it could be parsed, false otherwise
|
277
|
+
*/
|
278
|
+
setColor: function(strVal) {
|
279
|
+
strVal = strVal.toLowerCase().trim();
|
280
|
+
if (strVal) {
|
281
|
+
if (this.isTransparent(strVal)) {
|
282
|
+
this.value = {
|
283
|
+
h: 0,
|
284
|
+
s: 0,
|
285
|
+
b: 0,
|
286
|
+
a: 0
|
287
|
+
};
|
288
|
+
return true;
|
289
|
+
} else {
|
290
|
+
var parsedColor = this.parse(strVal);
|
291
|
+
if (parsedColor) {
|
292
|
+
this.value = this.value = {
|
293
|
+
h: parsedColor.h,
|
294
|
+
s: parsedColor.s,
|
295
|
+
b: parsedColor.b,
|
296
|
+
a: parsedColor.a
|
297
|
+
};
|
298
|
+
if (!this.origFormat) {
|
299
|
+
this.origFormat = parsedColor.format;
|
300
|
+
}
|
301
|
+
} else if (this.fallbackValue) {
|
302
|
+
// if parser fails, defaults to fallbackValue if defined, otherwise the value won't be changed
|
303
|
+
this.value = this.fallbackValue;
|
304
|
+
}
|
305
|
+
}
|
306
|
+
}
|
307
|
+
return false;
|
308
|
+
},
|
309
|
+
setHue: function(h) {
|
310
|
+
this.value.h = 1 - h;
|
311
|
+
},
|
312
|
+
setSaturation: function(s) {
|
313
|
+
this.value.s = s;
|
314
|
+
},
|
315
|
+
setBrightness: function(b) {
|
316
|
+
this.value.b = 1 - b;
|
317
|
+
},
|
318
|
+
setAlpha: function(a) {
|
319
|
+
this.value.a = Math.round((parseInt((1 - a) * 100, 10) / 100) * 100) / 100;
|
320
|
+
},
|
321
|
+
toRGB: function(h, s, b, a) {
|
322
|
+
if (arguments.length === 0) {
|
323
|
+
h = this.value.h;
|
324
|
+
s = this.value.s;
|
325
|
+
b = this.value.b;
|
326
|
+
a = this.value.a;
|
327
|
+
}
|
328
|
+
|
329
|
+
h *= 360;
|
330
|
+
var R, G, B, X, C;
|
331
|
+
h = (h % 360) / 60;
|
332
|
+
C = b * s;
|
333
|
+
X = C * (1 - Math.abs(h % 2 - 1));
|
334
|
+
R = G = B = b - C;
|
335
|
+
|
336
|
+
h = ~~h;
|
337
|
+
R += [C, X, 0, 0, X, C][h];
|
338
|
+
G += [X, C, C, X, 0, 0][h];
|
339
|
+
B += [0, 0, X, C, C, X][h];
|
340
|
+
|
341
|
+
return {
|
342
|
+
r: Math.round(R * 255),
|
343
|
+
g: Math.round(G * 255),
|
344
|
+
b: Math.round(B * 255),
|
345
|
+
a: a
|
346
|
+
};
|
347
|
+
},
|
348
|
+
toHex: function(h, s, b, a) {
|
349
|
+
if (arguments.length === 0) {
|
350
|
+
h = this.value.h;
|
351
|
+
s = this.value.s;
|
352
|
+
b = this.value.b;
|
353
|
+
a = this.value.a;
|
354
|
+
}
|
355
|
+
|
356
|
+
var rgb = this.toRGB(h, s, b, a);
|
357
|
+
|
358
|
+
if (this.rgbaIsTransparent(rgb)) {
|
359
|
+
return 'transparent';
|
360
|
+
}
|
361
|
+
|
362
|
+
var hexStr = (this.hexNumberSignPrefix ? '#' : '') + (
|
363
|
+
(1 << 24) +
|
364
|
+
(parseInt(rgb.r) << 16) +
|
365
|
+
(parseInt(rgb.g) << 8) +
|
366
|
+
parseInt(rgb.b))
|
367
|
+
.toString(16)
|
368
|
+
.slice(1);
|
369
|
+
|
370
|
+
return hexStr;
|
371
|
+
},
|
372
|
+
toHSL: function(h, s, b, a) {
|
373
|
+
if (arguments.length === 0) {
|
374
|
+
h = this.value.h;
|
375
|
+
s = this.value.s;
|
376
|
+
b = this.value.b;
|
377
|
+
a = this.value.a;
|
378
|
+
}
|
379
|
+
|
380
|
+
var H = h,
|
381
|
+
L = (2 - s) * b,
|
382
|
+
S = s * b;
|
383
|
+
if (L > 0 && L <= 1) {
|
384
|
+
S /= L;
|
385
|
+
} else {
|
386
|
+
S /= 2 - L;
|
387
|
+
}
|
388
|
+
L /= 2;
|
389
|
+
if (S > 1) {
|
390
|
+
S = 1;
|
391
|
+
}
|
392
|
+
return {
|
393
|
+
h: isNaN(H) ? 0 : H,
|
394
|
+
s: isNaN(S) ? 0 : S,
|
395
|
+
l: isNaN(L) ? 0 : L,
|
396
|
+
a: isNaN(a) ? 0 : a
|
397
|
+
};
|
398
|
+
},
|
399
|
+
toAlias: function(r, g, b, a) {
|
400
|
+
var c, rgb = (arguments.length === 0) ? this.toHex() : this.toHex(r, g, b, a);
|
401
|
+
|
402
|
+
// support predef. colors in non-hex format too, as defined in the alias itself
|
403
|
+
var original = this.origFormat === 'alias' ? rgb : this.toString(this.origFormat, false);
|
404
|
+
|
405
|
+
for (var alias in this.colors) {
|
406
|
+
c = this.colors[alias].toLowerCase().trim();
|
407
|
+
if ((c === rgb) || (c === original)) {
|
408
|
+
return alias;
|
409
|
+
}
|
410
|
+
}
|
411
|
+
return false;
|
412
|
+
},
|
413
|
+
RGBtoHSB: function(r, g, b, a) {
|
414
|
+
r /= 255;
|
415
|
+
g /= 255;
|
416
|
+
b /= 255;
|
417
|
+
|
418
|
+
var H, S, V, C;
|
419
|
+
V = Math.max(r, g, b);
|
420
|
+
C = V - Math.min(r, g, b);
|
421
|
+
H = (C === 0 ? null :
|
422
|
+
V === r ? (g - b) / C :
|
423
|
+
V === g ? (b - r) / C + 2 :
|
424
|
+
(r - g) / C + 4
|
425
|
+
);
|
426
|
+
H = ((H + 360) % 6) * 60 / 360;
|
427
|
+
S = C === 0 ? 0 : C / V;
|
428
|
+
return {
|
429
|
+
h: this._sanitizeNumber(H),
|
430
|
+
s: S,
|
431
|
+
b: V,
|
432
|
+
a: this._sanitizeNumber(a)
|
433
|
+
};
|
434
|
+
},
|
435
|
+
HueToRGB: function(p, q, h) {
|
436
|
+
if (h < 0) {
|
437
|
+
h += 1;
|
438
|
+
} else if (h > 1) {
|
439
|
+
h -= 1;
|
440
|
+
}
|
441
|
+
if ((h * 6) < 1) {
|
442
|
+
return p + (q - p) * h * 6;
|
443
|
+
} else if ((h * 2) < 1) {
|
444
|
+
return q;
|
445
|
+
} else if ((h * 3) < 2) {
|
446
|
+
return p + (q - p) * ((2 / 3) - h) * 6;
|
447
|
+
} else {
|
448
|
+
return p;
|
449
|
+
}
|
450
|
+
},
|
451
|
+
HSLtoRGB: function(h, s, l, a) {
|
452
|
+
if (s < 0) {
|
453
|
+
s = 0;
|
454
|
+
}
|
455
|
+
var q;
|
456
|
+
if (l <= 0.5) {
|
457
|
+
q = l * (1 + s);
|
458
|
+
} else {
|
459
|
+
q = l + s - (l * s);
|
460
|
+
}
|
461
|
+
|
462
|
+
var p = 2 * l - q;
|
463
|
+
|
464
|
+
var tr = h + (1 / 3);
|
465
|
+
var tg = h;
|
466
|
+
var tb = h - (1 / 3);
|
467
|
+
|
468
|
+
var r = Math.round(this.HueToRGB(p, q, tr) * 255);
|
469
|
+
var g = Math.round(this.HueToRGB(p, q, tg) * 255);
|
470
|
+
var b = Math.round(this.HueToRGB(p, q, tb) * 255);
|
471
|
+
return [r, g, b, this._sanitizeNumber(a)];
|
472
|
+
},
|
473
|
+
/**
|
474
|
+
* @param {String} strVal
|
475
|
+
* @returns {Object} Object containing h,s,b,a,format properties or FALSE if failed to parse
|
476
|
+
*/
|
477
|
+
parse: function(strVal) {
|
478
|
+
if (arguments.length === 0) {
|
479
|
+
return false;
|
480
|
+
}
|
481
|
+
|
482
|
+
var that = this,
|
483
|
+
result = false,
|
484
|
+
isAlias = (typeof this.colors[strVal] !== 'undefined'),
|
485
|
+
values, format;
|
486
|
+
|
487
|
+
if (isAlias) {
|
488
|
+
strVal = this.colors[strVal].toLowerCase().trim();
|
489
|
+
}
|
490
|
+
|
491
|
+
$.each(this.stringParsers, function(i, parser) {
|
492
|
+
var match = parser.re.exec(strVal);
|
493
|
+
values = match && parser.parse.apply(that, [match]);
|
494
|
+
if (values) {
|
495
|
+
result = {};
|
496
|
+
format = (isAlias ? 'alias' : (parser.format ? parser.format : that.getValidFallbackFormat()));
|
497
|
+
if (format.match(/hsla?/)) {
|
498
|
+
result = that.RGBtoHSB.apply(that, that.HSLtoRGB.apply(that, values));
|
499
|
+
} else {
|
500
|
+
result = that.RGBtoHSB.apply(that, values);
|
501
|
+
}
|
502
|
+
if (result instanceof Object) {
|
503
|
+
result.format = format;
|
504
|
+
}
|
505
|
+
return false; // stop iterating
|
506
|
+
}
|
507
|
+
return true;
|
508
|
+
});
|
509
|
+
return result;
|
510
|
+
},
|
511
|
+
getValidFallbackFormat: function() {
|
512
|
+
var formats = [
|
513
|
+
'rgba', 'rgb', 'hex', 'hsla', 'hsl'
|
514
|
+
];
|
515
|
+
if (this.origFormat && (formats.indexOf(this.origFormat) !== -1)) {
|
516
|
+
return this.origFormat;
|
517
|
+
}
|
518
|
+
if (this.fallbackFormat && (formats.indexOf(this.fallbackFormat) !== -1)) {
|
519
|
+
return this.fallbackFormat;
|
520
|
+
}
|
521
|
+
|
522
|
+
return 'rgba'; // By default, return a format that will not lose the alpha info
|
523
|
+
},
|
524
|
+
/**
|
525
|
+
*
|
526
|
+
* @param {string} [format] (default: rgba)
|
527
|
+
* @param {boolean} [translateAlias] Return real color for pre-defined (non-standard) aliases (default: false)
|
528
|
+
* @returns {String}
|
529
|
+
*/
|
530
|
+
toString: function(format, translateAlias) {
|
531
|
+
format = format || this.origFormat || this.fallbackFormat;
|
532
|
+
translateAlias = translateAlias || false;
|
533
|
+
|
534
|
+
var c = false;
|
535
|
+
|
536
|
+
switch (format) {
|
537
|
+
case 'rgb':
|
538
|
+
{
|
539
|
+
c = this.toRGB();
|
540
|
+
if (this.rgbaIsTransparent(c)) {
|
541
|
+
return 'transparent';
|
542
|
+
}
|
543
|
+
return 'rgb(' + c.r + ',' + c.g + ',' + c.b + ')';
|
544
|
+
}
|
545
|
+
break;
|
546
|
+
case 'rgba':
|
547
|
+
{
|
548
|
+
c = this.toRGB();
|
549
|
+
return 'rgba(' + c.r + ',' + c.g + ',' + c.b + ',' + c.a + ')';
|
550
|
+
}
|
551
|
+
break;
|
552
|
+
case 'hsl':
|
553
|
+
{
|
554
|
+
c = this.toHSL();
|
555
|
+
return 'hsl(' + Math.round(c.h * 360) + ',' + Math.round(c.s * 100) + '%,' + Math.round(c.l * 100) + '%)';
|
556
|
+
}
|
557
|
+
break;
|
558
|
+
case 'hsla':
|
559
|
+
{
|
560
|
+
c = this.toHSL();
|
561
|
+
return 'hsla(' + Math.round(c.h * 360) + ',' + Math.round(c.s * 100) + '%,' + Math.round(c.l * 100) + '%,' + c.a + ')';
|
562
|
+
}
|
563
|
+
break;
|
564
|
+
case 'hex':
|
565
|
+
{
|
566
|
+
return this.toHex();
|
567
|
+
}
|
568
|
+
break;
|
569
|
+
case 'alias':
|
570
|
+
{
|
571
|
+
c = this.toAlias();
|
572
|
+
|
573
|
+
if (c === false) {
|
574
|
+
return this.toString(this.getValidFallbackFormat());
|
575
|
+
}
|
576
|
+
|
577
|
+
if (translateAlias && !(c in Color.webColors) && (c in this.predefinedColors)) {
|
578
|
+
return this.predefinedColors[c];
|
579
|
+
}
|
580
|
+
|
581
|
+
return c;
|
582
|
+
}
|
583
|
+
default:
|
584
|
+
{
|
585
|
+
return c;
|
586
|
+
}
|
587
|
+
break;
|
588
|
+
}
|
589
|
+
},
|
590
|
+
// a set of RE's that can match strings and generate color tuples.
|
591
|
+
// from John Resig color plugin
|
592
|
+
// https://github.com/jquery/jquery-color/
|
593
|
+
stringParsers: [{
|
594
|
+
re: /rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*?\)/,
|
595
|
+
format: 'rgb',
|
596
|
+
parse: function(execResult) {
|
597
|
+
return [
|
598
|
+
execResult[1],
|
599
|
+
execResult[2],
|
600
|
+
execResult[3],
|
601
|
+
1
|
602
|
+
];
|
603
|
+
}
|
604
|
+
}, {
|
605
|
+
re: /rgb\(\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*?\)/,
|
606
|
+
format: 'rgb',
|
607
|
+
parse: function(execResult) {
|
608
|
+
return [
|
609
|
+
2.55 * execResult[1],
|
610
|
+
2.55 * execResult[2],
|
611
|
+
2.55 * execResult[3],
|
612
|
+
1
|
613
|
+
];
|
614
|
+
}
|
615
|
+
}, {
|
616
|
+
re: /rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/,
|
617
|
+
format: 'rgba',
|
618
|
+
parse: function(execResult) {
|
619
|
+
return [
|
620
|
+
execResult[1],
|
621
|
+
execResult[2],
|
622
|
+
execResult[3],
|
623
|
+
execResult[4]
|
624
|
+
];
|
625
|
+
}
|
626
|
+
}, {
|
627
|
+
re: /rgba\(\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/,
|
628
|
+
format: 'rgba',
|
629
|
+
parse: function(execResult) {
|
630
|
+
return [
|
631
|
+
2.55 * execResult[1],
|
632
|
+
2.55 * execResult[2],
|
633
|
+
2.55 * execResult[3],
|
634
|
+
execResult[4]
|
635
|
+
];
|
636
|
+
}
|
637
|
+
}, {
|
638
|
+
re: /hsl\(\s*(\d*(?:\.\d+)?)\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*?\)/,
|
639
|
+
format: 'hsl',
|
640
|
+
parse: function(execResult) {
|
641
|
+
return [
|
642
|
+
execResult[1] / 360,
|
643
|
+
execResult[2] / 100,
|
644
|
+
execResult[3] / 100,
|
645
|
+
execResult[4]
|
646
|
+
];
|
647
|
+
}
|
648
|
+
}, {
|
649
|
+
re: /hsla\(\s*(\d*(?:\.\d+)?)\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/,
|
650
|
+
format: 'hsla',
|
651
|
+
parse: function(execResult) {
|
652
|
+
return [
|
653
|
+
execResult[1] / 360,
|
654
|
+
execResult[2] / 100,
|
655
|
+
execResult[3] / 100,
|
656
|
+
execResult[4]
|
657
|
+
];
|
658
|
+
}
|
659
|
+
}, {
|
660
|
+
re: /#?([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,
|
661
|
+
format: 'hex',
|
662
|
+
parse: function(execResult) {
|
663
|
+
return [
|
664
|
+
parseInt(execResult[1], 16),
|
665
|
+
parseInt(execResult[2], 16),
|
666
|
+
parseInt(execResult[3], 16),
|
667
|
+
1
|
668
|
+
];
|
669
|
+
}
|
670
|
+
}, {
|
671
|
+
re: /#?([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/,
|
672
|
+
format: 'hex',
|
673
|
+
parse: function(execResult) {
|
674
|
+
return [
|
675
|
+
parseInt(execResult[1] + execResult[1], 16),
|
676
|
+
parseInt(execResult[2] + execResult[2], 16),
|
677
|
+
parseInt(execResult[3] + execResult[3], 16),
|
678
|
+
1
|
679
|
+
];
|
680
|
+
}
|
681
|
+
}],
|
682
|
+
colorNameToHex: function(name) {
|
683
|
+
if (typeof this.colors[name.toLowerCase()] !== 'undefined') {
|
684
|
+
return this.colors[name.toLowerCase()];
|
685
|
+
}
|
686
|
+
return false;
|
687
|
+
}
|
688
|
+
};
|
689
|
+
|
690
|
+
/*
|
691
|
+
* Default plugin options
|
692
|
+
*/
|
693
|
+
var defaults = {
|
694
|
+
horizontal: false, // horizontal mode layout ?
|
695
|
+
inline: false, //forces to show the colorpicker as an inline element
|
696
|
+
color: false, //forces a color
|
697
|
+
format: false, //forces a format
|
698
|
+
input: 'input', // children input selector
|
699
|
+
container: false, // container selector
|
700
|
+
component: '.add-on, .input-group-addon', // children component selector
|
701
|
+
fallbackColor: false, // fallback color value. null = keeps current color.
|
702
|
+
fallbackFormat: 'hex', // fallback color format
|
703
|
+
hexNumberSignPrefix: true, // put a '#' (number sign) before hex strings
|
704
|
+
sliders: {
|
705
|
+
saturation: {
|
706
|
+
maxLeft: 100,
|
707
|
+
maxTop: 100,
|
708
|
+
callLeft: 'setSaturation',
|
709
|
+
callTop: 'setBrightness'
|
710
|
+
},
|
711
|
+
hue: {
|
712
|
+
maxLeft: 0,
|
713
|
+
maxTop: 100,
|
714
|
+
callLeft: false,
|
715
|
+
callTop: 'setHue'
|
716
|
+
},
|
717
|
+
alpha: {
|
718
|
+
maxLeft: 0,
|
719
|
+
maxTop: 100,
|
720
|
+
callLeft: false,
|
721
|
+
callTop: 'setAlpha'
|
722
|
+
}
|
723
|
+
},
|
724
|
+
slidersHorz: {
|
725
|
+
saturation: {
|
726
|
+
maxLeft: 100,
|
727
|
+
maxTop: 100,
|
728
|
+
callLeft: 'setSaturation',
|
729
|
+
callTop: 'setBrightness'
|
730
|
+
},
|
731
|
+
hue: {
|
732
|
+
maxLeft: 100,
|
733
|
+
maxTop: 0,
|
734
|
+
callLeft: 'setHue',
|
735
|
+
callTop: false
|
736
|
+
},
|
737
|
+
alpha: {
|
738
|
+
maxLeft: 100,
|
739
|
+
maxTop: 0,
|
740
|
+
callLeft: 'setAlpha',
|
741
|
+
callTop: false
|
742
|
+
}
|
743
|
+
},
|
744
|
+
template: '<div class="colorpicker dropdown-menu">' +
|
745
|
+
'<div class="colorpicker-saturation"><i><b></b></i></div>' +
|
746
|
+
'<div class="colorpicker-hue"><i></i></div>' +
|
747
|
+
'<div class="colorpicker-alpha"><i></i></div>' +
|
748
|
+
'<div class="colorpicker-color"><div /></div>' +
|
749
|
+
'<div class="colorpicker-selectors"></div>' +
|
750
|
+
'</div>',
|
751
|
+
align: 'right',
|
752
|
+
customClass: null, // custom class added to the colorpicker element
|
753
|
+
colorSelectors: null // custom color aliases
|
754
|
+
};
|
755
|
+
|
756
|
+
/**
|
757
|
+
* Colorpicker component class
|
758
|
+
*
|
759
|
+
* @param {Object|String} element
|
760
|
+
* @param {Object} options
|
761
|
+
* @constructor
|
762
|
+
*/
|
763
|
+
var Colorpicker = function(element, options) {
|
764
|
+
this.element = $(element).addClass('colorpicker-element');
|
765
|
+
this.options = $.extend(true, {}, defaults, this.element.data(), options);
|
766
|
+
this.component = this.options.component;
|
767
|
+
this.component = (this.component !== false) ? this.element.find(this.component) : false;
|
768
|
+
if (this.component && (this.component.length === 0)) {
|
769
|
+
this.component = false;
|
770
|
+
}
|
771
|
+
this.container = (this.options.container === true) ? this.element : this.options.container;
|
772
|
+
this.container = (this.container !== false) ? $(this.container) : false;
|
773
|
+
|
774
|
+
// Is the element an input? Should we search inside for any input?
|
775
|
+
this.input = this.element.is('input') ? this.element : (this.options.input ?
|
776
|
+
this.element.find(this.options.input) : false);
|
777
|
+
if (this.input && (this.input.length === 0)) {
|
778
|
+
this.input = false;
|
779
|
+
}
|
780
|
+
// Set HSB color
|
781
|
+
this.color = this.createColor(this.options.color !== false ? this.options.color : this.getValue());
|
782
|
+
|
783
|
+
this.format = this.options.format !== false ? this.options.format : this.color.origFormat;
|
784
|
+
|
785
|
+
if (this.options.color !== false) {
|
786
|
+
this.updateInput(this.color);
|
787
|
+
this.updateData(this.color);
|
788
|
+
}
|
789
|
+
|
790
|
+
// Setup picker
|
791
|
+
var $picker = this.picker = $(this.options.template);
|
792
|
+
if (this.options.customClass) {
|
793
|
+
$picker.addClass(this.options.customClass);
|
794
|
+
}
|
795
|
+
if (this.options.inline) {
|
796
|
+
$picker.addClass('colorpicker-inline colorpicker-visible');
|
797
|
+
} else {
|
798
|
+
$picker.addClass('colorpicker-hidden');
|
799
|
+
}
|
800
|
+
if (this.options.horizontal) {
|
801
|
+
$picker.addClass('colorpicker-horizontal');
|
802
|
+
}
|
803
|
+
if (
|
804
|
+
(['rgba', 'hsla', 'alias'].indexOf(this.format) !== -1) ||
|
805
|
+
this.options.format === false ||
|
806
|
+
this.getValue() === 'transparent'
|
807
|
+
) {
|
808
|
+
$picker.addClass('colorpicker-with-alpha');
|
809
|
+
}
|
810
|
+
if (this.options.align === 'right') {
|
811
|
+
$picker.addClass('colorpicker-right');
|
812
|
+
}
|
813
|
+
if (this.options.inline === true) {
|
814
|
+
$picker.addClass('colorpicker-no-arrow');
|
815
|
+
}
|
816
|
+
if (this.options.colorSelectors) {
|
817
|
+
var colorpicker = this,
|
818
|
+
selectorsContainer = colorpicker.picker.find('.colorpicker-selectors');
|
819
|
+
|
820
|
+
if (selectorsContainer.length > 0) {
|
821
|
+
$.each(this.options.colorSelectors, function(name, color) {
|
822
|
+
var $btn = $('<i />')
|
823
|
+
.addClass('colorpicker-selectors-color')
|
824
|
+
.css('background-color', color)
|
825
|
+
.data('class', name).data('alias', name);
|
826
|
+
|
827
|
+
$btn.on('mousedown.colorpicker touchstart.colorpicker', function(event) {
|
828
|
+
event.preventDefault();
|
829
|
+
colorpicker.setValue(
|
830
|
+
colorpicker.format === 'alias' ? $(this).data('alias') : $(this).css('background-color')
|
831
|
+
);
|
832
|
+
});
|
833
|
+
selectorsContainer.append($btn);
|
834
|
+
});
|
835
|
+
selectorsContainer.show().addClass('colorpicker-visible');
|
836
|
+
}
|
837
|
+
}
|
838
|
+
|
839
|
+
// Prevent closing the colorpicker when clicking on itself
|
840
|
+
$picker.on('mousedown.colorpicker touchstart.colorpicker', $.proxy(function(e) {
|
841
|
+
if (e.target === e.currentTarget) {
|
842
|
+
e.preventDefault();
|
843
|
+
}
|
844
|
+
}, this));
|
845
|
+
|
846
|
+
// Bind click/tap events on the sliders
|
847
|
+
$picker.find('.colorpicker-saturation, .colorpicker-hue, .colorpicker-alpha')
|
848
|
+
.on('mousedown.colorpicker touchstart.colorpicker', $.proxy(this.mousedown, this));
|
849
|
+
|
850
|
+
$picker.appendTo(this.container ? this.container : $('body'));
|
851
|
+
|
852
|
+
// Bind other events
|
853
|
+
if (this.input !== false) {
|
854
|
+
this.input.on({
|
855
|
+
'keyup.colorpicker': $.proxy(this.keyup, this)
|
856
|
+
});
|
857
|
+
this.input.on({
|
858
|
+
'change.colorpicker': $.proxy(this.change, this)
|
859
|
+
});
|
860
|
+
if (this.component === false) {
|
861
|
+
this.element.on({
|
862
|
+
'focus.colorpicker': $.proxy(this.show, this)
|
863
|
+
});
|
864
|
+
}
|
865
|
+
if (this.options.inline === false) {
|
866
|
+
this.element.on({
|
867
|
+
'focusout.colorpicker': $.proxy(this.hide, this)
|
868
|
+
});
|
869
|
+
}
|
870
|
+
}
|
871
|
+
|
872
|
+
if (this.component !== false) {
|
873
|
+
this.component.on({
|
874
|
+
'click.colorpicker': $.proxy(this.show, this)
|
875
|
+
});
|
876
|
+
}
|
877
|
+
|
878
|
+
if ((this.input === false) && (this.component === false)) {
|
879
|
+
this.element.on({
|
880
|
+
'click.colorpicker': $.proxy(this.show, this)
|
881
|
+
});
|
882
|
+
}
|
883
|
+
|
884
|
+
// for HTML5 input[type='color']
|
885
|
+
if ((this.input !== false) && (this.component !== false) && (this.input.attr('type') === 'color')) {
|
886
|
+
|
887
|
+
this.input.on({
|
888
|
+
'click.colorpicker': $.proxy(this.show, this),
|
889
|
+
'focus.colorpicker': $.proxy(this.show, this)
|
890
|
+
});
|
891
|
+
}
|
892
|
+
this.update();
|
893
|
+
|
894
|
+
$($.proxy(function() {
|
895
|
+
this.element.trigger('create');
|
896
|
+
}, this));
|
897
|
+
};
|
898
|
+
|
899
|
+
Colorpicker.Color = Color;
|
900
|
+
|
901
|
+
Colorpicker.prototype = {
|
902
|
+
constructor: Colorpicker,
|
903
|
+
destroy: function() {
|
904
|
+
this.picker.remove();
|
905
|
+
this.element.removeData('colorpicker', 'color').off('.colorpicker');
|
906
|
+
if (this.input !== false) {
|
907
|
+
this.input.off('.colorpicker');
|
908
|
+
}
|
909
|
+
if (this.component !== false) {
|
910
|
+
this.component.off('.colorpicker');
|
911
|
+
}
|
912
|
+
this.element.removeClass('colorpicker-element');
|
913
|
+
this.element.trigger({
|
914
|
+
type: 'destroy'
|
915
|
+
});
|
916
|
+
},
|
917
|
+
reposition: function() {
|
918
|
+
if (this.options.inline !== false || this.options.container) {
|
919
|
+
return false;
|
920
|
+
}
|
921
|
+
var type = this.container && this.container[0] !== window.document.body ? 'position' : 'offset';
|
922
|
+
var element = this.component || this.element;
|
923
|
+
var offset = element[type]();
|
924
|
+
if (this.options.align === 'right') {
|
925
|
+
offset.left -= this.picker.outerWidth() - element.outerWidth();
|
926
|
+
}
|
927
|
+
this.picker.css({
|
928
|
+
top: offset.top + element.outerHeight(),
|
929
|
+
left: offset.left
|
930
|
+
});
|
931
|
+
},
|
932
|
+
show: function(e) {
|
933
|
+
if (this.isDisabled()) {
|
934
|
+
// Don't show the widget if it's disabled (the input)
|
935
|
+
return;
|
936
|
+
}
|
937
|
+
this.picker.addClass('colorpicker-visible').removeClass('colorpicker-hidden');
|
938
|
+
this.reposition();
|
939
|
+
$(window).on('resize.colorpicker', $.proxy(this.reposition, this));
|
940
|
+
if (e && (!this.hasInput() || this.input.attr('type') === 'color')) {
|
941
|
+
if (e.stopPropagation && e.preventDefault) {
|
942
|
+
e.stopPropagation();
|
943
|
+
e.preventDefault();
|
944
|
+
}
|
945
|
+
}
|
946
|
+
if ((this.component || !this.input) && (this.options.inline === false)) {
|
947
|
+
$(window.document).on({
|
948
|
+
'mousedown.colorpicker': $.proxy(this.hide, this)
|
949
|
+
});
|
950
|
+
}
|
951
|
+
this.element.trigger({
|
952
|
+
type: 'showPicker',
|
953
|
+
color: this.color
|
954
|
+
});
|
955
|
+
},
|
956
|
+
hide: function(e) {
|
957
|
+
if ((typeof e !== 'undefined') && e.target) {
|
958
|
+
// Prevent hide if triggered by an event and an element inside the colorpicker has been clicked/touched
|
959
|
+
if (
|
960
|
+
$(e.currentTarget).parents('.colorpicker').length > 0 ||
|
961
|
+
$(e.target).parents('.colorpicker').length > 0
|
962
|
+
) {
|
963
|
+
return false;
|
964
|
+
}
|
965
|
+
}
|
966
|
+
this.picker.addClass('colorpicker-hidden').removeClass('colorpicker-visible');
|
967
|
+
$(window).off('resize.colorpicker', this.reposition);
|
968
|
+
$(window.document).off({
|
969
|
+
'mousedown.colorpicker': this.hide
|
970
|
+
});
|
971
|
+
this.update();
|
972
|
+
this.element.trigger({
|
973
|
+
type: 'hidePicker',
|
974
|
+
color: this.color
|
975
|
+
});
|
976
|
+
},
|
977
|
+
updateData: function(val) {
|
978
|
+
val = val || this.color.toString(this.format, false);
|
979
|
+
this.element.data('color', val);
|
980
|
+
return val;
|
981
|
+
},
|
982
|
+
updateInput: function(val) {
|
983
|
+
val = val || this.color.toString(this.format, false);
|
984
|
+
if (this.input !== false) {
|
985
|
+
this.input.prop('value', val);
|
986
|
+
this.input.trigger('change');
|
987
|
+
}
|
988
|
+
return val;
|
989
|
+
},
|
990
|
+
updatePicker: function(val) {
|
991
|
+
if (typeof val !== 'undefined') {
|
992
|
+
this.color = this.createColor(val);
|
993
|
+
}
|
994
|
+
var sl = (this.options.horizontal === false) ? this.options.sliders : this.options.slidersHorz;
|
995
|
+
var icns = this.picker.find('i');
|
996
|
+
if (icns.length === 0) {
|
997
|
+
return;
|
998
|
+
}
|
999
|
+
if (this.options.horizontal === false) {
|
1000
|
+
sl = this.options.sliders;
|
1001
|
+
icns.eq(1).css('top', sl.hue.maxTop * (1 - this.color.value.h)).end()
|
1002
|
+
.eq(2).css('top', sl.alpha.maxTop * (1 - this.color.value.a));
|
1003
|
+
} else {
|
1004
|
+
sl = this.options.slidersHorz;
|
1005
|
+
icns.eq(1).css('left', sl.hue.maxLeft * (1 - this.color.value.h)).end()
|
1006
|
+
.eq(2).css('left', sl.alpha.maxLeft * (1 - this.color.value.a));
|
1007
|
+
}
|
1008
|
+
icns.eq(0).css({
|
1009
|
+
'top': sl.saturation.maxTop - this.color.value.b * sl.saturation.maxTop,
|
1010
|
+
'left': this.color.value.s * sl.saturation.maxLeft
|
1011
|
+
});
|
1012
|
+
|
1013
|
+
this.picker.find('.colorpicker-saturation')
|
1014
|
+
.css('backgroundColor', (this.options.hexNumberSignPrefix ? '' : '#') + this.color.toHex(this.color.value.h, 1, 1, 1));
|
1015
|
+
|
1016
|
+
this.picker.find('.colorpicker-alpha')
|
1017
|
+
.css('backgroundColor', (this.options.hexNumberSignPrefix ? '' : '#') + this.color.toHex());
|
1018
|
+
|
1019
|
+
this.picker.find('.colorpicker-color, .colorpicker-color div')
|
1020
|
+
.css('backgroundColor', this.color.toString(this.format, true));
|
1021
|
+
|
1022
|
+
return val;
|
1023
|
+
},
|
1024
|
+
updateComponent: function(val) {
|
1025
|
+
var color;
|
1026
|
+
|
1027
|
+
if (typeof val !== 'undefined') {
|
1028
|
+
color = this.createColor(val);
|
1029
|
+
} else {
|
1030
|
+
color = this.color;
|
1031
|
+
}
|
1032
|
+
|
1033
|
+
if (this.component !== false) {
|
1034
|
+
var icn = this.component.find('i').eq(0);
|
1035
|
+
if (icn.length > 0) {
|
1036
|
+
icn.css({
|
1037
|
+
'backgroundColor': color.toString(this.format, true)
|
1038
|
+
});
|
1039
|
+
} else {
|
1040
|
+
this.component.css({
|
1041
|
+
'backgroundColor': color.toString(this.format, true)
|
1042
|
+
});
|
1043
|
+
}
|
1044
|
+
}
|
1045
|
+
|
1046
|
+
return color.toString(this.format, false);
|
1047
|
+
},
|
1048
|
+
update: function(force) {
|
1049
|
+
var val;
|
1050
|
+
if ((this.getValue(false) !== false) || (force === true)) {
|
1051
|
+
// Update input/data only if the current value is not empty
|
1052
|
+
val = this.updateComponent();
|
1053
|
+
this.updateInput(val);
|
1054
|
+
this.updateData(val);
|
1055
|
+
this.updatePicker(); // only update picker if value is not empty
|
1056
|
+
}
|
1057
|
+
return val;
|
1058
|
+
|
1059
|
+
},
|
1060
|
+
setValue: function(val) { // set color manually
|
1061
|
+
this.color = this.createColor(val);
|
1062
|
+
this.update(true);
|
1063
|
+
this.element.trigger({
|
1064
|
+
type: 'changeColor',
|
1065
|
+
color: this.color,
|
1066
|
+
value: val
|
1067
|
+
});
|
1068
|
+
},
|
1069
|
+
/**
|
1070
|
+
* Creates a new color using the instance options
|
1071
|
+
* @protected
|
1072
|
+
* @param {String} val
|
1073
|
+
* @returns {Color}
|
1074
|
+
*/
|
1075
|
+
createColor: function(val) {
|
1076
|
+
return new Color(
|
1077
|
+
val ? val : null,
|
1078
|
+
this.options.colorSelectors,
|
1079
|
+
this.options.fallbackColor ? this.options.fallbackColor : this.color,
|
1080
|
+
this.options.fallbackFormat,
|
1081
|
+
this.options.hexNumberSignPrefix
|
1082
|
+
);
|
1083
|
+
},
|
1084
|
+
getValue: function(defaultValue) {
|
1085
|
+
defaultValue = (typeof defaultValue === 'undefined') ? this.options.fallbackColor : defaultValue;
|
1086
|
+
var val;
|
1087
|
+
if (this.hasInput()) {
|
1088
|
+
val = this.input.val();
|
1089
|
+
} else {
|
1090
|
+
val = this.element.data('color');
|
1091
|
+
}
|
1092
|
+
if ((val === undefined) || (val === '') || (val === null)) {
|
1093
|
+
// if not defined or empty, return default
|
1094
|
+
val = defaultValue;
|
1095
|
+
}
|
1096
|
+
return val;
|
1097
|
+
},
|
1098
|
+
hasInput: function() {
|
1099
|
+
return (this.input !== false);
|
1100
|
+
},
|
1101
|
+
isDisabled: function() {
|
1102
|
+
if (this.hasInput()) {
|
1103
|
+
return (this.input.prop('disabled') === true);
|
1104
|
+
}
|
1105
|
+
return false;
|
1106
|
+
},
|
1107
|
+
disable: function() {
|
1108
|
+
if (this.hasInput()) {
|
1109
|
+
this.input.prop('disabled', true);
|
1110
|
+
this.element.trigger({
|
1111
|
+
type: 'disable',
|
1112
|
+
color: this.color,
|
1113
|
+
value: this.getValue()
|
1114
|
+
});
|
1115
|
+
return true;
|
1116
|
+
}
|
1117
|
+
return false;
|
1118
|
+
},
|
1119
|
+
enable: function() {
|
1120
|
+
if (this.hasInput()) {
|
1121
|
+
this.input.prop('disabled', false);
|
1122
|
+
this.element.trigger({
|
1123
|
+
type: 'enable',
|
1124
|
+
color: this.color,
|
1125
|
+
value: this.getValue()
|
1126
|
+
});
|
1127
|
+
return true;
|
1128
|
+
}
|
1129
|
+
return false;
|
1130
|
+
},
|
1131
|
+
currentSlider: null,
|
1132
|
+
mousePointer: {
|
1133
|
+
left: 0,
|
1134
|
+
top: 0
|
1135
|
+
},
|
1136
|
+
mousedown: function(e) {
|
1137
|
+
if (!e.pageX && !e.pageY && e.originalEvent && e.originalEvent.touches) {
|
1138
|
+
e.pageX = e.originalEvent.touches[0].pageX;
|
1139
|
+
e.pageY = e.originalEvent.touches[0].pageY;
|
1140
|
+
}
|
1141
|
+
e.stopPropagation();
|
1142
|
+
e.preventDefault();
|
1143
|
+
|
1144
|
+
var target = $(e.target);
|
1145
|
+
|
1146
|
+
//detect the slider and set the limits and callbacks
|
1147
|
+
var zone = target.closest('div');
|
1148
|
+
var sl = this.options.horizontal ? this.options.slidersHorz : this.options.sliders;
|
1149
|
+
if (!zone.is('.colorpicker')) {
|
1150
|
+
if (zone.is('.colorpicker-saturation')) {
|
1151
|
+
this.currentSlider = $.extend({}, sl.saturation);
|
1152
|
+
} else if (zone.is('.colorpicker-hue')) {
|
1153
|
+
this.currentSlider = $.extend({}, sl.hue);
|
1154
|
+
} else if (zone.is('.colorpicker-alpha')) {
|
1155
|
+
this.currentSlider = $.extend({}, sl.alpha);
|
1156
|
+
} else {
|
1157
|
+
return false;
|
1158
|
+
}
|
1159
|
+
var offset = zone.offset();
|
1160
|
+
//reference to guide's style
|
1161
|
+
this.currentSlider.guide = zone.find('i')[0].style;
|
1162
|
+
this.currentSlider.left = e.pageX - offset.left;
|
1163
|
+
this.currentSlider.top = e.pageY - offset.top;
|
1164
|
+
this.mousePointer = {
|
1165
|
+
left: e.pageX,
|
1166
|
+
top: e.pageY
|
1167
|
+
};
|
1168
|
+
//trigger mousemove to move the guide to the current position
|
1169
|
+
$(window.document).on({
|
1170
|
+
'mousemove.colorpicker': $.proxy(this.mousemove, this),
|
1171
|
+
'touchmove.colorpicker': $.proxy(this.mousemove, this),
|
1172
|
+
'mouseup.colorpicker': $.proxy(this.mouseup, this),
|
1173
|
+
'touchend.colorpicker': $.proxy(this.mouseup, this)
|
1174
|
+
}).trigger('mousemove');
|
1175
|
+
}
|
1176
|
+
return false;
|
1177
|
+
},
|
1178
|
+
mousemove: function(e) {
|
1179
|
+
if (!e.pageX && !e.pageY && e.originalEvent && e.originalEvent.touches) {
|
1180
|
+
e.pageX = e.originalEvent.touches[0].pageX;
|
1181
|
+
e.pageY = e.originalEvent.touches[0].pageY;
|
1182
|
+
}
|
1183
|
+
e.stopPropagation();
|
1184
|
+
e.preventDefault();
|
1185
|
+
var left = Math.max(
|
1186
|
+
0,
|
1187
|
+
Math.min(
|
1188
|
+
this.currentSlider.maxLeft,
|
1189
|
+
this.currentSlider.left + ((e.pageX || this.mousePointer.left) - this.mousePointer.left)
|
1190
|
+
)
|
1191
|
+
);
|
1192
|
+
var top = Math.max(
|
1193
|
+
0,
|
1194
|
+
Math.min(
|
1195
|
+
this.currentSlider.maxTop,
|
1196
|
+
this.currentSlider.top + ((e.pageY || this.mousePointer.top) - this.mousePointer.top)
|
1197
|
+
)
|
1198
|
+
);
|
1199
|
+
this.currentSlider.guide.left = left + 'px';
|
1200
|
+
this.currentSlider.guide.top = top + 'px';
|
1201
|
+
if (this.currentSlider.callLeft) {
|
1202
|
+
this.color[this.currentSlider.callLeft].call(this.color, left / this.currentSlider.maxLeft);
|
1203
|
+
}
|
1204
|
+
if (this.currentSlider.callTop) {
|
1205
|
+
this.color[this.currentSlider.callTop].call(this.color, top / this.currentSlider.maxTop);
|
1206
|
+
}
|
1207
|
+
// Change format dynamically
|
1208
|
+
// Only occurs if user choose the dynamic format by
|
1209
|
+
// setting option format to false
|
1210
|
+
if (
|
1211
|
+
this.options.format === false &&
|
1212
|
+
(this.currentSlider.callTop === 'setAlpha' ||
|
1213
|
+
this.currentSlider.callLeft === 'setAlpha')
|
1214
|
+
) {
|
1215
|
+
|
1216
|
+
// Converting from hex / rgb to rgba
|
1217
|
+
if (this.color.value.a !== 1) {
|
1218
|
+
this.format = 'rgba';
|
1219
|
+
this.color.origFormat = 'rgba';
|
1220
|
+
}
|
1221
|
+
|
1222
|
+
// Converting from rgba to hex
|
1223
|
+
else {
|
1224
|
+
this.format = 'hex';
|
1225
|
+
this.color.origFormat = 'hex';
|
1226
|
+
}
|
1227
|
+
}
|
1228
|
+
this.update(true);
|
1229
|
+
|
1230
|
+
this.element.trigger({
|
1231
|
+
type: 'changeColor',
|
1232
|
+
color: this.color
|
1233
|
+
});
|
1234
|
+
return false;
|
1235
|
+
},
|
1236
|
+
mouseup: function(e) {
|
1237
|
+
e.stopPropagation();
|
1238
|
+
e.preventDefault();
|
1239
|
+
$(window.document).off({
|
1240
|
+
'mousemove.colorpicker': this.mousemove,
|
1241
|
+
'touchmove.colorpicker': this.mousemove,
|
1242
|
+
'mouseup.colorpicker': this.mouseup,
|
1243
|
+
'touchend.colorpicker': this.mouseup
|
1244
|
+
});
|
1245
|
+
return false;
|
1246
|
+
},
|
1247
|
+
change: function(e) {
|
1248
|
+
this.keyup(e);
|
1249
|
+
},
|
1250
|
+
keyup: function(e) {
|
1251
|
+
if ((e.keyCode === 38)) {
|
1252
|
+
if (this.color.value.a < 1) {
|
1253
|
+
this.color.value.a = Math.round((this.color.value.a + 0.01) * 100) / 100;
|
1254
|
+
}
|
1255
|
+
this.update(true);
|
1256
|
+
} else if ((e.keyCode === 40)) {
|
1257
|
+
if (this.color.value.a > 0) {
|
1258
|
+
this.color.value.a = Math.round((this.color.value.a - 0.01) * 100) / 100;
|
1259
|
+
}
|
1260
|
+
this.update(true);
|
1261
|
+
} else {
|
1262
|
+
this.color = this.createColor(this.input.val());
|
1263
|
+
// Change format dynamically
|
1264
|
+
// Only occurs if user choose the dynamic format by
|
1265
|
+
// setting option format to false
|
1266
|
+
if (this.color.origFormat && this.options.format === false) {
|
1267
|
+
this.format = this.color.origFormat;
|
1268
|
+
}
|
1269
|
+
if (this.getValue(false) !== false) {
|
1270
|
+
this.updateData();
|
1271
|
+
this.updateComponent();
|
1272
|
+
this.updatePicker();
|
1273
|
+
}
|
1274
|
+
}
|
1275
|
+
this.element.trigger({
|
1276
|
+
type: 'changeColor',
|
1277
|
+
color: this.color,
|
1278
|
+
value: this.input.val()
|
1279
|
+
});
|
1280
|
+
}
|
1281
|
+
};
|
1282
|
+
|
1283
|
+
$.colorpicker = Colorpicker;
|
1284
|
+
|
1285
|
+
$.fn.colorpicker = function(option) {
|
1286
|
+
var apiArgs = Array.prototype.slice.call(arguments, 1),
|
1287
|
+
isSingleElement = (this.length === 1),
|
1288
|
+
returnValue = null;
|
1289
|
+
|
1290
|
+
var $jq = this.each(function() {
|
1291
|
+
var $this = $(this),
|
1292
|
+
inst = $this.data('colorpicker'),
|
1293
|
+
options = ((typeof option === 'object') ? option : {});
|
1294
|
+
|
1295
|
+
if (!inst) {
|
1296
|
+
inst = new Colorpicker(this, options);
|
1297
|
+
$this.data('colorpicker', inst);
|
1298
|
+
}
|
1299
|
+
|
1300
|
+
if (typeof option === 'string') {
|
1301
|
+
if ($.isFunction(inst[option])) {
|
1302
|
+
returnValue = inst[option].apply(inst, apiArgs);
|
1303
|
+
} else { // its a property ?
|
1304
|
+
if (apiArgs.length) {
|
1305
|
+
// set property
|
1306
|
+
inst[option] = apiArgs[0];
|
1307
|
+
}
|
1308
|
+
returnValue = inst[option];
|
1309
|
+
}
|
1310
|
+
} else {
|
1311
|
+
returnValue = $this;
|
1312
|
+
}
|
1313
|
+
});
|
1314
|
+
return isSingleElement ? returnValue : $jq;
|
1315
|
+
};
|
1316
|
+
|
1317
|
+
$.fn.colorpicker.constructor = Colorpicker;
|
1318
|
+
|
1319
|
+
}));
|