From 0d36998b0fb8139456bf1eda3f614542fec890c5 Mon Sep 17 00:00:00 2001 From: RblSb Date: Mon, 2 Mar 2020 13:50:16 +0300 Subject: Video sync toggler --- src/client/Buttons.hx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/client/Buttons.hx') diff --git a/src/client/Buttons.hx b/src/client/Buttons.hx index d50773d..f88aa97 100644 --- a/src/client/Buttons.hx +++ b/src/client/Buttons.hx @@ -78,6 +78,23 @@ class Buttons { window.dispatchEvent(new Event("resize")); } + final toggleSynch = ge("#togglesynch"); + toggleSynch.onclick = e -> { + final icon = toggleSynch.firstElementChild; + if (main.isSyncActive) { + if (!window.confirm(Lang.get("toggleSynchConfirm"))) return; + main.isSyncActive = false; + icon.style.color = "rgba(238, 72, 67, 0.75)"; + icon.classList.add("glyphicon-pause"); + icon.classList.remove("glyphicon-play"); + } else { + main.isSyncActive = true; + icon.style.color = ""; + icon.classList.add("glyphicon-play"); + icon.classList.remove("glyphicon-pause"); + main.send({type: UpdatePlaylist}); + } + } final mediaRefresh = ge("#mediarefresh"); mediaRefresh.onclick = e -> { main.refreshPlayer(); -- cgit v1.2.3