WP File Manager
Current Path:
/
home
/
argothem
/
www
/
organecyberpresse
/
plugins
/
auto
/
calendriermini
/
v4.1.1
/
javascript
/
Name
Action
..
calendrier_mini.js.html
Edit
jquery-ui.multidatespicker.js
Edit
Editing: calendrier_mini.js.html
#HTTP_HEADER{Content-type:text/javascript} if (!jQuery.fn.datepicker){ #INCLURE{prive/formulaires/dateur/bootstrap-datepicker.js} } [(#REM)<script>] var ajax_image_searching = "<img src='#CHEMIN{images/loader.svg}' width='32' height='32' />"; var minical = { options: { closeText: '<:bouton_fermer|texte_script:>', prevText: '<:precedent|texte_script:>', nextText: '<:suivant|texte_script:>', currentText: '<:date_aujourdhui|texte_script:>', clearText: '<:lien_supprimer|texte_script:>', monthNames: [ '<:date_mois_1|texte_script:>','<:date_mois_2|texte_script:>','<:date_mois_3|texte_script:>','<:date_mois_4|texte_script:>','<:date_mois_5|texte_script:>','<:date_mois_6|texte_script:>', '<:date_mois_7|texte_script:>','<:date_mois_8|texte_script:>','<:date_mois_9|texte_script:>','<:date_mois_10|texte_script:>','<:date_mois_11|texte_script:>','<:date_mois_12|texte_script:>'], monthNamesShort: [ '<:date_mois_1_abbr|texte_script:>','<:date_mois_2_abbr|texte_script:>','<:date_mois_3_abbr|texte_script:>','<:date_mois_4_abbr|texte_script:>','<:date_mois_5_abbr|texte_script:>','<:date_mois_6_abbr|texte_script:>', '<:date_mois_7_abbr|texte_script:>','<:date_mois_8_abbr|texte_script:>','<:date_mois_9_abbr|texte_script:>','<:date_mois_10_abbr|texte_script:>','<:date_mois_11_abbr|texte_script:>','<:date_mois_12_abbr|texte_script:>'], dayNames: [ '<:date_jour_1|texte_script:>','<:date_jour_2|texte_script:>','<:date_jour_3|texte_script:>','<:date_jour_4|texte_script:>', '<:date_jour_5|texte_script:>','<:date_jour_6|texte_script:>','<:date_jour_7|texte_script:>'], dayNamesShort: [ '<:date_jour_1_abbr|texte_script:>','<:date_jour_2_abbr|texte_script:>','<:date_jour_3_abbr|texte_script:>','<:date_jour_4_abbr|texte_script:>', '<:date_jour_5_abbr|texte_script:>','<:date_jour_6_abbr|texte_script:>','<:date_jour_7_abbr|texte_script:>'], dayNamesMin: [ '<:date_jour_1_initiale|texte_script:>','<:date_jour_2_initiale|texte_script:>','<:date_jour_3_initiale|texte_script:>','<:date_jour_4_initiale|texte_script:>', '<:date_jour_5_initiale|texte_script:>','<:date_jour_6_initiale|texte_script:>','<:date_jour_7_initiale|texte_script:>'], dateFormat: 'yy-mm-dd', firstDay: #CONFIG{calendriermini/jour1,1} }, add_tooltip_and_class: function($this,date,id,tooltip,className){ var new_day = false; if (!$this.tooltip) $this.tooltip = {}; if (!$this.cn) $this.cn = {}; var d = date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate(); if (!$this.tooltip[d]) { new_day = true; $this.tooltip[d] = {}; } tooltip = tooltip.replace(/"/g,'"'); // echapper les " pour ne pas casser le html (secu, supprimer le html en amont !) $this.tooltip[d][id] = tooltip; if (className && typeof className != "undefined"){ if (!$this.cn[d]) { $this.cn[d] = {}; } $this.cn[d][id] = className; } return new_day; }, set_events: function(me,start,end,data){ var dates = []; var $this = me.get(0); $this.tooltip = null; $this.cn = null; if (data.length){ var d,datebegin,dateend; for(var j=0;j<data.length;j++){ d = data[j].start.split(" "); d = d[0].split("-"); d = new Date(d[0],d[1]-1,d[2]); if (minical.add_tooltip_and_class($this,d,data[j].id,data[j].title,data[j].className)) { dates.push(d); } if(data[j].end){ /* prendre la plus grande date de debut entre debut a afficher et l'interval donne */ datebegin = Math.max(start * 1000,d.getTime()); d = data[j].end.split(" "); d = d[0].split("-"); d = new Date(d[0],d[1]-1,d[2]); /* prendre la plus petite date de fin entre fin a afficher et l'interval donne */ dateend = Math.min(end * 1000, d.getTime()); if (dateend>datebegin){ if (minical.add_tooltip_and_class($this,d,data[j].id,data[j].title,data[j].className)) { dates.push(d); } datebegin = datebegin+(3600*24*1000); while(datebegin < dateend){ d = new Date(datebegin); if (minical.add_tooltip_and_class($this,d,data[j].id,data[j].title,data[j].className)) { dates.push(d); } datebegin = datebegin+(3600*24*1000); } } } } var args = ['update'].concat(dates); jQuery.fn.datepicker.apply(me, args); $this.currentDates = dates; } }, before_show_day: function(date) { var d = date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate(); var c = {enabled:true, classes:''}; if (this.cn && this.cn[d]){ for (var i in this.cn[d]) c.classes += ' ' + this.cn[d][i]; } if (this.tooltip && this.tooltip[d]){ var glue = ''; c.tooltip = ''; for (var i in this.tooltip[d]) { c.tooltip += glue + this.tooltip[d][i]; glue = "\n"; } } return c; }, change_month_year: function(year, month, inst){ var me = inst; //console.log("change_month_year:"+year+"/"+month); if (typeof inst.input != "undefined") me = inst.input; //console.log(me); var t = new Date(year,month-1,1); t = parseInt(t.getTime()/1000); var start = t-7*24*3600; var end = t+38*24*3600; // stocker les year/month deja vus pour ne pas les recharger 2 fois quand on va et vient var o = me.get(0); if (typeof o.dateseen == "undefined") o.dateseen = {}; if (typeof o.dateseen[year+"/"+month] === "undefined"){ //console.log(o.dateseen); o.dateseen[year+"/"+month] = true; minical.show_loading(me); jQuery.ajax({ url:jQuery(me).attr("data-json"), data:{start:start,end:end}, success:function(data, textStatus, jqXHR){ data = eval(data); o.dateseen[year+"/"+month] = data; minical.set_events(me,start,end,data); minical.hide_loading(me); } }); } else { minical.set_events(me,start,end,o.dateseen[year+"/"+month]); } inst.currentDay=0; // annuler la date active : pas de sens ici }, show_loading : function(me){ me.animateLoading(); }, hide_loading : function(me) { me.endLoading(true); }, init : function(selecteur){ var options = minical.options; var lang = '[(#LANG|texte_script)]'; [(#CONFIG{calendriermini/format_jour,initiale}|=={abbr}|oui) minical.options.dayNamesMin = minical.options.dayNamesShort; ] if (typeof jQuery.fn.datepicker.dates !== "undefined"){ if (typeof jQuery.fn.datepicker.dates[lang]==="undefined"){ jQuery.fn.datepicker.dates[lang] = { days: options.dayNames, daysShort: options.dayNamesShort, daysMin: options.dayNamesMin, months: options.monthNames, monthsShort: options.monthNamesShort, today: options.currentText, clear: options.clearText, format: options.dateFormat.replace('yy', 'yyyy'), titleFormat: "MM yyyy", /* Leverages same syntax as 'format' */ weekStart: options.firstDay, rtl: [(#LANG_DIR|=={'rtl'}|?{true, false})] }; } options.language = lang; } jQuery(function(){ jQuery(selecteur).not('.loaded') .addClass('loaded') .each(function() { var me = jQuery(this); me.datepicker(jQuery.extend({},options, { multidate: true, updateViewDate: false, // se mettre a la date demandee (pour afficher le bon mois) defaultViewDate: me.attr('data-year')+"-"+me.attr('data-month')+"-1", beforeShowDay: function(date) { return minical.before_show_day.apply(me.get(0), [date]); } })) // initialiser le mois par defaut minical.change_month_year(me.attr('data-year'),me.attr('data-month'),me); }) .on('changeMonth', function(e) { var me = jQuery(e.target); minical.change_month_year(e.date.getFullYear(), e.date.getMonth()+1, me); }) .on('changeDate', minical.onChangeDate) .trigger('miniCalendarLoaded') .find(".alt").remove(); }); }, onChangeDate : function(e){ var me = jQuery(this); if (typeof this.currentDates === "undefined") { this.currentDates = []; } if (e.dates.length>this.currentDates.length) { // on a picke une date qui n'etait pas dans la liste, on peut ignorer // remettre l'affichage d'aplomb //console.log('added => IGNORED'); var args = ['update'].concat(this.currentDates); jQuery.fn.datepicker.apply(me, args); } else { //console.log('removed => on a clique'); // remettre l'affichage d'aplomb var args = ['update'].concat(this.currentDates); jQuery.fn.datepicker.apply(me, args); var dates = []; for (var i in e.dates) { dates.push(e.dates[i].getFullYear()+'-'+(e.dates[i].getMonth()+1)+'-'+e.dates[i].getDate()); } var datePicked; for (var i in this.currentDates) { var d = this.currentDates[i].getFullYear()+'-'+(this.currentDates[i].getMonth()+1)+'-'+this.currentDates[i].getDate(); if (dates.indexOf(d) === -1) { datePicked = d; var url = me.attr('data-url'); url = parametre_url(url,me.attr('data-vardate'),datePicked); //console.log("REDIRECT",url); window.location = url; } } } } }