pulse_meter_visualizer 0.4.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. data/.gitignore +19 -0
  2. data/.rbenv-version +1 -0
  3. data/.rspec +1 -0
  4. data/.rvmrc +1 -0
  5. data/.travis.yml +8 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE +22 -0
  8. data/Procfile +3 -0
  9. data/README.md +40 -0
  10. data/Rakefile +72 -0
  11. data/examples/basic.ru +145 -0
  12. data/examples/basic_sensor_data.rb +96 -0
  13. data/lib/pulse_meter/visualize/app.rb +78 -0
  14. data/lib/pulse_meter/visualize/base.rb +15 -0
  15. data/lib/pulse_meter/visualize/coffee/application.coffee +40 -0
  16. data/lib/pulse_meter/visualize/coffee/collections/page_info_list.coffee +17 -0
  17. data/lib/pulse_meter/visualize/coffee/collections/sensor_info_list.coffee +4 -0
  18. data/lib/pulse_meter/visualize/coffee/collections/widget_list.coffee +14 -0
  19. data/lib/pulse_meter/visualize/coffee/extensions.coffee +26 -0
  20. data/lib/pulse_meter/visualize/coffee/models/dinamic_widget.coffee +34 -0
  21. data/lib/pulse_meter/visualize/coffee/models/page_info.coffee +2 -0
  22. data/lib/pulse_meter/visualize/coffee/models/sensor_info.coffee +2 -0
  23. data/lib/pulse_meter/visualize/coffee/models/widget.coffee +54 -0
  24. data/lib/pulse_meter/visualize/coffee/presenters/area.coffee +2 -0
  25. data/lib/pulse_meter/visualize/coffee/presenters/gauge.coffee +11 -0
  26. data/lib/pulse_meter/visualize/coffee/presenters/line.coffee +2 -0
  27. data/lib/pulse_meter/visualize/coffee/presenters/pie.coffee +20 -0
  28. data/lib/pulse_meter/visualize/coffee/presenters/series.coffee +44 -0
  29. data/lib/pulse_meter/visualize/coffee/presenters/table.coffee +10 -0
  30. data/lib/pulse_meter/visualize/coffee/presenters/timeline.coffee +13 -0
  31. data/lib/pulse_meter/visualize/coffee/presenters/widget.coffee +65 -0
  32. data/lib/pulse_meter/visualize/coffee/router.coffee +21 -0
  33. data/lib/pulse_meter/visualize/coffee/views/dynamic_chart.coffee +91 -0
  34. data/lib/pulse_meter/visualize/coffee/views/dynamic_widget.coffee +58 -0
  35. data/lib/pulse_meter/visualize/coffee/views/page_title.coffee +17 -0
  36. data/lib/pulse_meter/visualize/coffee/views/page_titles.coffee +15 -0
  37. data/lib/pulse_meter/visualize/coffee/views/sensor_info_list.coffee +19 -0
  38. data/lib/pulse_meter/visualize/coffee/views/widget.coffee +99 -0
  39. data/lib/pulse_meter/visualize/coffee/views/widget_chart.coffee +13 -0
  40. data/lib/pulse_meter/visualize/coffee/views/widget_list.coffee +15 -0
  41. data/lib/pulse_meter/visualize/dsl/base.rb +131 -0
  42. data/lib/pulse_meter/visualize/dsl/errors.rb +40 -0
  43. data/lib/pulse_meter/visualize/dsl/layout.rb +27 -0
  44. data/lib/pulse_meter/visualize/dsl/page.rb +33 -0
  45. data/lib/pulse_meter/visualize/dsl/sensor.rb +20 -0
  46. data/lib/pulse_meter/visualize/dsl/widget.rb +37 -0
  47. data/lib/pulse_meter/visualize/dsl/widgets/area.rb +20 -0
  48. data/lib/pulse_meter/visualize/dsl/widgets/gauge.rb +12 -0
  49. data/lib/pulse_meter/visualize/dsl/widgets/line.rb +21 -0
  50. data/lib/pulse_meter/visualize/dsl/widgets/pie.rb +16 -0
  51. data/lib/pulse_meter/visualize/dsl/widgets/table.rb +19 -0
  52. data/lib/pulse_meter/visualize/layout.rb +79 -0
  53. data/lib/pulse_meter/visualize/page.rb +25 -0
  54. data/lib/pulse_meter/visualize/public/css/application.css +56 -0
  55. data/lib/pulse_meter/visualize/public/css/bootstrap.css +4883 -0
  56. data/lib/pulse_meter/visualize/public/css/bootstrap.min.css +729 -0
  57. data/lib/pulse_meter/visualize/public/css/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  58. data/lib/pulse_meter/visualize/public/css/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  59. data/lib/pulse_meter/visualize/public/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  60. data/lib/pulse_meter/visualize/public/css/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  61. data/lib/pulse_meter/visualize/public/css/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  62. data/lib/pulse_meter/visualize/public/css/images/ui-bg_glass_75_ffffff_1x400.png +0 -0
  63. data/lib/pulse_meter/visualize/public/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  64. data/lib/pulse_meter/visualize/public/css/images/ui-bg_inset-soft_95_fef1ec_1x100.png +0 -0
  65. data/lib/pulse_meter/visualize/public/css/images/ui-icons_222222_256x240.png +0 -0
  66. data/lib/pulse_meter/visualize/public/css/images/ui-icons_2e83ff_256x240.png +0 -0
  67. data/lib/pulse_meter/visualize/public/css/images/ui-icons_454545_256x240.png +0 -0
  68. data/lib/pulse_meter/visualize/public/css/images/ui-icons_888888_256x240.png +0 -0
  69. data/lib/pulse_meter/visualize/public/css/images/ui-icons_cd0a0a_256x240.png +0 -0
  70. data/lib/pulse_meter/visualize/public/css/images/ui-icons_f6cf3b_256x240.png +0 -0
  71. data/lib/pulse_meter/visualize/public/css/jquery-ui-1.8.16.bootstrap.css +1320 -0
  72. data/lib/pulse_meter/visualize/public/favicon.ico +208 -0
  73. data/lib/pulse_meter/visualize/public/img/glyphicons-halflings-white.png +0 -0
  74. data/lib/pulse_meter/visualize/public/img/glyphicons-halflings.png +0 -0
  75. data/lib/pulse_meter/visualize/public/js/application.js +973 -0
  76. data/lib/pulse_meter/visualize/public/js/backbone-min.js +38 -0
  77. data/lib/pulse_meter/visualize/public/js/bootstrap.js +1835 -0
  78. data/lib/pulse_meter/visualize/public/js/jquery-1.7.2.min.js +4 -0
  79. data/lib/pulse_meter/visualize/public/js/jquery-ui-1.8.16.bootstrap.min.js +791 -0
  80. data/lib/pulse_meter/visualize/public/js/jquery-ui-1.8.23.custom.min.js +21 -0
  81. data/lib/pulse_meter/visualize/public/js/jquery-ui-timepicker-addon.js +1687 -0
  82. data/lib/pulse_meter/visualize/public/js/json2.js +487 -0
  83. data/lib/pulse_meter/visualize/public/js/underscore-min.js +32 -0
  84. data/lib/pulse_meter/visualize/sensor.rb +63 -0
  85. data/lib/pulse_meter/visualize/series_extractor.rb +107 -0
  86. data/lib/pulse_meter/visualize/views/main.haml +30 -0
  87. data/lib/pulse_meter/visualize/views/sensors.haml +76 -0
  88. data/lib/pulse_meter/visualize/views/widgets/area.haml +53 -0
  89. data/lib/pulse_meter/visualize/views/widgets/extend_options.haml +11 -0
  90. data/lib/pulse_meter/visualize/views/widgets/gauge.haml +13 -0
  91. data/lib/pulse_meter/visualize/views/widgets/line.haml +54 -0
  92. data/lib/pulse_meter/visualize/views/widgets/pie.haml +13 -0
  93. data/lib/pulse_meter/visualize/views/widgets/table.haml +45 -0
  94. data/lib/pulse_meter/visualize/widget.rb +38 -0
  95. data/lib/pulse_meter/visualize/widgets/gauge.rb +47 -0
  96. data/lib/pulse_meter/visualize/widgets/pie.rb +36 -0
  97. data/lib/pulse_meter/visualize/widgets/timeline.rb +114 -0
  98. data/lib/pulse_meter/visualizer.rb +38 -0
  99. data/lib/pulse_meter_visualizer.rb +2 -0
  100. data/pulse_meter_visualizer.gemspec +41 -0
  101. data/spec/pulse_meter/visualize/app_spec.rb +27 -0
  102. data/spec/pulse_meter/visualize/dsl/layout_spec.rb +64 -0
  103. data/spec/pulse_meter/visualize/dsl/page_spec.rb +62 -0
  104. data/spec/pulse_meter/visualize/dsl/sensor_spec.rb +30 -0
  105. data/spec/pulse_meter/visualize/dsl/widget_spec.rb +6 -0
  106. data/spec/pulse_meter/visualize/dsl/widgets/area_spec.rb +44 -0
  107. data/spec/pulse_meter/visualize/dsl/widgets/gauge_spec.rb +22 -0
  108. data/spec/pulse_meter/visualize/dsl/widgets/line_spec.rb +44 -0
  109. data/spec/pulse_meter/visualize/dsl/widgets/pie_spec.rb +35 -0
  110. data/spec/pulse_meter/visualize/dsl/widgets/table_spec.rb +36 -0
  111. data/spec/pulse_meter/visualize/layout_spec.rb +54 -0
  112. data/spec/pulse_meter/visualize/page_spec.rb +153 -0
  113. data/spec/pulse_meter/visualize/sensor_spec.rb +120 -0
  114. data/spec/pulse_meter/visualize/series_extractor_spec.rb +80 -0
  115. data/spec/pulse_meter/visualize/widgets/area_spec.rb +6 -0
  116. data/spec/pulse_meter/visualize/widgets/gauge_spec.rb +63 -0
  117. data/spec/pulse_meter/visualize/widgets/line_spec.rb +6 -0
  118. data/spec/pulse_meter/visualize/widgets/pie_spec.rb +73 -0
  119. data/spec/pulse_meter/visualize/widgets/table_spec.rb +6 -0
  120. data/spec/pulse_meter/visualizer_spec.rb +42 -0
  121. data/spec/shared_examples/dsl_widget.rb +106 -0
  122. data/spec/shared_examples/widget.rb +97 -0
  123. data/spec/spec_helper.rb +36 -0
  124. metadata +518 -0
