diff --git a/cron/jquery-cron-min.js b/cron/jquery-cron-min.js
index 386fb37..51369ad 100644
--- a/cron/jquery-cron-min.js
+++ b/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,useGentleSelect:false};var y="";for(var u=0;u<60;u++){var t=(u<10)?"0":"";y+="\n"}var d="";for(var u=0;u<24;u++){var t=(u<10)?"0":"";d+="\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+="\n"}var h="";var l=["January","February","March","April","May","June","July","August","September","October","November","December"];for(var u=0;u"+l[u]+"\n"}var s="";var g=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];for(var u=0;u"+g[u]+"\n"}var r="";var b=["minute","hour","day","week","month","year"];for(var u=0;u"+b[u]+"\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(A,j){if(a(j.customValues)){for(key in j.customValues){if(A==j.customValues[key]){return key}}}var E=/^((\d{1,2}|\*)\s){4}(\d{1,2}|\*)$/;if(typeof A!="string"||!E.test(A)){e.error("cron: invalid initial value");return undefined}var C=A.split(" ");var D=[0,0,1,1,0];var G=[59,23,31,12,6];for(var B=0;B=D[B]){continue}e.error("cron: invalid value found (col "+(B+1)+") in "+o.initial);return undefined}for(var H in w){if(w[H].test(A)){return H}}e.error("cron: valid but unsupported cron format. sorry.");return undefined}function f(j,i){if(!a(z(i.initial,i))){return true}if(!q(i.customValues)){return true}if(a(i.customValues)){for(key in i.customValues){if(w.hasOwnProperty(key)){e.error("cron: reserved keyword '"+key+"' should not be used as customValues key.");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(i){var G=i?i:{};var B=e.extend([],n,G);var j=e.extend({},n.effectOpts,G.effectOpts);e.extend(B,{minuteOpts:e.extend({},n.minuteOpts,j,G.minuteOpts),domOpts:e.extend({},n.domOpts,j,G.domOpts),monthOpts:e.extend({},n.monthOpts,j,G.monthOpts),dowOpts:e.extend({},n.dowOpts,j,G.dowOpts),timeHourOpts:e.extend({},n.timeHourOpts,j,G.timeHourOpts),timeMinuteOpts:e.extend({},n.timeMinuteOpts,j,G.timeMinuteOpts)});if(f(this,B)){return this}var C=[],A="",D=B.customValues;if(a(D)){for(var F in D){A+="\n"}}C.period=e("Every ").appendTo(this).data("root",this);var E=C.period.find("select");E.bind("change.cron",m.periodChanged).data("root",this);if(B.useGentleSelect){E.gentleSelect(j)}C.dom=e(" on the ").appendTo(this).data("root",this);E=C.dom.find("select").data("root",this);if(B.useGentleSelect){E.gentleSelect(B.domOpts)}C.month=e(" of ").appendTo(this).data("root",this);E=C.month.find("select").data("root",this);if(B.useGentleSelect){E.gentleSelect(B.monthOpts)}C.mins=e(" at minutes past the hour ").appendTo(this).data("root",this);E=C.mins.find("select").data("root",this);if(B.useGentleSelect){E.gentleSelect(B.minuteOpts)}C.dow=e(" on ").appendTo(this).data("root",this);E=C.dow.find("select").data("root",this);if(B.useGentleSelect){E.gentleSelect(B.dowOpts)}C.time=e(" at :").appendTo(this).data("root",this);E=C.time.find("select.cron-time-hour").data("root",this);if(B.useGentleSelect){E.gentleSelect(B.timeHourOpts)}E=C.time.find("select.cron-time-min").data("root",this);if(B.useGentleSelect){E.gentleSelect(B.timeMinuteOpts)}C.controls=e("« save ").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",B).data("block",C);this.data("current_value",B.initial);return x.value.call(this,B.initial)},value:function(C){if(!C){return k(this)}var A=this.data("options");var D=this.data("block");var F=A.useGentleSelect;var K=z(C,A);if(!a(K)){return false}if(a(A.customValues)&&A.customValues.hasOwnProperty(K)){K=A.customValues[K]}else{var H=C.split(" ");var J={mins:H[0],hour:H[1],dom:H[2],month:H[3],dow:H[4]};var G=p[K];for(var E=0;E=r[c]))return void e.error("cron: invalid value found (col "+(c+1)+") in "+o.initial)}for(var u in b)if(b[u].test(n))return u;return void e.error("cron: valid but unsupported cron format. sorry.")}function a(o,a){if(!t(i(a.initial,a)))return!0;if(!n(a.customValues))return!0;if(t(a.customValues))for(key in a.customValues)if(b.hasOwnProperty(key))return e.error("cron: reserved keyword '"+key+"' should not be used as customValues key."),!0;return!1}function s(e){var t=e.data("block"),o=hour=day=month=dow="*",n=t.period.find("select").val();switch(n){case"minute":break;case"hour":o=t.mins.find("select").val();break;case"day":o=t.time.find("select.cron-time-min").val(),hour=t.time.find("select.cron-time-hour").val();break;case"week":o=t.time.find("select.cron-time-min").val(),hour=t.time.find("select.cron-time-hour").val(),dow=t.dow.find("select").val();break;case"month":o=t.time.find("select.cron-time-min").val(),hour=t.time.find("select.cron-time-hour").val(),day=t.dom.find("select").val();break;case"year":o=t.time.find("select.cron-time-min").val(),hour=t.time.find("select.cron-time-hour").val(),day=t.dom.find("select").val(),month=t.month.find("select").val();break;default:return n}return[o,hour,day,month,dow].join(" ")}for(var r={initial:"* * * * *",periods:["minute","hour","day","week","month","year"],minuteOpts:{minWidth:100,itemWidth:30,columns:4,rows:void 0,title:"Minutes Past the Hour"},timeHourOpts:{minWidth:100,itemWidth:20,columns:2,rows:void 0,title:"Time: Hour"},domOpts:{minWidth:100,itemWidth:30,columns:void 0,rows:10,title:"Day of Month"},monthOpts:{minWidth:100,itemWidth:100,columns:2,rows:void 0,title:void 0},dowOpts:{minWidth:100,itemWidth:void 0,columns:void 0,rows:void 0,title:void 0},timeMinuteOpts:{minWidth:100,itemWidth:20,columns:4,rows:void 0,title:"Time: Minute"},effectOpts:{openSpeed:400,closeSpeed:400,openEffect:"slide",closeEffect:"slide",hideOnMouseOut:!0},url_set:void 0,customValues:void 0,onChange:void 0,useGentleSelect:!1},l="",c=0;60>c;c++){var d=10>c?"0":"";l+="\n"}for(var u="",c=0;24>c;c++){var d=10>c?"0":"";u+="\n"}for(var m="",c=1;32>c;c++){if(1==c||21==c||31==c)var h="st";else if(2==c||22==c)var h="nd";else if(3==c||23==c)var h="rd";else var h="th";m+="\n"}for(var p="",v=["January","February","March","April","May","June","July","August","September","October","November","December"],c=0;c"+v[c]+"\n";for(var f="",y=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=0;c"+y[c]+"\n";var g={minute:[],hour:["mins"],day:["time"],week:["dow","time"],month:["dom","time"],year:["dom","month","time"]},b={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}\*$/},O={init:function(o){var n=o?o:{},i=e.extend([],r,n),s=e.extend({},r.effectOpts,n.effectOpts);if(e.extend(i,{periods:n.periods&&n.periods.length>0?n.periods:r.periods,minuteOpts:e.extend({},r.minuteOpts,s,n.minuteOpts),domOpts:e.extend({},r.domOpts,s,n.domOpts),monthOpts:e.extend({},r.monthOpts,s,n.monthOpts),dowOpts:e.extend({},r.dowOpts,s,n.dowOpts),timeHourOpts:e.extend({},r.timeHourOpts,s,n.timeHourOpts),timeMinuteOpts:e.extend({},r.timeMinuteOpts,s,n.timeMinuteOpts)}),a(this,i))return this;var c="",d=i.periods;e.each(d,function(e,t){c+="\n"});var h=[],v="",y=i.customValues;if(t(y))for(var g in y)v+="\n";h.period=e("Every ").appendTo(this).data("root",this);var b=h.period.find("select");return b.bind("change.cron",k.periodChanged).data("root",this),i.useGentleSelect&&b.gentleSelect(s),h.dom=e(" on the ").appendTo(this).data("root",this),b=h.dom.find("select").data("root",this),i.useGentleSelect&&b.gentleSelect(i.domOpts),h.month=e(" of ").appendTo(this).data("root",this),b=h.month.find("select").data("root",this),i.useGentleSelect&&b.gentleSelect(i.monthOpts),h.mins=e(" at minutes past the hour ").appendTo(this).data("root",this),b=h.mins.find("select").data("root",this),i.useGentleSelect&&b.gentleSelect(i.minuteOpts),h.dow=e(" on ").appendTo(this).data("root",this),b=h.dow.find("select").data("root",this),i.useGentleSelect&&b.gentleSelect(i.dowOpts),h.time=e(" at :").appendTo(this).data("root",this),b=h.time.find("select.cron-time-hour").data("root",this),i.useGentleSelect&&b.gentleSelect(i.timeHourOpts),b=h.time.find("select.cron-time-min").data("root",this),i.useGentleSelect&&b.gentleSelect(i.timeMinuteOpts),h.controls=e("« save ").appendTo(this).data("root",this).find("span.cron-button-save").bind("click.cron",k.saveClicked).data("root",this).end(),this.find("select").bind("change.cron-callback",k.somethingChanged),this.data("options",i).data("block",h),this.data("current_value",i.initial),O.value.call(this,i.initial)},value:function(e){if(!e)return s(this);var o=this.data("options"),n=this.data("block"),a=o.useGentleSelect,r=i(e,o);if(!t(r))return!1;if(t(o.customValues)&&o.customValues.hasOwnProperty(r))r=o.customValues[r];else for(var l=e.split(" "),c={mins:l[0],hour:l[1],dom:l[2],month:l[3],dow:l[4]},d=g[r],u=0;u" + days[i] + "\n";
}
- // options for period
- var str_opt_period = "";
- var periods = ["minute", "hour", "day", "week", "month", "year"];
- for (var i = 0; i < periods.length; i++) {
- str_opt_period += "\n";
- }
-
// display matrix
var toDisplay = {
"minute" : [],
@@ -285,6 +279,7 @@
var o = $.extend([], defaults, options);
var eo = $.extend({}, defaults.effectOpts, options.effectOpts);
$.extend(o, {
+ periods : options.periods && options.periods.length > 0 ? options.periods : defaults.periods,
minuteOpts : $.extend({}, defaults.minuteOpts, eo, options.minuteOpts),
domOpts : $.extend({}, defaults.domOpts, eo, options.domOpts),
monthOpts : $.extend({}, defaults.monthOpts, eo, options.monthOpts),
@@ -295,6 +290,13 @@
// error checking
if (hasError(this, o)) { return this; }
+
+ // options for period
+ var str_opt_period = "";
+ var periods = o.periods;
+ $.each(periods, function (index, value) {
+ str_opt_period += "\n";
+ })
// ---- define select boxes in the right order -----
diff --git a/index.html b/index.html
index 7180030..e87e2b1 100644
--- a/index.html
+++ b/index.html
@@ -68,6 +68,10 @@
},
useGentleSelect: true
});
+ $('#example5').cron({
+ periods: ["day", "year"],
+ useGentleSelect: true
+ });
});
@@ -354,6 +358,26 @@ Adding custom values
+
+ Specify periods to display
+
+ The list of selectable cron periods can be specified using the periods
+ option. This allows you to specify an array of periods to display.
+
+
+ For example, the following displays only day and year period selections:
+
+$('#selector').cron({
+ periods: ["day", "year"]
+});
+
+
+
+
+
Methods
value