repsheet_visualizer 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/repsheet_visualizer/application/app.rb +2 -2
- data/lib/repsheet_visualizer/application/public/javascripts/application.js +0 -4
- data/lib/repsheet_visualizer/application/views/activity.erb +5 -0
- data/lib/repsheet_visualizer/application/views/actors.erb +5 -0
- data/lib/repsheet_visualizer/application/views/breakdown.erb +5 -0
- data/lib/repsheet_visualizer/application/views/whitelist.erb +5 -0
- data/lib/repsheet_visualizer/application/views/worldview.erb +5 -0
- data/lib/repsheet_visualizer/version.rb +1 -1
- metadata +2 -289
- data/redesign/actor.html +0 -228
- data/redesign/chart-flot.html +0 -698
- data/redesign/chart-morris.html +0 -528
- data/redesign/chart-sparkline.html +0 -702
- data/redesign/css/App.css +0 -3436
- data/redesign/css/Login.css +0 -88
- data/redesign/css/bootstrap.min.css +0 -9
- data/redesign/css/custom.css +0 -0
- data/redesign/css/font-awesome.min.css +0 -395
- data/redesign/fonts/FontAwesome.otf +0 -0
- data/redesign/fonts/fontawesome-webfont.eot +0 -0
- data/redesign/fonts/fontawesome-webfont.svg +0 -414
- data/redesign/fonts/fontawesome-webfont.ttf +0 -0
- data/redesign/fonts/fontawesome-webfont.woff +0 -0
- data/redesign/fonts/glyphicons-halflings-regular.eot +0 -0
- data/redesign/fonts/glyphicons-halflings-regular.svg +0 -228
- data/redesign/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/redesign/fonts/glyphicons-halflings-regular.woff +0 -0
- data/redesign/form-extended.html +0 -1052
- data/redesign/form-regular.html +0 -863
- data/redesign/form-validation.html +0 -678
- data/redesign/img/avatars/avatar-1.jpg +0 -0
- data/redesign/img/avatars/avatar-2.jpg +0 -0
- data/redesign/img/avatars/avatar-large-1.jpg +0 -0
- data/redesign/img/avatars/avatar-large-2.jpg +0 -0
- data/redesign/img/gallery/zoom.png +0 -0
- data/redesign/img/jquery/handle-vertical.png +0 -0
- data/redesign/img/jquery/handle.png +0 -0
- data/redesign/img/layout/sidebar-bg.png +0 -0
- data/redesign/img/loaders/ajax-loader.gif +0 -0
- data/redesign/img/logos/logo-login.png +0 -0
- data/redesign/img/logos/logo.png +0 -0
- data/redesign/img/mockup.png +0 -0
- data/redesign/img/photos/blur-lg.jpg +0 -0
- data/redesign/img/photos/blur-sm.jpg +0 -0
- data/redesign/img/photos/clock-lg.jpg +0 -0
- data/redesign/img/photos/clock-sm.jpg +0 -0
- data/redesign/img/photos/lens-lg.jpg +0 -0
- data/redesign/img/photos/lens-sm.jpg +0 -0
- data/redesign/img/photos/map.png +0 -0
- data/redesign/img/photos/rust-lg.jpg +0 -0
- data/redesign/img/photos/rust-sm.jpg +0 -0
- data/redesign/img/pricing/label-editable.png +0 -0
- data/redesign/img/pricing/label-red.png +0 -0
- data/redesign/img/pricing/label-yellow.png +0 -0
- data/redesign/index.html +0 -328
- data/redesign/js/App.js +0 -372
- data/redesign/js/Login.js +0 -17
- data/redesign/js/demos/buttons.js +0 -7
- data/redesign/js/demos/calendar.js +0 -142
- data/redesign/js/demos/charts/flot/area.js +0 -73
- data/redesign/js/demos/charts/flot/chart1.js +0 -77
- data/redesign/js/demos/charts/flot/chart2.js +0 -70
- data/redesign/js/demos/charts/flot/chart3.js +0 -71
- data/redesign/js/demos/charts/flot/chart4.js +0 -69
- data/redesign/js/demos/charts/flot/donut.js +0 -49
- data/redesign/js/demos/charts/flot/horizontal.js +0 -56
- data/redesign/js/demos/charts/flot/line.js +0 -76
- data/redesign/js/demos/charts/flot/pie.js +0 -50
- data/redesign/js/demos/charts/flot/scatter.js +0 -62
- data/redesign/js/demos/charts/flot/stacked-area.js +0 -86
- data/redesign/js/demos/charts/flot/stacked-horizontal.js +0 -60
- data/redesign/js/demos/charts/flot/stacked-vertical.js +0 -75
- data/redesign/js/demos/charts/flot/vertical.js +0 -70
- data/redesign/js/demos/charts/morris/area.js +0 -28
- data/redesign/js/demos/charts/morris/bar.js +0 -29
- data/redesign/js/demos/charts/morris/donut.js +0 -26
- data/redesign/js/demos/charts/morris/line.js +0 -30
- data/redesign/js/demos/dashboard.js +0 -26
- data/redesign/js/demos/form-extended.js +0 -61
- data/redesign/js/demos/popups.js +0 -16
- data/redesign/js/demos/pricing.js +0 -10
- data/redesign/js/demos/sliders.js +0 -77
- data/redesign/js/libs/bootstrap.js +0 -1999
- data/redesign/js/libs/bootstrap.min.js +0 -6
- data/redesign/js/libs/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/redesign/js/libs/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/redesign/js/libs/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/redesign/js/libs/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/redesign/js/libs/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/redesign/js/libs/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/redesign/js/libs/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/redesign/js/libs/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/redesign/js/libs/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/redesign/js/libs/css/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- data/redesign/js/libs/css/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- data/redesign/js/libs/css/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
- data/redesign/js/libs/css/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
- data/redesign/js/libs/css/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
- data/redesign/js/libs/css/ui-lightness/jquery-ui-1.9.2.custom.css +0 -294
- data/redesign/js/libs/css/ui-lightness/jquery-ui-1.9.2.custom.min.css +0 -7
- data/redesign/js/libs/jquery-1.9.1.min.js +0 -5
- data/redesign/js/libs/jquery-ui-1.9.2.custom.min.js +0 -6
- data/redesign/js/libs/jquery.min.map +0 -1
- data/redesign/js/libs/raphael-2.1.2.min.js +0 -11
- data/redesign/js/plugins/autosize/jquery.autosize.min.js +0 -7
- data/redesign/js/plugins/datatables/DT_bootstrap.js +0 -148
- data/redesign/js/plugins/datatables/img/Sorting icons.psd +0 -0
- data/redesign/js/plugins/datatables/img/back_disabled.png +0 -0
- data/redesign/js/plugins/datatables/img/back_enabled.png +0 -0
- data/redesign/js/plugins/datatables/img/back_enabled_hover.png +0 -0
- data/redesign/js/plugins/datatables/img/datatable-row-openclose.png +0 -0
- data/redesign/js/plugins/datatables/img/favicon.ico +0 -0
- data/redesign/js/plugins/datatables/img/forward_disabled.png +0 -0
- data/redesign/js/plugins/datatables/img/forward_enabled.png +0 -0
- data/redesign/js/plugins/datatables/img/forward_enabled_hover.png +0 -0
- data/redesign/js/plugins/datatables/img/sort_asc.png +0 -0
- data/redesign/js/plugins/datatables/img/sort_asc_disabled.png +0 -0
- data/redesign/js/plugins/datatables/img/sort_both.png +0 -0
- data/redesign/js/plugins/datatables/img/sort_desc.png +0 -0
- data/redesign/js/plugins/datatables/img/sort_desc_disabled.png +0 -0
- data/redesign/js/plugins/datatables/jquery.dataTables.min.js +0 -155
- data/redesign/js/plugins/datepicker/bootstrap-datepicker.js +0 -1258
- data/redesign/js/plugins/datepicker/datepicker.css +0 -481
- data/redesign/js/plugins/datepicker/less/datepicker.less +0 -122
- data/redesign/js/plugins/fileupload/bootstrap-fileupload.css +0 -132
- data/redesign/js/plugins/fileupload/bootstrap-fileupload.js +0 -169
- data/redesign/js/plugins/fileupload/bootstrap-fileupload.min.css +0 -31
- data/redesign/js/plugins/fileupload/bootstrap-fileupload.min.js +0 -7
- data/redesign/js/plugins/flot/jquery.flot.js +0 -2599
- data/redesign/js/plugins/flot/jquery.flot.orderBars.js +0 -186
- data/redesign/js/plugins/flot/jquery.flot.pie.js +0 -750
- data/redesign/js/plugins/flot/jquery.flot.resize.js +0 -57
- data/redesign/js/plugins/flot/jquery.flot.stack.js +0 -184
- data/redesign/js/plugins/flot/jquery.flot.tooltip.min.js +0 -14
- data/redesign/js/plugins/fullcalendar/fullcalendar.css +0 -589
- data/redesign/js/plugins/fullcalendar/fullcalendar.js +0 -6110
- data/redesign/js/plugins/fullcalendar/fullcalendar.min.js +0 -7
- data/redesign/js/plugins/fullcalendar/fullcalendar.print.css +0 -32
- data/redesign/js/plugins/fullcalendar/gcal.js +0 -107
- data/redesign/js/plugins/howl/howl.js +0 -70
- data/redesign/js/plugins/howl/howl.min.js +0 -2
- data/redesign/js/plugins/icheck/jquery.icheck.js +0 -462
- data/redesign/js/plugins/icheck/jquery.icheck.min.js +0 -11
- data/redesign/js/plugins/icheck/skins/all.css +0 -61
- data/redesign/js/plugins/icheck/skins/flat/_all.css +0 -540
- data/redesign/js/plugins/icheck/skins/flat/aero.css +0 -54
- data/redesign/js/plugins/icheck/skins/flat/aero.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/aero@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/blue.css +0 -54
- data/redesign/js/plugins/icheck/skins/flat/blue.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/blue@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/flat.css +0 -54
- data/redesign/js/plugins/icheck/skins/flat/flat.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/flat@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/green.css +0 -54
- data/redesign/js/plugins/icheck/skins/flat/green.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/green@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/grey.css +0 -54
- data/redesign/js/plugins/icheck/skins/flat/grey.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/grey@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/orange.css +0 -54
- data/redesign/js/plugins/icheck/skins/flat/orange.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/orange@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/pink.css +0 -54
- data/redesign/js/plugins/icheck/skins/flat/pink.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/pink@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/purple.css +0 -54
- data/redesign/js/plugins/icheck/skins/flat/purple.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/purple@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/red.css +0 -54
- data/redesign/js/plugins/icheck/skins/flat/red.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/red@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/yellow.css +0 -54
- data/redesign/js/plugins/icheck/skins/flat/yellow.png +0 -0
- data/redesign/js/plugins/icheck/skins/flat/yellow@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/futurico/futurico.css +0 -54
- data/redesign/js/plugins/icheck/skins/futurico/futurico.png +0 -0
- data/redesign/js/plugins/icheck/skins/futurico/futurico@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/line/_all.css +0 -740
- data/redesign/js/plugins/icheck/skins/line/aero.css +0 -74
- data/redesign/js/plugins/icheck/skins/line/blue.css +0 -74
- data/redesign/js/plugins/icheck/skins/line/green.css +0 -74
- data/redesign/js/plugins/icheck/skins/line/grey.css +0 -74
- data/redesign/js/plugins/icheck/skins/line/line.css +0 -74
- data/redesign/js/plugins/icheck/skins/line/line.png +0 -0
- data/redesign/js/plugins/icheck/skins/line/line@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/line/orange.css +0 -74
- data/redesign/js/plugins/icheck/skins/line/pink.css +0 -74
- data/redesign/js/plugins/icheck/skins/line/purple.css +0 -74
- data/redesign/js/plugins/icheck/skins/line/red.css +0 -74
- data/redesign/js/plugins/icheck/skins/line/yellow.css +0 -74
- data/redesign/js/plugins/icheck/skins/minimal/_all.css +0 -600
- data/redesign/js/plugins/icheck/skins/minimal/aero.css +0 -60
- data/redesign/js/plugins/icheck/skins/minimal/aero.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/aero@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/blue.css +0 -60
- data/redesign/js/plugins/icheck/skins/minimal/blue.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/blue@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/green.css +0 -60
- data/redesign/js/plugins/icheck/skins/minimal/green.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/green@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/grey.css +0 -60
- data/redesign/js/plugins/icheck/skins/minimal/grey.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/grey@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/minimal.css +0 -60
- data/redesign/js/plugins/icheck/skins/minimal/minimal.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/minimal@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/orange.css +0 -60
- data/redesign/js/plugins/icheck/skins/minimal/orange.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/orange@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/pink.css +0 -60
- data/redesign/js/plugins/icheck/skins/minimal/pink.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/pink@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/purple.css +0 -60
- data/redesign/js/plugins/icheck/skins/minimal/purple.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/purple@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/red.css +0 -60
- data/redesign/js/plugins/icheck/skins/minimal/red.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/red@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/yellow.css +0 -60
- data/redesign/js/plugins/icheck/skins/minimal/yellow.png +0 -0
- data/redesign/js/plugins/icheck/skins/minimal/yellow@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/polaris/polaris.css +0 -60
- data/redesign/js/plugins/icheck/skins/polaris/polaris.png +0 -0
- data/redesign/js/plugins/icheck/skins/polaris/polaris@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/_all.css +0 -600
- data/redesign/js/plugins/icheck/skins/square/aero.css +0 -60
- data/redesign/js/plugins/icheck/skins/square/aero.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/aero@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/blue.css +0 -60
- data/redesign/js/plugins/icheck/skins/square/blue.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/blue@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/green.css +0 -60
- data/redesign/js/plugins/icheck/skins/square/green.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/green@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/grey.css +0 -60
- data/redesign/js/plugins/icheck/skins/square/grey.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/grey@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/orange.css +0 -60
- data/redesign/js/plugins/icheck/skins/square/orange.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/orange@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/pink.css +0 -60
- data/redesign/js/plugins/icheck/skins/square/pink.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/pink@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/purple.css +0 -60
- data/redesign/js/plugins/icheck/skins/square/purple.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/purple@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/red.css +0 -60
- data/redesign/js/plugins/icheck/skins/square/red.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/red@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/square.css +0 -60
- data/redesign/js/plugins/icheck/skins/square/square.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/square@2x.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/yellow.css +0 -60
- data/redesign/js/plugins/icheck/skins/square/yellow.png +0 -0
- data/redesign/js/plugins/icheck/skins/square/yellow@2x.png +0 -0
- data/redesign/js/plugins/magnific/jquery.magnific-popup.js +0 -2026
- data/redesign/js/plugins/magnific/jquery.magnific-popup.min.js +0 -4
- data/redesign/js/plugins/magnific/magnific-popup.css +0 -396
- data/redesign/js/plugins/morris/morris.css +0 -1
- data/redesign/js/plugins/morris/morris.min.js +0 -1
- data/redesign/js/plugins/parsley/parsley.js +0 -1363
- data/redesign/js/plugins/select2/select2-spinner.gif +0 -0
- data/redesign/js/plugins/select2/select2.css +0 -615
- data/redesign/js/plugins/select2/select2.js +0 -3217
- data/redesign/js/plugins/select2/select2.min.js +0 -22
- data/redesign/js/plugins/select2/select2.png +0 -0
- data/redesign/js/plugins/select2/select2x2.png +0 -0
- data/redesign/js/plugins/simplecolorpicker/jquery.simplecolorpicker.css +0 -98
- data/redesign/js/plugins/simplecolorpicker/jquery.simplecolorpicker.js +0 -211
- data/redesign/js/plugins/sparkline/jquery.sparkline.min.js +0 -5
- data/redesign/js/plugins/tableCheckable/jquery.tableCheckable.js +0 -122
- data/redesign/js/plugins/textarea-counter/jquery.textarea-counter.js +0 -163
- data/redesign/js/plugins/timepicker/bootstrap-timepicker.css +0 -121
- data/redesign/js/plugins/timepicker/bootstrap-timepicker.js +0 -893
- data/redesign/page-404.html +0 -446
- data/redesign/page-500.html +0 -453
- data/redesign/page-blank.html +0 -417
- data/redesign/page-calendar.html +0 -491
- data/redesign/page-gallery.html +0 -736
- data/redesign/page-invoice.html +0 -705
- data/redesign/page-login-social.html +0 -111
- data/redesign/page-login.html +0 -82
- data/redesign/page-pricing.html +0 -707
- data/redesign/page-settings.html +0 -665
- data/redesign/page-support.html +0 -825
- data/redesign/table-advanced.html +0 -1297
- data/redesign/table-basic.html +0 -777
- data/redesign/table-responsive.html +0 -720
- data/redesign/ui-buttons.html +0 -901
- data/redesign/ui-icons.html +0 -1392
- data/redesign/ui-popups.html +0 -781
- data/redesign/ui-portlets.html +0 -887
- data/redesign/ui-sliders.html +0 -520
- data/redesign/ui-tabs.html +0 -663
- data/redesign/ui-typography.html +0 -687
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*! Magnific Popup - v0.9.5 - 2013-08-21
|
|
2
|
-
* http://dimsemenov.com/plugins/magnific-popup/
|
|
3
|
-
* Copyright (c) 2013 Dmitry Semenov; */
|
|
4
|
-
(function(e){var t,i,n,o,a,r,s,l="Close",c="BeforeClose",d="AfterClose",u="BeforeAppend",p="MarkupParse",f="Open",m="Change",g="mfp",v="."+g,h="mfp-ready",C="mfp-removing",y="mfp-prevent-close",w=function(){},b=!!window.jQuery,I=e(window),x=function(e,i){t.ev.on(g+e+v,i)},k=function(t,i,n,o){var a=document.createElement("div");return a.className="mfp-"+t,n&&(a.innerHTML=n),o?i&&i.appendChild(a):(a=e(a),i&&a.appendTo(i)),a},T=function(i,n){t.ev.triggerHandler(g+i,n),t.st.callbacks&&(i=i.charAt(0).toLowerCase()+i.slice(1),t.st.callbacks[i]&&t.st.callbacks[i].apply(t,e.isArray(n)?n:[n]))},E=function(){(t.st.focus?t.content.find(t.st.focus).eq(0):t.wrap).focus()},S=function(i){return i===s&&t.currTemplate.closeBtn||(t.currTemplate.closeBtn=e(t.st.closeMarkup.replace("%title%",t.st.tClose)),s=i),t.currTemplate.closeBtn},P=function(){e.magnificPopup.instance||(t=new w,t.init(),e.magnificPopup.instance=t)},_=function(i){if(!e(i).hasClass(y)){var n=t.st.closeOnContentClick,o=t.st.closeOnBgClick;if(n&&o)return!0;if(!t.content||e(i).hasClass("mfp-close")||t.preloader&&i===t.preloader[0])return!0;if(i===t.content[0]||e.contains(t.content[0],i)){if(n)return!0}else if(o&&e.contains(document,i))return!0;return!1}},O=function(){var e=document.createElement("p").style,t=["ms","O","Moz","Webkit"];if(void 0!==e.transition)return!0;for(;t.length;)if(t.pop()+"Transition"in e)return!0;return!1};w.prototype={constructor:w,init:function(){var i=navigator.appVersion;t.isIE7=-1!==i.indexOf("MSIE 7."),t.isIE8=-1!==i.indexOf("MSIE 8."),t.isLowIE=t.isIE7||t.isIE8,t.isAndroid=/android/gi.test(i),t.isIOS=/iphone|ipad|ipod/gi.test(i),t.supportsTransition=O(),t.probablyMobile=t.isAndroid||t.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),n=e(document.body),o=e(document),t.popupsCache={}},open:function(i){var n;if(i.isObj===!1){t.items=i.items.toArray(),t.index=0;var a,s=i.items;for(n=0;s.length>n;n++)if(a=s[n],a.parsed&&(a=a.el[0]),a===i.el[0]){t.index=n;break}}else t.items=e.isArray(i.items)?i.items:[i.items],t.index=i.index||0;if(t.isOpen)return t.updateItemHTML(),void 0;t.types=[],r="",t.ev=i.mainEl&&i.mainEl.length?i.mainEl.eq(0):o,i.key?(t.popupsCache[i.key]||(t.popupsCache[i.key]={}),t.currTemplate=t.popupsCache[i.key]):t.currTemplate={},t.st=e.extend(!0,{},e.magnificPopup.defaults,i),t.fixedContentPos="auto"===t.st.fixedContentPos?!t.probablyMobile:t.st.fixedContentPos,t.st.modal&&(t.st.closeOnContentClick=!1,t.st.closeOnBgClick=!1,t.st.showCloseBtn=!1,t.st.enableEscapeKey=!1),t.bgOverlay||(t.bgOverlay=k("bg").on("click"+v,function(){t.close()}),t.wrap=k("wrap").attr("tabindex",-1).on("click"+v,function(e){_(e.target)&&t.close()}),t.container=k("container",t.wrap)),t.contentContainer=k("content"),t.st.preloader&&(t.preloader=k("preloader",t.container,t.st.tLoading));var l=e.magnificPopup.modules;for(n=0;l.length>n;n++){var c=l[n];c=c.charAt(0).toUpperCase()+c.slice(1),t["init"+c].call(t)}T("BeforeOpen"),t.st.showCloseBtn&&(t.st.closeBtnInside?(x(p,function(e,t,i,n){i.close_replaceWith=S(n.type)}),r+=" mfp-close-btn-in"):t.wrap.append(S())),t.st.alignTop&&(r+=" mfp-align-top"),t.fixedContentPos?t.wrap.css({overflow:t.st.overflowY,overflowX:"hidden",overflowY:t.st.overflowY}):t.wrap.css({top:I.scrollTop(),position:"absolute"}),(t.st.fixedBgPos===!1||"auto"===t.st.fixedBgPos&&!t.fixedContentPos)&&t.bgOverlay.css({height:o.height(),position:"absolute"}),t.st.enableEscapeKey&&o.on("keyup"+v,function(e){27===e.keyCode&&t.close()}),I.on("resize"+v,function(){t.updateSize()}),t.st.closeOnContentClick||(r+=" mfp-auto-cursor"),r&&t.wrap.addClass(r);var d=t.wH=I.height(),u={};if(t.fixedContentPos&&t._hasScrollBar(d)){var m=t._getScrollbarSize();m&&(u.paddingRight=m)}t.fixedContentPos&&(t.isIE7?e("body, html").css("overflow","hidden"):u.overflow="hidden");var g=t.st.mainClass;t.isIE7&&(g+=" mfp-ie7"),g&&t._addClassToMFP(g),t.updateItemHTML(),T("BuildControls"),e("html").css(u),t.bgOverlay.add(t.wrap).prependTo(document.body),t._lastFocusedEl=document.activeElement,setTimeout(function(){t.content?(t._addClassToMFP(h),E()):t.bgOverlay.addClass(h),o.on("focusin"+v,function(i){return i.target===t.wrap[0]||e.contains(t.wrap[0],i.target)?void 0:(E(),!1)})},16),t.isOpen=!0,t.updateSize(d),T(f)},close:function(){t.isOpen&&(T(c),t.isOpen=!1,t.st.removalDelay&&!t.isLowIE&&t.supportsTransition?(t._addClassToMFP(C),setTimeout(function(){t._close()},t.st.removalDelay)):t._close())},_close:function(){T(l);var i=C+" "+h+" ";if(t.bgOverlay.detach(),t.wrap.detach(),t.container.empty(),t.st.mainClass&&(i+=t.st.mainClass+" "),t._removeClassFromMFP(i),t.fixedContentPos){var n={paddingRight:""};t.isIE7?e("body, html").css("overflow",""):n.overflow="",e("html").css(n)}o.off("keyup"+v+" focusin"+v),t.ev.off(v),t.wrap.attr("class","mfp-wrap").removeAttr("style"),t.bgOverlay.attr("class","mfp-bg"),t.container.attr("class","mfp-container"),!t.st.showCloseBtn||t.st.closeBtnInside&&t.currTemplate[t.currItem.type]!==!0||t.currTemplate.closeBtn&&t.currTemplate.closeBtn.detach(),t._lastFocusedEl&&e(t._lastFocusedEl).focus(),t.currItem=null,t.content=null,t.currTemplate=null,t.prevHeight=0,T(d)},updateSize:function(e){if(t.isIOS){var i=document.documentElement.clientWidth/window.innerWidth,n=window.innerHeight*i;t.wrap.css("height",n),t.wH=n}else t.wH=e||I.height();t.fixedContentPos||t.wrap.css("height",t.wH),T("Resize")},updateItemHTML:function(){var i=t.items[t.index];t.contentContainer.detach(),t.content&&t.content.detach(),i.parsed||(i=t.parseEl(t.index));var n=i.type;if(T("BeforeChange",[t.currItem?t.currItem.type:"",n]),t.currItem=i,!t.currTemplate[n]){var o=t.st[n]?t.st[n].markup:!1;T("FirstMarkupParse",o),t.currTemplate[n]=o?e(o):!0}a&&a!==i.type&&t.container.removeClass("mfp-"+a+"-holder");var r=t["get"+n.charAt(0).toUpperCase()+n.slice(1)](i,t.currTemplate[n]);t.appendContent(r,n),i.preloaded=!0,T(m,i),a=i.type,t.container.prepend(t.contentContainer),T("AfterChange")},appendContent:function(e,i){t.content=e,e?t.st.showCloseBtn&&t.st.closeBtnInside&&t.currTemplate[i]===!0?t.content.find(".mfp-close").length||t.content.append(S()):t.content=e:t.content="",T(u),t.container.addClass("mfp-"+i+"-holder"),t.contentContainer.append(t.content)},parseEl:function(i){var n=t.items[i],o=n.type;if(n=n.tagName?{el:e(n)}:{data:n,src:n.src},n.el){for(var a=t.types,r=0;a.length>r;r++)if(n.el.hasClass("mfp-"+a[r])){o=a[r];break}n.src=n.el.attr("data-mfp-src"),n.src||(n.src=n.el.attr("href"))}return n.type=o||t.st.type||"inline",n.index=i,n.parsed=!0,t.items[i]=n,T("ElementParse",n),t.items[i]},addGroup:function(e,i){var n=function(n){n.mfpEl=this,t._openClick(n,e,i)};i||(i={});var o="click.magnificPopup";i.mainEl=e,i.items?(i.isObj=!0,e.off(o).on(o,n)):(i.isObj=!1,i.delegate?e.off(o).on(o,i.delegate,n):(i.items=e,e.off(o).on(o,n)))},_openClick:function(i,n,o){var a=void 0!==o.midClick?o.midClick:e.magnificPopup.defaults.midClick;if(a||2!==i.which&&!i.ctrlKey&&!i.metaKey){var r=void 0!==o.disableOn?o.disableOn:e.magnificPopup.defaults.disableOn;if(r)if(e.isFunction(r)){if(!r.call(t))return!0}else if(r>I.width())return!0;i.type&&(i.preventDefault(),t.isOpen&&i.stopPropagation()),o.el=e(i.mfpEl),o.delegate&&(o.items=n.find(o.delegate)),t.open(o)}},updateStatus:function(e,n){if(t.preloader){i!==e&&t.container.removeClass("mfp-s-"+i),n||"loading"!==e||(n=t.st.tLoading);var o={status:e,text:n};T("UpdateStatus",o),e=o.status,n=o.text,t.preloader.html(n),t.preloader.find("a").on("click",function(e){e.stopImmediatePropagation()}),t.container.addClass("mfp-s-"+e),i=e}},_addClassToMFP:function(e){t.bgOverlay.addClass(e),t.wrap.addClass(e)},_removeClassFromMFP:function(e){this.bgOverlay.removeClass(e),t.wrap.removeClass(e)},_hasScrollBar:function(e){return(t.isIE7?o.height():document.body.scrollHeight)>(e||I.height())},_parseMarkup:function(t,i,n){var o;n.data&&(i=e.extend(n.data,i)),T(p,[t,i,n]),e.each(i,function(e,i){if(void 0===i||i===!1)return!0;if(o=e.split("_"),o.length>1){var n=t.find(v+"-"+o[0]);if(n.length>0){var a=o[1];"replaceWith"===a?n[0]!==i[0]&&n.replaceWith(i):"img"===a?n.is("img")?n.attr("src",i):n.replaceWith('<img src="'+i+'" class="'+n.attr("class")+'" />'):n.attr(o[1],i)}}else t.find(v+"-"+e).html(i)})},_getScrollbarSize:function(){if(void 0===t.scrollbarSize){var e=document.createElement("div");e.id="mfp-sbm",e.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e),t.scrollbarSize=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return t.scrollbarSize}},e.magnificPopup={instance:null,proto:w.prototype,modules:[],open:function(e,t){return P(),e||(e={}),e.isObj=!0,e.index=t||0,this.instance.open(e)},close:function(){return e.magnificPopup.instance.close()},registerModule:function(t,i){i.options&&(e.magnificPopup.defaults[t]=i.options),e.extend(this.proto,i.proto),this.modules.push(t)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">×</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},e.fn.magnificPopup=function(i){P();var n=e(this);if("string"==typeof i)if("open"===i){var o,a=b?n.data("magnificPopup"):n[0].magnificPopup,r=parseInt(arguments[1],10)||0;a.items?o=a.items[r]:(o=n,a.delegate&&(o=o.find(a.delegate)),o=o.eq(r)),t._openClick({mfpEl:o},n,a)}else t.isOpen&&t[i].apply(t,Array.prototype.slice.call(arguments,1));else b?n.data("magnificPopup",i):n[0].magnificPopup=i,t.addGroup(n,i);return n};var z,M,B,H="inline",L=function(){B&&(M.after(B.addClass(z)).detach(),B=null)};e.magnificPopup.registerModule(H,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){t.types.push(H),x(l+"."+H,function(){L()})},getInline:function(i,n){if(L(),i.src){var o=t.st.inline,a=e(i.src);if(a.length){var r=a[0].parentNode;r&&r.tagName&&(M||(z=o.hiddenClass,M=k(z),z="mfp-"+z),B=a.after(M).detach().removeClass(z)),t.updateStatus("ready")}else t.updateStatus("error",o.tNotFound),a=e("<div>");return i.inlineElement=a,a}return t.updateStatus("ready"),t._parseMarkup(n,{},i),n}}});var A,F="ajax",j=function(){A&&n.removeClass(A)};e.magnificPopup.registerModule(F,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){t.types.push(F),A=t.st.ajax.cursor,x(l+"."+F,function(){j(),t.req&&t.req.abort()})},getAjax:function(i){A&&n.addClass(A),t.updateStatus("loading");var o=e.extend({url:i.src,success:function(n,o,a){var r={data:n,xhr:a};T("ParseAjax",r),t.appendContent(e(r.data),F),i.finished=!0,j(),E(),setTimeout(function(){t.wrap.addClass(h)},16),t.updateStatus("ready"),T("AjaxContentAdded")},error:function(){j(),i.finished=i.loadError=!0,t.updateStatus("error",t.st.ajax.tError.replace("%url%",i.src))}},t.st.ajax.settings);return t.req=e.ajax(o),""}}});var N,W=function(i){if(i.data&&void 0!==i.data.title)return i.data.title;var n=t.st.image.titleSrc;if(n){if(e.isFunction(n))return n.call(t,i);if(i.el)return i.el.attr(n)||""}return""};e.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><div class="mfp-img"></div><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var e=t.st.image,i=".image";t.types.push("image"),x(f+i,function(){"image"===t.currItem.type&&e.cursor&&n.addClass(e.cursor)}),x(l+i,function(){e.cursor&&n.removeClass(e.cursor),I.off("resize"+v)}),x("Resize"+i,t.resizeImage),t.isLowIE&&x("AfterChange",t.resizeImage)},resizeImage:function(){var e=t.currItem;if(e&&e.img&&t.st.image.verticalFit){var i=0;t.isLowIE&&(i=parseInt(e.img.css("padding-top"),10)+parseInt(e.img.css("padding-bottom"),10)),e.img.css("max-height",t.wH-i)}},_onImageHasSize:function(e){e.img&&(e.hasSize=!0,N&&clearInterval(N),e.isCheckingImgSize=!1,T("ImageHasSize",e),e.imgHidden&&(t.content&&t.content.removeClass("mfp-loading"),e.imgHidden=!1))},findImageSize:function(e){var i=0,n=e.img[0],o=function(a){N&&clearInterval(N),N=setInterval(function(){return n.naturalWidth>0?(t._onImageHasSize(e),void 0):(i>200&&clearInterval(N),i++,3===i?o(10):40===i?o(50):100===i&&o(500),void 0)},a)};o(1)},getImage:function(i,n){var o=0,a=function(){i&&(i.img[0].complete?(i.img.off(".mfploader"),i===t.currItem&&(t._onImageHasSize(i),t.updateStatus("ready")),i.hasSize=!0,i.loaded=!0,T("ImageLoadComplete")):(o++,200>o?setTimeout(a,100):r()))},r=function(){i&&(i.img.off(".mfploader"),i===t.currItem&&(t._onImageHasSize(i),t.updateStatus("error",s.tError.replace("%url%",i.src))),i.hasSize=!0,i.loaded=!0,i.loadError=!0)},s=t.st.image,l=n.find(".mfp-img");if(l.length){var c=document.createElement("img");c.className="mfp-img",i.img=e(c).on("load.mfploader",a).on("error.mfploader",r),c.src=i.src,l.is("img")&&(i.img=i.img.clone()),i.img[0].naturalWidth>0&&(i.hasSize=!0)}return t._parseMarkup(n,{title:W(i),img_replaceWith:i.img},i),t.resizeImage(),i.hasSize?(N&&clearInterval(N),i.loadError?(n.addClass("mfp-loading"),t.updateStatus("error",s.tError.replace("%url%",i.src))):(n.removeClass("mfp-loading"),t.updateStatus("ready")),n):(t.updateStatus("loading"),i.loading=!0,i.hasSize||(i.imgHidden=!0,n.addClass("mfp-loading"),t.findImageSize(i)),n)}}});var R,Z=function(){return void 0===R&&(R=void 0!==document.createElement("p").style.MozTransform),R};e.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(e){return e.is("img")?e:e.find("img")}},proto:{initZoom:function(){var e=t.st.zoom,i=".zoom";if(e.enabled&&t.supportsTransition){var n,o,a=e.duration,r=function(t){var i=t.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),n="all "+e.duration/1e3+"s "+e.easing,o={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},a="transition";return o["-webkit-"+a]=o["-moz-"+a]=o["-o-"+a]=o[a]=n,i.css(o),i},s=function(){t.content.css("visibility","visible")};x("BuildControls"+i,function(){if(t._allowZoom()){if(clearTimeout(n),t.content.css("visibility","hidden"),image=t._getItemToZoom(),!image)return s(),void 0;o=r(image),o.css(t._getOffset()),t.wrap.append(o),n=setTimeout(function(){o.css(t._getOffset(!0)),n=setTimeout(function(){s(),setTimeout(function(){o.remove(),image=o=null,T("ZoomAnimationEnded")},16)},a)},16)}}),x(c+i,function(){if(t._allowZoom()){if(clearTimeout(n),t.st.removalDelay=a,!image){if(image=t._getItemToZoom(),!image)return;o=r(image)}o.css(t._getOffset(!0)),t.wrap.append(o),t.content.css("visibility","hidden"),setTimeout(function(){o.css(t._getOffset())},16)}}),x(l+i,function(){t._allowZoom()&&(s(),o&&o.remove())})}},_allowZoom:function(){return"image"===t.currItem.type},_getItemToZoom:function(){return t.currItem.hasSize?t.currItem.img:!1},_getOffset:function(i){var n;n=i?t.currItem.img:t.st.zoom.opener(t.currItem.el||t.currItem);var o=n.offset(),a=parseInt(n.css("padding-top"),10),r=parseInt(n.css("padding-bottom"),10);o.top-=e(window).scrollTop()-a;var s={width:n.width(),height:(b?n.innerHeight():n[0].offsetHeight)-r-a};return Z()?s["-moz-transform"]=s.transform="translate("+o.left+"px,"+o.top+"px)":(s.left=o.left,s.top=o.top),s}}});var q="iframe",D="//about:blank",K=function(e){if(t.currTemplate[q]){var i=t.currTemplate[q].find("iframe");i.length&&(e||(i[0].src=D),t.isIE8&&i.css("display",e?"block":"none"))}};e.magnificPopup.registerModule(q,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){t.types.push(q),x("BeforeChange",function(e,t,i){t!==i&&(t===q?K():i===q&&K(!0))}),x(l+"."+q,function(){K()})},getIframe:function(i,n){var o=i.src,a=t.st.iframe;e.each(a.patterns,function(){return o.indexOf(this.index)>-1?(this.id&&(o="string"==typeof this.id?o.substr(o.lastIndexOf(this.id)+this.id.length,o.length):this.id.call(this,o)),o=this.src.replace("%id%",o),!1):void 0});var r={};return a.srcAction&&(r[a.srcAction]=o),t._parseMarkup(n,r,i),t.updateStatus("ready"),n}}});var Y=function(e){var i=t.items.length;return e>i-1?e-i:0>e?i+e:e},U=function(e,t,i){return e.replace("%curr%",t+1).replace("%total%",i)};e.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var i=t.st.gallery,n=".mfp-gallery",a=Boolean(e.fn.mfpFastClick);return t.direction=!0,i&&i.enabled?(r+=" mfp-gallery",x(f+n,function(){i.navigateByImgClick&&t.wrap.on("click"+n,".mfp-img",function(){return t.items.length>1?(t.next(),!1):void 0}),o.on("keydown"+n,function(e){37===e.keyCode?t.prev():39===e.keyCode&&t.next()})}),x("UpdateStatus"+n,function(e,i){i.text&&(i.text=U(i.text,t.currItem.index,t.items.length))}),x(p+n,function(e,n,o,a){var r=t.items.length;o.counter=r>1?U(i.tCounter,a.index,r):""}),x("BuildControls"+n,function(){if(t.items.length>1&&i.arrows&&!t.arrowLeft){var n=i.arrowMarkup,o=t.arrowLeft=e(n.replace("%title%",i.tPrev).replace("%dir%","left")).addClass(y),r=t.arrowRight=e(n.replace("%title%",i.tNext).replace("%dir%","right")).addClass(y),s=a?"mfpFastClick":"click";o[s](function(){t.prev()}),r[s](function(){t.next()}),t.isIE7&&(k("b",o[0],!1,!0),k("a",o[0],!1,!0),k("b",r[0],!1,!0),k("a",r[0],!1,!0)),t.container.append(o.add(r))}}),x(m+n,function(){t._preloadTimeout&&clearTimeout(t._preloadTimeout),t._preloadTimeout=setTimeout(function(){t.preloadNearbyImages(),t._preloadTimeout=null},16)}),x(l+n,function(){o.off(n),t.wrap.off("click"+n),t.arrowLeft&&a&&t.arrowLeft.add(t.arrowRight).destroyMfpFastClick(),t.arrowRight=t.arrowLeft=null}),void 0):!1},next:function(){t.direction=!0,t.index=Y(t.index+1),t.updateItemHTML()},prev:function(){t.direction=!1,t.index=Y(t.index-1),t.updateItemHTML()},goTo:function(e){t.direction=e>=t.index,t.index=e,t.updateItemHTML()},preloadNearbyImages:function(){var e,i=t.st.gallery.preload,n=Math.min(i[0],t.items.length),o=Math.min(i[1],t.items.length);for(e=1;(t.direction?o:n)>=e;e++)t._preloadItem(t.index+e);for(e=1;(t.direction?n:o)>=e;e++)t._preloadItem(t.index-e)},_preloadItem:function(i){if(i=Y(i),!t.items[i].preloaded){var n=t.items[i];n.parsed||(n=t.parseEl(i)),T("LazyLoad",n),"image"===n.type&&(n.img=e('<img class="mfp-img" />').on("load.mfploader",function(){n.hasSize=!0}).on("error.mfploader",function(){n.hasSize=!0,n.loadError=!0,T("LazyLoadError",n)}).attr("src",n.src)),n.preloaded=!0}}}});var G="retina";e.magnificPopup.registerModule(G,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var e=t.st.retina,i=e.ratio;i=isNaN(i)?i():i,i>1&&(x("ImageHasSize."+G,function(e,t){t.img.css({"max-width":t.img[0].naturalWidth/i,width:"100%"})}),x("ElementParse."+G,function(t,n){n.src=e.replaceSrc(n,i)}))}}}}),function(){var t=1e3,i="ontouchstart"in window,n=function(){I.off("touchmove"+a+" touchend"+a)},o="mfpFastClick",a="."+o;e.fn.mfpFastClick=function(o){return e(this).each(function(){var r,s=e(this);if(i){var l,c,d,u,p,f;s.on("touchstart"+a,function(e){u=!1,f=1,p=e.originalEvent?e.originalEvent.touches[0]:e.touches[0],c=p.clientX,d=p.clientY,I.on("touchmove"+a,function(e){p=e.originalEvent?e.originalEvent.touches:e.touches,f=p.length,p=p[0],(Math.abs(p.clientX-c)>10||Math.abs(p.clientY-d)>10)&&(u=!0,n())}).on("touchend"+a,function(e){n(),u||f>1||(r=!0,e.preventDefault(),clearTimeout(l),l=setTimeout(function(){r=!1},t),o())})})}s.on("click"+a,function(){r||o()})})},e.fn.destroyMfpFastClick=function(){e(this).off("touchstart"+a+" click"+a),i&&I.off("touchmove"+a+" touchend"+a)}}()})(window.jQuery||window.Zepto);
|
|
@@ -1,396 +0,0 @@
|
|
|
1
|
-
/* Magnific Popup CSS */
|
|
2
|
-
.mfp-bg {
|
|
3
|
-
top: 0;
|
|
4
|
-
left: 0;
|
|
5
|
-
width: 100%;
|
|
6
|
-
height: 100%;
|
|
7
|
-
z-index: 1042;
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
position: fixed;
|
|
10
|
-
background: #0b0b0b;
|
|
11
|
-
opacity: 0.8;
|
|
12
|
-
filter: alpha(opacity=80); }
|
|
13
|
-
|
|
14
|
-
.mfp-wrap {
|
|
15
|
-
top: 0;
|
|
16
|
-
left: 0;
|
|
17
|
-
width: 100%;
|
|
18
|
-
height: 100%;
|
|
19
|
-
z-index: 1043;
|
|
20
|
-
position: fixed;
|
|
21
|
-
outline: none !important;
|
|
22
|
-
-webkit-backface-visibility: hidden; }
|
|
23
|
-
|
|
24
|
-
.mfp-container {
|
|
25
|
-
text-align: center;
|
|
26
|
-
position: absolute;
|
|
27
|
-
width: 100%;
|
|
28
|
-
height: 100%;
|
|
29
|
-
left: 0;
|
|
30
|
-
top: 0;
|
|
31
|
-
padding: 0 8px;
|
|
32
|
-
-webkit-box-sizing: border-box;
|
|
33
|
-
-moz-box-sizing: border-box;
|
|
34
|
-
box-sizing: border-box; }
|
|
35
|
-
|
|
36
|
-
.mfp-container:before {
|
|
37
|
-
content: '';
|
|
38
|
-
display: inline-block;
|
|
39
|
-
height: 100%;
|
|
40
|
-
vertical-align: middle; }
|
|
41
|
-
|
|
42
|
-
.mfp-align-top .mfp-container:before {
|
|
43
|
-
display: none; }
|
|
44
|
-
|
|
45
|
-
.mfp-content {
|
|
46
|
-
position: relative;
|
|
47
|
-
display: inline-block;
|
|
48
|
-
vertical-align: middle;
|
|
49
|
-
margin: 0 auto;
|
|
50
|
-
text-align: left;
|
|
51
|
-
z-index: 1045; }
|
|
52
|
-
|
|
53
|
-
.mfp-inline-holder .mfp-content,
|
|
54
|
-
.mfp-ajax-holder .mfp-content {
|
|
55
|
-
width: 100%;
|
|
56
|
-
cursor: auto; }
|
|
57
|
-
|
|
58
|
-
.mfp-ajax-cur {
|
|
59
|
-
cursor: progress; }
|
|
60
|
-
|
|
61
|
-
.mfp-zoom-out-cur,
|
|
62
|
-
.mfp-zoom-out-cur .mfp-image-holder .mfp-close {
|
|
63
|
-
cursor: -moz-zoom-out;
|
|
64
|
-
cursor: -webkit-zoom-out;
|
|
65
|
-
cursor: zoom-out; }
|
|
66
|
-
|
|
67
|
-
.mfp-zoom {
|
|
68
|
-
cursor: pointer;
|
|
69
|
-
cursor: -webkit-zoom-in;
|
|
70
|
-
cursor: -moz-zoom-in;
|
|
71
|
-
cursor: zoom-in; }
|
|
72
|
-
|
|
73
|
-
.mfp-auto-cursor .mfp-content {
|
|
74
|
-
cursor: auto; }
|
|
75
|
-
|
|
76
|
-
.mfp-close,
|
|
77
|
-
.mfp-arrow,
|
|
78
|
-
.mfp-preloader,
|
|
79
|
-
.mfp-counter {
|
|
80
|
-
-webkit-user-select: none;
|
|
81
|
-
-moz-user-select: none;
|
|
82
|
-
user-select: none; }
|
|
83
|
-
|
|
84
|
-
.mfp-loading.mfp-figure {
|
|
85
|
-
display: none; }
|
|
86
|
-
|
|
87
|
-
.mfp-hide {
|
|
88
|
-
display: none !important; }
|
|
89
|
-
|
|
90
|
-
.mfp-preloader {
|
|
91
|
-
color: #cccccc;
|
|
92
|
-
position: absolute;
|
|
93
|
-
top: 50%;
|
|
94
|
-
width: auto;
|
|
95
|
-
text-align: center;
|
|
96
|
-
margin-top: -0.8em;
|
|
97
|
-
left: 8px;
|
|
98
|
-
right: 8px;
|
|
99
|
-
z-index: 1044; }
|
|
100
|
-
|
|
101
|
-
.mfp-preloader a {
|
|
102
|
-
color: #cccccc; }
|
|
103
|
-
|
|
104
|
-
.mfp-preloader a:hover {
|
|
105
|
-
color: white; }
|
|
106
|
-
|
|
107
|
-
.mfp-s-ready .mfp-preloader {
|
|
108
|
-
display: none; }
|
|
109
|
-
|
|
110
|
-
.mfp-s-error .mfp-content {
|
|
111
|
-
display: none; }
|
|
112
|
-
|
|
113
|
-
button.mfp-close,
|
|
114
|
-
button.mfp-arrow {
|
|
115
|
-
overflow: visible;
|
|
116
|
-
cursor: pointer;
|
|
117
|
-
background: transparent;
|
|
118
|
-
border: 0;
|
|
119
|
-
-webkit-appearance: none;
|
|
120
|
-
display: block;
|
|
121
|
-
padding: 0;
|
|
122
|
-
z-index: 1046;
|
|
123
|
-
-webkit-box-shadow: none;
|
|
124
|
-
box-shadow: none; }
|
|
125
|
-
|
|
126
|
-
button::-moz-focus-inner {
|
|
127
|
-
padding: 0;
|
|
128
|
-
border: 0; }
|
|
129
|
-
|
|
130
|
-
.mfp-close {
|
|
131
|
-
width: 44px;
|
|
132
|
-
height: 44px;
|
|
133
|
-
line-height: 44px;
|
|
134
|
-
position: absolute;
|
|
135
|
-
right: 0;
|
|
136
|
-
top: 0;
|
|
137
|
-
text-decoration: none;
|
|
138
|
-
text-align: center;
|
|
139
|
-
opacity: 0.65;
|
|
140
|
-
padding: 0 0 18px 10px;
|
|
141
|
-
color: white;
|
|
142
|
-
font-style: normal;
|
|
143
|
-
font-size: 28px;
|
|
144
|
-
font-family: Arial, Baskerville, monospace; }
|
|
145
|
-
.mfp-close:hover, .mfp-close:focus {
|
|
146
|
-
opacity: 1; }
|
|
147
|
-
.mfp-close:active {
|
|
148
|
-
top: 1px; }
|
|
149
|
-
|
|
150
|
-
.mfp-close-btn-in .mfp-close {
|
|
151
|
-
color: #333333; }
|
|
152
|
-
|
|
153
|
-
.mfp-image-holder .mfp-close,
|
|
154
|
-
.mfp-iframe-holder .mfp-close {
|
|
155
|
-
color: white;
|
|
156
|
-
right: -6px;
|
|
157
|
-
text-align: right;
|
|
158
|
-
padding-right: 6px;
|
|
159
|
-
width: 100%; }
|
|
160
|
-
|
|
161
|
-
.mfp-counter {
|
|
162
|
-
position: absolute;
|
|
163
|
-
top: 0;
|
|
164
|
-
right: 0;
|
|
165
|
-
color: #cccccc;
|
|
166
|
-
font-size: 12px;
|
|
167
|
-
line-height: 18px; }
|
|
168
|
-
|
|
169
|
-
.mfp-arrow {
|
|
170
|
-
position: absolute;
|
|
171
|
-
opacity: 0.65;
|
|
172
|
-
margin: 0;
|
|
173
|
-
top: 50%;
|
|
174
|
-
margin-top: -55px;
|
|
175
|
-
padding: 0;
|
|
176
|
-
width: 90px;
|
|
177
|
-
height: 110px;
|
|
178
|
-
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); }
|
|
179
|
-
|
|
180
|
-
.mfp-arrow:active {
|
|
181
|
-
margin-top: -54px; }
|
|
182
|
-
|
|
183
|
-
.mfp-arrow:hover,
|
|
184
|
-
.mfp-arrow:focus {
|
|
185
|
-
opacity: 1; }
|
|
186
|
-
|
|
187
|
-
.mfp-arrow:before, .mfp-arrow:after,
|
|
188
|
-
.mfp-arrow .mfp-b,
|
|
189
|
-
.mfp-arrow .mfp-a {
|
|
190
|
-
content: '';
|
|
191
|
-
display: block;
|
|
192
|
-
width: 0;
|
|
193
|
-
height: 0;
|
|
194
|
-
position: absolute;
|
|
195
|
-
left: 0;
|
|
196
|
-
top: 0;
|
|
197
|
-
margin-top: 35px;
|
|
198
|
-
margin-left: 35px;
|
|
199
|
-
border: medium inset transparent; }
|
|
200
|
-
.mfp-arrow:after,
|
|
201
|
-
.mfp-arrow .mfp-a {
|
|
202
|
-
border-top-width: 13px;
|
|
203
|
-
border-bottom-width: 13px;
|
|
204
|
-
top: 8px; }
|
|
205
|
-
.mfp-arrow:before,
|
|
206
|
-
.mfp-arrow .mfp-b {
|
|
207
|
-
border-top-width: 21px;
|
|
208
|
-
border-bottom-width: 21px; }
|
|
209
|
-
|
|
210
|
-
.mfp-arrow-left {
|
|
211
|
-
left: 0; }
|
|
212
|
-
.mfp-arrow-left:after,
|
|
213
|
-
.mfp-arrow-left .mfp-a {
|
|
214
|
-
border-right: 17px solid white;
|
|
215
|
-
margin-left: 31px; }
|
|
216
|
-
.mfp-arrow-left:before,
|
|
217
|
-
.mfp-arrow-left .mfp-b {
|
|
218
|
-
margin-left: 25px;
|
|
219
|
-
border-right: 27px solid #3f3f3f; }
|
|
220
|
-
|
|
221
|
-
.mfp-arrow-right {
|
|
222
|
-
right: 0; }
|
|
223
|
-
.mfp-arrow-right:after,
|
|
224
|
-
.mfp-arrow-right .mfp-a {
|
|
225
|
-
border-left: 17px solid white;
|
|
226
|
-
margin-left: 39px; }
|
|
227
|
-
.mfp-arrow-right:before,
|
|
228
|
-
.mfp-arrow-right .mfp-b {
|
|
229
|
-
border-left: 27px solid #3f3f3f; }
|
|
230
|
-
|
|
231
|
-
.mfp-iframe-holder {
|
|
232
|
-
padding-top: 40px;
|
|
233
|
-
padding-bottom: 40px; }
|
|
234
|
-
|
|
235
|
-
.mfp-iframe-holder .mfp-content {
|
|
236
|
-
line-height: 0;
|
|
237
|
-
width: 100%;
|
|
238
|
-
max-width: 900px; }
|
|
239
|
-
|
|
240
|
-
.mfp-iframe-scaler {
|
|
241
|
-
width: 100%;
|
|
242
|
-
height: 0;
|
|
243
|
-
overflow: hidden;
|
|
244
|
-
padding-top: 56.25%; }
|
|
245
|
-
|
|
246
|
-
.mfp-iframe-scaler iframe {
|
|
247
|
-
position: absolute;
|
|
248
|
-
display: block;
|
|
249
|
-
top: 0;
|
|
250
|
-
left: 0;
|
|
251
|
-
width: 100%;
|
|
252
|
-
height: 100%;
|
|
253
|
-
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
|
|
254
|
-
background: black; }
|
|
255
|
-
|
|
256
|
-
.mfp-iframe-holder .mfp-close {
|
|
257
|
-
top: -40px; }
|
|
258
|
-
|
|
259
|
-
/* Main image in popup */
|
|
260
|
-
img.mfp-img {
|
|
261
|
-
width: auto;
|
|
262
|
-
max-width: 100%;
|
|
263
|
-
height: auto;
|
|
264
|
-
display: block;
|
|
265
|
-
line-height: 0;
|
|
266
|
-
-webkit-box-sizing: border-box;
|
|
267
|
-
-moz-box-sizing: border-box;
|
|
268
|
-
box-sizing: border-box;
|
|
269
|
-
padding: 40px 0 40px;
|
|
270
|
-
margin: 0 auto; }
|
|
271
|
-
|
|
272
|
-
/* The shadow behind the image */
|
|
273
|
-
.mfp-figure:after {
|
|
274
|
-
content: '';
|
|
275
|
-
position: absolute;
|
|
276
|
-
left: 0;
|
|
277
|
-
top: 40px;
|
|
278
|
-
bottom: 40px;
|
|
279
|
-
display: block;
|
|
280
|
-
right: 0;
|
|
281
|
-
width: auto;
|
|
282
|
-
height: auto;
|
|
283
|
-
z-index: -1;
|
|
284
|
-
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
|
|
285
|
-
background: #444444; }
|
|
286
|
-
|
|
287
|
-
.mfp-figure {
|
|
288
|
-
line-height: 0; }
|
|
289
|
-
|
|
290
|
-
.mfp-bottom-bar {
|
|
291
|
-
margin-top: -36px;
|
|
292
|
-
position: absolute;
|
|
293
|
-
top: 100%;
|
|
294
|
-
left: 0;
|
|
295
|
-
width: 100%;
|
|
296
|
-
cursor: auto; }
|
|
297
|
-
|
|
298
|
-
.mfp-title {
|
|
299
|
-
text-align: left;
|
|
300
|
-
line-height: 18px;
|
|
301
|
-
color: #f3f3f3;
|
|
302
|
-
word-wrap: break-word;
|
|
303
|
-
padding-right: 36px; }
|
|
304
|
-
|
|
305
|
-
.mfp-figure small {
|
|
306
|
-
color: #bdbdbd;
|
|
307
|
-
display: block;
|
|
308
|
-
font-size: 12px;
|
|
309
|
-
line-height: 14px; }
|
|
310
|
-
|
|
311
|
-
.mfp-image-holder .mfp-content {
|
|
312
|
-
max-width: 100%; }
|
|
313
|
-
|
|
314
|
-
.mfp-gallery .mfp-image-holder .mfp-figure {
|
|
315
|
-
cursor: pointer; }
|
|
316
|
-
|
|
317
|
-
@media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px) {
|
|
318
|
-
/**
|
|
319
|
-
* Remove all paddings around the image on small screen
|
|
320
|
-
*/
|
|
321
|
-
.mfp-img-mobile .mfp-image-holder {
|
|
322
|
-
padding-left: 0;
|
|
323
|
-
padding-right: 0; }
|
|
324
|
-
|
|
325
|
-
.mfp-img-mobile img.mfp-img {
|
|
326
|
-
padding: 0; }
|
|
327
|
-
|
|
328
|
-
/* The shadow behind the image */
|
|
329
|
-
.mfp-img-mobile .mfp-figure:after {
|
|
330
|
-
top: 0;
|
|
331
|
-
bottom: 0; }
|
|
332
|
-
|
|
333
|
-
.mfp-img-mobile .mfp-bottom-bar {
|
|
334
|
-
background: rgba(0, 0, 0, 0.6);
|
|
335
|
-
bottom: 0;
|
|
336
|
-
margin: 0;
|
|
337
|
-
top: auto;
|
|
338
|
-
padding: 3px 5px;
|
|
339
|
-
position: fixed;
|
|
340
|
-
-webkit-box-sizing: border-box;
|
|
341
|
-
-moz-box-sizing: border-box;
|
|
342
|
-
box-sizing: border-box; }
|
|
343
|
-
|
|
344
|
-
.mfp-img-mobile .mfp-bottom-bar:empty {
|
|
345
|
-
padding: 0; }
|
|
346
|
-
|
|
347
|
-
.mfp-img-mobile .mfp-counter {
|
|
348
|
-
right: 5px;
|
|
349
|
-
top: 3px; }
|
|
350
|
-
|
|
351
|
-
.mfp-img-mobile .mfp-close {
|
|
352
|
-
top: 0;
|
|
353
|
-
right: 0;
|
|
354
|
-
width: 35px;
|
|
355
|
-
height: 35px;
|
|
356
|
-
line-height: 35px;
|
|
357
|
-
background: rgba(0, 0, 0, 0.6);
|
|
358
|
-
position: fixed;
|
|
359
|
-
text-align: center;
|
|
360
|
-
padding: 0; }
|
|
361
|
-
|
|
362
|
-
.mfp-img-mobile .mfp-figure small {
|
|
363
|
-
display: inline;
|
|
364
|
-
margin-left: 5px; } }
|
|
365
|
-
@media all and (max-width: 900px) {
|
|
366
|
-
.mfp-arrow {
|
|
367
|
-
-webkit-transform: scale(0.75);
|
|
368
|
-
transform: scale(0.75); }
|
|
369
|
-
|
|
370
|
-
.mfp-arrow-left {
|
|
371
|
-
-webkit-transform-origin: 0;
|
|
372
|
-
transform-origin: 0; }
|
|
373
|
-
|
|
374
|
-
.mfp-arrow-right {
|
|
375
|
-
-webkit-transform-origin: 100%;
|
|
376
|
-
transform-origin: 100%; }
|
|
377
|
-
|
|
378
|
-
.mfp-container {
|
|
379
|
-
padding-left: 6px;
|
|
380
|
-
padding-right: 6px; } }
|
|
381
|
-
.mfp-ie7 .mfp-img {
|
|
382
|
-
padding: 0; }
|
|
383
|
-
.mfp-ie7 .mfp-bottom-bar {
|
|
384
|
-
width: 600px;
|
|
385
|
-
left: 50%;
|
|
386
|
-
margin-left: -300px;
|
|
387
|
-
margin-top: 5px;
|
|
388
|
-
padding-bottom: 5px; }
|
|
389
|
-
.mfp-ie7 .mfp-container {
|
|
390
|
-
padding: 0; }
|
|
391
|
-
.mfp-ie7 .mfp-content {
|
|
392
|
-
padding-top: 44px; }
|
|
393
|
-
.mfp-ie7 .mfp-close {
|
|
394
|
-
top: 0;
|
|
395
|
-
right: 0;
|
|
396
|
-
padding-top: 0; }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(){var e,t,n,r,i=[].slice,s={}.hasOwnProperty,o=function(e,t){function r(){this.constructor=e}for(var n in t)s.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},u=function(e,t){return function(){return e.apply(t,arguments)}},a=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1};t=window.Morris={},e=jQuery,t.EventEmitter=function(){function e(){}return e.prototype.on=function(e,t){return this.handlers==null&&(this.handlers={}),this.handlers[e]==null&&(this.handlers[e]=[]),this.handlers[e].push(t)},e.prototype.fire=function(){var e,t,n,r,s,o,u;n=arguments[0],e=2<=arguments.length?i.call(arguments,1):[];if(this.handlers!=null&&this.handlers[n]!=null){o=this.handlers[n],u=[];for(r=0,s=o.length;r<s;r++)t=o[r],u.push(t.apply(null,e));return u}},e}(),t.commas=function(e){var t,n,r,i;return e!=null?(r=e<0?"-":"",t=Math.abs(e),n=Math.floor(t).toFixed(0),r+=n.replace(/(?=(?:\d{3})+$)(?!^)/g,","),i=t.toString(),i.length>n.length&&(r+=i.slice(n.length)),r):"-"},t.pad2=function(e){return(e<10?"0":"")+e},t.Grid=function(n){function r(t){var n=this;typeof t.element=="string"?this.el=e(document.getElementById(t.element)):this.el=e(t.element);if(this.el==null||this.el.length===0)throw new Error("Graph container element not found");this.el.css("position")==="static"&&this.el.css("position","relative"),this.options=e.extend({},this.gridDefaults,this.defaults||{},t),typeof this.options.units=="string"&&(this.options.postUnits=t.units),this.raphael=new Raphael(this.el[0]),this.elementWidth=null,this.elementHeight=null,this.dirty=!1,this.init&&this.init(),this.setData(this.options.data),this.el.bind("mousemove",function(e){var t;return t=n.el.offset(),n.fire("hovermove",e.pageX-t.left,e.pageY-t.top)}),this.el.bind("mouseout",function(e){return n.fire("hoverout")}),this.el.bind("touchstart touchmove touchend",function(e){var t,r;return r=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],t=n.el.offset(),n.fire("hover",r.pageX-t.left,r.pageY-t.top),r}),this.postInit&&this.postInit()}return o(r,n),r.prototype.gridDefaults={dateFormat:null,axes:!0,grid:!0,gridLineColor:"#aaa",gridStrokeWidth:.5,gridTextColor:"#888",gridTextSize:12,hideHover:!1,yLabelFormat:null,numLines:5,padding:25,parseTime:!0,postUnits:"",preUnits:"",ymax:"auto",ymin:"auto 0",goals:[],goalStrokeWidth:1,goalLineColors:["#666633","#999966","#cc6666","#663333"],events:[],eventStrokeWidth:1,eventLineColors:["#005a04","#ccffbb","#3a5f0b","#005502"]},r.prototype.setData=function(e,n){var r,i,s,o,u,a,f,l,c,h,p,d;n==null&&(n=!0);if(e==null||e.length===0){this.data=[],this.raphael.clear(),this.hover!=null&&this.hover.hide();return}h=this.cumulative?0:null,p=this.cumulative?0:null,this.options.goals.length>0&&(u=Math.min.apply(null,this.options.goals),o=Math.max.apply(null,this.options.goals),p=p!=null?Math.min(p,u):u,h=h!=null?Math.max(h,o):o),this.data=function(){var n,r,o;o=[];for(s=n=0,r=e.length;n<r;s=++n)f=e[s],a={},a.label=f[this.options.xkey],this.options.parseTime?(a.x=t.parseDate(a.label),this.options.dateFormat?a.label=this.options.dateFormat(a.x):typeof a.label=="number"&&(a.label=(new Date(a.label)).toString())):a.x=s,l=0,a.y=function(){var e,t,n,r;n=this.options.ykeys,r=[];for(i=e=0,t=n.length;e<t;i=++e)c=n[i],d=f[c],typeof d=="string"&&(d=parseFloat(d)),d!=null&&typeof d!="number"&&(d=null),d!=null&&(this.cumulative?l+=d:h!=null?(h=Math.max(d,h),p=Math.min(d,p)):h=p=d),this.cumulative&&l!=null&&(h=Math.max(l,h),p=Math.min(l,p)),r.push(d);return r}.call(this),o.push(a);return o}.call(this),this.options.parseTime&&(this.data=this.data.sort(function(e,t){return(e.x>t.x)-(t.x>e.x)})),this.xmin=this.data[0].x,this.xmax=this.data[this.data.length-1].x,this.events=[],this.options.parseTime&&this.options.events.length>0&&(this.events=function(){var e,n,i,s;i=this.options.events,s=[];for(e=0,n=i.length;e<n;e++)r=i[e],s.push(t.parseDate(r));return s}.call(this),this.xmax=Math.max(this.xmax,Math.max.apply(null,this.events)),this.xmin=Math.min(this.xmin,Math.min.apply(null,this.events))),this.xmin===this.xmax&&(this.xmin-=1,this.xmax+=1),this.ymin=this.yboundary("min",p),this.ymax=this.yboundary("max",h),this.ymin===this.ymax&&(p&&(this.ymin-=1),this.ymax+=1),this.yInterval=(this.ymax-this.ymin)/(this.options.numLines-1),this.yInterval>0&&this.yInterval<1?this.precision=-Math.floor(Math.log(this.yInterval)/Math.log(10)):this.precision=0,this.dirty=!0;if(n)return this.redraw()},r.prototype.yboundary=function(e,t){var n,r;return n=this.options["y"+e],typeof n=="string"?n.slice(0,4)==="auto"?n.length>5?(r=parseInt(n.slice(5),10),t==null?r:Math[e](t,r)):t!=null?t:0:parseInt(n,10):n},r.prototype._calc=function(){var e,t,n;n=this.el.width(),e=this.el.height();if(this.elementWidth!==n||this.elementHeight!==e||this.dirty){this.elementWidth=n,this.elementHeight=e,this.dirty=!1,this.left=this.options.padding,this.right=this.elementWidth-this.options.padding,this.top=this.options.padding,this.bottom=this.elementHeight-this.options.padding,this.options.axes&&(t=Math.max(this.measureText(this.yAxisFormat(this.ymin),this.options.gridTextSize).width,this.measureText(this.yAxisFormat(this.ymax),this.options.gridTextSize).width),this.left+=t,this.bottom-=1.5*this.options.gridTextSize),this.width=this.right-this.left,this.height=this.bottom-this.top,this.dx=this.width/(this.xmax-this.xmin),this.dy=this.height/(this.ymax-this.ymin);if(this.calc)return this.calc()}},r.prototype.transY=function(e){return this.bottom-(e-this.ymin)*this.dy},r.prototype.transX=function(e){return this.data.length===1?(this.left+this.right)/2:this.left+(e-this.xmin)*this.dx},r.prototype.redraw=function(){this.raphael.clear(),this._calc(),this.drawGrid(),this.drawGoals(),this.drawEvents();if(this.draw)return this.draw()},r.prototype.measureText=function(e,t){var n,r;return t==null&&(t=12),r=this.raphael.text(100,100,e).attr("font-size",t),n=r.getBBox(),r.remove(),n},r.prototype.yAxisFormat=function(e){return this.yLabelFormat(e)},r.prototype.yLabelFormat=function(e){return typeof this.options.yLabelFormat=="function"?this.options.yLabelFormat(e):""+this.options.preUnits+t.commas(e)+this.options.postUnits},r.prototype.updateHover=function(e,t){var n,r;n=this.hitTest(e,t);if(n!=null)return(r=this.hover).update.apply(r,n)},r.prototype.drawGrid=function(){var e,t,n,r,i,s,o,u;if(this.options.grid===!1&&this.options.axes===!1)return;e=this.ymin,t=this.ymax,u=[];for(n=s=e,o=this.yInterval;e<=t?s<=t:s>=t;n=s+=o)r=parseFloat(n.toFixed(this.precision)),i=this.transY(r),this.options.axes&&this.drawYAxisLabel(this.left-this.options.padding/2,i,this.yAxisFormat(r)),this.options.grid?u.push(this.drawGridLine("M"+this.left+","+i+"H"+(this.left+this.width))):u.push(void 0);return u},r.prototype.drawGoals=function(){var e,t,n,r,i,s,o;s=this.options.goals,o=[];for(n=r=0,i=s.length;r<i;n=++r)t=s[n],e=this.options.goalLineColors[n%this.options.goalLineColors.length],o.push(this.drawGoal(t,e));return o},r.prototype.drawEvents=function(){var e,t,n,r,i,s,o;s=this.events,o=[];for(n=r=0,i=s.length;r<i;n=++r)t=s[n],e=this.options.eventLineColors[n%this.options.eventLineColors.length],o.push(this.drawEvent(t,e));return o},r.prototype.drawGoal=function(e,t){return this.raphael.path("M"+this.left+","+this.transY(e)+"H"+this.right).attr("stroke",t).attr("stroke-width",this.options.goalStrokeWidth)},r.prototype.drawEvent=function(e,t){return this.raphael.path("M"+this.transX(e)+","+this.bottom+"V"+this.top).attr("stroke",t).attr("stroke-width",this.options.eventStrokeWidth)},r.prototype.drawYAxisLabel=function(e,t,n){return this.raphael.text(e,t,n).attr("font-size",this.options.gridTextSize).attr("fill",this.options.gridTextColor).attr("text-anchor","end")},r.prototype.drawGridLine=function(e){return this.raphael.path(e).attr("stroke",this.options.gridLineColor).attr("stroke-width",this.options.gridStrokeWidth)},r}(t.EventEmitter),t.parseDate=function(e){var t,n,r,i,s,o,u,a,f,l,c;return typeof e=="number"?e:(n=e.match(/^(\d+) Q(\d)$/),i=e.match(/^(\d+)-(\d+)$/),s=e.match(/^(\d+)-(\d+)-(\d+)$/),u=e.match(/^(\d+) W(\d+)$/),a=e.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+)(Z|([+-])(\d\d):?(\d\d))?$/),f=e.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+):(\d+(\.\d+)?)(Z|([+-])(\d\d):?(\d\d))?$/),n?(new Date(parseInt(n[1],10),parseInt(n[2],10)*3-1,1)).getTime():i?(new Date(parseInt(i[1],10),parseInt(i[2],10)-1,1)).getTime():s?(new Date(parseInt(s[1],10),parseInt(s[2],10)-1,parseInt(s[3],10))).getTime():u?(l=new Date(parseInt(u[1],10),0,1),l.getDay()!==4&&l.setMonth(0,1+(4-l.getDay()+7)%7),l.getTime()+parseInt(u[2],10)*6048e5):a?a[6]?(o=0,a[6]!=="Z"&&(o=parseInt(a[8],10)*60+parseInt(a[9],10),a[7]==="+"&&(o=0-o)),Date.UTC(parseInt(a[1],10),parseInt(a[2],10)-1,parseInt(a[3],10),parseInt(a[4],10),parseInt(a[5],10)+o)):(new Date(parseInt(a[1],10),parseInt(a[2],10)-1,parseInt(a[3],10),parseInt(a[4],10),parseInt(a[5],10))).getTime():f?(c=parseFloat(f[6]),t=Math.floor(c),r=Math.round((c-t)*1e3),f[8]?(o=0,f[8]!=="Z"&&(o=parseInt(f[10],10)*60+parseInt(f[11],10),f[9]==="+"&&(o=0-o)),Date.UTC(parseInt(f[1],10),parseInt(f[2],10)-1,parseInt(f[3],10),parseInt(f[4],10),parseInt(f[5],10)+o,t,r)):(new Date(parseInt(f[1],10),parseInt(f[2],10)-1,parseInt(f[3],10),parseInt(f[4],10),parseInt(f[5],10),t,r)).getTime()):(new Date(parseInt(e,10),0,1)).getTime())},t.Hover=function(){function n(n){n==null&&(n={}),this.options=e.extend({},t.Hover.defaults,n),this.el=e("<div class='"+this.options["class"]+"'></div>"),this.el.hide(),this.options.parent.append(this.el)}return n.defaults={"class":"morris-hover morris-default-style"},n.prototype.update=function(e,t,n){return this.html(e),this.show(),this.moveTo(t,n)},n.prototype.html=function(e){return this.el.html(e)},n.prototype.moveTo=function(e,t){var n,r,i,s,o,u;return o=this.options.parent.innerWidth(),s=this.options.parent.innerHeight(),r=this.el.outerWidth(),n=this.el.outerHeight(),i=Math.min(Math.max(0,e-r/2),o-r),t!=null?(u=t-n-10,u<0&&(u=t+10,u+n>s&&(u=s/2-n/2))):u=s/2-n/2,this.el.css({left:i+"px",top:u+"px"})},n.prototype.show=function(){return this.el.show()},n.prototype.hide=function(){return this.el.hide()},n}(),t.Line=function(e){function n(e){this.hilight=u(this.hilight,this),this.onHoverOut=u(this.onHoverOut,this),this.onHoverMove=u(this.onHoverMove,this);if(!(this instanceof t.Line))return new t.Line(e);n.__super__.constructor.call(this,e)}return o(n,e),n.prototype.init=function(){this.pointGrow=Raphael.animation({r:this.options.pointSize+3},25,"linear"),this.pointShrink=Raphael.animation({r:this.options.pointSize},25,"linear");if(this.options.hideHover!=="always")return this.hover=new t.Hover({parent:this.el}),this.on("hovermove",this.onHoverMove),this.on("hoverout",this.onHoverOut)},n.prototype.defaults={lineWidth:3,pointSize:4,lineColors:["#0b62a4","#7A92A3","#4da74d","#afd8f8","#edc240","#cb4b4b","#9440ed"],pointWidths:[1],pointStrokeColors:["#ffffff"],pointFillColors:[],smooth:!0,xLabels:"auto",xLabelFormat:null,xLabelMargin:50,continuousLine:!0,hideHover:!1},n.prototype.calc=function(){return this.calcPoints(),this.generatePaths()},n.prototype.calcPoints=function(){var e,t,n,r,i,s;i=this.data,s=[];for(n=0,r=i.length;n<r;n++)e=i[n],e._x=this.transX(e.x),e._y=function(){var n,r,i,s;i=e.y,s=[];for(n=0,r=i.length;n<r;n++)t=i[n],t!=null?s.push(this.transY(t)):s.push(t);return s}.call(this),s.push(e._ymax=Math.min.apply(null,[this.bottom].concat(function(){var n,r,i,s;i=e._y,s=[];for(n=0,r=i.length;n<r;n++)t=i[n],t!=null&&s.push(t);return s}())));return s},n.prototype.hitTest=function(e,t){var n,r,i,s,o;if(this.data.length===0)return null;o=this.data.slice(1);for(n=i=0,s=o.length;i<s;n=++i){r=o[n];if(e<(r._x+this.data[n]._x)/2)break}return n},n.prototype.onHoverMove=function(e,t){var n;return n=this.hitTest(e,t),this.displayHoverForRow(n)},n.prototype.onHoverOut=function(){if(this.options.hideHover==="auto")return this.displayHoverForRow(null)},n.prototype.displayHoverForRow=function(e){var t;return e!=null?((t=this.hover).update.apply(t,this.hoverContentForRow(e)),this.hilight(e)):(this.hover.hide(),this.hilight())},n.prototype.hoverContentForRow=function(e){var t,n,r,i,s,o,u;r=this.data[e];if(typeof this.options.hoverCallback=="function")t=this.options.hoverCallback(e,this.options);else{t="<div class='morris-hover-row-label'>"+r.label+"</div>",u=r.y;for(n=s=0,o=u.length;s<o;n=++s)i=u[n],t+="<div class='morris-hover-point' style='color: "+this.colorFor(r,n,"label")+"'>\n "+this.options.labels[n]+":\n "+this.yLabelFormat(i)+"\n</div>"}return[t,r._x,r._ymax]},n.prototype.generatePaths=function(){var e,n,r,i,s;return this.paths=function(){var o,u,f,l;l=[];for(r=o=0,u=this.options.ykeys.length;0<=u?o<u:o>u;r=0<=u?++o:--o)s=this.options.smooth===!0||(f=this.options.ykeys[r],a.call(this.options.smooth,f)>=0),n=function(){var e,t,n,s;n=this.data,s=[];for(e=0,t=n.length;e<t;e++)i=n[e],i._y[r]!==void 0&&s.push({x:i._x,y:i._y[r]});return s}.call(this),this.options.continuousLine&&(n=function(){var t,r,i;i=[];for(t=0,r=n.length;t<r;t++)e=n[t],e.y!==null&&i.push(e);return i}()),n.length>1?l.push(t.Line.createPath(n,s,this.bottom)):l.push(null);return l}.call(this)},n.prototype.draw=function(){this.options.axes&&this.drawXAxis(),this.drawSeries();if(this.options.hideHover===!1)return this.displayHoverForRow(this.data.length-1)},n.prototype.drawXAxis=function(){var e,n,r,i,s,o,u,a,f,l=this;o=this.bottom+this.options.gridTextSize*1.25,i=null,e=function(e,t){var n,r;return n=l.drawXAxisLabel(l.transX(t),o,e),r=n.getBBox(),(i==null||i>=r.x+r.width)&&r.x>=0&&r.x+r.width<l.el.width()?i=r.x-l.options.xLabelMargin:n.remove()},this.options.parseTime?this.data.length===1&&this.options.xLabels==="auto"?r=[[this.data[0].label,this.data[0].x]]:r=t.labelSeries(this.xmin,this.xmax,this.width,this.options.xLabels,this.options.xLabelFormat):r=function(){var e,t,n,r;n=this.data,r=[];for(e=0,t=n.length;e<t;e++)s=n[e],r.push([s.label,s.x]);return r}.call(this),r.reverse(),f=[];for(u=0,a=r.length;u<a;u++)n=r[u],f.push(e(n[0],n[1]));return f},n.prototype.drawSeries=function(){var e,t,n,r,i,s,o,u,a;for(t=i=o=this.options.ykeys.length-1;o<=0?i<=0:i>=0;t=o<=0?++i:--i)n=this.paths[t],n!==null&&this.drawLinePath(n,this.colorFor(r,t,"line"));this.seriesPoints=function(){var e,n,r;r=[];for(t=e=0,n=this.options.ykeys.length;0<=n?e<n:e>n;t=0<=n?++e:--e)r.push([]);return r}.call(this),a=[];for(t=s=u=this.options.ykeys.length-1;u<=0?s<=0:s>=0;t=u<=0?++s:--s)a.push(function(){var n,i,s,o;s=this.data,o=[];for(n=0,i=s.length;n<i;n++)r=s[n],r._y[t]!=null?e=this.drawLinePoint(r._x,r._y[t],this.options.pointSize,this.colorFor(r,t,"point"),t):e=null,o.push(this.seriesPoints[t].push(e));return o}.call(this));return a},n.createPath=function(e,n,r){var i,s,o,u,a,f,l,c,h,p,d,v,m,g;l="",n&&(o=t.Line.gradients(e)),c={y:null};for(u=m=0,g=e.length;m<g;u=++m){i=e[u];if(i.y!=null)if(c.y!=null)n?(s=o[u],f=o[u-1],a=(i.x-c.x)/4,h=c.x+a,d=Math.min(r,c.y+a*f),p=i.x-a,v=Math.min(r,i.y-a*s),l+="C"+h+","+d+","+p+","+v+","+i.x+","+i.y):l+="L"+i.x+","+i.y;else if(!n||o[u]!=null)l+="M"+i.x+","+i.y;c=i}return l},n.gradients=function(e){var t,n,r,i,s,o,u,a;n=function(e,t){return(e.y-t.y)/(e.x-t.x)},a=[];for(r=o=0,u=e.length;o<u;r=++o)t=e[r],t.y!=null?(i=e[r+1]||{y:null},s=e[r-1]||{y:null},s.y!=null&&i.y!=null?a.push(n(s,i)):s.y!=null?a.push(n(s,t)):i.y!=null?a.push(n(t,i)):a.push(null)):a.push(null);return a},n.prototype.hilight=function(e){var t,n,r,i,s;if(this.prevHilight!==null&&this.prevHilight!==e)for(t=n=0,i=this.seriesPoints.length-1;0<=i?n<=i:n>=i;t=0<=i?++n:--n)this.seriesPoints[t][this.prevHilight]&&this.seriesPoints[t][this.prevHilight].animate(this.pointShrink);if(e!==null&&this.prevHilight!==e)for(t=r=0,s=this.seriesPoints.length-1;0<=s?r<=s:r>=s;t=0<=s?++r:--r)this.seriesPoints[t][e]&&this.seriesPoints[t][e].animate(this.pointGrow);return this.prevHilight=e},n.prototype.colorFor=function(e,t,n){return typeof this.options.lineColors=="function"?this.options.lineColors.call(this,e,t,n):n==="point"?this.options.pointFillColors[t%this.options.pointFillColors.length]||this.options.lineColors[t%this.options.lineColors.length]:this.options.lineColors[t%this.options.lineColors.length]},n.prototype.drawXAxisLabel=function(e,t,n){return this.raphael.text(e,t,n).attr("font-size",this.options.gridTextSize).attr("fill",this.options.gridTextColor)},n.prototype.drawLinePath=function(e,t){return this.raphael.path(e).attr("stroke",t).attr("stroke-width",this.options.lineWidth)},n.prototype.drawLinePoint=function(e,t,n,r,i){return this.raphael.circle(e,t,n).attr("fill",r).attr("stroke-width",this.strokeWidthForSeries(i)).attr("stroke",this.strokeForSeries(i))},n.prototype.strokeWidthForSeries=function(e){return this.options.pointWidths[e%this.options.pointWidths.length]},n.prototype.strokeForSeries=function(e){return this.options.pointStrokeColors[e%this.options.pointStrokeColors.length]},n}(t.Grid),t.labelSeries=function(n,r,i,s,o){var u,a,f,l,c,h,p,d,v,m,g;f=200*(r-n)/i,a=new Date(n),p=t.LABEL_SPECS[s];if(p===void 0){g=t.AUTO_LABEL_ORDER;for(v=0,m=g.length;v<m;v++){l=g[v],h=t.LABEL_SPECS[l];if(f>=h.span){p=h;break}}}p===void 0&&(p=t.LABEL_SPECS.second),o&&(p=e.extend({},p,{fmt:o})),u=p.start(a),c=[];while((d=u.getTime())<=r)d>=n&&c.push([p.fmt(u),d]),p.incr(u);return c},n=function(e){return{span:e*60*1e3,start:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours())},fmt:function(e){return""+t.pad2(e.getHours())+":"+t.pad2(e.getMinutes())},incr:function(t){return t.setMinutes(t.getMinutes()+e)}}},r=function(e){return{span:e*1e3,start:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes())},fmt:function(e){return""+t.pad2(e.getHours())+":"+t.pad2(e.getMinutes())+":"+t.pad2(e.getSeconds())},incr:function(t){return t.setSeconds(t.getSeconds()+e)}}},t.LABEL_SPECS={decade:{span:1728e8,start:function(e){return new Date(e.getFullYear()-e.getFullYear()%10,0,1)},fmt:function(e){return""+e.getFullYear()},incr:function(e){return e.setFullYear(e.getFullYear()+10)}},year:{span:1728e7,start:function(e){return new Date(e.getFullYear(),0,1)},fmt:function(e){return""+e.getFullYear()},incr:function(e){return e.setFullYear(e.getFullYear()+1)}},month:{span:24192e5,start:function(e){return new Date(e.getFullYear(),e.getMonth(),1)},fmt:function(e){return""+e.getFullYear()+"-"+t.pad2(e.getMonth()+1)},incr:function(e){return e.setMonth(e.getMonth()+1)}},day:{span:864e5,start:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},fmt:function(e){return""+e.getFullYear()+"-"+t.pad2(e.getMonth()+1)+"-"+t.pad2(e.getDate())},incr:function(e){return e.setDate(e.getDate()+1)}},hour:n(60),"30min":n(30),"15min":n(15),"10min":n(10),"5min":n(5),minute:n(1),"30sec":r(30),"15sec":r(15),"10sec":r(10),"5sec":r(5),second:r(1)},t.AUTO_LABEL_ORDER=["decade","year","month","day","hour","30min","15min","10min","5min","minute","30sec","15sec","10sec","5sec","second"],t.Area=function(e){function n(e){if(!(this instanceof t.Area))return new t.Area(e);this.cumulative=!0,n.__super__.constructor.call(this,e)}return o(n,e),n.prototype.calcPoints=function(){var e,t,n,r,i,s,o;s=this.data,o=[];for(r=0,i=s.length;r<i;r++)e=s[r],e._x=this.transX(e.x),t=0,e._y=function(){var r,i,s,o;s=e.y,o=[];for(r=0,i=s.length;r<i;r++)n=s[r],t+=n||0,o.push(this.transY(t));return o}.call(this),o.push(e._ymax=e._y[e._y.length-1]);return o},n.prototype.drawSeries=function(){var e,t,r,i;for(e=r=i=this.options.ykeys.length-1;i<=0?r<=0:r>=0;e=i<=0?++r:--r)t=this.paths[e],t!==null&&(t+="L"+this.transX(this.xmax)+","+this.bottom+"L"+this.transX(this.xmin)+","+this.bottom+"Z",this.drawFilledPath(t,this.fillForSeries(e)));return n.__super__.drawSeries.call(this)},n.prototype.fillForSeries=function(e){var t;return t=Raphael.rgb2hsl(this.colorFor(this.data[e],e,"line")),Raphael.hsl(t.h,Math.min(255,t.s*.75),Math.min(255,t.l*1.25))},n.prototype.drawFilledPath=function(e,t){return this.raphael.path(e).attr("fill",t).attr("stroke-width",0)},n}(t.Line),t.Bar=function(n){function r(n){this.onHoverOut=u(this.onHoverOut,this),this.onHoverMove=u(this.onHoverMove,this);if(!(this instanceof t.Bar))return new t.Bar(n);r.__super__.constructor.call(this,e.extend({},n,{parseTime:!1}))}return o(r,n),r.prototype.init=function(){this.cumulative=this.options.stacked;if(this.options.hideHover!=="always")return this.hover=new t.Hover({parent:this.el}),this.on("hovermove",this.onHoverMove),this.on("hoverout",this.onHoverOut)},r.prototype.defaults={barSizeRatio:.75,barGap:3,barColors:["#0b62a4","#7a92a3","#4da74d","#afd8f8","#edc240","#cb4b4b","#9440ed"],xLabelMargin:50},r.prototype.calc=function(){var e;this.calcBars();if(this.options.hideHover===!1)return(e=this.hover).update.apply(e,this.hoverContentForRow(this.data.length-1))},r.prototype.calcBars=function(){var e,t,n,r,i,s,o;s=this.data,o=[];for(e=r=0,i=s.length;r<i;e=++r)t=s[e],t._x=this.left+this.width*(e+.5)/this.data.length,o.push(t._y=function(){var e,r,i,s;i=t.y,s=[];for(e=0,r=i.length;e<r;e++)n=i[e],n!=null?s.push(this.transY(n)):s.push(null);return s}.call(this));return o},r.prototype.draw=function(){return this.options.axes&&this.drawXAxis(),this.drawSeries()},r.prototype.drawXAxis=function(){var e,t,n,r,i,s,o,u,a;s=this.bottom+this.options.gridTextSize*1.25,r=null,a=[];for(e=o=0,u=this.data.length;0<=u?o<u:o>u;e=0<=u?++o:--o)i=this.data[this.data.length-1-e],t=this.drawXAxisLabel(i._x,s,i.label),n=t.getBBox(),(r==null||r>=n.x+n.width)&&n.x>=0&&n.x+n.width<this.el.width()?a.push(r=n.x-this.options.xLabelMargin):a.push(t.remove());return a},r.prototype.drawSeries=function(){var e,t,n,r,i,s,o,u,a,f,l,c,h,p;return n=this.width/this.options.data.length,u=this.options.stacked!=null?1:this.options.ykeys.length,e=(n*this.options.barSizeRatio-this.options.barGap*(u-1))/u,o=n*(1-this.options.barSizeRatio)/2,p=this.ymin<=0&&this.ymax>=0?this.transY(0):null,this.bars=function(){var u,d,v,m;v=this.data,m=[];for(r=u=0,d=v.length;u<d;r=++u)a=v[r],i=0,m.push(function(){var u,d,v,m;v=a._y,m=[];for(f=u=0,d=v.length;u<d;f=++u)h=v[f],h!==null?(p?(c=Math.min(h,p),t=Math.max(h,p)):(c=h,t=this.bottom),s=this.left+r*n+o,this.options.stacked||(s+=f*(e+this.options.barGap)),l=t-c,this.options.stacked&&(c-=i),this.drawBar(s,c,e,l,this.colorFor(a,f,"bar")),m.push(i+=l)):m.push(null);return m}.call(this));return m}.call(this)},r.prototype.colorFor=function(e,t,n){var r,i;return typeof this.options.barColors=="function"?(r={x:e.x,y:e.y[t],label:e.label},i={index:t,key:this.options.ykeys[t],label:this.options.labels[t]},this.options.barColors.call(this,r,i,n)):this.options.barColors[t%this.options.barColors.length]},r.prototype.hitTest=function(e,t){return this.data.length===0?null:(e=Math.max(Math.min(e,this.right),this.left),Math.min(this.data.length-1,Math.floor((e-this.left)/(this.width/this.data.length))))},r.prototype.onHoverMove=function(e,t){var n,r;return n=this.hitTest(e,t),(r=this.hover).update.apply(r,this.hoverContentForRow(n))},r.prototype.onHoverOut=function(){if(this.options.hideHover==="auto")return this.hover.hide()},r.prototype.hoverContentForRow=function(e){var t,n,r,i,s,o,u,a;if(typeof this.options.hoverCallback=="function")t=this.options.hoverCallback(e,this.options);else{r=this.data[e],t="<div class='morris-hover-row-label'>"+r.label+"</div>",a=r.y;for(n=o=0,u=a.length;o<u;n=++o)s=a[n],t+="<div class='morris-hover-point' style='color: "+this.colorFor(r,n,"label")+"'>\n "+this.options.labels[n]+":\n "+this.yLabelFormat(s)+"\n</div>"}return i=this.left+(e+.5)*this.width/this.data.length,[t,i]},r.prototype.drawXAxisLabel=function(e,t,n){var r;return r=this.raphael.text(e,t,n).attr("font-size",this.options.gridTextSize).attr("fill",this.options.gridTextColor)},r.prototype.drawBar=function(e,t,n,r,i){return this.raphael.rect(e,t,n,r).attr("fill",i).attr("stroke-width",0)},r}(t.Grid),t.Donut=function(){function n(n){this.select=u(this.select,this);if(!(this instanceof t.Donut))return new t.Donut(n);typeof n.element=="string"?this.el=e(document.getElementById(n.element)):this.el=e(n.element),this.options=e.extend({},this.defaults,n);if(this.el===null||this.el.length===0)throw new Error("Graph placeholder not found.");if(n.data===void 0||n.data.length===0)return;this.data=n.data,this.redraw()}return n.prototype.defaults={colors:["#0B62A4","#3980B5","#679DC6","#95BBD7","#B0CCE1","#095791","#095085","#083E67","#052C48","#042135"],backgroundColor:"#FFFFFF",labelColor:"#000000",formatter:t.commas},n.prototype.redraw=function(){var e,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x;this.el.empty(),this.raphael=new Raphael(this.el[0]),n=this.el.width()/2,r=this.el.height()/2,h=(Math.min(n,r)-10)/3,c=0,w=this.data;for(d=0,g=w.length;d<g;d++)p=w[d],c+=p.value;a=5/(2*h),e=1.9999*Math.PI-a*this.data.length,o=0,s=0,this.segments=[],E=this.data;for(v=0,y=E.length;v<y;v++)i=E[v],f=o+a+e*(i.value/c),l=new t.DonutSegment(n,r,h*2,h,o,f,this.options.colors[s%this.options.colors.length],this.options.backgroundColor,i,this.raphael),l.render(),this.segments.push(l),l.on("hover",this.select),o=f,s+=1;this.text1=this.drawEmptyDonutLabel(n,r-10,this.options.labelColor,15,800),this.text2=this.drawEmptyDonutLabel(n,r+10,this.options.labelColor,14),u=Math.max.apply(null,function(){var e,t,n,r;n=this.data,r=[];for(e=0,t=n.length;e<t;e++)i=n[e],r.push(i.value);return r}.call(this)),s=0,S=this.data,x=[];for(m=0,b=S.length;m<b;m++){i=S[m];if(i.value===u){this.select(s);break}x.push(s+=1)}return x},n.prototype.select=function(e){var t,n,r,i,s;s=this.segments;for(r=0,i=s.length;r<i;r++)t=s[r],t.deselect();return typeof e=="number"?n=this.segments[e]:n=e,n.select(),this.setLabels(n.data.label,this.options.formatter(n.data.value,n.data))},n.prototype.setLabels=function(e,t){var n,r,i,s,o,u,a,f;return n=(Math.min(this.el.width()/2,this.el.height()/2)-10)*2/3,s=1.8*n,i=n/2,r=n/3,this.text1.attr({text:e,transform:""}),o=this.text1.getBBox(),u=Math.min(s/o.width,i/o.height),this.text1.attr({transform:"S"+u+","+u+","+(o.x+o.width/2)+","+(o.y+o.height)}),this.text2.attr({text:t,transform:""}),a=this.text2.getBBox(),f=Math.min(s/a.width,r/a.height),this.text2.attr({transform:"S"+f+","+f+","+(a.x+a.width/2)+","+a.y})},n.prototype.drawEmptyDonutLabel=function(e,t,n,r,i){var s;return s=this.raphael.text(e,t,"").attr("font-size",r).attr("fill",n),i!=null&&s.attr("font-weight",i),s},n}(),t.DonutSegment=function(e){function t(e,t,n,r,i,s,o,a,f,l){this.cx=e,this.cy=t,this.inner=n,this.outer=r,this.color=o,this.backgroundColor=a,this.data=f,this.raphael=l,this.deselect=u(this.deselect,this),this.select=u(this.select,this),this.sin_p0=Math.sin(i),this.cos_p0=Math.cos(i),this.sin_p1=Math.sin(s),this.cos_p1=Math.cos(s),this.is_long=s-i>Math.PI?1:0,this.path=this.calcSegment(this.inner+3,this.inner+this.outer-5),this.selectedPath=this.calcSegment(this.inner+3,this.inner+this.outer),this.hilight=this.calcArc(this.inner)}return o(t,e),t.prototype.calcArcPoints=function(e){return[this.cx+e*this.sin_p0,this.cy+e*this.cos_p0,this.cx+e*this.sin_p1,this.cy+e*this.cos_p1]},t.prototype.calcSegment=function(e,t){var n,r,i,s,o,u,a,f,l,c;return l=this.calcArcPoints(e),n=l[0],i=l[1],r=l[2],s=l[3],c=this.calcArcPoints(t),o=c[0],a=c[1],u=c[2],f=c[3],"M"+n+","+i+("A"+e+","+e+",0,"+this.is_long+",0,"+r+","+s)+("L"+u+","+f)+("A"+t+","+t+",0,"+this.is_long+",1,"+o+","+a)+"Z"},t.prototype.calcArc=function(e){var t,n,r,i,s;return s=this.calcArcPoints(e),t=s[0],r=s[1],n=s[2],i=s[3],"M"+t+","+r+("A"+e+","+e+",0,"+this.is_long+",0,"+n+","+i)},t.prototype.render=function(){var e=this;return this.arc=this.drawDonutArc(this.hilight,this.color),this.seg=this.drawDonutSegment(this.path,this.color,this.backgroundColor,function(){return e.fire("hover",e)})},t.prototype.drawDonutArc=function(e,t){return this.raphael.path(e).attr({stroke:t,"stroke-width":2,opacity:0})},t.prototype.drawDonutSegment=function(e,t,n,r){return this.raphael.path(e).attr({fill:t,stroke:n,"stroke-width":3}).hover(r)},t.prototype.select=function(){if(!this.selected)return this.seg.animate({path:this.selectedPath},150,"<>"),this.arc.animate({opacity:1},150,"<>"),this.selected=!0},t.prototype.deselect=function(){if(this.selected)return this.seg.animate({path:this.path},150,"<>"),this.arc.animate({opacity:0},150,"<>"),this.selected=!1},t}(t.EventEmitter)}).call(this);
|
|
@@ -1,1363 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Parsley.js allows you to verify your form inputs frontend side, without writing a line of javascript. Or so..
|
|
3
|
-
*
|
|
4
|
-
* Author: Guillaume Potier - @guillaumepotier
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
!function ($) {
|
|
8
|
-
|
|
9
|
-
'use strict';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Validator class stores all constraints functions and associated messages.
|
|
13
|
-
* Provides public interface to add, remove or modify them
|
|
14
|
-
*
|
|
15
|
-
* @class Validator
|
|
16
|
-
* @constructor
|
|
17
|
-
*/
|
|
18
|
-
var Validator = function ( options ) {
|
|
19
|
-
/**
|
|
20
|
-
* Error messages
|
|
21
|
-
*
|
|
22
|
-
* @property messages
|
|
23
|
-
* @type {Object}
|
|
24
|
-
*/
|
|
25
|
-
this.messages = {
|
|
26
|
-
defaultMessage: "This value seems to be invalid."
|
|
27
|
-
, type: {
|
|
28
|
-
email: "This value should be a valid email."
|
|
29
|
-
, url: "This value should be a valid url."
|
|
30
|
-
, urlstrict: "This value should be a valid url."
|
|
31
|
-
, number: "This value should be a valid number."
|
|
32
|
-
, digits: "This value should be digits."
|
|
33
|
-
, dateIso: "This value should be a valid date (YYYY-MM-DD)."
|
|
34
|
-
, alphanum: "This value should be alphanumeric."
|
|
35
|
-
, phone: "This value should be a valid phone number."
|
|
36
|
-
}
|
|
37
|
-
, notnull: "This value should not be null."
|
|
38
|
-
, notblank: "This value should not be blank."
|
|
39
|
-
, required: "This value is required."
|
|
40
|
-
, regexp: "This value seems to be invalid."
|
|
41
|
-
, min: "This value should be greater than or equal to %s."
|
|
42
|
-
, max: "This value should be lower than or equal to %s."
|
|
43
|
-
, range: "This value should be between %s and %s."
|
|
44
|
-
, minlength: "This value is too short. It should have %s characters or more."
|
|
45
|
-
, maxlength: "This value is too long. It should have %s characters or less."
|
|
46
|
-
, rangelength: "This value length is invalid. It should be between %s and %s characters long."
|
|
47
|
-
, mincheck: "You must select at least %s choices."
|
|
48
|
-
, maxcheck: "You must select %s choices or less."
|
|
49
|
-
, rangecheck: "You must select between %s and %s choices."
|
|
50
|
-
, equalto: "This value should be the same."
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
this.init( options );
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
Validator.prototype = {
|
|
57
|
-
|
|
58
|
-
constructor: Validator
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Validator list. Built-in validators functions
|
|
62
|
-
*
|
|
63
|
-
* @property validators
|
|
64
|
-
* @type {Object}
|
|
65
|
-
*/
|
|
66
|
-
, validators: {
|
|
67
|
-
notnull: function ( val ) {
|
|
68
|
-
return val.length > 0;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
, notblank: function ( val ) {
|
|
72
|
-
return 'string' === typeof val && '' !== val.replace( /^\s+/g, '' ).replace( /\s+$/g, '' );
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Works on all inputs. val is object for checkboxes
|
|
76
|
-
, required: function ( val ) {
|
|
77
|
-
|
|
78
|
-
// for checkboxes and select multiples. Check there is at least one required value
|
|
79
|
-
if ( 'object' === typeof val ) {
|
|
80
|
-
for ( var i in val ) {
|
|
81
|
-
if ( this.required( val[ i ] ) ) {
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return this.notnull( val ) && this.notblank( val );
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
, type: function ( val, type ) {
|
|
93
|
-
var regExp;
|
|
94
|
-
|
|
95
|
-
switch ( type ) {
|
|
96
|
-
case 'number':
|
|
97
|
-
regExp = /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/;
|
|
98
|
-
break;
|
|
99
|
-
case 'digits':
|
|
100
|
-
regExp = /^\d+$/;
|
|
101
|
-
break;
|
|
102
|
-
case 'alphanum':
|
|
103
|
-
regExp = /^\w+$/;
|
|
104
|
-
break;
|
|
105
|
-
case 'email':
|
|
106
|
-
regExp = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))){2,6}$/i;
|
|
107
|
-
break;
|
|
108
|
-
case 'url':
|
|
109
|
-
val = new RegExp( '(https?|s?ftp|git)', 'i' ).test( val ) ? val : 'http://' + val;
|
|
110
|
-
/* falls through */
|
|
111
|
-
case 'urlstrict':
|
|
112
|
-
regExp = /^(https?|s?ftp|git):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i;
|
|
113
|
-
break;
|
|
114
|
-
case 'dateIso':
|
|
115
|
-
regExp = /^(\d{4})\D?(0[1-9]|1[0-2])\D?([12]\d|0[1-9]|3[01])$/;
|
|
116
|
-
break;
|
|
117
|
-
case 'phone':
|
|
118
|
-
regExp = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/;
|
|
119
|
-
break;
|
|
120
|
-
default:
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// test regExp if not null
|
|
125
|
-
return '' !== val ? regExp.test( val ) : false;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
, regexp: function ( val, regExp, self ) {
|
|
129
|
-
return new RegExp( regExp, self.options.regexpFlag || '' ).test( val );
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
, minlength: function ( val, min ) {
|
|
133
|
-
return val.length >= min;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
, maxlength: function ( val, max ) {
|
|
137
|
-
return val.length <= max;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
, rangelength: function ( val, arrayRange ) {
|
|
141
|
-
return this.minlength( val, arrayRange[ 0 ] ) && this.maxlength( val, arrayRange[ 1 ] );
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
, min: function ( val, min ) {
|
|
145
|
-
return Number( val ) >= min;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
, max: function ( val, max ) {
|
|
149
|
-
return Number( val ) <= max;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
, range: function ( val, arrayRange ) {
|
|
153
|
-
return val >= arrayRange[ 0 ] && val <= arrayRange[ 1 ];
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
, equalto: function ( val, elem, self ) {
|
|
157
|
-
self.options.validateIfUnchanged = true;
|
|
158
|
-
|
|
159
|
-
return val === $( elem ).val();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
, remote: function ( val, url, self ) {
|
|
163
|
-
var result = null
|
|
164
|
-
, data = {}
|
|
165
|
-
, dataType = {};
|
|
166
|
-
|
|
167
|
-
data[ self.$element.attr( 'name' ) ] = val;
|
|
168
|
-
|
|
169
|
-
if ( 'undefined' !== typeof self.options.remoteDatatype ) {
|
|
170
|
-
dataType = { dataType: self.options.remoteDatatype };
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
var manage = function ( isConstraintValid, message ) {
|
|
174
|
-
// remove error message if we got a server message, different from previous message
|
|
175
|
-
if ( 'undefined' !== typeof message && 'undefined' !== typeof self.Validator.messages.remote && message !== self.Validator.messages.remote ) {
|
|
176
|
-
$( self.ulError + ' .remote' ).remove();
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
self.updtConstraint( { name: 'remote', valid: isConstraintValid }, message );
|
|
180
|
-
self.manageValidationResult();
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
// transform string response into object
|
|
184
|
-
var handleResponse = function ( response ) {
|
|
185
|
-
if ( 'object' === typeof response ) {
|
|
186
|
-
return response;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
try {
|
|
190
|
-
response = $.parseJSON( response );
|
|
191
|
-
} catch ( err ) {}
|
|
192
|
-
|
|
193
|
-
return response;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
var manageErrorMessage = function ( response ) {
|
|
197
|
-
return 'object' === typeof response && null !== response ? ( 'undefined' !== typeof response.error ? response.error : ( 'undefined' !== typeof response.message ? response.message : null ) ) : null;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
$.ajax( $.extend( {}, {
|
|
201
|
-
url: url
|
|
202
|
-
, data: data
|
|
203
|
-
, type: self.options.remoteMethod || 'GET'
|
|
204
|
-
, success: function ( response ) {
|
|
205
|
-
response = handleResponse( response );
|
|
206
|
-
manage( 1 === response || true === response || ( 'object' === typeof response && null !== response && 'undefined' !== typeof response.success ), manageErrorMessage( response )
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
, error: function ( response ) {
|
|
210
|
-
response = handleResponse( response );
|
|
211
|
-
manage( false, manageErrorMessage( response ) );
|
|
212
|
-
}
|
|
213
|
-
}, dataType ) );
|
|
214
|
-
|
|
215
|
-
return result;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Aliases for checkboxes constraints
|
|
220
|
-
*/
|
|
221
|
-
, mincheck: function ( obj, val ) {
|
|
222
|
-
return this.minlength( obj, val );
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
, maxcheck: function ( obj, val ) {
|
|
226
|
-
return this.maxlength( obj, val);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
, rangecheck: function ( obj, arrayRange ) {
|
|
230
|
-
return this.rangelength( obj, arrayRange );
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/*
|
|
235
|
-
* Register custom validators and messages
|
|
236
|
-
*/
|
|
237
|
-
, init: function ( options ) {
|
|
238
|
-
var customValidators = options.validators
|
|
239
|
-
, customMessages = options.messages;
|
|
240
|
-
|
|
241
|
-
var key;
|
|
242
|
-
for ( key in customValidators ) {
|
|
243
|
-
this.addValidator(key, customValidators[ key ]);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
for ( key in customMessages ) {
|
|
247
|
-
this.addMessage(key, customMessages[ key ]);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Replace %s placeholders by values
|
|
253
|
-
*
|
|
254
|
-
* @method formatMesssage
|
|
255
|
-
* @param {String} message Message key
|
|
256
|
-
* @param {Mixed} args Args passed by validators functions. Could be string, number or object
|
|
257
|
-
* @return {String} Formatted string
|
|
258
|
-
*/
|
|
259
|
-
, formatMesssage: function ( message, args ) {
|
|
260
|
-
|
|
261
|
-
if ( 'object' === typeof args ) {
|
|
262
|
-
for ( var i in args ) {
|
|
263
|
-
message = this.formatMesssage( message, args[ i ] );
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
return message;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
return 'string' === typeof message ? message.replace( new RegExp( '%s', 'i' ), args ) : '';
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Add / override a validator in validators list
|
|
274
|
-
*
|
|
275
|
-
* @method addValidator
|
|
276
|
-
* @param {String} name Validator name. Will automatically bindable through data-name=''
|
|
277
|
-
* @param {Function} fn Validator function. Must return {Boolean}
|
|
278
|
-
*/
|
|
279
|
-
, addValidator: function ( name, fn ) {
|
|
280
|
-
this.validators[ name ] = fn;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Add / override error message
|
|
285
|
-
*
|
|
286
|
-
* @method addMessage
|
|
287
|
-
* @param {String} name Message name. Will automatically be binded to validator with same name
|
|
288
|
-
* @param {String} message Message
|
|
289
|
-
*/
|
|
290
|
-
, addMessage: function ( key, message, type ) {
|
|
291
|
-
|
|
292
|
-
if ( 'undefined' !== typeof type && true === type ) {
|
|
293
|
-
this.messages.type[ key ] = message;
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
// custom types messages are a bit tricky cuz' nested ;)
|
|
298
|
-
if ( 'type' === key ) {
|
|
299
|
-
for ( var i in message ) {
|
|
300
|
-
this.messages.type[ i ] = message[ i ];
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
this.messages[ key ] = message;
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* ParsleyField class manage each form field inside a validated Parsley form.
|
|
312
|
-
* Returns if field valid or not depending on its value and constraints
|
|
313
|
-
* Manage field error display and behavior, event triggers and more
|
|
314
|
-
*
|
|
315
|
-
* @class ParsleyField
|
|
316
|
-
* @constructor
|
|
317
|
-
*/
|
|
318
|
-
var ParsleyField = function ( element, options, type ) {
|
|
319
|
-
this.options = options;
|
|
320
|
-
this.Validator = new Validator( options );
|
|
321
|
-
|
|
322
|
-
// if type is ParsleyFieldMultiple, just return this. used for clone
|
|
323
|
-
if ( type === 'ParsleyFieldMultiple' ) {
|
|
324
|
-
return this;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
this.init( element, type || 'ParsleyField' );
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
ParsleyField.prototype = {
|
|
331
|
-
|
|
332
|
-
constructor: ParsleyField
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Set some properties, bind constraint validators and validation events
|
|
336
|
-
*
|
|
337
|
-
* @method init
|
|
338
|
-
* @param {Object} element
|
|
339
|
-
* @param {Object} options
|
|
340
|
-
*/
|
|
341
|
-
, init: function ( element, type ) {
|
|
342
|
-
this.type = type;
|
|
343
|
-
this.valid = true;
|
|
344
|
-
this.element = element;
|
|
345
|
-
this.validatedOnce = false;
|
|
346
|
-
this.$element = $( element );
|
|
347
|
-
this.val = this.$element.val();
|
|
348
|
-
this.isRequired = false;
|
|
349
|
-
this.constraints = {};
|
|
350
|
-
|
|
351
|
-
// overriden by ParsleyItemMultiple if radio or checkbox input
|
|
352
|
-
if ( 'undefined' === typeof this.isRadioOrCheckbox ) {
|
|
353
|
-
this.isRadioOrCheckbox = false;
|
|
354
|
-
this.hash = this.generateHash();
|
|
355
|
-
this.errorClassHandler = this.options.errors.classHandler( element, this.isRadioOrCheckbox ) || this.$element;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
// error ul dom management done only once at init
|
|
359
|
-
this.ulErrorManagement();
|
|
360
|
-
|
|
361
|
-
// bind some html5 properties
|
|
362
|
-
this.bindHtml5Constraints();
|
|
363
|
-
|
|
364
|
-
// bind validators to field
|
|
365
|
-
this.addConstraints();
|
|
366
|
-
|
|
367
|
-
// bind parsley events if validators have been registered
|
|
368
|
-
if ( this.hasConstraints() ) {
|
|
369
|
-
this.bindValidationEvents();
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
, setParent: function ( elem ) {
|
|
374
|
-
this.$parent = $( elem );
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
, getParent: function () {
|
|
378
|
-
return this.$parent;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* Bind some extra html5 types / validators
|
|
383
|
-
*
|
|
384
|
-
* @private
|
|
385
|
-
* @method bindHtml5Constraints
|
|
386
|
-
*/
|
|
387
|
-
, bindHtml5Constraints: function () {
|
|
388
|
-
// add html5 required support + class required support
|
|
389
|
-
if ( this.$element.hasClass( 'required' ) || this.$element.prop( 'required' ) ) {
|
|
390
|
-
this.options.required = true;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
// add html5 supported types & options
|
|
394
|
-
if ( 'undefined' !== typeof this.$element.attr( 'type' ) && new RegExp( this.$element.attr( 'type' ), 'i' ).test( 'email url number range' ) ) {
|
|
395
|
-
this.options.type = this.$element.attr( 'type' );
|
|
396
|
-
|
|
397
|
-
// number and range types could have min and/or max values
|
|
398
|
-
if ( new RegExp( this.options.type, 'i' ).test( 'number range' ) ) {
|
|
399
|
-
this.options.type = 'number';
|
|
400
|
-
|
|
401
|
-
// double condition to support jQuery and Zepto.. :(
|
|
402
|
-
if ( 'undefined' !== typeof this.$element.attr( 'min' ) && this.$element.attr( 'min' ).length ) {
|
|
403
|
-
this.options.min = this.$element.attr( 'min' );
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
if ( 'undefined' !== typeof this.$element.attr( 'max' ) && this.$element.attr( 'max' ).length ) {
|
|
407
|
-
this.options.max = this.$element.attr( 'max' );
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
if ( 'string' === typeof this.$element.attr( 'pattern' ) && this.$element.attr( 'pattern' ).length ) {
|
|
413
|
-
this.options.regexp = this.$element.attr( 'pattern' );
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Attach field validators functions passed through data-api
|
|
420
|
-
*
|
|
421
|
-
* @private
|
|
422
|
-
* @method addConstraints
|
|
423
|
-
*/
|
|
424
|
-
, addConstraints: function () {
|
|
425
|
-
for ( var constraint in this.options ) {
|
|
426
|
-
var addConstraint = {};
|
|
427
|
-
addConstraint[ constraint ] = this.options[ constraint ];
|
|
428
|
-
this.addConstraint( addConstraint, true );
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* Dynamically add a new constraint to a field
|
|
434
|
-
*
|
|
435
|
-
* @method addConstraint
|
|
436
|
-
* @param {Object} constraint { name: requirements }
|
|
437
|
-
*/
|
|
438
|
-
, addConstraint: function ( constraint, doNotUpdateValidationEvents ) {
|
|
439
|
-
for ( var name in constraint ) {
|
|
440
|
-
name = name.toLowerCase();
|
|
441
|
-
|
|
442
|
-
if ( 'function' === typeof this.Validator.validators[ name ] ) {
|
|
443
|
-
this.constraints[ name ] = {
|
|
444
|
-
name: name
|
|
445
|
-
, requirements: constraint[ name ]
|
|
446
|
-
, valid: null
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
if ( name === 'required' ) {
|
|
450
|
-
this.isRequired = true;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
this.addCustomConstraintMessage( name );
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
// force field validation next check and reset validation events
|
|
458
|
-
if ( 'undefined' === typeof doNotUpdateValidationEvents ) {
|
|
459
|
-
this.bindValidationEvents();
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
/**
|
|
464
|
-
* Dynamically update an existing constraint to a field.
|
|
465
|
-
* Simple API: { name: requirements }
|
|
466
|
-
*
|
|
467
|
-
* @method updtConstraint
|
|
468
|
-
* @param {Object} constraint
|
|
469
|
-
*/
|
|
470
|
-
, updateConstraint: function ( constraint, message ) {
|
|
471
|
-
for ( var name in constraint ) {
|
|
472
|
-
this.updtConstraint( { name: name, requirements: constraint[ name ], valid: null }, message );
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Dynamically update an existing constraint to a field.
|
|
478
|
-
* Complex API: { name: name, requirements: requirements, valid: boolean }
|
|
479
|
-
*
|
|
480
|
-
* @method updtConstraint
|
|
481
|
-
* @param {Object} constraint
|
|
482
|
-
*/
|
|
483
|
-
, updtConstraint: function ( constraint, message ) {
|
|
484
|
-
this.constraints[ constraint.name ] = $.extend( true, this.constraints[ constraint.name ], constraint );
|
|
485
|
-
|
|
486
|
-
if ( 'string' === typeof message ) {
|
|
487
|
-
this.Validator.messages[ constraint.name ] = message ;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
// force field validation next check and reset validation events
|
|
491
|
-
this.bindValidationEvents();
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
/**
|
|
495
|
-
* Dynamically remove an existing constraint to a field.
|
|
496
|
-
*
|
|
497
|
-
* @method removeConstraint
|
|
498
|
-
* @param {String} constraintName
|
|
499
|
-
*/
|
|
500
|
-
, removeConstraint: function ( constraintName ) {
|
|
501
|
-
var constraintName = constraintName.toLowerCase();
|
|
502
|
-
|
|
503
|
-
delete this.constraints[ constraintName ];
|
|
504
|
-
|
|
505
|
-
if ( constraintName === 'required' ) {
|
|
506
|
-
this.isRequired = false;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
// if there are no more constraint, destroy parsley instance for this field
|
|
510
|
-
if ( !this.hasConstraints() ) {
|
|
511
|
-
// in a form context, remove item from parent
|
|
512
|
-
if ( 'ParsleyForm' === typeof this.getParent() ) {
|
|
513
|
-
this.getParent().removeItem( this.$element );
|
|
514
|
-
return;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
this.destroy();
|
|
518
|
-
return;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
this.bindValidationEvents();
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
/**
|
|
525
|
-
* Add custom constraint message, passed through data-API
|
|
526
|
-
*
|
|
527
|
-
* @private
|
|
528
|
-
* @method addCustomConstraintMessage
|
|
529
|
-
* @param constraint
|
|
530
|
-
*/
|
|
531
|
-
, addCustomConstraintMessage: function ( constraint ) {
|
|
532
|
-
// custom message type data-type-email-message -> typeEmailMessage | data-minlength-error => minlengthMessage
|
|
533
|
-
var customMessage = constraint
|
|
534
|
-
+ ( 'type' === constraint && 'undefined' !== typeof this.options[ constraint ] ? this.options[ constraint ].charAt( 0 ).toUpperCase() + this.options[ constraint ].substr( 1 ) : '' )
|
|
535
|
-
+ 'Message';
|
|
536
|
-
|
|
537
|
-
if ( 'undefined' !== typeof this.options[ customMessage ] ) {
|
|
538
|
-
this.Validator.addMessage( 'type' === constraint ? this.options[ constraint ] : constraint, this.options[ customMessage ], 'type' === constraint );
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
/**
|
|
543
|
-
* Bind validation events on a field
|
|
544
|
-
*
|
|
545
|
-
* @private
|
|
546
|
-
* @method bindValidationEvents
|
|
547
|
-
*/
|
|
548
|
-
, bindValidationEvents: function () {
|
|
549
|
-
// this field has validation events, that means it has to be validated
|
|
550
|
-
this.valid = null;
|
|
551
|
-
this.$element.addClass( 'parsley-validated' );
|
|
552
|
-
|
|
553
|
-
// remove eventually already binded events
|
|
554
|
-
this.$element.off( '.' + this.type );
|
|
555
|
-
|
|
556
|
-
// force add 'change' event if async remote validator here to have result before form submitting
|
|
557
|
-
if ( this.options.remote && !new RegExp( 'change', 'i' ).test( this.options.trigger ) ) {
|
|
558
|
-
this.options.trigger = !this.options.trigger ? 'change' : ' change';
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
// alaways bind keyup event, for better UX when a field is invalid
|
|
562
|
-
var triggers = ( !this.options.trigger ? '' : this.options.trigger )
|
|
563
|
-
+ ( new RegExp( 'key', 'i' ).test( this.options.trigger ) ? '' : ' keyup' );
|
|
564
|
-
|
|
565
|
-
// alaways bind change event, for better UX when a select is invalid
|
|
566
|
-
if ( this.$element.is( 'select' ) ) {
|
|
567
|
-
triggers += new RegExp( 'change', 'i' ).test( triggers ) ? '' : ' change';
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
// trim triggers to bind them correctly with .on()
|
|
571
|
-
triggers = triggers.replace( /^\s+/g , '' ).replace( /\s+$/g , '' );
|
|
572
|
-
|
|
573
|
-
this.$element.on( ( triggers + ' ' ).split( ' ' ).join( '.' + this.type + ' ' ), false, $.proxy( this.eventValidation, this ) );
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
/**
|
|
577
|
-
* Hash management. Used for ul error
|
|
578
|
-
*
|
|
579
|
-
* @method generateHash
|
|
580
|
-
* @returns {String} 5 letters unique hash
|
|
581
|
-
*/
|
|
582
|
-
, generateHash: function () {
|
|
583
|
-
return 'parsley-' + ( Math.random() + '' ).substring( 2 );
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
/**
|
|
587
|
-
* Public getHash accessor
|
|
588
|
-
*
|
|
589
|
-
* @method getHash
|
|
590
|
-
* @returns {String} hash
|
|
591
|
-
*/
|
|
592
|
-
, getHash: function () {
|
|
593
|
-
return this.hash;
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
* Returns field val needed for validation
|
|
598
|
-
* Special treatment for radio & checkboxes
|
|
599
|
-
*
|
|
600
|
-
* @method getVal
|
|
601
|
-
* @returns {String} val
|
|
602
|
-
*/
|
|
603
|
-
, getVal: function () {
|
|
604
|
-
return this.$element.data('value') || this.$element.val();
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
/**
|
|
608
|
-
* Called when validation is triggered by an event
|
|
609
|
-
* Do nothing if val.length < this.options.validationMinlength
|
|
610
|
-
*
|
|
611
|
-
* @method eventValidation
|
|
612
|
-
* @param {Object} event jQuery event
|
|
613
|
-
*/
|
|
614
|
-
, eventValidation: function ( event ) {
|
|
615
|
-
var val = this.getVal();
|
|
616
|
-
|
|
617
|
-
// do nothing on keypress event if not explicitely passed as data-trigger and if field has not already been validated once
|
|
618
|
-
if ( event.type === 'keyup' && !/keyup/i.test( this.options.trigger ) && !this.validatedOnce ) {
|
|
619
|
-
return true;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
// do nothing on change event if not explicitely passed as data-trigger and if field has not already been validated once
|
|
623
|
-
if ( event.type === 'change' && !/change/i.test( this.options.trigger ) && !this.validatedOnce ) {
|
|
624
|
-
return true;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
// start validation process only if field has enough chars and validation never started
|
|
628
|
-
if ( !this.isRadioOrCheckbox && this.getLength(val) < this.options.validationMinlength && !this.validatedOnce ) {
|
|
629
|
-
return true;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
this.validate();
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
/**
|
|
636
|
-
* Get the length of a given value
|
|
637
|
-
*
|
|
638
|
-
* @method getLength
|
|
639
|
-
* @return {int} The length of the value
|
|
640
|
-
*/
|
|
641
|
-
, getLength: function(val) {
|
|
642
|
-
if (!val || !val.hasOwnProperty('length')) return 0;
|
|
643
|
-
return val.length;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* Return if field verify its constraints
|
|
648
|
-
*
|
|
649
|
-
* @method isValid
|
|
650
|
-
* @return {Boolean} Is field valid or not
|
|
651
|
-
*/
|
|
652
|
-
, isValid: function () {
|
|
653
|
-
return this.validate( false );
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
/**
|
|
657
|
-
* Return if field has constraints
|
|
658
|
-
*
|
|
659
|
-
* @method hasConstraints
|
|
660
|
-
* @return {Boolean} Is field has constraints or not
|
|
661
|
-
*/
|
|
662
|
-
, hasConstraints: function () {
|
|
663
|
-
for ( var constraint in this.constraints ) {
|
|
664
|
-
return true;
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
return false;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
/**
|
|
671
|
-
* Validate a field & display errors
|
|
672
|
-
*
|
|
673
|
-
* @method validate
|
|
674
|
-
* @param {Boolean} errorBubbling set to false if you just want valid boolean without error bubbling next to fields
|
|
675
|
-
* @return {Boolean} Is field valid or not
|
|
676
|
-
*/
|
|
677
|
-
, validate: function ( errorBubbling ) {
|
|
678
|
-
var val = this.getVal()
|
|
679
|
-
, valid = null;
|
|
680
|
-
|
|
681
|
-
// do not even bother trying validating a field w/o constraints
|
|
682
|
-
if ( !this.hasConstraints() ) {
|
|
683
|
-
return null;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
// reset Parsley validation if onFieldValidate returns true, or if field is empty and not required
|
|
687
|
-
if ( this.options.listeners.onFieldValidate( this.element, this ) || ( '' === val && !this.isRequired ) ) {
|
|
688
|
-
this.reset();
|
|
689
|
-
return null;
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
// do not validate a field already validated and unchanged !
|
|
693
|
-
if ( !this.needsValidation( val ) ) {
|
|
694
|
-
return this.valid;
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
valid = this.applyValidators();
|
|
698
|
-
|
|
699
|
-
if ( 'undefined' !== typeof errorBubbling ? errorBubbling : this.options.showErrors ) {
|
|
700
|
-
this.manageValidationResult();
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
return valid;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
/**
|
|
707
|
-
* Check if value has changed since previous validation
|
|
708
|
-
*
|
|
709
|
-
* @method needsValidation
|
|
710
|
-
* @param value
|
|
711
|
-
* @return {Boolean}
|
|
712
|
-
*/
|
|
713
|
-
, needsValidation: function ( val ) {
|
|
714
|
-
if ( !this.options.validateIfUnchanged && this.valid !== null && this.val === val && this.validatedOnce ) {
|
|
715
|
-
return false;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
this.val = val;
|
|
719
|
-
return this.validatedOnce = true;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
/**
|
|
723
|
-
* Loop through every fields validators
|
|
724
|
-
* Adds errors after unvalid fields
|
|
725
|
-
*
|
|
726
|
-
* @method applyValidators
|
|
727
|
-
* @return {Mixed} {Boolean} If field valid or not, null if not validated
|
|
728
|
-
*/
|
|
729
|
-
, applyValidators: function () {
|
|
730
|
-
var valid = null;
|
|
731
|
-
|
|
732
|
-
for ( var constraint in this.constraints ) {
|
|
733
|
-
var result = this.Validator.validators[ this.constraints[ constraint ].name ]( this.val, this.constraints[ constraint ].requirements, this );
|
|
734
|
-
|
|
735
|
-
if ( false === result ) {
|
|
736
|
-
valid = false;
|
|
737
|
-
this.constraints[ constraint ].valid = valid;
|
|
738
|
-
} else if ( true === result ) {
|
|
739
|
-
this.constraints[ constraint ].valid = true;
|
|
740
|
-
valid = false !== valid;
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
// listeners' ballet
|
|
745
|
-
if (false === valid) {
|
|
746
|
-
this.options.listeners.onFieldError( this.element, this.constraints, this );
|
|
747
|
-
} else if (true === valid && false === this.options.listeners.onFieldSuccess( this.element, this.constraints, this )) {
|
|
748
|
-
// if onFieldSuccess returns (bool) false, consider that field si invalid
|
|
749
|
-
valid = false;
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
return valid;
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
/**
|
|
756
|
-
* Fired when all validators have be executed
|
|
757
|
-
* Returns true or false if field is valid or not
|
|
758
|
-
* Display errors messages below failed fields
|
|
759
|
-
* Adds parsley-success or parsley-error class on fields
|
|
760
|
-
*
|
|
761
|
-
* @method manageValidationResult
|
|
762
|
-
* @return {Boolean} Is field valid or not
|
|
763
|
-
*/
|
|
764
|
-
, manageValidationResult: function () {
|
|
765
|
-
var valid = null;
|
|
766
|
-
|
|
767
|
-
for ( var constraint in this.constraints ) {
|
|
768
|
-
if ( false === this.constraints[ constraint ].valid ) {
|
|
769
|
-
this.manageError( this.constraints[ constraint ] );
|
|
770
|
-
valid = false;
|
|
771
|
-
} else if ( true === this.constraints[ constraint ].valid ) {
|
|
772
|
-
this.removeError( this.constraints[ constraint ].name );
|
|
773
|
-
valid = false !== valid;
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
this.valid = valid;
|
|
778
|
-
|
|
779
|
-
if ( true === this.valid ) {
|
|
780
|
-
this.removeErrors();
|
|
781
|
-
this.errorClassHandler.removeClass( this.options.errorClass ).addClass( this.options.successClass );
|
|
782
|
-
return true;
|
|
783
|
-
} else if ( false === this.valid ) {
|
|
784
|
-
this.errorClassHandler.removeClass( this.options.successClass ).addClass( this.options.errorClass );
|
|
785
|
-
return false;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
// remove li error, and ul error if no more li inside
|
|
789
|
-
if ( this.ulError && $( this.ulError ).children().length === 0 ) {
|
|
790
|
-
this.removeErrors();
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
return valid;
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
/**
|
|
797
|
-
* Manage ul error Container
|
|
798
|
-
*
|
|
799
|
-
* @private
|
|
800
|
-
* @method ulErrorManagement
|
|
801
|
-
*/
|
|
802
|
-
, ulErrorManagement: function () {
|
|
803
|
-
this.ulError = '#' + this.hash;
|
|
804
|
-
this.ulTemplate = $( this.options.errors.errorsWrapper ).attr( 'id', this.hash ).addClass( 'parsley-error-list' );
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
/**
|
|
808
|
-
* Remove li / ul error
|
|
809
|
-
*
|
|
810
|
-
* @method removeError
|
|
811
|
-
* @param {String} constraintName Method Name
|
|
812
|
-
*/
|
|
813
|
-
, removeError: function ( constraintName ) {
|
|
814
|
-
var liError = this.ulError + ' .' + constraintName
|
|
815
|
-
, that = this;
|
|
816
|
-
|
|
817
|
-
this.options.animate ? $( liError ).fadeOut( this.options.animateDuration, function () {
|
|
818
|
-
$( this ).remove();
|
|
819
|
-
|
|
820
|
-
if ( that.ulError && $( that.ulError ).children().length === 0 ) {
|
|
821
|
-
that.removeErrors();
|
|
822
|
-
} } ) : $( liError ).remove();
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
/**
|
|
826
|
-
* Add li error
|
|
827
|
-
*
|
|
828
|
-
* @method addError
|
|
829
|
-
* @param {Object} { minlength: "error message for minlength constraint" }
|
|
830
|
-
*/
|
|
831
|
-
, addError: function ( error ) {
|
|
832
|
-
for ( var constraint in error ) {
|
|
833
|
-
var liTemplate = $( this.options.errors.errorElem ).addClass( constraint );
|
|
834
|
-
|
|
835
|
-
$( this.ulError ).append( this.options.animate ? $( liTemplate ).html( error[ constraint ] ).hide().fadeIn( this.options.animateDuration ) : $( liTemplate ).html( error[ constraint ] ) );
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
/**
|
|
840
|
-
* Remove all ul / li errors
|
|
841
|
-
*
|
|
842
|
-
* @method removeErrors
|
|
843
|
-
*/
|
|
844
|
-
, removeErrors: function () {
|
|
845
|
-
this.options.animate ? $( this.ulError ).fadeOut( this.options.animateDuration, function () { $( this ).remove(); } ) : $( this.ulError ).remove();
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
/**
|
|
849
|
-
* Remove ul errors and parsley error or success classes
|
|
850
|
-
*
|
|
851
|
-
* @method reset
|
|
852
|
-
*/
|
|
853
|
-
, reset: function () {
|
|
854
|
-
this.valid = null;
|
|
855
|
-
this.removeErrors();
|
|
856
|
-
this.validatedOnce = false;
|
|
857
|
-
this.errorClassHandler.removeClass( this.options.successClass ).removeClass( this.options.errorClass );
|
|
858
|
-
|
|
859
|
-
for ( var constraint in this.constraints ) {
|
|
860
|
-
this.constraints[ constraint ].valid = null;
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
return this;
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
/**
|
|
867
|
-
* Add li / ul errors messages
|
|
868
|
-
*
|
|
869
|
-
* @method manageError
|
|
870
|
-
* @param {Object} constraint
|
|
871
|
-
*/
|
|
872
|
-
, manageError: function ( constraint ) {
|
|
873
|
-
// display ulError container if it has been removed previously (or never shown)
|
|
874
|
-
if ( !$( this.ulError ).length ) {
|
|
875
|
-
this.manageErrorContainer();
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
// TODO: refacto properly
|
|
879
|
-
// if required constraint but field is not null, do not display
|
|
880
|
-
if ( 'required' === constraint.name && null !== this.getVal() && this.getVal().length > 0 ) {
|
|
881
|
-
return;
|
|
882
|
-
// if empty required field and non required constraint fails, do not display
|
|
883
|
-
} else if ( this.isRequired && 'required' !== constraint.name && ( null === this.getVal() || 0 === this.getVal().length ) ) {
|
|
884
|
-
this.removeError(constraint.name);
|
|
885
|
-
return;
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
// TODO: refacto error name w/ proper & readable function
|
|
889
|
-
var constraintName = constraint.name
|
|
890
|
-
, liClass = false !== this.options.errorMessage ? 'custom-error-message' : constraintName
|
|
891
|
-
, liError = {}
|
|
892
|
-
, message = false !== this.options.errorMessage ? this.options.errorMessage : ( constraint.name === 'type' ?
|
|
893
|
-
this.Validator.messages[ constraintName ][ constraint.requirements ] : ( 'undefined' === typeof this.Validator.messages[ constraintName ] ?
|
|
894
|
-
this.Validator.messages.defaultMessage : this.Validator.formatMesssage( this.Validator.messages[ constraintName ], constraint.requirements ) ) );
|
|
895
|
-
|
|
896
|
-
// add liError if not shown. Do not add more than once custom errorMessage if exist
|
|
897
|
-
if ( !$( this.ulError + ' .' + liClass ).length ) {
|
|
898
|
-
liError[ liClass ] = message;
|
|
899
|
-
this.addError( liError );
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
/**
|
|
904
|
-
* Create ul error container
|
|
905
|
-
*
|
|
906
|
-
* @method manageErrorContainer
|
|
907
|
-
*/
|
|
908
|
-
, manageErrorContainer: function () {
|
|
909
|
-
var errorContainer = this.options.errorContainer || this.options.errors.container( this.element, this.isRadioOrCheckbox )
|
|
910
|
-
, ulTemplate = this.options.animate ? this.ulTemplate.show() : this.ulTemplate;
|
|
911
|
-
|
|
912
|
-
if ( 'undefined' !== typeof errorContainer ) {
|
|
913
|
-
$( errorContainer ).append( ulTemplate );
|
|
914
|
-
return;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
!this.isRadioOrCheckbox ? this.$element.after( ulTemplate ) : this.$element.parent().after( ulTemplate );
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
/**
|
|
921
|
-
* Add custom listeners
|
|
922
|
-
*
|
|
923
|
-
* @param {Object} { listener: function () {} }, eg { onFormSubmit: function ( valid, event, focus ) { ... } }
|
|
924
|
-
*/
|
|
925
|
-
, addListener: function ( object ) {
|
|
926
|
-
for ( var listener in object ) {
|
|
927
|
-
this.options.listeners[ listener ] = object[ listener ];
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
/**
|
|
932
|
-
* Destroy parsley field instance
|
|
933
|
-
*
|
|
934
|
-
* @private
|
|
935
|
-
* @method destroy
|
|
936
|
-
*/
|
|
937
|
-
, destroy: function () {
|
|
938
|
-
this.$element.removeClass( 'parsley-validated' );
|
|
939
|
-
this.reset().$element.off( '.' + this.type ).removeData( this.type );
|
|
940
|
-
}
|
|
941
|
-
};
|
|
942
|
-
|
|
943
|
-
/**
|
|
944
|
-
* ParsleyFieldMultiple override ParsleyField for checkbox and radio inputs
|
|
945
|
-
* Pseudo-heritance to manage divergent behavior from ParsleyItem in dedicated methods
|
|
946
|
-
*
|
|
947
|
-
* @class ParsleyFieldMultiple
|
|
948
|
-
* @constructor
|
|
949
|
-
*/
|
|
950
|
-
var ParsleyFieldMultiple = function ( element, options, type ) {
|
|
951
|
-
this.initMultiple( element, options );
|
|
952
|
-
this.inherit( element, options );
|
|
953
|
-
this.Validator = new Validator( options );
|
|
954
|
-
|
|
955
|
-
// call ParsleyField constructor
|
|
956
|
-
this.init( element, type || 'ParsleyFieldMultiple' );
|
|
957
|
-
};
|
|
958
|
-
|
|
959
|
-
ParsleyFieldMultiple.prototype = {
|
|
960
|
-
|
|
961
|
-
constructor: ParsleyFieldMultiple
|
|
962
|
-
|
|
963
|
-
/**
|
|
964
|
-
* Set some specific properties, call some extra methods to manage radio / checkbox
|
|
965
|
-
*
|
|
966
|
-
* @method init
|
|
967
|
-
* @param {Object} element
|
|
968
|
-
* @param {Object} options
|
|
969
|
-
*/
|
|
970
|
-
, initMultiple: function ( element, options ) {
|
|
971
|
-
this.element = element;
|
|
972
|
-
this.$element = $( element );
|
|
973
|
-
this.group = options.group || false;
|
|
974
|
-
this.hash = this.getName();
|
|
975
|
-
this.siblings = this.group ? '[data-group="' + this.group + '"]' : 'input[name="' + this.$element.attr( 'name' ) + '"]';
|
|
976
|
-
this.isRadioOrCheckbox = true;
|
|
977
|
-
this.isRadio = this.$element.is( 'input[type=radio]' );
|
|
978
|
-
this.isCheckbox = this.$element.is( 'input[type=checkbox]' );
|
|
979
|
-
this.errorClassHandler = options.errors.classHandler( element, this.isRadioOrCheckbox ) || this.$element.parent();
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
/**
|
|
983
|
-
* Set specific constraints messages, do pseudo-heritance
|
|
984
|
-
*
|
|
985
|
-
* @private
|
|
986
|
-
* @method inherit
|
|
987
|
-
* @param {Object} element
|
|
988
|
-
* @param {Object} options
|
|
989
|
-
*/
|
|
990
|
-
, inherit: function ( element, options ) {
|
|
991
|
-
var clone = new ParsleyField( element, options, 'ParsleyFieldMultiple' );
|
|
992
|
-
|
|
993
|
-
for ( var property in clone ) {
|
|
994
|
-
if ( 'undefined' === typeof this[ property ] ) {
|
|
995
|
-
this[ property ] = clone [ property ];
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
/**
|
|
1001
|
-
* Set specific constraints messages, do pseudo-heritance
|
|
1002
|
-
*
|
|
1003
|
-
* @method getName
|
|
1004
|
-
* @returns {String} radio / checkbox hash is cleaned 'name' or data-group property
|
|
1005
|
-
*/
|
|
1006
|
-
, getName: function () {
|
|
1007
|
-
if ( this.group ) {
|
|
1008
|
-
return 'parsley-' + this.group;
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
if ( 'undefined' === typeof this.$element.attr( 'name' ) ) {
|
|
1012
|
-
throw "A radio / checkbox input must have a data-group attribute or a name to be Parsley validated !";
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
return 'parsley-' + this.$element.attr( 'name' ).replace( /(:|\.|\[|\])/g, '' );
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
/**
|
|
1019
|
-
* Special treatment for radio & checkboxes
|
|
1020
|
-
* Returns checked radio or checkboxes values
|
|
1021
|
-
*
|
|
1022
|
-
* @method getVal
|
|
1023
|
-
* @returns {String} val
|
|
1024
|
-
*/
|
|
1025
|
-
, getVal: function () {
|
|
1026
|
-
if ( this.isRadio ) {
|
|
1027
|
-
return $( this.siblings + ':checked' ).val() || '';
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
if ( this.isCheckbox ) {
|
|
1031
|
-
var values = [];
|
|
1032
|
-
|
|
1033
|
-
$( this.siblings + ':checked' ).each( function () {
|
|
1034
|
-
values.push( $( this ).val() );
|
|
1035
|
-
} );
|
|
1036
|
-
|
|
1037
|
-
return values;
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
/**
|
|
1042
|
-
* Bind validation events on a field
|
|
1043
|
-
*
|
|
1044
|
-
* @private
|
|
1045
|
-
* @method bindValidationEvents
|
|
1046
|
-
*/
|
|
1047
|
-
, bindValidationEvents: function () {
|
|
1048
|
-
// this field has validation events, that means it has to be validated
|
|
1049
|
-
this.valid = null;
|
|
1050
|
-
this.$element.addClass( 'parsley-validated' );
|
|
1051
|
-
|
|
1052
|
-
// remove eventually already binded events
|
|
1053
|
-
this.$element.off( '.' + this.type );
|
|
1054
|
-
|
|
1055
|
-
// alaways bind keyup event, for better UX when a field is invalid
|
|
1056
|
-
var self = this
|
|
1057
|
-
, triggers = ( !this.options.trigger ? '' : this.options.trigger )
|
|
1058
|
-
+ ( new RegExp( 'change', 'i' ).test( this.options.trigger ) ? '' : ' change' );
|
|
1059
|
-
|
|
1060
|
-
// trim triggers to bind them correctly with .on()
|
|
1061
|
-
triggers = triggers.replace( /^\s+/g , '' ).replace( /\s+$/g ,'' );
|
|
1062
|
-
|
|
1063
|
-
// bind trigger event on every siblings
|
|
1064
|
-
$( this.siblings ).each(function () {
|
|
1065
|
-
$( this ).on( triggers.split( ' ' ).join( '.' + self.type + ' ' ) , false, $.proxy( self.eventValidation, self ) );
|
|
1066
|
-
} )
|
|
1067
|
-
}
|
|
1068
|
-
};
|
|
1069
|
-
|
|
1070
|
-
/**
|
|
1071
|
-
* ParsleyForm class manage Parsley validated form.
|
|
1072
|
-
* Manage its fields and global validation
|
|
1073
|
-
*
|
|
1074
|
-
* @class ParsleyForm
|
|
1075
|
-
* @constructor
|
|
1076
|
-
*/
|
|
1077
|
-
var ParsleyForm = function ( element, options, type ) {
|
|
1078
|
-
this.init( element, options, type || 'parsleyForm' );
|
|
1079
|
-
};
|
|
1080
|
-
|
|
1081
|
-
ParsleyForm.prototype = {
|
|
1082
|
-
|
|
1083
|
-
constructor: ParsleyForm
|
|
1084
|
-
|
|
1085
|
-
/* init data, bind jQuery on() actions */
|
|
1086
|
-
, init: function ( element, options, type ) {
|
|
1087
|
-
this.type = type;
|
|
1088
|
-
this.items = [];
|
|
1089
|
-
this.$element = $( element );
|
|
1090
|
-
this.options = options;
|
|
1091
|
-
var self = this;
|
|
1092
|
-
|
|
1093
|
-
this.$element.find( options.inputs ).each( function () {
|
|
1094
|
-
self.addItem( this );
|
|
1095
|
-
});
|
|
1096
|
-
|
|
1097
|
-
this.$element.on( 'submit.' + this.type , false, $.proxy( this.validate, this ) );
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
/**
|
|
1101
|
-
* Add custom listeners
|
|
1102
|
-
*
|
|
1103
|
-
* @param {Object} { listener: function () {} }, eg { onFormSubmit: function ( valid, event, focus ) { ... } }
|
|
1104
|
-
*/
|
|
1105
|
-
, addListener: function ( object ) {
|
|
1106
|
-
for ( var listener in object ) {
|
|
1107
|
-
if ( new RegExp( 'Field' ).test( listener ) ) {
|
|
1108
|
-
for ( var item = 0; item < this.items.length; item++ ) {
|
|
1109
|
-
this.items[ item ].addListener( object );
|
|
1110
|
-
}
|
|
1111
|
-
} else {
|
|
1112
|
-
this.options.listeners[ listener ] = object[ listener ];
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
/**
|
|
1118
|
-
* Adds a new parsleyItem child to ParsleyForm
|
|
1119
|
-
*
|
|
1120
|
-
* @method addItem
|
|
1121
|
-
* @param elem
|
|
1122
|
-
*/
|
|
1123
|
-
, addItem: function ( elem ) {
|
|
1124
|
-
if ( $( elem ).is( this.options.excluded ) ) {
|
|
1125
|
-
return false;
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
var ParsleyField = $( elem ).parsley( this.options );
|
|
1129
|
-
ParsleyField.setParent( this );
|
|
1130
|
-
|
|
1131
|
-
this.items.push( ParsleyField );
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
/**
|
|
1135
|
-
* Removes a parsleyItem child from ParsleyForm
|
|
1136
|
-
*
|
|
1137
|
-
* @method removeItem
|
|
1138
|
-
* @param elem
|
|
1139
|
-
* @return {Boolean}
|
|
1140
|
-
*/
|
|
1141
|
-
, removeItem: function ( elem ) {
|
|
1142
|
-
var parsleyItem = $( elem ).parsley();
|
|
1143
|
-
|
|
1144
|
-
// identify & remove item if same Parsley hash
|
|
1145
|
-
for ( var i = 0; i < this.items.length; i++ ) {
|
|
1146
|
-
if ( this.items[ i ].hash === parsleyItem.hash ) {
|
|
1147
|
-
this.items[ i ].destroy();
|
|
1148
|
-
this.items.splice( i, 1 );
|
|
1149
|
-
return true;
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
return false;
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
/**
|
|
1157
|
-
* Process each form field validation
|
|
1158
|
-
* Display errors, call custom onFormSubmit() function
|
|
1159
|
-
*
|
|
1160
|
-
* @method validate
|
|
1161
|
-
* @param {Object} event jQuery Event
|
|
1162
|
-
* @return {Boolean} Is form valid or not
|
|
1163
|
-
*/
|
|
1164
|
-
, validate: function ( event ) {
|
|
1165
|
-
var valid = true;
|
|
1166
|
-
this.focusedField = false;
|
|
1167
|
-
|
|
1168
|
-
for ( var item = 0; item < this.items.length; item++ ) {
|
|
1169
|
-
if ( 'undefined' !== typeof this.items[ item ] && false === this.items[ item ].validate() ) {
|
|
1170
|
-
valid = false;
|
|
1171
|
-
|
|
1172
|
-
if ( !this.focusedField && 'first' === this.options.focus || 'last' === this.options.focus ) {
|
|
1173
|
-
this.focusedField = this.items[ item ].$element;
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
// form is invalid, focus an error field depending on focus policy
|
|
1179
|
-
if ( this.focusedField && !valid ) {
|
|
1180
|
-
// Scroll smoothly
|
|
1181
|
-
if ( this.options.scrollDuration > 0 ) {
|
|
1182
|
-
var that = this,
|
|
1183
|
-
top = this.focusedField.offset().top - $( window ).height() / 2; // Center the window on the field
|
|
1184
|
-
|
|
1185
|
-
$( 'html, body' ).animate( {
|
|
1186
|
-
scrollTop: top
|
|
1187
|
-
},
|
|
1188
|
-
this.options.scrollDuration,
|
|
1189
|
-
function () {
|
|
1190
|
-
that.focusedField.focus();
|
|
1191
|
-
}
|
|
1192
|
-
);
|
|
1193
|
-
// Just focus on the field and let the browser do the rest
|
|
1194
|
-
} else {
|
|
1195
|
-
this.focusedField.focus();
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
// if onFormSubmit returns (bool) false, form won't be submitted, even if valid
|
|
1200
|
-
var onFormSubmit = this.options.listeners.onFormSubmit( valid, event, this );
|
|
1201
|
-
if ('undefined' !== typeof onFormSubmit) {
|
|
1202
|
-
return onFormSubmit;
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
return valid;
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
, isValid: function () {
|
|
1209
|
-
for ( var item = 0; item < this.items.length; item++ ) {
|
|
1210
|
-
if ( false === this.items[ item ].isValid() ) {
|
|
1211
|
-
return false;
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
return true;
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
/**
|
|
1219
|
-
* Remove all errors ul under invalid fields
|
|
1220
|
-
*
|
|
1221
|
-
* @method removeErrors
|
|
1222
|
-
*/
|
|
1223
|
-
, removeErrors: function () {
|
|
1224
|
-
for ( var item = 0; item < this.items.length; item++ ) {
|
|
1225
|
-
this.items[ item ].parsley( 'reset' );
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
/**
|
|
1230
|
-
* destroy Parsley binded on the form and its fields
|
|
1231
|
-
*
|
|
1232
|
-
* @method destroy
|
|
1233
|
-
*/
|
|
1234
|
-
, destroy: function () {
|
|
1235
|
-
for ( var item = 0; item < this.items.length; item++ ) {
|
|
1236
|
-
this.items[ item ].destroy();
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
this.$element.off( '.' + this.type ).removeData( this.type );
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
/**
|
|
1243
|
-
* reset Parsley binded on the form and its fields
|
|
1244
|
-
*
|
|
1245
|
-
* @method reset
|
|
1246
|
-
*/
|
|
1247
|
-
, reset: function () {
|
|
1248
|
-
for ( var item = 0; item < this.items.length; item++ ) {
|
|
1249
|
-
this.items[ item ].reset();
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
};
|
|
1253
|
-
|
|
1254
|
-
/**
|
|
1255
|
-
* Parsley plugin definition
|
|
1256
|
-
* Provides an interface to access public Validator, ParsleyForm and ParsleyField functions
|
|
1257
|
-
*
|
|
1258
|
-
* @class Parsley
|
|
1259
|
-
* @constructor
|
|
1260
|
-
* @param {Mixed} Options. {Object} to configure Parsley or {String} method name to call a public class method
|
|
1261
|
-
* @param {Function} Callback function
|
|
1262
|
-
* @return {Mixed} public class method return
|
|
1263
|
-
*/
|
|
1264
|
-
$.fn.parsley = function ( option, fn ) {
|
|
1265
|
-
var options = $.extend( true, {}, $.fn.parsley.defaults, 'undefined' !== typeof window.ParsleyConfig ? window.ParsleyConfig : {}, option, this.data() )
|
|
1266
|
-
, newInstance = null;
|
|
1267
|
-
|
|
1268
|
-
function bind ( self, type ) {
|
|
1269
|
-
var parsleyInstance = $( self ).data( type );
|
|
1270
|
-
|
|
1271
|
-
// if data never binded or we want to clone a build (for radio & checkboxes), bind it right now!
|
|
1272
|
-
if ( !parsleyInstance ) {
|
|
1273
|
-
switch ( type ) {
|
|
1274
|
-
case 'parsleyForm':
|
|
1275
|
-
parsleyInstance = new ParsleyForm( self, options, 'parsleyForm' );
|
|
1276
|
-
break;
|
|
1277
|
-
case 'parsleyField':
|
|
1278
|
-
parsleyInstance = new ParsleyField( self, options, 'parsleyField' );
|
|
1279
|
-
break;
|
|
1280
|
-
case 'parsleyFieldMultiple':
|
|
1281
|
-
parsleyInstance = new ParsleyFieldMultiple( self, options, 'parsleyFieldMultiple' );
|
|
1282
|
-
break;
|
|
1283
|
-
default:
|
|
1284
|
-
return;
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
$( self ).data( type, parsleyInstance );
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
// here is our parsley public function accessor
|
|
1291
|
-
if ( 'string' === typeof option && 'function' === typeof parsleyInstance[ option ] ) {
|
|
1292
|
-
var response = parsleyInstance[ option ]( fn );
|
|
1293
|
-
|
|
1294
|
-
return 'undefined' !== typeof response ? response : $( self );
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
return parsleyInstance;
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
// if a form elem is given, bind all its input children
|
|
1301
|
-
if ( $( this ).is( 'form' ) || true === $( this ).data( 'bind' ) ) {
|
|
1302
|
-
newInstance = bind ( $( this ), 'parsleyForm' );
|
|
1303
|
-
|
|
1304
|
-
// if it is a Parsley supported single element, bind it too, except inputs type hidden
|
|
1305
|
-
// add here a return instance, cuz' we could call public methods on single elems with data[ option ]() above
|
|
1306
|
-
} else if ( $( this ).is( options.inputs ) && !$( this ).is( options.excluded ) ) {
|
|
1307
|
-
newInstance = bind( $( this ), !$( this ).is( 'input[type=radio], input[type=checkbox]' ) ? 'parsleyField' : 'parsleyFieldMultiple' );
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
return 'function' === typeof fn ? fn() : newInstance;
|
|
1311
|
-
};
|
|
1312
|
-
|
|
1313
|
-
$.fn.parsley.Constructor = ParsleyForm;
|
|
1314
|
-
|
|
1315
|
-
/**
|
|
1316
|
-
* Parsley plugin configuration
|
|
1317
|
-
*
|
|
1318
|
-
* @property $.fn.parsley.defaults
|
|
1319
|
-
* @type {Object}
|
|
1320
|
-
*/
|
|
1321
|
-
$.fn.parsley.defaults = {
|
|
1322
|
-
// basic data-api overridable properties here..
|
|
1323
|
-
inputs: 'input, textarea, select' // Default supported inputs.
|
|
1324
|
-
, excluded: 'input[type=hidden], input[type=file], :disabled' // Do not validate input[type=hidden] & :disabled.
|
|
1325
|
-
, trigger: false // $.Event() that will trigger validation. eg: keyup, change..
|
|
1326
|
-
, animate: true // fade in / fade out error messages
|
|
1327
|
-
, animateDuration: 300 // fadein/fadout ms time
|
|
1328
|
-
, scrollDuration: 500 // Duration in ms time of the window scroll when focusing on invalid field (0 = no scroll)
|
|
1329
|
-
, focus: 'first' // 'fist'|'last'|'none' which error field would have focus first on form validation
|
|
1330
|
-
, validationMinlength: 3 // If trigger validation specified, only if value.length > validationMinlength
|
|
1331
|
-
, successClass: 'parsley-success' // Class name on each valid input
|
|
1332
|
-
, errorClass: 'parsley-error' // Class name on each invalid input
|
|
1333
|
-
, errorMessage: false // Customize an unique error message showed if one constraint fails
|
|
1334
|
-
, validators: {} // Add your custom validators functions
|
|
1335
|
-
, showErrors: true // Set to false if you don't want Parsley to display error messages
|
|
1336
|
-
, messages: {} // Add your own error messages here
|
|
1337
|
-
|
|
1338
|
-
//some quite advanced configuration here..
|
|
1339
|
-
, validateIfUnchanged: false // false: validate once by field value change
|
|
1340
|
-
, errors: {
|
|
1341
|
-
classHandler: function ( elem, isRadioOrCheckbox ) {} // specify where parsley error-success classes are set
|
|
1342
|
-
, container: function ( elem, isRadioOrCheckbox ) {} // specify an elem where errors will be **apened**
|
|
1343
|
-
, errorsWrapper: '<ul></ul>' // do not set an id for this elem, it would have an auto-generated id
|
|
1344
|
-
, errorElem: '<li></li>' // each field constraint fail in an li
|
|
1345
|
-
}
|
|
1346
|
-
, listeners: {
|
|
1347
|
-
onFieldValidate: function ( elem, ParsleyForm ) { return false; } // Executed on validation. Return true to ignore field validation
|
|
1348
|
-
, onFormSubmit: function ( isFormValid, event, ParsleyForm ) {} // Executed once on form validation. Return (bool) false to block submit, even if valid
|
|
1349
|
-
, onFieldError: function ( elem, constraints, ParsleyField ) {} // Executed when a field is detected as invalid
|
|
1350
|
-
, onFieldSuccess: function ( elem, constraints, ParsleyField ) {} // Executed when a field passes validation
|
|
1351
|
-
}
|
|
1352
|
-
};
|
|
1353
|
-
|
|
1354
|
-
/* PARSLEY auto-bind DATA-API + Global config retrieving
|
|
1355
|
-
* =================================================== */
|
|
1356
|
-
$( window ).on( 'load', function () {
|
|
1357
|
-
$( '[data-validate="parsley"]' ).each( function () {
|
|
1358
|
-
$( this ).parsley();
|
|
1359
|
-
} );
|
|
1360
|
-
} );
|
|
1361
|
-
|
|
1362
|
-
// This plugin works with jQuery or Zepto (with data extension built for Zepto.)
|
|
1363
|
-
}(window.jQuery || window.Zepto);
|