Add play button to media rows when items are tagged
This commit is contained in:
parent
de136c7d83
commit
3d3cc2b91c
36
renderer.js
36
renderer.js
@ -238,6 +238,36 @@ function addTagToEpisode(filePath, tagType) {
|
|||||||
|
|
||||||
// Add a data attribute to track that this file is tagged
|
// Add a data attribute to track that this file is tagged
|
||||||
item.setAttribute('data-tagged-' + tagType, 'true');
|
item.setAttribute('data-tagged-' + tagType, 'true');
|
||||||
|
|
||||||
|
// Add play button to the end of the row
|
||||||
|
const playButton = document.createElement('button');
|
||||||
|
playButton.className = 'play-button';
|
||||||
|
playButton.innerHTML = '▶️';
|
||||||
|
playButton.title = 'Play file';
|
||||||
|
playButton.dataset.filePath = filePath;
|
||||||
|
|
||||||
|
// Style the play button
|
||||||
|
playButton.style.marginLeft = '10px';
|
||||||
|
playButton.style.padding = '5px 10px';
|
||||||
|
playButton.style.border = 'none';
|
||||||
|
playButton.style.borderRadius = '3px';
|
||||||
|
playButton.style.cursor = 'pointer';
|
||||||
|
playButton.style.backgroundColor = '#28a745';
|
||||||
|
playButton.style.color = 'white';
|
||||||
|
playButton.style.fontWeight = 'bold';
|
||||||
|
playButton.style.fontSize = '14px';
|
||||||
|
|
||||||
|
// Add click handler for play button
|
||||||
|
playButton.addEventListener('click', function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
openVideoPreview(filePath);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add the play button to the file item
|
||||||
|
const fileTags = item.querySelector('.file-tags');
|
||||||
|
if (fileTags) {
|
||||||
|
fileTags.appendChild(playButton);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -272,6 +302,12 @@ function untagFile(filePath, tagType) {
|
|||||||
|
|
||||||
// Remove the data attribute
|
// Remove the data attribute
|
||||||
item.removeAttribute('data-tagged-' + tagType);
|
item.removeAttribute('data-tagged-' + tagType);
|
||||||
|
|
||||||
|
// Remove play button if it exists
|
||||||
|
const playButton = item.querySelector('.play-button');
|
||||||
|
if (playButton) {
|
||||||
|
playButton.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user