action_ui 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +36 -0
- data/lib/cre_pro-rails.rb +8 -0
- data/lib/cre_pro/rails.rb +7 -0
- data/lib/cre_pro/rails/version.rb +5 -0
- data/vendor/assets/javascripts/gp/gp.js +292 -0
- data/vendor/assets/javascripts/ld/bootstrap-checkbox-radio-switch-tags.js +869 -0
- data/vendor/assets/javascripts/ld/bootstrap-datetimepicker.js +2573 -0
- data/vendor/assets/javascripts/ld/bootstrap-notify.js +379 -0
- data/vendor/assets/javascripts/ld/bootstrap-selectpicker.js +1711 -0
- data/vendor/assets/javascripts/ld/bootstrap-table.js +2484 -0
- data/vendor/assets/javascripts/ld/chartist.min.js +8 -0
- data/vendor/assets/javascripts/ld/demo.js +731 -0
- data/vendor/assets/javascripts/ld/fullcalendar.min.js +9 -0
- data/vendor/assets/javascripts/ld/jquery-jvectormap.js +3381 -0
- data/vendor/assets/javascripts/ld/jquery-ui.min.js +24 -0
- data/vendor/assets/javascripts/ld/jquery.bootstrap.wizard.min.js +22 -0
- data/vendor/assets/javascripts/ld/jquery.datatables.js +15498 -0
- data/vendor/assets/javascripts/ld/jquery.min.js +5 -0
- data/vendor/assets/javascripts/ld/jquery.validate.min.js +4 -0
- data/vendor/assets/javascripts/ld/ld.js +422 -0
- data/vendor/assets/javascripts/ld/moment.min.js +7 -0
- data/vendor/assets/javascripts/ld/sweetalert2.js +877 -0
- data/vendor/assets/javascripts/mk/bootstrap-datepicker.js +474 -0
- data/vendor/assets/javascripts/mk/bootstrap.min.js +7 -0
- data/vendor/assets/javascripts/mk/jasny-bootstrap.min.js +6 -0
- data/vendor/assets/javascripts/mk/jquery.dropdown.js +378 -0
- data/vendor/assets/javascripts/mk/jquery.flexisel.js +342 -0
- data/vendor/assets/javascripts/mk/jquery.min.js +3 -0
- data/vendor/assets/javascripts/mk/jquery.tagsinput.js +355 -0
- data/vendor/assets/javascripts/mk/mk.js +191 -0
- data/vendor/assets/javascripts/mk/mk.min.js +1 -0
- data/vendor/assets/javascripts/mk/nouislider.min.js +31 -0
- data/vendor/assets/javascripts/pd/bootstrap-checkbox-radio-switch-tags.js +869 -0
- data/vendor/assets/javascripts/pd/bootstrap-datetimepicker.js +2576 -0
- data/vendor/assets/javascripts/pd/bootstrap-notify.js +379 -0
- data/vendor/assets/javascripts/pd/bootstrap-selectpicker.js +1711 -0
- data/vendor/assets/javascripts/pd/bootstrap-table.js +2484 -0
- data/vendor/assets/javascripts/pd/bootstrap.min.js +12 -0
- data/vendor/assets/javascripts/pd/chartist.min.js +9 -0
- data/vendor/assets/javascripts/pd/demo.js +911 -0
- data/vendor/assets/javascripts/pd/fullcalendar.min.js +9 -0
- data/vendor/assets/javascripts/pd/jquery-1.10.2.js +9789 -0
- data/vendor/assets/javascripts/pd/jquery-1.10.2.min.js +3 -0
- data/vendor/assets/javascripts/pd/jquery-jvectormap.js +3381 -0
- data/vendor/assets/javascripts/pd/jquery-ui.min.js +24 -0
- data/vendor/assets/javascripts/pd/jquery.bootstrap.wizard.min.js +22 -0
- data/vendor/assets/javascripts/pd/jquery.datatables.js +15498 -0
- data/vendor/assets/javascripts/pd/jquery.easypiechart.min.js +9 -0
- data/vendor/assets/javascripts/pd/jquery.min.js +5 -0
- data/vendor/assets/javascripts/pd/jquery.tagsinput.js +355 -0
- data/vendor/assets/javascripts/pd/jquery.validate.min.js +4 -0
- data/vendor/assets/javascripts/pd/moment.min.js +7 -0
- data/vendor/assets/javascripts/pd/pd.js +335 -0
- data/vendor/assets/javascripts/pd/sweetalert2.js +877 -0
- data/vendor/assets/javascripts/pk/bootstrap-datepicker.js +492 -0
- data/vendor/assets/javascripts/pk/bootstrap-select.js +1711 -0
- data/vendor/assets/javascripts/pk/chartist.min.js +8 -0
- data/vendor/assets/javascripts/pk/ct-pk-bootstrapswitch.js +249 -0
- data/vendor/assets/javascripts/pk/ct-pk-checkbox.js +109 -0
- data/vendor/assets/javascripts/pk/ct-pk-radio.js +140 -0
- data/vendor/assets/javascripts/pk/ct-pk.js +305 -0
- data/vendor/assets/javascripts/pk/demo.js +289 -0
- data/vendor/assets/javascripts/pk/jasny-bootstrap.min.js +6 -0
- data/vendor/assets/javascripts/pk/jquery-1.10.2.js +9789 -0
- data/vendor/assets/javascripts/pk/jquery-ui-1.10.4.custom.min.js +6 -0
- data/vendor/assets/javascripts/pk/jquery.tagsinput.js +355 -0
- data/vendor/assets/javascripts/pk/photo_swipe/init-gallery.js +205 -0
- data/vendor/assets/javascripts/pk/photo_swipe/photoswipe-ui-default.min.js +4 -0
- data/vendor/assets/javascripts/pk/photo_swipe/photoswipe.min.js +4 -0
- data/vendor/assets/javascripts/pk/presentation-page/atv-img-min.js +233 -0
- data/vendor/assets/javascripts/pk/presentation-page/jquery.sharrre.js +585 -0
- data/vendor/assets/javascripts/sd/bootstrap-datepicker.js +492 -0
- data/vendor/assets/javascripts/sd/bootstrap-select.js +1711 -0
- data/vendor/assets/javascripts/sd/chartist.min.js +8 -0
- data/vendor/assets/javascripts/sd/demo.js +227 -0
- data/vendor/assets/javascripts/sd/jquery-ui.custom.min.js +7 -0
- data/vendor/assets/javascripts/sd/jquery.flexisel.js +342 -0
- data/vendor/assets/javascripts/sd/jquery.js +9789 -0
- data/vendor/assets/javascripts/sd/jquery.tagsinput.js +355 -0
- data/vendor/assets/javascripts/sd/retina.min.js +10 -0
- data/vendor/assets/javascripts/sd/sd-bootstrapswitch.js +249 -0
- data/vendor/assets/javascripts/sd/sd-checkbox.js +109 -0
- data/vendor/assets/javascripts/sd/sd-morphing.js +89 -0
- data/vendor/assets/javascripts/sd/sd-radio.js +140 -0
- data/vendor/assets/javascripts/sd/sd.js +398 -0
- data/vendor/assets/stylesheets/gp/components/_buttons.scss +121 -0
- data/vendor/assets/stylesheets/gp/components/_cards.scss +271 -0
- data/vendor/assets/stylesheets/gp/components/_carousel.scss +15 -0
- data/vendor/assets/stylesheets/gp/components/_clients.scss +172 -0
- data/vendor/assets/stylesheets/gp/components/_closure.scss +19 -0
- data/vendor/assets/stylesheets/gp/components/_contact.scss +93 -0
- data/vendor/assets/stylesheets/gp/components/_dropdown.scss +173 -0
- data/vendor/assets/stylesheets/gp/components/_example-pages.scss +524 -0
- data/vendor/assets/stylesheets/gp/components/_footers.scss +191 -0
- data/vendor/assets/stylesheets/gp/components/_headers.scss +72 -0
- data/vendor/assets/stylesheets/gp/components/_inputs.scss +145 -0
- data/vendor/assets/stylesheets/gp/components/_labels.scss +15 -0
- data/vendor/assets/stylesheets/gp/components/_misc.scss +332 -0
- data/vendor/assets/stylesheets/gp/components/_mixins.scss +11 -0
- data/vendor/assets/stylesheets/gp/components/_navbars.scss +252 -0
- data/vendor/assets/stylesheets/gp/components/_numbers.scss +61 -0
- data/vendor/assets/stylesheets/gp/components/_projects.scss +279 -0
- data/vendor/assets/stylesheets/gp/components/_responsive.scss +950 -0
- data/vendor/assets/stylesheets/gp/components/_sections.scss +328 -0
- data/vendor/assets/stylesheets/gp/components/_social-buttons.scss +30 -0
- data/vendor/assets/stylesheets/gp/components/_team.scss +182 -0
- data/vendor/assets/stylesheets/gp/components/_theme.scss +22 -0
- data/vendor/assets/stylesheets/gp/components/_typography.scss +252 -0
- data/vendor/assets/stylesheets/gp/components/_variables.scss +267 -0
- data/vendor/assets/stylesheets/gp/components/mixins/_buttons.scss +61 -0
- data/vendor/assets/stylesheets/gp/components/mixins/_cards.scss +8 -0
- data/vendor/assets/stylesheets/gp/components/mixins/_inputs.scss +17 -0
- data/vendor/assets/stylesheets/gp/components/mixins/_navbars.scss +11 -0
- data/vendor/assets/stylesheets/gp/components/mixins/_transparency.scss +20 -0
- data/vendor/assets/stylesheets/gp/components/mixins/_vendor-prefixes.scss +284 -0
- data/vendor/assets/stylesheets/gp/gp.scss +30 -0
- data/vendor/assets/stylesheets/ld/ld.scss +53 -0
- data/vendor/assets/stylesheets/ld/ld/_alerts.scss +82 -0
- data/vendor/assets/stylesheets/ld/ld/_buttons.scss +123 -0
- data/vendor/assets/stylesheets/ld/ld/_cards.scss +315 -0
- data/vendor/assets/stylesheets/ld/ld/_carousel.scss +15 -0
- data/vendor/assets/stylesheets/ld/ld/_checkbox-radio-switch.scss +253 -0
- data/vendor/assets/stylesheets/ld/ld/_collapse.scss +49 -0
- data/vendor/assets/stylesheets/ld/ld/_dropdown.scss +176 -0
- data/vendor/assets/stylesheets/ld/ld/_footers.scss +155 -0
- data/vendor/assets/stylesheets/ld/ld/_forms.scss +41 -0
- data/vendor/assets/stylesheets/ld/ld/_inputs.scss +170 -0
- data/vendor/assets/stylesheets/ld/ld/_labels.scss +54 -0
- data/vendor/assets/stylesheets/ld/ld/_media.scss +80 -0
- data/vendor/assets/stylesheets/ld/ld/_misc.scss +87 -0
- data/vendor/assets/stylesheets/ld/ld/_mixins.scss +22 -0
- data/vendor/assets/stylesheets/ld/ld/_modal.scss +79 -0
- data/vendor/assets/stylesheets/ld/ld/_navbars.scss +362 -0
- data/vendor/assets/stylesheets/ld/ld/_pages.scss +215 -0
- data/vendor/assets/stylesheets/ld/ld/_progress-bars.scss +26 -0
- data/vendor/assets/stylesheets/ld/ld/_responsive.scss +647 -0
- data/vendor/assets/stylesheets/ld/ld/_sidebar-and-main-panel.scss +576 -0
- data/vendor/assets/stylesheets/ld/ld/_sliders.scss +219 -0
- data/vendor/assets/stylesheets/ld/ld/_social-buttons.scss +77 -0
- data/vendor/assets/stylesheets/ld/ld/_tables.scss +120 -0
- data/vendor/assets/stylesheets/ld/ld/_tabs-navs-pagination.scss +302 -0
- data/vendor/assets/stylesheets/ld/ld/_tags.scss +123 -0
- data/vendor/assets/stylesheets/ld/ld/_tooltips-and-popovers.scss +156 -0
- data/vendor/assets/stylesheets/ld/ld/_typography.scss +93 -0
- data/vendor/assets/stylesheets/ld/ld/_variables.scss +319 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_buttons.scss +74 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_cards.scss +8 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_chartist.scss +85 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_icons.scss +13 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_inputs.scss +17 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_labels.scss +21 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_morphing-buttons.scss +34 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_navbars.scss +11 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_social-buttons.scss +43 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_table-row.scss +22 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_tabs.scss +4 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_transparency.scss +20 -0
- data/vendor/assets/stylesheets/ld/ld/mixins/_vendor-prefixes.scss +197 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_animate.scss +188 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_bootstrap-select.scss +308 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_bootstrap-table.scss +328 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_chartist.scss +247 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_datatables.net.scss +513 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_datetime-picker.scss +440 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_fullcalendar.scss +1114 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_jquery.jvectormap.scss +135 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_perfect-scrollbar.scss +111 -0
- data/vendor/assets/stylesheets/ld/ld/plugins/_sweetalert2.scss +531 -0
- data/vendor/assets/stylesheets/mk/mk.scss +50 -0
- data/vendor/assets/stylesheets/mk/mk/_alerts.scss +41 -0
- data/vendor/assets/stylesheets/mk/mk/_buttons.scss +283 -0
- data/vendor/assets/stylesheets/mk/mk/_cards.scss +576 -0
- data/vendor/assets/stylesheets/mk/mk/_carousel.scss +86 -0
- data/vendor/assets/stylesheets/mk/mk/_checkboxes.scss +195 -0
- data/vendor/assets/stylesheets/mk/mk/_colors.scss +326 -0
- data/vendor/assets/stylesheets/mk/mk/_dialogs.scss +99 -0
- data/vendor/assets/stylesheets/mk/mk/_dividers.scss +73 -0
- data/vendor/assets/stylesheets/mk/mk/_dropdown.scss +86 -0
- data/vendor/assets/stylesheets/mk/mk/_example-pages.scss +775 -0
- data/vendor/assets/stylesheets/mk/mk/_fileupload.scss +115 -0
- data/vendor/assets/stylesheets/mk/mk/_flexisel.scss +54 -0
- data/vendor/assets/stylesheets/mk/mk/_form.scss +58 -0
- data/vendor/assets/stylesheets/mk/mk/_images.scss +6 -0
- data/vendor/assets/stylesheets/mk/mk/_import-bs-less.scss +4 -0
- data/vendor/assets/stylesheets/mk/mk/_import-bs-sass.scss +2 -0
- data/vendor/assets/stylesheets/mk/mk/_info-areas.scss +57 -0
- data/vendor/assets/stylesheets/mk/mk/_inputs-size.scss +223 -0
- data/vendor/assets/stylesheets/mk/mk/_inputs.scss +394 -0
- data/vendor/assets/stylesheets/mk/mk/_labels.scss +10 -0
- data/vendor/assets/stylesheets/mk/mk/_lists.scss +104 -0
- data/vendor/assets/stylesheets/mk/mk/_media.scss +47 -0
- data/vendor/assets/stylesheets/mk/mk/_misc.scss +94 -0
- data/vendor/assets/stylesheets/mk/mk/_mixins.scss +413 -0
- data/vendor/assets/stylesheets/mk/mk/_navbar.scss +311 -0
- data/vendor/assets/stylesheets/mk/mk/_pagination.scss +91 -0
- data/vendor/assets/stylesheets/mk/mk/_panels.scss +47 -0
- data/vendor/assets/stylesheets/mk/mk/_pills.scss +128 -0
- data/vendor/assets/stylesheets/mk/mk/_popups.scss +77 -0
- data/vendor/assets/stylesheets/mk/mk/_progress.scss +33 -0
- data/vendor/assets/stylesheets/mk/mk/_radios.scss +114 -0
- data/vendor/assets/stylesheets/mk/mk/_responsive.scss +115 -0
- data/vendor/assets/stylesheets/mk/mk/_ripples.scss +40 -0
- data/vendor/assets/stylesheets/mk/mk/_sections.scss +131 -0
- data/vendor/assets/stylesheets/mk/mk/_select.scss +108 -0
- data/vendor/assets/stylesheets/mk/mk/_shadows.scss +138 -0
- data/vendor/assets/stylesheets/mk/mk/_tables.scss +104 -0
- data/vendor/assets/stylesheets/mk/mk/_tabs.scss +53 -0
- data/vendor/assets/stylesheets/mk/mk/_tags.scss +97 -0
- data/vendor/assets/stylesheets/mk/mk/_togglebutton.scss +87 -0
- data/vendor/assets/stylesheets/mk/mk/_typography.scss +75 -0
- data/vendor/assets/stylesheets/mk/mk/_variables.scss +224 -0
- data/vendor/assets/stylesheets/mk/mk/_variables_bootstrap.scss +883 -0
- data/vendor/assets/stylesheets/mk/mk/_welljumbo.scss +28 -0
- data/vendor/assets/stylesheets/mk/mk/plugins/_plugin-datepicker.scss +204 -0
- data/vendor/assets/stylesheets/mk/mk/plugins/_plugin-nouislider.scss +161 -0
- data/vendor/assets/stylesheets/mk/mk/plugins/_plugin-selectize.scss +93 -0
- data/vendor/assets/stylesheets/mk/mk/plugins/_plugin-snackbarjs.scss +34 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_blogs.scss +17 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_contactus.scss +51 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_features.scss +92 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_footers.scss +163 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_headers.scss +125 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_pricing.scss +40 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_projects.scss +75 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_social-subscribe-lines.scss +71 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_team.scss +53 -0
- data/vendor/assets/stylesheets/mk/mk/sections/_testimonials.scss +5 -0
- data/vendor/assets/stylesheets/pd/pd.scss +51 -0
- data/vendor/assets/stylesheets/pd/pd/_alerts.scss +60 -0
- data/vendor/assets/stylesheets/pd/pd/_animated-buttons.scss +61 -0
- data/vendor/assets/stylesheets/pd/pd/_buttons.scss +173 -0
- data/vendor/assets/stylesheets/pd/pd/_cards.scss +546 -0
- data/vendor/assets/stylesheets/pd/pd/_carousel.scss +15 -0
- data/vendor/assets/stylesheets/pd/pd/_chat-message.scss +206 -0
- data/vendor/assets/stylesheets/pd/pd/_checkbox-radio.scss +126 -0
- data/vendor/assets/stylesheets/pd/pd/_circlechart.scss +18 -0
- data/vendor/assets/stylesheets/pd/pd/_collapse.scss +40 -0
- data/vendor/assets/stylesheets/pd/pd/_dropdown.scss +413 -0
- data/vendor/assets/stylesheets/pd/pd/_footers.scss +87 -0
- data/vendor/assets/stylesheets/pd/pd/_forms.scss +43 -0
- data/vendor/assets/stylesheets/pd/pd/_inputs.scss +190 -0
- data/vendor/assets/stylesheets/pd/pd/_labels.scss +29 -0
- data/vendor/assets/stylesheets/pd/pd/_media.scss +80 -0
- data/vendor/assets/stylesheets/pd/pd/_misc.scss +104 -0
- data/vendor/assets/stylesheets/pd/pd/_mixins.scss +17 -0
- data/vendor/assets/stylesheets/pd/pd/_modal.scss +79 -0
- data/vendor/assets/stylesheets/pd/pd/_navbars.scss +289 -0
- data/vendor/assets/stylesheets/pd/pd/_pages.scss +196 -0
- data/vendor/assets/stylesheets/pd/pd/_progress-bars.scss +27 -0
- data/vendor/assets/stylesheets/pd/pd/_responsive.scss +666 -0
- data/vendor/assets/stylesheets/pd/pd/_sidebar-and-main-panel.scss +514 -0
- data/vendor/assets/stylesheets/pd/pd/_sliders.scss +222 -0
- data/vendor/assets/stylesheets/pd/pd/_social.scss +130 -0
- data/vendor/assets/stylesheets/pd/pd/_switch.scss +145 -0
- data/vendor/assets/stylesheets/pd/pd/_tables.scss +194 -0
- data/vendor/assets/stylesheets/pd/pd/_tabs-navs-pagination.scss +341 -0
- data/vendor/assets/stylesheets/pd/pd/_tags.scss +104 -0
- data/vendor/assets/stylesheets/pd/pd/_timeline.scss +178 -0
- data/vendor/assets/stylesheets/pd/pd/_tooltips-and-popovers.scss +156 -0
- data/vendor/assets/stylesheets/pd/pd/_typography.scss +117 -0
- data/vendor/assets/stylesheets/pd/pd/_variables.scss +367 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_alerts.scss +13 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_buttons.scss +89 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_cards.scss +7 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_chartist.scss +104 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_icons.scss +13 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_inputs.scss +17 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_labels.scss +10 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_navbars.scss +11 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_sidebar.scss +54 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_social.scss +68 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_table-row.scss +22 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_tabs.scss +4 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_transparency.scss +20 -0
- data/vendor/assets/stylesheets/pd/pd/mixins/_vendor-prefixes.scss +254 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_animate.scss +189 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_bootstrap-select.scss +313 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_bootstrap-table.scss +375 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_chartist.scss +246 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_datatables.net.scss +504 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_datetime-picker.scss +418 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_fullcalendar.scss +1124 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_jquery.jvectormap.scss +135 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_perfect-scrollbar.scss +112 -0
- data/vendor/assets/stylesheets/pd/pd/plugins/_sweetalert2.scss +531 -0
- data/vendor/assets/stylesheets/pk/ct-pk.scss +64 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_alerts.scss +69 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_animated-buttons.scss +63 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_bootstrap-select.scss +320 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_buttons.scss +161 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_cards.scss +570 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_carousel.scss +59 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_chartist.scss +354 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_checkbox-radio.scss +129 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_collapse.scss +40 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_datepicker.scss +198 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_dropdown.scss +291 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_fileupload.scss +112 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_footers.scss +193 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_headers.scss +85 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_images.scss +28 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_info-areas.scss +62 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_inputs.scss +171 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_labels.scss +29 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_media.scss +82 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_misc.scss +124 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_mixins.scss +16 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_modal.scss +91 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_navbars.scss +285 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_preloaders.scss +282 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_progress-bars.scss +27 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_responsive.scss +411 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_sections.scss +45 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_sidebar.scss +206 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_sliders.scss +222 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_social.scss +130 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_switch.scss +145 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_tables.scss +135 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_tabs-navs-pagination.scss +311 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_tags.scss +108 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_tooltips-and-popovers.scss +188 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_typography.scss +106 -0
- data/vendor/assets/stylesheets/pk/ct-pk/_variables.scss +301 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_alerts.scss +11 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_buttons.scss +104 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_inputs.scss +17 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_labels.scss +10 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_navbars.scss +11 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_popovers.scss +21 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_social.scss +68 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_tabs.scss +4 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_transparency.scss +17 -0
- data/vendor/assets/stylesheets/pk/ct-pk/mixins/_vendor-prefixes.scss +233 -0
- data/vendor/assets/stylesheets/pk/ct-pk/plugins/photo-swipe/_default-skin.scss +592 -0
- data/vendor/assets/stylesheets/pk/ct-pk/plugins/photo-swipe/_gallery.scss +27 -0
- data/vendor/assets/stylesheets/pk/ct-pk/plugins/photo-swipe/_main-settings.scss +11 -0
- data/vendor/assets/stylesheets/pk/ct-pk/plugins/photo-swipe/_main.scss +213 -0
- data/vendor/assets/stylesheets/pk/examples.scss +1083 -0
- data/vendor/assets/stylesheets/sd/examples.scss +403 -0
- data/vendor/assets/stylesheets/sd/sd.scss +41 -0
- data/vendor/assets/stylesheets/sd/sd/_alerts.scss +37 -0
- data/vendor/assets/stylesheets/sd/sd/_bootstrap-select.scss +307 -0
- data/vendor/assets/stylesheets/sd/sd/_buttons.scss +108 -0
- data/vendor/assets/stylesheets/sd/sd/_cards.scss +462 -0
- data/vendor/assets/stylesheets/sd/sd/_carousel.scss +15 -0
- data/vendor/assets/stylesheets/sd/sd/_chartist.scss +335 -0
- data/vendor/assets/stylesheets/sd/sd/_checkbox-radio-switch.scss +246 -0
- data/vendor/assets/stylesheets/sd/sd/_collapse.scss +33 -0
- data/vendor/assets/stylesheets/sd/sd/_datepicker.scss +199 -0
- data/vendor/assets/stylesheets/sd/sd/_dropdown.scss +98 -0
- data/vendor/assets/stylesheets/sd/sd/_flexisel.scss +53 -0
- data/vendor/assets/stylesheets/sd/sd/_footers.scss +216 -0
- data/vendor/assets/stylesheets/sd/sd/_icons.scss +127 -0
- data/vendor/assets/stylesheets/sd/sd/_inputs.scss +141 -0
- data/vendor/assets/stylesheets/sd/sd/_labels.scss +54 -0
- data/vendor/assets/stylesheets/sd/sd/_media.scss +80 -0
- data/vendor/assets/stylesheets/sd/sd/_misc.scss +115 -0
- data/vendor/assets/stylesheets/sd/sd/_mixins.scss +20 -0
- data/vendor/assets/stylesheets/sd/sd/_modal.scss +79 -0
- data/vendor/assets/stylesheets/sd/sd/_morphing-buttons.scss +161 -0
- data/vendor/assets/stylesheets/sd/sd/_navbars.scss +293 -0
- data/vendor/assets/stylesheets/sd/sd/_progress-bars.scss +9 -0
- data/vendor/assets/stylesheets/sd/sd/_responsive.scss +302 -0
- data/vendor/assets/stylesheets/sd/sd/_sections.scss +12 -0
- data/vendor/assets/stylesheets/sd/sd/_sidebar-menu.scss +232 -0
- data/vendor/assets/stylesheets/sd/sd/_sliders.scss +218 -0
- data/vendor/assets/stylesheets/sd/sd/_social-buttons.scss +76 -0
- data/vendor/assets/stylesheets/sd/sd/_tables.scss +110 -0
- data/vendor/assets/stylesheets/sd/sd/_tabs-navs-pagination.scss +217 -0
- data/vendor/assets/stylesheets/sd/sd/_tags.scss +220 -0
- data/vendor/assets/stylesheets/sd/sd/_tooltips-and-popovers.scss +156 -0
- data/vendor/assets/stylesheets/sd/sd/_typography.scss +73 -0
- data/vendor/assets/stylesheets/sd/sd/_variables.scss +249 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_buttons.scss +76 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_cards.scss +8 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_icons.scss +13 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_inputs.scss +17 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_labels.scss +21 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_morphing-buttons.scss +34 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_navbars.scss +11 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_social-buttons.scss +43 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_tabs.scss +4 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_transparency.scss +20 -0
- data/vendor/assets/stylesheets/sd/sd/mixins/_vendor-prefixes.scss +177 -0
- metadata +484 -0
@@ -0,0 +1,379 @@
|
|
1
|
+
(function (factory) {
|
2
|
+
if (typeof define === 'function' && define.amd) {
|
3
|
+
// AMD. Register as an anonymous module.
|
4
|
+
define(['jquery'], factory);
|
5
|
+
} else if (typeof exports === 'object') {
|
6
|
+
// Node/CommonJS
|
7
|
+
factory(require('jquery'));
|
8
|
+
} else {
|
9
|
+
// Browser globals
|
10
|
+
factory(jQuery);
|
11
|
+
}
|
12
|
+
}(function ($) {
|
13
|
+
// Create the defaults once
|
14
|
+
var defaults = {
|
15
|
+
element: 'body',
|
16
|
+
position: null,
|
17
|
+
type: "info",
|
18
|
+
allow_dismiss: true,
|
19
|
+
allow_duplicates: true,
|
20
|
+
newest_on_top: false,
|
21
|
+
showProgressbar: false,
|
22
|
+
placement: {
|
23
|
+
from: "top",
|
24
|
+
align: "right"
|
25
|
+
},
|
26
|
+
offset: 20,
|
27
|
+
spacing: 10,
|
28
|
+
z_index: 1031,
|
29
|
+
delay: 5000,
|
30
|
+
timer: 1000,
|
31
|
+
url_target: '_blank',
|
32
|
+
mouse_over: null,
|
33
|
+
animate: {
|
34
|
+
enter: 'animated fadeInDown',
|
35
|
+
exit: 'animated fadeOutUp'
|
36
|
+
},
|
37
|
+
onShow: null,
|
38
|
+
onShown: null,
|
39
|
+
onClose: null,
|
40
|
+
onClosed: null,
|
41
|
+
icon_type: 'class',
|
42
|
+
template: '<div data-notify="container" class="col-xs-11 col-sm-4 alert alert-{0}" role="alert"><button type="button" aria-hidden="true" class="close" data-notify="dismiss">×</button><span data-notify="icon"></span> <span data-notify="title">{1}</span> <span data-notify="message">{2}</span><div class="progress" data-notify="progressbar"><div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div></div><a href="{3}" target="{4}" data-notify="url"></a></div>'
|
43
|
+
};
|
44
|
+
|
45
|
+
String.format = function () {
|
46
|
+
var str = arguments[0];
|
47
|
+
for (var i = 1; i < arguments.length; i++) {
|
48
|
+
str = str.replace(RegExp("\\{" + (i - 1) + "\\}", "gm"), arguments[i]);
|
49
|
+
}
|
50
|
+
return str;
|
51
|
+
};
|
52
|
+
|
53
|
+
function isDuplicateNotification(notification) {
|
54
|
+
var isDupe = false;
|
55
|
+
|
56
|
+
$('[data-notify="container"]').each(function (i, el) {
|
57
|
+
var $el = $(el);
|
58
|
+
var title = $el.find('[data-notify="title"]').text().trim();
|
59
|
+
var message = $el.find('[data-notify="message"]').html().trim();
|
60
|
+
|
61
|
+
// The input string might be different than the actual parsed HTML string!
|
62
|
+
// (<br> vs <br /> for example)
|
63
|
+
// So we have to force-parse this as HTML here!
|
64
|
+
var isSameTitle = title === $("<div>" + notification.settings.content.title + "</div>").html().trim();
|
65
|
+
var isSameMsg = message === $("<div>" + notification.settings.content.message + "</div>").html().trim();
|
66
|
+
var isSameType = $el.hasClass('alert-' + notification.settings.type);
|
67
|
+
|
68
|
+
if (isSameTitle && isSameMsg && isSameType) {
|
69
|
+
//we found the dupe. Set the var and stop checking.
|
70
|
+
isDupe = true;
|
71
|
+
}
|
72
|
+
return !isDupe;
|
73
|
+
});
|
74
|
+
|
75
|
+
return isDupe;
|
76
|
+
}
|
77
|
+
|
78
|
+
function Notify(element, content, options) {
|
79
|
+
// Setup Content of Notify
|
80
|
+
var contentObj = {
|
81
|
+
content: {
|
82
|
+
message: typeof content === 'object' ? content.message : content,
|
83
|
+
title: content.title ? content.title : '',
|
84
|
+
icon: content.icon ? content.icon : '',
|
85
|
+
url: content.url ? content.url : '#',
|
86
|
+
target: content.target ? content.target : '-'
|
87
|
+
}
|
88
|
+
};
|
89
|
+
|
90
|
+
options = $.extend(true, {}, contentObj, options);
|
91
|
+
this.settings = $.extend(true, {}, defaults, options);
|
92
|
+
this._defaults = defaults;
|
93
|
+
if (this.settings.content.target === "-") {
|
94
|
+
this.settings.content.target = this.settings.url_target;
|
95
|
+
}
|
96
|
+
this.animations = {
|
97
|
+
start: 'webkitAnimationStart oanimationstart MSAnimationStart animationstart',
|
98
|
+
end: 'webkitAnimationEnd oanimationend MSAnimationEnd animationend'
|
99
|
+
};
|
100
|
+
|
101
|
+
if (typeof this.settings.offset === 'number') {
|
102
|
+
this.settings.offset = {
|
103
|
+
x: this.settings.offset,
|
104
|
+
y: this.settings.offset
|
105
|
+
};
|
106
|
+
}
|
107
|
+
|
108
|
+
//if duplicate messages are not allowed, then only continue if this new message is not a duplicate of one that it already showing
|
109
|
+
if (this.settings.allow_duplicates || (!this.settings.allow_duplicates && !isDuplicateNotification(this))) {
|
110
|
+
this.init();
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
$.extend(Notify.prototype, {
|
115
|
+
init: function () {
|
116
|
+
var self = this;
|
117
|
+
|
118
|
+
this.buildNotify();
|
119
|
+
if (this.settings.content.icon) {
|
120
|
+
this.setIcon();
|
121
|
+
}
|
122
|
+
if (this.settings.content.url != "#") {
|
123
|
+
this.styleURL();
|
124
|
+
}
|
125
|
+
this.styleDismiss();
|
126
|
+
this.placement();
|
127
|
+
this.bind();
|
128
|
+
|
129
|
+
this.notify = {
|
130
|
+
$ele: this.$ele,
|
131
|
+
update: function (command, update) {
|
132
|
+
var commands = {};
|
133
|
+
if (typeof command === "string") {
|
134
|
+
commands[command] = update;
|
135
|
+
} else {
|
136
|
+
commands = command;
|
137
|
+
}
|
138
|
+
for (var cmd in commands) {
|
139
|
+
switch (cmd) {
|
140
|
+
case "type":
|
141
|
+
this.$ele.removeClass('alert-' + self.settings.type);
|
142
|
+
this.$ele.find('[data-notify="progressbar"] > .progress-bar').removeClass('progress-bar-' + self.settings.type);
|
143
|
+
self.settings.type = commands[cmd];
|
144
|
+
this.$ele.addClass('alert-' + commands[cmd]).find('[data-notify="progressbar"] > .progress-bar').addClass('progress-bar-' + commands[cmd]);
|
145
|
+
break;
|
146
|
+
case "icon":
|
147
|
+
var $icon = this.$ele.find('[data-notify="icon"]');
|
148
|
+
if (self.settings.icon_type.toLowerCase() === 'class') {
|
149
|
+
$icon.removeClass(self.settings.content.icon).addClass(commands[cmd]);
|
150
|
+
} else {
|
151
|
+
if (!$icon.is('img')) {
|
152
|
+
$icon.find('img');
|
153
|
+
}
|
154
|
+
$icon.attr('src', commands[cmd]);
|
155
|
+
}
|
156
|
+
break;
|
157
|
+
case "progress":
|
158
|
+
var newDelay = self.settings.delay - (self.settings.delay * (commands[cmd] / 100));
|
159
|
+
this.$ele.data('notify-delay', newDelay);
|
160
|
+
this.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', commands[cmd]).css('width', commands[cmd] + '%');
|
161
|
+
break;
|
162
|
+
case "url":
|
163
|
+
this.$ele.find('[data-notify="url"]').attr('href', commands[cmd]);
|
164
|
+
break;
|
165
|
+
case "target":
|
166
|
+
this.$ele.find('[data-notify="url"]').attr('target', commands[cmd]);
|
167
|
+
break;
|
168
|
+
default:
|
169
|
+
this.$ele.find('[data-notify="' + cmd + '"]').html(commands[cmd]);
|
170
|
+
}
|
171
|
+
}
|
172
|
+
var posX = this.$ele.outerHeight() + parseInt(self.settings.spacing) + parseInt(self.settings.offset.y);
|
173
|
+
self.reposition(posX);
|
174
|
+
},
|
175
|
+
close: function () {
|
176
|
+
self.close();
|
177
|
+
}
|
178
|
+
};
|
179
|
+
|
180
|
+
},
|
181
|
+
buildNotify: function () {
|
182
|
+
var content = this.settings.content;
|
183
|
+
this.$ele = $(String.format(this.settings.template, this.settings.type, content.title, content.message, content.url, content.target));
|
184
|
+
this.$ele.attr('data-notify-position', this.settings.placement.from + '-' + this.settings.placement.align);
|
185
|
+
if (!this.settings.allow_dismiss) {
|
186
|
+
this.$ele.find('[data-notify="dismiss"]').css('display', 'none');
|
187
|
+
}
|
188
|
+
if ((this.settings.delay <= 0 && !this.settings.showProgressbar) || !this.settings.showProgressbar) {
|
189
|
+
this.$ele.find('[data-notify="progressbar"]').remove();
|
190
|
+
}
|
191
|
+
},
|
192
|
+
setIcon: function () {
|
193
|
+
|
194
|
+
this.$ele.addClass('alert-with-icon');
|
195
|
+
|
196
|
+
if (this.settings.icon_type.toLowerCase() === 'class') {
|
197
|
+
this.$ele.find('[data-notify="icon"]').addClass(this.settings.content.icon);
|
198
|
+
} else {
|
199
|
+
if (this.$ele.find('[data-notify="icon"]').is('img')) {
|
200
|
+
this.$ele.find('[data-notify="icon"]').attr('src', this.settings.content.icon);
|
201
|
+
} else {
|
202
|
+
this.$ele.find('[data-notify="icon"]').append('<img src="' + this.settings.content.icon + '" alt="Notify Icon" />');
|
203
|
+
}
|
204
|
+
}
|
205
|
+
},
|
206
|
+
styleDismiss: function () {
|
207
|
+
this.$ele.find('[data-notify="dismiss"]').css({
|
208
|
+
position: 'absolute',
|
209
|
+
right: '10px',
|
210
|
+
top: '50%',
|
211
|
+
marginTop: '-13px',
|
212
|
+
zIndex: this.settings.z_index + 2
|
213
|
+
});
|
214
|
+
},
|
215
|
+
styleURL: function () {
|
216
|
+
this.$ele.find('[data-notify="url"]').css({
|
217
|
+
backgroundImage: 'url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)',
|
218
|
+
height: '100%',
|
219
|
+
left: 0,
|
220
|
+
position: 'absolute',
|
221
|
+
top: 0,
|
222
|
+
width: '100%',
|
223
|
+
zIndex: this.settings.z_index + 1
|
224
|
+
});
|
225
|
+
},
|
226
|
+
placement: function () {
|
227
|
+
var self = this,
|
228
|
+
offsetAmt = this.settings.offset.y,
|
229
|
+
css = {
|
230
|
+
display: 'inline-block',
|
231
|
+
margin: '0px auto',
|
232
|
+
position: this.settings.position ? this.settings.position : (this.settings.element === 'body' ? 'fixed' : 'absolute'),
|
233
|
+
transition: 'all .5s ease-in-out',
|
234
|
+
zIndex: this.settings.z_index
|
235
|
+
},
|
236
|
+
hasAnimation = false,
|
237
|
+
settings = this.settings;
|
238
|
+
|
239
|
+
$('[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])').each(function () {
|
240
|
+
offsetAmt = Math.max(offsetAmt, parseInt($(this).css(settings.placement.from)) + parseInt($(this).outerHeight()) + parseInt(settings.spacing));
|
241
|
+
});
|
242
|
+
if (this.settings.newest_on_top === true) {
|
243
|
+
offsetAmt = this.settings.offset.y;
|
244
|
+
}
|
245
|
+
css[this.settings.placement.from] = offsetAmt + 'px';
|
246
|
+
|
247
|
+
switch (this.settings.placement.align) {
|
248
|
+
case "left":
|
249
|
+
case "right":
|
250
|
+
css[this.settings.placement.align] = this.settings.offset.x + 'px';
|
251
|
+
break;
|
252
|
+
case "center":
|
253
|
+
css.left = 0;
|
254
|
+
css.right = 0;
|
255
|
+
break;
|
256
|
+
}
|
257
|
+
this.$ele.css(css).addClass(this.settings.animate.enter);
|
258
|
+
$.each(Array('webkit-', 'moz-', 'o-', 'ms-', ''), function (index, prefix) {
|
259
|
+
self.$ele[0].style[prefix + 'AnimationIterationCount'] = 1;
|
260
|
+
});
|
261
|
+
|
262
|
+
$(this.settings.element).append(this.$ele);
|
263
|
+
|
264
|
+
if (this.settings.newest_on_top === true) {
|
265
|
+
offsetAmt = (parseInt(offsetAmt) + parseInt(this.settings.spacing)) + this.$ele.outerHeight();
|
266
|
+
this.reposition(offsetAmt);
|
267
|
+
}
|
268
|
+
|
269
|
+
if ($.isFunction(self.settings.onShow)) {
|
270
|
+
self.settings.onShow.call(this.$ele);
|
271
|
+
}
|
272
|
+
|
273
|
+
this.$ele.one(this.animations.start, function () {
|
274
|
+
hasAnimation = true;
|
275
|
+
}).one(this.animations.end, function () {
|
276
|
+
if ($.isFunction(self.settings.onShown)) {
|
277
|
+
self.settings.onShown.call(this);
|
278
|
+
}
|
279
|
+
});
|
280
|
+
|
281
|
+
setTimeout(function () {
|
282
|
+
if (!hasAnimation) {
|
283
|
+
if ($.isFunction(self.settings.onShown)) {
|
284
|
+
self.settings.onShown.call(this);
|
285
|
+
}
|
286
|
+
}
|
287
|
+
}, 600);
|
288
|
+
},
|
289
|
+
bind: function () {
|
290
|
+
var self = this;
|
291
|
+
|
292
|
+
this.$ele.find('[data-notify="dismiss"]').on('click', function () {
|
293
|
+
self.close();
|
294
|
+
});
|
295
|
+
|
296
|
+
this.$ele.mouseover(function () {
|
297
|
+
$(this).data('data-hover', "true");
|
298
|
+
}).mouseout(function () {
|
299
|
+
$(this).data('data-hover', "false");
|
300
|
+
});
|
301
|
+
this.$ele.data('data-hover', "false");
|
302
|
+
|
303
|
+
if (this.settings.delay > 0) {
|
304
|
+
self.$ele.data('notify-delay', self.settings.delay);
|
305
|
+
var timer = setInterval(function () {
|
306
|
+
var delay = parseInt(self.$ele.data('notify-delay')) - self.settings.timer;
|
307
|
+
if ((self.$ele.data('data-hover') === 'false' && self.settings.mouse_over === "pause") || self.settings.mouse_over != "pause") {
|
308
|
+
var percent = ((self.settings.delay - delay) / self.settings.delay) * 100;
|
309
|
+
self.$ele.data('notify-delay', delay);
|
310
|
+
self.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', percent).css('width', percent + '%');
|
311
|
+
}
|
312
|
+
if (delay <= -(self.settings.timer)) {
|
313
|
+
clearInterval(timer);
|
314
|
+
self.close();
|
315
|
+
}
|
316
|
+
}, self.settings.timer);
|
317
|
+
}
|
318
|
+
},
|
319
|
+
close: function () {
|
320
|
+
var self = this,
|
321
|
+
posX = parseInt(this.$ele.css(this.settings.placement.from)),
|
322
|
+
hasAnimation = false;
|
323
|
+
|
324
|
+
this.$ele.data('closing', 'true').addClass(this.settings.animate.exit);
|
325
|
+
self.reposition(posX);
|
326
|
+
|
327
|
+
if ($.isFunction(self.settings.onClose)) {
|
328
|
+
self.settings.onClose.call(this.$ele);
|
329
|
+
}
|
330
|
+
|
331
|
+
this.$ele.one(this.animations.start, function () {
|
332
|
+
hasAnimation = true;
|
333
|
+
}).one(this.animations.end, function () {
|
334
|
+
$(this).remove();
|
335
|
+
if ($.isFunction(self.settings.onClosed)) {
|
336
|
+
self.settings.onClosed.call(this);
|
337
|
+
}
|
338
|
+
});
|
339
|
+
|
340
|
+
setTimeout(function () {
|
341
|
+
if (!hasAnimation) {
|
342
|
+
self.$ele.remove();
|
343
|
+
if (self.settings.onClosed) {
|
344
|
+
self.settings.onClosed(self.$ele);
|
345
|
+
}
|
346
|
+
}
|
347
|
+
}, 600);
|
348
|
+
},
|
349
|
+
reposition: function (posX) {
|
350
|
+
var self = this,
|
351
|
+
notifies = '[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])',
|
352
|
+
$elements = this.$ele.nextAll(notifies);
|
353
|
+
if (this.settings.newest_on_top === true) {
|
354
|
+
$elements = this.$ele.prevAll(notifies);
|
355
|
+
}
|
356
|
+
$elements.each(function () {
|
357
|
+
$(this).css(self.settings.placement.from, posX);
|
358
|
+
posX = (parseInt(posX) + parseInt(self.settings.spacing)) + $(this).outerHeight();
|
359
|
+
});
|
360
|
+
}
|
361
|
+
});
|
362
|
+
|
363
|
+
$.notify = function (content, options) {
|
364
|
+
var plugin = new Notify(this, content, options);
|
365
|
+
return plugin.notify;
|
366
|
+
};
|
367
|
+
$.notifyDefaults = function (options) {
|
368
|
+
defaults = $.extend(true, {}, defaults, options);
|
369
|
+
return defaults;
|
370
|
+
};
|
371
|
+
$.notifyClose = function (command) {
|
372
|
+
if (typeof command === "undefined" || command === "all") {
|
373
|
+
$('[data-notify]').find('[data-notify="dismiss"]').trigger('click');
|
374
|
+
} else {
|
375
|
+
$('[data-notify-position="' + command + '"]').find('[data-notify="dismiss"]').trigger('click');
|
376
|
+
}
|
377
|
+
};
|
378
|
+
|
379
|
+
}));
|
@@ -0,0 +1,1711 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap-select v1.8.1 (http://silviomoreto.github.io/bootstrap-select)
|
3
|
+
*
|
4
|
+
* Copyright 2013-2015 bootstrap-select
|
5
|
+
* Licensed under MIT (https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE)
|
6
|
+
*/
|
7
|
+
|
8
|
+
(function (root, factory) {
|
9
|
+
if (typeof define === 'function' && define.amd) {
|
10
|
+
// AMD. Register as an anonymous module unless amdModuleId is set
|
11
|
+
define(["jquery"], function (a0) {
|
12
|
+
return (factory(a0));
|
13
|
+
});
|
14
|
+
} else if (typeof exports === 'object') {
|
15
|
+
// Node. Does not work with strict CommonJS, but
|
16
|
+
// only CommonJS-like environments that support module.exports,
|
17
|
+
// like Node.
|
18
|
+
module.exports = factory(require("jquery"));
|
19
|
+
} else {
|
20
|
+
factory(jQuery);
|
21
|
+
}
|
22
|
+
}(this, function (jQuery) {
|
23
|
+
|
24
|
+
(function ($) {
|
25
|
+
'use strict';
|
26
|
+
|
27
|
+
//<editor-fold desc="Shims">
|
28
|
+
if (!String.prototype.includes) {
|
29
|
+
(function () {
|
30
|
+
'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
|
31
|
+
var toString = {}.toString;
|
32
|
+
var defineProperty = (function () {
|
33
|
+
// IE 8 only supports `Object.defineProperty` on DOM elements
|
34
|
+
try {
|
35
|
+
var object = {};
|
36
|
+
var $defineProperty = Object.defineProperty;
|
37
|
+
var result = $defineProperty(object, object, object) && $defineProperty;
|
38
|
+
} catch (error) {
|
39
|
+
}
|
40
|
+
return result;
|
41
|
+
}());
|
42
|
+
var indexOf = ''.indexOf;
|
43
|
+
var includes = function (search) {
|
44
|
+
if (this == null) {
|
45
|
+
throw new TypeError();
|
46
|
+
}
|
47
|
+
var string = String(this);
|
48
|
+
if (search && toString.call(search) == '[object RegExp]') {
|
49
|
+
throw new TypeError();
|
50
|
+
}
|
51
|
+
var stringLength = string.length;
|
52
|
+
var searchString = String(search);
|
53
|
+
var searchLength = searchString.length;
|
54
|
+
var position = arguments.length > 1 ? arguments[1] : undefined;
|
55
|
+
// `ToInteger`
|
56
|
+
var pos = position ? Number(position) : 0;
|
57
|
+
if (pos != pos) { // better `isNaN`
|
58
|
+
pos = 0;
|
59
|
+
}
|
60
|
+
var start = Math.min(Math.max(pos, 0), stringLength);
|
61
|
+
// Avoid the `indexOf` call if no match is possible
|
62
|
+
if (searchLength + start > stringLength) {
|
63
|
+
return false;
|
64
|
+
}
|
65
|
+
return indexOf.call(string, searchString, pos) != -1;
|
66
|
+
};
|
67
|
+
if (defineProperty) {
|
68
|
+
defineProperty(String.prototype, 'includes', {
|
69
|
+
'value': includes,
|
70
|
+
'configurable': true,
|
71
|
+
'writable': true
|
72
|
+
});
|
73
|
+
} else {
|
74
|
+
String.prototype.includes = includes;
|
75
|
+
}
|
76
|
+
}());
|
77
|
+
}
|
78
|
+
|
79
|
+
if (!String.prototype.startsWith) {
|
80
|
+
(function () {
|
81
|
+
'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
|
82
|
+
var defineProperty = (function () {
|
83
|
+
// IE 8 only supports `Object.defineProperty` on DOM elements
|
84
|
+
try {
|
85
|
+
var object = {};
|
86
|
+
var $defineProperty = Object.defineProperty;
|
87
|
+
var result = $defineProperty(object, object, object) && $defineProperty;
|
88
|
+
} catch (error) {
|
89
|
+
}
|
90
|
+
return result;
|
91
|
+
}());
|
92
|
+
var toString = {}.toString;
|
93
|
+
var startsWith = function (search) {
|
94
|
+
if (this == null) {
|
95
|
+
throw new TypeError();
|
96
|
+
}
|
97
|
+
var string = String(this);
|
98
|
+
if (search && toString.call(search) == '[object RegExp]') {
|
99
|
+
throw new TypeError();
|
100
|
+
}
|
101
|
+
var stringLength = string.length;
|
102
|
+
var searchString = String(search);
|
103
|
+
var searchLength = searchString.length;
|
104
|
+
var position = arguments.length > 1 ? arguments[1] : undefined;
|
105
|
+
// `ToInteger`
|
106
|
+
var pos = position ? Number(position) : 0;
|
107
|
+
if (pos != pos) { // better `isNaN`
|
108
|
+
pos = 0;
|
109
|
+
}
|
110
|
+
var start = Math.min(Math.max(pos, 0), stringLength);
|
111
|
+
// Avoid the `indexOf` call if no match is possible
|
112
|
+
if (searchLength + start > stringLength) {
|
113
|
+
return false;
|
114
|
+
}
|
115
|
+
var index = -1;
|
116
|
+
while (++index < searchLength) {
|
117
|
+
if (string.charCodeAt(start + index) != searchString.charCodeAt(index)) {
|
118
|
+
return false;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
return true;
|
122
|
+
};
|
123
|
+
if (defineProperty) {
|
124
|
+
defineProperty(String.prototype, 'startsWith', {
|
125
|
+
'value': startsWith,
|
126
|
+
'configurable': true,
|
127
|
+
'writable': true
|
128
|
+
});
|
129
|
+
} else {
|
130
|
+
String.prototype.startsWith = startsWith;
|
131
|
+
}
|
132
|
+
}());
|
133
|
+
}
|
134
|
+
|
135
|
+
if (!Object.keys) {
|
136
|
+
Object.keys = function (
|
137
|
+
o, // object
|
138
|
+
k, // key
|
139
|
+
r // result array
|
140
|
+
){
|
141
|
+
// initialize object and result
|
142
|
+
r=[];
|
143
|
+
// iterate over object keys
|
144
|
+
for (k in o)
|
145
|
+
// fill result array with non-prototypical keys
|
146
|
+
r.hasOwnProperty.call(o, k) && r.push(k);
|
147
|
+
// return result
|
148
|
+
return r;
|
149
|
+
};
|
150
|
+
}
|
151
|
+
|
152
|
+
$.fn.triggerNative = function (eventName) {
|
153
|
+
var el = this[0],
|
154
|
+
event;
|
155
|
+
|
156
|
+
if (el.dispatchEvent) {
|
157
|
+
if (typeof Event === 'function') {
|
158
|
+
// For modern browsers
|
159
|
+
event = new Event(eventName, {
|
160
|
+
bubbles: true
|
161
|
+
});
|
162
|
+
} else {
|
163
|
+
// For IE since it doesn't support Event constructor
|
164
|
+
event = document.createEvent('Event');
|
165
|
+
event.initEvent(eventName, true, false);
|
166
|
+
}
|
167
|
+
|
168
|
+
el.dispatchEvent(event);
|
169
|
+
} else {
|
170
|
+
if (el.fireEvent) {
|
171
|
+
event = document.createEventObject();
|
172
|
+
event.eventType = eventName;
|
173
|
+
el.fireEvent('on' + eventName, event);
|
174
|
+
}
|
175
|
+
|
176
|
+
this.trigger(eventName);
|
177
|
+
}
|
178
|
+
};
|
179
|
+
//</editor-fold>
|
180
|
+
|
181
|
+
// Case insensitive contains search
|
182
|
+
$.expr[':'].icontains = function (obj, index, meta) {
|
183
|
+
var $obj = $(obj);
|
184
|
+
var haystack = ($obj.data('tokens') || $obj.text()).toUpperCase();
|
185
|
+
return haystack.includes(meta[3].toUpperCase());
|
186
|
+
};
|
187
|
+
|
188
|
+
// Case insensitive begins search
|
189
|
+
$.expr[':'].ibegins = function (obj, index, meta) {
|
190
|
+
var $obj = $(obj);
|
191
|
+
var haystack = ($obj.data('tokens') || $obj.text()).toUpperCase();
|
192
|
+
return haystack.startsWith(meta[3].toUpperCase());
|
193
|
+
};
|
194
|
+
|
195
|
+
// Case and accent insensitive contains search
|
196
|
+
$.expr[':'].aicontains = function (obj, index, meta) {
|
197
|
+
var $obj = $(obj);
|
198
|
+
var haystack = ($obj.data('tokens') || $obj.data('normalizedText') || $obj.text()).toUpperCase();
|
199
|
+
return haystack.includes(meta[3].toUpperCase());
|
200
|
+
};
|
201
|
+
|
202
|
+
// Case and accent insensitive begins search
|
203
|
+
$.expr[':'].aibegins = function (obj, index, meta) {
|
204
|
+
var $obj = $(obj);
|
205
|
+
var haystack = ($obj.data('tokens') || $obj.data('normalizedText') || $obj.text()).toUpperCase();
|
206
|
+
return haystack.startsWith(meta[3].toUpperCase());
|
207
|
+
};
|
208
|
+
|
209
|
+
/**
|
210
|
+
* Remove all diatrics from the given text.
|
211
|
+
* @access private
|
212
|
+
* @param {String} text
|
213
|
+
* @returns {String}
|
214
|
+
*/
|
215
|
+
function normalizeToBase(text) {
|
216
|
+
var rExps = [
|
217
|
+
{re: /[\xC0-\xC6]/g, ch: "A"},
|
218
|
+
{re: /[\xE0-\xE6]/g, ch: "a"},
|
219
|
+
{re: /[\xC8-\xCB]/g, ch: "E"},
|
220
|
+
{re: /[\xE8-\xEB]/g, ch: "e"},
|
221
|
+
{re: /[\xCC-\xCF]/g, ch: "I"},
|
222
|
+
{re: /[\xEC-\xEF]/g, ch: "i"},
|
223
|
+
{re: /[\xD2-\xD6]/g, ch: "O"},
|
224
|
+
{re: /[\xF2-\xF6]/g, ch: "o"},
|
225
|
+
{re: /[\xD9-\xDC]/g, ch: "U"},
|
226
|
+
{re: /[\xF9-\xFC]/g, ch: "u"},
|
227
|
+
{re: /[\xC7-\xE7]/g, ch: "c"},
|
228
|
+
{re: /[\xD1]/g, ch: "N"},
|
229
|
+
{re: /[\xF1]/g, ch: "n"}
|
230
|
+
];
|
231
|
+
$.each(rExps, function () {
|
232
|
+
text = text.replace(this.re, this.ch);
|
233
|
+
});
|
234
|
+
return text;
|
235
|
+
}
|
236
|
+
|
237
|
+
|
238
|
+
function htmlEscape(html) {
|
239
|
+
var escapeMap = {
|
240
|
+
'&': '&',
|
241
|
+
'<': '<',
|
242
|
+
'>': '>',
|
243
|
+
'"': '"',
|
244
|
+
"'": ''',
|
245
|
+
'`': '`'
|
246
|
+
};
|
247
|
+
var source = '(?:' + Object.keys(escapeMap).join('|') + ')',
|
248
|
+
testRegexp = new RegExp(source),
|
249
|
+
replaceRegexp = new RegExp(source, 'g'),
|
250
|
+
string = html == null ? '' : '' + html;
|
251
|
+
return testRegexp.test(string) ? string.replace(replaceRegexp, function (match) {
|
252
|
+
return escapeMap[match];
|
253
|
+
}) : string;
|
254
|
+
}
|
255
|
+
|
256
|
+
var Selectpicker = function (element, options, e) {
|
257
|
+
if (e) {
|
258
|
+
e.stopPropagation();
|
259
|
+
e.preventDefault();
|
260
|
+
}
|
261
|
+
|
262
|
+
this.$element = $(element);
|
263
|
+
this.$newElement = null;
|
264
|
+
this.$button = null;
|
265
|
+
this.$menu = null;
|
266
|
+
this.$lis = null;
|
267
|
+
this.options = options;
|
268
|
+
|
269
|
+
// If we have no title yet, try to pull it from the html title attribute (jQuery doesnt' pick it up as it's not a
|
270
|
+
// data-attribute)
|
271
|
+
if (this.options.title === null) {
|
272
|
+
this.options.title = this.$element.attr('title');
|
273
|
+
}
|
274
|
+
|
275
|
+
//Expose public methods
|
276
|
+
this.val = Selectpicker.prototype.val;
|
277
|
+
this.render = Selectpicker.prototype.render;
|
278
|
+
this.refresh = Selectpicker.prototype.refresh;
|
279
|
+
this.setStyle = Selectpicker.prototype.setStyle;
|
280
|
+
this.selectAll = Selectpicker.prototype.selectAll;
|
281
|
+
this.deselectAll = Selectpicker.prototype.deselectAll;
|
282
|
+
this.destroy = Selectpicker.prototype.destroy;
|
283
|
+
this.remove = Selectpicker.prototype.remove;
|
284
|
+
this.show = Selectpicker.prototype.show;
|
285
|
+
this.hide = Selectpicker.prototype.hide;
|
286
|
+
|
287
|
+
this.init();
|
288
|
+
};
|
289
|
+
|
290
|
+
Selectpicker.VERSION = '1.8.1';
|
291
|
+
|
292
|
+
// part of this is duplicated in i18n/defaults-en_US.js. Make sure to update both.
|
293
|
+
Selectpicker.DEFAULTS = {
|
294
|
+
noneSelectedText: 'Nothing selected',
|
295
|
+
noneResultsText: 'No results matched {0}',
|
296
|
+
countSelectedText: function (numSelected, numTotal) {
|
297
|
+
return (numSelected == 1) ? "{0} item selected" : "{0} items selected";
|
298
|
+
},
|
299
|
+
maxOptionsText: function (numAll, numGroup) {
|
300
|
+
return [
|
301
|
+
(numAll == 1) ? 'Limit reached ({n} item max)' : 'Limit reached ({n} items max)',
|
302
|
+
(numGroup == 1) ? 'Group limit reached ({n} item max)' : 'Group limit reached ({n} items max)'
|
303
|
+
];
|
304
|
+
},
|
305
|
+
selectAllText: 'Select All',
|
306
|
+
deselectAllText: 'Deselect All',
|
307
|
+
doneButton: false,
|
308
|
+
doneButtonText: 'Close',
|
309
|
+
multipleSeparator: ', ',
|
310
|
+
styleBase: 'btn',
|
311
|
+
style: 'btn-default',
|
312
|
+
size: 'auto',
|
313
|
+
title: null,
|
314
|
+
selectedTextFormat: 'values',
|
315
|
+
width: false,
|
316
|
+
container: false,
|
317
|
+
hideDisabled: false,
|
318
|
+
showSubtext: false,
|
319
|
+
showIcon: true,
|
320
|
+
showContent: true,
|
321
|
+
dropupAuto: true,
|
322
|
+
header: false,
|
323
|
+
liveSearch: false,
|
324
|
+
liveSearchPlaceholder: null,
|
325
|
+
liveSearchNormalize: false,
|
326
|
+
liveSearchStyle: 'contains',
|
327
|
+
actionsBox: false,
|
328
|
+
|
329
|
+
iconBase: 'fa',
|
330
|
+
tickIcon: 'fa-check',
|
331
|
+
template: {
|
332
|
+
caret: '<span class="caret"></span>'
|
333
|
+
},
|
334
|
+
maxOptions: false,
|
335
|
+
mobile: false,
|
336
|
+
selectOnTab: false,
|
337
|
+
dropdownAlignRight: false
|
338
|
+
};
|
339
|
+
|
340
|
+
Selectpicker.prototype = {
|
341
|
+
|
342
|
+
constructor: Selectpicker,
|
343
|
+
|
344
|
+
init: function () {
|
345
|
+
var that = this,
|
346
|
+
id = this.$element.attr('id');
|
347
|
+
|
348
|
+
// store originalIndex (key) and newIndex (value) in this.liObj for fast accessibility
|
349
|
+
// allows us to do this.$lis.eq(that.liObj[index]) instead of this.$lis.filter('[data-original-index="' + index + '"]')
|
350
|
+
this.liObj = {};
|
351
|
+
this.multiple = this.$element.prop('multiple');
|
352
|
+
this.autofocus = this.$element.prop('autofocus');
|
353
|
+
this.$newElement = this.createView();
|
354
|
+
this.$element
|
355
|
+
.after(this.$newElement)
|
356
|
+
.appendTo(this.$newElement);
|
357
|
+
this.$button = this.$newElement.children('button');
|
358
|
+
this.$menu = this.$newElement.children('.dropdown-menu');
|
359
|
+
this.$menuInner = this.$menu.children('.inner');
|
360
|
+
this.$searchbox = this.$menu.find('input');
|
361
|
+
|
362
|
+
if (this.options.dropdownAlignRight)
|
363
|
+
this.$menu.addClass('dropdown-menu-right');
|
364
|
+
|
365
|
+
if (typeof id !== 'undefined') {
|
366
|
+
this.$button.attr('data-id', id);
|
367
|
+
$('label[for="' + id + '"]').click(function (e) {
|
368
|
+
e.preventDefault();
|
369
|
+
that.$button.focus();
|
370
|
+
});
|
371
|
+
}
|
372
|
+
|
373
|
+
this.checkDisabled();
|
374
|
+
this.clickListener();
|
375
|
+
if (this.options.liveSearch) this.liveSearchListener();
|
376
|
+
this.render();
|
377
|
+
this.setStyle();
|
378
|
+
this.setWidth();
|
379
|
+
if (this.options.container) this.selectPosition();
|
380
|
+
this.$menu.data('this', this);
|
381
|
+
this.$newElement.data('this', this);
|
382
|
+
if (this.options.mobile) this.mobile();
|
383
|
+
|
384
|
+
this.$newElement.on({
|
385
|
+
'hide.bs.dropdown': function (e) {
|
386
|
+
that.$element.trigger('hide.bs.select', e);
|
387
|
+
},
|
388
|
+
'hidden.bs.dropdown': function (e) {
|
389
|
+
that.$element.trigger('hidden.bs.select', e);
|
390
|
+
},
|
391
|
+
'show.bs.dropdown': function (e) {
|
392
|
+
that.$element.trigger('show.bs.select', e);
|
393
|
+
},
|
394
|
+
'shown.bs.dropdown': function (e) {
|
395
|
+
that.$element.trigger('shown.bs.select', e);
|
396
|
+
}
|
397
|
+
});
|
398
|
+
|
399
|
+
if (that.$element[0].hasAttribute('required')) {
|
400
|
+
this.$element.on('invalid', function () {
|
401
|
+
that.$button
|
402
|
+
.addClass('bs-invalid')
|
403
|
+
.focus();
|
404
|
+
|
405
|
+
that.$element.on({
|
406
|
+
'focus.bs.select': function () {
|
407
|
+
that.$button.focus();
|
408
|
+
that.$element.off('focus.bs.select');
|
409
|
+
},
|
410
|
+
'shown.bs.select': function () {
|
411
|
+
that.$element
|
412
|
+
.val(that.$element.val()) // set the value to hide the validation message in Chrome when menu is opened
|
413
|
+
.off('shown.bs.select');
|
414
|
+
},
|
415
|
+
'rendered.bs.select': function () {
|
416
|
+
// if select is no longer invalid, remove the bs-invalid class
|
417
|
+
if (this.validity.valid) that.$button.removeClass('bs-invalid');
|
418
|
+
that.$element.off('rendered.bs.select');
|
419
|
+
}
|
420
|
+
});
|
421
|
+
|
422
|
+
});
|
423
|
+
}
|
424
|
+
|
425
|
+
setTimeout(function () {
|
426
|
+
that.$element.trigger('loaded.bs.select');
|
427
|
+
});
|
428
|
+
},
|
429
|
+
|
430
|
+
createDropdown: function () {
|
431
|
+
// Options
|
432
|
+
// If we are multiple, then add the show-tick class by default
|
433
|
+
var multiple = this.multiple ? ' show-tick' : '',
|
434
|
+
inputGroup = this.$element.parent().hasClass('input-group') ? ' input-group-btn' : '',
|
435
|
+
autofocus = this.autofocus ? ' autofocus' : '';
|
436
|
+
// Elements
|
437
|
+
var header = this.options.header ? '<div class="popover-title"><button type="button" class="close" aria-hidden="true">×</button>' + this.options.header + '</div>' : '';
|
438
|
+
var searchbox = this.options.liveSearch ?
|
439
|
+
'<div class="bs-searchbox">' +
|
440
|
+
'<input type="text" class="form-control" autocomplete="off"' +
|
441
|
+
(null === this.options.liveSearchPlaceholder ? '' : ' placeholder="' + htmlEscape(this.options.liveSearchPlaceholder) + '"') + '>' +
|
442
|
+
'</div>'
|
443
|
+
: '';
|
444
|
+
var actionsbox = this.multiple && this.options.actionsBox ?
|
445
|
+
'<div class="bs-actionsbox">' +
|
446
|
+
'<div class="btn-group btn-group-sm btn-block">' +
|
447
|
+
'<button type="button" class="actions-btn bs-select-all btn btn-default">' +
|
448
|
+
this.options.selectAllText +
|
449
|
+
'</button>' +
|
450
|
+
'<button type="button" class="actions-btn bs-deselect-all btn btn-default">' +
|
451
|
+
this.options.deselectAllText +
|
452
|
+
'</button>' +
|
453
|
+
'</div>' +
|
454
|
+
'</div>'
|
455
|
+
: '';
|
456
|
+
var donebutton = this.multiple && this.options.doneButton ?
|
457
|
+
'<div class="bs-donebutton">' +
|
458
|
+
'<div class="btn-group btn-block">' +
|
459
|
+
'<button type="button" class="btn btn-sm btn-default">' +
|
460
|
+
this.options.doneButtonText +
|
461
|
+
'</button>' +
|
462
|
+
'</div>' +
|
463
|
+
'</div>'
|
464
|
+
: '';
|
465
|
+
var drop =
|
466
|
+
'<div class="btn-group bootstrap-select' + multiple + inputGroup + '">' +
|
467
|
+
'<button type="button" class="' + this.options.styleBase + ' dropdown-toggle" data-toggle="dropdown"' + autofocus + '>' +
|
468
|
+
'<span class="filter-option pull-left"></span> ' +
|
469
|
+
'<span class="bs-caret">' +
|
470
|
+
this.options.template.caret +
|
471
|
+
'</span>' +
|
472
|
+
'</button>' +
|
473
|
+
'<div class="dropdown-menu open">' +
|
474
|
+
header +
|
475
|
+
searchbox +
|
476
|
+
actionsbox +
|
477
|
+
'<ul class="dropdown-menu inner" role="menu">' +
|
478
|
+
'</ul>' +
|
479
|
+
donebutton +
|
480
|
+
'</div>' +
|
481
|
+
'</div>';
|
482
|
+
|
483
|
+
return $(drop);
|
484
|
+
},
|
485
|
+
|
486
|
+
createView: function () {
|
487
|
+
var $drop = this.createDropdown(),
|
488
|
+
li = this.createLi();
|
489
|
+
|
490
|
+
$drop.find('ul')[0].innerHTML = li;
|
491
|
+
return $drop;
|
492
|
+
},
|
493
|
+
|
494
|
+
reloadLi: function () {
|
495
|
+
//Remove all children.
|
496
|
+
this.destroyLi();
|
497
|
+
//Re build
|
498
|
+
var li = this.createLi();
|
499
|
+
this.$menuInner[0].innerHTML = li;
|
500
|
+
},
|
501
|
+
|
502
|
+
destroyLi: function () {
|
503
|
+
this.$menu.find('li').remove();
|
504
|
+
},
|
505
|
+
|
506
|
+
createLi: function () {
|
507
|
+
var that = this,
|
508
|
+
_li = [],
|
509
|
+
optID = 0,
|
510
|
+
titleOption = document.createElement('option'),
|
511
|
+
liIndex = -1; // increment liIndex whenever a new <li> element is created to ensure liObj is correct
|
512
|
+
|
513
|
+
// Helper functions
|
514
|
+
/**
|
515
|
+
* @param content
|
516
|
+
* @param [index]
|
517
|
+
* @param [classes]
|
518
|
+
* @param [optgroup]
|
519
|
+
* @returns {string}
|
520
|
+
*/
|
521
|
+
var generateLI = function (content, index, classes, optgroup) {
|
522
|
+
return '<li' +
|
523
|
+
((typeof classes !== 'undefined' & '' !== classes) ? ' class="' + classes + '"' : '') +
|
524
|
+
((typeof index !== 'undefined' & null !== index) ? ' data-original-index="' + index + '"' : '') +
|
525
|
+
((typeof optgroup !== 'undefined' & null !== optgroup) ? 'data-optgroup="' + optgroup + '"' : '') +
|
526
|
+
'>' + content + '</li>';
|
527
|
+
};
|
528
|
+
|
529
|
+
/**
|
530
|
+
* @param text
|
531
|
+
* @param [classes]
|
532
|
+
* @param [inline]
|
533
|
+
* @param [tokens]
|
534
|
+
* @returns {string}
|
535
|
+
*/
|
536
|
+
var generateA = function (text, classes, inline, tokens) {
|
537
|
+
return '<a tabindex="0"' +
|
538
|
+
(typeof classes !== 'undefined' ? ' class="' + classes + '"' : '') +
|
539
|
+
(typeof inline !== 'undefined' ? ' style="' + inline + '"' : '') +
|
540
|
+
(that.options.liveSearchNormalize ? ' data-normalized-text="' + normalizeToBase(htmlEscape(text)) + '"' : '') +
|
541
|
+
(typeof tokens !== 'undefined' || tokens !== null ? ' data-tokens="' + tokens + '"' : '') +
|
542
|
+
'>' + text +
|
543
|
+
'<span class="' + that.options.iconBase + ' ' + that.options.tickIcon + ' check-mark"></span>' +
|
544
|
+
'</a>';
|
545
|
+
};
|
546
|
+
|
547
|
+
if (this.options.title && !this.multiple) {
|
548
|
+
// this option doesn't create a new <li> element, but does add a new option, so liIndex is decreased
|
549
|
+
// since liObj is recalculated on every refresh, liIndex needs to be decreased even if the titleOption is already appended
|
550
|
+
liIndex--;
|
551
|
+
|
552
|
+
if (!this.$element.find('.bs-title-option').length) {
|
553
|
+
// Use native JS to prepend option (faster)
|
554
|
+
var element = this.$element[0];
|
555
|
+
titleOption.className = 'bs-title-option';
|
556
|
+
titleOption.appendChild(document.createTextNode(this.options.title));
|
557
|
+
titleOption.value = '';
|
558
|
+
element.insertBefore(titleOption, element.firstChild);
|
559
|
+
// Check if selected attribute is already set on an option. If not, select the titleOption option.
|
560
|
+
if ($(element.options[element.selectedIndex]).attr('selected') === undefined) titleOption.selected = true;
|
561
|
+
}
|
562
|
+
}
|
563
|
+
|
564
|
+
this.$element.find('option').each(function (index) {
|
565
|
+
var $this = $(this);
|
566
|
+
|
567
|
+
liIndex++;
|
568
|
+
|
569
|
+
if ($this.hasClass('bs-title-option')) return;
|
570
|
+
|
571
|
+
// Get the class and text for the option
|
572
|
+
var optionClass = this.className || '',
|
573
|
+
inline = this.style.cssText,
|
574
|
+
text = $this.data('content') ? $this.data('content') : $this.html(),
|
575
|
+
tokens = $this.data('tokens') ? $this.data('tokens') : null,
|
576
|
+
subtext = typeof $this.data('subtext') !== 'undefined' ? '<small class="text-muted">' + $this.data('subtext') + '</small>' : '',
|
577
|
+
icon = typeof $this.data('icon') !== 'undefined' ? '<span class="' + that.options.iconBase + ' ' + $this.data('icon') + '"></span> ' : '',
|
578
|
+
isDisabled = this.disabled || (this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled);
|
579
|
+
|
580
|
+
if (icon !== '' && isDisabled) {
|
581
|
+
icon = '<span>' + icon + '</span>';
|
582
|
+
}
|
583
|
+
|
584
|
+
if (that.options.hideDisabled && isDisabled) {
|
585
|
+
liIndex--;
|
586
|
+
return;
|
587
|
+
}
|
588
|
+
|
589
|
+
if (!$this.data('content')) {
|
590
|
+
// Prepend any icon and append any subtext to the main text.
|
591
|
+
text = icon + '<span class="text">' + text + subtext + '</span>';
|
592
|
+
}
|
593
|
+
|
594
|
+
if (this.parentNode.tagName === 'OPTGROUP' && $this.data('divider') !== true) {
|
595
|
+
var optGroupClass = ' ' + this.parentNode.className || '';
|
596
|
+
|
597
|
+
if ($this.index() === 0) { // Is it the first option of the optgroup?
|
598
|
+
optID += 1;
|
599
|
+
|
600
|
+
// Get the opt group label
|
601
|
+
var label = this.parentNode.label,
|
602
|
+
labelSubtext = typeof $this.parent().data('subtext') !== 'undefined' ? '<small class="text-muted">' + $this.parent().data('subtext') + '</small>' : '',
|
603
|
+
labelIcon = $this.parent().data('icon') ? '<span class="' + that.options.iconBase + ' ' + $this.parent().data('icon') + '"></span> ' : '';
|
604
|
+
|
605
|
+
label = labelIcon + '<span class="text">' + label + labelSubtext + '</span>';
|
606
|
+
|
607
|
+
if (index !== 0 && _li.length > 0) { // Is it NOT the first option of the select && are there elements in the dropdown?
|
608
|
+
liIndex++;
|
609
|
+
_li.push(generateLI('', null, 'divider', optID + 'div'));
|
610
|
+
}
|
611
|
+
liIndex++;
|
612
|
+
_li.push(generateLI(label, null, 'dropdown-header' + optGroupClass, optID));
|
613
|
+
}
|
614
|
+
_li.push(generateLI(generateA(text, 'opt ' + optionClass + optGroupClass, inline, tokens), index, '', optID));
|
615
|
+
} else if ($this.data('divider') === true) {
|
616
|
+
_li.push(generateLI('', index, 'divider'));
|
617
|
+
} else if ($this.data('hidden') === true) {
|
618
|
+
_li.push(generateLI(generateA(text, optionClass, inline, tokens), index, 'hidden is-hidden'));
|
619
|
+
} else {
|
620
|
+
if (this.previousElementSibling && this.previousElementSibling.tagName === 'OPTGROUP') {
|
621
|
+
liIndex++;
|
622
|
+
_li.push(generateLI('', null, 'divider', optID + 'div'));
|
623
|
+
}
|
624
|
+
_li.push(generateLI(generateA(text, optionClass, inline, tokens), index));
|
625
|
+
}
|
626
|
+
|
627
|
+
that.liObj[index] = liIndex;
|
628
|
+
});
|
629
|
+
|
630
|
+
//If we are not multiple, we don't have a selected item, and we don't have a title, select the first element so something is set in the button
|
631
|
+
if (!this.multiple && this.$element.find('option:selected').length === 0 && !this.options.title) {
|
632
|
+
this.$element.find('option').eq(0).prop('selected', true).attr('selected', 'selected');
|
633
|
+
}
|
634
|
+
|
635
|
+
return _li.join('');
|
636
|
+
},
|
637
|
+
|
638
|
+
findLis: function () {
|
639
|
+
if (this.$lis == null) this.$lis = this.$menu.find('li');
|
640
|
+
return this.$lis;
|
641
|
+
},
|
642
|
+
|
643
|
+
/**
|
644
|
+
* @param [updateLi] defaults to true
|
645
|
+
*/
|
646
|
+
render: function (updateLi) {
|
647
|
+
var that = this,
|
648
|
+
notDisabled;
|
649
|
+
|
650
|
+
//Update the LI to match the SELECT
|
651
|
+
if (updateLi !== false) {
|
652
|
+
this.$element.find('option').each(function (index) {
|
653
|
+
var $lis = that.findLis().eq(that.liObj[index]);
|
654
|
+
|
655
|
+
that.setDisabled(index, this.disabled || this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled, $lis);
|
656
|
+
that.setSelected(index, this.selected, $lis);
|
657
|
+
});
|
658
|
+
}
|
659
|
+
|
660
|
+
this.tabIndex();
|
661
|
+
|
662
|
+
var selectedItems = this.$element.find('option').map(function () {
|
663
|
+
if (this.selected) {
|
664
|
+
if (that.options.hideDisabled && (this.disabled || this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled)) return;
|
665
|
+
|
666
|
+
var $this = $(this),
|
667
|
+
icon = $this.data('icon') && that.options.showIcon ? '<i class="' + that.options.iconBase + ' ' + $this.data('icon') + '"></i> ' : '',
|
668
|
+
subtext;
|
669
|
+
|
670
|
+
if (that.options.showSubtext && $this.data('subtext') && !that.multiple) {
|
671
|
+
subtext = ' <small class="text-muted">' + $this.data('subtext') + '</small>';
|
672
|
+
} else {
|
673
|
+
subtext = '';
|
674
|
+
}
|
675
|
+
if (typeof $this.attr('title') !== 'undefined') {
|
676
|
+
return $this.attr('title');
|
677
|
+
} else if ($this.data('content') && that.options.showContent) {
|
678
|
+
return $this.data('content');
|
679
|
+
} else {
|
680
|
+
return icon + $this.html() + subtext;
|
681
|
+
}
|
682
|
+
}
|
683
|
+
}).toArray();
|
684
|
+
|
685
|
+
//Fixes issue in IE10 occurring when no default option is selected and at least one option is disabled
|
686
|
+
//Convert all the values into a comma delimited string
|
687
|
+
var title = !this.multiple ? selectedItems[0] : selectedItems.join(this.options.multipleSeparator);
|
688
|
+
|
689
|
+
//If this is multi select, and the selectText type is count, the show 1 of 2 selected etc..
|
690
|
+
if (this.multiple && this.options.selectedTextFormat.indexOf('count') > -1) {
|
691
|
+
var max = this.options.selectedTextFormat.split('>');
|
692
|
+
if ((max.length > 1 && selectedItems.length > max[1]) || (max.length == 1 && selectedItems.length >= 2)) {
|
693
|
+
notDisabled = this.options.hideDisabled ? ', [disabled]' : '';
|
694
|
+
var totalCount = this.$element.find('option').not('[data-divider="true"], [data-hidden="true"]' + notDisabled).length,
|
695
|
+
tr8nText = (typeof this.options.countSelectedText === 'function') ? this.options.countSelectedText(selectedItems.length, totalCount) : this.options.countSelectedText;
|
696
|
+
title = tr8nText.replace('{0}', selectedItems.length.toString()).replace('{1}', totalCount.toString());
|
697
|
+
}
|
698
|
+
}
|
699
|
+
|
700
|
+
if (this.options.title == undefined) {
|
701
|
+
this.options.title = this.$element.attr('title');
|
702
|
+
}
|
703
|
+
|
704
|
+
if (this.options.selectedTextFormat == 'static') {
|
705
|
+
title = this.options.title;
|
706
|
+
}
|
707
|
+
|
708
|
+
//If we dont have a title, then use the default, or if nothing is set at all, use the not selected text
|
709
|
+
if (!title) {
|
710
|
+
title = typeof this.options.title !== 'undefined' ? this.options.title : this.options.noneSelectedText;
|
711
|
+
}
|
712
|
+
|
713
|
+
//strip all html-tags and trim the result
|
714
|
+
this.$button.attr('title', $.trim(title.replace(/<[^>]*>?/g, '')));
|
715
|
+
this.$button.children('.filter-option').html(title);
|
716
|
+
|
717
|
+
this.$element.trigger('rendered.bs.select');
|
718
|
+
},
|
719
|
+
|
720
|
+
/**
|
721
|
+
* @param [style]
|
722
|
+
* @param [status]
|
723
|
+
*/
|
724
|
+
setStyle: function (style, status) {
|
725
|
+
if (this.$element.attr('class')) {
|
726
|
+
this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi, ''));
|
727
|
+
}
|
728
|
+
|
729
|
+
var buttonClass = style ? style : this.options.style;
|
730
|
+
|
731
|
+
if (status == 'add') {
|
732
|
+
this.$button.addClass(buttonClass);
|
733
|
+
} else if (status == 'remove') {
|
734
|
+
this.$button.removeClass(buttonClass);
|
735
|
+
} else {
|
736
|
+
this.$button.removeClass(this.options.style);
|
737
|
+
this.$button.addClass(buttonClass);
|
738
|
+
}
|
739
|
+
},
|
740
|
+
|
741
|
+
liHeight: function (refresh) {
|
742
|
+
if (!refresh && (this.options.size === false || this.sizeInfo)) return;
|
743
|
+
|
744
|
+
var newElement = document.createElement('div'),
|
745
|
+
menu = document.createElement('div'),
|
746
|
+
menuInner = document.createElement('ul'),
|
747
|
+
divider = document.createElement('li'),
|
748
|
+
li = document.createElement('li'),
|
749
|
+
a = document.createElement('a'),
|
750
|
+
text = document.createElement('span'),
|
751
|
+
header = this.options.header && this.$menu.find('.popover-title').length > 0 ? this.$menu.find('.popover-title')[0].cloneNode(true) : null,
|
752
|
+
search = this.options.liveSearch ? document.createElement('div') : null,
|
753
|
+
actions = this.options.actionsBox && this.multiple && this.$menu.find('.bs-actionsbox').length > 0 ? this.$menu.find('.bs-actionsbox')[0].cloneNode(true) : null,
|
754
|
+
doneButton = this.options.doneButton && this.multiple && this.$menu.find('.bs-donebutton').length > 0 ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null;
|
755
|
+
|
756
|
+
text.className = 'text';
|
757
|
+
newElement.className = this.$menu[0].parentNode.className + ' open';
|
758
|
+
menu.className = 'dropdown-menu open';
|
759
|
+
menuInner.className = 'dropdown-menu inner';
|
760
|
+
divider.className = 'divider';
|
761
|
+
|
762
|
+
text.appendChild(document.createTextNode('Inner text'));
|
763
|
+
a.appendChild(text);
|
764
|
+
li.appendChild(a);
|
765
|
+
menuInner.appendChild(li);
|
766
|
+
menuInner.appendChild(divider);
|
767
|
+
if (header) menu.appendChild(header);
|
768
|
+
if (search) {
|
769
|
+
// create a span instead of input as creating an input element is slower
|
770
|
+
var input = document.createElement('span');
|
771
|
+
search.className = 'bs-searchbox';
|
772
|
+
input.className = 'form-control';
|
773
|
+
search.appendChild(input);
|
774
|
+
menu.appendChild(search);
|
775
|
+
}
|
776
|
+
if (actions) menu.appendChild(actions);
|
777
|
+
menu.appendChild(menuInner);
|
778
|
+
if (doneButton) menu.appendChild(doneButton);
|
779
|
+
newElement.appendChild(menu);
|
780
|
+
|
781
|
+
document.body.appendChild(newElement);
|
782
|
+
|
783
|
+
var liHeight = a.offsetHeight,
|
784
|
+
headerHeight = header ? header.offsetHeight : 0,
|
785
|
+
searchHeight = search ? search.offsetHeight : 0,
|
786
|
+
actionsHeight = actions ? actions.offsetHeight : 0,
|
787
|
+
doneButtonHeight = doneButton ? doneButton.offsetHeight : 0,
|
788
|
+
dividerHeight = $(divider).outerHeight(true),
|
789
|
+
// fall back to jQuery if getComputedStyle is not supported
|
790
|
+
menuStyle = typeof getComputedStyle === 'function' ? getComputedStyle(menu) : false,
|
791
|
+
$menu = menuStyle ? null : $(menu),
|
792
|
+
menuPadding = parseInt(menuStyle ? menuStyle.paddingTop : $menu.css('paddingTop')) +
|
793
|
+
parseInt(menuStyle ? menuStyle.paddingBottom : $menu.css('paddingBottom')) +
|
794
|
+
parseInt(menuStyle ? menuStyle.borderTopWidth : $menu.css('borderTopWidth')) +
|
795
|
+
parseInt(menuStyle ? menuStyle.borderBottomWidth : $menu.css('borderBottomWidth')),
|
796
|
+
menuExtras = menuPadding +
|
797
|
+
parseInt(menuStyle ? menuStyle.marginTop : $menu.css('marginTop')) +
|
798
|
+
parseInt(menuStyle ? menuStyle.marginBottom : $menu.css('marginBottom')) + 2;
|
799
|
+
|
800
|
+
document.body.removeChild(newElement);
|
801
|
+
|
802
|
+
this.sizeInfo = {
|
803
|
+
liHeight: liHeight,
|
804
|
+
headerHeight: headerHeight,
|
805
|
+
searchHeight: searchHeight,
|
806
|
+
actionsHeight: actionsHeight,
|
807
|
+
doneButtonHeight: doneButtonHeight,
|
808
|
+
dividerHeight: dividerHeight,
|
809
|
+
menuPadding: menuPadding,
|
810
|
+
menuExtras: menuExtras
|
811
|
+
};
|
812
|
+
},
|
813
|
+
|
814
|
+
setSize: function () {
|
815
|
+
this.findLis();
|
816
|
+
this.liHeight();
|
817
|
+
|
818
|
+
if (this.options.header) this.$menu.css('padding-top', 0);
|
819
|
+
if (this.options.size === false) return;
|
820
|
+
|
821
|
+
var that = this,
|
822
|
+
$menu = this.$menu,
|
823
|
+
$menuInner = this.$menuInner,
|
824
|
+
$window = $(window),
|
825
|
+
selectHeight = this.$newElement[0].offsetHeight,
|
826
|
+
liHeight = this.sizeInfo['liHeight'],
|
827
|
+
headerHeight = this.sizeInfo['headerHeight'],
|
828
|
+
searchHeight = this.sizeInfo['searchHeight'],
|
829
|
+
actionsHeight = this.sizeInfo['actionsHeight'],
|
830
|
+
doneButtonHeight = this.sizeInfo['doneButtonHeight'],
|
831
|
+
divHeight = this.sizeInfo['dividerHeight'],
|
832
|
+
menuPadding = this.sizeInfo['menuPadding'],
|
833
|
+
menuExtras = this.sizeInfo['menuExtras'],
|
834
|
+
notDisabled = this.options.hideDisabled ? '.disabled' : '',
|
835
|
+
menuHeight,
|
836
|
+
getHeight,
|
837
|
+
selectOffsetTop,
|
838
|
+
selectOffsetBot,
|
839
|
+
posVert = function () {
|
840
|
+
selectOffsetTop = that.$newElement.offset().top - $window.scrollTop();
|
841
|
+
selectOffsetBot = $window.height() - selectOffsetTop - selectHeight;
|
842
|
+
};
|
843
|
+
|
844
|
+
posVert();
|
845
|
+
|
846
|
+
if (this.options.size === 'auto') {
|
847
|
+
var getSize = function () {
|
848
|
+
var minHeight,
|
849
|
+
hasClass = function (className, include) {
|
850
|
+
return function (element) {
|
851
|
+
if (include) {
|
852
|
+
return (element.classList ? element.classList.contains(className) : $(element).hasClass(className));
|
853
|
+
} else {
|
854
|
+
return !(element.classList ? element.classList.contains(className) : $(element).hasClass(className));
|
855
|
+
}
|
856
|
+
};
|
857
|
+
},
|
858
|
+
lis = that.$menuInner[0].getElementsByTagName('li'),
|
859
|
+
lisVisible = Array.prototype.filter ? Array.prototype.filter.call(lis, hasClass('hidden', false)) : that.$lis.not('.hidden'),
|
860
|
+
optGroup = Array.prototype.filter ? Array.prototype.filter.call(lisVisible, hasClass('dropdown-header', true)) : lisVisible.filter('.dropdown-header');
|
861
|
+
|
862
|
+
posVert();
|
863
|
+
menuHeight = selectOffsetBot - menuExtras;
|
864
|
+
|
865
|
+
if (that.options.container) {
|
866
|
+
if (!$menu.data('height')) $menu.data('height', $menu.height());
|
867
|
+
getHeight = $menu.data('height');
|
868
|
+
} else {
|
869
|
+
getHeight = $menu.height();
|
870
|
+
}
|
871
|
+
|
872
|
+
if (that.options.dropupAuto) {
|
873
|
+
that.$newElement.toggleClass('dropup', selectOffsetTop > selectOffsetBot && (menuHeight - menuExtras) < getHeight);
|
874
|
+
}
|
875
|
+
if (that.$newElement.hasClass('dropup')) {
|
876
|
+
menuHeight = selectOffsetTop - menuExtras;
|
877
|
+
}
|
878
|
+
|
879
|
+
if ((lisVisible.length + optGroup.length) > 3) {
|
880
|
+
minHeight = liHeight * 3 + menuExtras - 2;
|
881
|
+
} else {
|
882
|
+
minHeight = 0;
|
883
|
+
}
|
884
|
+
|
885
|
+
$menu.css({
|
886
|
+
'max-height': menuHeight + 'px',
|
887
|
+
'overflow': 'hidden',
|
888
|
+
'min-height': minHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight + 'px'
|
889
|
+
});
|
890
|
+
$menuInner.css({
|
891
|
+
'max-height': menuHeight - headerHeight - searchHeight - actionsHeight - doneButtonHeight - menuPadding + 'px',
|
892
|
+
'overflow-y': 'auto',
|
893
|
+
'min-height': Math.max(minHeight - menuPadding, 0) + 'px'
|
894
|
+
});
|
895
|
+
};
|
896
|
+
getSize();
|
897
|
+
this.$searchbox.off('input.getSize propertychange.getSize').on('input.getSize propertychange.getSize', getSize);
|
898
|
+
$window.off('resize.getSize scroll.getSize').on('resize.getSize scroll.getSize', getSize);
|
899
|
+
} else if (this.options.size && this.options.size != 'auto' && this.$lis.not(notDisabled).length > this.options.size) {
|
900
|
+
var optIndex = this.$lis.not('.divider').not(notDisabled).children().slice(0, this.options.size).last().parent().index(),
|
901
|
+
divLength = this.$lis.slice(0, optIndex + 1).filter('.divider').length;
|
902
|
+
menuHeight = liHeight * this.options.size + divLength * divHeight + menuPadding;
|
903
|
+
|
904
|
+
if (that.options.container) {
|
905
|
+
if (!$menu.data('height')) $menu.data('height', $menu.height());
|
906
|
+
getHeight = $menu.data('height');
|
907
|
+
} else {
|
908
|
+
getHeight = $menu.height();
|
909
|
+
}
|
910
|
+
|
911
|
+
if (that.options.dropupAuto) {
|
912
|
+
//noinspection JSUnusedAssignment
|
913
|
+
this.$newElement.toggleClass('dropup', selectOffsetTop > selectOffsetBot && (menuHeight - menuExtras) < getHeight);
|
914
|
+
}
|
915
|
+
$menu.css({
|
916
|
+
'max-height': menuHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight + 'px',
|
917
|
+
'overflow': 'hidden',
|
918
|
+
'min-height': ''
|
919
|
+
});
|
920
|
+
$menuInner.css({
|
921
|
+
'max-height': menuHeight - menuPadding + 'px',
|
922
|
+
'overflow-y': 'auto',
|
923
|
+
'min-height': ''
|
924
|
+
});
|
925
|
+
}
|
926
|
+
},
|
927
|
+
|
928
|
+
setWidth: function () {
|
929
|
+
if (this.options.width === 'auto') {
|
930
|
+
this.$menu.css('min-width', '0');
|
931
|
+
|
932
|
+
// Get correct width if element is hidden
|
933
|
+
var $selectClone = this.$menu.parent().clone().appendTo('body'),
|
934
|
+
$selectClone2 = this.options.container ? this.$newElement.clone().appendTo('body') : $selectClone,
|
935
|
+
ulWidth = $selectClone.children('.dropdown-menu').outerWidth(),
|
936
|
+
btnWidth = $selectClone2.css('width', 'auto').children('button').outerWidth();
|
937
|
+
|
938
|
+
$selectClone.remove();
|
939
|
+
$selectClone2.remove();
|
940
|
+
|
941
|
+
// Set width to whatever's larger, button title or longest option
|
942
|
+
this.$newElement.css('width', Math.max(ulWidth, btnWidth) + 'px');
|
943
|
+
} else if (this.options.width === 'fit') {
|
944
|
+
// Remove inline min-width so width can be changed from 'auto'
|
945
|
+
this.$menu.css('min-width', '');
|
946
|
+
this.$newElement.css('width', '').addClass('fit-width');
|
947
|
+
} else if (this.options.width) {
|
948
|
+
// Remove inline min-width so width can be changed from 'auto'
|
949
|
+
this.$menu.css('min-width', '');
|
950
|
+
this.$newElement.css('width', this.options.width);
|
951
|
+
} else {
|
952
|
+
// Remove inline min-width/width so width can be changed
|
953
|
+
this.$menu.css('min-width', '');
|
954
|
+
this.$newElement.css('width', '');
|
955
|
+
}
|
956
|
+
// Remove fit-width class if width is changed programmatically
|
957
|
+
if (this.$newElement.hasClass('fit-width') && this.options.width !== 'fit') {
|
958
|
+
this.$newElement.removeClass('fit-width');
|
959
|
+
}
|
960
|
+
},
|
961
|
+
|
962
|
+
selectPosition: function () {
|
963
|
+
this.$bsContainer = $('<div class="bs-container" />');
|
964
|
+
|
965
|
+
var that = this,
|
966
|
+
pos,
|
967
|
+
actualHeight,
|
968
|
+
getPlacement = function ($element) {
|
969
|
+
that.$bsContainer.addClass($element.attr('class').replace(/form-control|fit-width/gi, '')).toggleClass('dropup', $element.hasClass('dropup'));
|
970
|
+
pos = $element.offset();
|
971
|
+
actualHeight = $element.hasClass('dropup') ? 0 : $element[0].offsetHeight;
|
972
|
+
that.$bsContainer.css({
|
973
|
+
'top': pos.top + actualHeight,
|
974
|
+
'left': pos.left,
|
975
|
+
'width': $element[0].offsetWidth
|
976
|
+
});
|
977
|
+
};
|
978
|
+
|
979
|
+
this.$button.on('click', function () {
|
980
|
+
var $this = $(this);
|
981
|
+
|
982
|
+
if (that.isDisabled()) {
|
983
|
+
return;
|
984
|
+
}
|
985
|
+
|
986
|
+
getPlacement(that.$newElement);
|
987
|
+
|
988
|
+
that.$bsContainer
|
989
|
+
.appendTo(that.options.container)
|
990
|
+
.toggleClass('open', !$this.hasClass('open'))
|
991
|
+
.append(that.$menu);
|
992
|
+
});
|
993
|
+
|
994
|
+
$(window).on('resize scroll', function () {
|
995
|
+
getPlacement(that.$newElement);
|
996
|
+
});
|
997
|
+
|
998
|
+
this.$element.on('hide.bs.select', function () {
|
999
|
+
that.$menu.data('height', that.$menu.height());
|
1000
|
+
that.$bsContainer.detach();
|
1001
|
+
});
|
1002
|
+
},
|
1003
|
+
|
1004
|
+
setSelected: function (index, selected, $lis) {
|
1005
|
+
if (!$lis) {
|
1006
|
+
$lis = this.findLis().eq(this.liObj[index]);
|
1007
|
+
}
|
1008
|
+
|
1009
|
+
$lis.toggleClass('selected', selected);
|
1010
|
+
},
|
1011
|
+
|
1012
|
+
setDisabled: function (index, disabled, $lis) {
|
1013
|
+
if (!$lis) {
|
1014
|
+
$lis = this.findLis().eq(this.liObj[index]);
|
1015
|
+
}
|
1016
|
+
|
1017
|
+
if (disabled) {
|
1018
|
+
$lis.addClass('disabled').children('a').attr('href', '#').attr('tabindex', -1);
|
1019
|
+
} else {
|
1020
|
+
$lis.removeClass('disabled').children('a').removeAttr('href').attr('tabindex', 0);
|
1021
|
+
}
|
1022
|
+
},
|
1023
|
+
|
1024
|
+
isDisabled: function () {
|
1025
|
+
return this.$element[0].disabled;
|
1026
|
+
},
|
1027
|
+
|
1028
|
+
checkDisabled: function () {
|
1029
|
+
var that = this;
|
1030
|
+
|
1031
|
+
if (this.isDisabled()) {
|
1032
|
+
this.$newElement.addClass('disabled');
|
1033
|
+
this.$button.addClass('disabled').attr('tabindex', -1);
|
1034
|
+
} else {
|
1035
|
+
if (this.$button.hasClass('disabled')) {
|
1036
|
+
this.$newElement.removeClass('disabled');
|
1037
|
+
this.$button.removeClass('disabled');
|
1038
|
+
}
|
1039
|
+
|
1040
|
+
if (this.$button.attr('tabindex') == -1 && !this.$element.data('tabindex')) {
|
1041
|
+
this.$button.removeAttr('tabindex');
|
1042
|
+
}
|
1043
|
+
}
|
1044
|
+
|
1045
|
+
this.$button.click(function () {
|
1046
|
+
return !that.isDisabled();
|
1047
|
+
});
|
1048
|
+
},
|
1049
|
+
|
1050
|
+
tabIndex: function () {
|
1051
|
+
if (this.$element.data('tabindex') !== this.$element.attr('tabindex') &&
|
1052
|
+
(this.$element.attr('tabindex') !== -98 && this.$element.attr('tabindex') !== '-98')) {
|
1053
|
+
this.$element.data('tabindex', this.$element.attr('tabindex'));
|
1054
|
+
this.$button.attr('tabindex', this.$element.data('tabindex'));
|
1055
|
+
}
|
1056
|
+
|
1057
|
+
this.$element.attr('tabindex', -98);
|
1058
|
+
},
|
1059
|
+
|
1060
|
+
clickListener: function () {
|
1061
|
+
var that = this,
|
1062
|
+
$document = $(document);
|
1063
|
+
|
1064
|
+
this.$newElement.on('touchstart.dropdown', '.dropdown-menu', function (e) {
|
1065
|
+
e.stopPropagation();
|
1066
|
+
});
|
1067
|
+
|
1068
|
+
$document.data('spaceSelect', false);
|
1069
|
+
|
1070
|
+
this.$button.on('keyup', function (e) {
|
1071
|
+
if (/(32)/.test(e.keyCode.toString(10)) && $document.data('spaceSelect')) {
|
1072
|
+
e.preventDefault();
|
1073
|
+
$document.data('spaceSelect', false);
|
1074
|
+
}
|
1075
|
+
});
|
1076
|
+
|
1077
|
+
this.$button.on('click', function () {
|
1078
|
+
that.setSize();
|
1079
|
+
that.$element.on('shown.bs.select', function () {
|
1080
|
+
if (!that.options.liveSearch && !that.multiple) {
|
1081
|
+
that.$menuInner.find('.selected a').focus();
|
1082
|
+
} else if (!that.multiple) {
|
1083
|
+
var selectedIndex = that.liObj[that.$element[0].selectedIndex];
|
1084
|
+
|
1085
|
+
if (typeof selectedIndex !== 'number' || that.options.size === false) return;
|
1086
|
+
|
1087
|
+
// scroll to selected option
|
1088
|
+
var offset = that.$lis.eq(selectedIndex)[0].offsetTop - that.$menuInner[0].offsetTop;
|
1089
|
+
offset = offset - that.$menuInner[0].offsetHeight/2 + that.sizeInfo.liHeight/2;
|
1090
|
+
that.$menuInner[0].scrollTop = offset;
|
1091
|
+
}
|
1092
|
+
});
|
1093
|
+
});
|
1094
|
+
|
1095
|
+
this.$menuInner.on('click', 'li a', function (e) {
|
1096
|
+
var $this = $(this),
|
1097
|
+
clickedIndex = $this.parent().data('originalIndex'),
|
1098
|
+
prevValue = that.$element.val(),
|
1099
|
+
prevIndex = that.$element.prop('selectedIndex');
|
1100
|
+
|
1101
|
+
// Don't close on multi choice menu
|
1102
|
+
if (that.multiple) {
|
1103
|
+
e.stopPropagation();
|
1104
|
+
}
|
1105
|
+
|
1106
|
+
e.preventDefault();
|
1107
|
+
|
1108
|
+
//Don't run if we have been disabled
|
1109
|
+
if (!that.isDisabled() && !$this.parent().hasClass('disabled')) {
|
1110
|
+
var $options = that.$element.find('option'),
|
1111
|
+
$option = $options.eq(clickedIndex),
|
1112
|
+
state = $option.prop('selected'),
|
1113
|
+
$optgroup = $option.parent('optgroup'),
|
1114
|
+
maxOptions = that.options.maxOptions,
|
1115
|
+
maxOptionsGrp = $optgroup.data('maxOptions') || false;
|
1116
|
+
|
1117
|
+
if (!that.multiple) { // Deselect all others if not multi select box
|
1118
|
+
$options.prop('selected', false);
|
1119
|
+
$option.prop('selected', true);
|
1120
|
+
that.$menuInner.find('.selected').removeClass('selected');
|
1121
|
+
that.setSelected(clickedIndex, true);
|
1122
|
+
} else { // Toggle the one we have chosen if we are multi select.
|
1123
|
+
$option.prop('selected', !state);
|
1124
|
+
that.setSelected(clickedIndex, !state);
|
1125
|
+
$this.blur();
|
1126
|
+
|
1127
|
+
if (maxOptions !== false || maxOptionsGrp !== false) {
|
1128
|
+
var maxReached = maxOptions < $options.filter(':selected').length,
|
1129
|
+
maxReachedGrp = maxOptionsGrp < $optgroup.find('option:selected').length;
|
1130
|
+
|
1131
|
+
if ((maxOptions && maxReached) || (maxOptionsGrp && maxReachedGrp)) {
|
1132
|
+
if (maxOptions && maxOptions == 1) {
|
1133
|
+
$options.prop('selected', false);
|
1134
|
+
$option.prop('selected', true);
|
1135
|
+
that.$menuInner.find('.selected').removeClass('selected');
|
1136
|
+
that.setSelected(clickedIndex, true);
|
1137
|
+
} else if (maxOptionsGrp && maxOptionsGrp == 1) {
|
1138
|
+
$optgroup.find('option:selected').prop('selected', false);
|
1139
|
+
$option.prop('selected', true);
|
1140
|
+
var optgroupID = $this.parent().data('optgroup');
|
1141
|
+
that.$menuInner.find('[data-optgroup="' + optgroupID + '"]').removeClass('selected');
|
1142
|
+
that.setSelected(clickedIndex, true);
|
1143
|
+
} else {
|
1144
|
+
var maxOptionsArr = (typeof that.options.maxOptionsText === 'function') ?
|
1145
|
+
that.options.maxOptionsText(maxOptions, maxOptionsGrp) : that.options.maxOptionsText,
|
1146
|
+
maxTxt = maxOptionsArr[0].replace('{n}', maxOptions),
|
1147
|
+
maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp),
|
1148
|
+
$notify = $('<div class="notify"></div>');
|
1149
|
+
// If {var} is set in array, replace it
|
1150
|
+
/** @deprecated */
|
1151
|
+
if (maxOptionsArr[2]) {
|
1152
|
+
maxTxt = maxTxt.replace('{var}', maxOptionsArr[2][maxOptions > 1 ? 0 : 1]);
|
1153
|
+
maxTxtGrp = maxTxtGrp.replace('{var}', maxOptionsArr[2][maxOptionsGrp > 1 ? 0 : 1]);
|
1154
|
+
}
|
1155
|
+
|
1156
|
+
$option.prop('selected', false);
|
1157
|
+
|
1158
|
+
that.$menu.append($notify);
|
1159
|
+
|
1160
|
+
if (maxOptions && maxReached) {
|
1161
|
+
$notify.append($('<div>' + maxTxt + '</div>'));
|
1162
|
+
that.$element.trigger('maxReached.bs.select');
|
1163
|
+
}
|
1164
|
+
|
1165
|
+
if (maxOptionsGrp && maxReachedGrp) {
|
1166
|
+
$notify.append($('<div>' + maxTxtGrp + '</div>'));
|
1167
|
+
that.$element.trigger('maxReachedGrp.bs.select');
|
1168
|
+
}
|
1169
|
+
|
1170
|
+
setTimeout(function () {
|
1171
|
+
that.setSelected(clickedIndex, false);
|
1172
|
+
}, 10);
|
1173
|
+
|
1174
|
+
$notify.delay(750).fadeOut(300, function () {
|
1175
|
+
$(this).remove();
|
1176
|
+
});
|
1177
|
+
}
|
1178
|
+
}
|
1179
|
+
}
|
1180
|
+
}
|
1181
|
+
|
1182
|
+
if (!that.multiple) {
|
1183
|
+
that.$button.focus();
|
1184
|
+
} else if (that.options.liveSearch) {
|
1185
|
+
that.$searchbox.focus();
|
1186
|
+
}
|
1187
|
+
|
1188
|
+
// Trigger select 'change'
|
1189
|
+
if ((prevValue != that.$element.val() && that.multiple) || (prevIndex != that.$element.prop('selectedIndex') && !that.multiple)) {
|
1190
|
+
that.$element.triggerNative('change');
|
1191
|
+
// $option.prop('selected') is current option state (selected/unselected). state is previous option state.
|
1192
|
+
that.$element.trigger('changed.bs.select', [clickedIndex, $option.prop('selected'), state]);
|
1193
|
+
}
|
1194
|
+
}
|
1195
|
+
});
|
1196
|
+
|
1197
|
+
this.$menu.on('click', 'li.disabled a, .popover-title, .popover-title :not(.close)', function (e) {
|
1198
|
+
if (e.currentTarget == this) {
|
1199
|
+
e.preventDefault();
|
1200
|
+
e.stopPropagation();
|
1201
|
+
if (that.options.liveSearch && !$(e.target).hasClass('close')) {
|
1202
|
+
that.$searchbox.focus();
|
1203
|
+
} else {
|
1204
|
+
that.$button.focus();
|
1205
|
+
}
|
1206
|
+
}
|
1207
|
+
});
|
1208
|
+
|
1209
|
+
this.$menuInner.on('click', '.divider, .dropdown-header', function (e) {
|
1210
|
+
e.preventDefault();
|
1211
|
+
e.stopPropagation();
|
1212
|
+
if (that.options.liveSearch) {
|
1213
|
+
that.$searchbox.focus();
|
1214
|
+
} else {
|
1215
|
+
that.$button.focus();
|
1216
|
+
}
|
1217
|
+
});
|
1218
|
+
|
1219
|
+
this.$menu.on('click', '.popover-title .close', function () {
|
1220
|
+
that.$button.click();
|
1221
|
+
});
|
1222
|
+
|
1223
|
+
this.$searchbox.on('click', function (e) {
|
1224
|
+
e.stopPropagation();
|
1225
|
+
});
|
1226
|
+
|
1227
|
+
this.$menu.on('click', '.actions-btn', function (e) {
|
1228
|
+
if (that.options.liveSearch) {
|
1229
|
+
that.$searchbox.focus();
|
1230
|
+
} else {
|
1231
|
+
that.$button.focus();
|
1232
|
+
}
|
1233
|
+
|
1234
|
+
e.preventDefault();
|
1235
|
+
e.stopPropagation();
|
1236
|
+
|
1237
|
+
if ($(this).hasClass('bs-select-all')) {
|
1238
|
+
that.selectAll();
|
1239
|
+
} else {
|
1240
|
+
that.deselectAll();
|
1241
|
+
}
|
1242
|
+
that.$element.triggerNative('change');
|
1243
|
+
});
|
1244
|
+
|
1245
|
+
this.$element.change(function () {
|
1246
|
+
that.render(false);
|
1247
|
+
});
|
1248
|
+
},
|
1249
|
+
|
1250
|
+
liveSearchListener: function () {
|
1251
|
+
var that = this,
|
1252
|
+
$no_results = $('<li class="no-results"></li>');
|
1253
|
+
|
1254
|
+
this.$button.on('click.dropdown.data-api touchstart.dropdown.data-api', function () {
|
1255
|
+
that.$menuInner.find('.active').removeClass('active');
|
1256
|
+
if (!!that.$searchbox.val()) {
|
1257
|
+
that.$searchbox.val('');
|
1258
|
+
that.$lis.not('.is-hidden').removeClass('hidden');
|
1259
|
+
if (!!$no_results.parent().length) $no_results.remove();
|
1260
|
+
}
|
1261
|
+
if (!that.multiple) that.$menuInner.find('.selected').addClass('active');
|
1262
|
+
setTimeout(function () {
|
1263
|
+
that.$searchbox.focus();
|
1264
|
+
}, 10);
|
1265
|
+
});
|
1266
|
+
|
1267
|
+
this.$searchbox.on('click.dropdown.data-api focus.dropdown.data-api touchend.dropdown.data-api', function (e) {
|
1268
|
+
e.stopPropagation();
|
1269
|
+
});
|
1270
|
+
|
1271
|
+
this.$searchbox.on('input propertychange', function () {
|
1272
|
+
if (that.$searchbox.val()) {
|
1273
|
+
var $searchBase = that.$lis.not('.is-hidden').removeClass('hidden').children('a');
|
1274
|
+
if (that.options.liveSearchNormalize) {
|
1275
|
+
$searchBase = $searchBase.not(':a' + that._searchStyle() + '("' + normalizeToBase(that.$searchbox.val()) + '")');
|
1276
|
+
} else {
|
1277
|
+
$searchBase = $searchBase.not(':' + that._searchStyle() + '("' + that.$searchbox.val() + '")');
|
1278
|
+
}
|
1279
|
+
$searchBase.parent().addClass('hidden');
|
1280
|
+
|
1281
|
+
that.$lis.filter('.dropdown-header').each(function () {
|
1282
|
+
var $this = $(this),
|
1283
|
+
optgroup = $this.data('optgroup');
|
1284
|
+
|
1285
|
+
if (that.$lis.filter('[data-optgroup=' + optgroup + ']').not($this).not('.hidden').length === 0) {
|
1286
|
+
$this.addClass('hidden');
|
1287
|
+
that.$lis.filter('[data-optgroup=' + optgroup + 'div]').addClass('hidden');
|
1288
|
+
}
|
1289
|
+
});
|
1290
|
+
|
1291
|
+
var $lisVisible = that.$lis.not('.hidden');
|
1292
|
+
|
1293
|
+
// hide divider if first or last visible, or if followed by another divider
|
1294
|
+
$lisVisible.each(function (index) {
|
1295
|
+
var $this = $(this);
|
1296
|
+
|
1297
|
+
if ($this.hasClass('divider') && (
|
1298
|
+
$this.index() === $lisVisible.first().index() ||
|
1299
|
+
$this.index() === $lisVisible.last().index() ||
|
1300
|
+
$lisVisible.eq(index + 1).hasClass('divider'))) {
|
1301
|
+
$this.addClass('hidden');
|
1302
|
+
}
|
1303
|
+
});
|
1304
|
+
|
1305
|
+
if (!that.$lis.not('.hidden, .no-results').length) {
|
1306
|
+
if (!!$no_results.parent().length) {
|
1307
|
+
$no_results.remove();
|
1308
|
+
}
|
1309
|
+
$no_results.html(that.options.noneResultsText.replace('{0}', '"' + htmlEscape(that.$searchbox.val()) + '"')).show();
|
1310
|
+
that.$menuInner.append($no_results);
|
1311
|
+
} else if (!!$no_results.parent().length) {
|
1312
|
+
$no_results.remove();
|
1313
|
+
}
|
1314
|
+
} else {
|
1315
|
+
that.$lis.not('.is-hidden').removeClass('hidden');
|
1316
|
+
if (!!$no_results.parent().length) {
|
1317
|
+
$no_results.remove();
|
1318
|
+
}
|
1319
|
+
}
|
1320
|
+
|
1321
|
+
that.$lis.filter('.active').removeClass('active');
|
1322
|
+
if (that.$searchbox.val()) that.$lis.not('.hidden, .divider, .dropdown-header').eq(0).addClass('active').children('a').focus();
|
1323
|
+
$(this).focus();
|
1324
|
+
});
|
1325
|
+
},
|
1326
|
+
|
1327
|
+
_searchStyle: function () {
|
1328
|
+
var styles = {
|
1329
|
+
begins: 'ibegins',
|
1330
|
+
startsWith: 'ibegins'
|
1331
|
+
};
|
1332
|
+
|
1333
|
+
return styles[this.options.liveSearchStyle] || 'icontains';
|
1334
|
+
},
|
1335
|
+
|
1336
|
+
val: function (value) {
|
1337
|
+
if (typeof value !== 'undefined') {
|
1338
|
+
this.$element.val(value);
|
1339
|
+
this.render();
|
1340
|
+
|
1341
|
+
return this.$element;
|
1342
|
+
} else {
|
1343
|
+
return this.$element.val();
|
1344
|
+
}
|
1345
|
+
},
|
1346
|
+
|
1347
|
+
changeAll: function (status) {
|
1348
|
+
if (typeof status === 'undefined') status = true;
|
1349
|
+
|
1350
|
+
this.findLis();
|
1351
|
+
|
1352
|
+
var $options = this.$element.find('option'),
|
1353
|
+
$lisVisible = this.$lis.not('.divider, .dropdown-header, .disabled, .hidden').toggleClass('selected', status),
|
1354
|
+
lisVisLen = $lisVisible.length,
|
1355
|
+
selectedOptions = [];
|
1356
|
+
|
1357
|
+
for (var i = 0; i < lisVisLen; i++) {
|
1358
|
+
var origIndex = $lisVisible[i].getAttribute('data-original-index');
|
1359
|
+
selectedOptions[selectedOptions.length] = $options.eq(origIndex)[0];
|
1360
|
+
}
|
1361
|
+
|
1362
|
+
$(selectedOptions).prop('selected', status);
|
1363
|
+
|
1364
|
+
this.render(false);
|
1365
|
+
},
|
1366
|
+
|
1367
|
+
selectAll: function () {
|
1368
|
+
return this.changeAll(true);
|
1369
|
+
},
|
1370
|
+
|
1371
|
+
deselectAll: function () {
|
1372
|
+
return this.changeAll(false);
|
1373
|
+
},
|
1374
|
+
|
1375
|
+
keydown: function (e) {
|
1376
|
+
var $this = $(this),
|
1377
|
+
$parent = $this.is('input') ? $this.parent().parent() : $this.parent(),
|
1378
|
+
$items,
|
1379
|
+
that = $parent.data('this'),
|
1380
|
+
index,
|
1381
|
+
next,
|
1382
|
+
first,
|
1383
|
+
last,
|
1384
|
+
prev,
|
1385
|
+
nextPrev,
|
1386
|
+
prevIndex,
|
1387
|
+
isActive,
|
1388
|
+
selector = ':not(.disabled, .hidden, .dropdown-header, .divider)',
|
1389
|
+
keyCodeMap = {
|
1390
|
+
32: ' ',
|
1391
|
+
48: '0',
|
1392
|
+
49: '1',
|
1393
|
+
50: '2',
|
1394
|
+
51: '3',
|
1395
|
+
52: '4',
|
1396
|
+
53: '5',
|
1397
|
+
54: '6',
|
1398
|
+
55: '7',
|
1399
|
+
56: '8',
|
1400
|
+
57: '9',
|
1401
|
+
59: ';',
|
1402
|
+
65: 'a',
|
1403
|
+
66: 'b',
|
1404
|
+
67: 'c',
|
1405
|
+
68: 'd',
|
1406
|
+
69: 'e',
|
1407
|
+
70: 'f',
|
1408
|
+
71: 'g',
|
1409
|
+
72: 'h',
|
1410
|
+
73: 'i',
|
1411
|
+
74: 'j',
|
1412
|
+
75: 'k',
|
1413
|
+
76: 'l',
|
1414
|
+
77: 'm',
|
1415
|
+
78: 'n',
|
1416
|
+
79: 'o',
|
1417
|
+
80: 'p',
|
1418
|
+
81: 'q',
|
1419
|
+
82: 'r',
|
1420
|
+
83: 's',
|
1421
|
+
84: 't',
|
1422
|
+
85: 'u',
|
1423
|
+
86: 'v',
|
1424
|
+
87: 'w',
|
1425
|
+
88: 'x',
|
1426
|
+
89: 'y',
|
1427
|
+
90: 'z',
|
1428
|
+
96: '0',
|
1429
|
+
97: '1',
|
1430
|
+
98: '2',
|
1431
|
+
99: '3',
|
1432
|
+
100: '4',
|
1433
|
+
101: '5',
|
1434
|
+
102: '6',
|
1435
|
+
103: '7',
|
1436
|
+
104: '8',
|
1437
|
+
105: '9'
|
1438
|
+
};
|
1439
|
+
|
1440
|
+
if (that.options.liveSearch) $parent = $this.parent().parent();
|
1441
|
+
|
1442
|
+
if (that.options.container) $parent = that.$menu;
|
1443
|
+
|
1444
|
+
$items = $('[role=menu] li', $parent);
|
1445
|
+
|
1446
|
+
isActive = that.$newElement.hasClass('open');
|
1447
|
+
|
1448
|
+
if (!isActive && (e.keyCode >= 48 && e.keyCode <= 57 || e.keyCode >= 96 && e.keyCode <= 105 || e.keyCode >= 65 && e.keyCode <= 90)) {
|
1449
|
+
if (!that.options.container) {
|
1450
|
+
that.setSize();
|
1451
|
+
that.$menu.parent().addClass('open');
|
1452
|
+
isActive = true;
|
1453
|
+
} else {
|
1454
|
+
that.$button.trigger('click');
|
1455
|
+
}
|
1456
|
+
that.$searchbox.focus();
|
1457
|
+
}
|
1458
|
+
|
1459
|
+
if (that.options.liveSearch) {
|
1460
|
+
if (/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && that.$menu.find('.active').length === 0) {
|
1461
|
+
e.preventDefault();
|
1462
|
+
that.$menu.parent().removeClass('open');
|
1463
|
+
if (that.options.container) that.$newElement.removeClass('open');
|
1464
|
+
that.$button.focus();
|
1465
|
+
}
|
1466
|
+
// $items contains li elements when liveSearch is enabled
|
1467
|
+
$items = $('[role=menu] li' + selector, $parent);
|
1468
|
+
if (!$this.val() && !/(38|40)/.test(e.keyCode.toString(10))) {
|
1469
|
+
if ($items.filter('.active').length === 0) {
|
1470
|
+
$items = that.$menuInner.find('li');
|
1471
|
+
if (that.options.liveSearchNormalize) {
|
1472
|
+
$items = $items.filter(':a' + that._searchStyle() + '(' + normalizeToBase(keyCodeMap[e.keyCode]) + ')');
|
1473
|
+
} else {
|
1474
|
+
$items = $items.filter(':' + that._searchStyle() + '(' + keyCodeMap[e.keyCode] + ')');
|
1475
|
+
}
|
1476
|
+
}
|
1477
|
+
}
|
1478
|
+
}
|
1479
|
+
|
1480
|
+
if (!$items.length) return;
|
1481
|
+
|
1482
|
+
if (/(38|40)/.test(e.keyCode.toString(10))) {
|
1483
|
+
index = $items.index($items.find('a').filter(':focus').parent());
|
1484
|
+
first = $items.filter(selector).first().index();
|
1485
|
+
last = $items.filter(selector).last().index();
|
1486
|
+
next = $items.eq(index).nextAll(selector).eq(0).index();
|
1487
|
+
prev = $items.eq(index).prevAll(selector).eq(0).index();
|
1488
|
+
nextPrev = $items.eq(next).prevAll(selector).eq(0).index();
|
1489
|
+
|
1490
|
+
if (that.options.liveSearch) {
|
1491
|
+
$items.each(function (i) {
|
1492
|
+
if (!$(this).hasClass('disabled')) {
|
1493
|
+
$(this).data('index', i);
|
1494
|
+
}
|
1495
|
+
});
|
1496
|
+
index = $items.index($items.filter('.active'));
|
1497
|
+
first = $items.first().data('index');
|
1498
|
+
last = $items.last().data('index');
|
1499
|
+
next = $items.eq(index).nextAll().eq(0).data('index');
|
1500
|
+
prev = $items.eq(index).prevAll().eq(0).data('index');
|
1501
|
+
nextPrev = $items.eq(next).prevAll().eq(0).data('index');
|
1502
|
+
}
|
1503
|
+
|
1504
|
+
prevIndex = $this.data('prevIndex');
|
1505
|
+
|
1506
|
+
if (e.keyCode == 38) {
|
1507
|
+
if (that.options.liveSearch) index--;
|
1508
|
+
if (index != nextPrev && index > prev) index = prev;
|
1509
|
+
if (index < first) index = first;
|
1510
|
+
if (index == prevIndex) index = last;
|
1511
|
+
} else if (e.keyCode == 40) {
|
1512
|
+
if (that.options.liveSearch) index++;
|
1513
|
+
if (index == -1) index = 0;
|
1514
|
+
if (index != nextPrev && index < next) index = next;
|
1515
|
+
if (index > last) index = last;
|
1516
|
+
if (index == prevIndex) index = first;
|
1517
|
+
}
|
1518
|
+
|
1519
|
+
$this.data('prevIndex', index);
|
1520
|
+
|
1521
|
+
if (!that.options.liveSearch) {
|
1522
|
+
$items.eq(index).children('a').focus();
|
1523
|
+
} else {
|
1524
|
+
e.preventDefault();
|
1525
|
+
if (!$this.hasClass('dropdown-toggle')) {
|
1526
|
+
$items.removeClass('active').eq(index).addClass('active').children('a').focus();
|
1527
|
+
$this.focus();
|
1528
|
+
}
|
1529
|
+
}
|
1530
|
+
|
1531
|
+
} else if (!$this.is('input')) {
|
1532
|
+
var keyIndex = [],
|
1533
|
+
count,
|
1534
|
+
prevKey;
|
1535
|
+
|
1536
|
+
$items.each(function () {
|
1537
|
+
if (!$(this).hasClass('disabled')) {
|
1538
|
+
if ($.trim($(this).children('a').text().toLowerCase()).substring(0, 1) == keyCodeMap[e.keyCode]) {
|
1539
|
+
keyIndex.push($(this).index());
|
1540
|
+
}
|
1541
|
+
}
|
1542
|
+
});
|
1543
|
+
|
1544
|
+
count = $(document).data('keycount');
|
1545
|
+
count++;
|
1546
|
+
$(document).data('keycount', count);
|
1547
|
+
|
1548
|
+
prevKey = $.trim($(':focus').text().toLowerCase()).substring(0, 1);
|
1549
|
+
|
1550
|
+
if (prevKey != keyCodeMap[e.keyCode]) {
|
1551
|
+
count = 1;
|
1552
|
+
$(document).data('keycount', count);
|
1553
|
+
} else if (count >= keyIndex.length) {
|
1554
|
+
$(document).data('keycount', 0);
|
1555
|
+
if (count > keyIndex.length) count = 1;
|
1556
|
+
}
|
1557
|
+
|
1558
|
+
$items.eq(keyIndex[count - 1]).children('a').focus();
|
1559
|
+
}
|
1560
|
+
|
1561
|
+
// Select focused option if "Enter", "Spacebar" or "Tab" (when selectOnTab is true) are pressed inside the menu.
|
1562
|
+
if ((/(13|32)/.test(e.keyCode.toString(10)) || (/(^9$)/.test(e.keyCode.toString(10)) && that.options.selectOnTab)) && isActive) {
|
1563
|
+
if (!/(32)/.test(e.keyCode.toString(10))) e.preventDefault();
|
1564
|
+
if (!that.options.liveSearch) {
|
1565
|
+
var elem = $(':focus');
|
1566
|
+
elem.click();
|
1567
|
+
// Bring back focus for multiselects
|
1568
|
+
elem.focus();
|
1569
|
+
// Prevent screen from scrolling if the user hit the spacebar
|
1570
|
+
e.preventDefault();
|
1571
|
+
// Fixes spacebar selection of dropdown items in FF & IE
|
1572
|
+
$(document).data('spaceSelect', true);
|
1573
|
+
} else if (!/(32)/.test(e.keyCode.toString(10))) {
|
1574
|
+
that.$menuInner.find('.active a').click();
|
1575
|
+
$this.focus();
|
1576
|
+
}
|
1577
|
+
$(document).data('keycount', 0);
|
1578
|
+
}
|
1579
|
+
|
1580
|
+
if ((/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && (that.multiple || that.options.liveSearch)) || (/(27)/.test(e.keyCode.toString(10)) && !isActive)) {
|
1581
|
+
that.$menu.parent().removeClass('open');
|
1582
|
+
if (that.options.container) that.$newElement.removeClass('open');
|
1583
|
+
that.$button.focus();
|
1584
|
+
}
|
1585
|
+
},
|
1586
|
+
|
1587
|
+
mobile: function () {
|
1588
|
+
this.$element.addClass('mobile-device');
|
1589
|
+
},
|
1590
|
+
|
1591
|
+
refresh: function () {
|
1592
|
+
this.$lis = null;
|
1593
|
+
this.liObj = {};
|
1594
|
+
this.reloadLi();
|
1595
|
+
this.render();
|
1596
|
+
this.checkDisabled();
|
1597
|
+
this.liHeight(true);
|
1598
|
+
this.setStyle();
|
1599
|
+
this.setWidth();
|
1600
|
+
if (this.$lis) this.$searchbox.trigger('propertychange');
|
1601
|
+
|
1602
|
+
this.$element.trigger('refreshed.bs.select');
|
1603
|
+
},
|
1604
|
+
|
1605
|
+
hide: function () {
|
1606
|
+
this.$newElement.hide();
|
1607
|
+
},
|
1608
|
+
|
1609
|
+
show: function () {
|
1610
|
+
this.$newElement.show();
|
1611
|
+
},
|
1612
|
+
|
1613
|
+
remove: function () {
|
1614
|
+
this.$newElement.remove();
|
1615
|
+
this.$element.remove();
|
1616
|
+
},
|
1617
|
+
|
1618
|
+
destroy: function () {
|
1619
|
+
this.$newElement.remove();
|
1620
|
+
|
1621
|
+
if (this.$bsContainer) {
|
1622
|
+
this.$bsContainer.remove();
|
1623
|
+
} else {
|
1624
|
+
this.$menu.remove();
|
1625
|
+
}
|
1626
|
+
|
1627
|
+
this.$element
|
1628
|
+
.off('.bs.select')
|
1629
|
+
.removeData('selectpicker')
|
1630
|
+
.removeClass('bs-select-hidden selectpicker');
|
1631
|
+
}
|
1632
|
+
};
|
1633
|
+
|
1634
|
+
// SELECTPICKER PLUGIN DEFINITION
|
1635
|
+
// ==============================
|
1636
|
+
function Plugin(option, event) {
|
1637
|
+
// get the args of the outer function..
|
1638
|
+
var args = arguments;
|
1639
|
+
// The arguments of the function are explicitly re-defined from the argument list, because the shift causes them
|
1640
|
+
// to get lost/corrupted in android 2.3 and IE9 #715 #775
|
1641
|
+
var _option = option,
|
1642
|
+
_event = event;
|
1643
|
+
[].shift.apply(args);
|
1644
|
+
|
1645
|
+
var value;
|
1646
|
+
var chain = this.each(function () {
|
1647
|
+
var $this = $(this);
|
1648
|
+
if ($this.is('select')) {
|
1649
|
+
var data = $this.data('selectpicker'),
|
1650
|
+
options = typeof _option == 'object' && _option;
|
1651
|
+
|
1652
|
+
if (!data) {
|
1653
|
+
var config = $.extend({}, Selectpicker.DEFAULTS, $.fn.selectpicker.defaults || {}, $this.data(), options);
|
1654
|
+
config.template = $.extend({}, Selectpicker.DEFAULTS.template, ($.fn.selectpicker.defaults ? $.fn.selectpicker.defaults.template : {}), $this.data().template, options.template);
|
1655
|
+
$this.data('selectpicker', (data = new Selectpicker(this, config, _event)));
|
1656
|
+
} else if (options) {
|
1657
|
+
for (var i in options) {
|
1658
|
+
if (options.hasOwnProperty(i)) {
|
1659
|
+
data.options[i] = options[i];
|
1660
|
+
}
|
1661
|
+
}
|
1662
|
+
}
|
1663
|
+
|
1664
|
+
if (typeof _option == 'string') {
|
1665
|
+
if (data[_option] instanceof Function) {
|
1666
|
+
value = data[_option].apply(data, args);
|
1667
|
+
} else {
|
1668
|
+
value = data.options[_option];
|
1669
|
+
}
|
1670
|
+
}
|
1671
|
+
}
|
1672
|
+
});
|
1673
|
+
|
1674
|
+
if (typeof value !== 'undefined') {
|
1675
|
+
//noinspection JSUnusedAssignment
|
1676
|
+
return value;
|
1677
|
+
} else {
|
1678
|
+
return chain;
|
1679
|
+
}
|
1680
|
+
}
|
1681
|
+
|
1682
|
+
var old = $.fn.selectpicker;
|
1683
|
+
$.fn.selectpicker = Plugin;
|
1684
|
+
$.fn.selectpicker.Constructor = Selectpicker;
|
1685
|
+
|
1686
|
+
// SELECTPICKER NO CONFLICT
|
1687
|
+
// ========================
|
1688
|
+
$.fn.selectpicker.noConflict = function () {
|
1689
|
+
$.fn.selectpicker = old;
|
1690
|
+
return this;
|
1691
|
+
};
|
1692
|
+
|
1693
|
+
$(document)
|
1694
|
+
.data('keycount', 0)
|
1695
|
+
.on('keydown.bs.select', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input', Selectpicker.prototype.keydown)
|
1696
|
+
.on('focusin.modal', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input', function (e) {
|
1697
|
+
e.stopPropagation();
|
1698
|
+
});
|
1699
|
+
|
1700
|
+
// SELECTPICKER DATA-API
|
1701
|
+
// =====================
|
1702
|
+
$(window).on('load.bs.select.data-api', function () {
|
1703
|
+
$('.selectpicker').each(function () {
|
1704
|
+
var $selectpicker = $(this);
|
1705
|
+
Plugin.call($selectpicker, $selectpicker.data());
|
1706
|
+
})
|
1707
|
+
});
|
1708
|
+
})(jQuery);
|
1709
|
+
|
1710
|
+
|
1711
|
+
}));
|