Skip to content

Commit

Permalink
Merge remote-tracking branch 'philo/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Meow committed May 6, 2024
2 parents 9754668 + 6cf9020 commit a8e08b0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 21 deletions.
6 changes: 4 additions & 2 deletions assets/js/image_expansion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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">
Expand Down
10 changes: 3 additions & 7 deletions assets/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
{
"compilerOptions": {
"baseUrl": "./js",
"target": "ES2020",
"target": "ES2016",
"useDefineForClassFields": true,
"esModuleInterop": true,
"allowJs": true,
"skipLibCheck": true,
"lib": [
"ES2020",
"ES2016",
"DOM",
"DOM.Iterable"
],

"moduleResolution": "Node",
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,


"strict": true,

"types": ["vitest/globals"]
}
}
13 changes: 1 addition & 12 deletions assets/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@ import { defineConfig, UserConfig, ConfigEnv } from 'vite';
export default defineConfig(({ command, mode }: ConfigEnv): UserConfig => {
const isDev = command !== 'build' && mode !== 'test';

if (isDev) {
// Terminate the watcher when Phoenix quits
// @see https://moroz.dev/blog/integrating-vite-js-with-phoenix-1-6
process.stdin.on('close', () => {
// eslint-disable-next-line no-process-exit
process.exit(0);
});

process.stdin.resume();
}

const themeNames =
fs.readdirSync(path.resolve(__dirname, 'css/themes/')).map(name => {
const m = name.match(/([-a-z]+).scss/);
Expand All @@ -42,7 +31,7 @@ export default defineConfig(({ command, mode }: ConfigEnv): UserConfig => {
}
},
build: {
target: 'es2020',
target: ['es2016', 'chrome67', 'firefox62', 'edge18', 'safari12'],
outDir: path.resolve(__dirname, '../priv/static'),
emptyOutDir: false,
sourcemap: isDev,
Expand Down
1 change: 1 addition & 0 deletions lib/philomena_web/controllers/setting_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 4 additions & 0 deletions lib/philomena_web/templates/setting/edit.html.slime
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit a8e08b0

Please sign in to comment.