Add hostname at the end of the calendar row
This commit is contained in:
parent
46483202ca
commit
8be820b711
24
calendar.js
24
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');
|
||||
@ -190,6 +210,8 @@ async function loadSonarrCalendar(shouldScroll = false)
|
||||
try {
|
||||
calendar.render();
|
||||
|
||||
appendSonarrHostnames();
|
||||
|
||||
if (message) {
|
||||
message.remove();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user