/* * This file is part of the Arnapou jqCron package. * * (c) Arnaud Buathier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ var jqCronDefaultSettings={texts:{fr:{empty:"-tout-",name_minute:"minute",name_hour:"heure",name_day:"jour",name_week:"semaine",name_month:"mois",name_year:"année",text_period:"Chaque ",text_mins:"à minutes",text_time:"à :",text_dow:"le ",text_month:"de ",text_dom:"le ",error1:"La balise %s n'est pas supportée !",error2:"Mauvais nombre d'éléments",error3:"La propriété jquery_element doit être définie dans les paramètres jqCron",error4:"Expression non reconnue",weekdays:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],months:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},en:{empty:"-all-",name_minute:"minute",name_hour:"hour",name_day:"day",name_week:"week",name_month:"month",name_year:"year",text_period:"Every ",text_mins:"at minutes past the hour",text_time:"at :",text_dow:"on ",text_month:"of ",text_dom:"on the ",error1:"The tag %s is not supported !",error2:"Bad number of elements",error3:"The jquery_element should be set into jqCron settings",error4:"Unrecognized expression",weekdays:["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],months:["january","february","march","april","may","june","july","august","september","october","november","december"]}},monthdays:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],hours:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],minutes:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59],lang:"fr",enabled_minute:false,enabled_hour:true,enabled_day:true,enabled_week:true,enabled_month:true,enabled_year:true,multiple_dom:false,multiple_month:false,multiple_mins:false,multiple_dow:false,multiple_time_hours:false,multiple_time_minutes:false,numeric_zero_pad:false,default_period:"day",default_value:"",no_reset_button:true,disabled:false,bind_to:null,bind_method:{set:function(e,t){e.is(":input")?e.val(t):e.data("jqCronValue",t)},get:function(e){return e.is(":input")?e.val():e.data("jqCronValue")}}};(function(e){var t=function(n,r){for(var i in r){if(e.isPlainObject(r[i])){n[i]=t(n[i]&&e.isPlainObject(n[i])?n[i]:{},r[i])}else if(e.isArray(r[i])){n[i]=r[i].slice(0)}else if(r[i]!==undefined){n[i]=r[i]}}return n};this.jqCronMergeSettings=function(e){return t(t({},jqCronDefaultSettings),e||{})}}).call(this,jQuery);(function(e){e.fn.jqCronGetInstance=function(){return this.data("jqCron")}}).call(this,jQuery);(function(e){e.fn.jqCron=function(t){return this.each(function(){var n,r;var i=e(this);t=jqCronMergeSettings(t);if(!t.jquery_container){if(i.is(":container")){t.jquery_element=i.uniqueId("jqCron")}else if(i.is(":autoclose")){if(i.next(".jqCron").length==1){i.next(".jqCron").remove()}t.jquery_element=e('').uniqueId("jqCron").insertAfter(i)}else{console&&console.error(t.texts[t.lang].error1.replace("%s",this.tagName));return}}if(i.is(":input")){t.bind_to=t.bind_to||i}if(t.bind_to){if(t.bind_to.is(":input")){t.bind_to.blur(function(){var e=t.bind_method.get(t.bind_to);i.jqCronGetInstance().setCron(e)})}r=t.bind_method.get(t.bind_to);n=new jqCron(t);n.setCron(r)}else{n=new jqCron(t)}e(this).data("jqCron",n)})}}).call(this,jQuery);(function(e){function n(n){function x(e,s){var u=new jqCronSelector(i,e,s);u.$.bind("selector:open",function(){for(var e=t.length;e--;){if(t[e]!=i){t[e].closeSelectors()}else{for(var n=v.length;n--;){if(v[n]!=u){v[n].close()}}}}});u.$.bind("selector:change",function(){var e=false;if(!r)return;if(n.multiple_mins==n.multiple_time_minutes){if(u==g){e=b.setValue(g.getValue())}else if(u==b){e=g.setValue(b.getValue())}}e||o.trigger("cron:change",i.getCron())});v.push(u);return u}var r=false;var i=this;var s=this;var o=e('');var u=e('');var a=e('');var f=e('');var l=e('');var c=e('');var h=e('');var p=e('');var d=e('');var v=[];var m,g,y,b,w,E,S;this.disable=function(){o.addClass("disable");n.disable=true;i.closeSelectors()};this.isDisabled=function(){return n.disable==true};this.enable=function(){o.removeClass("disable");n.disable=false};this.getCron=function(){var e=m.getValue();var t=["*","*","*","*","*"];if(e=="hour"){t[0]=g.getCronValue()}if(e=="day"||e=="week"||e=="month"||e=="year"){t[0]=b.getCronValue();t[1]=y.getCronValue()}if(e=="month"||e=="year"){t[2]=E.getCronValue()}if(e=="year"){t[3]=S.getCronValue()}if(e=="week"){t[4]=w.getCronValue()}return t.join(" ")};this.setCron=function(e){if(!e)return;try{e=e.replace(/\s+/g," ").replace(/^ +/,"").replace(/ +$/,"");var t=e.replace(/[^\* ]/g,"-").replace(/-+/g,"-").replace(/ +/g,"");var n=e.split(" ");if(n.length!=5)i.error(i.getText("error2"));if(t=="*****"){m.setValue("minute")}else if(t=="-****"){m.setValue("hour");g.setCronValue(n[0]);b.setCronValue(n[0])}else if(t.substring(2,t.length)=="***"){m.setValue("day");g.setCronValue(n[0]);b.setCronValue(n[0]);y.setCronValue(n[1])}else if(t.substring(2,t.length)=="-**"){m.setValue("month");g.setCronValue(n[0]);b.setCronValue(n[0]);y.setCronValue(n[1]);E.setCronValue(n[2])}else if(t.substring(2,t.length)=="**-"){m.setValue("week");g.setCronValue(n[0]);b.setCronValue(n[0]);y.setCronValue(n[1]);w.setCronValue(n[4])}else if(t.substring(3,t.length)=="-*"){m.setValue("year");g.setCronValue(n[0]);b.setCronValue(n[0]);y.setCronValue(n[1]);E.setCronValue(n[2]);S.setCronValue(n[3])}else{i.error(i.getText("error4"))}i.clearError()}catch(r){}};this.closeSelectors=function(){for(var e=v.length;e--;){v[e].close()}};this.getId=function(){return s.attr("id")};this.getText=function(e){var t=n.texts[n.lang][e]||null;if(typeof t=="string"&&t.match(")/gi,'');t=''+t+""}return t};this.getHumanText=function(){var t=[];o.find("> span > span:visible").find(".jqCron-text, .jqCron-selector > span").each(function(){var n=e(this).text().replace(/\s+$/g,"").replace(/^\s+/g,"");n&&t.push(n)});return t.join(" ").replace(/\s:\s/g,":")};this.getSettings=function(){return n};this.error=function(e){console&&console.error("[jqCron Error] "+e);o.addClass("jqCron-error").attr("title",e);throw e};this.clearError=function(){o.attr("title","").removeClass("jqCron-error")};this.clear=function(){E.setValue([]);w.setValue([]);g.setValue([]);S.setValue([]);y.setValue([]);b.setValue([]);i.triggerChange()};this.init=function(){var t,T,N;if(r)return;n=jqCronMergeSettings(n);n.jquery_element||i.error(i.getText("error3"));s=n.jquery_element;s.append(o);o.data("id",n.id);o.data("jqCron",i);o.append(u);n.no_reset_button||o.append(d);!n.disable||o.addClass("disable");u.append(a);u.append(f);u.append(l);u.append(c);u.append(h);u.append(p);d.click(function(){i.isDisabled()||i.clear()});o.bind("cron:change",function(e,t){if(!n.bind_to)return;n.bind_method.set&&n.bind_method.set(n.bind_to,t);i.clearError()});a.append(i.getText("text_period"));m=x(a,false);n.enabled_minute&&m.add("minute",i.getText("name_minute"));n.enabled_hour&&m.add("hour",i.getText("name_hour"));n.enabled_day&&m.add("day",i.getText("name_day"));n.enabled_week&&m.add("week",i.getText("name_week"));n.enabled_month&&m.add("month",i.getText("name_month"));n.enabled_year&&m.add("year",i.getText("name_year"));m.$.bind("selector:change",function(e,t){f.hide();l.hide();c.hide();h.hide();p.hide();if(t=="hour"){c.show()}else if(t=="day"){p.show()}else if(t=="week"){h.show();p.show()}else if(t=="month"){f.show();p.show()}else if(t=="year"){f.show();l.show();p.show()}});m.setValue(n.default_period);c.append(i.getText("text_mins"));g=x(c,n.multiple_mins);for(T=0,N=n.minutes;T');var o=e('');var u=e('');var a={};var f=[];var l=true;var c=t.getSettings().numeric_zero_pad;this.getValue=function(){return r?f:f[0]};this.getCronValue=function(){if(f.length==0)return"*";var e=[f[0]],t,n=f[0],r=f[0],i=f.length;for(t=1;t"+n+"");s.append(o);a[t]=o;o.click(function(){if(r&&e(this).hasClass("selected")){i.removeValue(t)}else{i.addValue(t);if(!r)i.close()}})};this.$=u;n.find("b:eq(0)").after(u).remove();u.addClass("jqCron-selector-"+n.find(".jqCron-selector").length).append(o).append(s).bind("selector:open",function(){if(l){var e=1,t=s.find("li").length;if(t>5&&t<=16)e=2;else if(t>16&&t<=23)e=3;else if(t>23&&t<=40)e=4;else if(t>40)e=5;s.addClass("cols"+e)}s.show()}).bind("selector:close",function(){s.hide()}).bind("selector:change",function(){o.html(i.getTitleText())}).click(function(e){e.stopPropagation()}).trigger("selector:change");e.fn.disableSelection&&u.disableSelection();o.click(function(e){i.isOpened()||t.isDisabled()?i.close():i.open()});i.close();i.clear()}this.jqCronSelector=t}).call(this,jQuery);(function(e){var t=0;var n=function(e){var n;while(1){t++;n=(e||"JQUID")+""+t;if(!document.getElementById(n))return n}};e.fn.uniqueId=function(t){return this.each(function(){if(e(this).attr("id"))return;var r=n(t);e(this).attr("id",r)})}}).call(this,jQuery);(function(e){e.extend(e.expr[":"],{container:function(e){return(e.tagName+"").toLowerCase()in{a:1,abbr:1,acronym:1,address:1,b:1,big:1,blockquote:1,button:1,cite:1,code:1,dd:1,del:1,dfn:1,div:1,dt:1,em:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,i:1,ins:1,kbd:1,label:1,li:1,p:1,pre:1,q:1,samp:1,small:1,span:1,strong:1,sub:1,sup:1,td:1,tt:1}},autoclose:function(e){return(e.tagName+"").toLowerCase()in{area:1,base:1,basefont:1,br:1,col:1,frame:1,hr:1,img:1,input:1,link:1,meta:1,param:1}}})}).call(this,jQuery)