From 8be820b7114acc0af5f93f737a99efdb4aa4af61 Mon Sep 17 00:00:00 2001 From: Alex Thomassen Date: Thu, 25 Aug 2022 16:12:34 +0200 Subject: [PATCH] Add hostname at the end of the calendar row --- calendar.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/calendar.js b/calendar.js index dba08f6..6688a26 100644 --- a/calendar.js +++ b/calendar.js @@ -40,6 +40,7 @@ async function fetchIcs(url, name) const status = item.getFirstPropertyValue('status'); const start = item.getFirstPropertyValue('dtstart').toJSDate(); const end = item.getFirstPropertyValue('dtend').toJSDate(); + const publisher = item.getFirstPropertyValue('categories'); let isAdded = false; if (status.toLowerCase() === 'confirmed') { @@ -71,13 +72,14 @@ async function fetchIcs(url, name) // console.log(status); // } - title = `${title} [${name}]`; + title = `${title} (${publisher})`; return { title: title, start, end, display: 'list-item', + classNames: [name], }; }); @@ -151,6 +153,24 @@ const toggleButton = { }, }; +function appendSonarrHostnames() +{ + const names = icsUrls.map(item => item.name); + + for (const name of names) { + const rows = document.querySelectorAll(`.${name}`); + + for (const row of rows) { + const lastCell = row.querySelector('td:last-child'); + + const hostname = document.createElement('span'); + hostname.className = 'float-end'; + hostname.textContent = name; + lastCell.insertAdjacentElement('beforeend', hostname); + } + } +} + async function loadSonarrCalendar(shouldScroll = false) { const calendarElement = document.querySelector('#sonarr-calendar'); @@ -189,6 +209,8 @@ async function loadSonarrCalendar(shouldScroll = false) const message = document.querySelector('#status-message'); try { calendar.render(); + + appendSonarrHostnames(); if (message) { message.remove();