refinerycms-calendar 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/vendor/assets/images/chosen-sprite.png +0 -0
- data/vendor/assets/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/vendor/assets/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
- data/vendor/assets/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- data/vendor/assets/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- data/vendor/assets/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- data/vendor/assets/images/ui-icons_217bc0_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_2e83ff_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_469bdd_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_6da8d5_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_d8e7f3_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_f9bd01_256x240.png +0 -0
- data/vendor/assets/javascripts/chosen.jquery.min.js +10 -0
- data/vendor/assets/javascripts/jquery.ui.timepicker.addon.js +1326 -0
- data/vendor/assets/javascripts/refinery/calendar.js.coffee +7 -0
- data/vendor/assets/stylesheets/chosen.css +372 -0
- data/vendor/assets/stylesheets/jquery-ui.css +377 -0
- data/vendor/assets/stylesheets/refinery/calendar.css.scss +22 -0
- metadata +28 -6
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,10 @@
|
|
1
|
+
// Chosen, a Select Box Enhancer for jQuery and Protoype
|
2
|
+
// by Patrick Filler for Harvest, http://getharvest.com
|
3
|
+
//
|
4
|
+
// Version 0.9.5
|
5
|
+
// Full source at https://github.com/harvesthq/chosen
|
6
|
+
// Copyright (c) 2011 Harvest http://getharvest.com
|
7
|
+
|
8
|
+
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
9
|
+
// This file is generated by `cake build`, do not edit it by hand.
|
10
|
+
(function(){var a;a=function(){function a(){this.options_index=0,this.parsed=[]}return a.prototype.add_node=function(a){return a.nodeName==="OPTGROUP"?this.add_group(a):this.add_option(a)},a.prototype.add_group=function(a){var b,c,d,e,f,g;b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:a.label,children:0,disabled:a.disabled}),f=a.childNodes,g=[];for(d=0,e=f.length;d<e;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},a.prototype.add_option=function(a,b,c){if(a.nodeName==="OPTION")return a.text!==""?(b!=null&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},a}(),a.select_to_array=function(b){var c,d,e,f,g;d=new a,g=b.childNodes;for(e=0,f=g.length;e<f;e++)c=g[e],d.add_node(c);return d.parsed},this.SelectParser=a}).call(this),function(){var a,b,c=function(a,b){return function(){return a.apply(b,arguments)}};b=this,a=function(){function a(a,b){this.form_field=a,this.options=b!=null?b:{},this.set_default_values(),this.is_multiple=this.form_field.multiple,this.default_text_default=this.is_multiple?"Select Some Options":"Select an Option",this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return a.prototype.set_default_values=function(){return this.click_test_action=c(function(a){return this.test_active_click(a)},this),this.activate_action=c(function(a){return this.activate_field(a)},this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.choices=0,this.results_none_found=this.options.no_results_text||"No results match"},a.prototype.mouse_enter=function(){return this.mouse_on_container=!0},a.prototype.mouse_leave=function(){return this.mouse_on_container=!1},a.prototype.input_focus=function(a){if(!this.active_field)return setTimeout(c(function(){return this.container_mousedown()},this),50)},a.prototype.input_blur=function(a){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(c(function(){return this.blur_test()},this),100)},a.prototype.result_add_option=function(a){var b,c;return a.disabled?"":(a.dom_id=this.container_id+"_o_"+a.array_index,b=a.selected&&this.is_multiple?[]:["active-result"],a.selected&&b.push("result-selected"),a.group_array_index!=null&&b.push("group-option"),a.classes!==""&&b.push(a.classes),c=a.style.cssText!==""?' style="'+a.style+'"':"",'<li id="'+a.dom_id+'" class="'+b.join(" ")+'"'+c+">"+a.html+"</li>")},a.prototype.results_update_field=function(){return this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},a.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},a.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},a.prototype.keyup_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale();switch(b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:a.preventDefault();if(this.results_showing)return this.result_select(a);break;case 27:if(this.results_showing)return this.results_hide();break;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},a.prototype.generate_field_id=function(){var a;return a=this.generate_random_id(),this.form_field.id=a,a},a.prototype.generate_random_char=function(){var a,b,c;return a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",c=Math.floor(Math.random()*a.length),b=a.substring(c,c+1)},a}(),b.AbstractChosen=a}.call(this),function(){var a,b,c,d,e=Object.prototype.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a},g=function(a,b){return function(){return a.apply(b,arguments)}};d=this,a=jQuery,a.fn.extend({chosen:function(c){return!a.browser.msie||a.browser.version!=="6.0"&&a.browser.version!=="7.0"?a(this).each(function(d){if(!a(this).hasClass("chzn-done"))return new b(this,c)}):this}}),b=function(){function b(){b.__super__.constructor.apply(this,arguments)}return f(b,AbstractChosen),b.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},b.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},b.prototype.set_up_html=function(){var b,d,e,f;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/(:|\.)/g,"_"):this.generate_field_id(),this.container_id+="_chzn",this.f_width=this.form_field_jq.outerWidth(),this.default_text=this.form_field_jq.data("placeholder")?this.form_field_jq.data("placeholder"):this.default_text_default,b=a("<div />",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px;"}),this.is_multiple?b.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):b.html('<a href="javascript:void(0)" class="chzn-single"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(b),this.container=a("#"+this.container_id),this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.find("div.chzn-drop").first(),d=this.container.height(),e=this.f_width-c(this.dropdown),this.dropdown.css({width:e+"px",top:d+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),f=e-c(this.search_container)-c(this.search_field),this.search_field.css({width:f+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},b.prototype.register_observers=function(){this.container.mousedown(g(function(a){return this.container_mousedown(a)},this)),this.container.mouseup(g(function(a){return this.container_mouseup(a)},this)),this.container.mouseenter(g(function(a){return this.mouse_enter(a)},this)),this.container.mouseleave(g(function(a){return this.mouse_leave(a)},this)),this.search_results.mouseup(g(function(a){return this.search_results_mouseup(a)},this)),this.search_results.mouseover(g(function(a){return this.search_results_mouseover(a)},this)),this.search_results.mouseout(g(function(a){return this.search_results_mouseout(a)},this)),this.form_field_jq.bind("liszt:updated",g(function(a){return this.results_update_field(a)},this)),this.search_field.blur(g(function(a){return this.input_blur(a)},this)),this.search_field.keyup(g(function(a){return this.keyup_checker(a)},this)),this.search_field.keydown(g(function(a){return this.keydown_checker(a)},this));if(this.is_multiple)return this.search_choices.click(g(function(a){return this.choices_click(a)},this)),this.search_field.focus(g(function(a){return this.input_focus(a)},this))},b.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},b.prototype.container_mousedown=function(b){var c;if(!this.is_disabled)return c=b!=null?a(b.target).hasClass("search-choice-close"):!1,b&&b.type==="mousedown"&&b.stopPropagation(),!this.pending_destroy_click&&!c?(this.active_field?!this.is_multiple&&b&&(a(b.target)[0]===this.selected_item[0]||a(b.target).parents("a.chzn-single").length)&&(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(document).click(this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},b.prototype.container_mouseup=function(a){if(a.target.nodeName==="ABBR")return this.results_reset(a)},b.prototype.blur_test=function(a){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},b.prototype.close_field=function(){return a(document).unbind("click",this.click_test_action),this.is_multiple||(this.selected_item.attr("tabindex",this.search_field.attr("tabindex")),this.search_field.attr("tabindex",-1)),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},b.prototype.activate_field=function(){return!this.is_multiple&&!this.active_field&&(this.search_field.attr("tabindex",this.selected_item.attr("tabindex")),this.selected_item.attr("tabindex",-1)),this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},b.prototype.test_active_click=function(b){return a(b.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},b.prototype.results_build=function(){var a,b,c,e,f;this.parsing=!0,this.results_data=d.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.find("span").text(this.default_text),this.form_field.options.length>this.disable_search_threshold?this.container.removeClass("chzn-container-single-nosearch"):this.container.addClass("chzn-container-single-nosearch")),a="",f=this.results_data;for(c=0,e=f.length;c<e;c++)b=f[c],b.group?a+=this.result_add_group(b):b.empty||(a+=this.result_add_option(b),b.selected&&this.is_multiple?this.choice_build(b):b.selected&&!this.is_multiple&&(this.selected_item.find("span").text(b.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(a),this.parsing=!1},b.prototype.result_add_group=function(b){return b.disabled?"":(b.dom_id=this.container_id+"_g_"+b.array_index,'<li id="'+b.dom_id+'" class="group-result">'+a("<div />").text(b.label).html()+"</li>")},b.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight();if(b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(c<f)return this.search_results.scrollTop(c)}},b.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},b.prototype.results_show=function(){var a;return this.is_multiple||(this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected)),a=this.is_multiple?this.container.height():this.container.height()-1,this.dropdown.css({top:a+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},b.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},b.prototype.set_tab_index=function(a){var b;if(this.form_field_jq.attr("tabindex"))return b=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.is_multiple?this.search_field.attr("tabindex",b):(this.selected_item.attr("tabindex",b),this.search_field.attr("tabindex",-1))},b.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},b.prototype.search_results_mouseup=function(b){var c;c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first();if(c.length)return this.result_highlight=c,this.result_select(b)},b.prototype.search_results_mouseover=function(b){var c;c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first();if(c)return this.result_do_highlight(c)},b.prototype.search_results_mouseout=function(b){if(a(b.target).hasClass("active-result"))return this.result_clear_highlight()},b.prototype.choices_click=function(b){b.preventDefault();if(this.active_field&&!a(b.target).hasClass("search-choice")&&!this.results_showing)return this.results_show()},b.prototype.choice_build=function(b){var c,d;return c=this.container_id+"_c_"+b.array_index,this.choices+=1,this.search_container.before('<li class="search-choice" id="'+c+'"><span>'+b.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+b.array_index+'"></a></li>'),d=a("#"+c).find("a").first(),d.click(g(function(a){return this.choice_destroy_link_click(a)},this))},b.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),this.is_disabled?b.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(a(b.target)))},b.prototype.choice_destroy=function(a){return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),this.result_deselect(a.attr("rel")),a.parents("li").first().remove()},b.prototype.results_reset=function(b){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.show_search_field_default(),a(b.target).remove(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},b.prototype.result_select=function(a){var b,c,d,e;if(this.result_highlight)return b=this.result_highlight,c=b.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(b):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=b),b.addClass("result-selected"),e=c.substr(c.lastIndexOf("_")+1),d=this.results_data[e],d.selected=!0,this.form_field.options[d.options_index].selected=!0,this.is_multiple?this.choice_build(d):(this.selected_item.find("span").first().text(d.text),this.allow_single_deselect&&this.single_deselect_control_build()),(!a.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),this.form_field_jq.trigger("change"),this.search_field_scale()},b.prototype.result_activate=function(a){return a.addClass("active-result")},b.prototype.result_deactivate=function(a){return a.removeClass("active-result")},b.prototype.result_deselect=function(b){var c,d;return d=this.results_data[b],d.selected=!1,this.form_field.options[d.options_index].selected=!1,c=a("#"+this.container_id+"_o_"+b),c.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change"),this.search_field_scale()},b.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')},b.prototype.winnow_results=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;this.no_results_clear(),i=0,j=this.search_field.val()===this.default_text?"":a("<div/>").text(a.trim(this.search_field.val())).html(),f=new RegExp("^"+j.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),m=new RegExp(j.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),r=this.results_data;for(n=0,p=r.length;n<p;n++){c=r[n];if(!c.disabled&&!c.empty)if(c.group)a("#"+c.dom_id).css("display","none");else if(!this.is_multiple||!c.selected){b=!1,h=c.dom_id,g=a("#"+h);if(f.test(c.html))b=!0,i+=1;else if(c.html.indexOf(" ")>=0||c.html.indexOf("[")===0){e=c.html.replace(/\[|\]/g,"").split(" ");if(e.length)for(o=0,q=e.length;o<q;o++)d=e[o],f.test(d)&&(b=!0,i+=1)}b?(j.length?(k=c.html.search(m),l=c.html.substr(0,k+j.length)+"</em>"+c.html.substr(k+j.length),l=l.substr(0,k)+"<em>"+l.substr(k)):l=c.html,g.html(l),this.result_activate(g),c.group_array_index!=null&&a("#"+this.results_data[c.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&h===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(g))}}return i<1&&j.length?this.no_results(j):this.winnow_results_set_highlight()},b.prototype.winnow_results_clear=function(){var b,c,d,e,f;this.search_field.val(""),c=this.search_results.find("li"),f=[];for(d=0,e=c.length;d<e;d++)b=c[d],b=a(b),f.push(b.hasClass("group-result")?b.css("display","auto"):!this.is_multiple||!b.hasClass("result-selected")?this.result_activate(b):void 0);return f},b.prototype.winnow_results_set_highlight=function(){var a,b;if(!this.result_highlight){b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first();if(a!=null)return this.result_do_highlight(a)}},b.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c)},b.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},b.prototype.keydown_arrow=function(){var b,c;this.result_highlight?this.results_showing&&(c=this.result_highlight.nextAll("li.active-result").first(),c&&this.result_do_highlight(c)):(b=this.search_results.find("li.active-result").first(),b&&this.result_do_highlight(a(b)));if(!this.results_showing)return this.results_show()},b.prototype.keyup_arrow=function(){var a;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},b.prototype.keydown_backstroke=function(){return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(this.pending_backstroke=this.search_container.siblings("li.search-choice").last(),this.pending_backstroke.addClass("search-choice-focus"))},b.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},b.prototype.keydown_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale(),b!==8&&this.pending_backstroke&&this.clear_backstroke();switch(b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},b.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(i=0,j=g.length;i<j;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return c=a("<div />",{style:f}),c.text(this.search_field.val()),a("body").append(c),h=c.width()+25,c.remove(),h>this.f_width-10&&(h=this.f_width-10),this.search_field.css({width:h+"px"}),b=this.container.height(),this.dropdown.css({top:b+"px"})}},b.prototype.generate_random_id=function(){var b;b="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(a("#"+b).length>0)b+=this.generate_random_char();return b},b}(),c=function(a){var b;return b=a.outerWidth()-a.width()},d.get_side_border_padding=c}.call(this)
|
@@ -0,0 +1,1326 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery timepicker addon
|
3
|
+
* By: Trent Richardson [http://trentrichardson.com]
|
4
|
+
* Version 1.0.0
|
5
|
+
* Last Modified: 02/05/2012
|
6
|
+
*
|
7
|
+
* Copyright 2012 Trent Richardson
|
8
|
+
* Dual licensed under the MIT and 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
|
+
(function($) {
|
22
|
+
|
23
|
+
// Prevent "Uncaught RangeError: Maximum call stack size exceeded"
|
24
|
+
$.ui.timepicker = $.ui.timepicker || {};
|
25
|
+
if ($.ui.timepicker.version) {
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
|
29
|
+
$.extend($.ui, { timepicker: { version: "1.0.0" } });
|
30
|
+
|
31
|
+
/* Time picker manager.
|
32
|
+
Use the singleton instance of this class, $.timepicker, to interact with the time picker.
|
33
|
+
Settings for (groups of) time pickers are maintained in an instance object,
|
34
|
+
allowing multiple different settings on the same page. */
|
35
|
+
|
36
|
+
function Timepicker() {
|
37
|
+
this.regional = []; // Available regional settings, indexed by language code
|
38
|
+
this.regional[''] = { // Default regional settings
|
39
|
+
currentText: 'Now',
|
40
|
+
closeText: 'Done',
|
41
|
+
ampm: false,
|
42
|
+
amNames: ['AM', 'A'],
|
43
|
+
pmNames: ['PM', 'P'],
|
44
|
+
timeFormat: 'hh:mm tt',
|
45
|
+
timeSuffix: '',
|
46
|
+
timeOnlyTitle: 'Choose Time',
|
47
|
+
timeText: 'Time',
|
48
|
+
hourText: 'Hour',
|
49
|
+
minuteText: 'Minute',
|
50
|
+
secondText: 'Second',
|
51
|
+
millisecText: 'Millisecond',
|
52
|
+
timezoneText: 'Time Zone'
|
53
|
+
};
|
54
|
+
this._defaults = { // Global defaults for all the datetime picker instances
|
55
|
+
showButtonPanel: true,
|
56
|
+
timeOnly: false,
|
57
|
+
showHour: true,
|
58
|
+
showMinute: true,
|
59
|
+
showSecond: false,
|
60
|
+
showMillisec: false,
|
61
|
+
showTimezone: false,
|
62
|
+
showTime: true,
|
63
|
+
stepHour: 1,
|
64
|
+
stepMinute: 1,
|
65
|
+
stepSecond: 1,
|
66
|
+
stepMillisec: 1,
|
67
|
+
hour: 0,
|
68
|
+
minute: 0,
|
69
|
+
second: 0,
|
70
|
+
millisec: 0,
|
71
|
+
timezone: '+0000',
|
72
|
+
hourMin: 0,
|
73
|
+
minuteMin: 0,
|
74
|
+
secondMin: 0,
|
75
|
+
millisecMin: 0,
|
76
|
+
hourMax: 23,
|
77
|
+
minuteMax: 59,
|
78
|
+
secondMax: 59,
|
79
|
+
millisecMax: 999,
|
80
|
+
minDateTime: null,
|
81
|
+
maxDateTime: null,
|
82
|
+
onSelect: null,
|
83
|
+
hourGrid: 0,
|
84
|
+
minuteGrid: 0,
|
85
|
+
secondGrid: 0,
|
86
|
+
millisecGrid: 0,
|
87
|
+
alwaysSetTime: true,
|
88
|
+
separator: ' ',
|
89
|
+
altFieldTimeOnly: true,
|
90
|
+
showTimepicker: true,
|
91
|
+
timezoneIso8609: false,
|
92
|
+
timezoneList: null,
|
93
|
+
addSliderAccess: false,
|
94
|
+
sliderAccessArgs: null
|
95
|
+
};
|
96
|
+
$.extend(this._defaults, this.regional['']);
|
97
|
+
};
|
98
|
+
|
99
|
+
$.extend(Timepicker.prototype, {
|
100
|
+
$input: null,
|
101
|
+
$altInput: null,
|
102
|
+
$timeObj: null,
|
103
|
+
inst: null,
|
104
|
+
hour_slider: null,
|
105
|
+
minute_slider: null,
|
106
|
+
second_slider: null,
|
107
|
+
millisec_slider: null,
|
108
|
+
timezone_select: null,
|
109
|
+
hour: 0,
|
110
|
+
minute: 0,
|
111
|
+
second: 0,
|
112
|
+
millisec: 0,
|
113
|
+
timezone: '+0000',
|
114
|
+
hourMinOriginal: null,
|
115
|
+
minuteMinOriginal: null,
|
116
|
+
secondMinOriginal: null,
|
117
|
+
millisecMinOriginal: null,
|
118
|
+
hourMaxOriginal: null,
|
119
|
+
minuteMaxOriginal: null,
|
120
|
+
secondMaxOriginal: null,
|
121
|
+
millisecMaxOriginal: null,
|
122
|
+
ampm: '',
|
123
|
+
formattedDate: '',
|
124
|
+
formattedTime: '',
|
125
|
+
formattedDateTime: '',
|
126
|
+
timezoneList: null,
|
127
|
+
|
128
|
+
/* Override the default settings for all instances of the time picker.
|
129
|
+
@param settings object - the new settings to use as defaults (anonymous object)
|
130
|
+
@return the manager object */
|
131
|
+
setDefaults: function(settings) {
|
132
|
+
extendRemove(this._defaults, settings || {});
|
133
|
+
return this;
|
134
|
+
},
|
135
|
+
|
136
|
+
//########################################################################
|
137
|
+
// Create a new Timepicker instance
|
138
|
+
//########################################################################
|
139
|
+
_newInst: function($input, o) {
|
140
|
+
var tp_inst = new Timepicker(),
|
141
|
+
inlineSettings = {};
|
142
|
+
|
143
|
+
for (var attrName in this._defaults) {
|
144
|
+
var attrValue = $input.attr('time:' + attrName);
|
145
|
+
if (attrValue) {
|
146
|
+
try {
|
147
|
+
inlineSettings[attrName] = eval(attrValue);
|
148
|
+
} catch (err) {
|
149
|
+
inlineSettings[attrName] = attrValue;
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, {
|
154
|
+
beforeShow: function(input, dp_inst) {
|
155
|
+
if ($.isFunction(o.beforeShow))
|
156
|
+
return o.beforeShow(input, dp_inst, tp_inst);
|
157
|
+
},
|
158
|
+
onChangeMonthYear: function(year, month, dp_inst) {
|
159
|
+
// Update the time as well : this prevents the time from disappearing from the $input field.
|
160
|
+
tp_inst._updateDateTime(dp_inst);
|
161
|
+
if ($.isFunction(o.onChangeMonthYear))
|
162
|
+
o.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
|
163
|
+
},
|
164
|
+
onClose: function(dateText, dp_inst) {
|
165
|
+
if (tp_inst.timeDefined === true && $input.val() != '')
|
166
|
+
tp_inst._updateDateTime(dp_inst);
|
167
|
+
if ($.isFunction(o.onClose))
|
168
|
+
o.onClose.call($input[0], dateText, dp_inst, tp_inst);
|
169
|
+
},
|
170
|
+
timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
|
171
|
+
});
|
172
|
+
tp_inst.amNames = $.map(tp_inst._defaults.amNames, function(val) { return val.toUpperCase(); });
|
173
|
+
tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function(val) { return val.toUpperCase(); });
|
174
|
+
|
175
|
+
if (tp_inst._defaults.timezoneList === null) {
|
176
|
+
var timezoneList = [];
|
177
|
+
for (var i = -11; i <= 12; i++)
|
178
|
+
timezoneList.push((i >= 0 ? '+' : '-') + ('0' + Math.abs(i).toString()).slice(-2) + '00');
|
179
|
+
if (tp_inst._defaults.timezoneIso8609)
|
180
|
+
timezoneList = $.map(timezoneList, function(val) {
|
181
|
+
return val == '+0000' ? 'Z' : (val.substring(0, 3) + ':' + val.substring(3));
|
182
|
+
});
|
183
|
+
tp_inst._defaults.timezoneList = timezoneList;
|
184
|
+
}
|
185
|
+
|
186
|
+
tp_inst.hour = tp_inst._defaults.hour;
|
187
|
+
tp_inst.minute = tp_inst._defaults.minute;
|
188
|
+
tp_inst.second = tp_inst._defaults.second;
|
189
|
+
tp_inst.millisec = tp_inst._defaults.millisec;
|
190
|
+
tp_inst.ampm = '';
|
191
|
+
tp_inst.$input = $input;
|
192
|
+
|
193
|
+
if (o.altField)
|
194
|
+
tp_inst.$altInput = $(o.altField)
|
195
|
+
.css({ cursor: 'pointer' })
|
196
|
+
.focus(function(){ $input.trigger("focus"); });
|
197
|
+
|
198
|
+
if(tp_inst._defaults.minDate==0 || tp_inst._defaults.minDateTime==0)
|
199
|
+
{
|
200
|
+
tp_inst._defaults.minDate=new Date();
|
201
|
+
}
|
202
|
+
if(tp_inst._defaults.maxDate==0 || tp_inst._defaults.maxDateTime==0)
|
203
|
+
{
|
204
|
+
tp_inst._defaults.maxDate=new Date();
|
205
|
+
}
|
206
|
+
|
207
|
+
// datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
|
208
|
+
if(tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date)
|
209
|
+
tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
|
210
|
+
if(tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date)
|
211
|
+
tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
|
212
|
+
if(tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date)
|
213
|
+
tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
|
214
|
+
if(tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date)
|
215
|
+
tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
|
216
|
+
return tp_inst;
|
217
|
+
},
|
218
|
+
|
219
|
+
//########################################################################
|
220
|
+
// add our sliders to the calendar
|
221
|
+
//########################################################################
|
222
|
+
_addTimePicker: function(dp_inst) {
|
223
|
+
var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ?
|
224
|
+
this.$input.val() + ' ' + this.$altInput.val() :
|
225
|
+
this.$input.val();
|
226
|
+
|
227
|
+
this.timeDefined = this._parseTime(currDT);
|
228
|
+
this._limitMinMaxDateTime(dp_inst, false);
|
229
|
+
this._injectTimePicker();
|
230
|
+
},
|
231
|
+
|
232
|
+
//########################################################################
|
233
|
+
// parse the time string from input value or _setTime
|
234
|
+
//########################################################################
|
235
|
+
_parseTime: function(timeString, withDate) {
|
236
|
+
var regstr = this._defaults.timeFormat.toString()
|
237
|
+
.replace(/h{1,2}/ig, '(\\d?\\d)')
|
238
|
+
.replace(/m{1,2}/ig, '(\\d?\\d)')
|
239
|
+
.replace(/s{1,2}/ig, '(\\d?\\d)')
|
240
|
+
.replace(/l{1}/ig, '(\\d?\\d?\\d)')
|
241
|
+
.replace(/t{1,2}/ig, this._getPatternAmpm())
|
242
|
+
.replace(/z{1}/ig, '(z|[-+]\\d\\d:?\\d\\d)?')
|
243
|
+
.replace(/\s/g, '\\s?') + this._defaults.timeSuffix + '$',
|
244
|
+
order = this._getFormatPositions(),
|
245
|
+
ampm = '',
|
246
|
+
treg;
|
247
|
+
|
248
|
+
if (!this.inst) this.inst = $.datepicker._getInst(this.$input[0]);
|
249
|
+
|
250
|
+
if (withDate || !this._defaults.timeOnly) {
|
251
|
+
// the time should come after x number of characters and a space.
|
252
|
+
// x = at least the length of text specified by the date format
|
253
|
+
var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
|
254
|
+
// escape special regex characters in the seperator
|
255
|
+
var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g");
|
256
|
+
regstr = '^.{' + dp_dateFormat.length + ',}?' + this._defaults.separator.replace(specials, "\\$&") + regstr;
|
257
|
+
}
|
258
|
+
|
259
|
+
treg = timeString.match(new RegExp(regstr, 'i'));
|
260
|
+
|
261
|
+
if (treg) {
|
262
|
+
if (order.t !== -1) {
|
263
|
+
if (treg[order.t] === undefined || treg[order.t].length === 0) {
|
264
|
+
ampm = '';
|
265
|
+
this.ampm = '';
|
266
|
+
} else {
|
267
|
+
ampm = $.inArray(treg[order.t].toUpperCase(), this.amNames) !== -1 ? 'AM' : 'PM';
|
268
|
+
this.ampm = this._defaults[ampm == 'AM' ? 'amNames' : 'pmNames'][0];
|
269
|
+
}
|
270
|
+
}
|
271
|
+
|
272
|
+
if (order.h !== -1) {
|
273
|
+
if (ampm == 'AM' && treg[order.h] == '12')
|
274
|
+
this.hour = 0; // 12am = 0 hour
|
275
|
+
else if (ampm == 'PM' && treg[order.h] != '12')
|
276
|
+
this.hour = (parseFloat(treg[order.h]) + 12).toFixed(0); // 12pm = 12 hour, any other pm = hour + 12
|
277
|
+
else this.hour = Number(treg[order.h]);
|
278
|
+
}
|
279
|
+
|
280
|
+
if (order.m !== -1) this.minute = Number(treg[order.m]);
|
281
|
+
if (order.s !== -1) this.second = Number(treg[order.s]);
|
282
|
+
if (order.l !== -1) this.millisec = Number(treg[order.l]);
|
283
|
+
if (order.z !== -1 && treg[order.z] !== undefined) {
|
284
|
+
var tz = treg[order.z].toUpperCase();
|
285
|
+
switch (tz.length) {
|
286
|
+
case 1: // Z
|
287
|
+
tz = this._defaults.timezoneIso8609 ? 'Z' : '+0000';
|
288
|
+
break;
|
289
|
+
case 5: // +hhmm
|
290
|
+
if (this._defaults.timezoneIso8609)
|
291
|
+
tz = tz.substring(1) == '0000'
|
292
|
+
? 'Z'
|
293
|
+
: tz.substring(0, 3) + ':' + tz.substring(3);
|
294
|
+
break;
|
295
|
+
case 6: // +hh:mm
|
296
|
+
if (!this._defaults.timezoneIso8609)
|
297
|
+
tz = tz == 'Z' || tz.substring(1) == '00:00'
|
298
|
+
? '+0000'
|
299
|
+
: tz.replace(/:/, '');
|
300
|
+
else if (tz.substring(1) == '00:00')
|
301
|
+
tz = 'Z';
|
302
|
+
break;
|
303
|
+
}
|
304
|
+
this.timezone = tz;
|
305
|
+
}
|
306
|
+
|
307
|
+
return true;
|
308
|
+
|
309
|
+
}
|
310
|
+
return false;
|
311
|
+
},
|
312
|
+
|
313
|
+
//########################################################################
|
314
|
+
// pattern for standard and localized AM/PM markers
|
315
|
+
//########################################################################
|
316
|
+
_getPatternAmpm: function() {
|
317
|
+
var markers = [],
|
318
|
+
o = this._defaults;
|
319
|
+
if (o.amNames)
|
320
|
+
$.merge(markers, o.amNames);
|
321
|
+
if (o.pmNames)
|
322
|
+
$.merge(markers, o.pmNames);
|
323
|
+
markers = $.map(markers, function(val) { return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&'); });
|
324
|
+
return '(' + markers.join('|') + ')?';
|
325
|
+
},
|
326
|
+
|
327
|
+
//########################################################################
|
328
|
+
// figure out position of time elements.. cause js cant do named captures
|
329
|
+
//########################################################################
|
330
|
+
_getFormatPositions: function() {
|
331
|
+
var finds = this._defaults.timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|t{1,2}|z)/g),
|
332
|
+
orders = { h: -1, m: -1, s: -1, l: -1, t: -1, z: -1 };
|
333
|
+
|
334
|
+
if (finds)
|
335
|
+
for (var i = 0; i < finds.length; i++)
|
336
|
+
if (orders[finds[i].toString().charAt(0)] == -1)
|
337
|
+
orders[finds[i].toString().charAt(0)] = i + 1;
|
338
|
+
|
339
|
+
return orders;
|
340
|
+
},
|
341
|
+
|
342
|
+
//########################################################################
|
343
|
+
// generate and inject html for timepicker into ui datepicker
|
344
|
+
//########################################################################
|
345
|
+
_injectTimePicker: function() {
|
346
|
+
var $dp = this.inst.dpDiv,
|
347
|
+
o = this._defaults,
|
348
|
+
tp_inst = this,
|
349
|
+
// Added by Peter Medeiros:
|
350
|
+
// - Figure out what the hour/minute/second max should be based on the step values.
|
351
|
+
// - Example: if stepMinute is 15, then minMax is 45.
|
352
|
+
hourMax = parseInt((o.hourMax - ((o.hourMax - o.hourMin) % o.stepHour)) ,10),
|
353
|
+
minMax = parseInt((o.minuteMax - ((o.minuteMax - o.minuteMin) % o.stepMinute)) ,10),
|
354
|
+
secMax = parseInt((o.secondMax - ((o.secondMax - o.secondMin) % o.stepSecond)) ,10),
|
355
|
+
millisecMax = parseInt((o.millisecMax - ((o.millisecMax - o.millisecMin) % o.stepMillisec)) ,10),
|
356
|
+
dp_id = this.inst.id.toString().replace(/([^A-Za-z0-9_])/g, '');
|
357
|
+
|
358
|
+
// Prevent displaying twice
|
359
|
+
//if ($dp.find("div#ui-timepicker-div-"+ dp_id).length === 0) {
|
360
|
+
if ($dp.find("div#ui-timepicker-div-"+ dp_id).length === 0 && o.showTimepicker) {
|
361
|
+
var noDisplay = ' style="display:none;"',
|
362
|
+
html = '<div class="ui-timepicker-div" id="ui-timepicker-div-' + dp_id + '"><dl>' +
|
363
|
+
'<dt class="ui_tpicker_time_label" id="ui_tpicker_time_label_' + dp_id + '"' +
|
364
|
+
((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' +
|
365
|
+
'<dd class="ui_tpicker_time" id="ui_tpicker_time_' + dp_id + '"' +
|
366
|
+
((o.showTime) ? '' : noDisplay) + '></dd>' +
|
367
|
+
'<dt class="ui_tpicker_hour_label" id="ui_tpicker_hour_label_' + dp_id + '"' +
|
368
|
+
((o.showHour) ? '' : noDisplay) + '>' + o.hourText + '</dt>',
|
369
|
+
hourGridSize = 0,
|
370
|
+
minuteGridSize = 0,
|
371
|
+
secondGridSize = 0,
|
372
|
+
millisecGridSize = 0,
|
373
|
+
size = null;
|
374
|
+
|
375
|
+
// Hours
|
376
|
+
html += '<dd class="ui_tpicker_hour"><div id="ui_tpicker_hour_' + dp_id + '"' +
|
377
|
+
((o.showHour) ? '' : noDisplay) + '></div>';
|
378
|
+
if (o.showHour && o.hourGrid > 0) {
|
379
|
+
html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
|
380
|
+
|
381
|
+
for (var h = o.hourMin; h <= hourMax; h += parseInt(o.hourGrid,10)) {
|
382
|
+
hourGridSize++;
|
383
|
+
var tmph = (o.ampm && h > 12) ? h-12 : h;
|
384
|
+
if (tmph < 10) tmph = '0' + tmph;
|
385
|
+
if (o.ampm) {
|
386
|
+
if (h == 0) tmph = 12 +'a';
|
387
|
+
else if (h < 12) tmph += 'a';
|
388
|
+
else tmph += 'p';
|
389
|
+
}
|
390
|
+
html += '<td>' + tmph + '</td>';
|
391
|
+
}
|
392
|
+
|
393
|
+
html += '</tr></table></div>';
|
394
|
+
}
|
395
|
+
html += '</dd>';
|
396
|
+
|
397
|
+
// Minutes
|
398
|
+
html += '<dt class="ui_tpicker_minute_label" id="ui_tpicker_minute_label_' + dp_id + '"' +
|
399
|
+
((o.showMinute) ? '' : noDisplay) + '>' + o.minuteText + '</dt>'+
|
400
|
+
'<dd class="ui_tpicker_minute"><div id="ui_tpicker_minute_' + dp_id + '"' +
|
401
|
+
((o.showMinute) ? '' : noDisplay) + '></div>';
|
402
|
+
|
403
|
+
if (o.showMinute && o.minuteGrid > 0) {
|
404
|
+
html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
|
405
|
+
|
406
|
+
for (var m = o.minuteMin; m <= minMax; m += parseInt(o.minuteGrid,10)) {
|
407
|
+
minuteGridSize++;
|
408
|
+
html += '<td>' + ((m < 10) ? '0' : '') + m + '</td>';
|
409
|
+
}
|
410
|
+
|
411
|
+
html += '</tr></table></div>';
|
412
|
+
}
|
413
|
+
html += '</dd>';
|
414
|
+
|
415
|
+
// Seconds
|
416
|
+
html += '<dt class="ui_tpicker_second_label" id="ui_tpicker_second_label_' + dp_id + '"' +
|
417
|
+
((o.showSecond) ? '' : noDisplay) + '>' + o.secondText + '</dt>'+
|
418
|
+
'<dd class="ui_tpicker_second"><div id="ui_tpicker_second_' + dp_id + '"'+
|
419
|
+
((o.showSecond) ? '' : noDisplay) + '></div>';
|
420
|
+
|
421
|
+
if (o.showSecond && o.secondGrid > 0) {
|
422
|
+
html += '<div style="padding-left: 1px"><table><tr>';
|
423
|
+
|
424
|
+
for (var s = o.secondMin; s <= secMax; s += parseInt(o.secondGrid,10)) {
|
425
|
+
secondGridSize++;
|
426
|
+
html += '<td>' + ((s < 10) ? '0' : '') + s + '</td>';
|
427
|
+
}
|
428
|
+
|
429
|
+
html += '</tr></table></div>';
|
430
|
+
}
|
431
|
+
html += '</dd>';
|
432
|
+
|
433
|
+
// Milliseconds
|
434
|
+
html += '<dt class="ui_tpicker_millisec_label" id="ui_tpicker_millisec_label_' + dp_id + '"' +
|
435
|
+
((o.showMillisec) ? '' : noDisplay) + '>' + o.millisecText + '</dt>'+
|
436
|
+
'<dd class="ui_tpicker_millisec"><div id="ui_tpicker_millisec_' + dp_id + '"'+
|
437
|
+
((o.showMillisec) ? '' : noDisplay) + '></div>';
|
438
|
+
|
439
|
+
if (o.showMillisec && o.millisecGrid > 0) {
|
440
|
+
html += '<div style="padding-left: 1px"><table><tr>';
|
441
|
+
|
442
|
+
for (var l = o.millisecMin; l <= millisecMax; l += parseInt(o.millisecGrid,10)) {
|
443
|
+
millisecGridSize++;
|
444
|
+
html += '<td>' + ((l < 10) ? '0' : '') + l + '</td>';
|
445
|
+
}
|
446
|
+
|
447
|
+
html += '</tr></table></div>';
|
448
|
+
}
|
449
|
+
html += '</dd>';
|
450
|
+
|
451
|
+
// Timezone
|
452
|
+
html += '<dt class="ui_tpicker_timezone_label" id="ui_tpicker_timezone_label_' + dp_id + '"' +
|
453
|
+
((o.showTimezone) ? '' : noDisplay) + '>' + o.timezoneText + '</dt>';
|
454
|
+
html += '<dd class="ui_tpicker_timezone" id="ui_tpicker_timezone_' + dp_id + '"' +
|
455
|
+
((o.showTimezone) ? '' : noDisplay) + '></dd>';
|
456
|
+
|
457
|
+
html += '</dl></div>';
|
458
|
+
$tp = $(html);
|
459
|
+
|
460
|
+
// if we only want time picker...
|
461
|
+
if (o.timeOnly === true) {
|
462
|
+
$tp.prepend(
|
463
|
+
'<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' +
|
464
|
+
'<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' +
|
465
|
+
'</div>');
|
466
|
+
$dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
|
467
|
+
}
|
468
|
+
|
469
|
+
this.hour_slider = $tp.find('#ui_tpicker_hour_'+ dp_id).slider({
|
470
|
+
orientation: "horizontal",
|
471
|
+
value: this.hour,
|
472
|
+
min: o.hourMin,
|
473
|
+
max: hourMax,
|
474
|
+
step: o.stepHour,
|
475
|
+
slide: function(event, ui) {
|
476
|
+
tp_inst.hour_slider.slider( "option", "value", ui.value);
|
477
|
+
tp_inst._onTimeChange();
|
478
|
+
}
|
479
|
+
});
|
480
|
+
|
481
|
+
|
482
|
+
// Updated by Peter Medeiros:
|
483
|
+
// - Pass in Event and UI instance into slide function
|
484
|
+
this.minute_slider = $tp.find('#ui_tpicker_minute_'+ dp_id).slider({
|
485
|
+
orientation: "horizontal",
|
486
|
+
value: this.minute,
|
487
|
+
min: o.minuteMin,
|
488
|
+
max: minMax,
|
489
|
+
step: o.stepMinute,
|
490
|
+
slide: function(event, ui) {
|
491
|
+
tp_inst.minute_slider.slider( "option", "value", ui.value);
|
492
|
+
tp_inst._onTimeChange();
|
493
|
+
}
|
494
|
+
});
|
495
|
+
|
496
|
+
this.second_slider = $tp.find('#ui_tpicker_second_'+ dp_id).slider({
|
497
|
+
orientation: "horizontal",
|
498
|
+
value: this.second,
|
499
|
+
min: o.secondMin,
|
500
|
+
max: secMax,
|
501
|
+
step: o.stepSecond,
|
502
|
+
slide: function(event, ui) {
|
503
|
+
tp_inst.second_slider.slider( "option", "value", ui.value);
|
504
|
+
tp_inst._onTimeChange();
|
505
|
+
}
|
506
|
+
});
|
507
|
+
|
508
|
+
this.millisec_slider = $tp.find('#ui_tpicker_millisec_'+ dp_id).slider({
|
509
|
+
orientation: "horizontal",
|
510
|
+
value: this.millisec,
|
511
|
+
min: o.millisecMin,
|
512
|
+
max: millisecMax,
|
513
|
+
step: o.stepMillisec,
|
514
|
+
slide: function(event, ui) {
|
515
|
+
tp_inst.millisec_slider.slider( "option", "value", ui.value);
|
516
|
+
tp_inst._onTimeChange();
|
517
|
+
}
|
518
|
+
});
|
519
|
+
|
520
|
+
this.timezone_select = $tp.find('#ui_tpicker_timezone_'+ dp_id).append('<select></select>').find("select");
|
521
|
+
$.fn.append.apply(this.timezone_select,
|
522
|
+
$.map(o.timezoneList, function(val, idx) {
|
523
|
+
return $("<option />")
|
524
|
+
.val(typeof val == "object" ? val.value : val)
|
525
|
+
.text(typeof val == "object" ? val.label : val);
|
526
|
+
})
|
527
|
+
);
|
528
|
+
this.timezone_select.val((typeof this.timezone != "undefined" && this.timezone != null && this.timezone != "") ? this.timezone : o.timezone);
|
529
|
+
this.timezone_select.change(function() {
|
530
|
+
tp_inst._onTimeChange();
|
531
|
+
});
|
532
|
+
|
533
|
+
// Add grid functionality
|
534
|
+
if (o.showHour && o.hourGrid > 0) {
|
535
|
+
size = 100 * hourGridSize * o.hourGrid / (hourMax - o.hourMin);
|
536
|
+
|
537
|
+
$tp.find(".ui_tpicker_hour table").css({
|
538
|
+
width: size + "%",
|
539
|
+
marginLeft: (size / (-2 * hourGridSize)) + "%",
|
540
|
+
borderCollapse: 'collapse'
|
541
|
+
}).find("td").each( function(index) {
|
542
|
+
$(this).click(function() {
|
543
|
+
var h = $(this).html();
|
544
|
+
if(o.ampm) {
|
545
|
+
var ap = h.substring(2).toLowerCase(),
|
546
|
+
aph = parseInt(h.substring(0,2), 10);
|
547
|
+
if (ap == 'a') {
|
548
|
+
if (aph == 12) h = 0;
|
549
|
+
else h = aph;
|
550
|
+
} else if (aph == 12) h = 12;
|
551
|
+
else h = aph + 12;
|
552
|
+
}
|
553
|
+
tp_inst.hour_slider.slider("option", "value", h);
|
554
|
+
tp_inst._onTimeChange();
|
555
|
+
tp_inst._onSelectHandler();
|
556
|
+
}).css({
|
557
|
+
cursor: 'pointer',
|
558
|
+
width: (100 / hourGridSize) + '%',
|
559
|
+
textAlign: 'center',
|
560
|
+
overflow: 'hidden'
|
561
|
+
});
|
562
|
+
});
|
563
|
+
}
|
564
|
+
|
565
|
+
if (o.showMinute && o.minuteGrid > 0) {
|
566
|
+
size = 100 * minuteGridSize * o.minuteGrid / (minMax - o.minuteMin);
|
567
|
+
$tp.find(".ui_tpicker_minute table").css({
|
568
|
+
width: size + "%",
|
569
|
+
marginLeft: (size / (-2 * minuteGridSize)) + "%",
|
570
|
+
borderCollapse: 'collapse'
|
571
|
+
}).find("td").each(function(index) {
|
572
|
+
$(this).click(function() {
|
573
|
+
tp_inst.minute_slider.slider("option", "value", $(this).html());
|
574
|
+
tp_inst._onTimeChange();
|
575
|
+
tp_inst._onSelectHandler();
|
576
|
+
}).css({
|
577
|
+
cursor: 'pointer',
|
578
|
+
width: (100 / minuteGridSize) + '%',
|
579
|
+
textAlign: 'center',
|
580
|
+
overflow: 'hidden'
|
581
|
+
});
|
582
|
+
});
|
583
|
+
}
|
584
|
+
|
585
|
+
if (o.showSecond && o.secondGrid > 0) {
|
586
|
+
$tp.find(".ui_tpicker_second table").css({
|
587
|
+
width: size + "%",
|
588
|
+
marginLeft: (size / (-2 * secondGridSize)) + "%",
|
589
|
+
borderCollapse: 'collapse'
|
590
|
+
}).find("td").each(function(index) {
|
591
|
+
$(this).click(function() {
|
592
|
+
tp_inst.second_slider.slider("option", "value", $(this).html());
|
593
|
+
tp_inst._onTimeChange();
|
594
|
+
tp_inst._onSelectHandler();
|
595
|
+
}).css({
|
596
|
+
cursor: 'pointer',
|
597
|
+
width: (100 / secondGridSize) + '%',
|
598
|
+
textAlign: 'center',
|
599
|
+
overflow: 'hidden'
|
600
|
+
});
|
601
|
+
});
|
602
|
+
}
|
603
|
+
|
604
|
+
if (o.showMillisec && o.millisecGrid > 0) {
|
605
|
+
$tp.find(".ui_tpicker_millisec table").css({
|
606
|
+
width: size + "%",
|
607
|
+
marginLeft: (size / (-2 * millisecGridSize)) + "%",
|
608
|
+
borderCollapse: 'collapse'
|
609
|
+
}).find("td").each(function(index) {
|
610
|
+
$(this).click(function() {
|
611
|
+
tp_inst.millisec_slider.slider("option", "value", $(this).html());
|
612
|
+
tp_inst._onTimeChange();
|
613
|
+
tp_inst._onSelectHandler();
|
614
|
+
}).css({
|
615
|
+
cursor: 'pointer',
|
616
|
+
width: (100 / millisecGridSize) + '%',
|
617
|
+
textAlign: 'center',
|
618
|
+
overflow: 'hidden'
|
619
|
+
});
|
620
|
+
});
|
621
|
+
}
|
622
|
+
|
623
|
+
var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
|
624
|
+
if ($buttonPanel.length) $buttonPanel.before($tp);
|
625
|
+
else $dp.append($tp);
|
626
|
+
|
627
|
+
this.$timeObj = $tp.find('#ui_tpicker_time_'+ dp_id);
|
628
|
+
|
629
|
+
if (this.inst !== null) {
|
630
|
+
var timeDefined = this.timeDefined;
|
631
|
+
this._onTimeChange();
|
632
|
+
this.timeDefined = timeDefined;
|
633
|
+
}
|
634
|
+
|
635
|
+
//Emulate datepicker onSelect behavior. Call on slidestop.
|
636
|
+
var onSelectDelegate = function() {
|
637
|
+
tp_inst._onSelectHandler();
|
638
|
+
};
|
639
|
+
this.hour_slider.bind('slidestop',onSelectDelegate);
|
640
|
+
this.minute_slider.bind('slidestop',onSelectDelegate);
|
641
|
+
this.second_slider.bind('slidestop',onSelectDelegate);
|
642
|
+
this.millisec_slider.bind('slidestop',onSelectDelegate);
|
643
|
+
|
644
|
+
// slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
|
645
|
+
if (this._defaults.addSliderAccess){
|
646
|
+
var sliderAccessArgs = this._defaults.sliderAccessArgs;
|
647
|
+
setTimeout(function(){ // fix for inline mode
|
648
|
+
if($tp.find('.ui-slider-access').length == 0){
|
649
|
+
$tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
|
650
|
+
|
651
|
+
// fix any grids since sliders are shorter
|
652
|
+
var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
|
653
|
+
if(sliderAccessWidth){
|
654
|
+
$tp.find('table:visible').each(function(){
|
655
|
+
var $g = $(this),
|
656
|
+
oldWidth = $g.outerWidth(),
|
657
|
+
oldMarginLeft = $g.css('marginLeft').toString().replace('%',''),
|
658
|
+
newWidth = oldWidth - sliderAccessWidth,
|
659
|
+
newMarginLeft = ((oldMarginLeft * newWidth)/oldWidth) + '%';
|
660
|
+
|
661
|
+
$g.css({ width: newWidth, marginLeft: newMarginLeft });
|
662
|
+
});
|
663
|
+
}
|
664
|
+
}
|
665
|
+
},0);
|
666
|
+
}
|
667
|
+
// end slideAccess integration
|
668
|
+
|
669
|
+
}
|
670
|
+
},
|
671
|
+
|
672
|
+
//########################################################################
|
673
|
+
// This function tries to limit the ability to go outside the
|
674
|
+
// min/max date range
|
675
|
+
//########################################################################
|
676
|
+
_limitMinMaxDateTime: function(dp_inst, adjustSliders){
|
677
|
+
var o = this._defaults,
|
678
|
+
dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
|
679
|
+
|
680
|
+
if(!this._defaults.showTimepicker) return; // No time so nothing to check here
|
681
|
+
|
682
|
+
if($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date){
|
683
|
+
var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
|
684
|
+
minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
|
685
|
+
|
686
|
+
if(this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null){
|
687
|
+
this.hourMinOriginal = o.hourMin;
|
688
|
+
this.minuteMinOriginal = o.minuteMin;
|
689
|
+
this.secondMinOriginal = o.secondMin;
|
690
|
+
this.millisecMinOriginal = o.millisecMin;
|
691
|
+
}
|
692
|
+
|
693
|
+
if(dp_inst.settings.timeOnly || minDateTimeDate.getTime() == dp_date.getTime()) {
|
694
|
+
this._defaults.hourMin = minDateTime.getHours();
|
695
|
+
if (this.hour <= this._defaults.hourMin) {
|
696
|
+
this.hour = this._defaults.hourMin;
|
697
|
+
this._defaults.minuteMin = minDateTime.getMinutes();
|
698
|
+
if (this.minute <= this._defaults.minuteMin) {
|
699
|
+
this.minute = this._defaults.minuteMin;
|
700
|
+
this._defaults.secondMin = minDateTime.getSeconds();
|
701
|
+
} else if (this.second <= this._defaults.secondMin){
|
702
|
+
this.second = this._defaults.secondMin;
|
703
|
+
this._defaults.millisecMin = minDateTime.getMilliseconds();
|
704
|
+
} else {
|
705
|
+
if(this.millisec < this._defaults.millisecMin)
|
706
|
+
this.millisec = this._defaults.millisecMin;
|
707
|
+
this._defaults.millisecMin = this.millisecMinOriginal;
|
708
|
+
}
|
709
|
+
} else {
|
710
|
+
this._defaults.minuteMin = this.minuteMinOriginal;
|
711
|
+
this._defaults.secondMin = this.secondMinOriginal;
|
712
|
+
this._defaults.millisecMin = this.millisecMinOriginal;
|
713
|
+
}
|
714
|
+
}else{
|
715
|
+
this._defaults.hourMin = this.hourMinOriginal;
|
716
|
+
this._defaults.minuteMin = this.minuteMinOriginal;
|
717
|
+
this._defaults.secondMin = this.secondMinOriginal;
|
718
|
+
this._defaults.millisecMin = this.millisecMinOriginal;
|
719
|
+
}
|
720
|
+
}
|
721
|
+
|
722
|
+
if($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date){
|
723
|
+
var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
|
724
|
+
maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
|
725
|
+
|
726
|
+
if(this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null){
|
727
|
+
this.hourMaxOriginal = o.hourMax;
|
728
|
+
this.minuteMaxOriginal = o.minuteMax;
|
729
|
+
this.secondMaxOriginal = o.secondMax;
|
730
|
+
this.millisecMaxOriginal = o.millisecMax;
|
731
|
+
}
|
732
|
+
|
733
|
+
if(dp_inst.settings.timeOnly || maxDateTimeDate.getTime() == dp_date.getTime()){
|
734
|
+
this._defaults.hourMax = maxDateTime.getHours();
|
735
|
+
if (this.hour >= this._defaults.hourMax) {
|
736
|
+
this.hour = this._defaults.hourMax;
|
737
|
+
this._defaults.minuteMax = maxDateTime.getMinutes();
|
738
|
+
if (this.minute >= this._defaults.minuteMax) {
|
739
|
+
this.minute = this._defaults.minuteMax;
|
740
|
+
this._defaults.secondMax = maxDateTime.getSeconds();
|
741
|
+
} else if (this.second >= this._defaults.secondMax) {
|
742
|
+
this.second = this._defaults.secondMax;
|
743
|
+
this._defaults.millisecMax = maxDateTime.getMilliseconds();
|
744
|
+
} else {
|
745
|
+
if(this.millisec > this._defaults.millisecMax) this.millisec = this._defaults.millisecMax;
|
746
|
+
this._defaults.millisecMax = this.millisecMaxOriginal;
|
747
|
+
}
|
748
|
+
} else {
|
749
|
+
this._defaults.minuteMax = this.minuteMaxOriginal;
|
750
|
+
this._defaults.secondMax = this.secondMaxOriginal;
|
751
|
+
this._defaults.millisecMax = this.millisecMaxOriginal;
|
752
|
+
}
|
753
|
+
}else{
|
754
|
+
this._defaults.hourMax = this.hourMaxOriginal;
|
755
|
+
this._defaults.minuteMax = this.minuteMaxOriginal;
|
756
|
+
this._defaults.secondMax = this.secondMaxOriginal;
|
757
|
+
this._defaults.millisecMax = this.millisecMaxOriginal;
|
758
|
+
}
|
759
|
+
}
|
760
|
+
|
761
|
+
if(adjustSliders !== undefined && adjustSliders === true){
|
762
|
+
var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)) ,10),
|
763
|
+
minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)) ,10),
|
764
|
+
secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)) ,10),
|
765
|
+
millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)) ,10);
|
766
|
+
|
767
|
+
if(this.hour_slider)
|
768
|
+
this.hour_slider.slider("option", { min: this._defaults.hourMin, max: hourMax }).slider('value', this.hour);
|
769
|
+
if(this.minute_slider)
|
770
|
+
this.minute_slider.slider("option", { min: this._defaults.minuteMin, max: minMax }).slider('value', this.minute);
|
771
|
+
if(this.second_slider)
|
772
|
+
this.second_slider.slider("option", { min: this._defaults.secondMin, max: secMax }).slider('value', this.second);
|
773
|
+
if(this.millisec_slider)
|
774
|
+
this.millisec_slider.slider("option", { min: this._defaults.millisecMin, max: millisecMax }).slider('value', this.millisec);
|
775
|
+
}
|
776
|
+
|
777
|
+
},
|
778
|
+
|
779
|
+
|
780
|
+
//########################################################################
|
781
|
+
// when a slider moves, set the internal time...
|
782
|
+
// on time change is also called when the time is updated in the text field
|
783
|
+
//########################################################################
|
784
|
+
_onTimeChange: function() {
|
785
|
+
var hour = (this.hour_slider) ? this.hour_slider.slider('value') : false,
|
786
|
+
minute = (this.minute_slider) ? this.minute_slider.slider('value') : false,
|
787
|
+
second = (this.second_slider) ? this.second_slider.slider('value') : false,
|
788
|
+
millisec = (this.millisec_slider) ? this.millisec_slider.slider('value') : false,
|
789
|
+
timezone = (this.timezone_select) ? this.timezone_select.val() : false,
|
790
|
+
o = this._defaults;
|
791
|
+
|
792
|
+
if (typeof(hour) == 'object') hour = false;
|
793
|
+
if (typeof(minute) == 'object') minute = false;
|
794
|
+
if (typeof(second) == 'object') second = false;
|
795
|
+
if (typeof(millisec) == 'object') millisec = false;
|
796
|
+
if (typeof(timezone) == 'object') timezone = false;
|
797
|
+
|
798
|
+
if (hour !== false) hour = parseInt(hour,10);
|
799
|
+
if (minute !== false) minute = parseInt(minute,10);
|
800
|
+
if (second !== false) second = parseInt(second,10);
|
801
|
+
if (millisec !== false) millisec = parseInt(millisec,10);
|
802
|
+
|
803
|
+
var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
|
804
|
+
|
805
|
+
// If the update was done in the input field, the input field should not be updated.
|
806
|
+
// If the update was done using the sliders, update the input field.
|
807
|
+
var hasChanged = (hour != this.hour || minute != this.minute
|
808
|
+
|| second != this.second || millisec != this.millisec
|
809
|
+
|| (this.ampm.length > 0
|
810
|
+
&& (hour < 12) != ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1))
|
811
|
+
|| timezone != this.timezone);
|
812
|
+
|
813
|
+
if (hasChanged) {
|
814
|
+
|
815
|
+
if (hour !== false)this.hour = hour;
|
816
|
+
if (minute !== false) this.minute = minute;
|
817
|
+
if (second !== false) this.second = second;
|
818
|
+
if (millisec !== false) this.millisec = millisec;
|
819
|
+
if (timezone !== false) this.timezone = timezone;
|
820
|
+
|
821
|
+
if (!this.inst) this.inst = $.datepicker._getInst(this.$input[0]);
|
822
|
+
|
823
|
+
this._limitMinMaxDateTime(this.inst, true);
|
824
|
+
}
|
825
|
+
if (o.ampm) this.ampm = ampm;
|
826
|
+
|
827
|
+
//this._formatTime();
|
828
|
+
this.formattedTime = $.datepicker.formatTime(this._defaults.timeFormat, this, this._defaults);
|
829
|
+
if (this.$timeObj) this.$timeObj.text(this.formattedTime + o.timeSuffix);
|
830
|
+
this.timeDefined = true;
|
831
|
+
if (hasChanged) this._updateDateTime();
|
832
|
+
},
|
833
|
+
|
834
|
+
//########################################################################
|
835
|
+
// call custom onSelect.
|
836
|
+
// bind to sliders slidestop, and grid click.
|
837
|
+
//########################################################################
|
838
|
+
_onSelectHandler: function() {
|
839
|
+
var onSelect = this._defaults.onSelect;
|
840
|
+
var inputEl = this.$input ? this.$input[0] : null;
|
841
|
+
if (onSelect && inputEl) {
|
842
|
+
onSelect.apply(inputEl, [this.formattedDateTime, this]);
|
843
|
+
}
|
844
|
+
},
|
845
|
+
|
846
|
+
//########################################################################
|
847
|
+
// left for any backwards compatibility
|
848
|
+
//########################################################################
|
849
|
+
_formatTime: function(time, format) {
|
850
|
+
time = time || { hour: this.hour, minute: this.minute, second: this.second, millisec: this.millisec, ampm: this.ampm, timezone: this.timezone };
|
851
|
+
var tmptime = (format || this._defaults.timeFormat).toString();
|
852
|
+
|
853
|
+
tmptime = $.datepicker.formatTime(tmptime, time, this._defaults);
|
854
|
+
|
855
|
+
if (arguments.length) return tmptime;
|
856
|
+
else this.formattedTime = tmptime;
|
857
|
+
},
|
858
|
+
|
859
|
+
//########################################################################
|
860
|
+
// update our input with the new date time..
|
861
|
+
//########################################################################
|
862
|
+
_updateDateTime: function(dp_inst) {
|
863
|
+
dp_inst = this.inst || dp_inst;
|
864
|
+
var dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
|
865
|
+
dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
|
866
|
+
formatCfg = $.datepicker._getFormatConfig(dp_inst),
|
867
|
+
timeAvailable = dt !== null && this.timeDefined;
|
868
|
+
this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
|
869
|
+
var formattedDateTime = this.formattedDate;
|
870
|
+
if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0))
|
871
|
+
return;
|
872
|
+
|
873
|
+
if (this._defaults.timeOnly === true) {
|
874
|
+
formattedDateTime = this.formattedTime;
|
875
|
+
} else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
|
876
|
+
formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
|
877
|
+
}
|
878
|
+
|
879
|
+
this.formattedDateTime = formattedDateTime;
|
880
|
+
|
881
|
+
if(!this._defaults.showTimepicker) {
|
882
|
+
this.$input.val(this.formattedDate);
|
883
|
+
} else if (this.$altInput && this._defaults.altFieldTimeOnly === true) {
|
884
|
+
this.$altInput.val(this.formattedTime);
|
885
|
+
this.$input.val(this.formattedDate);
|
886
|
+
} else if(this.$altInput) {
|
887
|
+
this.$altInput.val(formattedDateTime);
|
888
|
+
this.$input.val(formattedDateTime);
|
889
|
+
} else {
|
890
|
+
this.$input.val(formattedDateTime);
|
891
|
+
}
|
892
|
+
|
893
|
+
this.$input.trigger("change");
|
894
|
+
}
|
895
|
+
|
896
|
+
});
|
897
|
+
|
898
|
+
$.fn.extend({
|
899
|
+
//########################################################################
|
900
|
+
// shorthand just to use timepicker..
|
901
|
+
//########################################################################
|
902
|
+
timepicker: function(o) {
|
903
|
+
o = o || {};
|
904
|
+
var tmp_args = arguments;
|
905
|
+
|
906
|
+
if (typeof o == 'object') tmp_args[0] = $.extend(o, { timeOnly: true });
|
907
|
+
|
908
|
+
return $(this).each(function() {
|
909
|
+
$.fn.datetimepicker.apply($(this), tmp_args);
|
910
|
+
});
|
911
|
+
},
|
912
|
+
|
913
|
+
//########################################################################
|
914
|
+
// extend timepicker to datepicker
|
915
|
+
//########################################################################
|
916
|
+
datetimepicker: function(o) {
|
917
|
+
o = o || {};
|
918
|
+
tmp_args = arguments;
|
919
|
+
|
920
|
+
if (typeof(o) == 'string'){
|
921
|
+
if(o == 'getDate')
|
922
|
+
return $.fn.datepicker.apply($(this[0]), tmp_args);
|
923
|
+
else
|
924
|
+
return this.each(function() {
|
925
|
+
var $t = $(this);
|
926
|
+
$t.datepicker.apply($t, tmp_args);
|
927
|
+
});
|
928
|
+
}
|
929
|
+
else
|
930
|
+
return this.each(function() {
|
931
|
+
var $t = $(this);
|
932
|
+
$t.datepicker($.timepicker._newInst($t, o)._defaults);
|
933
|
+
});
|
934
|
+
}
|
935
|
+
});
|
936
|
+
|
937
|
+
//########################################################################
|
938
|
+
// format the time all pretty...
|
939
|
+
// format = string format of the time
|
940
|
+
// time = a {}, not a Date() for timezones
|
941
|
+
// options = essentially the regional[].. amNames, pmNames, ampm
|
942
|
+
//########################################################################
|
943
|
+
$.datepicker.formatTime = function(format, time, options) {
|
944
|
+
options = options || {};
|
945
|
+
options = $.extend($.timepicker._defaults, options);
|
946
|
+
time = $.extend({hour:0, minute:0, second:0, millisec:0, timezone:'+0000'}, time);
|
947
|
+
|
948
|
+
var tmptime = format;
|
949
|
+
var ampmName = options['amNames'][0];
|
950
|
+
|
951
|
+
var hour = parseInt(time.hour, 10);
|
952
|
+
if (options.ampm) {
|
953
|
+
if (hour > 11){
|
954
|
+
ampmName = options['pmNames'][0];
|
955
|
+
if(hour > 12)
|
956
|
+
hour = hour % 12;
|
957
|
+
}
|
958
|
+
if (hour === 0)
|
959
|
+
hour = 12;
|
960
|
+
}
|
961
|
+
tmptime = tmptime.replace(/(?:hh?|mm?|ss?|[tT]{1,2}|[lz])/g, function(match) {
|
962
|
+
switch (match.toLowerCase()) {
|
963
|
+
case 'hh': return ('0' + hour).slice(-2);
|
964
|
+
case 'h': return hour;
|
965
|
+
case 'mm': return ('0' + time.minute).slice(-2);
|
966
|
+
case 'm': return time.minute;
|
967
|
+
case 'ss': return ('0' + time.second).slice(-2);
|
968
|
+
case 's': return time.second;
|
969
|
+
case 'l': return ('00' + time.millisec).slice(-3);
|
970
|
+
case 'z': return time.timezone;
|
971
|
+
case 't': case 'tt':
|
972
|
+
if (options.ampm) {
|
973
|
+
if (match.length == 1)
|
974
|
+
ampmName = ampmName.charAt(0);
|
975
|
+
return match.charAt(0) == 'T' ? ampmName.toUpperCase() : ampmName.toLowerCase();
|
976
|
+
}
|
977
|
+
return '';
|
978
|
+
}
|
979
|
+
});
|
980
|
+
|
981
|
+
tmptime = $.trim(tmptime);
|
982
|
+
return tmptime;
|
983
|
+
};
|
984
|
+
|
985
|
+
//########################################################################
|
986
|
+
// the bad hack :/ override datepicker so it doesnt close on select
|
987
|
+
// inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
|
988
|
+
//########################################################################
|
989
|
+
$.datepicker._base_selectDate = $.datepicker._selectDate;
|
990
|
+
$.datepicker._selectDate = function (id, dateStr) {
|
991
|
+
var inst = this._getInst($(id)[0]),
|
992
|
+
tp_inst = this._get(inst, 'timepicker');
|
993
|
+
|
994
|
+
if (tp_inst) {
|
995
|
+
tp_inst._limitMinMaxDateTime(inst, true);
|
996
|
+
inst.inline = inst.stay_open = true;
|
997
|
+
//This way the onSelect handler called from calendarpicker get the full dateTime
|
998
|
+
this._base_selectDate(id, dateStr);
|
999
|
+
inst.inline = inst.stay_open = false;
|
1000
|
+
this._notifyChange(inst);
|
1001
|
+
this._updateDatepicker(inst);
|
1002
|
+
}
|
1003
|
+
else this._base_selectDate(id, dateStr);
|
1004
|
+
};
|
1005
|
+
|
1006
|
+
//#############################################################################################
|
1007
|
+
// second bad hack :/ override datepicker so it triggers an event when changing the input field
|
1008
|
+
// and does not redraw the datepicker on every selectDate event
|
1009
|
+
//#############################################################################################
|
1010
|
+
$.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
|
1011
|
+
$.datepicker._updateDatepicker = function(inst) {
|
1012
|
+
|
1013
|
+
// don't popup the datepicker if there is another instance already opened
|
1014
|
+
var input = inst.input[0];
|
1015
|
+
if($.datepicker._curInst &&
|
1016
|
+
$.datepicker._curInst != inst &&
|
1017
|
+
$.datepicker._datepickerShowing &&
|
1018
|
+
$.datepicker._lastInput != input) {
|
1019
|
+
return;
|
1020
|
+
}
|
1021
|
+
|
1022
|
+
if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
|
1023
|
+
|
1024
|
+
this._base_updateDatepicker(inst);
|
1025
|
+
|
1026
|
+
// Reload the time control when changing something in the input text field.
|
1027
|
+
var tp_inst = this._get(inst, 'timepicker');
|
1028
|
+
if(tp_inst) tp_inst._addTimePicker(inst);
|
1029
|
+
}
|
1030
|
+
};
|
1031
|
+
|
1032
|
+
//#######################################################################################
|
1033
|
+
// third bad hack :/ override datepicker so it allows spaces and colon in the input field
|
1034
|
+
//#######################################################################################
|
1035
|
+
$.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
|
1036
|
+
$.datepicker._doKeyPress = function(event) {
|
1037
|
+
var inst = $.datepicker._getInst(event.target),
|
1038
|
+
tp_inst = $.datepicker._get(inst, 'timepicker');
|
1039
|
+
|
1040
|
+
if (tp_inst) {
|
1041
|
+
if ($.datepicker._get(inst, 'constrainInput')) {
|
1042
|
+
var ampm = tp_inst._defaults.ampm,
|
1043
|
+
dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
|
1044
|
+
datetimeChars = tp_inst._defaults.timeFormat.toString()
|
1045
|
+
.replace(/[hms]/g, '')
|
1046
|
+
.replace(/TT/g, ampm ? 'APM' : '')
|
1047
|
+
.replace(/Tt/g, ampm ? 'AaPpMm' : '')
|
1048
|
+
.replace(/tT/g, ampm ? 'AaPpMm' : '')
|
1049
|
+
.replace(/T/g, ampm ? 'AP' : '')
|
1050
|
+
.replace(/tt/g, ampm ? 'apm' : '')
|
1051
|
+
.replace(/t/g, ampm ? 'ap' : '') +
|
1052
|
+
" " +
|
1053
|
+
tp_inst._defaults.separator +
|
1054
|
+
tp_inst._defaults.timeSuffix +
|
1055
|
+
(tp_inst._defaults.showTimezone ? tp_inst._defaults.timezoneList.join('') : '') +
|
1056
|
+
(tp_inst._defaults.amNames.join('')) +
|
1057
|
+
(tp_inst._defaults.pmNames.join('')) +
|
1058
|
+
dateChars,
|
1059
|
+
chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
|
1060
|
+
return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
|
1061
|
+
}
|
1062
|
+
}
|
1063
|
+
|
1064
|
+
return $.datepicker._base_doKeyPress(event);
|
1065
|
+
};
|
1066
|
+
|
1067
|
+
//#######################################################################################
|
1068
|
+
// Override key up event to sync manual input changes.
|
1069
|
+
//#######################################################################################
|
1070
|
+
$.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
|
1071
|
+
$.datepicker._doKeyUp = function (event) {
|
1072
|
+
var inst = $.datepicker._getInst(event.target),
|
1073
|
+
tp_inst = $.datepicker._get(inst, 'timepicker');
|
1074
|
+
|
1075
|
+
if (tp_inst) {
|
1076
|
+
if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) {
|
1077
|
+
try {
|
1078
|
+
$.datepicker._updateDatepicker(inst);
|
1079
|
+
}
|
1080
|
+
catch (err) {
|
1081
|
+
$.datepicker.log(err);
|
1082
|
+
}
|
1083
|
+
}
|
1084
|
+
}
|
1085
|
+
|
1086
|
+
return $.datepicker._base_doKeyUp(event);
|
1087
|
+
};
|
1088
|
+
|
1089
|
+
//#######################################################################################
|
1090
|
+
// override "Today" button to also grab the time.
|
1091
|
+
//#######################################################################################
|
1092
|
+
$.datepicker._base_gotoToday = $.datepicker._gotoToday;
|
1093
|
+
$.datepicker._gotoToday = function(id) {
|
1094
|
+
var inst = this._getInst($(id)[0]),
|
1095
|
+
$dp = inst.dpDiv;
|
1096
|
+
this._base_gotoToday(id);
|
1097
|
+
var now = new Date();
|
1098
|
+
var tp_inst = this._get(inst, 'timepicker');
|
1099
|
+
if (tp_inst && tp_inst._defaults.showTimezone && tp_inst.timezone_select) {
|
1100
|
+
var tzoffset = now.getTimezoneOffset(); // If +0100, returns -60
|
1101
|
+
var tzsign = tzoffset > 0 ? '-' : '+';
|
1102
|
+
tzoffset = Math.abs(tzoffset);
|
1103
|
+
var tzmin = tzoffset % 60;
|
1104
|
+
tzoffset = tzsign + ('0' + (tzoffset - tzmin) / 60).slice(-2) + ('0' + tzmin).slice(-2);
|
1105
|
+
if (tp_inst._defaults.timezoneIso8609)
|
1106
|
+
tzoffset = tzoffset.substring(0, 3) + ':' + tzoffset.substring(3);
|
1107
|
+
tp_inst.timezone_select.val(tzoffset);
|
1108
|
+
}
|
1109
|
+
this._setTime(inst, now);
|
1110
|
+
$( '.ui-datepicker-today', $dp).click();
|
1111
|
+
};
|
1112
|
+
|
1113
|
+
//#######################################################################################
|
1114
|
+
// Disable & enable the Time in the datetimepicker
|
1115
|
+
//#######################################################################################
|
1116
|
+
$.datepicker._disableTimepickerDatepicker = function(target, date, withDate) {
|
1117
|
+
var inst = this._getInst(target),
|
1118
|
+
tp_inst = this._get(inst, 'timepicker');
|
1119
|
+
$(target).datepicker('getDate'); // Init selected[Year|Month|Day]
|
1120
|
+
if (tp_inst) {
|
1121
|
+
tp_inst._defaults.showTimepicker = false;
|
1122
|
+
tp_inst._updateDateTime(inst);
|
1123
|
+
}
|
1124
|
+
};
|
1125
|
+
|
1126
|
+
$.datepicker._enableTimepickerDatepicker = function(target, date, withDate) {
|
1127
|
+
var inst = this._getInst(target),
|
1128
|
+
tp_inst = this._get(inst, 'timepicker');
|
1129
|
+
$(target).datepicker('getDate'); // Init selected[Year|Month|Day]
|
1130
|
+
if (tp_inst) {
|
1131
|
+
tp_inst._defaults.showTimepicker = true;
|
1132
|
+
tp_inst._addTimePicker(inst); // Could be disabled on page load
|
1133
|
+
tp_inst._updateDateTime(inst);
|
1134
|
+
}
|
1135
|
+
};
|
1136
|
+
|
1137
|
+
//#######################################################################################
|
1138
|
+
// Create our own set time function
|
1139
|
+
//#######################################################################################
|
1140
|
+
$.datepicker._setTime = function(inst, date) {
|
1141
|
+
var tp_inst = this._get(inst, 'timepicker');
|
1142
|
+
if (tp_inst) {
|
1143
|
+
var defaults = tp_inst._defaults,
|
1144
|
+
// calling _setTime with no date sets time to defaults
|
1145
|
+
hour = date ? date.getHours() : defaults.hour,
|
1146
|
+
minute = date ? date.getMinutes() : defaults.minute,
|
1147
|
+
second = date ? date.getSeconds() : defaults.second,
|
1148
|
+
millisec = date ? date.getMilliseconds() : defaults.millisec;
|
1149
|
+
|
1150
|
+
//check if within min/max times..
|
1151
|
+
if ((hour < defaults.hourMin || hour > defaults.hourMax) || (minute < defaults.minuteMin || minute > defaults.minuteMax) || (second < defaults.secondMin || second > defaults.secondMax) || (millisec < defaults.millisecMin || millisec > defaults.millisecMax)) {
|
1152
|
+
hour = defaults.hourMin;
|
1153
|
+
minute = defaults.minuteMin;
|
1154
|
+
second = defaults.secondMin;
|
1155
|
+
millisec = defaults.millisecMin;
|
1156
|
+
}
|
1157
|
+
|
1158
|
+
tp_inst.hour = hour;
|
1159
|
+
tp_inst.minute = minute;
|
1160
|
+
tp_inst.second = second;
|
1161
|
+
tp_inst.millisec = millisec;
|
1162
|
+
|
1163
|
+
if (tp_inst.hour_slider) tp_inst.hour_slider.slider('value', hour);
|
1164
|
+
if (tp_inst.minute_slider) tp_inst.minute_slider.slider('value', minute);
|
1165
|
+
if (tp_inst.second_slider) tp_inst.second_slider.slider('value', second);
|
1166
|
+
if (tp_inst.millisec_slider) tp_inst.millisec_slider.slider('value', millisec);
|
1167
|
+
|
1168
|
+
tp_inst._onTimeChange();
|
1169
|
+
tp_inst._updateDateTime(inst);
|
1170
|
+
}
|
1171
|
+
};
|
1172
|
+
|
1173
|
+
//#######################################################################################
|
1174
|
+
// Create new public method to set only time, callable as $().datepicker('setTime', date)
|
1175
|
+
//#######################################################################################
|
1176
|
+
$.datepicker._setTimeDatepicker = function(target, date, withDate) {
|
1177
|
+
var inst = this._getInst(target),
|
1178
|
+
tp_inst = this._get(inst, 'timepicker');
|
1179
|
+
|
1180
|
+
if (tp_inst) {
|
1181
|
+
this._setDateFromField(inst);
|
1182
|
+
var tp_date;
|
1183
|
+
if (date) {
|
1184
|
+
if (typeof date == "string") {
|
1185
|
+
tp_inst._parseTime(date, withDate);
|
1186
|
+
tp_date = new Date();
|
1187
|
+
tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
|
1188
|
+
}
|
1189
|
+
else tp_date = new Date(date.getTime());
|
1190
|
+
if (tp_date.toString() == 'Invalid Date') tp_date = undefined;
|
1191
|
+
this._setTime(inst, tp_date);
|
1192
|
+
}
|
1193
|
+
}
|
1194
|
+
|
1195
|
+
};
|
1196
|
+
|
1197
|
+
//#######################################################################################
|
1198
|
+
// override setDate() to allow setting time too within Date object
|
1199
|
+
//#######################################################################################
|
1200
|
+
$.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
|
1201
|
+
$.datepicker._setDateDatepicker = function(target, date) {
|
1202
|
+
var inst = this._getInst(target),
|
1203
|
+
tp_date = (date instanceof Date) ? new Date(date.getTime()) : date;
|
1204
|
+
|
1205
|
+
this._updateDatepicker(inst);
|
1206
|
+
this._base_setDateDatepicker.apply(this, arguments);
|
1207
|
+
this._setTimeDatepicker(target, tp_date, true);
|
1208
|
+
};
|
1209
|
+
|
1210
|
+
//#######################################################################################
|
1211
|
+
// override getDate() to allow getting time too within Date object
|
1212
|
+
//#######################################################################################
|
1213
|
+
$.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
|
1214
|
+
$.datepicker._getDateDatepicker = function(target, noDefault) {
|
1215
|
+
var inst = this._getInst(target),
|
1216
|
+
tp_inst = this._get(inst, 'timepicker');
|
1217
|
+
|
1218
|
+
if (tp_inst) {
|
1219
|
+
this._setDateFromField(inst, noDefault);
|
1220
|
+
var date = this._getDate(inst);
|
1221
|
+
if (date && tp_inst._parseTime($(target).val(), tp_inst.timeOnly)) date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
|
1222
|
+
return date;
|
1223
|
+
}
|
1224
|
+
return this._base_getDateDatepicker(target, noDefault);
|
1225
|
+
};
|
1226
|
+
|
1227
|
+
//#######################################################################################
|
1228
|
+
// override parseDate() because UI 1.8.14 throws an error about "Extra characters"
|
1229
|
+
// An option in datapicker to ignore extra format characters would be nicer.
|
1230
|
+
//#######################################################################################
|
1231
|
+
$.datepicker._base_parseDate = $.datepicker.parseDate;
|
1232
|
+
$.datepicker.parseDate = function(format, value, settings) {
|
1233
|
+
var date;
|
1234
|
+
try {
|
1235
|
+
date = this._base_parseDate(format, value, settings);
|
1236
|
+
} catch (err) {
|
1237
|
+
if (err.indexOf(":") >= 0) {
|
1238
|
+
// Hack! The error message ends with a colon, a space, and
|
1239
|
+
// the "extra" characters. We rely on that instead of
|
1240
|
+
// attempting to perfectly reproduce the parsing algorithm.
|
1241
|
+
date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings);
|
1242
|
+
} else {
|
1243
|
+
// The underlying error was not related to the time
|
1244
|
+
throw err;
|
1245
|
+
}
|
1246
|
+
}
|
1247
|
+
return date;
|
1248
|
+
};
|
1249
|
+
|
1250
|
+
//#######################################################################################
|
1251
|
+
// override formatDate to set date with time to the input
|
1252
|
+
//#######################################################################################
|
1253
|
+
$.datepicker._base_formatDate = $.datepicker._formatDate;
|
1254
|
+
$.datepicker._formatDate = function(inst, day, month, year){
|
1255
|
+
var tp_inst = this._get(inst, 'timepicker');
|
1256
|
+
if(tp_inst) {
|
1257
|
+
tp_inst._updateDateTime(inst);
|
1258
|
+
return tp_inst.$input.val();
|
1259
|
+
}
|
1260
|
+
return this._base_formatDate(inst);
|
1261
|
+
};
|
1262
|
+
|
1263
|
+
//#######################################################################################
|
1264
|
+
// override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
|
1265
|
+
//#######################################################################################
|
1266
|
+
$.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
|
1267
|
+
$.datepicker._optionDatepicker = function(target, name, value) {
|
1268
|
+
var inst = this._getInst(target),
|
1269
|
+
tp_inst = this._get(inst, 'timepicker');
|
1270
|
+
if (tp_inst) {
|
1271
|
+
var min = null, max = null, onselect = null;
|
1272
|
+
if (typeof name == 'string') { // if min/max was set with the string
|
1273
|
+
if (name === 'minDate' || name === 'minDateTime' )
|
1274
|
+
min = value;
|
1275
|
+
else if (name === 'maxDate' || name === 'maxDateTime')
|
1276
|
+
max = value;
|
1277
|
+
else if (name === 'onSelect')
|
1278
|
+
onselect = value;
|
1279
|
+
} else if (typeof name == 'object') { //if min/max was set with the JSON
|
1280
|
+
if (name.minDate)
|
1281
|
+
min = name.minDate;
|
1282
|
+
else if (name.minDateTime)
|
1283
|
+
min = name.minDateTime;
|
1284
|
+
else if (name.maxDate)
|
1285
|
+
max = name.maxDate;
|
1286
|
+
else if (name.maxDateTime)
|
1287
|
+
max = name.maxDateTime;
|
1288
|
+
}
|
1289
|
+
if(min) { //if min was set
|
1290
|
+
if (min == 0)
|
1291
|
+
min = new Date();
|
1292
|
+
else
|
1293
|
+
min = new Date(min);
|
1294
|
+
|
1295
|
+
tp_inst._defaults.minDate = min;
|
1296
|
+
tp_inst._defaults.minDateTime = min;
|
1297
|
+
} else if (max) { //if max was set
|
1298
|
+
if(max==0)
|
1299
|
+
max=new Date();
|
1300
|
+
else
|
1301
|
+
max= new Date(max);
|
1302
|
+
tp_inst._defaults.maxDate = max;
|
1303
|
+
tp_inst._defaults.maxDateTime = max;
|
1304
|
+
} else if (onselect)
|
1305
|
+
tp_inst._defaults.onSelect = onselect;
|
1306
|
+
}
|
1307
|
+
if (value === undefined)
|
1308
|
+
return this._base_optionDatepicker(target, name);
|
1309
|
+
return this._base_optionDatepicker(target, name, value);
|
1310
|
+
};
|
1311
|
+
|
1312
|
+
//#######################################################################################
|
1313
|
+
// jQuery extend now ignores nulls!
|
1314
|
+
//#######################################################################################
|
1315
|
+
function extendRemove(target, props) {
|
1316
|
+
$.extend(target, props);
|
1317
|
+
for (var name in props)
|
1318
|
+
if (props[name] === null || props[name] === undefined)
|
1319
|
+
target[name] = props[name];
|
1320
|
+
return target;
|
1321
|
+
};
|
1322
|
+
|
1323
|
+
$.timepicker = new Timepicker(); // singleton instance
|
1324
|
+
$.timepicker.version = "1.0.0";
|
1325
|
+
|
1326
|
+
})(jQuery);
|