userscripts/jellyfin-quick-delete.js
2023-03-06 15:38:54 +00:00

23 lines
No EOL
891 B
JavaScript

const collection = document.getElementsByClassName("listItem");
for (let i = 0; i < collection.length; i++) {
let curr = collection[i];
let el = document.createElement("button");
el.className = "listItemButton paper-icon-button-light emby-button";
let el2 = document.createElement("span");
el2.className = "material-icons delete";
el2.style.color = "red";
el.appendChild(el2);
el.onclick = function () {
let url = "https://media.m3.fyi/Items/" + this.parentElement.dataset.id;
console.log("Deleting" + url);
fetch(url,
{
method: "DELETE",
headers: {
"X-Emby-Authorization": 'MediaBrowser Client="QuickDelete", Device="Chrome", DeviceId="test", Version="10.8.9", Token="38346c399d57454da3bdbf47ba716765"'
}
})
}
curr.appendChild(el);
}