Hide scrollbar on Windows Chrome

This commit is contained in:
2023-06-26 20:24:48 +08:00
parent 5108526b2f
commit 3b2b8bf300
6 changed files with 47 additions and 6 deletions

View File

@@ -20,6 +20,7 @@
"lifegpc-md5": "https://esm.sh/[email protected]",
"meilisearch": "https://esm.sh/[email protected]",
"lodash/": "https://esm.sh/[email protected]/",
"mime": "https://esm.sh/[email protected]"
"mime": "https://esm.sh/[email protected]",
"ua-parser-js": "https://esm.sh/[email protected]"
}
}

View File

@@ -167,6 +167,14 @@ export default class TaskManager extends Component<TaskManagerProps> {
if (!this.props.show) return null;
return (
<div class="task_manager">
<Fab
class="new_task"
onClick={() => {
set_state(`${this.props.base}/new`);
}}
>
<Icon>add</Icon>
</Fab>
<div class="task_amounts">
<div class="mdc-theme--secondary-light">
<p>count</p>

View File

@@ -3,19 +3,38 @@ import { Handlers, PageProps } from "$fresh/server.ts";
import GlobalContext from "../components/GlobalContext.tsx";
import Container from "../islands/Container.tsx";
import { get_i18nmap, i18n_handle_request } from "../server/i18ns.ts";
import parse_ua from "ua-parser-js";
export const handler: Handlers<string> = {
type Props = {
lang: string;
userAgent: string | null;
};
export const handler: Handlers<Props> = {
GET(req, ctx) {
const re = i18n_handle_request(req);
if (typeof re === "string") return ctx.render(re);
if (typeof re === "string") {
return ctx.render({
lang: re,
userAgent: req.headers.get("User-Agent"),
});
}
return re;
},
};
export default function Index({ data }: PageProps<string>) {
const i18n = get_i18nmap(data);
export default function Index({ data }: PageProps<Props>) {
const i18n = get_i18nmap(data.lang);
const ua = parse_ua(data.userAgent || "");
const is_windows_chrome = ua.browser.name === "Chrome" &&
ua.os.name === "Windows";
return (
<body>
<Head>
{is_windows_chrome
? <link rel="stylesheet" href="hide-scrollbar.css" />
: null}
</Head>
<GlobalContext>
<Container i18n={i18n} />
</GlobalContext>

View File

@@ -214,3 +214,9 @@ body {
.mdc-top-app-bar__section--align-end>* {
margin: 0 5px;
}
.task_manager .new_task {
position: fixed;
right: 50px;
bottom: 50px;
}

View File

@@ -0,0 +1,3 @@
html::-webkit-scrollbar {
display: none;
}

View File

@@ -27,7 +27,11 @@ self.addEventListener("activate", (event: ActivateEvent) => {
event.waitUntil(deleteOldCaches());
});
const CACHES = ["/common.css", "/preact-material-components/style.css"];
const CACHES = [
"/common.css",
"/hide-scrollbar.css",
"/preact-material-components/style.css",
];
function match_url(u: URL) {
const pn = u.pathname;