fix: menu button not push hash state.
optimize: $Search and $Drawer open and close method will determine hash first.
This commit is contained in:
defaultkavy 2024-10-13 08:42:57 +08:00
parent acf412de6b
commit a94bcd6f81
Signed by: defaultkavy
GPG Key ID: DFBB22C4E69D7826
5 changed files with 10 additions and 7 deletions

File diff suppressed because one or more lines are too long

2
dist/index.html vendored
View File

@ -16,7 +16,7 @@
gtag('config', 'G-59HBGP98WR');
</script>
<script type="module" crossorigin src="/assets/index-Dg3fAkPK.js"></script>
<script type="module" crossorigin src="/assets/index-BjMPWQj7.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CPDn8S3u.css">
</head>
<body>

View File

@ -2,7 +2,7 @@
"name": "danbooru-viewer",
"module": "index.ts",
"type": "module",
"version": "0.6.1",
"version": "0.6.2",
"devDependencies": {
"@types/bun": "latest",
"vite": "^5.4.8",

View File

@ -49,7 +49,10 @@ export class $Drawer extends $Container {
])
}
open() {
open() { if (location.hash !== '#drawer') $.open(location.href + '#drawer'); return this; }
close() { if (location.hash === '#drawer') $.back(); return this; }
private activate() {
this.hide(false);
this.$container.animate({
transform: [`translateX(100%)`, `translateX(0%)`]
@ -67,7 +70,7 @@ export class $Drawer extends $Container {
})
}
close() {
private inactivate() {
this.$container.animate({
transform: [`translateX(0%)`, `translateX(100%)`]
}, {

View File

@ -41,8 +41,8 @@ export class $Searchbar extends $Container {
])
}
open() { $.open(location.href + '#search'); return this; }
close() { $.back(); return this; }
open() { if (location.hash !== '#search') $.open(location.href + '#search'); return this; }
close() { if (location.hash === '#search') $.back(); return this; }
activate() {
this.hide(false);