Skip to content

Instantly share code, notes, and snippets.

@Serabe
Created November 18, 2012 02:35
Show Gist options
  • Save Serabe/4103051 to your computer and use it in GitHub Desktop.
Save Serabe/4103051 to your computer and use it in GitHub Desktop.
/**
* Función principal de inicialización del calendario de la home.
* Se encarga de inicializar todos los valores.
*/
var cargar_semanas = function(id){
// Averiguar anyo y mes actual
var date = $('#calendario_agenda').datepicker('getDate');
var year = $('#calendario_agenda .ui-datepicker-year option:selected').val();
var txt_month = $('#calendario_agenda .ui-datepicker-month').text();
var month = -1;
// Buscar en el bloque de html con los meses el id al que corresponde
$('#calendario_nombre_meses option').each(function(){
if($(this).text() == txt_month){
month = parseInt($(this).val());
}
});
// Fragmento que se encarga de sustituir los números de semana por flechas con enlace
$(id+' .ui-datepicker-week-col').each(function(){
// Sobreescribir texto antiguo por enlace con flecha y asociar accion onclick
$(this).html('<a href="#" class="calendar-week" onclick="calcularYMostrarSemana('+month+', '+year+'); return false;">&gt;</a>');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment