mirror of
https://gitlab.aliens-lyon.fr/savrillo/gpens.git
synced 2026-03-18 01:41:02 +01:00
Simplify code
This commit is contained in:
parent
8267dfca69
commit
1700a697ef
@ -46,11 +46,13 @@ function httpGetAsync(theUrl, callback)
|
||||
}
|
||||
|
||||
function selectRoom(roomId) {
|
||||
if (document.lastSelectedSalle != null) {
|
||||
document.lastSelectedSalle.classList.remove('current-room');
|
||||
var svg = document.getElementById('plan');
|
||||
|
||||
var selectedRooms = plan.contentDocument.getElementsByClassName('current-room');
|
||||
for (var i = 0; i < selectedRooms.length; i++) {
|
||||
selectedRooms[i].classList.remove('current-room');
|
||||
}
|
||||
|
||||
var svg = document.getElementById('plan');
|
||||
var room = svg.contentDocument.getElementById('path-salle-' + roomId);
|
||||
|
||||
if (room == null) {
|
||||
@ -59,17 +61,16 @@ function selectRoom(roomId) {
|
||||
}
|
||||
|
||||
var outputDiv = document.getElementById('selectedSalleInfos');
|
||||
document.lastSelectedSalle = room;
|
||||
|
||||
httpGetAsync("api/request.php?salle="+room.id.substring("path-salle-".length), function (s,errcode){
|
||||
window.clearTimeout(document.wnsTimeout);
|
||||
try{
|
||||
if (s=="404") {
|
||||
outputDiv.innerHTML = "Aucune information disponible pour cette salle. Si vous en avez, indiquez-les à l'adresse <a href=mailto:samy.avrillon@ens-lyon.fr>samy.avrillon@ens-lyon.fr</a> en indiquant l'identifiant de la salle : "+document.lastSelectedSalle.id.substring("path-salle-".length);
|
||||
outputDiv.innerHTML = "Aucune information disponible pour cette salle. Si vous en avez, indiquez-les à l'adresse <a href=mailto:samy.avrillon@ens-lyon.fr>samy.avrillon@ens-lyon.fr</a> en indiquant l'identifiant de la salle : "+room.id.substring("path-salle-".length);
|
||||
return;
|
||||
}
|
||||
ss = JSON.parse(s)
|
||||
if (document.lastSelectedSalle.id==("path-salle-"+ss["id"])) {
|
||||
if (room.id==("path-salle-"+ss["id"])) {
|
||||
if (errcode==200) {
|
||||
outputDiv.innerHTML = salleInfosToHtml(ss);
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user