-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
function main() { | ||
let timetable = document.getElementsByClassName("plan-lekcji")[0]; | ||
let headers = timetable.getElementsByTagName("thead")[0].getElementsByTagName("tr")[0]; | ||
const timetable = document.getElementsByClassName("plan-lekcji")[0]; | ||
const headers = timetable.getElementsByTagName("thead")[0].getElementsByTagName("tr")[0]; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
docentYT
Author
Owner
|
||
|
||
let saturdayString = headers.childNodes[headers.childNodes.length-3].lastChild.textContent; | ||
let saturday = new Date(saturdayString).setHours(0,0,0,0); | ||
const saturdayString = headers.childNodes[headers.childNodes.length-3].lastChild.textContent; | ||
This comment has been minimized.
Sorry, something went wrong.
EnterVPL
|
||
const saturday = new Date(saturdayString).setHours(0,0,0,0); | ||
|
||
let sundayString = headers.childNodes[headers.childNodes.length-2].lastChild.textContent; | ||
let sunday = new Date(sundayString).setHours(0,0,0,0); | ||
const sundayString = headers.childNodes[headers.childNodes.length-2].lastChild.textContent; | ||
const sunday = new Date(sundayString).setHours(0,0,0,0); | ||
|
||
let today = new Date().setHours(0,0,0,0); | ||
const today = new Date().setHours(0,0,0,0); | ||
|
||
if (today == saturday || today == sunday) { | ||
zmienTydzien(1); // function from original librus site | ||
|
NIEBEZPIECZNE
Jeśli kiedykolwiek utworzysz nową tabelkę nad tą, którą tu używasz to będziesz miał błąd w kodzie.
Rozwiązanie
Przypisz IDki do tych elementów.
PS. ClassName też lepiej unikać do pobierania pojedynczego elementu. Do tego używaj zawsze ID bo jest unikalny. Jeżeli będziesz chciał kiedyś operować na grupie elementów to wymyśl własny atrybut i pobieraj po nim elementy.