phcthemes_admin_panel_pack 0.16.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/Rakefile +0 -5
- data/lib/phcthemes_admin_panel_pack/railtie.rb +4 -0
- data/lib/phcthemes_admin_panel_pack/version.rb +1 -1
- data/lib/phcthemes_admin_panel_pack.rb +1 -1
- metadata +10 -239
- data/app/assets/config/phcthemes_admin_panel_pack_manifest.js +0 -3
- data/app/assets/javascripts/common/backstretch/jquery.backstretch.js +0 -1602
- data/app/assets/javascripts/common/bootstrap/bootstrap.bundle.js +0 -7013
- data/app/assets/javascripts/common/bootstrap/bootstrap.three.js +0 -2377
- data/app/assets/javascripts/common/bootstrap-datepicker/bootstrap-datepicker.js +0 -2039
- data/app/assets/javascripts/common/bootstrap-markdown/bootstrap-markdown.js +0 -1390
- data/app/assets/javascripts/common/bootstrap-select/bootstrap-select.js +0 -3139
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-am_ET.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-am_ET.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-am_ET.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ar_AR.js +0 -51
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ar_AR.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ar_AR.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-bg_BG.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-bg_BG.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-bg_BG.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-cs_CZ.js +0 -39
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-cs_CZ.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-cs_CZ.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-da_DK.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-da_DK.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-da_DK.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-de_DE.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-de_DE.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-de_DE.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-en_US.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-en_US.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-en_US.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-es_CL.js +0 -39
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-es_CL.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-es_CL.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-es_ES.js +0 -39
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-es_ES.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-es_ES.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-et_EE.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-et_EE.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-et_EE.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-eu.js +0 -39
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-eu.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-eu.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fa_IR.js +0 -39
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fa_IR.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fa_IR.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fi_FI.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fi_FI.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fi_FI.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fr_FR.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fr_FR.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fr_FR.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-hr_HR.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-hr_HR.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-hr_HR.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-hu_HU.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-hu_HU.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-hu_HU.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-id_ID.js +0 -39
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-id_ID.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-id_ID.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-it_IT.js +0 -41
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-it_IT.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-it_IT.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ja_JP.js +0 -39
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ja_JP.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ja_JP.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-kh_KM.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-kh_KM.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-kh_KM.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ko_KR.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ko_KR.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ko_KR.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-lt_LT.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-lt_LT.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-lt_LT.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-lv_LV.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-lv_LV.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-lv_LV.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-nb_NO.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-nb_NO.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-nb_NO.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-nl_NL.js +0 -39
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-nl_NL.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-nl_NL.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pl_PL.js +0 -39
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pl_PL.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pl_PL.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pt_BR.js +0 -39
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pt_BR.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pt_BR.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pt_PT.js +0 -39
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pt_PT.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pt_PT.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ro_RO.js +0 -40
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ro_RO.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ro_RO.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ru_RU.js +0 -40
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ru_RU.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ru_RU.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sk_SK.js +0 -39
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sk_SK.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sk_SK.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sl_SI.js +0 -44
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sl_SI.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sl_SI.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sv_SE.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sv_SE.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sv_SE.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-tr_TR.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-tr_TR.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-tr_TR.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ua_UA.js +0 -39
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ua_UA.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ua_UA.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-vi_VN.js +0 -46
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-vi_VN.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-vi_VN.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-zh_CN.js +0 -39
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-zh_CN.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-zh_CN.min.js +0 -8
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-zh_TW.js +0 -39
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-zh_TW.js.map +0 -1
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-zh_TW.min.js +0 -8
- data/app/assets/javascripts/common/chartjs/chart.js +0 -14680
- data/app/assets/javascripts/common/custom/custom.js +0 -0
- data/app/assets/javascripts/common/datatables/datatables.js +0 -15310
- data/app/assets/javascripts/common/daterangepicker/daterangepicker.js +0 -1565
- data/app/assets/javascripts/common/fastclick/fastclick.js +0 -841
- data/app/assets/javascripts/common/flexslider/jquery.flexslider.js +0 -1252
- data/app/assets/javascripts/common/greenstock/greensock.js +0 -36
- data/app/assets/javascripts/common/icheck/icheck.js +0 -509
- data/app/assets/javascripts/common/imagesloaded/imagesloaded.pkgd.js +0 -497
- data/app/assets/javascripts/common/isotope/isotope.pkgd.js +0 -3563
- data/app/assets/javascripts/common/jquery/jquery-3.4.1.js +0 -10598
- data/app/assets/javascripts/common/jquery-countdown/jquery.countdown.js +0 -246
- data/app/assets/javascripts/common/jquery-filterizer/jquery.filterizr.min.js +0 -1
- data/app/assets/javascripts/common/jquery-jvectormap/jquery-jvectormap.js +0 -44
- data/app/assets/javascripts/common/jquery-placeholder/jquery.placeholder.js +0 -281
- data/app/assets/javascripts/common/jquery-slimscroll/jquery.slimscroll.js +0 -474
- data/app/assets/javascripts/common/jquery-sparkline/jquery.sparkline.js +0 -3054
- data/app/assets/javascripts/common/jquery-ui/jquery-ui.js +0 -18706
- data/app/assets/javascripts/common/jquery-validation/jquery.validate.js +0 -1650
- data/app/assets/javascripts/common/jqvmap/jquery.vmap.js +0 -1281
- data/app/assets/javascripts/common/jqvmap/jquery.vmap.min.js +0 -10
- data/app/assets/javascripts/common/jqvmap/maps/continents/jquery.vmap.africa.js +0 -2
- data/app/assets/javascripts/common/jqvmap/maps/continents/jquery.vmap.asia.js +0 -2
- data/app/assets/javascripts/common/jqvmap/maps/continents/jquery.vmap.australia.js +0 -2
- data/app/assets/javascripts/common/jqvmap/maps/continents/jquery.vmap.europe.js +0 -2
- data/app/assets/javascripts/common/jqvmap/maps/continents/jquery.vmap.north-america.js +0 -2
- data/app/assets/javascripts/common/jqvmap/maps/continents/jquery.vmap.south-america.js +0 -2
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.algeria.js +0 -2
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.argentina.js +0 -1
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.brazil.js +0 -2
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.canada.js +0 -2
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.europe.js +0 -2
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.france.js +0 -1
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.germany.js +0 -2
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.greece.js +0 -1
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.iran.js +0 -6
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.iraq.js +0 -1
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.russia.js +0 -2
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.tunisia.js +0 -2
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.turkey.js +0 -11
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.usa.js +0 -2
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.world.js +0 -2
- data/app/assets/javascripts/common/js-cookie/js.cookie.js +0 -165
- data/app/assets/javascripts/common/layerslider/layerslider.kreaturamedia.jquery.js +0 -13
- data/app/assets/javascripts/common/layerslider/layerslider.origami.js +0 -13
- data/app/assets/javascripts/common/layerslider/layerslider.timeline.js +0 -13
- data/app/assets/javascripts/common/layerslider/layerslider.transitions.js +0 -13
- data/app/assets/javascripts/common/leaflet/leaflet.js +0 -5
- data/app/assets/javascripts/common/magnific-popup/jquery.magnific-popup.js +0 -1860
- data/app/assets/javascripts/common/mapbox/mapbox.js +0 -51
- data/app/assets/javascripts/common/metismenu/metisMenu.js +0 -340
- data/app/assets/javascripts/common/moderizer/modernizr.js +0 -11
- data/app/assets/javascripts/common/owl-carousel/owl.carousel.js +0 -3448
- data/app/assets/javascripts/common/pace/pace.js +0 -935
- data/app/assets/javascripts/common/paroller/jquery.paroller.js +0 -228
- data/app/assets/javascripts/common/particlejs/particles.js +0 -1541
- data/app/assets/javascripts/common/perfect-scrollbar/perfect-scrollbar.common.js +0 -1318
- data/app/assets/javascripts/common/perfect-scrollbar/perfect-scrollbar.esm.js +0 -1316
- data/app/assets/javascripts/common/perfect-scrollbar/perfect-scrollbar.js +0 -1324
- data/app/assets/javascripts/common/plyr/plyr.js +0 -9137
- data/app/assets/javascripts/common/rangeslider/rangeslider.js +0 -498
- data/app/assets/javascripts/common/retina/retina.js +0 -100
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.actions.js +0 -386
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.carousel.js +0 -365
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.kenburn.js +0 -199
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.layeranimation.js +0 -2524
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.migration.js +0 -260
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.navigation.js +0 -1156
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.parallax.js +0 -465
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.slideanims.js +0 -1447
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.video.js +0 -1464
- data/app/assets/javascripts/common/rev-slider/jquery.themepunch.revolution.js +0 -3286
- data/app/assets/javascripts/common/rev-slider/jquery.themepunch.tools.min.js +0 -8710
- data/app/assets/javascripts/common/scrollup/jquery.scrollUp.js +0 -168
- data/app/assets/javascripts/common/select2/select2.full.js +0 -6597
- data/app/assets/javascripts/common/selectbox/jquery.selectBox.js +0 -1092
- data/app/assets/javascripts/common/smooth-scroll/SmoothScroll.js +0 -788
- data/app/assets/javascripts/common/spectrum/spectrum.js +0 -2323
- data/app/assets/javascripts/common/stepper/jquery.fs.stepper.js +0 -339
- data/app/assets/javascripts/common/swiper/swiper.js +0 -8124
- data/app/assets/javascripts/common/toaster/toastr.js +0 -476
- data/app/assets/javascripts/common/typed/typed.js +0 -1045
- data/app/assets/javascripts/common/visable/jquery.visible.js +0 -68
- data/app/assets/javascripts/common/waypoints/jquery.waypoints.js +0 -662
- data/app/assets/javascripts/phcthemes_admin_panel_pack_adminlte.js +0 -12
- data/app/assets/javascripts/phcthemes_admin_panel_pack_basic.js +0 -5
- data/app/assets/javascripts/phcthemes_admin_panel_pack_boomerang.js +0 -0
- data/app/assets/javascripts/phcthemes_admin_panel_pack_coloradmin.js +0 -10
- data/app/assets/javascripts/phcthemes_admin_panel_pack_inspinia.js +0 -10
- data/app/assets/javascripts/phcthemes_admin_panel_pack_metronic.js +0 -4
- data/app/assets/javascripts/phcthemes_admin_panel_pack_quilpro.js +0 -5
- data/app/assets/javascripts/phcthemes_admin_panel_pack_starlight.js +0 -5
- data/app/assets/javascripts/themes/adminlte/custom/custom.js +0 -0
- data/app/assets/javascripts/themes/adminlte/theme/adminlte.js +0 -1141
- data/app/assets/javascripts/themes/boomerang/custom/custom.1.js +0 -0
- data/app/assets/javascripts/themes/boomerang/custom/custom.js +0 -0
- data/app/assets/javascripts/themes/coloradmin/theme/apps.js +0 -1650
- data/app/assets/javascripts/themes/coloradmin/theme/default.js +0 -152
- data/app/assets/javascripts/themes/inspinia/custom/custom.js +0 -0
- data/app/assets/javascripts/themes/inspinia/theme/inspinia.js +0 -279
- data/app/assets/javascripts/themes/metronic/theme/scripts.bundle.js +0 -9916
- data/app/assets/javascripts/themes/metronic/theme/vendors.bundle.js +0 -91352
- data/app/assets/stylesheets/common/custom/custom.scss +0 -0
- data/app/assets/stylesheets/phcthemes_admin_panel_pack_adminlte.scss +0 -13
- data/app/assets/stylesheets/phcthemes_admin_panel_pack_basic.scss +0 -6
- data/app/assets/stylesheets/phcthemes_admin_panel_pack_boomerang.scss +0 -24
- data/app/assets/stylesheets/phcthemes_admin_panel_pack_coloradmin.scss +0 -15
- data/app/assets/stylesheets/phcthemes_admin_panel_pack_inspinia.scss +0 -15
- data/app/assets/stylesheets/phcthemes_admin_panel_pack_metronic.scss +0 -7
- data/app/assets/stylesheets/phcthemes_admin_panel_pack_quilpro.scss +0 -16
- data/app/assets/stylesheets/phcthemes_admin_panel_pack_starlight.scss +0 -12
- data/app/assets/stylesheets/themes/adminlte/custom/custom.scss +0 -0
- data/app/assets/stylesheets/themes/boomerang/custom/custom.scss +0 -0
- data/app/assets/stylesheets/themes/coloradmin/custom/custom.scss +0 -0
- data/lib/phcthemes_admin_panel_pack/engine.rb +0 -19
@@ -1,1650 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* jQuery Validation Plugin v1.19.0
|
3
|
-
*
|
4
|
-
* https://jqueryvalidation.org/
|
5
|
-
*
|
6
|
-
* Copyright (c) 2018 Jörn Zaefferer
|
7
|
-
* Released under the MIT license
|
8
|
-
*/
|
9
|
-
(function( factory ) {
|
10
|
-
if ( typeof define === "function" && define.amd ) {
|
11
|
-
define( ["jquery"], factory );
|
12
|
-
} else if (typeof module === "object" && module.exports) {
|
13
|
-
module.exports = factory( require( "jquery" ) );
|
14
|
-
} else {
|
15
|
-
factory( jQuery );
|
16
|
-
}
|
17
|
-
}(function( $ ) {
|
18
|
-
|
19
|
-
$.extend( $.fn, {
|
20
|
-
|
21
|
-
// https://jqueryvalidation.org/validate/
|
22
|
-
validate: function( options ) {
|
23
|
-
|
24
|
-
// If nothing is selected, return nothing; can't chain anyway
|
25
|
-
if ( !this.length ) {
|
26
|
-
if ( options && options.debug && window.console ) {
|
27
|
-
console.warn( "Nothing selected, can't validate, returning nothing." );
|
28
|
-
}
|
29
|
-
return;
|
30
|
-
}
|
31
|
-
|
32
|
-
// Check if a validator for this form was already created
|
33
|
-
var validator = $.data( this[ 0 ], "validator" );
|
34
|
-
if ( validator ) {
|
35
|
-
return validator;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Add novalidate tag if HTML5.
|
39
|
-
this.attr( "novalidate", "novalidate" );
|
40
|
-
|
41
|
-
validator = new $.validator( options, this[ 0 ] );
|
42
|
-
$.data( this[ 0 ], "validator", validator );
|
43
|
-
|
44
|
-
if ( validator.settings.onsubmit ) {
|
45
|
-
|
46
|
-
this.on( "click.validate", ":submit", function( event ) {
|
47
|
-
|
48
|
-
// Track the used submit button to properly handle scripted
|
49
|
-
// submits later.
|
50
|
-
validator.submitButton = event.currentTarget;
|
51
|
-
|
52
|
-
// Allow suppressing validation by adding a cancel class to the submit button
|
53
|
-
if ( $( this ).hasClass( "cancel" ) ) {
|
54
|
-
validator.cancelSubmit = true;
|
55
|
-
}
|
56
|
-
|
57
|
-
// Allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
|
58
|
-
if ( $( this ).attr( "formnovalidate" ) !== undefined ) {
|
59
|
-
validator.cancelSubmit = true;
|
60
|
-
}
|
61
|
-
} );
|
62
|
-
|
63
|
-
// Validate the form on submit
|
64
|
-
this.on( "submit.validate", function( event ) {
|
65
|
-
if ( validator.settings.debug ) {
|
66
|
-
|
67
|
-
// Prevent form submit to be able to see console output
|
68
|
-
event.preventDefault();
|
69
|
-
}
|
70
|
-
|
71
|
-
function handle() {
|
72
|
-
var hidden, result;
|
73
|
-
|
74
|
-
// Insert a hidden input as a replacement for the missing submit button
|
75
|
-
// The hidden input is inserted in two cases:
|
76
|
-
// - A user defined a `submitHandler`
|
77
|
-
// - There was a pending request due to `remote` method and `stopRequest()`
|
78
|
-
// was called to submit the form in case it's valid
|
79
|
-
if ( validator.submitButton && ( validator.settings.submitHandler || validator.formSubmitted ) ) {
|
80
|
-
hidden = $( "<input type='hidden'/>" )
|
81
|
-
.attr( "name", validator.submitButton.name )
|
82
|
-
.val( $( validator.submitButton ).val() )
|
83
|
-
.appendTo( validator.currentForm );
|
84
|
-
}
|
85
|
-
|
86
|
-
if ( validator.settings.submitHandler && !validator.settings.debug ) {
|
87
|
-
result = validator.settings.submitHandler.call( validator, validator.currentForm, event );
|
88
|
-
if ( hidden ) {
|
89
|
-
|
90
|
-
// And clean up afterwards; thanks to no-block-scope, hidden can be referenced
|
91
|
-
hidden.remove();
|
92
|
-
}
|
93
|
-
if ( result !== undefined ) {
|
94
|
-
return result;
|
95
|
-
}
|
96
|
-
return false;
|
97
|
-
}
|
98
|
-
return true;
|
99
|
-
}
|
100
|
-
|
101
|
-
// Prevent submit for invalid forms or custom submit handlers
|
102
|
-
if ( validator.cancelSubmit ) {
|
103
|
-
validator.cancelSubmit = false;
|
104
|
-
return handle();
|
105
|
-
}
|
106
|
-
if ( validator.form() ) {
|
107
|
-
if ( validator.pendingRequest ) {
|
108
|
-
validator.formSubmitted = true;
|
109
|
-
return false;
|
110
|
-
}
|
111
|
-
return handle();
|
112
|
-
} else {
|
113
|
-
validator.focusInvalid();
|
114
|
-
return false;
|
115
|
-
}
|
116
|
-
} );
|
117
|
-
}
|
118
|
-
|
119
|
-
return validator;
|
120
|
-
},
|
121
|
-
|
122
|
-
// https://jqueryvalidation.org/valid/
|
123
|
-
valid: function() {
|
124
|
-
var valid, validator, errorList;
|
125
|
-
|
126
|
-
if ( $( this[ 0 ] ).is( "form" ) ) {
|
127
|
-
valid = this.validate().form();
|
128
|
-
} else {
|
129
|
-
errorList = [];
|
130
|
-
valid = true;
|
131
|
-
validator = $( this[ 0 ].form ).validate();
|
132
|
-
this.each( function() {
|
133
|
-
valid = validator.element( this ) && valid;
|
134
|
-
if ( !valid ) {
|
135
|
-
errorList = errorList.concat( validator.errorList );
|
136
|
-
}
|
137
|
-
} );
|
138
|
-
validator.errorList = errorList;
|
139
|
-
}
|
140
|
-
return valid;
|
141
|
-
},
|
142
|
-
|
143
|
-
// https://jqueryvalidation.org/rules/
|
144
|
-
rules: function( command, argument ) {
|
145
|
-
var element = this[ 0 ],
|
146
|
-
isContentEditable = typeof this.attr( "contenteditable" ) !== "undefined" && this.attr( "contenteditable" ) !== "false",
|
147
|
-
settings, staticRules, existingRules, data, param, filtered;
|
148
|
-
|
149
|
-
// If nothing is selected, return empty object; can't chain anyway
|
150
|
-
if ( element == null ) {
|
151
|
-
return;
|
152
|
-
}
|
153
|
-
|
154
|
-
if ( !element.form && isContentEditable ) {
|
155
|
-
element.form = this.closest( "form" )[ 0 ];
|
156
|
-
element.name = this.attr( "name" );
|
157
|
-
}
|
158
|
-
|
159
|
-
if ( element.form == null ) {
|
160
|
-
return;
|
161
|
-
}
|
162
|
-
|
163
|
-
if ( command ) {
|
164
|
-
settings = $.data( element.form, "validator" ).settings;
|
165
|
-
staticRules = settings.rules;
|
166
|
-
existingRules = $.validator.staticRules( element );
|
167
|
-
switch ( command ) {
|
168
|
-
case "add":
|
169
|
-
$.extend( existingRules, $.validator.normalizeRule( argument ) );
|
170
|
-
|
171
|
-
// Remove messages from rules, but allow them to be set separately
|
172
|
-
delete existingRules.messages;
|
173
|
-
staticRules[ element.name ] = existingRules;
|
174
|
-
if ( argument.messages ) {
|
175
|
-
settings.messages[ element.name ] = $.extend( settings.messages[ element.name ], argument.messages );
|
176
|
-
}
|
177
|
-
break;
|
178
|
-
case "remove":
|
179
|
-
if ( !argument ) {
|
180
|
-
delete staticRules[ element.name ];
|
181
|
-
return existingRules;
|
182
|
-
}
|
183
|
-
filtered = {};
|
184
|
-
$.each( argument.split( /\s/ ), function( index, method ) {
|
185
|
-
filtered[ method ] = existingRules[ method ];
|
186
|
-
delete existingRules[ method ];
|
187
|
-
} );
|
188
|
-
return filtered;
|
189
|
-
}
|
190
|
-
}
|
191
|
-
|
192
|
-
data = $.validator.normalizeRules(
|
193
|
-
$.extend(
|
194
|
-
{},
|
195
|
-
$.validator.classRules( element ),
|
196
|
-
$.validator.attributeRules( element ),
|
197
|
-
$.validator.dataRules( element ),
|
198
|
-
$.validator.staticRules( element )
|
199
|
-
), element );
|
200
|
-
|
201
|
-
// Make sure required is at front
|
202
|
-
if ( data.required ) {
|
203
|
-
param = data.required;
|
204
|
-
delete data.required;
|
205
|
-
data = $.extend( { required: param }, data );
|
206
|
-
}
|
207
|
-
|
208
|
-
// Make sure remote is at back
|
209
|
-
if ( data.remote ) {
|
210
|
-
param = data.remote;
|
211
|
-
delete data.remote;
|
212
|
-
data = $.extend( data, { remote: param } );
|
213
|
-
}
|
214
|
-
|
215
|
-
return data;
|
216
|
-
}
|
217
|
-
} );
|
218
|
-
|
219
|
-
// Custom selectors
|
220
|
-
$.extend( $.expr.pseudos || $.expr[ ":" ], { // '|| $.expr[ ":" ]' here enables backwards compatibility to jQuery 1.7. Can be removed when dropping jQ 1.7.x support
|
221
|
-
|
222
|
-
// https://jqueryvalidation.org/blank-selector/
|
223
|
-
blank: function( a ) {
|
224
|
-
return !$.trim( "" + $( a ).val() );
|
225
|
-
},
|
226
|
-
|
227
|
-
// https://jqueryvalidation.org/filled-selector/
|
228
|
-
filled: function( a ) {
|
229
|
-
var val = $( a ).val();
|
230
|
-
return val !== null && !!$.trim( "" + val );
|
231
|
-
},
|
232
|
-
|
233
|
-
// https://jqueryvalidation.org/unchecked-selector/
|
234
|
-
unchecked: function( a ) {
|
235
|
-
return !$( a ).prop( "checked" );
|
236
|
-
}
|
237
|
-
} );
|
238
|
-
|
239
|
-
// Constructor for validator
|
240
|
-
$.validator = function( options, form ) {
|
241
|
-
this.settings = $.extend( true, {}, $.validator.defaults, options );
|
242
|
-
this.currentForm = form;
|
243
|
-
this.init();
|
244
|
-
};
|
245
|
-
|
246
|
-
// https://jqueryvalidation.org/jQuery.validator.format/
|
247
|
-
$.validator.format = function( source, params ) {
|
248
|
-
if ( arguments.length === 1 ) {
|
249
|
-
return function() {
|
250
|
-
var args = $.makeArray( arguments );
|
251
|
-
args.unshift( source );
|
252
|
-
return $.validator.format.apply( this, args );
|
253
|
-
};
|
254
|
-
}
|
255
|
-
if ( params === undefined ) {
|
256
|
-
return source;
|
257
|
-
}
|
258
|
-
if ( arguments.length > 2 && params.constructor !== Array ) {
|
259
|
-
params = $.makeArray( arguments ).slice( 1 );
|
260
|
-
}
|
261
|
-
if ( params.constructor !== Array ) {
|
262
|
-
params = [ params ];
|
263
|
-
}
|
264
|
-
$.each( params, function( i, n ) {
|
265
|
-
source = source.replace( new RegExp( "\\{" + i + "\\}", "g" ), function() {
|
266
|
-
return n;
|
267
|
-
} );
|
268
|
-
} );
|
269
|
-
return source;
|
270
|
-
};
|
271
|
-
|
272
|
-
$.extend( $.validator, {
|
273
|
-
|
274
|
-
defaults: {
|
275
|
-
messages: {},
|
276
|
-
groups: {},
|
277
|
-
rules: {},
|
278
|
-
errorClass: "error",
|
279
|
-
pendingClass: "pending",
|
280
|
-
validClass: "valid",
|
281
|
-
errorElement: "label",
|
282
|
-
focusCleanup: false,
|
283
|
-
focusInvalid: true,
|
284
|
-
errorContainer: $( [] ),
|
285
|
-
errorLabelContainer: $( [] ),
|
286
|
-
onsubmit: true,
|
287
|
-
ignore: ":hidden",
|
288
|
-
ignoreTitle: false,
|
289
|
-
onfocusin: function( element ) {
|
290
|
-
this.lastActive = element;
|
291
|
-
|
292
|
-
// Hide error label and remove error class on focus if enabled
|
293
|
-
if ( this.settings.focusCleanup ) {
|
294
|
-
if ( this.settings.unhighlight ) {
|
295
|
-
this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
|
296
|
-
}
|
297
|
-
this.hideThese( this.errorsFor( element ) );
|
298
|
-
}
|
299
|
-
},
|
300
|
-
onfocusout: function( element ) {
|
301
|
-
if ( !this.checkable( element ) && ( element.name in this.submitted || !this.optional( element ) ) ) {
|
302
|
-
this.element( element );
|
303
|
-
}
|
304
|
-
},
|
305
|
-
onkeyup: function( element, event ) {
|
306
|
-
|
307
|
-
// Avoid revalidate the field when pressing one of the following keys
|
308
|
-
// Shift => 16
|
309
|
-
// Ctrl => 17
|
310
|
-
// Alt => 18
|
311
|
-
// Caps lock => 20
|
312
|
-
// End => 35
|
313
|
-
// Home => 36
|
314
|
-
// Left arrow => 37
|
315
|
-
// Up arrow => 38
|
316
|
-
// Right arrow => 39
|
317
|
-
// Down arrow => 40
|
318
|
-
// Insert => 45
|
319
|
-
// Num lock => 144
|
320
|
-
// AltGr key => 225
|
321
|
-
var excludedKeys = [
|
322
|
-
16, 17, 18, 20, 35, 36, 37,
|
323
|
-
38, 39, 40, 45, 144, 225
|
324
|
-
];
|
325
|
-
|
326
|
-
if ( event.which === 9 && this.elementValue( element ) === "" || $.inArray( event.keyCode, excludedKeys ) !== -1 ) {
|
327
|
-
return;
|
328
|
-
} else if ( element.name in this.submitted || element.name in this.invalid ) {
|
329
|
-
this.element( element );
|
330
|
-
}
|
331
|
-
},
|
332
|
-
onclick: function( element ) {
|
333
|
-
|
334
|
-
// Click on selects, radiobuttons and checkboxes
|
335
|
-
if ( element.name in this.submitted ) {
|
336
|
-
this.element( element );
|
337
|
-
|
338
|
-
// Or option elements, check parent select in that case
|
339
|
-
} else if ( element.parentNode.name in this.submitted ) {
|
340
|
-
this.element( element.parentNode );
|
341
|
-
}
|
342
|
-
},
|
343
|
-
highlight: function( element, errorClass, validClass ) {
|
344
|
-
if ( element.type === "radio" ) {
|
345
|
-
this.findByName( element.name ).addClass( errorClass ).removeClass( validClass );
|
346
|
-
} else {
|
347
|
-
$( element ).addClass( errorClass ).removeClass( validClass );
|
348
|
-
}
|
349
|
-
},
|
350
|
-
unhighlight: function( element, errorClass, validClass ) {
|
351
|
-
if ( element.type === "radio" ) {
|
352
|
-
this.findByName( element.name ).removeClass( errorClass ).addClass( validClass );
|
353
|
-
} else {
|
354
|
-
$( element ).removeClass( errorClass ).addClass( validClass );
|
355
|
-
}
|
356
|
-
}
|
357
|
-
},
|
358
|
-
|
359
|
-
// https://jqueryvalidation.org/jQuery.validator.setDefaults/
|
360
|
-
setDefaults: function( settings ) {
|
361
|
-
$.extend( $.validator.defaults, settings );
|
362
|
-
},
|
363
|
-
|
364
|
-
messages: {
|
365
|
-
required: "This field is required.",
|
366
|
-
remote: "Please fix this field.",
|
367
|
-
email: "Please enter a valid email address.",
|
368
|
-
url: "Please enter a valid URL.",
|
369
|
-
date: "Please enter a valid date.",
|
370
|
-
dateISO: "Please enter a valid date (ISO).",
|
371
|
-
number: "Please enter a valid number.",
|
372
|
-
digits: "Please enter only digits.",
|
373
|
-
equalTo: "Please enter the same value again.",
|
374
|
-
maxlength: $.validator.format( "Please enter no more than {0} characters." ),
|
375
|
-
minlength: $.validator.format( "Please enter at least {0} characters." ),
|
376
|
-
rangelength: $.validator.format( "Please enter a value between {0} and {1} characters long." ),
|
377
|
-
range: $.validator.format( "Please enter a value between {0} and {1}." ),
|
378
|
-
max: $.validator.format( "Please enter a value less than or equal to {0}." ),
|
379
|
-
min: $.validator.format( "Please enter a value greater than or equal to {0}." ),
|
380
|
-
step: $.validator.format( "Please enter a multiple of {0}." )
|
381
|
-
},
|
382
|
-
|
383
|
-
autoCreateRanges: false,
|
384
|
-
|
385
|
-
prototype: {
|
386
|
-
|
387
|
-
init: function() {
|
388
|
-
this.labelContainer = $( this.settings.errorLabelContainer );
|
389
|
-
this.errorContext = this.labelContainer.length && this.labelContainer || $( this.currentForm );
|
390
|
-
this.containers = $( this.settings.errorContainer ).add( this.settings.errorLabelContainer );
|
391
|
-
this.submitted = {};
|
392
|
-
this.valueCache = {};
|
393
|
-
this.pendingRequest = 0;
|
394
|
-
this.pending = {};
|
395
|
-
this.invalid = {};
|
396
|
-
this.reset();
|
397
|
-
|
398
|
-
var currentForm = this.currentForm,
|
399
|
-
groups = ( this.groups = {} ),
|
400
|
-
rules;
|
401
|
-
$.each( this.settings.groups, function( key, value ) {
|
402
|
-
if ( typeof value === "string" ) {
|
403
|
-
value = value.split( /\s/ );
|
404
|
-
}
|
405
|
-
$.each( value, function( index, name ) {
|
406
|
-
groups[ name ] = key;
|
407
|
-
} );
|
408
|
-
} );
|
409
|
-
rules = this.settings.rules;
|
410
|
-
$.each( rules, function( key, value ) {
|
411
|
-
rules[ key ] = $.validator.normalizeRule( value );
|
412
|
-
} );
|
413
|
-
|
414
|
-
function delegate( event ) {
|
415
|
-
var isContentEditable = typeof $( this ).attr( "contenteditable" ) !== "undefined" && $( this ).attr( "contenteditable" ) !== "false";
|
416
|
-
|
417
|
-
// Set form expando on contenteditable
|
418
|
-
if ( !this.form && isContentEditable ) {
|
419
|
-
this.form = $( this ).closest( "form" )[ 0 ];
|
420
|
-
this.name = $( this ).attr( "name" );
|
421
|
-
}
|
422
|
-
|
423
|
-
// Ignore the element if it belongs to another form. This will happen mainly
|
424
|
-
// when setting the `form` attribute of an input to the id of another form.
|
425
|
-
if ( currentForm !== this.form ) {
|
426
|
-
return;
|
427
|
-
}
|
428
|
-
|
429
|
-
var validator = $.data( this.form, "validator" ),
|
430
|
-
eventType = "on" + event.type.replace( /^validate/, "" ),
|
431
|
-
settings = validator.settings;
|
432
|
-
if ( settings[ eventType ] && !$( this ).is( settings.ignore ) ) {
|
433
|
-
settings[ eventType ].call( validator, this, event );
|
434
|
-
}
|
435
|
-
}
|
436
|
-
|
437
|
-
$( this.currentForm )
|
438
|
-
.on( "focusin.validate focusout.validate keyup.validate",
|
439
|
-
":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], " +
|
440
|
-
"[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], " +
|
441
|
-
"[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], " +
|
442
|
-
"[type='radio'], [type='checkbox'], [contenteditable], [type='button']", delegate )
|
443
|
-
|
444
|
-
// Support: Chrome, oldIE
|
445
|
-
// "select" is provided as event.target when clicking a option
|
446
|
-
.on( "click.validate", "select, option, [type='radio'], [type='checkbox']", delegate );
|
447
|
-
|
448
|
-
if ( this.settings.invalidHandler ) {
|
449
|
-
$( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler );
|
450
|
-
}
|
451
|
-
},
|
452
|
-
|
453
|
-
// https://jqueryvalidation.org/Validator.form/
|
454
|
-
form: function() {
|
455
|
-
this.checkForm();
|
456
|
-
$.extend( this.submitted, this.errorMap );
|
457
|
-
this.invalid = $.extend( {}, this.errorMap );
|
458
|
-
if ( !this.valid() ) {
|
459
|
-
$( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
|
460
|
-
}
|
461
|
-
this.showErrors();
|
462
|
-
return this.valid();
|
463
|
-
},
|
464
|
-
|
465
|
-
checkForm: function() {
|
466
|
-
this.prepareForm();
|
467
|
-
for ( var i = 0, elements = ( this.currentElements = this.elements() ); elements[ i ]; i++ ) {
|
468
|
-
this.check( elements[ i ] );
|
469
|
-
}
|
470
|
-
return this.valid();
|
471
|
-
},
|
472
|
-
|
473
|
-
// https://jqueryvalidation.org/Validator.element/
|
474
|
-
element: function( element ) {
|
475
|
-
var cleanElement = this.clean( element ),
|
476
|
-
checkElement = this.validationTargetFor( cleanElement ),
|
477
|
-
v = this,
|
478
|
-
result = true,
|
479
|
-
rs, group;
|
480
|
-
|
481
|
-
if ( checkElement === undefined ) {
|
482
|
-
delete this.invalid[ cleanElement.name ];
|
483
|
-
} else {
|
484
|
-
this.prepareElement( checkElement );
|
485
|
-
this.currentElements = $( checkElement );
|
486
|
-
|
487
|
-
// If this element is grouped, then validate all group elements already
|
488
|
-
// containing a value
|
489
|
-
group = this.groups[ checkElement.name ];
|
490
|
-
if ( group ) {
|
491
|
-
$.each( this.groups, function( name, testgroup ) {
|
492
|
-
if ( testgroup === group && name !== checkElement.name ) {
|
493
|
-
cleanElement = v.validationTargetFor( v.clean( v.findByName( name ) ) );
|
494
|
-
if ( cleanElement && cleanElement.name in v.invalid ) {
|
495
|
-
v.currentElements.push( cleanElement );
|
496
|
-
result = v.check( cleanElement ) && result;
|
497
|
-
}
|
498
|
-
}
|
499
|
-
} );
|
500
|
-
}
|
501
|
-
|
502
|
-
rs = this.check( checkElement ) !== false;
|
503
|
-
result = result && rs;
|
504
|
-
if ( rs ) {
|
505
|
-
this.invalid[ checkElement.name ] = false;
|
506
|
-
} else {
|
507
|
-
this.invalid[ checkElement.name ] = true;
|
508
|
-
}
|
509
|
-
|
510
|
-
if ( !this.numberOfInvalids() ) {
|
511
|
-
|
512
|
-
// Hide error containers on last error
|
513
|
-
this.toHide = this.toHide.add( this.containers );
|
514
|
-
}
|
515
|
-
this.showErrors();
|
516
|
-
|
517
|
-
// Add aria-invalid status for screen readers
|
518
|
-
$( element ).attr( "aria-invalid", !rs );
|
519
|
-
}
|
520
|
-
|
521
|
-
return result;
|
522
|
-
},
|
523
|
-
|
524
|
-
// https://jqueryvalidation.org/Validator.showErrors/
|
525
|
-
showErrors: function( errors ) {
|
526
|
-
if ( errors ) {
|
527
|
-
var validator = this;
|
528
|
-
|
529
|
-
// Add items to error list and map
|
530
|
-
$.extend( this.errorMap, errors );
|
531
|
-
this.errorList = $.map( this.errorMap, function( message, name ) {
|
532
|
-
return {
|
533
|
-
message: message,
|
534
|
-
element: validator.findByName( name )[ 0 ]
|
535
|
-
};
|
536
|
-
} );
|
537
|
-
|
538
|
-
// Remove items from success list
|
539
|
-
this.successList = $.grep( this.successList, function( element ) {
|
540
|
-
return !( element.name in errors );
|
541
|
-
} );
|
542
|
-
}
|
543
|
-
if ( this.settings.showErrors ) {
|
544
|
-
this.settings.showErrors.call( this, this.errorMap, this.errorList );
|
545
|
-
} else {
|
546
|
-
this.defaultShowErrors();
|
547
|
-
}
|
548
|
-
},
|
549
|
-
|
550
|
-
// https://jqueryvalidation.org/Validator.resetForm/
|
551
|
-
resetForm: function() {
|
552
|
-
if ( $.fn.resetForm ) {
|
553
|
-
$( this.currentForm ).resetForm();
|
554
|
-
}
|
555
|
-
this.invalid = {};
|
556
|
-
this.submitted = {};
|
557
|
-
this.prepareForm();
|
558
|
-
this.hideErrors();
|
559
|
-
var elements = this.elements()
|
560
|
-
.removeData( "previousValue" )
|
561
|
-
.removeAttr( "aria-invalid" );
|
562
|
-
|
563
|
-
this.resetElements( elements );
|
564
|
-
},
|
565
|
-
|
566
|
-
resetElements: function( elements ) {
|
567
|
-
var i;
|
568
|
-
|
569
|
-
if ( this.settings.unhighlight ) {
|
570
|
-
for ( i = 0; elements[ i ]; i++ ) {
|
571
|
-
this.settings.unhighlight.call( this, elements[ i ],
|
572
|
-
this.settings.errorClass, "" );
|
573
|
-
this.findByName( elements[ i ].name ).removeClass( this.settings.validClass );
|
574
|
-
}
|
575
|
-
} else {
|
576
|
-
elements
|
577
|
-
.removeClass( this.settings.errorClass )
|
578
|
-
.removeClass( this.settings.validClass );
|
579
|
-
}
|
580
|
-
},
|
581
|
-
|
582
|
-
numberOfInvalids: function() {
|
583
|
-
return this.objectLength( this.invalid );
|
584
|
-
},
|
585
|
-
|
586
|
-
objectLength: function( obj ) {
|
587
|
-
/* jshint unused: false */
|
588
|
-
var count = 0,
|
589
|
-
i;
|
590
|
-
for ( i in obj ) {
|
591
|
-
|
592
|
-
// This check allows counting elements with empty error
|
593
|
-
// message as invalid elements
|
594
|
-
if ( obj[ i ] !== undefined && obj[ i ] !== null && obj[ i ] !== false ) {
|
595
|
-
count++;
|
596
|
-
}
|
597
|
-
}
|
598
|
-
return count;
|
599
|
-
},
|
600
|
-
|
601
|
-
hideErrors: function() {
|
602
|
-
this.hideThese( this.toHide );
|
603
|
-
},
|
604
|
-
|
605
|
-
hideThese: function( errors ) {
|
606
|
-
errors.not( this.containers ).text( "" );
|
607
|
-
this.addWrapper( errors ).hide();
|
608
|
-
},
|
609
|
-
|
610
|
-
valid: function() {
|
611
|
-
return this.size() === 0;
|
612
|
-
},
|
613
|
-
|
614
|
-
size: function() {
|
615
|
-
return this.errorList.length;
|
616
|
-
},
|
617
|
-
|
618
|
-
focusInvalid: function() {
|
619
|
-
if ( this.settings.focusInvalid ) {
|
620
|
-
try {
|
621
|
-
$( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || [] )
|
622
|
-
.filter( ":visible" )
|
623
|
-
.focus()
|
624
|
-
|
625
|
-
// Manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
|
626
|
-
.trigger( "focusin" );
|
627
|
-
} catch ( e ) {
|
628
|
-
|
629
|
-
// Ignore IE throwing errors when focusing hidden elements
|
630
|
-
}
|
631
|
-
}
|
632
|
-
},
|
633
|
-
|
634
|
-
findLastActive: function() {
|
635
|
-
var lastActive = this.lastActive;
|
636
|
-
return lastActive && $.grep( this.errorList, function( n ) {
|
637
|
-
return n.element.name === lastActive.name;
|
638
|
-
} ).length === 1 && lastActive;
|
639
|
-
},
|
640
|
-
|
641
|
-
elements: function() {
|
642
|
-
var validator = this,
|
643
|
-
rulesCache = {};
|
644
|
-
|
645
|
-
// Select all valid inputs inside the form (no submit or reset buttons)
|
646
|
-
return $( this.currentForm )
|
647
|
-
.find( "input, select, textarea, [contenteditable]" )
|
648
|
-
.not( ":submit, :reset, :image, :disabled" )
|
649
|
-
.not( this.settings.ignore )
|
650
|
-
.filter( function() {
|
651
|
-
var name = this.name || $( this ).attr( "name" ); // For contenteditable
|
652
|
-
var isContentEditable = typeof $( this ).attr( "contenteditable" ) !== "undefined" && $( this ).attr( "contenteditable" ) !== "false";
|
653
|
-
|
654
|
-
if ( !name && validator.settings.debug && window.console ) {
|
655
|
-
console.error( "%o has no name assigned", this );
|
656
|
-
}
|
657
|
-
|
658
|
-
// Set form expando on contenteditable
|
659
|
-
if ( isContentEditable ) {
|
660
|
-
this.form = $( this ).closest( "form" )[ 0 ];
|
661
|
-
this.name = name;
|
662
|
-
}
|
663
|
-
|
664
|
-
// Ignore elements that belong to other/nested forms
|
665
|
-
if ( this.form !== validator.currentForm ) {
|
666
|
-
return false;
|
667
|
-
}
|
668
|
-
|
669
|
-
// Select only the first element for each name, and only those with rules specified
|
670
|
-
if ( name in rulesCache || !validator.objectLength( $( this ).rules() ) ) {
|
671
|
-
return false;
|
672
|
-
}
|
673
|
-
|
674
|
-
rulesCache[ name ] = true;
|
675
|
-
return true;
|
676
|
-
} );
|
677
|
-
},
|
678
|
-
|
679
|
-
clean: function( selector ) {
|
680
|
-
return $( selector )[ 0 ];
|
681
|
-
},
|
682
|
-
|
683
|
-
errors: function() {
|
684
|
-
var errorClass = this.settings.errorClass.split( " " ).join( "." );
|
685
|
-
return $( this.settings.errorElement + "." + errorClass, this.errorContext );
|
686
|
-
},
|
687
|
-
|
688
|
-
resetInternals: function() {
|
689
|
-
this.successList = [];
|
690
|
-
this.errorList = [];
|
691
|
-
this.errorMap = {};
|
692
|
-
this.toShow = $( [] );
|
693
|
-
this.toHide = $( [] );
|
694
|
-
},
|
695
|
-
|
696
|
-
reset: function() {
|
697
|
-
this.resetInternals();
|
698
|
-
this.currentElements = $( [] );
|
699
|
-
},
|
700
|
-
|
701
|
-
prepareForm: function() {
|
702
|
-
this.reset();
|
703
|
-
this.toHide = this.errors().add( this.containers );
|
704
|
-
},
|
705
|
-
|
706
|
-
prepareElement: function( element ) {
|
707
|
-
this.reset();
|
708
|
-
this.toHide = this.errorsFor( element );
|
709
|
-
},
|
710
|
-
|
711
|
-
elementValue: function( element ) {
|
712
|
-
var $element = $( element ),
|
713
|
-
type = element.type,
|
714
|
-
isContentEditable = typeof $element.attr( "contenteditable" ) !== "undefined" && $element.attr( "contenteditable" ) !== "false",
|
715
|
-
val, idx;
|
716
|
-
|
717
|
-
if ( type === "radio" || type === "checkbox" ) {
|
718
|
-
return this.findByName( element.name ).filter( ":checked" ).val();
|
719
|
-
} else if ( type === "number" && typeof element.validity !== "undefined" ) {
|
720
|
-
return element.validity.badInput ? "NaN" : $element.val();
|
721
|
-
}
|
722
|
-
|
723
|
-
if ( isContentEditable ) {
|
724
|
-
val = $element.text();
|
725
|
-
} else {
|
726
|
-
val = $element.val();
|
727
|
-
}
|
728
|
-
|
729
|
-
if ( type === "file" ) {
|
730
|
-
|
731
|
-
// Modern browser (chrome & safari)
|
732
|
-
if ( val.substr( 0, 12 ) === "C:\\fakepath\\" ) {
|
733
|
-
return val.substr( 12 );
|
734
|
-
}
|
735
|
-
|
736
|
-
// Legacy browsers
|
737
|
-
// Unix-based path
|
738
|
-
idx = val.lastIndexOf( "/" );
|
739
|
-
if ( idx >= 0 ) {
|
740
|
-
return val.substr( idx + 1 );
|
741
|
-
}
|
742
|
-
|
743
|
-
// Windows-based path
|
744
|
-
idx = val.lastIndexOf( "\\" );
|
745
|
-
if ( idx >= 0 ) {
|
746
|
-
return val.substr( idx + 1 );
|
747
|
-
}
|
748
|
-
|
749
|
-
// Just the file name
|
750
|
-
return val;
|
751
|
-
}
|
752
|
-
|
753
|
-
if ( typeof val === "string" ) {
|
754
|
-
return val.replace( /\r/g, "" );
|
755
|
-
}
|
756
|
-
return val;
|
757
|
-
},
|
758
|
-
|
759
|
-
check: function( element ) {
|
760
|
-
element = this.validationTargetFor( this.clean( element ) );
|
761
|
-
|
762
|
-
var rules = $( element ).rules(),
|
763
|
-
rulesCount = $.map( rules, function( n, i ) {
|
764
|
-
return i;
|
765
|
-
} ).length,
|
766
|
-
dependencyMismatch = false,
|
767
|
-
val = this.elementValue( element ),
|
768
|
-
result, method, rule, normalizer;
|
769
|
-
|
770
|
-
// Prioritize the local normalizer defined for this element over the global one
|
771
|
-
// if the former exists, otherwise user the global one in case it exists.
|
772
|
-
if ( typeof rules.normalizer === "function" ) {
|
773
|
-
normalizer = rules.normalizer;
|
774
|
-
} else if ( typeof this.settings.normalizer === "function" ) {
|
775
|
-
normalizer = this.settings.normalizer;
|
776
|
-
}
|
777
|
-
|
778
|
-
// If normalizer is defined, then call it to retreive the changed value instead
|
779
|
-
// of using the real one.
|
780
|
-
// Note that `this` in the normalizer is `element`.
|
781
|
-
if ( normalizer ) {
|
782
|
-
val = normalizer.call( element, val );
|
783
|
-
|
784
|
-
// Delete the normalizer from rules to avoid treating it as a pre-defined method.
|
785
|
-
delete rules.normalizer;
|
786
|
-
}
|
787
|
-
|
788
|
-
for ( method in rules ) {
|
789
|
-
rule = { method: method, parameters: rules[ method ] };
|
790
|
-
try {
|
791
|
-
result = $.validator.methods[ method ].call( this, val, element, rule.parameters );
|
792
|
-
|
793
|
-
// If a method indicates that the field is optional and therefore valid,
|
794
|
-
// don't mark it as valid when there are no other rules
|
795
|
-
if ( result === "dependency-mismatch" && rulesCount === 1 ) {
|
796
|
-
dependencyMismatch = true;
|
797
|
-
continue;
|
798
|
-
}
|
799
|
-
dependencyMismatch = false;
|
800
|
-
|
801
|
-
if ( result === "pending" ) {
|
802
|
-
this.toHide = this.toHide.not( this.errorsFor( element ) );
|
803
|
-
return;
|
804
|
-
}
|
805
|
-
|
806
|
-
if ( !result ) {
|
807
|
-
this.formatAndAdd( element, rule );
|
808
|
-
return false;
|
809
|
-
}
|
810
|
-
} catch ( e ) {
|
811
|
-
if ( this.settings.debug && window.console ) {
|
812
|
-
console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e );
|
813
|
-
}
|
814
|
-
if ( e instanceof TypeError ) {
|
815
|
-
e.message += ". Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.";
|
816
|
-
}
|
817
|
-
|
818
|
-
throw e;
|
819
|
-
}
|
820
|
-
}
|
821
|
-
if ( dependencyMismatch ) {
|
822
|
-
return;
|
823
|
-
}
|
824
|
-
if ( this.objectLength( rules ) ) {
|
825
|
-
this.successList.push( element );
|
826
|
-
}
|
827
|
-
return true;
|
828
|
-
},
|
829
|
-
|
830
|
-
// Return the custom message for the given element and validation method
|
831
|
-
// specified in the element's HTML5 data attribute
|
832
|
-
// return the generic message if present and no method specific message is present
|
833
|
-
customDataMessage: function( element, method ) {
|
834
|
-
return $( element ).data( "msg" + method.charAt( 0 ).toUpperCase() +
|
835
|
-
method.substring( 1 ).toLowerCase() ) || $( element ).data( "msg" );
|
836
|
-
},
|
837
|
-
|
838
|
-
// Return the custom message for the given element name and validation method
|
839
|
-
customMessage: function( name, method ) {
|
840
|
-
var m = this.settings.messages[ name ];
|
841
|
-
return m && ( m.constructor === String ? m : m[ method ] );
|
842
|
-
},
|
843
|
-
|
844
|
-
// Return the first defined argument, allowing empty strings
|
845
|
-
findDefined: function() {
|
846
|
-
for ( var i = 0; i < arguments.length; i++ ) {
|
847
|
-
if ( arguments[ i ] !== undefined ) {
|
848
|
-
return arguments[ i ];
|
849
|
-
}
|
850
|
-
}
|
851
|
-
return undefined;
|
852
|
-
},
|
853
|
-
|
854
|
-
// The second parameter 'rule' used to be a string, and extended to an object literal
|
855
|
-
// of the following form:
|
856
|
-
// rule = {
|
857
|
-
// method: "method name",
|
858
|
-
// parameters: "the given method parameters"
|
859
|
-
// }
|
860
|
-
//
|
861
|
-
// The old behavior still supported, kept to maintain backward compatibility with
|
862
|
-
// old code, and will be removed in the next major release.
|
863
|
-
defaultMessage: function( element, rule ) {
|
864
|
-
if ( typeof rule === "string" ) {
|
865
|
-
rule = { method: rule };
|
866
|
-
}
|
867
|
-
|
868
|
-
var message = this.findDefined(
|
869
|
-
this.customMessage( element.name, rule.method ),
|
870
|
-
this.customDataMessage( element, rule.method ),
|
871
|
-
|
872
|
-
// 'title' is never undefined, so handle empty string as undefined
|
873
|
-
!this.settings.ignoreTitle && element.title || undefined,
|
874
|
-
$.validator.messages[ rule.method ],
|
875
|
-
"<strong>Warning: No message defined for " + element.name + "</strong>"
|
876
|
-
),
|
877
|
-
theregex = /\$?\{(\d+)\}/g;
|
878
|
-
if ( typeof message === "function" ) {
|
879
|
-
message = message.call( this, rule.parameters, element );
|
880
|
-
} else if ( theregex.test( message ) ) {
|
881
|
-
message = $.validator.format( message.replace( theregex, "{$1}" ), rule.parameters );
|
882
|
-
}
|
883
|
-
|
884
|
-
return message;
|
885
|
-
},
|
886
|
-
|
887
|
-
formatAndAdd: function( element, rule ) {
|
888
|
-
var message = this.defaultMessage( element, rule );
|
889
|
-
|
890
|
-
this.errorList.push( {
|
891
|
-
message: message,
|
892
|
-
element: element,
|
893
|
-
method: rule.method
|
894
|
-
} );
|
895
|
-
|
896
|
-
this.errorMap[ element.name ] = message;
|
897
|
-
this.submitted[ element.name ] = message;
|
898
|
-
},
|
899
|
-
|
900
|
-
addWrapper: function( toToggle ) {
|
901
|
-
if ( this.settings.wrapper ) {
|
902
|
-
toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
|
903
|
-
}
|
904
|
-
return toToggle;
|
905
|
-
},
|
906
|
-
|
907
|
-
defaultShowErrors: function() {
|
908
|
-
var i, elements, error;
|
909
|
-
for ( i = 0; this.errorList[ i ]; i++ ) {
|
910
|
-
error = this.errorList[ i ];
|
911
|
-
if ( this.settings.highlight ) {
|
912
|
-
this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
|
913
|
-
}
|
914
|
-
this.showLabel( error.element, error.message );
|
915
|
-
}
|
916
|
-
if ( this.errorList.length ) {
|
917
|
-
this.toShow = this.toShow.add( this.containers );
|
918
|
-
}
|
919
|
-
if ( this.settings.success ) {
|
920
|
-
for ( i = 0; this.successList[ i ]; i++ ) {
|
921
|
-
this.showLabel( this.successList[ i ] );
|
922
|
-
}
|
923
|
-
}
|
924
|
-
if ( this.settings.unhighlight ) {
|
925
|
-
for ( i = 0, elements = this.validElements(); elements[ i ]; i++ ) {
|
926
|
-
this.settings.unhighlight.call( this, elements[ i ], this.settings.errorClass, this.settings.validClass );
|
927
|
-
}
|
928
|
-
}
|
929
|
-
this.toHide = this.toHide.not( this.toShow );
|
930
|
-
this.hideErrors();
|
931
|
-
this.addWrapper( this.toShow ).show();
|
932
|
-
},
|
933
|
-
|
934
|
-
validElements: function() {
|
935
|
-
return this.currentElements.not( this.invalidElements() );
|
936
|
-
},
|
937
|
-
|
938
|
-
invalidElements: function() {
|
939
|
-
return $( this.errorList ).map( function() {
|
940
|
-
return this.element;
|
941
|
-
} );
|
942
|
-
},
|
943
|
-
|
944
|
-
showLabel: function( element, message ) {
|
945
|
-
var place, group, errorID, v,
|
946
|
-
error = this.errorsFor( element ),
|
947
|
-
elementID = this.idOrName( element ),
|
948
|
-
describedBy = $( element ).attr( "aria-describedby" );
|
949
|
-
|
950
|
-
if ( error.length ) {
|
951
|
-
|
952
|
-
// Refresh error/success class
|
953
|
-
error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
|
954
|
-
|
955
|
-
// Replace message on existing label
|
956
|
-
error.html( message );
|
957
|
-
} else {
|
958
|
-
|
959
|
-
// Create error element
|
960
|
-
error = $( "<" + this.settings.errorElement + ">" )
|
961
|
-
.attr( "id", elementID + "-error" )
|
962
|
-
.addClass( this.settings.errorClass )
|
963
|
-
.html( message || "" );
|
964
|
-
|
965
|
-
// Maintain reference to the element to be placed into the DOM
|
966
|
-
place = error;
|
967
|
-
if ( this.settings.wrapper ) {
|
968
|
-
|
969
|
-
// Make sure the element is visible, even in IE
|
970
|
-
// actually showing the wrapped element is handled elsewhere
|
971
|
-
place = error.hide().show().wrap( "<" + this.settings.wrapper + "/>" ).parent();
|
972
|
-
}
|
973
|
-
if ( this.labelContainer.length ) {
|
974
|
-
this.labelContainer.append( place );
|
975
|
-
} else if ( this.settings.errorPlacement ) {
|
976
|
-
this.settings.errorPlacement.call( this, place, $( element ) );
|
977
|
-
} else {
|
978
|
-
place.insertAfter( element );
|
979
|
-
}
|
980
|
-
|
981
|
-
// Link error back to the element
|
982
|
-
if ( error.is( "label" ) ) {
|
983
|
-
|
984
|
-
// If the error is a label, then associate using 'for'
|
985
|
-
error.attr( "for", elementID );
|
986
|
-
|
987
|
-
// If the element is not a child of an associated label, then it's necessary
|
988
|
-
// to explicitly apply aria-describedby
|
989
|
-
} else if ( error.parents( "label[for='" + this.escapeCssMeta( elementID ) + "']" ).length === 0 ) {
|
990
|
-
errorID = error.attr( "id" );
|
991
|
-
|
992
|
-
// Respect existing non-error aria-describedby
|
993
|
-
if ( !describedBy ) {
|
994
|
-
describedBy = errorID;
|
995
|
-
} else if ( !describedBy.match( new RegExp( "\\b" + this.escapeCssMeta( errorID ) + "\\b" ) ) ) {
|
996
|
-
|
997
|
-
// Add to end of list if not already present
|
998
|
-
describedBy += " " + errorID;
|
999
|
-
}
|
1000
|
-
$( element ).attr( "aria-describedby", describedBy );
|
1001
|
-
|
1002
|
-
// If this element is grouped, then assign to all elements in the same group
|
1003
|
-
group = this.groups[ element.name ];
|
1004
|
-
if ( group ) {
|
1005
|
-
v = this;
|
1006
|
-
$.each( v.groups, function( name, testgroup ) {
|
1007
|
-
if ( testgroup === group ) {
|
1008
|
-
$( "[name='" + v.escapeCssMeta( name ) + "']", v.currentForm )
|
1009
|
-
.attr( "aria-describedby", error.attr( "id" ) );
|
1010
|
-
}
|
1011
|
-
} );
|
1012
|
-
}
|
1013
|
-
}
|
1014
|
-
}
|
1015
|
-
if ( !message && this.settings.success ) {
|
1016
|
-
error.text( "" );
|
1017
|
-
if ( typeof this.settings.success === "string" ) {
|
1018
|
-
error.addClass( this.settings.success );
|
1019
|
-
} else {
|
1020
|
-
this.settings.success( error, element );
|
1021
|
-
}
|
1022
|
-
}
|
1023
|
-
this.toShow = this.toShow.add( error );
|
1024
|
-
},
|
1025
|
-
|
1026
|
-
errorsFor: function( element ) {
|
1027
|
-
var name = this.escapeCssMeta( this.idOrName( element ) ),
|
1028
|
-
describer = $( element ).attr( "aria-describedby" ),
|
1029
|
-
selector = "label[for='" + name + "'], label[for='" + name + "'] *";
|
1030
|
-
|
1031
|
-
// 'aria-describedby' should directly reference the error element
|
1032
|
-
if ( describer ) {
|
1033
|
-
selector = selector + ", #" + this.escapeCssMeta( describer )
|
1034
|
-
.replace( /\s+/g, ", #" );
|
1035
|
-
}
|
1036
|
-
|
1037
|
-
return this
|
1038
|
-
.errors()
|
1039
|
-
.filter( selector );
|
1040
|
-
},
|
1041
|
-
|
1042
|
-
// See https://api.jquery.com/category/selectors/, for CSS
|
1043
|
-
// meta-characters that should be escaped in order to be used with JQuery
|
1044
|
-
// as a literal part of a name/id or any selector.
|
1045
|
-
escapeCssMeta: function( string ) {
|
1046
|
-
return string.replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" );
|
1047
|
-
},
|
1048
|
-
|
1049
|
-
idOrName: function( element ) {
|
1050
|
-
return this.groups[ element.name ] || ( this.checkable( element ) ? element.name : element.id || element.name );
|
1051
|
-
},
|
1052
|
-
|
1053
|
-
validationTargetFor: function( element ) {
|
1054
|
-
|
1055
|
-
// If radio/checkbox, validate first element in group instead
|
1056
|
-
if ( this.checkable( element ) ) {
|
1057
|
-
element = this.findByName( element.name );
|
1058
|
-
}
|
1059
|
-
|
1060
|
-
// Always apply ignore filter
|
1061
|
-
return $( element ).not( this.settings.ignore )[ 0 ];
|
1062
|
-
},
|
1063
|
-
|
1064
|
-
checkable: function( element ) {
|
1065
|
-
return ( /radio|checkbox/i ).test( element.type );
|
1066
|
-
},
|
1067
|
-
|
1068
|
-
findByName: function( name ) {
|
1069
|
-
return $( this.currentForm ).find( "[name='" + this.escapeCssMeta( name ) + "']" );
|
1070
|
-
},
|
1071
|
-
|
1072
|
-
getLength: function( value, element ) {
|
1073
|
-
switch ( element.nodeName.toLowerCase() ) {
|
1074
|
-
case "select":
|
1075
|
-
return $( "option:selected", element ).length;
|
1076
|
-
case "input":
|
1077
|
-
if ( this.checkable( element ) ) {
|
1078
|
-
return this.findByName( element.name ).filter( ":checked" ).length;
|
1079
|
-
}
|
1080
|
-
}
|
1081
|
-
return value.length;
|
1082
|
-
},
|
1083
|
-
|
1084
|
-
depend: function( param, element ) {
|
1085
|
-
return this.dependTypes[ typeof param ] ? this.dependTypes[ typeof param ]( param, element ) : true;
|
1086
|
-
},
|
1087
|
-
|
1088
|
-
dependTypes: {
|
1089
|
-
"boolean": function( param ) {
|
1090
|
-
return param;
|
1091
|
-
},
|
1092
|
-
"string": function( param, element ) {
|
1093
|
-
return !!$( param, element.form ).length;
|
1094
|
-
},
|
1095
|
-
"function": function( param, element ) {
|
1096
|
-
return param( element );
|
1097
|
-
}
|
1098
|
-
},
|
1099
|
-
|
1100
|
-
optional: function( element ) {
|
1101
|
-
var val = this.elementValue( element );
|
1102
|
-
return !$.validator.methods.required.call( this, val, element ) && "dependency-mismatch";
|
1103
|
-
},
|
1104
|
-
|
1105
|
-
startRequest: function( element ) {
|
1106
|
-
if ( !this.pending[ element.name ] ) {
|
1107
|
-
this.pendingRequest++;
|
1108
|
-
$( element ).addClass( this.settings.pendingClass );
|
1109
|
-
this.pending[ element.name ] = true;
|
1110
|
-
}
|
1111
|
-
},
|
1112
|
-
|
1113
|
-
stopRequest: function( element, valid ) {
|
1114
|
-
this.pendingRequest--;
|
1115
|
-
|
1116
|
-
// Sometimes synchronization fails, make sure pendingRequest is never < 0
|
1117
|
-
if ( this.pendingRequest < 0 ) {
|
1118
|
-
this.pendingRequest = 0;
|
1119
|
-
}
|
1120
|
-
delete this.pending[ element.name ];
|
1121
|
-
$( element ).removeClass( this.settings.pendingClass );
|
1122
|
-
if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
|
1123
|
-
$( this.currentForm ).submit();
|
1124
|
-
|
1125
|
-
// Remove the hidden input that was used as a replacement for the
|
1126
|
-
// missing submit button. The hidden input is added by `handle()`
|
1127
|
-
// to ensure that the value of the used submit button is passed on
|
1128
|
-
// for scripted submits triggered by this method
|
1129
|
-
if ( this.submitButton ) {
|
1130
|
-
$( "input:hidden[name='" + this.submitButton.name + "']", this.currentForm ).remove();
|
1131
|
-
}
|
1132
|
-
|
1133
|
-
this.formSubmitted = false;
|
1134
|
-
} else if ( !valid && this.pendingRequest === 0 && this.formSubmitted ) {
|
1135
|
-
$( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
|
1136
|
-
this.formSubmitted = false;
|
1137
|
-
}
|
1138
|
-
},
|
1139
|
-
|
1140
|
-
previousValue: function( element, method ) {
|
1141
|
-
method = typeof method === "string" && method || "remote";
|
1142
|
-
|
1143
|
-
return $.data( element, "previousValue" ) || $.data( element, "previousValue", {
|
1144
|
-
old: null,
|
1145
|
-
valid: true,
|
1146
|
-
message: this.defaultMessage( element, { method: method } )
|
1147
|
-
} );
|
1148
|
-
},
|
1149
|
-
|
1150
|
-
// Cleans up all forms and elements, removes validator-specific events
|
1151
|
-
destroy: function() {
|
1152
|
-
this.resetForm();
|
1153
|
-
|
1154
|
-
$( this.currentForm )
|
1155
|
-
.off( ".validate" )
|
1156
|
-
.removeData( "validator" )
|
1157
|
-
.find( ".validate-equalTo-blur" )
|
1158
|
-
.off( ".validate-equalTo" )
|
1159
|
-
.removeClass( "validate-equalTo-blur" )
|
1160
|
-
.find( ".validate-lessThan-blur" )
|
1161
|
-
.off( ".validate-lessThan" )
|
1162
|
-
.removeClass( "validate-lessThan-blur" )
|
1163
|
-
.find( ".validate-lessThanEqual-blur" )
|
1164
|
-
.off( ".validate-lessThanEqual" )
|
1165
|
-
.removeClass( "validate-lessThanEqual-blur" )
|
1166
|
-
.find( ".validate-greaterThanEqual-blur" )
|
1167
|
-
.off( ".validate-greaterThanEqual" )
|
1168
|
-
.removeClass( "validate-greaterThanEqual-blur" )
|
1169
|
-
.find( ".validate-greaterThan-blur" )
|
1170
|
-
.off( ".validate-greaterThan" )
|
1171
|
-
.removeClass( "validate-greaterThan-blur" );
|
1172
|
-
}
|
1173
|
-
|
1174
|
-
},
|
1175
|
-
|
1176
|
-
classRuleSettings: {
|
1177
|
-
required: { required: true },
|
1178
|
-
email: { email: true },
|
1179
|
-
url: { url: true },
|
1180
|
-
date: { date: true },
|
1181
|
-
dateISO: { dateISO: true },
|
1182
|
-
number: { number: true },
|
1183
|
-
digits: { digits: true },
|
1184
|
-
creditcard: { creditcard: true }
|
1185
|
-
},
|
1186
|
-
|
1187
|
-
addClassRules: function( className, rules ) {
|
1188
|
-
if ( className.constructor === String ) {
|
1189
|
-
this.classRuleSettings[ className ] = rules;
|
1190
|
-
} else {
|
1191
|
-
$.extend( this.classRuleSettings, className );
|
1192
|
-
}
|
1193
|
-
},
|
1194
|
-
|
1195
|
-
classRules: function( element ) {
|
1196
|
-
var rules = {},
|
1197
|
-
classes = $( element ).attr( "class" );
|
1198
|
-
|
1199
|
-
if ( classes ) {
|
1200
|
-
$.each( classes.split( " " ), function() {
|
1201
|
-
if ( this in $.validator.classRuleSettings ) {
|
1202
|
-
$.extend( rules, $.validator.classRuleSettings[ this ] );
|
1203
|
-
}
|
1204
|
-
} );
|
1205
|
-
}
|
1206
|
-
return rules;
|
1207
|
-
},
|
1208
|
-
|
1209
|
-
normalizeAttributeRule: function( rules, type, method, value ) {
|
1210
|
-
|
1211
|
-
// Convert the value to a number for number inputs, and for text for backwards compability
|
1212
|
-
// allows type="date" and others to be compared as strings
|
1213
|
-
if ( /min|max|step/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
|
1214
|
-
value = Number( value );
|
1215
|
-
|
1216
|
-
// Support Opera Mini, which returns NaN for undefined minlength
|
1217
|
-
if ( isNaN( value ) ) {
|
1218
|
-
value = undefined;
|
1219
|
-
}
|
1220
|
-
}
|
1221
|
-
|
1222
|
-
if ( value || value === 0 ) {
|
1223
|
-
rules[ method ] = value;
|
1224
|
-
} else if ( type === method && type !== "range" ) {
|
1225
|
-
|
1226
|
-
// Exception: the jquery validate 'range' method
|
1227
|
-
// does not test for the html5 'range' type
|
1228
|
-
rules[ method ] = true;
|
1229
|
-
}
|
1230
|
-
},
|
1231
|
-
|
1232
|
-
attributeRules: function( element ) {
|
1233
|
-
var rules = {},
|
1234
|
-
$element = $( element ),
|
1235
|
-
type = element.getAttribute( "type" ),
|
1236
|
-
method, value;
|
1237
|
-
|
1238
|
-
for ( method in $.validator.methods ) {
|
1239
|
-
|
1240
|
-
// Support for <input required> in both html5 and older browsers
|
1241
|
-
if ( method === "required" ) {
|
1242
|
-
value = element.getAttribute( method );
|
1243
|
-
|
1244
|
-
// Some browsers return an empty string for the required attribute
|
1245
|
-
// and non-HTML5 browsers might have required="" markup
|
1246
|
-
if ( value === "" ) {
|
1247
|
-
value = true;
|
1248
|
-
}
|
1249
|
-
|
1250
|
-
// Force non-HTML5 browsers to return bool
|
1251
|
-
value = !!value;
|
1252
|
-
} else {
|
1253
|
-
value = $element.attr( method );
|
1254
|
-
}
|
1255
|
-
|
1256
|
-
this.normalizeAttributeRule( rules, type, method, value );
|
1257
|
-
}
|
1258
|
-
|
1259
|
-
// 'maxlength' may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs
|
1260
|
-
if ( rules.maxlength && /-1|2147483647|524288/.test( rules.maxlength ) ) {
|
1261
|
-
delete rules.maxlength;
|
1262
|
-
}
|
1263
|
-
|
1264
|
-
return rules;
|
1265
|
-
},
|
1266
|
-
|
1267
|
-
dataRules: function( element ) {
|
1268
|
-
var rules = {},
|
1269
|
-
$element = $( element ),
|
1270
|
-
type = element.getAttribute( "type" ),
|
1271
|
-
method, value;
|
1272
|
-
|
1273
|
-
for ( method in $.validator.methods ) {
|
1274
|
-
value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() );
|
1275
|
-
|
1276
|
-
// Cast empty attributes like `data-rule-required` to `true`
|
1277
|
-
if ( value === "" ) {
|
1278
|
-
value = true;
|
1279
|
-
}
|
1280
|
-
|
1281
|
-
this.normalizeAttributeRule( rules, type, method, value );
|
1282
|
-
}
|
1283
|
-
return rules;
|
1284
|
-
},
|
1285
|
-
|
1286
|
-
staticRules: function( element ) {
|
1287
|
-
var rules = {},
|
1288
|
-
validator = $.data( element.form, "validator" );
|
1289
|
-
|
1290
|
-
if ( validator.settings.rules ) {
|
1291
|
-
rules = $.validator.normalizeRule( validator.settings.rules[ element.name ] ) || {};
|
1292
|
-
}
|
1293
|
-
return rules;
|
1294
|
-
},
|
1295
|
-
|
1296
|
-
normalizeRules: function( rules, element ) {
|
1297
|
-
|
1298
|
-
// Handle dependency check
|
1299
|
-
$.each( rules, function( prop, val ) {
|
1300
|
-
|
1301
|
-
// Ignore rule when param is explicitly false, eg. required:false
|
1302
|
-
if ( val === false ) {
|
1303
|
-
delete rules[ prop ];
|
1304
|
-
return;
|
1305
|
-
}
|
1306
|
-
if ( val.param || val.depends ) {
|
1307
|
-
var keepRule = true;
|
1308
|
-
switch ( typeof val.depends ) {
|
1309
|
-
case "string":
|
1310
|
-
keepRule = !!$( val.depends, element.form ).length;
|
1311
|
-
break;
|
1312
|
-
case "function":
|
1313
|
-
keepRule = val.depends.call( element, element );
|
1314
|
-
break;
|
1315
|
-
}
|
1316
|
-
if ( keepRule ) {
|
1317
|
-
rules[ prop ] = val.param !== undefined ? val.param : true;
|
1318
|
-
} else {
|
1319
|
-
$.data( element.form, "validator" ).resetElements( $( element ) );
|
1320
|
-
delete rules[ prop ];
|
1321
|
-
}
|
1322
|
-
}
|
1323
|
-
} );
|
1324
|
-
|
1325
|
-
// Evaluate parameters
|
1326
|
-
$.each( rules, function( rule, parameter ) {
|
1327
|
-
rules[ rule ] = $.isFunction( parameter ) && rule !== "normalizer" ? parameter( element ) : parameter;
|
1328
|
-
} );
|
1329
|
-
|
1330
|
-
// Clean number parameters
|
1331
|
-
$.each( [ "minlength", "maxlength" ], function() {
|
1332
|
-
if ( rules[ this ] ) {
|
1333
|
-
rules[ this ] = Number( rules[ this ] );
|
1334
|
-
}
|
1335
|
-
} );
|
1336
|
-
$.each( [ "rangelength", "range" ], function() {
|
1337
|
-
var parts;
|
1338
|
-
if ( rules[ this ] ) {
|
1339
|
-
if ( $.isArray( rules[ this ] ) ) {
|
1340
|
-
rules[ this ] = [ Number( rules[ this ][ 0 ] ), Number( rules[ this ][ 1 ] ) ];
|
1341
|
-
} else if ( typeof rules[ this ] === "string" ) {
|
1342
|
-
parts = rules[ this ].replace( /[\[\]]/g, "" ).split( /[\s,]+/ );
|
1343
|
-
rules[ this ] = [ Number( parts[ 0 ] ), Number( parts[ 1 ] ) ];
|
1344
|
-
}
|
1345
|
-
}
|
1346
|
-
} );
|
1347
|
-
|
1348
|
-
if ( $.validator.autoCreateRanges ) {
|
1349
|
-
|
1350
|
-
// Auto-create ranges
|
1351
|
-
if ( rules.min != null && rules.max != null ) {
|
1352
|
-
rules.range = [ rules.min, rules.max ];
|
1353
|
-
delete rules.min;
|
1354
|
-
delete rules.max;
|
1355
|
-
}
|
1356
|
-
if ( rules.minlength != null && rules.maxlength != null ) {
|
1357
|
-
rules.rangelength = [ rules.minlength, rules.maxlength ];
|
1358
|
-
delete rules.minlength;
|
1359
|
-
delete rules.maxlength;
|
1360
|
-
}
|
1361
|
-
}
|
1362
|
-
|
1363
|
-
return rules;
|
1364
|
-
},
|
1365
|
-
|
1366
|
-
// Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
|
1367
|
-
normalizeRule: function( data ) {
|
1368
|
-
if ( typeof data === "string" ) {
|
1369
|
-
var transformed = {};
|
1370
|
-
$.each( data.split( /\s/ ), function() {
|
1371
|
-
transformed[ this ] = true;
|
1372
|
-
} );
|
1373
|
-
data = transformed;
|
1374
|
-
}
|
1375
|
-
return data;
|
1376
|
-
},
|
1377
|
-
|
1378
|
-
// https://jqueryvalidation.org/jQuery.validator.addMethod/
|
1379
|
-
addMethod: function( name, method, message ) {
|
1380
|
-
$.validator.methods[ name ] = method;
|
1381
|
-
$.validator.messages[ name ] = message !== undefined ? message : $.validator.messages[ name ];
|
1382
|
-
if ( method.length < 3 ) {
|
1383
|
-
$.validator.addClassRules( name, $.validator.normalizeRule( name ) );
|
1384
|
-
}
|
1385
|
-
},
|
1386
|
-
|
1387
|
-
// https://jqueryvalidation.org/jQuery.validator.methods/
|
1388
|
-
methods: {
|
1389
|
-
|
1390
|
-
// https://jqueryvalidation.org/required-method/
|
1391
|
-
required: function( value, element, param ) {
|
1392
|
-
|
1393
|
-
// Check if dependency is met
|
1394
|
-
if ( !this.depend( param, element ) ) {
|
1395
|
-
return "dependency-mismatch";
|
1396
|
-
}
|
1397
|
-
if ( element.nodeName.toLowerCase() === "select" ) {
|
1398
|
-
|
1399
|
-
// Could be an array for select-multiple or a string, both are fine this way
|
1400
|
-
var val = $( element ).val();
|
1401
|
-
return val && val.length > 0;
|
1402
|
-
}
|
1403
|
-
if ( this.checkable( element ) ) {
|
1404
|
-
return this.getLength( value, element ) > 0;
|
1405
|
-
}
|
1406
|
-
return value !== undefined && value !== null && value.length > 0;
|
1407
|
-
},
|
1408
|
-
|
1409
|
-
// https://jqueryvalidation.org/email-method/
|
1410
|
-
email: function( value, element ) {
|
1411
|
-
|
1412
|
-
// From https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address
|
1413
|
-
// Retrieved 2014-01-14
|
1414
|
-
// If you have a problem with this implementation, report a bug against the above spec
|
1415
|
-
// Or use custom methods to implement your own email validation
|
1416
|
-
return this.optional( element ) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value );
|
1417
|
-
},
|
1418
|
-
|
1419
|
-
// https://jqueryvalidation.org/url-method/
|
1420
|
-
url: function( value, element ) {
|
1421
|
-
|
1422
|
-
// Copyright (c) 2010-2013 Diego Perini, MIT licensed
|
1423
|
-
// https://gist.github.com/dperini/729294
|
1424
|
-
// see also https://mathiasbynens.be/demo/url-regex
|
1425
|
-
// modified to allow protocol-relative URLs
|
1426
|
-
return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value );
|
1427
|
-
},
|
1428
|
-
|
1429
|
-
// https://jqueryvalidation.org/date-method/
|
1430
|
-
date: ( function() {
|
1431
|
-
var called = false;
|
1432
|
-
|
1433
|
-
return function( value, element ) {
|
1434
|
-
if ( !called ) {
|
1435
|
-
called = true;
|
1436
|
-
if ( this.settings.debug && window.console ) {
|
1437
|
-
console.warn(
|
1438
|
-
"The `date` method is deprecated and will be removed in version '2.0.0'.\n" +
|
1439
|
-
"Please don't use it, since it relies on the Date constructor, which\n" +
|
1440
|
-
"behaves very differently across browsers and locales. Use `dateISO`\n" +
|
1441
|
-
"instead or one of the locale specific methods in `localizations/`\n" +
|
1442
|
-
"and `additional-methods.js`."
|
1443
|
-
);
|
1444
|
-
}
|
1445
|
-
}
|
1446
|
-
|
1447
|
-
return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
|
1448
|
-
};
|
1449
|
-
}() ),
|
1450
|
-
|
1451
|
-
// https://jqueryvalidation.org/dateISO-method/
|
1452
|
-
dateISO: function( value, element ) {
|
1453
|
-
return this.optional( element ) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test( value );
|
1454
|
-
},
|
1455
|
-
|
1456
|
-
// https://jqueryvalidation.org/number-method/
|
1457
|
-
number: function( value, element ) {
|
1458
|
-
return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value );
|
1459
|
-
},
|
1460
|
-
|
1461
|
-
// https://jqueryvalidation.org/digits-method/
|
1462
|
-
digits: function( value, element ) {
|
1463
|
-
return this.optional( element ) || /^\d+$/.test( value );
|
1464
|
-
},
|
1465
|
-
|
1466
|
-
// https://jqueryvalidation.org/minlength-method/
|
1467
|
-
minlength: function( value, element, param ) {
|
1468
|
-
var length = $.isArray( value ) ? value.length : this.getLength( value, element );
|
1469
|
-
return this.optional( element ) || length >= param;
|
1470
|
-
},
|
1471
|
-
|
1472
|
-
// https://jqueryvalidation.org/maxlength-method/
|
1473
|
-
maxlength: function( value, element, param ) {
|
1474
|
-
var length = $.isArray( value ) ? value.length : this.getLength( value, element );
|
1475
|
-
return this.optional( element ) || length <= param;
|
1476
|
-
},
|
1477
|
-
|
1478
|
-
// https://jqueryvalidation.org/rangelength-method/
|
1479
|
-
rangelength: function( value, element, param ) {
|
1480
|
-
var length = $.isArray( value ) ? value.length : this.getLength( value, element );
|
1481
|
-
return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
|
1482
|
-
},
|
1483
|
-
|
1484
|
-
// https://jqueryvalidation.org/min-method/
|
1485
|
-
min: function( value, element, param ) {
|
1486
|
-
return this.optional( element ) || value >= param;
|
1487
|
-
},
|
1488
|
-
|
1489
|
-
// https://jqueryvalidation.org/max-method/
|
1490
|
-
max: function( value, element, param ) {
|
1491
|
-
return this.optional( element ) || value <= param;
|
1492
|
-
},
|
1493
|
-
|
1494
|
-
// https://jqueryvalidation.org/range-method/
|
1495
|
-
range: function( value, element, param ) {
|
1496
|
-
return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] );
|
1497
|
-
},
|
1498
|
-
|
1499
|
-
// https://jqueryvalidation.org/step-method/
|
1500
|
-
step: function( value, element, param ) {
|
1501
|
-
var type = $( element ).attr( "type" ),
|
1502
|
-
errorMessage = "Step attribute on input type " + type + " is not supported.",
|
1503
|
-
supportedTypes = [ "text", "number", "range" ],
|
1504
|
-
re = new RegExp( "\\b" + type + "\\b" ),
|
1505
|
-
notSupported = type && !re.test( supportedTypes.join() ),
|
1506
|
-
decimalPlaces = function( num ) {
|
1507
|
-
var match = ( "" + num ).match( /(?:\.(\d+))?$/ );
|
1508
|
-
if ( !match ) {
|
1509
|
-
return 0;
|
1510
|
-
}
|
1511
|
-
|
1512
|
-
// Number of digits right of decimal point.
|
1513
|
-
return match[ 1 ] ? match[ 1 ].length : 0;
|
1514
|
-
},
|
1515
|
-
toInt = function( num ) {
|
1516
|
-
return Math.round( num * Math.pow( 10, decimals ) );
|
1517
|
-
},
|
1518
|
-
valid = true,
|
1519
|
-
decimals;
|
1520
|
-
|
1521
|
-
// Works only for text, number and range input types
|
1522
|
-
// TODO find a way to support input types date, datetime, datetime-local, month, time and week
|
1523
|
-
if ( notSupported ) {
|
1524
|
-
throw new Error( errorMessage );
|
1525
|
-
}
|
1526
|
-
|
1527
|
-
decimals = decimalPlaces( param );
|
1528
|
-
|
1529
|
-
// Value can't have too many decimals
|
1530
|
-
if ( decimalPlaces( value ) > decimals || toInt( value ) % toInt( param ) !== 0 ) {
|
1531
|
-
valid = false;
|
1532
|
-
}
|
1533
|
-
|
1534
|
-
return this.optional( element ) || valid;
|
1535
|
-
},
|
1536
|
-
|
1537
|
-
// https://jqueryvalidation.org/equalTo-method/
|
1538
|
-
equalTo: function( value, element, param ) {
|
1539
|
-
|
1540
|
-
// Bind to the blur event of the target in order to revalidate whenever the target field is updated
|
1541
|
-
var target = $( param );
|
1542
|
-
if ( this.settings.onfocusout && target.not( ".validate-equalTo-blur" ).length ) {
|
1543
|
-
target.addClass( "validate-equalTo-blur" ).on( "blur.validate-equalTo", function() {
|
1544
|
-
$( element ).valid();
|
1545
|
-
} );
|
1546
|
-
}
|
1547
|
-
return value === target.val();
|
1548
|
-
},
|
1549
|
-
|
1550
|
-
// https://jqueryvalidation.org/remote-method/
|
1551
|
-
remote: function( value, element, param, method ) {
|
1552
|
-
if ( this.optional( element ) ) {
|
1553
|
-
return "dependency-mismatch";
|
1554
|
-
}
|
1555
|
-
|
1556
|
-
method = typeof method === "string" && method || "remote";
|
1557
|
-
|
1558
|
-
var previous = this.previousValue( element, method ),
|
1559
|
-
validator, data, optionDataString;
|
1560
|
-
|
1561
|
-
if ( !this.settings.messages[ element.name ] ) {
|
1562
|
-
this.settings.messages[ element.name ] = {};
|
1563
|
-
}
|
1564
|
-
previous.originalMessage = previous.originalMessage || this.settings.messages[ element.name ][ method ];
|
1565
|
-
this.settings.messages[ element.name ][ method ] = previous.message;
|
1566
|
-
|
1567
|
-
param = typeof param === "string" && { url: param } || param;
|
1568
|
-
optionDataString = $.param( $.extend( { data: value }, param.data ) );
|
1569
|
-
if ( previous.old === optionDataString ) {
|
1570
|
-
return previous.valid;
|
1571
|
-
}
|
1572
|
-
|
1573
|
-
previous.old = optionDataString;
|
1574
|
-
validator = this;
|
1575
|
-
this.startRequest( element );
|
1576
|
-
data = {};
|
1577
|
-
data[ element.name ] = value;
|
1578
|
-
$.ajax( $.extend( true, {
|
1579
|
-
mode: "abort",
|
1580
|
-
port: "validate" + element.name,
|
1581
|
-
dataType: "json",
|
1582
|
-
data: data,
|
1583
|
-
context: validator.currentForm,
|
1584
|
-
success: function( response ) {
|
1585
|
-
var valid = response === true || response === "true",
|
1586
|
-
errors, message, submitted;
|
1587
|
-
|
1588
|
-
validator.settings.messages[ element.name ][ method ] = previous.originalMessage;
|
1589
|
-
if ( valid ) {
|
1590
|
-
submitted = validator.formSubmitted;
|
1591
|
-
validator.resetInternals();
|
1592
|
-
validator.toHide = validator.errorsFor( element );
|
1593
|
-
validator.formSubmitted = submitted;
|
1594
|
-
validator.successList.push( element );
|
1595
|
-
validator.invalid[ element.name ] = false;
|
1596
|
-
validator.showErrors();
|
1597
|
-
} else {
|
1598
|
-
errors = {};
|
1599
|
-
message = response || validator.defaultMessage( element, { method: method, parameters: value } );
|
1600
|
-
errors[ element.name ] = previous.message = message;
|
1601
|
-
validator.invalid[ element.name ] = true;
|
1602
|
-
validator.showErrors( errors );
|
1603
|
-
}
|
1604
|
-
previous.valid = valid;
|
1605
|
-
validator.stopRequest( element, valid );
|
1606
|
-
}
|
1607
|
-
}, param ) );
|
1608
|
-
return "pending";
|
1609
|
-
}
|
1610
|
-
}
|
1611
|
-
|
1612
|
-
} );
|
1613
|
-
|
1614
|
-
// Ajax mode: abort
|
1615
|
-
// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
|
1616
|
-
// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
|
1617
|
-
|
1618
|
-
var pendingRequests = {},
|
1619
|
-
ajax;
|
1620
|
-
|
1621
|
-
// Use a prefilter if available (1.5+)
|
1622
|
-
if ( $.ajaxPrefilter ) {
|
1623
|
-
$.ajaxPrefilter( function( settings, _, xhr ) {
|
1624
|
-
var port = settings.port;
|
1625
|
-
if ( settings.mode === "abort" ) {
|
1626
|
-
if ( pendingRequests[ port ] ) {
|
1627
|
-
pendingRequests[ port ].abort();
|
1628
|
-
}
|
1629
|
-
pendingRequests[ port ] = xhr;
|
1630
|
-
}
|
1631
|
-
} );
|
1632
|
-
} else {
|
1633
|
-
|
1634
|
-
// Proxy ajax
|
1635
|
-
ajax = $.ajax;
|
1636
|
-
$.ajax = function( settings ) {
|
1637
|
-
var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
|
1638
|
-
port = ( "port" in settings ? settings : $.ajaxSettings ).port;
|
1639
|
-
if ( mode === "abort" ) {
|
1640
|
-
if ( pendingRequests[ port ] ) {
|
1641
|
-
pendingRequests[ port ].abort();
|
1642
|
-
}
|
1643
|
-
pendingRequests[ port ] = ajax.apply( this, arguments );
|
1644
|
-
return pendingRequests[ port ];
|
1645
|
-
}
|
1646
|
-
return ajax.apply( this, arguments );
|
1647
|
-
};
|
1648
|
-
}
|
1649
|
-
return $;
|
1650
|
-
}));
|