Created
November 12, 2012 17:10
-
-
Save Serabe/4060578 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JavaScript Document | |
// Versión: 2.1 | |
// - Extiende la versión anterior añadiendo una columna con un enlace y una flecha | |
// en el lugar donde irían las semanas a los calendarios. | |
// - Añade clases para marcar días especiales con colores diferentes. | |
/** | |
* PARA CARGAR ATRIBUTO TITLE ALT EN LAS IM�?GENES DE LOS DESTACADOS DE LA HOME | |
*/ | |
function cargar_atr_destacados(){ | |
var alt1= $('#img_destacados1 img').eq(0).attr('alt'); | |
var alt2= $('#img_destacados2 img').eq(0).attr('alt'); | |
var alt3= $('#img_destacados3 img').eq(0).attr('alt'); | |
var alt4= $('#img_destacados4 img').eq(0).attr('alt'); | |
var alt5= $('#img_destacados5 img').eq(0).attr('alt'); | |
$('#img_destacados1 img').eq(0).attr('title',alt1); | |
$('#img_destacados1 img').eq(1).attr('alt', alt1); | |
$('#img_destacados1 img').eq(1).attr('title',alt1); | |
$('#img_destacados1 img').eq(2).attr('alt',alt1); | |
$('#img_destacados1 img').eq(2).attr('title',alt1); | |
$('#img_destacados2 img').eq(0).attr('title',alt2); | |
$('#img_destacados2 img').eq(1).attr('alt', alt2); | |
$('#img_destacados2 img').eq(1).attr('title',alt2); | |
$('#img_destacados2 img').eq(2).attr('alt',alt2); | |
$('#img_destacados2 img').eq(2).attr('title',alt2); | |
$('#img_destacados3 img').eq(0).attr('title',alt3); | |
$('#img_destacados3 img').eq(1).attr('alt', alt3); | |
$('#img_destacados3 img').eq(1).attr('title',alt3); | |
$('#img_destacados3 img').eq(2).attr('alt',alt3); | |
$('#img_destacados3 img').eq(2).attr('title',alt3); | |
$('#img_destacados4 img').eq(0).attr('title',alt4); | |
$('#img_destacados4 img').eq(1).attr('alt', alt4); | |
$('#img_destacados4 img').eq(1).attr('title',alt4); | |
$('#img_destacados4 img').eq(2).attr('alt',alt4); | |
$('#img_destacados4 img').eq(2).attr('title',alt4); | |
$('#img_destacados5 img').eq(0).attr('title',alt5); | |
$('#img_destacados5 img').eq(1).attr('alt', alt5); | |
$('#img_destacados5 img').eq(1).attr('title',alt5); | |
$('#img_destacados5 img').eq(2).attr('alt',alt5); | |
$('#img_destacados5 img').eq(2).attr('title',alt5); | |
} | |
function selectCharge(select){ | |
var selectVar = document.getElementById('fs_seleciona_orden'); | |
if(selectVar!=null){ | |
if(select.value=='actual'){ | |
selectVar.style.display = 'none'; | |
}else{ | |
selectVar.style.display = 'inline'; | |
} | |
} | |
} | |
// FUNCIONES PARA EL CALENDARIO | |
/** | |
* Conjunto de variables globales que se utilizarán para los diferentes calendarios del portal. | |
* Utilizar estos valores en lugar de escribirlos directamente en la función de inicialización, | |
* para evitar ante un cambio de requisitos tener que cambiar todos los valores uno a uno. | |
* Se cambian aqui y el resto se actualizan con el valor indicado directamente. | |
*/ | |
function inicializarVariablesGenerales(){ | |
// No lleva el var por eso son globales | |
globales = { | |
monthNames: [$('#calendario_nombre_meses option').eq(0).text(), | |
$('#calendario_nombre_meses option').eq(1).text(), | |
$('#calendario_nombre_meses option').eq(2).text(), | |
$('#calendario_nombre_meses option').eq(3).text(), | |
$('#calendario_nombre_meses option').eq(4).text(), | |
$('#calendario_nombre_meses option').eq(5).text(), | |
$('#calendario_nombre_meses option').eq(6).text(), | |
$('#calendario_nombre_meses option').eq(7).text(), | |
$('#calendario_nombre_meses option').eq(8).text(), | |
$('#calendario_nombre_meses option').eq(9).text(), | |
$('#calendario_nombre_meses option').eq(10).text(), | |
$('#calendario_nombre_meses option').eq(11).text() | |
], | |
resultAjax: new Array(31), | |
dateFormat: 'ddmmyy', | |
firstDay: 1, | |
currentText: [$('#calendario_boton_hoy option').eq(0).text()], | |
showOtherMonths: true, | |
prevText: $('#prevText').text(), | |
nextText: $('#nextText').text(), | |
urlCal: $('#urlCalendario').text(), | |
urlCalPleno: $('#urlCalendarioPleno').text(), | |
prParam : $('#prParam').text(), | |
semanaSelecParam : $('#semanaSelecParam').text(), | |
showWeek: true, | |
hoy: new Date(), | |
widgetDateFormat: 'dd/mm/yy', | |
dayNamesMin: [$('#calendario_dias_min option').eq(0).text(), | |
$('#calendario_dias_min option').eq(1).text(), | |
$('#calendario_dias_min option').eq(2).text(), | |
$('#calendario_dias_min option').eq(3).text(), | |
$('#calendario_dias_min option').eq(4).text(), | |
$('#calendario_dias_min option').eq(5).text(), | |
$('#calendario_dias_min option').eq(6).text() | |
], | |
buttonImage: "/web/images/ico_calendar.gif", | |
buttonImageOnly: true, | |
changeYear: true | |
} | |
} | |
// FUNCIONES PRINCIPALES DE INICIALIZACIÓN | |
/** | |
* Función principal de inicialización del calendario de la home. | |
* Se encarga de inicializar todos los valores. | |
*/ | |
function cargar_semanas(id){ | |
// Fragmento que se encarga de sustituir los números de semana por flechas con enlace | |
$(id+' .ui-datepicker-week-col').each(function(){ | |
// Averiguar anyo y mes actual | |
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()); | |
} | |
}); | |
// Sobreescribir texto antiguo por enlace con flecha y asociar accion onclick | |
$(this).html('<a href="#" class="calendar-week" onclick="calcularYMostrarSemana('+month+', '+year+'); return false;">></a>'); | |
}); | |
} | |
function cargar_skin(id){ | |
clearTimeout(t); | |
var t = setTimeout("$('#"+id+" .cargar_skin').select_skin()", 1); | |
} | |
function inicializarCalendarioHome(y, m){ | |
actual= new Date(); | |
dia = actual.getDate(); | |
diaMinimo = new Date(document.getElementById("iniCalHome").value); | |
diaMaximo = new Date(document.getElementById("finCalHome").value); | |
$('#calendario_home').datepicker({ | |
changeYear: globales.changeYear, | |
onSelect: function(dateText, inst, pleno) { | |
// actividades_agenda es una capa que sólo existe cuando hay que | |
// refrescar información al pulsar un día | |
var divActividades = document.getElementById("actividades_agenda"); | |
if(divActividades!=null){ | |
// Hay que refrescar | |
//listActivities(ddmmyyy,week,aFilter (en este caso dia)); | |
listActivities(dateText,'','d'); | |
}else{ | |
// No hay que refrescar | |
// urlCal contiene la URL a la que hay que ir al pinchar un día | |
// id es un parametro | |
if(pleno[parseInt(dateText.substring(0,2))]=='S'){ | |
window.location = globales.urlCalPleno+'?id='+dateText+'&aFilter=d'; | |
}else{ | |
window.location = globales.urlCal+'?id='+dateText+'&aFilter=d'; | |
} | |
} | |
}, | |
monthNames: globales.monthNames, | |
changeMonth: true, | |
monthNamesShort: globales.monthNames, | |
firstDay: globales.firstDay, | |
dateFormat: globales.dateFormat, | |
showOtherMonths: globales.showOtherMonths, | |
prevText: globales.prevText, | |
nextText: globales.nextText, | |
showWeek: globales.showWeek, | |
minDate: diaMinimo, | |
maxDate: diaMaximo, | |
/* | |
onChangeMonthYear: function(year, month, inst){ | |
cargar_skin(inst.id); | |
setTimeout("cargar_semanas('#calendario_agenda');", 1); | |
}, | |
*/ | |
onChangeMonthYear: function(year, month, inst){ | |
$('#calendario_home').remove(); | |
$('.calendario').append('<div id="calendario_home"> </div>'); | |
inicializarCalendarioHome(year, month); | |
}, | |
defaultDate: mesInicial(y, m,null), | |
beforeShowDay: function(day){ | |
// TODO: SUSTITUIR LOS DIAS ESCRITOS A FUEGO POR LOS QUE CORRESPONDAN | |
/* Este fragmento de código añade una clase a cada uno de los días seleccionados. | |
* En el ejemplo el día 5 del mes 8 tiene la clase hay_plenaria, y el día 10 del mes 8 tiene | |
* la clase evento_general el resto de días de ese mes tendrán la clase dia_general. | |
* Para el mes 9: el día 6 tiene la clase hay_plenaria, el día 20 tiene la clase evento_general | |
* y el resto de días tienen la clase dia_general. | |
* Cuidado con los años que también hay que tenerlos en cuenta. | |
* | |
* Algoritmo: | |
* Recoger en un AJAX los días que tengan alguna circunstancia especial, (evento, plenaria ...), | |
* recorrer los días devueltos y asignarles la clase de la forma 'return [true, 'hay_plenaria']'. | |
* Dejar siempre una clase general para los días normales. | |
* El primer parámetro, en este caso true, indica si el día se encuentra activo o no. | |
* | |
* ROCIO | |
*/ | |
var dia = day.getDate()-1; | |
var mes = day.getMonth()+1; | |
var anyo = day.getFullYear(); | |
/*if((dia == 5 && mes == 10 && anyo == 2011) || (dia == 6 && mes == 11 && anyo == 2011)){ | |
return [true, 'hay_plenaria'] | |
} else if((dia == 10 && mes == 10 && anyo == 2011) || (dia == 20 && mes == 11 && anyo == 2011)){ | |
return [true, 'evento_general'] | |
} else if(dia == 17 && mes == 10 && anyo == 2011) { | |
return [true, 'hay_plenaria_evento'] | |
} else{ | |
return [true, 'dia_general'] | |
}*/ | |
if(req.responseXML!=null){ | |
if(req.responseXML.childNodes[0].childNodes[dia].childNodes[0].nodeValue=='Empty'){ | |
return [true, 'dia_general'] | |
} else if(req.responseXML.childNodes[0].childNodes[dia].childNodes[0].nodeValue=='Activity'){ | |
return [true, 'evento_general'] | |
} else if(req.responseXML.childNodes[0].childNodes[dia].childNodes[0].nodeValue.indexOf('Activity')==0){ | |
return [true, 'hay_plenaria_evento'] | |
}else{ | |
return [true, 'hay_plenaria'] | |
} | |
}else{ | |
return[false,''] | |
} | |
} | |
}); | |
// Fragmento que se encarga de sustituir los números de semana por flechas con enlace | |
/*$('#calendario_home .ui-datepicker-week-col').each(function(){ | |
// Recoger número semana | |
var semana = $(this).text(); | |
$(this).attr('id', 'sem-'+semana); | |
// Sobreescribir texto antiguo por enlace con flecha | |
// TODO: PONER AQUI ENLACE CORRECTO. ROCIO | |
$(this).html('<a href="http://www.google.com?'+semana+'" class="calendar-week">></a>'); | |
}); | |
*/ | |
// cargar_skin("calendario_home"); | |
} | |
function inicializarCalendarioPresidente(y, m){ | |
actual= new Date(); | |
dia = actual.getDate(); | |
diaMinimo = new Date(document.getElementById("iniCalPresi").value); | |
diaMaximo = new Date(document.getElementById("finCalPresi").value); | |
$('#calendario_presidente').datepicker({ | |
changeYear: globales.changeYear, | |
onSelect: function(dateText, inst, pleno) { | |
// actividades_agenda es una capa que sólo existe cuando hay que | |
// refrescar información al pulsar un día | |
var divAgendaPresi = document.getElementById("calendario_presidente"); | |
if(divAgendaPresi!=null){ | |
// Hay que refrescar | |
//listActivities(ddmmyyy,week,aFilter (en este caso dia)); | |
listActivities(dateText,'','d'); | |
// Hacer que se seleccione el dia pulsado | |
var idCasillaCalSel = 'cal_ag_'+ parseInt(dateText.substring(0,2),10); | |
for(var i=1;i<=31;i++){ | |
if(parseInt(dateText.substring(0,2),10) == parseInt(i,10)){ | |
casillaHoy = document.getElementById(idCasillaCalSel); | |
if(casillaHoy!=null){ | |
casillaHoy.setAttribute("class"," day-sel-today "); | |
} | |
}else{ | |
casillaHoy = document.getElementById('cal_ag_'+ i); | |
if(casillaHoy!=null){ | |
casillaHoy.setAttribute("class",""); | |
} | |
} | |
} | |
}else{ | |
// No hay que refrescar | |
// urlCal contiene la URL a la que hay que ir al pinchar un día | |
// id es un parametro | |
if(pleno[parseInt(dateText.substring(0,2))]=='S'){ | |
window.location = globales.urlCalPleno+'?id='+dateText+'&aFilter=d'; | |
}else{ | |
window.location = globales.urlCal+'?id='+dateText+'&aFilter=d'; | |
} | |
} | |
}, | |
monthNames: globales.monthNames, | |
changeMonth: true, | |
monthNamesShort: globales.monthNames, | |
firstDay: globales.firstDay, | |
dateFormat: globales.dateFormat, | |
showOtherMonths: globales.showOtherMonths, | |
prevText: globales.prevText, | |
nextText: globales.nextText, | |
showWeek: globales.showWeek, | |
minDate: diaMinimo, | |
maxDate: diaMaximo, | |
showButtonPanel: true, | |
currentText: globales.currentText, | |
onChangeMonthYear: function(year, month, inst){ | |
$('#calendario_presidente').remove(); | |
$('.calendario').append('<div id="calendario_presidente"> </div>'); | |
inicializarCalendarioPresidente(year, month); | |
}, | |
defaultDate: mesInicial(y, m, null), | |
beforeShowDay: function(day){ | |
// TODO: SUSTITUIR LOS DIAS ESCRITOS A FUEGO POR LOS QUE CORRESPONDAN | |
/* Este fragmento de código añade una clase a cada uno de los días seleccionados. | |
* En el ejemplo el día 5 del mes 8 tiene la clase hay_plenaria, y el día 10 del mes 8 tiene | |
* la clase evento_general el resto de días de ese mes tendrán la clase dia_general. | |
* Para el mes 9: el día 6 tiene la clase hay_plenaria, el día 20 tiene la clase evento_general | |
* y el resto de días tienen la clase dia_general. | |
* Cuidado con los años que también hay que tenerlos en cuenta. | |
* | |
* Algoritmo: | |
* Recoger en un AJAX los días que tengan alguna circunstancia especial, (evento, plenaria ...), | |
* recorrer los días devueltos y asignarles la clase de la forma 'return [true, 'hay_plenaria']'. | |
* Dejar siempre una clase general para los días normales. | |
* El primer parámetro, en este caso true, indica si el día se encuentra activo o no. | |
* | |
* ROCIO | |
*/ | |
var dia = day.getDate()-1; | |
var mes = day.getMonth()+1; | |
var anyo = day.getFullYear(); | |
/*if((dia == 5 && mes == 10 && anyo == 2011) || (dia == 6 && mes == 11 && anyo == 2011)){ | |
return [true, 'hay_plenaria'] | |
} else if((dia == 10 && mes == 10 && anyo == 2011) || (dia == 20 && mes == 11 && anyo == 2011)){ | |
return [true, 'evento_general'] | |
} else if(dia == 17 && mes == 10 && anyo == 2011) { | |
return [true, 'hay_plenaria_evento'] | |
} else{ | |
return [true, 'dia_general'] | |
}*/ | |
if(req.responseXML!=null){ | |
if(req.responseXML.childNodes[0].childNodes[dia].childNodes[0].nodeValue=='Empty'){ | |
return [true, 'dia_general'] | |
} else if(req.responseXML.childNodes[0].childNodes[dia].childNodes[0].nodeValue=='President'){ | |
// Hay un evento de tipo Agenda del presidente | |
return [true, 'evento_general'] | |
}else{ | |
return [true, 'dia_general'] | |
} | |
}else{ | |
return[false,''] | |
} | |
} | |
}); | |
// Fragmento que se encarga de sustituir los números de semana por flechas con enlace | |
/*$('#calendario_home .ui-datepicker-week-col').each(function(){ | |
// Recoger número semana | |
var semana = $(this).text(); | |
$(this).attr('id', 'sem-'+semana); | |
// Sobreescribir texto antiguo por enlace con flecha | |
// TODO: PONER AQUI ENLACE CORRECTO. ROCIO | |
$(this).html('<a href="http://www.google.com?'+semana+'" class="calendar-week">></a>'); | |
}); | |
*/ | |
} | |
/** | |
* Función principal de inicialización del calendario de la home. | |
* Se encarga de inicializar todos los valores. | |
*/ | |
function inicializarCalendarioAgenda(y, m){ | |
actual= new Date(); | |
dia = actual.getDate(); | |
diaMinimo = new Date(document.getElementById("iniCalActi").value); | |
diaMaximo = new Date(document.getElementById("finCalActi").value); | |
$('#calendario_agenda').datepicker({ | |
changeYear: globales.changeYear, | |
onSelect: function(dateText, inst, pleno) { | |
// actividades_agenda es una capa que sólo existe cuando hay que | |
// refrescar información al pulsar un día | |
var divActividades = document.getElementById("actividades_agenda"); | |
if(divActividades!=null){ | |
// Hay que refrescar | |
//listActivities(ddmmyyy,week,aFilter (en este caso dia)); | |
listActivities(dateText,'','d'); | |
// Hacer que se seleccione el dia pulsado | |
var idCasillaCalSel = 'cal_ag_'+ parseInt(dateText.substring(0,2),10); | |
for(var i=1;i<=31;i++){ | |
if(parseInt(dateText.substring(0,2),10) == parseInt(i,10)){ | |
casillaHoy = document.getElementById(idCasillaCalSel); | |
if(casillaHoy!=null){ | |
casillaHoy.setAttribute("class"," day-sel-today "); | |
} | |
}else{ | |
casillaHoy = document.getElementById('cal_ag_'+ i); | |
if(casillaHoy!=null){ | |
casillaHoy.setAttribute("class",""); | |
} | |
} | |
} | |
}else{ | |
// No hay que refrescar | |
// urlCal contiene la URL a la que hay que ir al pinchar un día | |
// id es un parametro | |
if(pleno[parseInt(dateText.substring(0,2))]=='S'){ | |
window.location = globales.urlCalPleno+'?id='+dateText+'&aFilter=d'; | |
}else{ | |
window.location = globales.urlCal+'?id='+dateText+'&aFilter=d'; | |
} | |
} | |
}, | |
monthNames: globales.monthNames, | |
changeMonth: true, | |
monthNamesShort: globales.monthNames, | |
firstDay: globales.firstDay, | |
dateFormat: globales.dateFormat, | |
showOtherMonths: globales.showOtherMonths, | |
prevText: globales.prevText, | |
nextText: globales.nextText, | |
showWeek: globales.showWeek, | |
minDate: diaMinimo, | |
maxDate: diaMaximo, | |
showButtonPanel: true, | |
currentText: globales.currentText, | |
/* | |
onChangeMonthYear: function(year, month, inst){ | |
cargar_skin(inst.id); | |
setTimeout("cargar_semanas('#calendario_agenda');", 1); | |
}, | |
*/ | |
onChangeMonthYear: function(year, month, inst){ | |
$('#calendario_agenda').remove(); | |
$('.calendario').append('<div id="calendario_agenda"> </div>'); | |
inicializarCalendarioAgenda(year, month); | |
}, | |
defaultDate: mesInicial(y, m, null), | |
beforeShowDay: function(day){ | |
// TODO: SUSTITUIR LOS DIAS ESCRITOS A FUEGO POR LOS QUE CORRESPONDAN | |
/* Este fragmento de código añade una clase a cada uno de los días seleccionados. | |
* En el ejemplo el día 5 del mes 8 tiene la clase hay_plenaria, y el día 10 del mes 8 tiene | |
* la clase evento_general el resto de días de ese mes tendrán la clase dia_general. | |
* Para el mes 9: el día 6 tiene la clase hay_plenaria, el día 20 tiene la clase evento_general | |
* y el resto de días tienen la clase dia_general. | |
* Cuidado con los años que también hay que tenerlos en cuenta. | |
* | |
* Algoritmo: | |
* Recoger en un AJAX los días que tengan alguna circunstancia especial, (evento, plenaria ...), | |
* recorrer los días devueltos y asignarles la clase de la forma 'return [true, 'hay_plenaria']'. | |
* Dejar siempre una clase general para los días normales. | |
* El primer parámetro, en este caso true, indica si el día se encuentra activo o no. | |
* | |
* ROCIO | |
*/ | |
var dia = day.getDate()-1; | |
var mes = day.getMonth()+1; | |
var anyo = day.getFullYear(); | |
/*if((dia == 5 && mes == 10 && anyo == 2011) || (dia == 6 && mes == 11 && anyo == 2011)){ | |
return [true, 'hay_plenaria'] | |
} else if((dia == 10 && mes == 10 && anyo == 2011) || (dia == 20 && mes == 11 && anyo == 2011)){ | |
return [true, 'evento_general'] | |
} else if(dia == 17 && mes == 10 && anyo == 2011) { | |
return [true, 'hay_plenaria_evento'] | |
} else{ | |
return [true, 'dia_general'] | |
}*/ | |
if(req.responseXML!=null){ | |
if(req.responseXML.childNodes[0].childNodes[dia].childNodes[0].nodeValue=='Empty'){ | |
return [true, 'dia_general'] | |
} else if(req.responseXML.childNodes[0].childNodes[dia].childNodes[0].nodeValue=='Activity'){ | |
return [true, 'evento_general'] | |
} else if(req.responseXML.childNodes[0].childNodes[dia].childNodes[0].nodeValue.indexOf('Activity')==0){ | |
return [true, 'hay_plenaria_evento'] | |
}else{ | |
return [true, 'hay_plenaria'] | |
} | |
}else{ | |
return[false,''] | |
} | |
} | |
}); | |
// Fragmento que se encarga de sustituir los números de semana por flechas con enlace | |
/*$('#calendario_home .ui-datepicker-week-col').each(function(){ | |
// Recoger número semana | |
var semana = $(this).text(); | |
$(this).attr('id', 'sem-'+semana); | |
// Sobreescribir texto antiguo por enlace con flecha | |
// TODO: PONER AQUI ENLACE CORRECTO. ROCIO | |
$(this).html('<a href="http://www.google.com?'+semana+'" class="calendar-week">></a>'); | |
}); | |
*/ | |
// cargar_skin("calendario_home"); | |
} | |
/** Inicializar el calendario que pinta si hay bocg en los dias | |
* | |
* */ | |
function inicializarCalendarioBocg(y, m){ | |
$('#calendario_bocg').datepicker({ | |
changeYear: globales.changeYear, | |
onSelect: function(dateText, inst) { | |
// urlCal contiene la URLSeccion a la que hay que ir al pinchar un día | |
// id es un parametro que contiene la fecha en formato DDMMAA | |
window.location = globales.urlCal +'?id='+dateText+'&aFilter=d'; | |
}, | |
monthNames: globales.monthNames, | |
firstDay: globales.firstDay, | |
changeMonth: true, | |
monthNamesShort: globales.monthNames, | |
dateFormat: globales.dateFormat, | |
showOtherMonths: globales.showOtherMonths, | |
prevText: globales.prevText, | |
nextText: globales.nextText, | |
minDate: new Date (1977,6,1), | |
maxDate: new Date ((globales.hoy.getFullYear()+1),11,31), | |
showWeek: true, | |
onChangeMonthYear: function(year, month, inst){ | |
$('#calendario_bocg').remove(); | |
$('.calendario').append('<div id="calendario_bocg"> </div>'); | |
inicializarCalendarioBocg(year, month); | |
}, | |
defaultDate: mesInicialSeleccionado(y,m), | |
beforeShowDay: function(day){ | |
var dia = day.getDate()-1; | |
var mes = day.getMonth()+1; | |
var anyo = day.getFullYear(); | |
if(req.responseXML!=null){ | |
if(req.responseXML.childNodes[0].childNodes[dia].childNodes[0].nodeValue=='Empty'){ | |
return [true, 'dia_general'] | |
} else if(req.responseXML.childNodes[0].childNodes[dia].childNodes[0].nodeValue=='bocg'){ | |
return [true, 'evento_general'] | |
} | |
}else{ | |
return[false,''] | |
} | |
} | |
}); | |
} | |
/** | |
* Inicializar calendario que pinta si hay diario de sesiones en los dias del mes | |
*/ | |
function inicializarCalendarioDiarioSesiones(y, m){ | |
$('#calendario_diario_sesiones').datepicker({ | |
changeYear: globales.changeYear, | |
onSelect: function(dateText, inst) { | |
// urlCal contiene la URLSeccion a la que hay que ir al pinchar un día | |
// id es un parametro que contiene la fecha en formato DDMMAA | |
window.location = globales.urlCal +'?id='+dateText+'&aFilter=d'; | |
}, | |
monthNames: globales.monthNames, | |
changeMonth: true, | |
monthNamesShort: globales.monthNames, | |
firstDay: globales.firstDay, | |
dateFormat: globales.dateFormat, | |
showOtherMonths: globales.showOtherMonths, | |
prevText: globales.prevText, | |
nextText: globales.nextText, | |
showWeek: true, | |
onChangeMonthYear: function(year, month, inst){ | |
$('#calendario_diario_sesiones').remove(); | |
$('.calendario').append('<div id="calendario_diario_sesiones"> </div>'); | |
inicializarCalendarioDiarioSesiones(year, month); | |
}, | |
defaultDate: mesInicialSeleccionado(y,m), | |
beforeShowDay: function(day){ | |
var dia = day.getDate()-1; | |
var mes = day.getMonth()+1; | |
var anyo = day.getFullYear(); | |
if(req.responseXML!=null){ | |
if(req.responseXML.childNodes[0].childNodes[dia].childNodes[0].nodeValue=='Empty'){ | |
return [true, 'dia_general'] | |
} else if(req.responseXML.childNodes[0].childNodes[dia].childNodes[0].nodeValue=='ds'){ | |
return [true, 'evento_general'] | |
} | |
}else{ | |
return[false,''] | |
} | |
} | |
}); | |
} | |
/** | |
* Funcion que se encarga de cargar un calendario que pase por id una fecha en | |
* formato DDMMAAA | |
* | |
*/ | |
function inicializarCalendarioGenerico(y, m){ | |
$('#calendario_generico').datepicker({ | |
onSelect: function(dateText, inst) { | |
// urlCal contiene la URLSeccion a la que hay que ir al pinchar un día | |
// id es un parametro que contiene la fecha en formato DDMMAA | |
window.location = globales.urlCal +'?id='+dateText; | |
}, | |
monthNames: globales.monthNames, | |
firstDay: globales.firstDay, | |
dateFormat: globales.dateFormat, | |
showOtherMonths: globales.showOtherMonths, | |
prevText: globales.prevText, | |
nextText: globales.nextText, | |
showWeek: false, | |
onChangeMonthYear: function(year, month, inst){ | |
$('#calendario_generico').remove(); | |
$('.calendario').append('<div id="calendario_generico"> </div>'); | |
inicializarCalendarioGenerico(year, month); | |
}, | |
defaultDate: mesInicial(y, m, null), | |
beforeShowDay: function(day){ | |
var dia = day.getDate()-1; | |
var mes = day.getMonth()+1; | |
var anyo = day.getFullYear(); | |
return [true, 'dia_general'] | |
} | |
}); | |
} | |
///////////////////////////////////////////////////////////////////////// | |
function mesInicialSeleccionado(y,m){ | |
if(globales.prParam!=null && globales.prParam!=''){ | |
return (new Date(globales.prParam.substring(4,8), globales.prParam.substring(2,4)-1, globales.prParam.substring(0,2))); | |
//alert(':::::'+globales.prParam.substring(4,8)+"-"+globales.prParam.substring(2,4)+'-'+globales.prParam.substring(0,2)); | |
}else{ | |
return mesInicial(y, m, null); | |
} | |
} | |
function mesInicial(nuevo_anyo, nuevo_mes, tipoCal){ | |
var act_anyo = globales.hoy.getFullYear(); | |
var act_mes = globales.hoy.getMonth()+1; | |
var distancia_meses = '+0m'; | |
var distancia_anyos = '+0y'; | |
// Calcular el salto en meses | |
if(nuevo_mes > act_mes){ | |
distancia_meses = '+'+(nuevo_mes - act_mes)+'m'; | |
} else if(nuevo_mes < act_mes){ | |
distancia_meses = (nuevo_mes - act_mes)+'m'; | |
} | |
// Calcular el salto en años | |
if(nuevo_anyo > act_anyo){ | |
distancia_anyos = '+'+(nuevo_anyo - act_anyo)+'y'; | |
} else if(nuevo_anyo < act_anyo){ | |
distancia_anyos = (nuevo_anyo - act_anyo)+'y'; | |
} | |
return distancia_meses+distancia_anyos; | |
} | |
function inicializarCalendarioWidget(label){ | |
inicializarVariablesGenerales(); | |
$('#'+label+' input').datepicker({ | |
showOn: "button", | |
buttonImage: globales.buttonImage, | |
buttonImageOnly: globales.buttonImageOnly, | |
monthNames: globales.monthNames, | |
firstDay: globales.firstDay, | |
dateFormat: globales.widgetDateFormat, | |
showOtherMonths: globales.showOtherMonths, | |
prevText: globales.prevText, | |
nextText: globales.nextText, | |
dayNamesMin: globales.dayNamesMin, | |
changeYear: globales.changeYear, | |
beforeShow: function(input, inst){ cargar_skin(inst.dpDiv.attr('id')) }, | |
onChangeMonthYear: function(year, month, inst){cargar_skin(inst.dpDiv.attr('id'))} | |
}); | |
$('#'+label+' .ui-datepicker-trigger').attr('id', label+'_widget'); | |
} | |
function inicializarCalendarios1977(inicio, fin){ | |
inicializarVariablesGenerales(); | |
var dates = $("#lb_fecha_primera, #lb_fecha_segunda").datepicker({ | |
showOn: "button", | |
buttonImage: globales.buttonImage, | |
buttonImageOnly: globales.buttonImageOnly, | |
monthNames: globales.monthNames, | |
firstDay: globales.firstDay, | |
dateFormat: globales.widgetDateFormat, | |
showOtherMonths: globales.showOtherMonths, | |
prevText: globales.prevText, | |
nextText: globales.nextText, | |
dayNamesMin: globales.dayNamesMin, | |
onSelect: function( selectedDate ) { | |
var option = this.id == "lb_fecha_primera" ? "minDate" : "maxDate", | |
instance = $( this ).data( "datepicker" ), | |
date = $.datepicker.parseDate( | |
instance.settings.dateFormat || | |
$.datepicker._defaults.dateFormat, | |
selectedDate, instance.settings ); | |
dates.not( this ).datepicker( "option", option, date ); | |
$(this).datepicker("hide"); | |
}, | |
changeYear: globales.changeYear, | |
changeMonth: true, | |
monthNamesShort: globales.monthNames, | |
beforeShow: function(input, inst){ cargar_skin(inst.dpDiv.attr('id')) }, | |
onChangeMonthYear: function(year, month, inst){ /*cargar_skin(inst.dpDiv.attr('id')) inicializarCalendarios1977(year, month); */cargar_skin(inst.dpDiv.attr('id'));} | |
}); | |
$('#'+inicio+' .ui-datepicker-trigger').attr('id', inicio+'_widget'); | |
$('#'+fin+' .ui-datepicker-trigger').attr('id', fin+'_widget'); | |
} | |
function mapaInteractivo(){ | |
$('#Map area').mouseover(function(){ | |
$('#over-'+$(this).attr('id')).css('display', 'block'); | |
}).mouseout(function(){ | |
$('#over-'+$(this).attr('id')).css('display', 'none'); | |
}); | |
} | |
function mapaInteractivo2(){ | |
$('#Map2 area').mouseover(function(){ | |
$('#over-'+$(this).attr('id')).css('display', 'block'); | |
}).mouseout(function(){ | |
$('#over-'+$(this).attr('id')).css('display', 'none'); | |
}) | |
} | |
// Genera el comportamiento dinámico de las pestañas de la ficha del senador | |
function pestanyasInformacionSenador(){ | |
$("#cabecera_informacion_senador td").each(function(){ | |
$(this).click(function(e){ | |
e.preventDefault(); | |
if($(this).attr('class') == "no_active_pes") | |
activarPestanyaInformacionSenador($(this).attr('id')); | |
}); | |
}); | |
} | |
function activarPestanyaInformacionSenador(id_nuevo){ | |
// El elemento que está marcado como activo lo ponemos como desactivo | |
$('.active_pes').addClass('no_active_pes'); | |
$('.active_pes').removeClass('active_pes'); | |
// Quitar la clase no_active_pes al id actual y ponerle active_pes | |
$('#'+id_nuevo).removeClass('no_active_pes'); | |
$('#'+id_nuevo).addClass('active_pes'); | |
// Ocultar bloque de contenido actual | |
$('.activo_pestania').addClass('no_activo_pestania'); | |
$('.activo_pestania').removeClass('activo_pestania'); | |
// Mostrar el nuevo | |
var s_id = id_nuevo.split('-'); | |
$('#'+s_id[1]).addClass('activo_pestania'); | |
$('#'+s_id[1]).removeClass('no_activo_pestania'); | |
} | |
function MostrarDialog() { | |
$('#dialog').dialog( 'option', 'position', 'center' ); | |
// $('#dialog').dialog('option', 'modal', true).dialog('open'); | |
$('#dialog').dialog('option', 'modal', true); | |
$('#dialog').dialog('open'); | |
return true; | |
} | |
function MostrarDialogPolitica() { | |
$('#dialog_politica').dialog( 'option', 'position', 'center' ); | |
// $('#dialog').dialog('option', 'modal', true).dialog('open'); | |
$('#dialog_politica').dialog('option', 'modal', true); | |
$('#dialog_politica').dialog('open'); | |
return true; | |
} | |
function MostrarDialogCVE() { | |
$('#dialog_cve').dialog( 'option', 'position', 'center' ); | |
// $('#dialog').dialog('option', 'modal', true).dialog('open'); | |
$('#dialog_cve').dialog('option', 'modal', true); | |
$('#dialog_cve').dialog('open'); | |
return true; | |
} | |
function calcularYMostrarSemana(selectedMonth, selectedYear){ | |
// Calcular día de inicio y fin de la semana | |
// Recorre la fila que contiene al día seleccionado mostrando los valores de i=1 e i=7 lunes y domingo | |
var tr = $('#calendario_agenda .ui-state-hover').parent().parent().children(); | |
var lunes = 0; | |
var domingo = 0; | |
var mes_lunes = 0; | |
var mes_domingo = 0; | |
var primer_lunes = 0; | |
var ultimo_domingo = 0; | |
var anyo_lunes = selectedYear; | |
var anyo_domingo = selectedYear; | |
var i = 0; | |
var j = 0; | |
// Buscar primera y última semana | |
var n_filas = $('#calendario_agenda .ui-datepicker-calendar tr').size()-1; | |
$('#calendario_agenda .ui-datepicker-calendar tr').each(function(){ | |
// Estoy en la primera semana necesito el lunes | |
if(j == 1){ | |
var l = 0; | |
$(this).children().each(function(){ | |
// Estoy recorriendo los td de la fila quiero el l == 1 | |
if(l == 1){ | |
primer_lunes = $(this).text(); | |
} | |
l++; | |
}); | |
} | |
else if(j == n_filas){ | |
var l = 0; | |
$(this).children().each(function(){ | |
// Estoy recorriendo la última fila quiero el último día l == 7 | |
if(l == 7){ | |
ultimo_domingo = $(this).text(); | |
} | |
l++; | |
}); | |
} | |
j++; | |
}); | |
// Buscar primer y último día | |
$(tr).each(function(){ | |
if(i == 1){ | |
lunes = $(this).text(); | |
if(!$(this).hasClass('ui-datepicker-other-month')) | |
mes_lunes = parseInt(selectedMonth)+1; | |
else{ | |
// Si el primer día es de otro mes y se corresponde con el primero del mes. Restar uno al | |
// mes actual | |
if(primer_lunes == lunes){ | |
mes_lunes = parseInt(selectedMonth); | |
} | |
} | |
} else if(i == 7){ | |
domingo = $(this).text(); | |
if(!$(this).hasClass('ui-datepicker-other-month')) mes_domingo = parseInt(selectedMonth)+1; | |
else{ | |
// Si el ultimo dia del mes es de otro mes y se corresponde con el ultimo domingo. Sumar | |
// uno al mes actual | |
if(ultimo_domingo == domingo){ | |
mes_domingo = parseInt(selectedMonth)+2; | |
} | |
} | |
} | |
i++; | |
}); | |
// Calcular el año en el que se encuentran las fechas de inicio y fin de semana | |
if(mes_domingo == 13){ | |
// Esto es enero del año siguiente al actual | |
mes_domingo = 1; | |
anyo_domingo = parseInt(anyo_domingo) + 1; | |
} | |
if(mes_lunes == 0){ | |
// Esto es diciembre del año anterior al actual | |
mes_lunes = 12; | |
anyo_lunes = parseInt(anyo_lunes) - 1; | |
} | |
// Pintar en el html el rango de fechas calculado | |
$('#lunes_semana').html(lunes+'/'+mes_lunes+'/'+anyo_lunes); | |
$('#domingo_semana').html(domingo+'/'+mes_domingo+'/'+anyo_domingo); | |
} | |
function inicializarCalendarioPlenaria(y, m){ | |
$('#calendario_plenarias').datepicker({ | |
onSelect: function(dateText, inst, pleno) { | |
// urlCal contiene la URL a la que hay que ir al pinchar un día | |
// id es un parametro | |
if(pleno[parseInt(dateText.substring(0,2))]=='S'){ | |
window.location = globales.urlCalPleno+'?id='+dateText+'&aFilter=d'+'#d'; | |
}else{ | |
window.location = globales.urlCal+'?f='+dateText+'#d'; | |
} | |
}, | |
monthNames: globales.monthNames, | |
changeYear: globales.changeYear, | |
firstDay: globales.firstDay, | |
dateFormat: 'dd/mm/yy', | |
showOtherMonths: globales.showOtherMonths, | |
prevText: globales.prevText, | |
nextText: globales.nextText, | |
onChangeMonthYear: function(year, month, inst){ | |
$('#calendario_plenarias').remove(); | |
$('.calendario').append('<div id="calendario_plenarias"> </div>'); | |
inicializarCalendarioPlenaria(year, month); | |
}, | |
defaultDate: mesInicialSeleccionado(y,m), | |
numberOfMonths: [2,3], | |
stepMonths: 6, | |
minDate: new Date(2004, 3, 2), // fecha de inicio de la Legis 8 (tope minimo) | |
beforeShowDay: function(day){ | |
// TODO: SUSTITUIR LOS DIAS ESCRITOS A FUEGO POR LOS QUE CORRESPONDAN | |
/* | |
var dia = day.getDate(); | |
var mes = day.getMonth()+1; | |
var anyo = day.getFullYear(); | |
if((dia == 5 && mes == 11 && anyo == 2011) || (dia == 6 && mes == 12 && anyo == 2011)){ | |
return [true, 'hay_plenaria'] | |
} else if((dia == 10 && mes == 11 && anyo == 2011) || (dia == 20 && mes == 12 && anyo == 2011)){ | |
return [true, 'evento_general'] | |
} else if(dia == 17 && mes == 12 && anyo == 2011) { | |
return [true, 'hay_plenaria_evento'] | |
} else{ | |
return [true, 'dia_general'] | |
} | |
*/ | |
var dia = day.getDate()-1; | |
var mes = day.getMonth()+1; | |
var anyo = day.getFullYear(); | |
if(req.responseXML!=null){ | |
for(var mesIter=mes-1;(mesIter<(mes-1)+5 && mesIter<12);mesIter++){ | |
if(req.responseXML.childNodes[0].childNodes[mesIter].childNodes[0].nodeValue!='Empty'){ | |
if(req.responseXML.childNodes[0].childNodes[mesIter].childNodes[dia].childNodes[0].nodeValue=='Empty'){ | |
return [true, 'dia_general'] | |
} else if(req.responseXML.childNodes[0].childNodes[mesIter].childNodes[dia].childNodes[0].nodeValue=='Plein'){ | |
return [true, 'hay_plenaria'] | |
}else{ | |
return [true, 'dia_general'] | |
} | |
}else{ | |
return[false,''] | |
} | |
} | |
}else{ | |
return[false,''] | |
} | |
} | |
}); | |
} | |
/** | |
* Ordena alfabéticamente el combo indicado. | |
* Usado en el combo de idiomas | |
*/ | |
$.fn.sort_select_box = function(){ | |
// Obtengo los elementos del select | |
var my_options = $("#" + this.attr('id') + ' option'); | |
//Guardo el valor seleccionado | |
var selectedVal = $("#" + this.attr('id')).val(); | |
// ordeno alfabéticamente | |
my_options.sort(function(a,b) { | |
if (a.text > b.text) return 1; | |
else if (a.text < b.text) return -1; | |
else return 0 | |
}) | |
//reemplazo los valores ordenados | |
$(this).empty().append( my_options ); | |
// Limpio cualquier selección | |
$("#"+this.attr('id')+" option").attr('selected', false); | |
//Ponemos la selección que había previa a la ordenación | |
$("#" + this.attr('id')).val(selectedVal); | |
} | |
function desplegable(id){ | |
$(id).click(function(event){ | |
event.preventDefault(); | |
var tmp_abrir = $(this).attr('id').split("_"); | |
var i=1; | |
var buscado = ""; | |
while(i<tmp_abrir.length-1){ | |
buscado += tmp_abrir[i]+'_'; | |
i++ | |
} | |
buscado += tmp_abrir[i]; | |
$('#'+buscado).toggle(); | |
}); | |
} | |
/** | |
* Bloque inicial. | |
* Este es el bloque que se ejecuta al cargar cada página del portal. | |
* Toda funcionalidad que se introduzca en la página debe ser llamada dentro | |
* de esta función. Es una función especial. | |
* Si un elemento no existe en una determinada página hay que evitar que las demás lo cargen, | |
* en caso contrario se producirá un error de Javascript. | |
*/ | |
$(document).ready(function(){ | |
// PARA CARGAR ATRIBUTO TITLE EN LAS IMÁGENES DE LOS DESTACADOS DE LA HOME | |
cargar_atr_destacados(); | |
//Ordenación combo idiomas | |
$('#slct_idioma').sort_select_box(); | |
// PARA ESTILOS PARA COMBOS | |
$("#slct_idioma").select_skin(); | |
$(".cargar_skin").select_skin(); | |
$("#lb_select_legislatura").select_skin(); | |
$("#lb_select_legislatura_no").select_skin(); | |
// PARA CARGAR CALENDARIOS | |
if($('#calendario_home').html()){ | |
// Inicializacion de las variables globales | |
inicializarVariablesGenerales(); | |
// CÓdigo para el calendario de la home | |
inicializarCalendarioHome(globales.hoy.getFullYear(), globales.hoy.getMonth()+1); | |
//('#calendario_home'); | |
} | |
// Calendario de la Agenda | |
if($('#calendario_agenda').html()) { | |
inicializarVariablesGenerales(); | |
// Inicializacion del calendario | |
inicializarCalendarioAgenda(globales.hoy.getFullYear, globales.hoy.getMonth()+1); | |
} | |
if($('#calendario_generico').html()){ | |
// Inicializacion de las variables globales | |
inicializarVariablesGenerales(); | |
// CÓdigo para el calendario de la home | |
inicializarCalendarioGenerico(globales.hoy.getFullYear(), globales.hoy.getMonth()+1); | |
} | |
if($('#calendario_presidente').html()){ | |
// Inicializacion de las variables globales | |
inicializarVariablesGenerales(); | |
var diaMuestra = new Date(document.getElementById("fechaActual").value); | |
// CÓdigo para el calendario de la home | |
inicializarCalendarioPresidente(globales.hoy.getFullYear(), diaMuestra.getMonth()+1); | |
} | |
if($('#calendario_bocg').html()){ | |
// Inicializacion de las variables globales | |
inicializarVariablesGenerales(); | |
inicializarCalendarioBocg(globales.hoy.getFullYear(), globales.hoy.getMonth()+1); | |
// alert(globales.prParam+' '+globales.urlCal); | |
} | |
if($('#calendario_diario_sesiones').html()){ | |
// Inicializacion de las variables globales | |
inicializarVariablesGenerales(); | |
inicializarCalendarioDiarioSesiones(globales.hoy.getFullYear(), globales.hoy.getMonth()+1); | |
} | |
// Carga el slider de la home | |
if($('#slider').html()){ | |
$("#slider").easySlider({auto: true, continuous: true}); | |
} | |
// Fragmento de código que carga el lightBox | |
if($('.slider').html()){ | |
$('.slider').each(function(){ | |
var id = $(this).attr('id'); | |
$('#'+id+' a').lightBox(); | |
}); | |
} | |
// Form_solicitud_vista calendarios con icono | |
if($('#calendario_primero').html()){ | |
inicializarCalendarioWidget('calendario_primero'); | |
} | |
if($('#calendario_segundo').html()){ | |
inicializarCalendarioWidget('calendario_segundo'); | |
} | |
if($('#Map').html()){ | |
mapaInteractivo(); | |
} | |
if($('#cabecera_informacion_senador').html()){ | |
pestanyasInformacionSenador(); | |
} | |
// composicion_1977.html calendarios | |
if($('#calendario_primero_1977').html() && $('#calendario_segundo_1977').html()){ | |
inicializarCalendarios1977('calendario_primero_1977', 'calendario_segundo_1977'); | |
} | |
$('#dialog').dialog({autoOpen: false,width: 600}); | |
$('#dialog_cve').dialog({autoOpen: false,width: 600}); | |
$('#dialog_politica').dialog({autoOpen: false,width: 600}); | |
// Para cargar los calendarios de la página agenda.html | |
if($('#calendario_agenda').html()){ | |
inicializarVariablesGenerales(); | |
inicializarCalendarioAgenda(globales.hoy.getFullYear(), globales.hoy.getMonth()+1); | |
} | |
// Para cargar los calendarios en bloque de 6 de sesion_plenaria_calendario | |
if($('#calendario_plenarias').html()){ | |
inicializarVariablesGenerales(); | |
inicializarCalendarioPlenaria(globales.hoy.getFullYear(), globales.hoy.getMonth()+1); | |
} | |
if($('#dialog').html()){ | |
$('#dialog').dialog({ | |
autoOpen: false, | |
width: 600}); | |
} | |
if($('#dialog_cve').html()){ | |
$('#dialog_cve').dialog({ | |
autoOpen: false, | |
width: 600}); | |
} | |
if($('.desplegable').html()){ | |
$('.desplegable').each(function(){ | |
var id = $(this).attr('id'); | |
desplegable('#'+id); | |
}); | |
} | |
$('td').mouseover(function(){ | |
$('#over-'+$(this).attr('id')).css('display', 'block'); | |
}).mouseout(function(){ | |
$('#over-'+$(this).attr('id')).css('display', 'none'); | |
}); | |
$('#query').each(function() { | |
// tomamos el valor actual del input | |
var currentValue = $(this).val(); | |
// en el focus() comparamos si es el mismo por defecto, y si es asi lo vaciamos | |
$(this).focus(function(){ | |
if( $(this).val() == currentValue ) { | |
$(this).val(''); | |
}; | |
}); | |
// en el blur, si el usuario dejo el value vacio, lo volvemos a restablecer | |
$(this).blur(function(){ | |
if( $(this).val() == '' ) { | |
$(this).val(currentValue); | |
}; | |
}); | |
}); | |
$('#SES-NOMBRE-QUERY').each(function() { | |
// tomamos el valor actual del input | |
var currentValue = $(this).val(); | |
// en el focus() comparamos si es el mismo por defecto, y si es asi lo vaciamos | |
$(this).focus(function(){ | |
if( $(this).val() == currentValue ) { | |
$(this).val(''); | |
}; | |
}); | |
// en el blur, si el usuario dejo el value vacio, lo volvemos a restablecer | |
$(this).blur(function(){ | |
if( $(this).val() == '' ) { | |
$(this).val(currentValue); | |
}; | |
}); | |
}); | |
$('#bt_buscador_des_2').each(function() { | |
// tomamos el valor actual del input | |
var currentValue = $(this).val(); | |
// en el focus() comparamos si es el mismo por defecto, y si es asi lo vaciamos | |
$(this).focus(function(){ | |
if( $(this).val() == currentValue ) { | |
$(this).val(''); | |
}; | |
}); | |
// en el blur, si el usuario dejo el value vacio, lo volvemos a restablecer | |
$(this).blur(function(){ | |
if( $(this).val() == '' ) { | |
$(this).val(currentValue); | |
}; | |
}); | |
}); | |
$('#queryglobal').each(function() { | |
// tomamos el valor actual del input | |
var currentValue = $(this).val(); | |
// en el focus() comparamos si es el mismo por defecto, y si es asi lo vaciamos | |
$(this).focus(function(){ | |
if( $(this).val() == currentValue ) { | |
$(this).val(''); | |
}; | |
}); | |
// en el blur, si el usuario dejo el value vacio, lo volvemos a restablecer | |
$(this).blur(function(){ | |
if( $(this).val() == '' ) { | |
$(this).val(currentValue); | |
}; | |
}); | |
}); | |
$('#enlace_menu_senado').click(function(event){ | |
event.preventDefault(); | |
$("#menu_congreso").hide(); | |
$("#menu_boe").hide(); | |
$("#menu_senado").toggle(); | |
}); | |
$('#enlace_menu_congreso').click(function(event){ | |
event.preventDefault(); | |
$("#menu_senado").hide(); | |
$("#menu_boe").hide(); | |
$("#menu_congreso").toggle(); | |
}); | |
$('#enlace_menu_boe').click(function(event){ | |
event.preventDefault(); | |
$("#menu_senado").hide(); | |
$("#menu_congreso").hide(); | |
$("#menu_boe").toggle(); | |
}); | |
$('#lb_select_periodo').change(function(event){ | |
var val = $("#lb_select_periodo").val(); | |
var xml = $("#xmlUcmLegislatura").val(); | |
var xsl = $("#xslUcmLegislatura").val(); | |
$("#span_select_legis").html(''); | |
$("#span_select_legis").load("/web/xsltransform?xmlUcm="+xml+"&xslUcm="+xsl+"¶ms=idperiodo:"+val,function(){ | |
$("#lb_select_legislatura").select_skin(); | |
}); | |
}); | |
$('#lb_select_periodo_no').change(function(event){ | |
var val = $("#lb_select_periodo_no").val(); | |
var xml = $("#xmlUcmLegislaturano").val(); | |
var xsl = $("#xslUcmLegislaturano").val(); | |
$("#span_select_legis_no").html(''); | |
$("#span_select_legis_no").load("/web/xsltransform?xmlUcm="+xml+"&xslUcm="+xsl+"¶ms=idperiodo:"+val,function(){ | |
$("#lb_select_legislatura_no").select_skin(); | |
}); | |
}); | |
$('#periodo_combo').change(function(event){ | |
var val = $("#periodo_combo").val(); | |
var xml = $("#xmlUcmLegislatura").val(); | |
var xsl = $("#xslUcmLegislatura").val(); | |
$("#legis_combo").parent().load("/web/xsltransform?xmlUcm="+xml+"&xslUcm="+xsl+"¶ms=idperiodo:"+val); | |
}); | |
}); | |
/* | |
$("#menu_blog").position({ | |
my: "left top", | |
at: "left bottom", | |
of: "#content_left_camara", | |
collision: "fit" | |
}); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment