kopia lustrzana https://github.com/cheeaun/phanpy
user-scalable=no for PWA
rodzic
51e7729b3a
commit
ce74d515dd
|
@ -9,9 +9,6 @@ body {
|
|||
color: var(--text-color);
|
||||
overflow-x: hidden;
|
||||
}
|
||||
body {
|
||||
touch-action: pan-x pan-y;
|
||||
}
|
||||
|
||||
#app {
|
||||
min-height: 100vh;
|
||||
|
@ -531,7 +528,6 @@ a[href^='http'][rel*='nofollow']:visited:not(:has(div)) {
|
|||
inset 0 -3px var(--comment-line-color),
|
||||
inset 0 3px var(--comment-line-color);
|
||||
overscroll-behavior-x: contain;
|
||||
/* touch-action: pan-x; */
|
||||
}
|
||||
.timeline.contextual .replies[data-comments-level='4'] {
|
||||
overflow-x: auto;
|
||||
|
|
|
@ -2079,7 +2079,6 @@ a:focus-visible .card img {
|
|||
a.card {
|
||||
text-decoration: none;
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
touch-action: manipulation;
|
||||
}
|
||||
a.card:is(:hover, :focus) {
|
||||
border: 1px solid var(--link-color);
|
||||
|
|
|
@ -11,11 +11,13 @@ import { useEffect, useState } from 'preact/hooks';
|
|||
import ComposeSuspense from './components/compose-suspense';
|
||||
import Loader from './components/loader';
|
||||
import { initActivateLang } from './utils/lang';
|
||||
import { initPWAViewport } from './utils/pwa-viewport';
|
||||
import { initStates } from './utils/states';
|
||||
import { getCurrentAccount } from './utils/store-utils';
|
||||
import useTitle from './utils/useTitle';
|
||||
|
||||
initActivateLang();
|
||||
initPWAViewport();
|
||||
|
||||
if (window.opener) {
|
||||
console = window.opener.console;
|
||||
|
|
|
@ -359,7 +359,7 @@ msgid "Home"
|
|||
msgstr ""
|
||||
|
||||
#: src/components/compose-button.jsx:150
|
||||
#: src/compose.jsx:39
|
||||
#: src/compose.jsx:41
|
||||
msgid "Compose"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1136,7 +1136,7 @@ msgid "Frame rate too high. Uploading might encounter issues."
|
|||
msgstr "Frame rate too high. Uploading might encounter issues."
|
||||
|
||||
#: src/components/media-attachment.jsx:334
|
||||
#: src/compose.jsx:85
|
||||
#: src/compose.jsx:87
|
||||
msgid "Error"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2843,28 +2843,28 @@ msgstr ""
|
|||
msgid "Failed to translate"
|
||||
msgstr ""
|
||||
|
||||
#: src/compose.jsx:34
|
||||
#: src/compose.jsx:36
|
||||
msgid "Editing source status"
|
||||
msgstr ""
|
||||
|
||||
#. placeholder {0}: replyToStatus.account?.acct || replyToStatus.account?.username
|
||||
#: src/compose.jsx:36
|
||||
#: src/compose.jsx:38
|
||||
msgid "Replying to @{0}"
|
||||
msgstr ""
|
||||
|
||||
#: src/compose.jsx:64
|
||||
#: src/compose.jsx:66
|
||||
msgid "You may close this page now."
|
||||
msgstr ""
|
||||
|
||||
#: src/compose.jsx:72
|
||||
#: src/compose.jsx:74
|
||||
msgid "Close window"
|
||||
msgstr ""
|
||||
|
||||
#: src/compose.jsx:88
|
||||
#: src/compose.jsx:90
|
||||
msgid "Login required."
|
||||
msgstr "Login required."
|
||||
|
||||
#: src/compose.jsx:92
|
||||
#: src/compose.jsx:94
|
||||
#: src/pages/annual-report.jsx:164
|
||||
#: src/pages/http-route.jsx:91
|
||||
#: src/pages/login.jsx:280
|
||||
|
|
|
@ -13,8 +13,10 @@ import { HashRouter } from 'react-router-dom';
|
|||
import { App } from './app';
|
||||
import { IconSpriteProvider } from './components/icon-sprite-manager';
|
||||
import { initActivateLang } from './utils/lang';
|
||||
import { initPWAViewport } from './utils/pwa-viewport';
|
||||
|
||||
initActivateLang();
|
||||
initPWAViewport();
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
import('preact/debug');
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
function updateViewportForPWA() {
|
||||
const viewportMeta = document.querySelector('meta[name="viewport"]');
|
||||
if (!viewportMeta) return;
|
||||
|
||||
// Check if running as PWA (standalone mode)
|
||||
const isStandalone =
|
||||
window.matchMedia('(display-mode: standalone)').matches ||
|
||||
window.navigator.standalone === true || // iOS Safari
|
||||
window.matchMedia('(display-mode: window-controls-overlay)').matches;
|
||||
|
||||
if (isStandalone) {
|
||||
const currentContent = viewportMeta.getAttribute('content');
|
||||
if (!currentContent.includes('user-scalable=no')) {
|
||||
viewportMeta.setAttribute(
|
||||
'content',
|
||||
currentContent + ', user-scalable=no',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function initPWAViewport() {
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', updateViewportForPWA);
|
||||
} else {
|
||||
updateViewportForPWA();
|
||||
}
|
||||
}
|
Ładowanie…
Reference in New Issue