Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use correct suffix for 31 (as in 31st). Thanks @RikWaspcroft

  • Loading branch information...
commit 63597f28f908824efb32aeb34c9704206cf200ba 1 parent 9ffb178
@shawnchin authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  cron/jquery-cron-min.js
  2. +1 −1  cron/jquery-cron.js
View
2  cron/jquery-cron-min.js
@@ -1 +1 @@
-(function(e){var n={initial:"* * * * *",minuteOpts:{minWidth:100,itemWidth:30,columns:4,rows:undefined,title:"Minutes Past the Hour"},timeHourOpts:{minWidth:100,itemWidth:20,columns:2,rows:undefined,title:"Time: Hour"},domOpts:{minWidth:100,itemWidth:30,columns:undefined,rows:10,title:"Day of Month"},monthOpts:{minWidth:100,itemWidth:100,columns:2,rows:undefined,title:undefined},dowOpts:{minWidth:100,itemWidth:undefined,columns:undefined,rows:undefined,title:undefined},timeMinuteOpts:{minWidth:100,itemWidth:20,columns:4,rows:undefined,title:"Time: Minute"},effectOpts:{openSpeed:400,closeSpeed:400,openEffect:"slide",closeEffect:"slide",hideOnMouseOut:true},url_set:undefined,customValues:undefined,onChange:undefined};var y="";for(var u=0;u<60;u++){var t=(u<10)?"0":"";y+="<option value='"+u+"'>"+t+u+"</option>\n"}var d="";for(var u=0;u<24;u++){var t=(u<10)?"0":"";d+="<option value='"+u+"'>"+t+u+"</option>\n"}var v="";for(var u=1;u<32;u++){if(u==1||u==21){var c="st"}else{if(u==2||u==22){var c="nd"}else{if(u==3||u==23){var c="rd"}else{var c="th"}}}v+="<option value='"+u+"'>"+u+c+"</option>\n"}var h="";var l=["January","February","March","April","May","June","July","August","September","October","November","December"];for(var u=0;u<l.length;u++){h+="<option value='"+(u+1)+"'>"+l[u]+"</option>\n"}var s="";var g=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];for(var u=0;u<g.length;u++){s+="<option value='"+u+"'>"+g[u]+"</option>\n"}var r="";var b=["minute","hour","day","week","month","year"];for(var u=0;u<b.length;u++){r+="<option value='"+b[u]+"'>"+b[u]+"</option>\n"}var p={minute:[],hour:["mins"],day:["time"],week:["dow","time"],month:["dom","time"],year:["dom","month","time"]};var w={minute:/^(\*\s){4}\*$/,hour:/^\d{1,2}\s(\*\s){3}\*$/,day:/^(\d{1,2}\s){2}(\*\s){2}\*$/,week:/^(\d{1,2}\s){2}(\*\s){2}\d{1,2}$/,month:/^(\d{1,2}\s){3}\*\s\*$/,year:/^(\d{1,2}\s){4}\*$/};function a(i){if(typeof i=="undefined"){return false}else{return true}}function q(i){return(!a(i)||typeof i=="object")}function z(G){var E=/^((\d{1,2}|\*)\s){4}(\d{1,2}|\*)$/;if(typeof G!="string"||!E.test(G)){e.error("cron: invalid initial value");return undefined}var F=G.split(" ");var D=[0,0,1,1,0];var A=[59,23,31,12,6];for(var C=0;C<F.length;C++){if(F[C]=="*"){continue}var j=parseInt(F[C]);if(a(j)&&j<=A[C]&&j>=D[C]){continue}e.error("cron: invalid value found (col "+(C+1)+") in "+o.initial);return undefined}for(var B in w){if(w[B].test(G)){return B}}e.error("cron: valid but unsupported cron format. sorry.");return undefined}function f(j,i){if(!a(z(i.initial))){return true}if(!q(i.customValues)){return true}return false}function k(B){var i=B.data("block");var j=hour=day=month=dow="*";var A=i.period.find("select").val();switch(A){case"minute":break;case"hour":j=i.mins.find("select").val();break;case"day":j=i.time.find("select.cron-time-min").val();hour=i.time.find("select.cron-time-hour").val();break;case"week":j=i.time.find("select.cron-time-min").val();hour=i.time.find("select.cron-time-hour").val();dow=i.dow.find("select").val();break;case"month":j=i.time.find("select.cron-time-min").val();hour=i.time.find("select.cron-time-hour").val();day=i.dom.find("select").val();break;case"year":j=i.time.find("select.cron-time-min").val();hour=i.time.find("select.cron-time-hour").val();day=i.dom.find("select").val();month=i.month.find("select").val();break;default:return A}return[j,hour,day,month,dow].join(" ")}var x={init:function(D){var B=D?D:{};var F=e.extend([],n,B);var j=e.extend({},n.effectOpts,B.effectOpts);e.extend(F,{minuteOpts:e.extend({},n.minuteOpts,j,B.minuteOpts),domOpts:e.extend({},n.domOpts,j,B.domOpts),monthOpts:e.extend({},n.monthOpts,j,B.monthOpts),dowOpts:e.extend({},n.dowOpts,j,B.dowOpts),timeHourOpts:e.extend({},n.timeHourOpts,j,B.timeHourOpts),timeMinuteOpts:e.extend({},n.timeMinuteOpts,j,B.timeMinuteOpts)});if(f(this,F)){return this}var E=[],A="",i=F.customValues;if(a(i)){for(var C in i){A+="<option value='"+i[C]+"'>"+C+"</option>\n"}}E.period=e("<span class='cron-period'>Every <select name='cron-period'>"+A+r+"</select> </span>").appendTo(this).find("select").bind("change.cron",m.periodChanged).data("root",this).gentleSelect(j).end();E.dom=e("<span class='cron-block cron-block-dom'> on the <select name='cron-dom'>"+v+"</select> </span>").appendTo(this).data("root",this).find("select").gentleSelect(F.domOpts).data("root",this).end();E.month=e("<span class='cron-block cron-block-month'> of <select name='cron-month'>"+h+"</select> </span>").appendTo(this).data("root",this).find("select").gentleSelect(F.monthOpts).data("root",this).end();E.mins=e("<span class='cron-block cron-block-mins'> at <select name='cron-mins'>"+y+"</select> minutes past the hour </span>").appendTo(this).data("root",this).find("select").gentleSelect(F.minuteOpts).data("root",this).end();E.dow=e("<span class='cron-block cron-block-dow'> on <select name='cron-dow'>"+s+"</select> </span>").appendTo(this).data("root",this).find("select").gentleSelect(F.dowOpts).data("root",this).end();E.time=e("<span class='cron-block cron-block-time'> at <select name='cron-time-hour' class='cron-time-hour'>"+d+"</select>:<select name='cron-time-min' class='cron-time-min'>"+y+" </span>").appendTo(this).data("root",this).find("select.cron-time-hour").gentleSelect(F.timeHourOpts).data("root",this).end().find("select.cron-time-min").gentleSelect(F.timeMinuteOpts).data("root",this).end();E.controls=e("<span class='cron-controls'>&laquo; save <span class='cron-button cron-button-save'></span> </span>").appendTo(this).data("root",this).find("span.cron-button-save").bind("click.cron",m.saveClicked).data("root",this).end();this.find("select").bind("change.cron-callback",m.somethingChanged);this.data("options",F).data("block",E);this.data("current_value",F.initial);return x.value.call(this,F.initial)},value:function(F){if(!F){return k(this)}var C=z(F);if(!a(C)){return false}var E=this.data("block");var D=F.split(" ");var A={mins:D[0],hour:D[1],dom:D[2],month:D[3],dow:D[4]};var j=p[C];for(var B=0;B<j.length;B++){var G=j[B];if(G=="time"){E[G].find("select.cron-time-hour").val(A.hour).gentleSelect("update").end().find("select.cron-time-min").val(A.mins).gentleSelect("update").end()}else{E[G].find("select").val(A[G]).gentleSelect("update")}}E.period.find("select").val(C).gentleSelect("update").trigger("change");return this}};var m={periodChanged:function(){var A=e(this).data("root");var E=A.data("block"),C=A.data("options");var D=e(this).val();A.find("span.cron-block").hide();if(p.hasOwnProperty(D)){var j=p[e(this).val()];for(var B=0;B<j.length;B++){E[j[B]].show()}}},somethingChanged:function(){root=e(this).data("root");if(a(root.data("options").url_set)){if(x.value.call(root)!=root.data("current_value")){root.addClass("cron-changed");root.data("block")["controls"].fadeIn()}else{root.removeClass("cron-changed");root.data("block")["controls"].fadeOut()}}else{root.data("block")["controls"].hide()}var i=root.data("options").onChange;if(a(i)&&e.isFunction(i)){i.call(root)}},saveClicked:function(){var j=e(this);var i=j.data("root");var A=x.value.call(i);if(j.hasClass("cron-loading")){return}j.addClass("cron-loading");e.ajax({type:"POST",url:i.data("options").url_set,data:{cron:A},success:function(){i.data("current_value",A);j.removeClass("cron-loading");if(A==x.value.call(i)){i.removeClass("cron-changed");i.data("block").controls.fadeOut()}},error:function(){alert("An error occured when submitting your request. Try again?");j.removeClass("cron-loading")}})}};e.fn.cron=function(i){if(x[i]){return x[i].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof i==="object"||!i){return x.init.apply(this,arguments)}else{e.error("Method "+i+" does not exist on jQuery.cron")}}}})(jQuery);
+(function(e){var n={initial:"* * * * *",minuteOpts:{minWidth:100,itemWidth:30,columns:4,rows:undefined,title:"Minutes Past the Hour"},timeHourOpts:{minWidth:100,itemWidth:20,columns:2,rows:undefined,title:"Time: Hour"},domOpts:{minWidth:100,itemWidth:30,columns:undefined,rows:10,title:"Day of Month"},monthOpts:{minWidth:100,itemWidth:100,columns:2,rows:undefined,title:undefined},dowOpts:{minWidth:100,itemWidth:undefined,columns:undefined,rows:undefined,title:undefined},timeMinuteOpts:{minWidth:100,itemWidth:20,columns:4,rows:undefined,title:"Time: Minute"},effectOpts:{openSpeed:400,closeSpeed:400,openEffect:"slide",closeEffect:"slide",hideOnMouseOut:true},url_set:undefined,customValues:undefined,onChange:undefined};var y="";for(var u=0;u<60;u++){var t=(u<10)?"0":"";y+="<option value='"+u+"'>"+t+u+"</option>\n"}var d="";for(var u=0;u<24;u++){var t=(u<10)?"0":"";d+="<option value='"+u+"'>"+t+u+"</option>\n"}var v="";for(var u=1;u<32;u++){if(u==1||u==21||u==31){var c="st"}else{if(u==2||u==22){var c="nd"}else{if(u==3||u==23){var c="rd"}else{var c="th"}}}v+="<option value='"+u+"'>"+u+c+"</option>\n"}var h="";var l=["January","February","March","April","May","June","July","August","September","October","November","December"];for(var u=0;u<l.length;u++){h+="<option value='"+(u+1)+"'>"+l[u]+"</option>\n"}var s="";var g=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];for(var u=0;u<g.length;u++){s+="<option value='"+u+"'>"+g[u]+"</option>\n"}var r="";var b=["minute","hour","day","week","month","year"];for(var u=0;u<b.length;u++){r+="<option value='"+b[u]+"'>"+b[u]+"</option>\n"}var p={minute:[],hour:["mins"],day:["time"],week:["dow","time"],month:["dom","time"],year:["dom","month","time"]};var w={minute:/^(\*\s){4}\*$/,hour:/^\d{1,2}\s(\*\s){3}\*$/,day:/^(\d{1,2}\s){2}(\*\s){2}\*$/,week:/^(\d{1,2}\s){2}(\*\s){2}\d{1,2}$/,month:/^(\d{1,2}\s){3}\*\s\*$/,year:/^(\d{1,2}\s){4}\*$/};function a(i){if(typeof i=="undefined"){return false}else{return true}}function q(i){return(!a(i)||typeof i=="object")}function z(G){var E=/^((\d{1,2}|\*)\s){4}(\d{1,2}|\*)$/;if(typeof G!="string"||!E.test(G)){e.error("cron: invalid initial value");return undefined}var F=G.split(" ");var D=[0,0,1,1,0];var A=[59,23,31,12,6];for(var C=0;C<F.length;C++){if(F[C]=="*"){continue}var j=parseInt(F[C]);if(a(j)&&j<=A[C]&&j>=D[C]){continue}e.error("cron: invalid value found (col "+(C+1)+") in "+o.initial);return undefined}for(var B in w){if(w[B].test(G)){return B}}e.error("cron: valid but unsupported cron format. sorry.");return undefined}function f(j,i){if(!a(z(i.initial))){return true}if(!q(i.customValues)){return true}return false}function k(B){var i=B.data("block");var j=hour=day=month=dow="*";var A=i.period.find("select").val();switch(A){case"minute":break;case"hour":j=i.mins.find("select").val();break;case"day":j=i.time.find("select.cron-time-min").val();hour=i.time.find("select.cron-time-hour").val();break;case"week":j=i.time.find("select.cron-time-min").val();hour=i.time.find("select.cron-time-hour").val();dow=i.dow.find("select").val();break;case"month":j=i.time.find("select.cron-time-min").val();hour=i.time.find("select.cron-time-hour").val();day=i.dom.find("select").val();break;case"year":j=i.time.find("select.cron-time-min").val();hour=i.time.find("select.cron-time-hour").val();day=i.dom.find("select").val();month=i.month.find("select").val();break;default:return A}return[j,hour,day,month,dow].join(" ")}var x={init:function(D){var B=D?D:{};var F=e.extend([],n,B);var j=e.extend({},n.effectOpts,B.effectOpts);e.extend(F,{minuteOpts:e.extend({},n.minuteOpts,j,B.minuteOpts),domOpts:e.extend({},n.domOpts,j,B.domOpts),monthOpts:e.extend({},n.monthOpts,j,B.monthOpts),dowOpts:e.extend({},n.dowOpts,j,B.dowOpts),timeHourOpts:e.extend({},n.timeHourOpts,j,B.timeHourOpts),timeMinuteOpts:e.extend({},n.timeMinuteOpts,j,B.timeMinuteOpts)});if(f(this,F)){return this}var E=[],A="",i=F.customValues;if(a(i)){for(var C in i){A+="<option value='"+i[C]+"'>"+C+"</option>\n"}}E.period=e("<span class='cron-period'>Every <select name='cron-period'>"+A+r+"</select> </span>").appendTo(this).find("select").bind("change.cron",m.periodChanged).data("root",this).gentleSelect(j).end();E.dom=e("<span class='cron-block cron-block-dom'> on the <select name='cron-dom'>"+v+"</select> </span>").appendTo(this).data("root",this).find("select").gentleSelect(F.domOpts).data("root",this).end();E.month=e("<span class='cron-block cron-block-month'> of <select name='cron-month'>"+h+"</select> </span>").appendTo(this).data("root",this).find("select").gentleSelect(F.monthOpts).data("root",this).end();E.mins=e("<span class='cron-block cron-block-mins'> at <select name='cron-mins'>"+y+"</select> minutes past the hour </span>").appendTo(this).data("root",this).find("select").gentleSelect(F.minuteOpts).data("root",this).end();E.dow=e("<span class='cron-block cron-block-dow'> on <select name='cron-dow'>"+s+"</select> </span>").appendTo(this).data("root",this).find("select").gentleSelect(F.dowOpts).data("root",this).end();E.time=e("<span class='cron-block cron-block-time'> at <select name='cron-time-hour' class='cron-time-hour'>"+d+"</select>:<select name='cron-time-min' class='cron-time-min'>"+y+" </span>").appendTo(this).data("root",this).find("select.cron-time-hour").gentleSelect(F.timeHourOpts).data("root",this).end().find("select.cron-time-min").gentleSelect(F.timeMinuteOpts).data("root",this).end();E.controls=e("<span class='cron-controls'>&laquo; save <span class='cron-button cron-button-save'></span> </span>").appendTo(this).data("root",this).find("span.cron-button-save").bind("click.cron",m.saveClicked).data("root",this).end();this.find("select").bind("change.cron-callback",m.somethingChanged);this.data("options",F).data("block",E);this.data("current_value",F.initial);return x.value.call(this,F.initial)},value:function(F){if(!F){return k(this)}var C=z(F);if(!a(C)){return false}var E=this.data("block");var D=F.split(" ");var A={mins:D[0],hour:D[1],dom:D[2],month:D[3],dow:D[4]};var j=p[C];for(var B=0;B<j.length;B++){var G=j[B];if(G=="time"){E[G].find("select.cron-time-hour").val(A.hour).gentleSelect("update").end().find("select.cron-time-min").val(A.mins).gentleSelect("update").end()}else{E[G].find("select").val(A[G]).gentleSelect("update")}}E.period.find("select").val(C).gentleSelect("update").trigger("change");return this}};var m={periodChanged:function(){var A=e(this).data("root");var E=A.data("block"),C=A.data("options");var D=e(this).val();A.find("span.cron-block").hide();if(p.hasOwnProperty(D)){var j=p[e(this).val()];for(var B=0;B<j.length;B++){E[j[B]].show()}}},somethingChanged:function(){root=e(this).data("root");if(a(root.data("options").url_set)){if(x.value.call(root)!=root.data("current_value")){root.addClass("cron-changed");root.data("block")["controls"].fadeIn()}else{root.removeClass("cron-changed");root.data("block")["controls"].fadeOut()}}else{root.data("block")["controls"].hide()}var i=root.data("options").onChange;if(a(i)&&e.isFunction(i)){i.call(root)}},saveClicked:function(){var j=e(this);var i=j.data("root");var A=x.value.call(i);if(j.hasClass("cron-loading")){return}j.addClass("cron-loading");e.ajax({type:"POST",url:i.data("options").url_set,data:{cron:A},success:function(){i.data("current_value",A);j.removeClass("cron-loading");if(A==x.value.call(i)){i.removeClass("cron-changed");i.data("block").controls.fadeOut()}},error:function(){alert("An error occured when submitting your request. Try again?");j.removeClass("cron-loading")}})}};e.fn.cron=function(i){if(x[i]){return x[i].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof i==="object"||!i){return x.init.apply(this,arguments)}else{e.error("Method "+i+" does not exist on jQuery.cron")}}}})(jQuery);
View
2  cron/jquery-cron.js
@@ -115,7 +115,7 @@
// options for days of month
var str_opt_dom = "";
for (var i = 1; i < 32; i++) {
- if (i == 1 || i == 21) { var suffix = "st"; }
+ if (i == 1 || i == 21 || i == 31) { var suffix = "st"; }
else if (i == 2 || i == 22) { var suffix = "nd"; }
else if (i == 3 || i == 23) { var suffix = "rd"; }
else { var suffix = "th"; }
Please sign in to comment.
Something went wrong with that request. Please try again.