Belote/static/belote-script.js

78 lines
2.3 KiB
JavaScript

/*************************
la Belote
**************************/
var go = function(url) {
document.location.href=url;
}
var hidealert = function(id){
$('#'+id).hide();
}
$(document).ready(function() {
/*==============================
listeners à activer à ready
===============================*/
document.getElementById("username").addEventListener("click",function() {apparaitDisparaitMenu('username-items','username-fleche')});
var options = document.getElementById("options");
if(options){
options.addEventListener("click",function() {apparaitDisparaitAccordeon('options-valeur','options-fleche')});
}
var derpli = document.getElementById("dernier-pli")
if(derpli){
derpli.addEventListener("click",function() {apparaitDisparaitAccordeon('dernier-pli-valeur','dernier-pli-fleche')});
}
/*==============================
fonctions
===============================*/
/*
fonction apparaitDisparaitUserAttr
apparition/disparition d'un menu
*/
function apparaitDisparaitMenu (idMenu,idFleche) {
var element = document.getElementById(idMenu);
if(element.style.visibility == "hidden" || element.style.visibility == "") {
document.getElementById(idMenu).style.visibility = "visible";
}
else {
document.getElementById(idMenu).style.visibility = "hidden";
};
var elementFleche = document.getElementById(idFleche);
var splitElement = elementFleche.src.split('/');
var lastElement = splitElement[splitElement.length-1];
if(lastElement == "fleche-bas.gif") {
document.getElementById(idFleche).src = "/static/fleche-haut.gif";
}
else {
document.getElementById(idFleche).src = "/static/fleche-bas.gif";
}
return(0);
}
function apparaitDisparaitAccordeon (idZone,idFleche) {
var element = document.getElementById(idZone);
if(element.style.display == "none" || element.style.display == "") {
document.getElementById(idZone).style.display = "block";
}
else {
document.getElementById(idZone).style.display = "none";
};
var elementFleche = document.getElementById(idFleche);
var splitElement = elementFleche.src.split('/');
var lastElement = splitElement[splitElement.length-1];
if(lastElement == "fleche-bas.gif") {
document.getElementById(idFleche).src = "/static/fleche-haut.gif";
}
else {
document.getElementById(idFleche).src = "/static/fleche-bas.gif";
}
return(0);
}
/* fin de $(document).ready() */
});