/* * NTG Agenda * written by Hrodrigu * http://www.newtenberg.com * 2011-04-27 * GPL (GPL-LICENSE.txt) licenses. * * Built for jQuery library * http://jquery.com */ (function($){ $.fn.ntg_agenda = function(options){ // default configuration properties var defaults = { showCurrentMonth: true }; var options = $.extend(defaults, options); var allObjs = $(this); this.each(function(i){ var obj = $(this); $("th",obj).each( function(i){ $(this).text($(this).text().substring(0,1)); $(this).css("text-align","center"); }); $("br",obj).remove(); $("td",obj).each(function(i){ var celda = $(this); var eventosCelda = $(".evento",celda); if(eventosCelda.length > 0){ eventosCelda.wrapAll('<' + 'div class="dia" />'); var dia = $(".dia",celda); dia.prepend('<' +'a class="btncerrar" href="#">x'); eventosCelda.wrapAll('<' + 'div class="eventos" />'); $("div:eq(0)",celda).click(function(){ $(".dia",obj).not(dia).hide('fast'); dia.toggle('fast');} ).addClass("dia-con-eventos"); $(".btncerrar",celda).click(function(){ dia.hide('fast');}); } }); if(options.showCurrentMonth){ obj.hide(); obj.each(function(j){ if(i→'); if(i>0) $(this).prepend('<' + 'a href="#" class="anterior">←'); $("a.anterior",this).click(function(){ allObjs.hide().eq(i-1).show();}); $("a.siguiente",this).click(function(){ allObjs.hide().eq(i+1).show(); }); }); } }); if(options.showCurrentMonth){ var d= new Date(); allObjs.eq(d.getMonth()).show(); } }; })(jQuery);