From e74ad5132ae4bf373d1525055ceabce0a8d1142f Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 18 May 2022 19:17:21 +0200 Subject: [PATCH] persist videoplayer prefs --- copyparty/web/baguettebox.js | 5 +++-- copyparty/web/browser.js | 4 ++-- copyparty/web/util.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/copyparty/web/baguettebox.js b/copyparty/web/baguettebox.js index d70958dd..fc2b36fb 100644 --- a/copyparty/web/baguettebox.js +++ b/copyparty/web/baguettebox.js @@ -35,8 +35,8 @@ window.baguetteBox = (function () { documentLastFocus = null, isFullscreen = false, vmute = false, - vloop = false, - vnext = false, + vloop = sread('vmode') == 'L', + vnext = sread('vmode') == 'C', resume_mp = false; var onFSC = function (e) { @@ -320,6 +320,7 @@ window.baguetteBox = (function () { btnVmode.setAttribute('aria-label', msg); btnVmode.setAttribute('tt', msg + tts); btnVmode.textContent = lbl; + swrite('vmode', lbl[0]); v.loop = vloop if (vloop && v.paused) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 6ab10460..a1f9ac3c 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -5298,7 +5298,7 @@ var settheme = (function () { vbar.draw(); showfile.setstyle(); - var html = [], itheme = ax.indexOf(theme.charAt(0)) * 2 + (light ? 1 : 0), + var html = [], itheme = ax.indexOf(theme[0]) * 2 + (light ? 1 : 0), names = ['classic dark', 'classic light', 'pm-monokai', 'flat light', 'vice', 'hotdog stand']; for (var a = 0; a < themes; a++) @@ -5318,7 +5318,7 @@ var settheme = (function () { var i = e; try { ev(e); i = e.target.textContent; } catch (ex) { } light = i % 2 == 1; - var c = ax.charAt(Math.floor(i / 2)), + var c = ax[Math.floor(i / 2)], l = light ? 'y' : 'z'; theme = c + l + ' ' + c + ' ' + l; swrite('theme', theme); diff --git a/copyparty/web/util.js b/copyparty/web/util.js index a31f1c93..480c7945 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -471,7 +471,7 @@ function linksplit(rp, id) { q = '?' + q[1]; } - if (rp && rp.charAt(0) == '/') + if (rp && rp[0] == '/') rp = rp.slice(1); while (rp) {