@@ -0,0 +1,21 @@
1
+ /*! jQuery UI - v1.8.23 - 2012-08-15
2
+ * https://github.com/jquery/jquery-ui
3
+ * Includes: jquery.ui.core.js
4
+ * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
5
+ (function(a,b){function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;return!b.href||!g||f.nodeName.toLowerCase()!=="map"?!1:(h=a("img[usemap=#"+g+"]")[0],!!h&&d(h))}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.ui=a.ui||{};if(a.ui.version)return;a.extend(a.ui,{version:"1.8.23",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;return a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a("<a>").outerWidth(1).jquery||a.each(["Width","Height"],function(c,d){function h(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)}),c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){return c===b?g["inner"+d].call(this):this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){return typeof b!="number"?g["outer"+d].call(this,b):this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:a.expr.createPseudo?a.expr.createPseudo(function(b){return function(c){return!!a.data(c,b)}}):function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));c.offsetHeight,a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.curCSS||(a.curCSS=a.css),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!d||!a.element[0].parentNode)return;for(var e=0;e<d.length;e++)a.options[d[e][0]]&&d[e][1].apply(a.element,c)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(b,c){if(a(b).css("overflow")==="hidden")return!1;var d=c&&c==="left"?"scrollLeft":"scrollTop",e=!1;return b[d]>0?!0:(b[d]=1,e=b[d]>0,b[d]=0,e)},isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(b,c,d,e,f,g){return a.ui.isOverAxis(b,d,f)&&a.ui.isOverAxis(c,e,g)}})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15
6
+ * https://github.com/jquery/jquery-ui
7
+ * Includes: jquery.ui.widget.js
8
+ * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
9
+ (function(a,b){if(a.cleanData){var c=a.cleanData;a.cleanData=function(b){for(var d=0,e;(e=b[d])!=null;d++)try{a(e).triggerHandler("remove")}catch(f){}c(b)}}else{var d=a.fn.remove;a.fn.remove=function(b,c){return this.each(function(){return c||(!b||a.filter(b,[this]).length)&&a("*",this).add([this]).each(function(){try{a(this).triggerHandler("remove")}catch(b){}}),d.call(a(this),b,c)})}}a.widget=function(b,c,d){var e=b.split(".")[0],f;b=b.split(".")[1],f=e+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][f]=function(c){return!!a.data(c,b)},a[e]=a[e]||{},a[e][b]=function(a,b){arguments.length&&this._createWidget(a,b)};var g=new c;g.options=a.extend(!0,{},g.options),a[e][b].prototype=a.extend(!0,g,{namespace:e,widgetName:b,widgetEventPrefix:a[e][b].prototype.widgetEventPrefix||b,widgetBaseClass:f},d),a.widget.bridge(b,a[e][b])},a.widget.bridge=function(c,d){a.fn[c]=function(e){var f=typeof e=="string",g=Array.prototype.slice.call(arguments,1),h=this;return e=!f&&g.length?a.extend.apply(null,[!0,e].concat(g)):e,f&&e.charAt(0)==="_"?h:(f?this.each(function(){var d=a.data(this,c),f=d&&a.isFunction(d[e])?d[e].apply(d,g):d;if(f!==d&&f!==b)return h=f,!1}):this.each(function(){var b=a.data(this,c);b?b.option(e||{})._init():a.data(this,c,new d(e,this))}),h)}},a.Widget=function(a,b){arguments.length&&this._createWidget(a,b)},a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(b,c){a.data(c,this.widgetName,this),this.element=a(c),this.options=a.extend(!0,{},this.options,this._getCreateOptions(),b);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()}),this._create(),this._trigger("create"),this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName),this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled")},widget:function(){return this.element},option:function(c,d){var e=c;if(arguments.length===0)return a.extend({},this.options);if(typeof c=="string"){if(d===b)return this.options[c];e={},e[c]=d}return this._setOptions(e),this},_setOptions:function(b){var c=this;return a.each(b,function(a,b){c._setOption(a,b)}),this},_setOption:function(a,b){return this.options[a]=b,a==="disabled"&&this.widget()[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",b),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(b,c,d){var e,f,g=this.options[b];d=d||{},c=a.Event(c),c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase(),c.target=this.element[0],f=c.originalEvent;if(f)for(e in f)e in c||(c[e]=f[e]);return this.element.trigger(c,d),!(a.isFunction(g)&&g.call(this.element[0],c,d)===!1||c.isDefaultPrevented())}}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15
10
+ * https://github.com/jquery/jquery-ui
11
+ * Includes: jquery.ui.mouse.js
12
+ * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
13
+ (function(a,b){var c=!1;a(document).mouseup(function(a){c=!1}),a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(a){return b._mouseDown(a)}).bind("click."+this.widgetName,function(c){if(!0===a.data(c.target,b.widgetName+".preventClickEvent"))return a.removeData(c.target,b.widgetName+".preventClickEvent"),c.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(b){if(c)return;this._mouseStarted&&this._mouseUp(b),this._mouseDownEvent=b;var d=this,e=b.which==1,f=typeof this.options.cancel=="string"&&b.target.nodeName?a(b.target).closest(this.options.cancel).length:!1;if(!e||f||!this._mouseCapture(b))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){d.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=this._mouseStart(b)!==!1;if(!this._mouseStarted)return b.preventDefault(),!0}return!0===a.data(b.target,this.widgetName+".preventClickEvent")&&a.removeData(b.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(a){return d._mouseMove(a)},this._mouseUpDelegate=function(a){return d._mouseUp(a)},a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),b.preventDefault(),c=!0,!0},_mouseMove:function(b){return!a.browser.msie||document.documentMode>=9||!!b.button?this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted):this._mouseUp(b)},_mouseUp:function(b){return a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b)),!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15
14
+ * https://github.com/jquery/jquery-ui
15
+ * Includes: jquery.ui.slider.js
16
+ * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
17
+ (function(a,b){var c=5;a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var b=this,d=this.options,e=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",g=d.values&&d.values.length||1,h=[];this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"+(d.disabled?" ui-slider-disabled ui-disabled":"")),this.range=a([]),d.range&&(d.range===!0&&(d.values||(d.values=[this._valueMin(),this._valueMin()]),d.values.length&&d.values.length!==2&&(d.values=[d.values[0],d.values[0]])),this.range=a("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;i<g;i+=1)h.push(f);this.handles=e.add(a(h.join("")).appendTo(b.element)),this.handle=this.handles.eq(0),this.handles.add(this.range).filter("a").click(function(a){a.preventDefault()}).hover(function(){d.disabled||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).focus(function(){d.disabled?a(this).blur():(a(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),a(this).addClass("ui-state-focus"))}).blur(function(){a(this).removeClass("ui-state-focus")}),this.handles.each(function(b){a(this).data("index.ui-slider-handle",b)}),this.handles.keydown(function(d){var e=a(this).data("index.ui-slider-handle"),f,g,h,i;if(b.options.disabled)return;switch(d.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.PAGE_UP:case a.ui.keyCode.PAGE_DOWN:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:d.preventDefault();if(!b._keySliding){b._keySliding=!0,a(this).addClass("ui-state-active"),f=b._start(d,e);if(f===!1)return}}i=b.options.step,b.options.values&&b.options.values.length?g=h=b.values(e):g=h=b.value();switch(d.keyCode){case a.ui.keyCode.HOME:h=b._valueMin();break;case a.ui.keyCode.END:h=b._valueMax();break;case a.ui.keyCode.PAGE_UP:h=b._trimAlignValue(g+(b._valueMax()-b._valueMin())/c);break;case a.ui.keyCode.PAGE_DOWN:h=b._trimAlignValue(g-(b._valueMax()-b._valueMin())/c);break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(g===b._valueMax())return;h=b._trimAlignValue(g+i);break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(g===b._valueMin())return;h=b._trimAlignValue(g-i)}b._slide(d,e,h)}).keyup(function(c){var d=a(this).data("index.ui-slider-handle");b._keySliding&&(b._keySliding=!1,b._stop(c,d),b._change(c,d),a(this).removeClass("ui-state-active"))}),this._refreshValue(),this._animateOff=!1},destroy:function(){return this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider"),this._mouseDestroy(),this},_mouseCapture:function(b){var c=this.options,d,e,f,g,h,i,j,k,l;return c.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),d={x:b.pageX,y:b.pageY},e=this._normValueFromMouse(d),f=this._valueMax()-this._valueMin()+1,h=this,this.handles.each(function(b){var c=Math.abs(e-h.values(b));f>c&&(f=c,g=a(this),i=b)}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i),j===!1?!1:(this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0,!0))},_mouseStart:function(a){return!0},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);return this._slide(a,this._handleIndex,c),!1},_mouseStop:function(a){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b,c,d,e,f;return this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e,this._trimAlignValue(f)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};return this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("start",a,c)},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c<d)&&(c=d),c!==this.values(b)&&(e=this.values(),e[b]=c,f=this._trigger("slide",a,{handle:this.handles[b],value:c,values:e}),d=this.values(b?0:1),f!==!1&&this.values(b,c,!0))):c!==this.value()&&(f=this._trigger("slide",a,{handle:this.handles[b],value:c}),f!==!1&&this.value(c))},_stop:function(a,b){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("stop",a,c)},_change:function(a,b){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("change",a,c)}},value:function(a){if(arguments.length){this.options.value=this._trimAlignValue(a),this._refreshValue(),this._change(null,0);return}return this._value()},values:function(b,c){var d,e,f;if(arguments.length>1){this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);return}if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f<d.length;f+=1)d[f]=this._trimAlignValue(e[f]),this._change(null,f);this._refreshValue()},_setOption:function(b,c){var d,e=0;a.isArray(this.options.values)&&(e=this.options.values.length),a.Widget.prototype._setOption.apply(this,arguments);switch(b){case"disabled":c?(this.handles.filter(".ui-state-focus").blur(),this.handles.removeClass("ui-state-hover"),this.handles.propAttr("disabled",!0),this.element.addClass("ui-disabled")):(this.handles.propAttr("disabled",!1),this.element.removeClass("ui-disabled"));break;case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":this._animateOff=!0,this._refreshValue();for(d=0;d<e;d+=1)this._change(null,d);this._animateOff=!1}},_value:function(){var a=this.options.value;return a=this._trimAlignValue(a),a},_values:function(a){var b,c,d;if(arguments.length)return b=this.options.values[a],b=this._trimAlignValue(b),b;c=this.options.values.slice();for(d=0;d<c.length;d+=1)c[d]=this._trimAlignValue(c[d]);return c},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;return Math.abs(c)*2>=b&&(d+=c>0?b:-b),parseFloat(d.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate}))),h=f}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}))}}),a.extend(a.ui.slider,{version:"1.8.23"})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15
18
+ * https://github.com/jquery/jquery-ui
19
+ * Includes: jquery.ui.datepicker.js
20
+ * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
21
+ (function($,undefined){function Datepicker(){this.debug=!1,this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},$.extend(this._defaults,this.regional[""]),this.dpDiv=bindHover($('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function bindHover(a){var b="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return a.bind("mouseout",function(a){var c=$(a.target).closest(b);if(!c.length)return;c.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(c){var d=$(c.target).closest(b);if($.datepicker._isDisabledDatepicker(instActive.inline?a.parent()[0]:instActive.input[0])||!d.length)return;d.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),d.addClass("ui-state-hover"),d.hasClass("ui-datepicker-prev")&&d.addClass("ui-datepicker-prev-hover"),d.hasClass("ui-datepicker-next")&&d.addClass("ui-datepicker-next-hover")})}function extendRemove(a,b){$.extend(a,b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a}function isArray(a){return a&&($.browser.safari&&typeof a=="object"&&a.length||a.constructor&&a.constructor.toString().match(/\Array\(\)/))}$.extend($.ui,{datepicker:{version:"1.8.23"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){return extendRemove(this._defaults,a||{}),this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},_newInst:function(a,b){var c=a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:b?bindHover($('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')):this.dpDiv}},_connectDatepicker:function(a,b){var c=$(a);b.append=$([]),b.trigger=$([]);if(c.hasClass(this.markerClassName))return;this._attachments(c,b),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),this._autoSize(b),$.data(a,PROP_NAME,b),b.settings.disabled&&this._disableDatepicker(a)},_attachments:function(a,b){var c=this._get(b,"appendText"),d=this._get(b,"isRTL");b.append&&b.append.remove(),c&&(b.append=$('<span class="'+this._appendClass+'">'+c+"</span>"),a[d?"before":"after"](b.append)),a.unbind("focus",this._showDatepicker),b.trigger&&b.trigger.remove();var e=this._get(b,"showOn");(e=="focus"||e=="both")&&a.focus(this._showDatepicker);if(e=="button"||e=="both"){var f=this._get(b,"buttonText"),g=this._get(b,"buttonImage");b.trigger=$(this._get(b,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:g,alt:f,title:f}):$('<button type="button"></button>').addClass(this._triggerClass).html(g==""?f:$("<img/>").attr({src:g,alt:f,title:f}))),a[d?"before":"after"](b.trigger),b.trigger.click(function(){return $.datepicker._datepickerShowing&&$.datepicker._lastInput==a[0]?$.datepicker._hideDatepicker():$.datepicker._datepickerShowing&&$.datepicker._lastInput!=a[0]?($.datepicker._hideDatepicker(),$.datepicker._showDatepicker(a[0])):$.datepicker._showDatepicker(a[0]),!1})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var d=function(a){var b=0,c=0;for(var d=0;d<a.length;d++)a[d].length>b&&(b=a[d].length,c=d);return c};b.setMonth(d(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort"))),b.setDate(d(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=$(a);if(c.hasClass(this.markerClassName))return;c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),$.data(a,PROP_NAME,b),this._setDate(b,this._getDefaultDate(b),!0),this._updateDatepicker(b),this._updateAlternate(b),b.settings.disabled&&this._disableDatepicker(a),b.dpDiv.css("display","block")},_dialogDatepicker:function(a,b,c,d,e){var f=this._dialogInst;if(!f){this.uuid+=1;var g="dp"+this.uuid;this._dialogInput=$('<input type="text" id="'+g+'" style="position: absolute; top: -100px; width: 0px;"/>'),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),f=this._dialogInst=this._newInst(this._dialogInput,!1),f.settings={},$.data(this._dialogInput[0],PROP_NAME,f)}extendRemove(f.settings,d||{}),b=b&&b.constructor==Date?this._formatDate(f,b):b,this._dialogInput.val(b),this._pos=e?e.length?e:[e.pageX,e.pageY]:null;if(!this._pos){var h=document.documentElement.clientWidth,i=document.documentElement.clientHeight,j=document.documentElement.scrollLeft||document.body.scrollLeft,k=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[h/2-100+j,i/2-150+k]}return this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),f.settings.onSelect=c,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,f),this},_destroyDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();$.removeData(a,PROP_NAME),d=="input"?(c.append.remove(),c.trigger.remove(),b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(d=="div"||d=="span")&&b.removeClass(this.markerClassName).empty()},_enableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!1,c.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().removeClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b})},_disableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!0,c.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().addClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b}),this._disabledInputs[this._disabledInputs.length]=a},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return!0;return!1},_getInst:function(a){try{return $.data(a,PROP_NAME)}catch(b){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(a,b,c){var d=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?$.extend({},$.datepicker._defaults):d?b=="all"?$.extend({},d.settings):this._get(d,b):null;var e=b||{};typeof b=="string"&&(e={},e[b]=c);if(d){this._curInst==d&&this._hideDatepicker();var f=this._getDateDatepicker(a,!0),g=this._getMinMaxDate(d,"min"),h=this._getMinMaxDate(d,"max");extendRemove(d.settings,e),g!==null&&e.dateFormat!==undefined&&e.minDate===undefined&&(d.settings.minDate=this._formatDate(d,g)),h!==null&&e.dateFormat!==undefined&&e.maxDate===undefined&&(d.settings.maxDate=this._formatDate(d,h)),this._attachments($(a),d),this._autoSize(d),this._setDate(d,f),this._updateAlternate(d),this._updateDatepicker(d)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){var b=this._getInst(a);b&&this._updateDatepicker(b)},_setDateDatepicker:function(a,b){var c=this._getInst(a);c&&(this._setDate(c,b),this._updateDatepicker(c),this._updateAlternate(c))},_getDateDatepicker:function(a,b){var c=this._getInst(a);return c&&!c.inline&&this._setDateFromField(c,b),c?this._getDate(c):null},_doKeyDown:function(a){var b=$.datepicker._getInst(a.target),c=!0,d=b.dpDiv.is(".ui-datepicker-rtl");b._keyEvent=!0;if($.datepicker._datepickerShowing)switch(a.keyCode){case 9:$.datepicker._hideDatepicker(),c=!1;break;case 13:var e=$("td."+$.datepicker._dayOverClass+":not(."+$.datepicker._currentClass+")",b.dpDiv);e[0]&&$.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,e[0]);var f=$.datepicker._get(b,"onSelect");if(f){var g=$.datepicker._formatDate(b);f.apply(b.input?b.input[0]:null,[g,b])}else $.datepicker._hideDatepicker();return!1;case 27:$.datepicker._hideDatepicker();break;case 33:$.datepicker._adjustDate(a.target,a.ctrlKey?-$.datepicker._get(b,"stepBigMonths"):-$.datepicker._get(b,"stepMonths"),"M");break;case 34:$.datepicker._adjustDate(a.target,a.ctrlKey?+$.datepicker._get(b,"stepBigMonths"):+$.datepicker._get(b,"stepMonths"),"M");break;case 35:(a.ctrlKey||a.metaKey)&&$.datepicker._clearDate(a.target),c=a.ctrlKey||a.metaKey;break;case 36:(a.ctrlKey||a.metaKey)&&$.datepicker._gotoToday(a.target),c=a.ctrlKey||a.metaKey;break;case 37:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,d?1:-1,"D"),c=a.ctrlKey||a.metaKey,a.originalEvent.altKey&&$.datepicker._adjustDate(a.target,a.ctrlKey?-$.datepicker._get(b,"stepBigMonths"):-$.datepicker._get(b,"stepMonths"),"M");break;case 38:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,-7,"D"),c=a.ctrlKey||a.metaKey;break;case 39:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,d?-1:1,"D"),c=a.ctrlKey||a.metaKey,a.originalEvent.altKey&&$.datepicker._adjustDate(a.target,a.ctrlKey?+$.datepicker._get(b,"stepBigMonths"):+$.datepicker._get(b,"stepMonths"),"M");break;case 40:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,7,"D"),c=a.ctrlKey||a.metaKey;break;default:c=!1}else a.keyCode==36&&a.ctrlKey?$.datepicker._showDatepicker(this):c=!1;c&&(a.preventDefault(),a.stopPropagation())},_doKeyPress:function(a){var b=$.datepicker._getInst(a.target);if($.datepicker._get(b,"constrainInput")){var c=$.datepicker._possibleChars($.datepicker._get(b,"dateFormat")),d=String.fromCharCode(a.charCode==undefined?a.keyCode:a.charCode);return a.ctrlKey||a.metaKey||d<" "||!c||c.indexOf(d)>-1}},_doKeyUp:function(a){var b=$.datepicker._getInst(a.target);if(b.input.val()!=b.lastVal)try{var c=$.datepicker.parseDate($.datepicker._get(b,"dateFormat"),b.input?b.input.val():null,$.datepicker._getFormatConfig(b));c&&($.datepicker._setDateFromField(b),$.datepicker._updateAlternate(b),$.datepicker._updateDatepicker(b))}catch(d){$.datepicker.log(d)}return!0},_showDatepicker:function(a){a=a.target||a,a.nodeName.toLowerCase()!="input"&&(a=$("input",a.parentNode)[0]);if($.datepicker._isDisabledDatepicker(a)||$.datepicker._lastInput==a)return;var b=$.datepicker._getInst(a);$.datepicker._curInst&&$.datepicker._curInst!=b&&($.datepicker._curInst.dpDiv.stop(!0,!0),b&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var c=$.datepicker._get(b,"beforeShow"),d=c?c.apply(a,[a,b]):{};if(d===!1)return;extendRemove(b.settings,d),b.lastVal=null,$.datepicker._lastInput=a,$.datepicker._setDateFromField(b),$.datepicker._inDialog&&(a.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(a),$.datepicker._pos[1]+=a.offsetHeight);var e=!1;$(a).parents().each(function(){return e|=$(this).css("position")=="fixed",!e}),e&&$.browser.opera&&($.datepicker._pos[0]-=document.documentElement.scrollLeft,$.datepicker._pos[1]-=document.documentElement.scrollTop);var f={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,b.dpDiv.empty(),b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(b),f=$.datepicker._checkOffset(b,f,e),b.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":e?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!b.inline){var g=$.datepicker._get(b,"showAnim"),h=$.datepicker._get(b,"duration"),i=function(){var a=b.dpDiv.find("iframe.ui-datepicker-cover");if(!!a.length){var c=$.datepicker._getBorders(b.dpDiv);a.css({left:-c[0],top:-c[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex($(a).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&$.effects[g]?b.dpDiv.show(g,$.datepicker._get(b,"showOptions"),h,i):b.dpDiv[g||"show"](g?h:null,i),(!g||!h)&&i(),b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus(),$.datepicker._curInst=b}},_updateDatepicker:function(a){var b=this;b.maxRows=4;var c=$.datepicker._getBorders(a.dpDiv);instActive=a,a.dpDiv.empty().append(this._generateHTML(a)),this._attachHandlers(a);var d=a.dpDiv.find("iframe.ui-datepicker-cover");!d.length||d.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}),a.dpDiv.find("."+this._dayOverClass+" a").mouseover();var e=this._getNumberOfMonths(a),f=e[1],g=17;a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),f>1&&a.dpDiv.addClass("ui-datepicker-multi-"+f).css("width",g*f+"em"),a.dpDiv[(e[0]!=1||e[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),a==$.datepicker._curInst&&$.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var h=a.yearshtml;setTimeout(function(){h===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml),h=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var d=a.dpDiv.outerWidth(),e=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,g=a.input?a.input.outerHeight():0,h=document.documentElement.clientWidth+(c?0:$(document).scrollLeft()),i=document.documentElement.clientHeight+(c?0:$(document).scrollTop());return b.left-=this._get(a,"isRTL")?d-f:0,b.left-=c&&b.left==a.input.offset().left?$(document).scrollLeft():0,b.top-=c&&b.top==a.input.offset().top+g?$(document).scrollTop():0,b.left-=Math.min(b.left,b.left+d>h&&h>d?Math.abs(b.left+d-h):0),b.top-=Math.min(b.top,b.top+e>i&&i>e?Math.abs(e+g):0),b},_findPos:function(a){var b=this._getInst(a),c=this._get(b,"isRTL");while(a&&(a.type=="hidden"||a.nodeType!=1||$.expr.filters.hidden(a)))a=a[c?"previousSibling":"nextSibling"];var d=$(a).offset();return[d.left,d.top]},_hideDatepicker:function(a){var b=this._curInst;if(!b||a&&b!=$.data(a,PROP_NAME))return;if(this._datepickerShowing){var c=this._get(b,"showAnim"),d=this._get(b,"duration"),e=function(){$.datepicker._tidyDialog(b)};$.effects&&$.effects[c]?b.dpDiv.hide(c,$.datepicker._get(b,"showOptions"),d,e):b.dpDiv[c=="slideDown"?"slideUp":c=="fadeIn"?"fadeOut":"hide"](c?d:null,e),c||e(),this._datepickerShowing=!1;var f=this._get(b,"onClose");f&&f.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(!$.datepicker._curInst)return;var b=$(a.target),c=$.datepicker._getInst(b[0]);(b[0].id!=$.datepicker._mainDivId&&b.parents("#"+$.datepicker._mainDivId).length==0&&!b.hasClass($.datepicker.markerClassName)&&!b.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||b.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=c)&&$.datepicker._hideDatepicker()},_adjustDate:function(a,b,c){var d=$(a),e=this._getInst(d[0]);if(this._isDisabledDatepicker(d[0]))return;this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c),this._updateDatepicker(e)},_gotoToday:function(a){var b=$(a),c=this._getInst(b[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var d=new Date;c.selectedDay=d.getDate(),c.drawMonth=c.selectedMonth=d.getMonth(),c.drawYear=c.selectedYear=d.getFullYear()}this._notifyChange(c),this._adjustDate(b)},_selectMonthYear:function(a,b,c){var d=$(a),e=this._getInst(d[0]);e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10),this._notifyChange(e),this._adjustDate(d)},_selectDay:function(a,b,c,d){var e=$(a);if($(d).hasClass(this._unselectableClass)||this._isDisabledDatepicker(e[0]))return;var f=this._getInst(e[0]);f.selectedDay=f.currentDay=$("a",d).html(),f.selectedMonth=f.currentMonth=b,f.selectedYear=f.currentYear=c,this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))},_clearDate:function(a){var b=$(a),c=this._getInst(b[0]);this._selectDate(b,"")},_selectDate:function(a,b){var c=$(a),d=this._getInst(c[0]);b=b!=null?b:this._formatDate(d),d.input&&d.input.val(b),this._updateAlternate(d);var e=this._get(d,"onSelect");e?e.apply(d.input?d.input[0]:null,[b,d]):d.input&&d.input.trigger("change"),d.inline?this._updateDatepicker(d):(this._hideDatepicker(),this._lastInput=d.input[0],typeof d.input[0]!="object"&&d.input.focus(),this._lastInput=null)},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),d=this._getDate(a),e=this.formatDate(c,d,this._getFormatConfig(a));$(b).each(function(){$(this).val(e)})}},noWeekends:function(a){var b=a.getDay();return[b>0&&b<6,""]},iso8601Week:function(a){var b=new Date(a.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();return b.setMonth(0),b.setDate(1),Math.floor(Math.round((c-b)/864e5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var d=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;d=typeof d!="string"?d:(new Date).getFullYear()%100+parseInt(d,10);var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,g=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,h=(c?c.monthNames:null)||this._defaults.monthNames,i=-1,j=-1,k=-1,l=-1,m=!1,n=function(b){var c=s+1<a.length&&a.charAt(s+1)==b;return c&&s++,c},o=function(a){var c=n(a),d=a=="@"?14:a=="!"?20:a=="y"&&c?4:a=="o"?3:2,e=new RegExp("^\\d{1,"+d+"}"),f=b.substring(r).match(e);if(!f)throw"Missing number at position "+r;return r+=f[0].length,parseInt(f[0],10)},p=function(a,c,d){var e=$.map(n(a)?d:c,function(a,b){return[[b,a]]}).sort(function(a,b){return-(a[1].length-b[1].length)}),f=-1;$.each(e,function(a,c){var d=c[1];if(b.substr(r,d.length).toLowerCase()==d.toLowerCase())return f=c[0],r+=d.length,!1});if(f!=-1)return f+1;throw"Unknown name at position "+r},q=function(){if(b.charAt(r)!=a.charAt(s))throw"Unexpected literal at position "+r;r++},r=0;for(var s=0;s<a.length;s++)if(m)a.charAt(s)=="'"&&!n("'")?m=!1:q();else switch(a.charAt(s)){case"d":k=o("d");break;case"D":p("D",e,f);break;case"o":l=o("o");break;case"m":j=o("m");break;case"M":j=p("M",g,h);break;case"y":i=o("y");break;case"@":var t=new Date(o("@"));i=t.getFullYear(),j=t.getMonth()+1,k=t.getDate();break;case"!":var t=new Date((o("!")-this._ticksTo1970)/1e4);i=t.getFullYear(),j=t.getMonth()+1,k=t.getDate();break;case"'":n("'")?q():m=!0;break;default:q()}if(r<b.length)throw"Extra/unparsed characters found in date: "+b.substring(r);i==-1?i=(new Date).getFullYear():i<100&&(i+=(new Date).getFullYear()-(new Date).getFullYear()%100+(i<=d?0:-100));if(l>-1){j=1,k=l;do{var u=this._getDaysInMonth(i,j-1);if(k<=u)break;j++,k-=u}while(!0)}var t=this._daylightSavingAdjust(new Date(i,j-1,k));if(t.getFullYear()!=i||t.getMonth()+1!=j||t.getDate()!=k)throw"Invalid date";return t},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(a,b,c){if(!b)return"";var d=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,f=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,h=function(b){var c=m+1<a.length&&a.charAt(m+1)==b;return c&&m++,c},i=function(a,b,c){var d=""+b;if(h(a))while(d.length<c)d="0"+d;return d},j=function(a,b,c,d){return h(a)?d[b]:c[b]},k="",l=!1;if(b)for(var m=0;m<a.length;m++)if(l)a.charAt(m)=="'"&&!h("'")?l=!1:k+=a.charAt(m);else switch(a.charAt(m)){case"d":k+=i("d",b.getDate(),2);break;case"D":k+=j("D",b.getDay(),d,e);break;case"o":k+=i("o",Math.round(((new Date(b.getFullYear(),b.getMonth(),b.getDate())).getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864e5),3);break;case"m":k+=i("m",b.getMonth()+1,2);break;case"M":k+=j("M",b.getMonth(),f,g);break;case"y":k+=h("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case"@":k+=b.getTime();break;case"!":k+=b.getTime()*1e4+this._ticksTo1970;break;case"'":h("'")?k+="'":l=!0;break;default:k+=a.charAt(m)}return k},_possibleChars:function(a){var b="",c=!1,d=function(b){var c=e+1<a.length&&a.charAt(e+1)==b;return c&&e++,c};for(var e=0;e<a.length;e++)if(c)a.charAt(e)=="'"&&!d("'")?c=!1:b+=a.charAt(e);else switch(a.charAt(e)){case"d":case"m":case"y":case"@":b+="0123456789";break;case"D":case"M":return null;case"'":d("'")?b+="'":c=!0;break;default:b+=a.charAt(e)}return b},_get:function(a,b){return a.settings[b]!==undefined?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()==a.lastVal)return;var c=this._get(a,"dateFormat"),d=a.lastVal=a.input?a.input.val():null,e,f;e=f=this._getDefaultDate(a);var g=this._getFormatConfig(a);try{e=this.parseDate(c,d,g)||f}catch(h){this.log(h),d=b?"":d}a.selectedDay=e.getDate(),a.drawMonth=a.selectedMonth=e.getMonth(),a.drawYear=a.selectedYear=e.getFullYear(),a.currentDay=d?e.getDate():0,a.currentMonth=d?e.getMonth():0,a.currentYear=d?e.getFullYear():0,this._adjustInstDate(a)},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var d=function(a){var b=new Date;return b.setDate(b.getDate()+a),b},e=function(b){try{return $.datepicker.parseDate($.datepicker._get(a,"dateFormat"),b,$.datepicker._getFormatConfig(a))}catch(c){}var d=(b.toLowerCase().match(/^c/)?$.datepicker._getDate(a):null)||new Date,e=d.getFullYear(),f=d.getMonth(),g=d.getDate(),h=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,i=h.exec(b);while(i){switch(i[2]||"d"){case"d":case"D":g+=parseInt(i[1],10);break;case"w":case"W":g+=parseInt(i[1],10)*7;break;case"m":case"M":f+=parseInt(i[1],10),g=Math.min(g,$.datepicker._getDaysInMonth(e,f));break;case"y":case"Y":e+=parseInt(i[1],10),g=Math.min(g,$.datepicker._getDaysInMonth(e,f))}i=h.exec(b)}return new Date(e,f,g)},f=b==null||b===""?c:typeof b=="string"?e(b):typeof b=="number"?isNaN(b)?c:d(b):new Date(b.getTime());return f=f&&f.toString()=="Invalid Date"?c:f,f&&(f.setHours(0),f.setMinutes(0),f.setSeconds(0),f.setMilliseconds(0)),this._daylightSavingAdjust(f)},_daylightSavingAdjust:function(a){return a?(a.setHours(a.getHours()>12?a.getHours()+2:0),a):null},_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,f=a.selectedYear,g=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=g.getDate(),a.drawMonth=a.selectedMonth=a.currentMonth=g.getMonth(),a.drawYear=a.selectedYear=a.currentYear=g.getFullYear(),(e!=a.selectedMonth||f!=a.selectedYear)&&!c&&this._notifyChange(a),this._adjustInstDate(a),a.input&&a.input.val(d?"":this._formatDate(a))},_getDate:function(a){var b=!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return b},_attachHandlers:function(a){var b=this._get(a,"stepMonths"),c="#"+a.id.replace(/\\\\/g,"\\");a.dpDiv.find("[data-handler]").map(function(){var a={prev:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(c,-b,"M")},next:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(c,+b,"M")},hide:function(){window["DP_jQuery_"+dpuuid].datepicker._hideDatepicker()},today:function(){window["DP_jQuery_"+dpuuid].datepicker._gotoToday(c)},selectDay:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectDay(c,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(c,this,"M"),!1},selectYear:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(c,this,"Y"),!1}};$(this).bind(this.getAttribute("data-event"),a[this.getAttribute("data-handler")])})},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),d=this._get(a,"showButtonPanel"),e=this._get(a,"hideIfNoPrevNext"),f=this._get(a,"navigationAsDateFormat"),g=this._getNumberOfMonths(a),h=this._get(a,"showCurrentAtPos"),i=this._get(a,"stepMonths"),j=g[0]!=1||g[1]!=1,k=this._daylightSavingAdjust(a.currentDay?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(9999,9,9)),l=this._getMinMaxDate(a,"min"),m=this._getMinMaxDate(a,"max"),n=a.drawMonth-h,o=a.drawYear;n<0&&(n+=12,o--);if(m){var p=this._daylightSavingAdjust(new Date(m.getFullYear(),m.getMonth()-g[0]*g[1]+1,m.getDate()));p=l&&p<l?l:p;while(this._daylightSavingAdjust(new Date(o,n,1))>p)n--,n<0&&(n=11,o--)}a.drawMonth=n,a.drawYear=o;var q=this._get(a,"prevText");q=f?this.formatDate(q,this._daylightSavingAdjust(new Date(o,n-i,1)),this._getFormatConfig(a)):q;var r=this._canAdjustMonth(a,-1,o,n)?'<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click" title="'+q+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+q+"</span></a>":e?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+q+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+q+"</span></a>",s=this._get(a,"nextText");s=f?this.formatDate(s,this._daylightSavingAdjust(new Date(o,n+i,1)),this._getFormatConfig(a)):s;var t=this._canAdjustMonth(a,1,o,n)?'<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>":e?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>",u=this._get(a,"currentText"),v=this._get(a,"gotoCurrent")&&a.currentDay?k:b;u=f?this.formatDate(u,v,this._getFormatConfig(a)):u;var w=a.inline?"":'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">'+this._get(a,"closeText")+"</button>",x=d?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?w:"")+(this._isInRange(a,v)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click">'+u+"</button>":"")+(c?"":w)+"</div>":"",y=parseInt(this._get(a,"firstDay"),10);y=isNaN(y)?0:y;var z=this._get(a,"showWeek"),A=this._get(a,"dayNames"),B=this._get(a,"dayNamesShort"),C=this._get(a,"dayNamesMin"),D=this._get(a,"monthNames"),E=this._get(a,"monthNamesShort"),F=this._get(a,"beforeShowDay"),G=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths"),I=this._get(a,"calculateWeek")||this.iso8601Week,J=this._getDefaultDate(a),K="";for(var L=0;L<g[0];L++){var M="";this.maxRows=4;for(var N=0;N<g[1];N++){var O=this._daylightSavingAdjust(new Date(o,n,a.selectedDay)),P=" ui-corner-all",Q="";if(j){Q+='<div class="ui-datepicker-group';if(g[1]>1)switch(N){case 0:Q+=" ui-datepicker-group-first",P=" ui-corner-"+(c?"right":"left");break;case g[1]-1:Q+=" ui-datepicker-group-last",P=" ui-corner-"+(c?"left":"right");break;default:Q+=" ui-datepicker-group-middle",P=""}Q+='">'}Q+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+P+'">'+(/all|left/.test(P)&&L==0?c?t:r:"")+(/all|right/.test(P)&&L==0?c?r:t:"")+this._generateMonthYearHeader(a,n,o,l,m,L>0||N>0,D,E)+'</div><table class="ui-datepicker-calendar"><thead>'+"<tr>";var R=z?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(var S=0;S<7;S++){var T=(S+y)%7;R+="<th"+((S+y+6)%7>=5?' class="ui-datepicker-week-end"':"")+">"+'<span title="'+A[T]+'">'+C[T]+"</span></th>"}Q+=R+"</tr></thead><tbody>";var U=this._getDaysInMonth(o,n);o==a.selectedYear&&n==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,U));var V=(this._getFirstDayOfMonth(o,n)-y+7)%7,W=Math.ceil((V+U)/7),X=j?this.maxRows>W?this.maxRows:W:W;this.maxRows=X;var Y=this._daylightSavingAdjust(new Date(o,n,1-V));for(var Z=0;Z<X;Z++){Q+="<tr>";var _=z?'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(Y)+"</td>":"";for(var S=0;S<7;S++){var ba=F?F.apply(a.input?a.input[0]:null,[Y]):[!0,""],bb=Y.getMonth()!=n,bc=bb&&!H||!ba[0]||l&&Y<l||m&&Y>m;_+='<td class="'+((S+y+6)%7>=5?" ui-datepicker-week-end":"")+(bb?" ui-datepicker-other-month":"")+(Y.getTime()==O.getTime()&&n==a.selectedMonth&&a._keyEvent||J.getTime()==Y.getTime()&&J.getTime()==O.getTime()?" "+this._dayOverClass:"")+(bc?" "+this._unselectableClass+" ui-state-disabled":"")+(bb&&!G?"":" "+ba[1]+(Y.getTime()==k.getTime()?" "+this._currentClass:"")+(Y.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!bb||G)&&ba[2]?' title="'+ba[2]+'"':"")+(bc?"":' data-handler="selectDay" data-event="click" data-month="'+Y.getMonth()+'" data-year="'+Y.getFullYear()+'"')+">"+(bb&&!G?"&#xa0;":bc?'<span class="ui-state-default">'+Y.getDate()+"</span>":'<a class="ui-state-default'+(Y.getTime()==b.getTime()?" ui-state-highlight":"")+(Y.getTime()==k.getTime()?" ui-state-active":"")+(bb?" ui-priority-secondary":"")+'" href="#">'+Y.getDate()+"</a>")+"</td>",Y.setDate(Y.getDate()+1),Y=this._daylightSavingAdjust(Y)}Q+=_+"</tr>"}n++,n>11&&(n=0,o++),Q+="</tbody></table>"+(j?"</div>"+(g[0]>0&&N==g[1]-1?'<div class="ui-datepicker-row-break"></div>':""):""),M+=Q}K+=M}return K+=x+($.browser.msie&&parseInt($.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':""),a._keyEvent=!1,K},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,"changeMonth"),j=this._get(a,"changeYear"),k=this._get(a,"showMonthAfterYear"),l='<div class="ui-datepicker-title">',m="";if(f||!i)m+='<span class="ui-datepicker-month">'+g[b]+"</span>";else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+='<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">';for(var p=0;p<12;p++)(!n||p>=d.getMonth())&&(!o||p<=e.getMonth())&&(m+='<option value="'+p+'"'+(p==b?' selected="selected"':"")+">"+h[p]+"</option>");m+="</select>"}k||(l+=m+(f||!i||!j?"&#xa0;":""));if(!a.yearshtml){a.yearshtml="";if(f||!j)l+='<span class="ui-datepicker-year">'+c+"</span>";else{var q=this._get(a,"yearRange").split(":"),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b},t=s(q[0]),u=Math.max(t,s(q[1]||""));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+='<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">';for(;t<=u;t++)a.yearshtml+='<option value="'+t+'"'+(t==c?' selected="selected"':"")+">"+t+"</option>";a.yearshtml+="</select>",l+=a.yearshtml,a.yearshtml=null}}return l+=this._get(a,"yearSuffix"),k&&(l+=(f||!i||!j?"&#xa0;":"")+m),l+="</div>",l},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=="Y"?b:0),e=a.drawMonth+(c=="M"?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=="D"?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=="M"||c=="Y")&&this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&b<c?c:b;return e=d&&e>d?d:e,e},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));return b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth())),this._isInRange(a,f)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");return b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10),{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a))}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);return typeof a!="string"||a!="isDisabled"&&a!="getDate"&&a!="widget"?a=="option"&&arguments.length==2&&typeof arguments[1]=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b)):this.each(function(){typeof a=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a)}):$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b))},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.23",window["DP_jQuery_"+dpuuid]=$})(jQuery);;
@@ -0,0 +1,1687 @@
1
+ /*
2
+ * jQuery timepicker addon
3
+ * By: Trent Richardson [http://trentrichardson.com]
4
+ * Version 1.0.2
5
+ * Last Modified: 07/01/2012
6
+ *
7
+ * Copyright 2012 Trent Richardson
8
+ * You may use this project under MIT or GPL licenses.
9
+ * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
10
+ * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
11
+ *
12
+ * HERES THE CSS:
13
+ * .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
14
+ * .ui-timepicker-div dl { text-align: left; }
15
+ * .ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
16
+ * .ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
17
+ * .ui-timepicker-div td { font-size: 90%; }
18
+ * .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
19
+ */
20
+
21
+ /*jslint evil: true, maxlen: 300, white: false, undef: false, nomen: false, onevar: false */
22
+
23
+ (function($) {
24
+
25
+ // Prevent "Uncaught RangeError: Maximum call stack size exceeded"
26
+ $.ui.timepicker = $.ui.timepicker || {};
27
+ if ($.ui.timepicker.version) {
28
+ return;
29
+ }
30
+
31
+ $.extend($.ui, { timepicker: { version: "1.0.2" } });
32
+
33
+ /* Time picker manager.
34
+ Use the singleton instance of this class, $.timepicker, to interact with the time picker.
35
+ Settings for (groups of) time pickers are maintained in an instance object,
36
+ allowing multiple different settings on the same page. */
37
+
38
+ function Timepicker() {
39
+ this.regional = []; // Available regional settings, indexed by language code
40
+ this.regional[''] = { // Default regional settings
41
+ currentText: 'Now',
42
+ closeText: 'Done',
43
+ ampm: false,
44
+ amNames: ['AM', 'A'],
45
+ pmNames: ['PM', 'P'],
46
+ timeFormat: 'hh:mm tt',
47
+ timeSuffix: '',
48
+ timeOnlyTitle: 'Choose Time',
49
+ timeText: 'Time',
50
+ hourText: 'Hour',
51
+ minuteText: 'Minute',
52
+ secondText: 'Second',
53
+ millisecText: 'Millisecond',
54
+ timezoneText: 'Time Zone'
55
+ };
56
+ this._defaults = { // Global defaults for all the datetime picker instances
57
+ showButtonPanel: true,
58
+ timeOnly: false,
59
+ showHour: true,
60
+ showMinute: true,
61
+ showSecond: false,
62
+ showMillisec: false,
63
+ showTimezone: false,
64
+ showTime: true,
65
+ stepHour: 1,
66
+ stepMinute: 1,
67
+ stepSecond: 1,
68
+ stepMillisec: 1,
69
+ hour: 0,
70
+ minute: 0,
71
+ second: 0,
72
+ millisec: 0,
73
+ timezone: null,
74
+ useLocalTimezone: true,
75
+ defaultTimezone: "+0000",
76
+ hourMin: 0,
77
+ minuteMin: 0,
78
+ secondMin: 0,
79
+ millisecMin: 0,
80
+ hourMax: 23,
81
+ minuteMax: 59,
82
+ secondMax: 59,
83
+ millisecMax: 999,
84
+ minDateTime: null,
85
+ maxDateTime: null,
86
+ onSelect: null,
87
+ hourGrid: 0,
88
+ minuteGrid: 0,
89
+ secondGrid: 0,
90
+ millisecGrid: 0,
91
+ alwaysSetTime: true,
92
+ separator: ' ',
93
+ altFieldTimeOnly: true,
94
+ altSeparator: null,
95
+ altTimeSuffix: null,
96
+ showTimepicker: true,
97
+ timezoneIso8601: false,
98
+ timezoneList: null,
99
+ addSliderAccess: false,
100
+ sliderAccessArgs: null,
101
+ defaultValue: null
102
+ };
103
+ $.extend(this._defaults, this.regional['']);
104
+ }
105
+
106
+ $.extend(Timepicker.prototype, {
107
+ $input: null,
108
+ $altInput: null,
109
+ $timeObj: null,
110
+ inst: null,
111
+ hour_slider: null,
112
+ minute_slider: null,
113
+ second_slider: null,
114
+ millisec_slider: null,
115
+ timezone_select: null,
116
+ hour: 0,
117
+ minute: 0,
118
+ second: 0,
119
+ millisec: 0,
120
+ timezone: null,
121
+ defaultTimezone: "+0000",
122
+ hourMinOriginal: null,
123
+ minuteMinOriginal: null,
124
+ secondMinOriginal: null,
125
+ millisecMinOriginal: null,
126
+ hourMaxOriginal: null,
127
+ minuteMaxOriginal: null,
128
+ secondMaxOriginal: null,
129
+ millisecMaxOriginal: null,
130
+ ampm: '',
131
+ formattedDate: '',
132
+ formattedTime: '',
133
+ formattedDateTime: '',
134
+ timezoneList: null,
135
+
136
+ /* Override the default settings for all instances of the time picker.
137
+ @param settings object - the new settings to use as defaults (anonymous object)
138
+ @return the manager object */
139
+ setDefaults: function(settings) {
140
+ extendRemove(this._defaults, settings || {});
141
+ return this;
142
+ },
143
+
144
+ //########################################################################
145
+ // Create a new Timepicker instance
146
+ //########################################################################
147
+ _newInst: function($input, o) {
148
+ var tp_inst = new Timepicker(),
149
+ inlineSettings = {};
150
+
151
+ for (var attrName in this._defaults) {
152
+ var attrValue = $input.attr('time:' + attrName);
153
+ if (attrValue) {
154
+ try {
155
+ inlineSettings[attrName] = eval(attrValue);
156
+ } catch (err) {
157
+ inlineSettings[attrName] = attrValue;
158
+ }
159
+ }
160
+ }
161
+ tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, {
162
+ beforeShow: function(input, dp_inst) {
163
+ if ($.isFunction(o.beforeShow)) {
164
+ return o.beforeShow(input, dp_inst, tp_inst);
165
+ }
166
+ },
167
+ onChangeMonthYear: function(year, month, dp_inst) {
168
+ // Update the time as well : this prevents the time from disappearing from the $input field.
169
+ tp_inst._updateDateTime(dp_inst);
170
+ if ($.isFunction(o.onChangeMonthYear)) {
171
+ o.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
172
+ }
173
+ },
174
+ onClose: function(dateText, dp_inst) {
175
+ if (tp_inst.timeDefined === true && $input.val() !== '') {
176
+ tp_inst._updateDateTime(dp_inst);
177
+ }
178
+ if ($.isFunction(o.onClose)) {
179
+ o.onClose.call($input[0], dateText, dp_inst, tp_inst);
180
+ }
181
+ },
182
+ timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
183
+ });
184
+ tp_inst.amNames = $.map(tp_inst._defaults.amNames, function(val) { return val.toUpperCase(); });
185
+ tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function(val) { return val.toUpperCase(); });
186
+
187
+ if (tp_inst._defaults.timezoneList === null) {
188
+ var timezoneList = ['-1200','-1100','-1000','-0930','-0900','-0800','-0700','-0600','-0500','-0430','-0400','-0330','-0300','-0200','-0100','+0000','+0100','+0200','+0300',
189
+ '+0330','+0400','+0430','+0500','+0530','+0545','+0600','+0630','+0700','+0800','+0845','+0900','+0930','+1000','+1030','+1100','+1130','+1200','+1245','+1300','+1400'];
190
+
191
+ if (tp_inst._defaults.timezoneIso8601) {
192
+ timezoneList = $.map(timezoneList, function(val) {
193
+ return val == '+0000' ? 'Z' : (val.substring(0, 3) + ':' + val.substring(3));
194
+ });
195
+ }
196
+ tp_inst._defaults.timezoneList = timezoneList;
197
+ }
198
+
199
+ tp_inst.timezone = tp_inst._defaults.timezone;
200
+ tp_inst.hour = tp_inst._defaults.hour;
201
+ tp_inst.minute = tp_inst._defaults.minute;
202
+ tp_inst.second = tp_inst._defaults.second;
203
+ tp_inst.millisec = tp_inst._defaults.millisec;
204
+ tp_inst.ampm = '';
205
+ tp_inst.$input = $input;
206
+
207
+ if (o.altField) {
208
+ tp_inst.$altInput = $(o.altField)
209
+ .css({ cursor: 'pointer' })
210
+ .focus(function(){ $input.trigger("focus"); });
211
+ }
212
+
213
+ if(tp_inst._defaults.minDate===0 || tp_inst._defaults.minDateTime===0)
214
+ {
215
+ tp_inst._defaults.minDate=new Date();
216
+ }
217
+ if(tp_inst._defaults.maxDate===0 || tp_inst._defaults.maxDateTime===0)
218
+ {
219
+ tp_inst._defaults.maxDate=new Date();
220
+ }
221
+
222
+ // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
223
+ if(tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {
224
+ tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
225
+ }
226
+ if(tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {
227
+ tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
228
+ }
229
+ if(tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {
230
+ tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
231
+ }
232
+ if(tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {
233
+ tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
234
+ }
235
+ tp_inst.$input.bind('focus', function() {
236
+ tp_inst._onFocus();
237
+ });
238
+
239
+ return tp_inst;
240
+ },
241
+
242
+ //########################################################################
243
+ // add our sliders to the calendar
244
+ //########################################################################
245
+ _addTimePicker: function(dp_inst) {
246
+ var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ?
247
+ this.$input.val() + ' ' + this.$altInput.val() :
248
+ this.$input.val();
249
+
250
+ this.timeDefined = this._parseTime(currDT);
251
+ this._limitMinMaxDateTime(dp_inst, false);
252
+ this._injectTimePicker();
253
+ },
254
+
255
+ //########################################################################
256
+ // parse the time string from input value or _setTime
257
+ //########################################################################
258
+ _parseTime: function(timeString, withDate) {
259
+ if (!this.inst) {
260
+ this.inst = $.datepicker._getInst(this.$input[0]);
261
+ }
262
+
263
+ if (withDate || !this._defaults.timeOnly)
264
+ {
265
+ var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
266
+ try {
267
+ var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
268
+ if (!parseRes.timeObj) { return false; }
269
+ $.extend(this, parseRes.timeObj);
270
+ } catch (err)
271
+ {
272
+ return false;
273
+ }
274
+ return true;
275
+ }
276
+ else
277
+ {
278
+ var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
279
+ if(!timeObj) { return false; }
280
+ $.extend(this, timeObj);
281
+ return true;
282
+ }
283
+ },
284
+
285
+ //########################################################################
286
+ // generate and inject html for timepicker into ui datepicker
287
+ //########################################################################
288
+ _injectTimePicker: function() {
289
+ var $dp = this.inst.dpDiv,
290
+ o = this.inst.settings,
291
+ tp_inst = this,
292
+ // Added by Peter Medeiros:
293
+ // - Figure out what the hour/minute/second max should be based on the step values.
294
+ // - Example: if stepMinute is 15, then minMax is 45.
295
+ hourMax = parseInt((o.hourMax - ((o.hourMax - o.hourMin) % o.stepHour)) ,10),
296
+ minMax = parseInt((o.minuteMax - ((o.minuteMax - o.minuteMin) % o.stepMinute)) ,10),
297
+ secMax = parseInt((o.secondMax - ((o.secondMax - o.secondMin) % o.stepSecond)) ,10),
298
+ millisecMax = parseInt((o.millisecMax - ((o.millisecMax - o.millisecMin) % o.stepMillisec)) ,10);
299
+
300
+ // Prevent displaying twice
301
+ if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
302
+ var noDisplay = ' style="display:none;"',
303
+ html = '<div class="ui-timepicker-div"><dl>' +
304
+ '<dt class="ui_tpicker_time_label"' +
305
+ ((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' +
306
+ '<dd class="ui_tpicker_time"' +
307
+ ((o.showTime) ? '' : noDisplay) + '></dd>' +
308
+ '<dt class="ui_tpicker_hour_label"' +
309
+ ((o.showHour) ? '' : noDisplay) + '>' + o.hourText + '</dt>',
310
+ hourGridSize = 0,
311
+ minuteGridSize = 0,
312
+ secondGridSize = 0,
313
+ millisecGridSize = 0,
314
+ size = null;
315
+
316
+ // Hours
317
+ html += '<dd class="ui_tpicker_hour"><div class="ui_tpicker_hour_slider"' +
318
+ ((o.showHour) ? '' : noDisplay) + '></div>';
319
+ if (o.showHour && o.hourGrid > 0) {
320
+ html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
321
+
322
+ for (var h = o.hourMin; h <= hourMax; h += parseInt(o.hourGrid,10)) {
323
+ hourGridSize++;
324
+ var tmph = (o.ampm && h > 12) ? h-12 : h;
325
+ if (tmph < 10) { tmph = '0' + tmph; }
326
+ if (o.ampm) {
327
+ if (h === 0) {
328
+ tmph = 12 +'a';
329
+ } else {
330
+ if (h < 12) { tmph += 'a'; }
331
+ else { tmph += 'p'; }
332
+ }
333
+ }
334
+ html += '<td>' + tmph + '</td>';
335
+ }
336
+
337
+ html += '</tr></table></div>';
338
+ }
339
+ html += '</dd>';
340
+
341
+ // Minutes
342
+ html += '<dt class="ui_tpicker_minute_label"' +
343
+ ((o.showMinute) ? '' : noDisplay) + '>' + o.minuteText + '</dt>'+
344
+ '<dd class="ui_tpicker_minute"><div class="ui_tpicker_minute_slider"' +
345
+ ((o.showMinute) ? '' : noDisplay) + '></div>';
346
+
347
+ if (o.showMinute && o.minuteGrid > 0) {
348
+ html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
349
+
350
+ for (var m = o.minuteMin; m <= minMax; m += parseInt(o.minuteGrid,10)) {
351
+ minuteGridSize++;
352
+ html += '<td>' + ((m < 10) ? '0' : '') + m + '</td>';
353
+ }
354
+
355
+ html += '</tr></table></div>';
356
+ }
357
+ html += '</dd>';
358
+
359
+ // Seconds
360
+ html += '<dt class="ui_tpicker_second_label"' +
361
+ ((o.showSecond) ? '' : noDisplay) + '>' + o.secondText + '</dt>'+
362
+ '<dd class="ui_tpicker_second"><div class="ui_tpicker_second_slider"'+
363
+ ((o.showSecond) ? '' : noDisplay) + '></div>';
364
+
365
+ if (o.showSecond && o.secondGrid > 0) {
366
+ html += '<div style="padding-left: 1px"><table><tr>';
367
+
368
+ for (var s = o.secondMin; s <= secMax; s += parseInt(o.secondGrid,10)) {
369
+ secondGridSize++;
370
+ html += '<td>' + ((s < 10) ? '0' : '') + s + '</td>';
371
+ }
372
+
373
+ html += '</tr></table></div>';
374
+ }
375
+ html += '</dd>';
376
+
377
+ // Milliseconds
378
+ html += '<dt class="ui_tpicker_millisec_label"' +
379
+ ((o.showMillisec) ? '' : noDisplay) + '>' + o.millisecText + '</dt>'+
380
+ '<dd class="ui_tpicker_millisec"><div class="ui_tpicker_millisec_slider"'+
381
+ ((o.showMillisec) ? '' : noDisplay) + '></div>';
382
+
383
+ if (o.showMillisec && o.millisecGrid > 0) {
384
+ html += '<div style="padding-left: 1px"><table><tr>';
385
+
386
+ for (var l = o.millisecMin; l <= millisecMax; l += parseInt(o.millisecGrid,10)) {
387
+ millisecGridSize++;
388
+ html += '<td>' + ((l < 10) ? '0' : '') + l + '</td>';
389
+ }
390
+
391
+ html += '</tr></table></div>';
392
+ }
393
+ html += '</dd>';
394
+
395
+ // Timezone
396
+ html += '<dt class="ui_tpicker_timezone_label"' +
397
+ ((o.showTimezone) ? '' : noDisplay) + '>' + o.timezoneText + '</dt>';
398
+ html += '<dd class="ui_tpicker_timezone" ' +
399
+ ((o.showTimezone) ? '' : noDisplay) + '></dd>';
400
+
401
+ html += '</dl></div>';
402
+ var $tp = $(html);
403
+
404
+ // if we only want time picker...
405
+ if (o.timeOnly === true) {
406
+ $tp.prepend(
407
+ '<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' +
408
+ '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' +
409
+ '</div>');
410
+ $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
411
+ }
412
+
413
+ this.hour_slider = $tp.find('.ui_tpicker_hour_slider').slider({
414
+ orientation: "horizontal",
415
+ value: this.hour,
416
+ min: o.hourMin,
417
+ max: hourMax,
418
+ step: o.stepHour,
419
+ slide: function(event, ui) {
420
+ tp_inst.hour_slider.slider( "option", "value", ui.value);
421
+ tp_inst._onTimeChange();
422
+ }
423
+ });
424
+
425
+
426
+ // Updated by Peter Medeiros:
427
+ // - Pass in Event and UI instance into slide function
428
+ this.minute_slider = $tp.find('.ui_tpicker_minute_slider').slider({
429
+ orientation: "horizontal",
430
+ value: this.minute,
431
+ min: o.minuteMin,
432
+ max: minMax,
433
+ step: o.stepMinute,
434
+ slide: function(event, ui) {
435
+ tp_inst.minute_slider.slider( "option", "value", ui.value);
436
+ tp_inst._onTimeChange();
437
+ }
438
+ });
439
+
440
+ this.second_slider = $tp.find('.ui_tpicker_second_slider').slider({
441
+ orientation: "horizontal",
442
+ value: this.second,
443
+ min: o.secondMin,
444
+ max: secMax,
445
+ step: o.stepSecond,
446
+ slide: function(event, ui) {
447
+ tp_inst.second_slider.slider( "option", "value", ui.value);
448
+ tp_inst._onTimeChange();
449
+ }
450
+ });
451
+
452
+ this.millisec_slider = $tp.find('.ui_tpicker_millisec_slider').slider({
453
+ orientation: "horizontal",
454
+ value: this.millisec,
455
+ min: o.millisecMin,
456
+ max: millisecMax,
457
+ step: o.stepMillisec,
458
+ slide: function(event, ui) {
459
+ tp_inst.millisec_slider.slider( "option", "value", ui.value);
460
+ tp_inst._onTimeChange();
461
+ }
462
+ });
463
+
464
+ this.timezone_select = $tp.find('.ui_tpicker_timezone').append('<select></select>').find("select");
465
+ $.fn.append.apply(this.timezone_select,
466
+ $.map(o.timezoneList, function(val, idx) {
467
+ return $("<option />")
468
+ .val(typeof val == "object" ? val.value : val)
469
+ .text(typeof val == "object" ? val.label : val);
470
+ })
471
+ );
472
+ if (typeof(this.timezone) != "undefined" && this.timezone !== null && this.timezone !== "") {
473
+ var local_date = new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12);
474
+ var local_timezone = $.timepicker.timeZoneOffsetString(local_date);
475
+ if (local_timezone == this.timezone) {
476
+ selectLocalTimeZone(tp_inst);
477
+ } else {
478
+ this.timezone_select.val(this.timezone);
479
+ }
480
+ } else {
481
+ if (typeof(this.hour) != "undefined" && this.hour !== null && this.hour !== "") {
482
+ this.timezone_select.val(o.defaultTimezone);
483
+ } else {
484
+ selectLocalTimeZone(tp_inst);
485
+ }
486
+ }
487
+ this.timezone_select.change(function() {
488
+ tp_inst._defaults.useLocalTimezone = false;
489
+ tp_inst._onTimeChange();
490
+ });
491
+
492
+ // Add grid functionality
493
+ if (o.showHour && o.hourGrid > 0) {
494
+ size = 100 * hourGridSize * o.hourGrid / (hourMax - o.hourMin);
495
+
496
+ $tp.find(".ui_tpicker_hour table").css({
497
+ width: size + "%",
498
+ marginLeft: (size / (-2 * hourGridSize)) + "%",
499
+ borderCollapse: 'collapse'
500
+ }).find("td").each( function(index) {
501
+ $(this).click(function() {
502
+ var h = $(this).html();
503
+ if(o.ampm) {
504
+ var ap = h.substring(2).toLowerCase(),
505
+ aph = parseInt(h.substring(0,2), 10);
506
+ if (ap == 'a') {
507
+ if (aph == 12) { h = 0; }
508
+ else { h = aph; }
509
+ } else if (aph == 12) { h = 12; }
510
+ else { h = aph + 12; }
511
+ }
512
+ tp_inst.hour_slider.slider("option", "value", h);
513
+ tp_inst._onTimeChange();
514
+ tp_inst._onSelectHandler();
515
+ }).css({
516
+ cursor: 'pointer',
517
+ width: (100 / hourGridSize) + '%',
518
+ textAlign: 'center',
519
+ overflow: 'hidden'
520
+ });
521
+ });
522
+ }
523
+
524
+ if (o.showMinute && o.minuteGrid > 0) {
525
+ size = 100 * minuteGridSize * o.minuteGrid / (minMax - o.minuteMin);
526
+ $tp.find(".ui_tpicker_minute table").css({
527
+ width: size + "%",
528
+ marginLeft: (size / (-2 * minuteGridSize)) + "%",
529
+ borderCollapse: 'collapse'
530
+ }).find("td").each(function(index) {
531
+ $(this).click(function() {
532
+ tp_inst.minute_slider.slider("option", "value", $(this).html());
533
+ tp_inst._onTimeChange();
534
+ tp_inst._onSelectHandler();
535
+ }).css({
536
+ cursor: 'pointer',
537
+ width: (100 / minuteGridSize) + '%',
538
+ textAlign: 'center',
539
+ overflow: 'hidden'
540
+ });
541
+ });
542
+ }
543
+
544
+ if (o.showSecond && o.secondGrid > 0) {
545
+ $tp.find(".ui_tpicker_second table").css({
546
+ width: size + "%",
547
+ marginLeft: (size / (-2 * secondGridSize)) + "%",
548
+ borderCollapse: 'collapse'
549
+ }).find("td").each(function(index) {
550
+ $(this).click(function() {
551
+ tp_inst.second_slider.slider("option", "value", $(this).html());
552
+ tp_inst._onTimeChange();
553
+ tp_inst._onSelectHandler();
554
+ }).css({
555
+ cursor: 'pointer',
556
+ width: (100 / secondGridSize) + '%',
557
+ textAlign: 'center',
558
+ overflow: 'hidden'
559
+ });
560
+ });
561
+ }
562
+
563
+ if (o.showMillisec && o.millisecGrid > 0) {
564
+ $tp.find(".ui_tpicker_millisec table").css({
565
+ width: size + "%",
566
+ marginLeft: (size / (-2 * millisecGridSize)) + "%",
567
+ borderCollapse: 'collapse'
568
+ }).find("td").each(function(index) {
569
+ $(this).click(function() {
570
+ tp_inst.millisec_slider.slider("option", "value", $(this).html());
571
+ tp_inst._onTimeChange();
572
+ tp_inst._onSelectHandler();
573
+ }).css({
574
+ cursor: 'pointer',
575
+ width: (100 / millisecGridSize) + '%',
576
+ textAlign: 'center',
577
+ overflow: 'hidden'
578
+ });
579
+ });
580
+ }
581
+
582
+ var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
583
+ if ($buttonPanel.length) { $buttonPanel.before($tp); }
584
+ else { $dp.append($tp); }
585
+
586
+ this.$timeObj = $tp.find('.ui_tpicker_time');
587
+
588
+ if (this.inst !== null) {
589
+ var timeDefined = this.timeDefined;
590
+ this._onTimeChange();
591
+ this.timeDefined = timeDefined;
592
+ }
593
+
594
+ //Emulate datepicker onSelect behavior. Call on slidestop.
595
+ var onSelectDelegate = function() {
596
+ tp_inst._onSelectHandler();
597
+ };
598
+ this.hour_slider.bind('slidestop',onSelectDelegate);
599
+ this.minute_slider.bind('slidestop',onSelectDelegate);
600
+ this.second_slider.bind('slidestop',onSelectDelegate);
601
+ this.millisec_slider.bind('slidestop',onSelectDelegate);
602
+
603
+ // slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
604
+ if (this._defaults.addSliderAccess){
605
+ var sliderAccessArgs = this._defaults.sliderAccessArgs;
606
+ setTimeout(function(){ // fix for inline mode
607
+ if($tp.find('.ui-slider-access').length === 0){
608
+ $tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
609
+
610
+ // fix any grids since sliders are shorter
611
+ var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
612
+ if(sliderAccessWidth){
613
+ $tp.find('table:visible').each(function(){
614
+ var $g = $(this),
615
+ oldWidth = $g.outerWidth(),
616
+ oldMarginLeft = $g.css('marginLeft').toString().replace('%',''),
617
+ newWidth = oldWidth - sliderAccessWidth,
618
+ newMarginLeft = ((oldMarginLeft * newWidth)/oldWidth) + '%';
619
+
620
+ $g.css({ width: newWidth, marginLeft: newMarginLeft });
621
+ });
622
+ }
623
+ }
624
+ },0);
625
+ }
626
+ // end slideAccess integration
627
+
628
+ }
629
+ },
630
+
631
+ //########################################################################
632
+ // This function tries to limit the ability to go outside the
633
+ // min/max date range
634
+ //########################################################################
635
+ _limitMinMaxDateTime: function(dp_inst, adjustSliders){
636
+ var o = this._defaults,
637
+ dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
638
+
639
+ if(!this._defaults.showTimepicker) { return; } // No time so nothing to check here
640
+
641
+ if($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date){
642
+ var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
643
+ minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
644
+
645
+ if(this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null){
646
+ this.hourMinOriginal = o.hourMin;
647
+ this.minuteMinOriginal = o.minuteMin;
648
+ this.secondMinOriginal = o.secondMin;
649
+ this.millisecMinOriginal = o.millisecMin;
650
+ }
651
+
652
+ if(dp_inst.settings.timeOnly || minDateTimeDate.getTime() == dp_date.getTime()) {
653
+ this._defaults.hourMin = minDateTime.getHours();
654
+ if (this.hour <= this._defaults.hourMin) {
655
+ this.hour = this._defaults.hourMin;
656
+ this._defaults.minuteMin = minDateTime.getMinutes();
657
+ if (this.minute <= this._defaults.minuteMin) {
658
+ this.minute = this._defaults.minuteMin;
659
+ this._defaults.secondMin = minDateTime.getSeconds();
660
+ if (this.second <= this._defaults.secondMin){
661
+ this.second = this._defaults.secondMin;
662
+ this._defaults.millisecMin = minDateTime.getMilliseconds();
663
+ }
664
+ else {
665
+ if(this.millisec < this._defaults.millisecMin) {
666
+ this.millisec = this._defaults.millisecMin;
667
+ }
668
+ this._defaults.millisecMin = this.millisecMinOriginal;
669
+ }
670
+ }
671
+ else {
672
+ this._defaults.secondMin = this.secondMinOriginal;
673
+ this._defaults.millisecMin = this.millisecMinOriginal;
674
+ }
675
+ }
676
+ else {
677
+ this._defaults.minuteMin = this.minuteMinOriginal;
678
+ this._defaults.secondMin = this.secondMinOriginal;
679
+ this._defaults.millisecMin = this.millisecMinOriginal;
680
+ }
681
+ }
682
+ else {
683
+ this._defaults.hourMin = this.hourMinOriginal;
684
+ this._defaults.minuteMin = this.minuteMinOriginal;
685
+ this._defaults.secondMin = this.secondMinOriginal;
686
+ this._defaults.millisecMin = this.millisecMinOriginal;
687
+ }
688
+ }
689
+
690
+ if($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date){
691
+ var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
692
+ maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
693
+
694
+ if(this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null){
695
+ this.hourMaxOriginal = o.hourMax;
696
+ this.minuteMaxOriginal = o.minuteMax;
697
+ this.secondMaxOriginal = o.secondMax;
698
+ this.millisecMaxOriginal = o.millisecMax;
699
+ }
700
+
701
+ if(dp_inst.settings.timeOnly || maxDateTimeDate.getTime() == dp_date.getTime()){
702
+ this._defaults.hourMax = maxDateTime.getHours();
703
+ if (this.hour >= this._defaults.hourMax) {
704
+ this.hour = this._defaults.hourMax;
705
+ this._defaults.minuteMax = maxDateTime.getMinutes();
706
+ if (this.minute >= this._defaults.minuteMax) {
707
+ this.minute = this._defaults.minuteMax;
708
+ this._defaults.secondMax = maxDateTime.getSeconds();
709
+ } else if (this.second >= this._defaults.secondMax) {
710
+ this.second = this._defaults.secondMax;
711
+ this._defaults.millisecMax = maxDateTime.getMilliseconds();
712
+ } else {
713
+ if(this.millisec > this._defaults.millisecMax) { this.millisec = this._defaults.millisecMax; }
714
+ this._defaults.millisecMax = this.millisecMaxOriginal;
715
+ }
716
+ } else {
717
+ this._defaults.minuteMax = this.minuteMaxOriginal;
718
+ this._defaults.secondMax = this.secondMaxOriginal;
719
+ this._defaults.millisecMax = this.millisecMaxOriginal;
720
+ }
721
+ }else{
722
+ this._defaults.hourMax = this.hourMaxOriginal;
723
+ this._defaults.minuteMax = this.minuteMaxOriginal;
724
+ this._defaults.secondMax = this.secondMaxOriginal;
725
+ this._defaults.millisecMax = this.millisecMaxOriginal;
726
+ }
727
+ }
728
+
729
+ if(adjustSliders !== undefined && adjustSliders === true){
730
+ var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)) ,10),
731
+ minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)) ,10),
732
+ secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)) ,10),
733
+ millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)) ,10);
734
+
735
+ if(this.hour_slider) {
736
+ this.hour_slider.slider("option", { min: this._defaults.hourMin, max: hourMax }).slider('value', this.hour);
737
+ }
738
+ if(this.minute_slider) {
739
+ this.minute_slider.slider("option", { min: this._defaults.minuteMin, max: minMax }).slider('value', this.minute);
740
+ }
741
+ if(this.second_slider){
742
+ this.second_slider.slider("option", { min: this._defaults.secondMin, max: secMax }).slider('value', this.second);
743
+ }
744
+ if(this.millisec_slider) {
745
+ this.millisec_slider.slider("option", { min: this._defaults.millisecMin, max: millisecMax }).slider('value', this.millisec);
746
+ }
747
+ }
748
+
749
+ },
750
+
751
+
752
+ //########################################################################
753
+ // when a slider moves, set the internal time...
754
+ // on time change is also called when the time is updated in the text field
755
+ //########################################################################
756
+ _onTimeChange: function() {
757
+ var hour = (this.hour_slider) ? this.hour_slider.slider('value') : false,
758
+ minute = (this.minute_slider) ? this.minute_slider.slider('value') : false,
759
+ second = (this.second_slider) ? this.second_slider.slider('value') : false,
760
+ millisec = (this.millisec_slider) ? this.millisec_slider.slider('value') : false,
761
+ timezone = (this.timezone_select) ? this.timezone_select.val() : false,
762
+ o = this._defaults;
763
+
764
+ if (typeof(hour) == 'object') { hour = false; }
765
+ if (typeof(minute) == 'object') { minute = false; }
766
+ if (typeof(second) == 'object') { second = false; }
767
+ if (typeof(millisec) == 'object') { millisec = false; }
768
+ if (typeof(timezone) == 'object') { timezone = false; }
769
+
770
+ if (hour !== false) { hour = parseInt(hour,10); }
771
+ if (minute !== false) { minute = parseInt(minute,10); }
772
+ if (second !== false) { second = parseInt(second,10); }
773
+ if (millisec !== false) { millisec = parseInt(millisec,10); }
774
+
775
+ var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
776
+
777
+ // If the update was done in the input field, the input field should not be updated.
778
+ // If the update was done using the sliders, update the input field.
779
+ var hasChanged = (hour != this.hour || minute != this.minute ||
780
+ second != this.second || millisec != this.millisec ||
781
+ (this.ampm.length > 0 &&
782
+ (hour < 12) != ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) ||
783
+ ((this.timezone == null && timezone != this.defaultTimezone) || (this.timezone != null && timezone != this.timezone)));
784
+
785
+ if (hasChanged) {
786
+
787
+ if (hour !== false) { this.hour = hour; }
788
+ if (minute !== false) { this.minute = minute; }
789
+ if (second !== false) { this.second = second; }
790
+ if (millisec !== false) { this.millisec = millisec; }
791
+ if (timezone !== false) { this.timezone = timezone; }
792
+
793
+ if (!this.inst) { this.inst = $.datepicker._getInst(this.$input[0]); }
794
+
795
+ this._limitMinMaxDateTime(this.inst, true);
796
+ }
797
+ if (o.ampm) { this.ampm = ampm; }
798
+
799
+ //this._formatTime();
800
+ this.formattedTime = $.datepicker.formatTime(this._defaults.timeFormat, this, this._defaults);
801
+ if (this.$timeObj) { this.$timeObj.text(this.formattedTime + o.timeSuffix); }
802
+ this.timeDefined = true;
803
+ if (hasChanged) { this._updateDateTime(); }
804
+ },
805
+
806
+ //########################################################################
807
+ // call custom onSelect.
808
+ // bind to sliders slidestop, and grid click.
809
+ //########################################################################
810
+ _onSelectHandler: function() {
811
+ var onSelect = this._defaults.onSelect;
812
+ var inputEl = this.$input ? this.$input[0] : null;
813
+ if (onSelect && inputEl) {
814
+ onSelect.apply(inputEl, [this.formattedDateTime, this]);
815
+ }
816
+ },
817
+
818
+ //########################################################################
819
+ // left for any backwards compatibility
820
+ //########################################################################
821
+ _formatTime: function(time, format) {
822
+ time = time || { hour: this.hour, minute: this.minute, second: this.second, millisec: this.millisec, ampm: this.ampm, timezone: this.timezone };
823
+ var tmptime = (format || this._defaults.timeFormat).toString();
824
+
825
+ tmptime = $.datepicker.formatTime(tmptime, time, this._defaults);
826
+
827
+ if (arguments.length) { return tmptime; }
828
+ else { this.formattedTime = tmptime; }
829
+ },
830
+
831
+ //########################################################################
832
+ // update our input with the new date time..
833
+ //########################################################################
834
+ _updateDateTime: function(dp_inst) {
835
+ dp_inst = this.inst || dp_inst;
836
+ var dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
837
+ dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
838
+ formatCfg = $.datepicker._getFormatConfig(dp_inst),
839
+ timeAvailable = dt !== null && this.timeDefined;
840
+ this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
841
+ var formattedDateTime = this.formattedDate;
842
+
843
+ // remove following lines to force every changes in date picker to change the input value
844
+ // Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
845
+ // If the user manually empty the value in the input field, the date picker will never change selected value.
846
+ //if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
847
+ // return;
848
+ //}
849
+
850
+ if (this._defaults.timeOnly === true) {
851
+ formattedDateTime = this.formattedTime;
852
+ } else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
853
+ formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
854
+ }
855
+
856
+ this.formattedDateTime = formattedDateTime;
857
+
858
+ if(!this._defaults.showTimepicker) {
859
+ this.$input.val(this.formattedDate);
860
+ } else if (this.$altInput && this._defaults.altFieldTimeOnly === true) {
861
+ this.$altInput.val(this.formattedTime);
862
+ this.$input.val(this.formattedDate);
863
+ } else if(this.$altInput) {
864
+ this.$input.val(formattedDateTime);
865
+ var altFormattedDateTime = '',
866
+ altSeparator = this._defaults.altSeparator ? this._defaults.altSeparator : this._defaults.separator,
867
+ altTimeSuffix = this._defaults.altTimeSuffix ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
868
+ if (this._defaults.altFormat)
869
+ altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
870
+ else
871
+ altFormattedDateTime = this.formattedDate;
872
+ if (altFormattedDateTime)
873
+ altFormattedDateTime += altSeparator;
874
+ if (this._defaults.altTimeFormat)
875
+ altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
876
+ else
877
+ altFormattedDateTime += this.formattedTime + altTimeSuffix;
878
+ this.$altInput.val(altFormattedDateTime);
879
+ } else {
880
+ this.$input.val(formattedDateTime);
881
+ }
882
+
883
+ this.$input.trigger("change");
884
+ },
885
+
886
+ _onFocus: function() {
887
+ if( !this.$input.val() && this._defaults.defaultValue ) {
888
+ this.$input.val(this._defaults.defaultValue);
889
+ var inst = $.datepicker._getInst(this.$input.get(0)),
890
+ tp_inst = $.datepicker._get(inst, 'timepicker');
891
+ if (tp_inst) {
892
+ if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) {
893
+ try {
894
+ $.datepicker._updateDatepicker(inst);
895
+ }
896
+ catch (err) {
897
+ $.datepicker.log(err);
898
+ }
899
+ }
900
+ }
901
+ }
902
+ }
903
+
904
+ });
905
+
906
+ $.fn.extend({
907
+ //########################################################################
908
+ // shorthand just to use timepicker..
909
+ //########################################################################
910
+ timepicker: function(o) {
911
+ o = o || {};
912
+ var tmp_args = arguments;
913
+
914
+ if (typeof o == 'object') { tmp_args[0] = $.extend(o, { timeOnly: true }); }
915
+
916
+ return $(this).each(function() {
917
+ $.fn.datetimepicker.apply($(this), tmp_args);
918
+ });
919
+ },
920
+
921
+ //########################################################################
922
+ // extend timepicker to datepicker
923
+ //########################################################################
924
+ datetimepicker: function(o) {
925
+ o = o || {};
926
+ var tmp_args = arguments;
927
+
928
+ if (typeof(o) == 'string'){
929
+ if(o == 'getDate') {
930
+ return $.fn.datepicker.apply($(this[0]), tmp_args);
931
+ }
932
+ else {
933
+ return this.each(function() {
934
+ var $t = $(this);
935
+ $t.datepicker.apply($t, tmp_args);
936
+ });
937
+ }
938
+ }
939
+ else {
940
+ return this.each(function() {
941
+ var $t = $(this);
942
+ $t.datepicker($.timepicker._newInst($t, o)._defaults);
943
+ });
944
+ }
945
+ }
946
+ });
947
+
948
+ $.datepicker.parseDateTime = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
949
+ var parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings);
950
+ if (parseRes.timeObj)
951
+ {
952
+ var t = parseRes.timeObj;
953
+ parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
954
+ }
955
+
956
+ return parseRes.date;
957
+ };
958
+
959
+ $.datepicker.parseTime = function(timeFormat, timeString, options) {
960
+
961
+ //########################################################################
962
+ // pattern for standard and localized AM/PM markers
963
+ //########################################################################
964
+ var getPatternAmpm = function(amNames, pmNames) {
965
+ var markers = [];
966
+ if (amNames) {
967
+ $.merge(markers, amNames);
968
+ }
969
+ if (pmNames) {
970
+ $.merge(markers, pmNames);
971
+ }
972
+ markers = $.map(markers, function(val) { return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&'); });
973
+ return '(' + markers.join('|') + ')?';
974
+ };
975
+
976
+ //########################################################################
977
+ // figure out position of time elements.. cause js cant do named captures
978
+ //########################################################################
979
+ var getFormatPositions = function( timeFormat ) {
980
+ var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|t{1,2}|z)/g),
981
+ orders = { h: -1, m: -1, s: -1, l: -1, t: -1, z: -1 };
982
+
983
+ if (finds) {
984
+ for (var i = 0; i < finds.length; i++) {
985
+ if (orders[finds[i].toString().charAt(0)] == -1) {
986
+ orders[finds[i].toString().charAt(0)] = i + 1;
987
+ }
988
+ }
989
+ }
990
+ return orders;
991
+ };
992
+
993
+ var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {});
994
+
995
+ var regstr = '^' + timeFormat.toString()
996
+ .replace(/h{1,2}/ig, '(\\d?\\d)')
997
+ .replace(/m{1,2}/ig, '(\\d?\\d)')
998
+ .replace(/s{1,2}/ig, '(\\d?\\d)')
999
+ .replace(/l{1}/ig, '(\\d?\\d?\\d)')
1000
+ .replace(/t{1,2}/ig, getPatternAmpm(o.amNames, o.pmNames))
1001
+ .replace(/z{1}/ig, '(z|[-+]\\d\\d:?\\d\\d|\\S+)?')
1002
+ .replace(/\s/g, '\\s?') + o.timeSuffix + '$',
1003
+ order = getFormatPositions(timeFormat),
1004
+ ampm = '',
1005
+ treg;
1006
+
1007
+ treg = timeString.match(new RegExp(regstr, 'i'));
1008
+
1009
+ var resTime = {hour: 0, minute: 0, second: 0, millisec: 0};
1010
+
1011
+ if (treg) {
1012
+ if (order.t !== -1) {
1013
+ if (treg[order.t] === undefined || treg[order.t].length === 0) {
1014
+ ampm = '';
1015
+ resTime.ampm = '';
1016
+ } else {
1017
+ ampm = $.inArray(treg[order.t].toUpperCase(), o.amNames) !== -1 ? 'AM' : 'PM';
1018
+ resTime.ampm = o[ampm == 'AM' ? 'amNames' : 'pmNames'][0];
1019
+ }
1020
+ }
1021
+
1022
+ if (order.h !== -1) {
1023
+ if (ampm == 'AM' && treg[order.h] == '12') {
1024
+ resTime.hour = 0; // 12am = 0 hour
1025
+ } else {
1026
+ if (ampm == 'PM' && treg[order.h] != '12') {
1027
+ resTime.hour = parseInt(treg[order.h],10) + 12; // 12pm = 12 hour, any other pm = hour + 12
1028
+ }
1029
+ else { resTime.hour = Number(treg[order.h]); }
1030
+ }
1031
+ }
1032
+
1033
+ if (order.m !== -1) { resTime.minute = Number(treg[order.m]); }
1034
+ if (order.s !== -1) { resTime.second = Number(treg[order.s]); }
1035
+ if (order.l !== -1) { resTime.millisec = Number(treg[order.l]); }
1036
+ if (order.z !== -1 && treg[order.z] !== undefined) {
1037
+ var tz = treg[order.z].toUpperCase();
1038
+ switch (tz.length) {
1039
+ case 1: // Z
1040
+ tz = o.timezoneIso8601 ? 'Z' : '+0000';
1041
+ break;
1042
+ case 5: // +hhmm
1043
+ if (o.timezoneIso8601) {
1044
+ tz = tz.substring(1) == '0000' ?
1045
+ 'Z' :
1046
+ tz.substring(0, 3) + ':' + tz.substring(3);
1047
+ }
1048
+ break;
1049
+ case 6: // +hh:mm
1050
+ if (!o.timezoneIso8601) {
1051
+ tz = tz == 'Z' || tz.substring(1) == '00:00' ?
1052
+ '+0000' :
1053
+ tz.replace(/:/, '');
1054
+ } else {
1055
+ if (tz.substring(1) == '00:00') {
1056
+ tz = 'Z';
1057
+ }
1058
+ }
1059
+ break;
1060
+ }
1061
+ resTime.timezone = tz;
1062
+ }
1063
+
1064
+
1065
+ return resTime;
1066
+ }
1067
+
1068
+ return false;
1069
+ };
1070
+
1071
+ //########################################################################
1072
+ // format the time all pretty...
1073
+ // format = string format of the time
1074
+ // time = a {}, not a Date() for timezones
1075
+ // options = essentially the regional[].. amNames, pmNames, ampm
1076
+ //########################################################################
1077
+ $.datepicker.formatTime = function(format, time, options) {
1078
+ options = options || {};
1079
+ options = $.extend({}, $.timepicker._defaults, options);
1080
+ time = $.extend({hour:0, minute:0, second:0, millisec:0, timezone:'+0000'}, time);
1081
+
1082
+ var tmptime = format;
1083
+ var ampmName = options.amNames[0];
1084
+
1085
+ var hour = parseInt(time.hour, 10);
1086
+ if (options.ampm) {
1087
+ if (hour > 11){
1088
+ ampmName = options.pmNames[0];
1089
+ if(hour > 12) {
1090
+ hour = hour % 12;
1091
+ }
1092
+ }
1093
+ if (hour === 0) {
1094
+ hour = 12;
1095
+ }
1096
+ }
1097
+ tmptime = tmptime.replace(/(?:hh?|mm?|ss?|[tT]{1,2}|[lz]|('.*?'|".*?"))/g, function(match) {
1098
+ switch (match.toLowerCase()) {
1099
+ case 'hh': return ('0' + hour).slice(-2);
1100
+ case 'h': return hour;
1101
+ case 'mm': return ('0' + time.minute).slice(-2);
1102
+ case 'm': return time.minute;
1103
+ case 'ss': return ('0' + time.second).slice(-2);
1104
+ case 's': return time.second;
1105
+ case 'l': return ('00' + time.millisec).slice(-3);
1106
+ case 'z': return time.timezone;
1107
+ case 't': case 'tt':
1108
+ if (options.ampm) {
1109
+ if (match.length == 1) {
1110
+ ampmName = ampmName.charAt(0);
1111
+ }
1112
+ return match.charAt(0) === 'T' ? ampmName.toUpperCase() : ampmName.toLowerCase();
1113
+ }
1114
+ return '';
1115
+ default:
1116
+ return match.replace(/\'/g, "") || "'";
1117
+ }
1118
+ });
1119
+
1120
+ tmptime = $.trim(tmptime);
1121
+ return tmptime;
1122
+ };
1123
+
1124
+ //########################################################################
1125
+ // the bad hack :/ override datepicker so it doesnt close on select
1126
+ // inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
1127
+ //########################################################################
1128
+ $.datepicker._base_selectDate = $.datepicker._selectDate;
1129
+ $.datepicker._selectDate = function (id, dateStr) {
1130
+ var inst = this._getInst($(id)[0]),
1131
+ tp_inst = this._get(inst, 'timepicker');
1132
+
1133
+ if (tp_inst) {
1134
+ tp_inst._limitMinMaxDateTime(inst, true);
1135
+ inst.inline = inst.stay_open = true;
1136
+ //This way the onSelect handler called from calendarpicker get the full dateTime
1137
+ this._base_selectDate(id, dateStr);
1138
+ inst.inline = inst.stay_open = false;
1139
+ this._notifyChange(inst);
1140
+ this._updateDatepicker(inst);
1141
+ }
1142
+ else { this._base_selectDate(id, dateStr); }
1143
+ };
1144
+
1145
+ //#############################################################################################
1146
+ // second bad hack :/ override datepicker so it triggers an event when changing the input field
1147
+ // and does not redraw the datepicker on every selectDate event
1148
+ //#############################################################################################
1149
+ $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
1150
+ $.datepicker._updateDatepicker = function(inst) {
1151
+
1152
+ // don't popup the datepicker if there is another instance already opened
1153
+ var input = inst.input[0];
1154
+ if($.datepicker._curInst &&
1155
+ $.datepicker._curInst != inst &&
1156
+ $.datepicker._datepickerShowing &&
1157
+ $.datepicker._lastInput != input) {
1158
+ return;
1159
+ }
1160
+
1161
+ if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
1162
+
1163
+ this._base_updateDatepicker(inst);
1164
+
1165
+ // Reload the time control when changing something in the input text field.
1166
+ var tp_inst = this._get(inst, 'timepicker');
1167
+ if(tp_inst) {
1168
+ tp_inst._addTimePicker(inst);
1169
+
1170
+ if (tp_inst._defaults.useLocalTimezone) { //checks daylight saving with the new date.
1171
+ var date = new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay, 12);
1172
+ selectLocalTimeZone(tp_inst, date);
1173
+ tp_inst._onTimeChange();
1174
+ }
1175
+ }
1176
+ }
1177
+ };
1178
+
1179
+ //#######################################################################################
1180
+ // third bad hack :/ override datepicker so it allows spaces and colon in the input field
1181
+ //#######################################################################################
1182
+ $.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
1183
+ $.datepicker._doKeyPress = function(event) {
1184
+ var inst = $.datepicker._getInst(event.target),
1185
+ tp_inst = $.datepicker._get(inst, 'timepicker');
1186
+
1187
+ if (tp_inst) {
1188
+ if ($.datepicker._get(inst, 'constrainInput')) {
1189
+ var ampm = tp_inst._defaults.ampm,
1190
+ dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
1191
+ datetimeChars = tp_inst._defaults.timeFormat.toString()
1192
+ .replace(/[hms]/g, '')
1193
+ .replace(/TT/g, ampm ? 'APM' : '')
1194
+ .replace(/Tt/g, ampm ? 'AaPpMm' : '')
1195
+ .replace(/tT/g, ampm ? 'AaPpMm' : '')
1196
+ .replace(/T/g, ampm ? 'AP' : '')
1197
+ .replace(/tt/g, ampm ? 'apm' : '')
1198
+ .replace(/t/g, ampm ? 'ap' : '') +
1199
+ " " +
1200
+ tp_inst._defaults.separator +
1201
+ tp_inst._defaults.timeSuffix +
1202
+ (tp_inst._defaults.showTimezone ? tp_inst._defaults.timezoneList.join('') : '') +
1203
+ (tp_inst._defaults.amNames.join('')) +
1204
+ (tp_inst._defaults.pmNames.join('')) +
1205
+ dateChars,
1206
+ chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
1207
+ return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
1208
+ }
1209
+ }
1210
+
1211
+ return $.datepicker._base_doKeyPress(event);
1212
+ };
1213
+
1214
+ //#######################################################################################
1215
+ // Override key up event to sync manual input changes.
1216
+ //#######################################################################################
1217
+ $.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
1218
+ $.datepicker._doKeyUp = function (event) {
1219
+ var inst = $.datepicker._getInst(event.target),
1220
+ tp_inst = $.datepicker._get(inst, 'timepicker');
1221
+
1222
+ if (tp_inst) {
1223
+ if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) {
1224
+ try {
1225
+ $.datepicker._updateDatepicker(inst);
1226
+ }
1227
+ catch (err) {
1228
+ $.datepicker.log(err);
1229
+ }
1230
+ }
1231
+ }
1232
+
1233
+ return $.datepicker._base_doKeyUp(event);
1234
+ };
1235
+
1236
+ //#######################################################################################
1237
+ // override "Today" button to also grab the time.
1238
+ //#######################################################################################
1239
+ $.datepicker._base_gotoToday = $.datepicker._gotoToday;
1240
+ $.datepicker._gotoToday = function(id) {
1241
+ var inst = this._getInst($(id)[0]),
1242
+ $dp = inst.dpDiv;
1243
+ this._base_gotoToday(id);
1244
+ var tp_inst = this._get(inst, 'timepicker');
1245
+ selectLocalTimeZone(tp_inst);
1246
+ var now = new Date();
1247
+ this._setTime(inst, now);
1248
+ $( '.ui-datepicker-today', $dp).click();
1249
+ };
1250
+
1251
+ //#######################################################################################
1252
+ // Disable & enable the Time in the datetimepicker
1253
+ //#######################################################################################
1254
+ $.datepicker._disableTimepickerDatepicker = function(target) {
1255
+ var inst = this._getInst(target);
1256
+ if (!inst) { return; }
1257
+
1258
+ var tp_inst = this._get(inst, 'timepicker');
1259
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1260
+ if (tp_inst) {
1261
+ tp_inst._defaults.showTimepicker = false;
1262
+ tp_inst._updateDateTime(inst);
1263
+ }
1264
+ };
1265
+
1266
+ $.datepicker._enableTimepickerDatepicker = function(target) {
1267
+ var inst = this._getInst(target);
1268
+ if (!inst) { return; }
1269
+
1270
+ var tp_inst = this._get(inst, 'timepicker');
1271
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1272
+ if (tp_inst) {
1273
+ tp_inst._defaults.showTimepicker = true;
1274
+ tp_inst._addTimePicker(inst); // Could be disabled on page load
1275
+ tp_inst._updateDateTime(inst);
1276
+ }
1277
+ };
1278
+
1279
+ //#######################################################################################
1280
+ // Create our own set time function
1281
+ //#######################################################################################
1282
+ $.datepicker._setTime = function(inst, date) {
1283
+ var tp_inst = this._get(inst, 'timepicker');
1284
+ if (tp_inst) {
1285
+ var defaults = tp_inst._defaults,
1286
+ // calling _setTime with no date sets time to defaults
1287
+ hour = date ? date.getHours() : defaults.hour,
1288
+ minute = date ? date.getMinutes() : defaults.minute,
1289
+ second = date ? date.getSeconds() : defaults.second,
1290
+ millisec = date ? date.getMilliseconds() : defaults.millisec;
1291
+ //check if within min/max times..
1292
+ // correct check if within min/max times.
1293
+ // Rewritten by Scott A. Woodward
1294
+ var hourEq = hour === defaults.hourMin,
1295
+ minuteEq = minute === defaults.minuteMin,
1296
+ secondEq = second === defaults.secondMin;
1297
+ var reset = false;
1298
+ if(hour < defaults.hourMin || hour > defaults.hourMax)
1299
+ reset = true;
1300
+ else if( (minute < defaults.minuteMin || minute > defaults.minuteMax) && hourEq)
1301
+ reset = true;
1302
+ else if( (second < defaults.secondMin || second > defaults.secondMax ) && hourEq && minuteEq)
1303
+ reset = true;
1304
+ else if( (millisec < defaults.millisecMin || millisec > defaults.millisecMax) && hourEq && minuteEq && secondEq)
1305
+ reset = true;
1306
+ if(reset) {
1307
+ hour = defaults.hourMin;
1308
+ minute = defaults.minuteMin;
1309
+ second = defaults.secondMin;
1310
+ millisec = defaults.millisecMin;
1311
+ }
1312
+ tp_inst.hour = hour;
1313
+ tp_inst.minute = minute;
1314
+ tp_inst.second = second;
1315
+ tp_inst.millisec = millisec;
1316
+ if (tp_inst.hour_slider) tp_inst.hour_slider.slider('value', hour);
1317
+ if (tp_inst.minute_slider) tp_inst.minute_slider.slider('value', minute);
1318
+ if (tp_inst.second_slider) tp_inst.second_slider.slider('value', second);
1319
+ if (tp_inst.millisec_slider) tp_inst.millisec_slider.slider('value', millisec);
1320
+
1321
+ tp_inst._onTimeChange();
1322
+ tp_inst._updateDateTime(inst);
1323
+ }
1324
+ };
1325
+
1326
+ //#######################################################################################
1327
+ // Create new public method to set only time, callable as $().datepicker('setTime', date)
1328
+ //#######################################################################################
1329
+ $.datepicker._setTimeDatepicker = function(target, date, withDate) {
1330
+ var inst = this._getInst(target);
1331
+ if (!inst) { return; }
1332
+
1333
+ var tp_inst = this._get(inst, 'timepicker');
1334
+
1335
+ if (tp_inst) {
1336
+ this._setDateFromField(inst);
1337
+ var tp_date;
1338
+ if (date) {
1339
+ if (typeof date == "string") {
1340
+ tp_inst._parseTime(date, withDate);
1341
+ tp_date = new Date();
1342
+ tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1343
+ }
1344
+ else { tp_date = new Date(date.getTime()); }
1345
+ if (tp_date.toString() == 'Invalid Date') { tp_date = undefined; }
1346
+ this._setTime(inst, tp_date);
1347
+ }
1348
+ }
1349
+
1350
+ };
1351
+
1352
+ //#######################################################################################
1353
+ // override setDate() to allow setting time too within Date object
1354
+ //#######################################################################################
1355
+ $.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
1356
+ $.datepicker._setDateDatepicker = function(target, date) {
1357
+ var inst = this._getInst(target);
1358
+ if (!inst) { return; }
1359
+
1360
+ var tp_date = (date instanceof Date) ? new Date(date.getTime()) : date;
1361
+
1362
+ this._updateDatepicker(inst);
1363
+ this._base_setDateDatepicker.apply(this, arguments);
1364
+ this._setTimeDatepicker(target, tp_date, true);
1365
+ };
1366
+
1367
+ //#######################################################################################
1368
+ // override getDate() to allow getting time too within Date object
1369
+ //#######################################################################################
1370
+ $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
1371
+ $.datepicker._getDateDatepicker = function(target, noDefault) {
1372
+ var inst = this._getInst(target);
1373
+ if (!inst) { return; }
1374
+
1375
+ var tp_inst = this._get(inst, 'timepicker');
1376
+
1377
+ if (tp_inst) {
1378
+ this._setDateFromField(inst, noDefault);
1379
+ var date = this._getDate(inst);
1380
+ if (date && tp_inst._parseTime($(target).val(), tp_inst.timeOnly)) { date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec); }
1381
+ return date;
1382
+ }
1383
+ return this._base_getDateDatepicker(target, noDefault);
1384
+ };
1385
+
1386
+ //#######################################################################################
1387
+ // override parseDate() because UI 1.8.14 throws an error about "Extra characters"
1388
+ // An option in datapicker to ignore extra format characters would be nicer.
1389
+ //#######################################################################################
1390
+ $.datepicker._base_parseDate = $.datepicker.parseDate;
1391
+ $.datepicker.parseDate = function(format, value, settings) {
1392
+ var splitRes = splitDateTime(format, value, settings);
1393
+ return $.datepicker._base_parseDate(format, splitRes[0], settings);
1394
+ };
1395
+
1396
+ //#######################################################################################
1397
+ // override formatDate to set date with time to the input
1398
+ //#######################################################################################
1399
+ $.datepicker._base_formatDate = $.datepicker._formatDate;
1400
+ $.datepicker._formatDate = function(inst, day, month, year){
1401
+ var tp_inst = this._get(inst, 'timepicker');
1402
+ if(tp_inst) {
1403
+ tp_inst._updateDateTime(inst);
1404
+ return tp_inst.$input.val();
1405
+ }
1406
+ return this._base_formatDate(inst);
1407
+ };
1408
+
1409
+ //#######################################################################################
1410
+ // override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
1411
+ //#######################################################################################
1412
+ $.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
1413
+ $.datepicker._optionDatepicker = function(target, name, value) {
1414
+ var inst = this._getInst(target);
1415
+ if (!inst) { return null; }
1416
+
1417
+ var tp_inst = this._get(inst, 'timepicker');
1418
+ if (tp_inst) {
1419
+ var min = null, max = null, onselect = null;
1420
+ if (typeof name == 'string') { // if min/max was set with the string
1421
+ if (name === 'minDate' || name === 'minDateTime' ) {
1422
+ min = value;
1423
+ }
1424
+ else {
1425
+ if (name === 'maxDate' || name === 'maxDateTime') {
1426
+ max = value;
1427
+ }
1428
+ else {
1429
+ if (name === 'onSelect') {
1430
+ onselect = value;
1431
+ }
1432
+ }
1433
+ }
1434
+ } else {
1435
+ if (typeof name == 'object') { //if min/max was set with the JSON
1436
+ if (name.minDate) {
1437
+ min = name.minDate;
1438
+ } else {
1439
+ if (name.minDateTime) {
1440
+ min = name.minDateTime;
1441
+ } else {
1442
+ if (name.maxDate) {
1443
+ max = name.maxDate;
1444
+ } else {
1445
+ if (name.maxDateTime) {
1446
+ max = name.maxDateTime;
1447
+ }
1448
+ }
1449
+ }
1450
+ }
1451
+ }
1452
+ }
1453
+ if(min) { //if min was set
1454
+ if (min === 0) {
1455
+ min = new Date();
1456
+ } else {
1457
+ min = new Date(min);
1458
+ }
1459
+
1460
+ tp_inst._defaults.minDate = min;
1461
+ tp_inst._defaults.minDateTime = min;
1462
+ } else if (max) { //if max was set
1463
+ if(max===0) {
1464
+ max=new Date();
1465
+ } else {
1466
+ max= new Date(max);
1467
+ }
1468
+ tp_inst._defaults.maxDate = max;
1469
+ tp_inst._defaults.maxDateTime = max;
1470
+ } else if (onselect) {
1471
+ tp_inst._defaults.onSelect = onselect;
1472
+ }
1473
+ }
1474
+ if (value === undefined) {
1475
+ return this._base_optionDatepicker(target, name);
1476
+ }
1477
+ return this._base_optionDatepicker(target, name, value);
1478
+ };
1479
+
1480
+ //#######################################################################################
1481
+ // jQuery extend now ignores nulls!
1482
+ //#######################################################################################
1483
+ function extendRemove(target, props) {
1484
+ $.extend(target, props);
1485
+ for (var name in props) {
1486
+ if (props[name] === null || props[name] === undefined) {
1487
+ target[name] = props[name];
1488
+ }
1489
+ }
1490
+ return target;
1491
+ }
1492
+
1493
+ //#######################################################################################
1494
+ // Splits datetime string into date ans time substrings.
1495
+ // Throws exception when date can't be parsed
1496
+ // If only date is present, time substring eill be ''
1497
+ //#######################################################################################
1498
+ var splitDateTime = function(dateFormat, dateTimeString, dateSettings)
1499
+ {
1500
+ try {
1501
+ var date = $.datepicker._base_parseDate(dateFormat, dateTimeString, dateSettings);
1502
+ } catch (err) {
1503
+ if (err.indexOf(":") >= 0) {
1504
+ // Hack! The error message ends with a colon, a space, and
1505
+ // the "extra" characters. We rely on that instead of
1506
+ // attempting to perfectly reproduce the parsing algorithm.
1507
+ var dateStringLength = dateTimeString.length-(err.length-err.indexOf(':')-2);
1508
+ var timeString = dateTimeString.substring(dateStringLength);
1509
+
1510
+ return [dateTimeString.substring(0, dateStringLength), dateTimeString.substring(dateStringLength)];
1511
+
1512
+ } else {
1513
+ throw err;
1514
+ }
1515
+ }
1516
+ return [dateTimeString, ''];
1517
+ };
1518
+
1519
+ //#######################################################################################
1520
+ // Internal function to parse datetime interval
1521
+ // Returns: {date: Date, timeObj: Object}, where
1522
+ // date - parsed date without time (type Date)
1523
+ // timeObj = {hour: , minute: , second: , millisec: } - parsed time. Optional
1524
+ //#######################################################################################
1525
+ var parseDateTimeInternal = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings)
1526
+ {
1527
+ var date;
1528
+ var splitRes = splitDateTime(dateFormat, dateTimeString, dateSettings);
1529
+ date = $.datepicker._base_parseDate(dateFormat, splitRes[0], dateSettings);
1530
+ if (splitRes[1] !== '')
1531
+ {
1532
+ var timeString = splitRes[1];
1533
+ var separator = timeSettings && timeSettings.separator ? timeSettings.separator : $.timepicker._defaults.separator;
1534
+ if ( timeString.indexOf(separator) !== 0) {
1535
+ throw 'Missing time separator';
1536
+ }
1537
+ timeString = timeString.substring(separator.length);
1538
+ var parsedTime = $.datepicker.parseTime(timeFormat, timeString, timeSettings);
1539
+ if (parsedTime === null) {
1540
+ throw 'Wrong time format';
1541
+ }
1542
+ return {date: date, timeObj: parsedTime};
1543
+ } else {
1544
+ return {date: date};
1545
+ }
1546
+ };
1547
+
1548
+ //#######################################################################################
1549
+ // Internal function to set timezone_select to the local timezone
1550
+ //#######################################################################################
1551
+ var selectLocalTimeZone = function(tp_inst, date)
1552
+ {
1553
+ if (tp_inst && tp_inst.timezone_select) {
1554
+ tp_inst._defaults.useLocalTimezone = true;
1555
+ var now = typeof date !== 'undefined' ? date : new Date();
1556
+ var tzoffset = $.timepicker.timeZoneOffsetString(now);
1557
+ if (tp_inst._defaults.timezoneIso8601) {
1558
+ tzoffset = tzoffset.substring(0, 3) + ':' + tzoffset.substring(3);
1559
+ }
1560
+ tp_inst.timezone_select.val(tzoffset);
1561
+ }
1562
+ };
1563
+
1564
+ $.timepicker = new Timepicker(); // singleton instance
1565
+
1566
+ /**
1567
+ * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
1568
+ * @param date
1569
+ * @return string
1570
+ */
1571
+ $.timepicker.timeZoneOffsetString = function(date) {
1572
+ var off = date.getTimezoneOffset() * -1,
1573
+ minutes = off % 60,
1574
+ hours = (off-minutes) / 60;
1575
+ return (off >= 0 ? '+' : '-') + ('0'+(hours*101).toString()).substr(-2) + ('0'+(minutes*101).toString()).substr(-2);
1576
+ };
1577
+
1578
+ //#######################################################################################
1579
+ // Changes by simonvwade to better handle time range limits
1580
+ //#######################################################################################
1581
+ /**
1582
+ * Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to
1583
+ * enforce date range limits.
1584
+ * n.b. The input value must be correctly formatted (reformatting is not supported)
1585
+ * @param Element startTime
1586
+ * @param Element endTime
1587
+ * @param obj options Options for the timepicker() call
1588
+ * @return jQuery
1589
+ */
1590
+ $.timepicker.timeRange = function( startTime, endTime, options ) {
1591
+ return $.timepicker.handleRange('timepicker', startTime, endTime, options);
1592
+ }
1593
+
1594
+ /**
1595
+ * Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to
1596
+ * enforce date range limits.
1597
+ * @param Element startTime
1598
+ * @param Element endTime
1599
+ * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
1600
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
1601
+ * @param string method Can be used to specify the type of picker to be added
1602
+ * @return jQuery
1603
+ */
1604
+ $.timepicker.dateTimeRange = function( startTime, endTime, options ) {
1605
+ $.timepicker.dateRange(startTime, endTime, options, 'datetimepicker');
1606
+ }
1607
+
1608
+ /**
1609
+ * Calls `method` on the `startTime` and `endTime` elements, and configures them to
1610
+ * enforce date range limits.
1611
+ * @param Element startTime
1612
+ * @param Element endTime
1613
+ * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
1614
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
1615
+ * @param string method Can be used to specify the type of picker to be added
1616
+ * @return jQuery
1617
+ */
1618
+ $.timepicker.dateRange = function( startTime, endTime, options, method ) {
1619
+ method = method || 'datepicker';
1620
+ $.timepicker.handleRange(method, startTime, endTime, options);
1621
+ }
1622
+
1623
+ /**
1624
+ * Calls `method` on the `startTime` and `endTime` elements, and configures them to
1625
+ * enforce date range limits.
1626
+ * @param string method Can be used to specify the type of picker to be added
1627
+ * @param Element startTime
1628
+ * @param Element endTime
1629
+ * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
1630
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
1631
+ * @return jQuery
1632
+ */
1633
+ $.timepicker.handleRange = function( method, startTime, endTime, options ) {
1634
+ $.fn[method].call(startTime, $.extend({
1635
+ onClose: function(dateText, inst) {
1636
+ checkDates(this, endTime, dateText);
1637
+ },
1638
+ onSelect: function (selectedDateTime) {
1639
+ selected(this, endTime, 'minDate');
1640
+ }
1641
+ }, options, options.start)
1642
+ );
1643
+ $.fn[method].call(endTime, $.extend({
1644
+ onClose: function(dateText, inst) {
1645
+ checkDates(this, startTime, dateText);
1646
+ },
1647
+ onSelect: function (selectedDateTime) {
1648
+ selected(this, startTime, 'maxDate');
1649
+ }
1650
+ }, options, options.end)
1651
+ );
1652
+ // timepicker doesn't provide access to its 'timeFormat' option,
1653
+ // nor could I get datepicker.formatTime() to behave with times, so I
1654
+ // have disabled reformatting for timepicker
1655
+ if( method != 'timepicker' && options.reformat ) {
1656
+ $([startTime, endTime]).each(function() {
1657
+ var format = $(this)[method].call($(this), 'option', 'dateFormat'),
1658
+ date = new Date($(this).val());
1659
+ if( $(this).val() && date ) {
1660
+ $(this).val($.datepicker.formatDate(format, date));
1661
+ }
1662
+ });
1663
+ }
1664
+ checkDates(startTime, endTime, startTime.val());
1665
+ function checkDates(changed, other, dateText) {
1666
+ if( other.val() && (new Date(startTime.val()) > new Date(endTime.val())) ) {
1667
+ other.val(dateText);
1668
+ }
1669
+ }
1670
+ selected(startTime, endTime, 'minDate');
1671
+ selected(endTime, startTime, 'maxDate');
1672
+ function selected(changed, other, option) {
1673
+ if( !$(changed).val() ) {
1674
+ return;
1675
+ }
1676
+ var date = $(changed)[method].call($(changed), 'getDate');
1677
+ // timepicker doesn't implement 'getDate' and returns a jQuery
1678
+ if( date.getTime ) {
1679
+ $(other)[method].call($(other), 'option', option, date);
1680
+ }
1681
+ }
1682
+ return $([startTime.get(0), endTime.get(0)]);
1683
+ };
1684
+
1685
+ $.timepicker.version = "1.0.2";
1686
+
1687
+ })(jQuery);