Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame^] | 1 | <script type="text/javascript" src="./horaris.json"></script> |
| 2 | |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 3 | <html> |
| 4 | <head> |
| 5 | </head> |
| 6 | <body> |
| 7 | <h1>App de traçabilitat DAFME</h1> |
| 8 | <h2>Estructures Algebràiques</h2> |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame^] | 9 | <h2 id = "assignatura"></h2> |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 10 | <h3>Aula S03</h3> |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame^] | 11 | <h3 id = "aula"></h3> |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 12 | <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 Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame^] | 22 | var mydata = JSON.parse(classes); |
| 23 | |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 24 | 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 Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame^] | 42 | |
| 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 Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 50 | document.getElementById("data").innerHTML = data; |
| 51 | </script> |
| 52 | </body> |
| 53 | </html> |