mirror of
https://gitlab.aliens-lyon.fr/savrillo/gpens.git
synced 2026-03-18 16:21:04 +01:00
Simplify code
This commit is contained in:
parent
8267dfca69
commit
1700a697ef
@ -46,11 +46,13 @@ function httpGetAsync(theUrl, callback)
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectRoom(roomId) {
|
function selectRoom(roomId) {
|
||||||
if (document.lastSelectedSalle != null) {
|
var svg = document.getElementById('plan');
|
||||||
document.lastSelectedSalle.classList.remove('current-room');
|
|
||||||
|
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);
|
var room = svg.contentDocument.getElementById('path-salle-' + roomId);
|
||||||
|
|
||||||
if (room == null) {
|
if (room == null) {
|
||||||
@ -59,17 +61,16 @@ function selectRoom(roomId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var outputDiv = document.getElementById('selectedSalleInfos');
|
var outputDiv = document.getElementById('selectedSalleInfos');
|
||||||
document.lastSelectedSalle = room;
|
|
||||||
|
|
||||||
httpGetAsync("api/request.php?salle="+room.id.substring("path-salle-".length), function (s,errcode){
|
httpGetAsync("api/request.php?salle="+room.id.substring("path-salle-".length), function (s,errcode){
|
||||||
window.clearTimeout(document.wnsTimeout);
|
window.clearTimeout(document.wnsTimeout);
|
||||||
try{
|
try{
|
||||||
if (s=="404") {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
ss = JSON.parse(s)
|
ss = JSON.parse(s)
|
||||||
if (document.lastSelectedSalle.id==("path-salle-"+ss["id"])) {
|
if (room.id==("path-salle-"+ss["id"])) {
|
||||||
if (errcode==200) {
|
if (errcode==200) {
|
||||||
outputDiv.innerHTML = salleInfosToHtml(ss);
|
outputDiv.innerHTML = salleInfosToHtml(ss);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user