blob: bf16a34fb985a2ba243ed5e4ac94aeb72931f40a [file] [log] [blame]
Dani Vilardell21dacea2020-09-21 14:25:20 +02001<script type="text/javascript" src="./horaris.json"></script>
2
Andreu Huguet8d2e08f2020-09-17 14:15:23 +02003<html>
4 <head>
5 </head>
6 <body>
7 <h1>App de traçabilitat DAFME</h1>
8 <h2>Estructures Algebràiques</h2>
Dani Vilardell21dacea2020-09-21 14:25:20 +02009 <h2 id = "assignatura"></h2>
Andreu Huguet8d2e08f2020-09-17 14:15:23 +020010 <h3>Aula S03</h3>
Dani Vilardell21dacea2020-09-21 14:25:20 +020011 <h3 id = "aula"></h3>
Andreu Huguet8d2e08f2020-09-17 14:15:23 +020012 <a href="#">No és així? Canvia-ho.</a>
13
14 <h2 id="hora">
15 <span id="inici"></span> -
16 <span id="fi"></span>
17 </h2>
18 <h3 id="data"></h3>
19 <a href="#">No és així? Canvia-ho.</a>
20
21 <script>
Dani Vilardell21dacea2020-09-21 14:25:20 +020022 var mydata = JSON.parse(classes);
23
Andreu Huguet8d2e08f2020-09-17 14:15:23 +020024 var hora_actual = new Date();
25 var minuts;
26
27 // Hora d'inici
28 hora_actual.setMinutes(0, 0, 0); // Arrodonir per baix els minuts
29 minuts = hora_actual.getMinutes() < 10 ? hora_actual.getMinutes().toString() + '0' : hora_actual.getMinutes().toString();
30 document.getElementById("inici").innerHTML = hora_actual.getHours().toString() + ":" + minuts;
31
32 // Hora de fi
33 hora_actual.setHours(hora_actual.getHours() + 1); // Sumar una hora
34 minuts = hora_actual.getMinutes() < 10 ? hora_actual.getMinutes().toString() + '0' : hora_actual.getMinutes().toString();
35 document.getElementById("fi").innerHTML = hora_actual.getHours().toString() + ":" + minuts;
36
37 // Data
38 var dia = hora_actual.getDate();
39 var mes = hora_actual.getMonth() + 1;
40 var any = hora_actual.getFullYear();
41 var data = dia.toString() + '/' + mes.toString() + '/' + any.toString();
Dani Vilardell21dacea2020-09-21 14:25:20 +020042
43 for (i = 0; i < mydata.length; i++) {
44 var h = mydata[i].hora.split(":");
45 if(h[0] == (hora_actual.getHours() - 1).toString()) {
46 console.log("trobat");
47 document.getElementById("assignatura").innerHTML = mydata[i].nom;
48 }
49 }
Andreu Huguet8d2e08f2020-09-17 14:15:23 +020050 document.getElementById("data").innerHTML = data;
51 </script>
52 </body>
53</html>