Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 1 | |
| 2 | const fs = require('fs'); |
| 3 | |
Andreu Huguet | f4581a4 | 2020-09-17 13:33:44 +0200 | [diff] [blame] | 4 | let hores = [], newhour; |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 5 | |
Andreu Huguet | f4581a4 | 2020-09-17 13:33:44 +0200 | [diff] [blame] | 6 | for (let h = 8; h < 22; ++h) { |
| 7 | newhour = ""; |
| 8 | if (h < 10) newhour += "0"; |
| 9 | newhour += h.toString(); |
| 10 | |
| 11 | hores.push(newhour + ":00"); |
| 12 | hores.push(newhour + ":30"); |
| 13 | } |
| 14 | |
| 15 | hores.forEach(hora => { |
| 16 | let column = 1; |
| 17 | let td = $("td:contains(" + hora + ")").next(); |
| 18 | |
| 19 | while (td.text().indexOf(hora) == -1) { |
| 20 | |
| 21 | if (td.text().indexOf("CDATA") == -1) { |
| 22 | let aula = $("#day_main th")[column].textContent.trim(); |
| 23 | let durada = parseInt(td.attr("rowspan"))*30; |
| 24 | |
| 25 | console.log(td.text() |
| 26 | + ", " + hora |
| 27 | + ", " + durada + "mins" |
| 28 | + ", " + aula); |
| 29 | } |
| 30 | |
| 31 | td = td.next(); |
| 32 | ++column; |
| 33 | } |
| 34 | }); |