mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
Add local setting to enable audio on videos by default (#252)
* Add local setting to enable audio on videos by default * Update copy * Use ternary over `let`+`if`
This commit is contained in:
parent
5b836580e1
commit
377317a26b
3 changed files with 9 additions and 2 deletions
|
@ -86,10 +86,12 @@ function pickAndResize(elem) {
|
|||
clearEl(elem);
|
||||
}
|
||||
|
||||
const muted = store.get('unmute_videos') ? '' : 'muted';
|
||||
|
||||
if (imageFormat === 'mp4') {
|
||||
elem.classList.add('full-height');
|
||||
elem.insertAdjacentHTML('afterbegin',
|
||||
`<video controls autoplay loop muted playsinline preload="auto" id="image-display"
|
||||
`<video controls autoplay loop ${muted} playsinline preload="auto" id="image-display"
|
||||
width="${imageWidth}" height="${imageHeight}">
|
||||
<source src="${uris.webm}" type="video/webm">
|
||||
<source src="${uris.mp4}" type="video/mp4">
|
||||
|
@ -102,7 +104,7 @@ function pickAndResize(elem) {
|
|||
}
|
||||
else if (imageFormat === 'webm') {
|
||||
elem.insertAdjacentHTML('afterbegin',
|
||||
`<video controls autoplay loop muted playsinline id="image-display">
|
||||
`<video controls autoplay loop ${muted} playsinline id="image-display">
|
||||
<source src="${uri}" type="video/webm">
|
||||
<source src="${uri.replace(/webm$/, 'mp4')}" type="video/mp4">
|
||||
<p class="block block--fixed block--warning">
|
||||
|
|
|
@ -39,6 +39,7 @@ defmodule PhilomenaWeb.SettingController do
|
|||
|> set_cookie(user_params, "hidpi", "hidpi")
|
||||
|> set_cookie(user_params, "webm", "webm")
|
||||
|> set_cookie(user_params, "serve_webm", "serve_webm")
|
||||
|> set_cookie(user_params, "unmute_videos", "unmute_videos")
|
||||
|> set_cookie(user_params, "chan_nsfw", "chan_nsfw")
|
||||
|> set_cookie(user_params, "hide_staff_tools", "hide_staff_tools")
|
||||
|> set_cookie(user_params, "hide_uploader", "hide_uploader")
|
||||
|
|
|
@ -154,6 +154,10 @@ h1 Content Settings
|
|||
=> label f, :webm, "Use video thumbnails"
|
||||
=> checkbox f, :webm, checked: @conn.cookies["webm"] == "true"
|
||||
.fieldlabel: i Use video thumbnails for WebM videos. Does not apply to GIF images.
|
||||
.field
|
||||
=> label f, :unmute_videos, "Enable video audio by default"
|
||||
=> checkbox f, :unmute_videos, checked: @conn.cookies["unmute_videos"] == "true"
|
||||
.fieldlabel: i Automatically enable audio on video pages when they are loaded.
|
||||
.field
|
||||
=> label f, :hide_uploader
|
||||
=> checkbox f, :hide_uploader, checked: @conn.cookies["hide_uploader"] == "true"
|
||||
|
|
Loading…
Reference in a new issue