Managed to figure out how to use javascript on the plugin page by utilizing data-controller as found in other repos. Unsure how this is used, but appears to be how you can attach a js file to a div. Also implemented a basic state api to build off of in future.
This commit is contained in:
27
Jellyfin.Plugin.MediaCleaner/Pages/media_cleaner_table.js
Normal file
27
Jellyfin.Plugin.MediaCleaner/Pages/media_cleaner_table.js
Normal file
@@ -0,0 +1,27 @@
|
||||
var table = document.getElementById("seriesTable");
|
||||
|
||||
|
||||
|
||||
const getMediaCleanerState = async () => {
|
||||
const response = await fetch('/mediacleaner/state');
|
||||
|
||||
if(!response.ok){
|
||||
throw new Error(`Response status: ${response.status}`)
|
||||
}
|
||||
|
||||
return response.json();
|
||||
}
|
||||
|
||||
var state = await getMediaCleanerState();
|
||||
|
||||
console.log("State: ", state);
|
||||
|
||||
for(let i = 0; i < state.length; i++){
|
||||
var row = table.insertRow(-1);
|
||||
var cell1 = row.insertCell(0);
|
||||
var cell2 = row.insertCell(1);
|
||||
var cell3 = row.insertCell(2);
|
||||
cell1.innerHTML = state[i].Id;
|
||||
cell2.innerHTML = state[i].SeriesName;
|
||||
cell3.innerHTML = state[i].Seasons.length;
|
||||
}
|
||||
Reference in New Issue
Block a user