Autoplay functionality was implemented.
This commit is contained in:
parent
06213c9b05
commit
e34e8dddb9
@ -189,6 +189,10 @@ thead tr th.clickable.sort-down::after { content: '↓'; }
|
||||
text-shadow: 0 0 .3rem var(--secondary-color);
|
||||
z-index: 999; }
|
||||
|
||||
#overlay span.c-autoplay {
|
||||
left: auto;
|
||||
right: 0; }
|
||||
|
||||
#overlay :is(video, audio, img) {
|
||||
margin: auto;
|
||||
max-height: 100%;
|
||||
|
@ -55,6 +55,15 @@ overlay_content.addEventListener("mousemove", e => {
|
||||
e.target.style.transform = `translate(${g_oc_translate[0]}px, ${g_oc_translate[1]}px) scale(${g_scale})`;
|
||||
});
|
||||
|
||||
overlay_autoplay = document.getElementsByName("autoplay")[0];
|
||||
|
||||
overlay_autoplay.addEventListener("change", e => {
|
||||
if (e.target.checked && overlay_content.firstChild !== undefined)
|
||||
if (overlay_content.firstChild.tagName === "AUDIO" || overlay_content.firstChild.tagName === "VIDEO")
|
||||
if (overlay_content.firstChild.ended)
|
||||
b_next.click();
|
||||
});
|
||||
|
||||
|
||||
function determine_media_element(path) {
|
||||
path = path.toLowerCase();
|
||||
@ -83,6 +92,7 @@ function send_to_overlay(pathname, media_type_element) {
|
||||
media_element.addEventListener("volumechange", e => {
|
||||
localStorage['audio_volume'] = e.target.volume; });
|
||||
media_element.volume = localStorage["audio_volume"];
|
||||
media_element.addEventListener("ended", e => { if (overlay_autoplay.checked) b_next.click(); });
|
||||
}
|
||||
|
||||
overlay_label.textContent = decodeURI(pathname.substr(pathname.lastIndexOf("/") + 1));
|
||||
|
@ -88,6 +88,10 @@ templ Index(currentPath, progVer string, stat *files.DirStat, entries *[]files.D
|
||||
<button name="prev">❰</button>
|
||||
<div></div>
|
||||
<span></span>
|
||||
<span class="c-autoplay">
|
||||
<input id="c-autoplay" type="checkbox" name="autoplay">
|
||||
<label for="c-autoplay">{ i18n.T(ctx, "autoplay") }</label>
|
||||
</span>
|
||||
<button name="next">❱</button>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -13,6 +13,7 @@ en:
|
||||
size: Size
|
||||
no-script-explain: With scripts deactivated you loose some QoL features like overlay to view files without need to leave a page, filter of directory's content, and navigation using arrow keys.
|
||||
instruction: TODO
|
||||
autoplay: Autoplay
|
||||
footer:
|
||||
author: Alexander ❝Arav❞ Andreev
|
||||
privacy: Privacy statements
|
@ -13,6 +13,7 @@ ru:
|
||||
size: Размер
|
||||
no-script-explain: С отключенными скриптами ты теряешь такие удобные функции, как оверлей для просмотра файлов без необходимости покидать страницу, фильтр по содержимому директории и навигацию стрелками.
|
||||
instruction: TODO
|
||||
autoplay: Автоматическое проигрывание
|
||||
footer:
|
||||
author: Александр «Arav» Андреев
|
||||
privacy: О приватности
|
Loading…
Reference in New Issue
Block a user