Permalink
Browse files

Updated contributers list.

  • Loading branch information...
1 parent d5adea8 commit 1e1c37e99468471d1f41e128465585f9da023147 @jonthornton committed Mar 13, 2012
Showing with 10 additions and 6 deletions.
  1. +1 −1 README.md
  2. +7 −3 index.html
  3. +1 −1 jquery.timepicker.css
  4. +1 −1 jquery.timepicker.min.js
View
2 README.md
@@ -12,4 +12,4 @@ jQuery v1.6 or higher is required. There are known issues with jQuery 1.5.
- - -
-This software is made available under the open source MIT License. © 2011 [Jon Thornton](http://www.jonthornton.com), contributions from [Anthony Fojas](https://github.com/fojas)
+This software is made available under the open source MIT License. © 2012 [Jon Thornton](http://www.jonthornton.com), contributions from [Anthony Fojas](https://github.com/fojas), [Vince Mi](https://github.com/vinc3m1), [Nikita Korotaev](https://github.com/websirnik), [Spoon88](https://github.com/Spoon88), [elarkin](https://github.com/elarkin)
View
10 index.html
@@ -5,6 +5,7 @@
<meta charset='utf-8'>
<title>Timepicker for jQuery</title>
+ <meta name="description" content="A jQuery timepicker plugin inspired by Google Calendar." />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.timepicker.js"></script>
@@ -33,14 +34,14 @@
.code { font-family: Consolas, Monaco, "Courier New", Courier; background: #fff; color: #888; }
#container { margin: 0 auto; width: 700px; }
- h1 { font-size: 3.8em; color: #000; margin: 0 0 3px 0; }
+ h1 { font-size: 3.8em; color: #000; margin: 0 0 35px 0; }
h1 .small { font-size: 0.4em; }
h1 a { text-decoration: none }
h2 { font-size: 1.5em; color: #000; }
.byline { font-size: 1.5em; font-weight: bold; margin: 20px 0 0 0; }
.byline a { text-decoration: none; }
.description { font-size: 1.2em; margin: 20px 0 40px 0; font-style: italic;}
- #download { float: right; padding-top: 20px; }
+ #download { float: right; padding-top: 35px; }
pre { background: #000; color: #fff; padding: 15px;}
hr { border: 0; width: 80%; border-bottom: 1px solid #aaa}
.footer { text-align:center; padding-top:30px; font-style: italic; }
@@ -281,7 +282,10 @@
</div>
<div class="footer">
- &copy; 2011 <a href="http://jonthornton.com">Jon Thornton</a>
+ &copy; 2012 <a href="http://jonthornton.com">Jon Thornton</a>, contributions from
+ <a href="https://github.com/fojas">Anthony Fojas</a>, <a href="https://github.com/vinc3m1">Vince Mi</a>,
+ <a href="https://github.com/websirnik">Nikita Korotaev</a>, <a href="https://github.com/Spoon88">Spoon88</a>,
+ <a href="https://github.com/elarkin">elarkin</a>
</div>
</div>
View
2 jquery.timepicker.css
@@ -1,4 +1,4 @@
-.ui-timepicker-list { overflow-y: auto; height: 150px; width: 6.5em; background: #fff; border: 1px solid #ddd; margin: 0; padding: 0; }
+.ui-timepicker-list { overflow-y: auto; height: 150px; width: 6.5em; background: #fff; border: 1px solid #ddd; margin: 0; padding: 0; list-style: none; }
.ui-timepicker-list.ui-timepicker-with-duration { width: 11em; }
.ui-timepicker-duration { margin-left: 5px; color: #888; }
.ui-timepicker-list:hover .ui-timepicker-duration { color: #888; }
View
2 jquery.timepicker.min.js
@@ -1 +1 @@
-(function(e){var m=new Date().getTimezoneOffset();var b=86400;var d={className:null,minTime:null,maxTime:null,durationTime:null,step:30,showDuration:false,timeFormat:"g:ia",scrollDefaultNow:false,onSelect:function(){}};var c={init:function(n){return this.each(function(){var r=e(this);if(r[0].tagName=="SELECT"){var q=e("<input />");var s={type:"text",value:r.val()};var o=r[0].attributes;for(var t=0;t<o.length;t++){s[o[t].nodeName]=o[t].nodeValue}q.attr(s);r.replaceWith(q);r=q}var u=e.extend({},d);if(n){u=e.extend(u,n)}if(u.minTime){u.minTime=f(u.minTime)}if(u.maxTime){u.maxTime=f(u.maxTime)}if(u.durationTime){u.durationTime=f(u.durationTime)}r.data("settings",u);r.attr("autocomplete","off");r.click(c.show).focus(c.show).keydown(a);r.addClass("ui-timepicker-input");if(r.val()){var v=g(f(r.val()),u.timeFormat);r.val(v)}var p=e('<span class="ui-timepicker-container" />');r.wrap(p);e("body").attr("tabindex",-1).focusin(function(w){if(e(w.target).closest(".ui-timepicker-container").length==0){c.hide()}})})},show:function(t){var n=e(this);var s=n.siblings(".ui-timepicker-list");if(n.hasClass("ui-timepicker-hideme")){n.removeClass("ui-timepicker-hideme");s.hide();return}if(s.is(":visible")){return}c.hide();if(s.length==0){h(n);s=n.siblings(".ui-timepicker-list")}if((n.offset().top+n.outerHeight(true)+s.outerHeight())>e(window).height()+e(window).scrollTop()){s.css({top:n.position().top-s.outerHeight()})}else{s.css({top:n.position().top+n.outerHeight(true)})}s.show();var q=n.data("settings");var p=s.find(".ui-timepicker-selected");if(!p.length&&q.minTime===null&&q.scrollDefaultNow){var r=f(new Date());p=j(n,s,r)}if(p&&p.length){var o=s.scrollTop()+p.position().top-p.outerHeight();s.scrollTop(o)}else{s.scrollTop(0)}},hide:function(n){e(".ui-timepicker-list:visible").each(function(){var p=e(this);var o=p.siblings(".ui-timepicker-input");k(o);p.hide()})},option:function(o,r){var n=e(this);var p=n.data("settings");var q=n.siblings(".ui-timepicker-list");if(typeof o=="object"){p=e.extend(p,o)}else{if(typeof o=="string"&&typeof r!="undefined"){p[o]=r}else{if(typeof o=="string"){return p[o]}}}if(p.minTime){p.minTime=f(p.minTime)}if(p.maxTime){p.maxTime=f(p.maxTime)}if(p.durationTime){p.durationTime=f(p.durationTime)}n.data("settings",p);q.remove()},getSecondsFromMidnight:function(){return f(e(this).val())},setTime:function(o){var n=e(this);var p=g(f(o),n.data("settings").timeFormat);n.val(p)}};function h(w){var o=w.data("settings");var t=w.siblings(".ui-timepicker-list");if(t&&t.length){t.remove()}t=e("<ul />");t.attr("tabindex",-1);t.addClass("ui-timepicker-list");if(o.className){t.addClass(o.className)}var u=w.css("zIndex");u=(u+0==u)?u+1:2;t.css({display:"none",position:"absolute",left:(w.position().left),zIndex:u});if(o.minTime!==null&&o.showDuration){t.addClass("ui-timepicker-with-duration")}var s=(o.durationTime!==null)?o.durationTime:o.minTime;var n=(o.minTime!==null)?o.minTime:0;var q=(o.maxTime!==null)?o.maxTime:(n+b-1);if(q<=n){q+=b}for(var r=n;r<=q;r+=o.step*60){var v=r%b;var x=e("<li />");x.data("time",v);x.text(g(v,o.timeFormat));if(o.minTime!==null&&o.showDuration){var p=e("<span />");p.addClass("ui-timepicker-duration");p.text(" ("+i(r-s)+")");x.append(p)}t.append(x)}w.after(t);l(w,t);t.delegate("li","click",{timepicker:w},function(y){w.addClass("ui-timepicker-hideme");w[0].focus();t.find("li").removeClass("ui-timepicker-selected");e(this).addClass("ui-timepicker-selected");k(w);t.hide()})}function j(n,r,q){if(!q&&q!==0){return false}var p=n.data("settings");var o=false;r.find("li").each(function(s,u){var t=e(u);if(Math.abs(t.data("time")-q)<=p.step*30){o=t;return false}});return o}function l(n,q){var p=f(n.val());var o=j(n,q,p);if(o){o.addClass("ui-timepicker-selected")}}function a(q){var n=e(this);var p=n.siblings(".ui-timepicker-list");if(!p.is(":visible")){if(q.keyCode==40){n.focus()}else{return true}}switch(q.keyCode){case 13:k(n);c.hide.apply(this);q.preventDefault();return false;break;case 38:var o=p.find(".ui-timepicker-selected");if(!o.length){var o;p.children().each(function(r,s){if(e(s).position().top>0){o=e(s);return false}});o.addClass("ui-timepicker-selected")}else{if(!o.is(":first-child")){o.removeClass("ui-timepicker-selected");o.prev().addClass("ui-timepicker-selected");if(o.prev().position().top<o.outerHeight()){p.scrollTop(p.scrollTop()-o.outerHeight())}}}break;case 40:var o=p.find(".ui-timepicker-selected");if(o.length==0){var o;p.children().each(function(r,s){if(e(s).position().top>0){o=e(s);return false}});o.addClass("ui-timepicker-selected")}else{if(!o.is(":last-child")){o.removeClass("ui-timepicker-selected");o.next().addClass("ui-timepicker-selected");if(o.next().position().top+2*o.outerHeight()>p.outerHeight()){p.scrollTop(p.scrollTop()+o.outerHeight())}}}break;case 27:p.find("li").removeClass("ui-timepicker-selected");p.hide();break;case 9:case 16:case 17:case 18:case 19:case 20:case 33:case 34:case 35:case 36:case 37:case 39:case 45:return;default:p.find("li").removeClass("ui-timepicker-selected");return}}function k(n){var q=n.data("settings");var r=n.siblings(".ui-timepicker-list");var p=null;var s=r.find(".ui-timepicker-selected");if(s.length){var p=s.data("time")}else{if(n.val()){var p=f(n.val());l(n,r)}}if(p!==null){var o=g(p,q.timeFormat);n.attr("value",o)}q.onSelect.call(n);n.trigger("change")}function i(p){var o=Math.round(p/60);if(o<60){return o+" mins"}else{if(o==60){return"1 hr"}else{var n=o/60;return n.toFixed(1)+" hrs"}}}function g(u,t){var s=new Date((u+m*60)*1000);var o="";for(var q=0;q<t.length;q++){var r=t.charAt(q);switch(r){case"a":o+=(s.getHours()>11)?"pm":"am";break;case"A":o+=(s.getHours()>11)?"PM":"AM";break;case"g":var n=s.getHours()%12;o+=(n==0)?"12":n;break;case"G":o+=s.getHours();break;case"h":var n=s.getHours()%12;if(n!=0&&n<10){n="0"+n}o+=(n==0)?"12":n;break;case"H":var n=s.getHours();o+=(n>9)?n:"0"+n;break;case"i":var p=s.getMinutes();o+=(p>9)?p:"0"+p;break;case"s":var u=s.getSeconds();o+=(u>9)?u:"0"+u;break;default:o+=r}}return o}function f(q){if(q==""){return null}if(q+0==q){return q}if(typeof(q)=="object"){q=q.getHours()+":"+q.getMinutes()}var s=new Date(0);var r=q.toLowerCase().match(/(\d+)(?::(\d\d))?\s*([pa]?)/);if(!r){return null}var o=parseInt(r[1]*1);if(r[3]){if(o==12){var n=(r[3]=="p")?12:0}else{var n=(o+(r[3]=="p"?12:0))}}else{var n=o}var p=(r[2]*1||0);return n*3600+p*60}e.fn.timepicker=function(n){if(c[n]){return c[n].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof n==="object"||!n){return c.init.apply(this,arguments)}else{e.error("Method "+n+" does not exist on jQuery.timepicker")}}}})(jQuery);
+(function(f){var d=new Date();d.setHours(0);d.setMinutes(0);var b=86400;var e={className:null,minTime:null,maxTime:null,durationTime:null,step:30,showDuration:false,timeFormat:"g:ia",scrollDefaultNow:false,onSelect:function(){}};var c={init:function(n){return this.each(function(){var r=f(this);if(r[0].tagName=="SELECT"){var q=f("<input />");var s={type:"text",value:r.val()};var o=r[0].attributes;for(var t=0;t<o.length;t++){s[o[t].nodeName]=o[t].nodeValue}q.attr(s);r.replaceWith(q);r=q}var u=f.extend({},e);if(n){u=f.extend(u,n)}if(u.minTime){u.minTime=g(u.minTime)}if(u.maxTime){u.maxTime=g(u.maxTime)}if(u.durationTime){u.durationTime=g(u.durationTime)}r.data("settings",u);r.attr("autocomplete","off");r.click(c.show).focus(c.show).keydown(a);r.addClass("ui-timepicker-input");if(r.val()){var v=h(g(r.val()),u.timeFormat);r.val(v)}var p=f('<span class="ui-timepicker-container" />');r.wrap(p);f("body").attr("tabindex",-1).focusin(function(w){if(f(w.target).closest(".ui-timepicker-container").length==0){c.hide()}})})},show:function(t){var n=f(this);var s=n.siblings(".ui-timepicker-list");if(n.hasClass("ui-timepicker-hideme")){n.removeClass("ui-timepicker-hideme");s.hide();return}if(s.is(":visible")){return}c.hide();if(s.length==0){i(n);s=n.siblings(".ui-timepicker-list")}if((n.offset().top+n.outerHeight(true)+s.outerHeight())>f(window).height()+f(window).scrollTop()){s.css({top:n.position().top-s.outerHeight()})}else{s.css({top:n.position().top+n.outerHeight(true)})}s.show();var q=n.data("settings");var p=s.find(".ui-timepicker-selected");if(!p.length&&q.minTime===null&&q.scrollDefaultNow){var r=g(new Date());p=k(n,s,r)}if(p&&p.length){var o=s.scrollTop()+p.position().top-p.outerHeight();s.scrollTop(o)}else{s.scrollTop(0)}},hide:function(n){f(".ui-timepicker-list:visible").each(function(){var p=f(this);var o=p.siblings(".ui-timepicker-input");l(o);p.hide()})},option:function(o,r){var n=f(this);var p=n.data("settings");var q=n.siblings(".ui-timepicker-list");if(typeof o=="object"){p=f.extend(p,o)}else{if(typeof o=="string"&&typeof r!="undefined"){p[o]=r}else{if(typeof o=="string"){return p[o]}}}if(p.minTime){p.minTime=g(p.minTime)}if(p.maxTime){p.maxTime=g(p.maxTime)}if(p.durationTime){p.durationTime=g(p.durationTime)}n.data("settings",p);q.remove()},getSecondsFromMidnight:function(){return g(f(this).val())},setTime:function(o){var n=f(this);var p=h(g(o),n.data("settings").timeFormat);n.val(p)}};function i(w){var o=w.data("settings");var t=w.siblings(".ui-timepicker-list");if(t&&t.length){t.remove()}t=f("<ul />");t.attr("tabindex",-1);t.addClass("ui-timepicker-list");if(o.className){t.addClass(o.className)}var u=w.css("zIndex");u=(u+0==u)?u+1:2;t.css({display:"none",position:"absolute",left:(w.position().left),zIndex:u});if(o.minTime!==null&&o.showDuration){t.addClass("ui-timepicker-with-duration")}var s=(o.durationTime!==null)?o.durationTime:o.minTime;var n=(o.minTime!==null)?o.minTime:0;var q=(o.maxTime!==null)?o.maxTime:(n+b-1);if(q<=n){q+=b}for(var r=n;r<=q;r+=o.step*60){var v=r%b;var x=f("<li />");x.data("time",v);x.text(h(v,o.timeFormat));if(o.minTime!==null&&o.showDuration){var p=f("<span />");p.addClass("ui-timepicker-duration");p.text(" ("+j(r-s)+")");x.append(p)}t.append(x)}w.after(t);m(w,t);t.delegate("li","click",{timepicker:w},function(y){w.addClass("ui-timepicker-hideme");w[0].focus();t.find("li").removeClass("ui-timepicker-selected");f(this).addClass("ui-timepicker-selected");l(w);t.hide()})}function k(n,r,q){if(!q&&q!==0){return false}var p=n.data("settings");var o=false;r.find("li").each(function(s,u){var t=f(u);if(Math.abs(t.data("time")-q)<=p.step*30){o=t;return false}});return o}function m(n,q){var p=g(n.val());var o=k(n,q,p);if(o){o.addClass("ui-timepicker-selected")}}function a(q){var n=f(this);var p=n.siblings(".ui-timepicker-list");if(!p.is(":visible")){if(q.keyCode==40){n.focus()}else{return true}}switch(q.keyCode){case 13:l(n);c.hide.apply(this);q.preventDefault();return false;break;case 38:var o=p.find(".ui-timepicker-selected");if(!o.length){var o;p.children().each(function(r,s){if(f(s).position().top>0){o=f(s);return false}});o.addClass("ui-timepicker-selected")}else{if(!o.is(":first-child")){o.removeClass("ui-timepicker-selected");o.prev().addClass("ui-timepicker-selected");if(o.prev().position().top<o.outerHeight()){p.scrollTop(p.scrollTop()-o.outerHeight())}}}break;case 40:var o=p.find(".ui-timepicker-selected");if(o.length==0){var o;p.children().each(function(r,s){if(f(s).position().top>0){o=f(s);return false}});o.addClass("ui-timepicker-selected")}else{if(!o.is(":last-child")){o.removeClass("ui-timepicker-selected");o.next().addClass("ui-timepicker-selected");if(o.next().position().top+2*o.outerHeight()>p.outerHeight()){p.scrollTop(p.scrollTop()+o.outerHeight())}}}break;case 27:p.find("li").removeClass("ui-timepicker-selected");p.hide();break;case 9:case 16:case 17:case 18:case 19:case 20:case 33:case 34:case 35:case 36:case 37:case 39:case 45:return;default:p.find("li").removeClass("ui-timepicker-selected");return}}function l(n){var q=n.data("settings");var r=n.siblings(".ui-timepicker-list");var p=null;var s=r.find(".ui-timepicker-selected");if(s.length){var p=s.data("time")}else{if(n.val()){var p=g(n.val());m(n,r)}}if(p!==null){var o=h(p,q.timeFormat);n.attr("value",o)}q.onSelect.call(n);n.trigger("change")}function j(p){var o=Math.round(p/60);if(o<60){return o+" mins"}else{if(o==60){return"1 hr"}else{var n=o/60;return n.toFixed(1)+" hrs"}}}function h(u,t){var s=new Date(d.valueOf()+(u*1000));var o="";for(var q=0;q<t.length;q++){var r=t.charAt(q);switch(r){case"a":o+=(s.getHours()>11)?"pm":"am";break;case"A":o+=(s.getHours()>11)?"PM":"AM";break;case"g":var n=s.getHours()%12;o+=(n==0)?"12":n;break;case"G":o+=s.getHours();break;case"h":var n=s.getHours()%12;if(n!=0&&n<10){n="0"+n}o+=(n==0)?"12":n;break;case"H":var n=s.getHours();o+=(n>9)?n:"0"+n;break;case"i":var p=s.getMinutes();o+=(p>9)?p:"0"+p;break;case"s":var u=s.getSeconds();o+=(u>9)?u:"0"+u;break;default:o+=r}}return o}function g(q){if(q==""){return null}if(q+0==q){return q}if(typeof(q)=="object"){q=q.getHours()+":"+q.getMinutes()}var s=new Date(0);var r=q.toLowerCase().match(/(\d+)(?::(\d\d))?\s*([pa]?)/);if(!r){return null}var o=parseInt(r[1]*1);if(r[3]){if(o==12){var n=(r[3]=="p")?12:0}else{var n=(o+(r[3]=="p"?12:0))}}else{var n=o}var p=(r[2]*1||0);return n*3600+p*60}f.fn.timepicker=function(n){if(c[n]){return c[n].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof n==="object"||!n){return c.init.apply(this,arguments)}else{f.error("Method "+n+" does not exist on jQuery.timepicker")}}}})(jQuery);

0 comments on commit 1e1c37e

Please sign in to comment.