Skip to content

Commit cc36d2f

Browse files
committed
v0.15.2
- fix: Searchbar select filter tag from selection list should make user easy to continue edit the tag. - new: User now can use key '-' and '=' to resize posts grid. - add: Searchbar hotkey '/' hint appear in the searchbar button.
1 parent ff4e5f8 commit cc36d2f

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

client/index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
--nav-height: 50px;
3030
}
3131
html {
32+
overflow-y: scroll;
3233
overflow-x: hidden;
3334
font-size: 14px;
3435
scroll-behavior: smooth;

client/src/component/$NavigationBar.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { $Container } from "elexis";
33
import { Booru } from "../structure/Booru";
44
import { $Searchbar } from "./Searchbar/$Searchbar";
55
import { $Drawer } from "./Drawer/$Drawer";
6-
import { LocalSettings } from "../structure/LocalSettings";
76
import { $DetailPanel } from "./DetailPanel/$DetailPanel";
87

98
export class $NavigationBar extends $Container {
@@ -26,7 +25,10 @@ export class $NavigationBar extends $Container {
2625
])
2726
]),
2827
// Searchbar
29-
$('div').class('searchbar').content(['Search in ', Booru.name$])
28+
$('div').css({ position: 'relative' }).class('searchbar').content([
29+
`Search in ${Booru.name$}`,
30+
$('span').css({ position: 'absolute', right: '0.4rem', top: '0.3rem', border: '1px solid var(--secondary-color-4)', padding: '0rem 0.4rem 0.1rem', borderRadius: '0.4rem', color: 'var(--secondary-color-4)' }).content('/')
31+
])
3032
.self($self => $Router.events.on('stateChange', ({beforeURL, afterURL}) => {if (beforeURL.hash === '#search') $self.hide(false); if (afterURL.hash === '#search') $self.hide(true)}))
3133
.on('click', () => $Searchbar.$ele.open()),
3234
// Buttons

client/src/component/PostGrid/$PostGrid.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { Post } from "../../structure/Post";
44
import { $PostTile } from "../PostTile/$PostTile";
55
import { $Input } from "elexis/lib/node/$Input";
66
import { PostManager } from "../../structure/PostManager";
7+
import { LocalSettings } from "../../structure/LocalSettings";
8+
import { $Notify } from "../$Notify";
79

810
interface $PostGridOptions {
911
tags?: string
@@ -65,6 +67,8 @@ export class $PostGrid extends $Layout {
6567
if (focused instanceof $PostTile) $.open(focused.url);
6668
})
6769
.keydown(['Escape'], e => { e.preventDefault(); this.$focus.blur(); })
70+
.keydown(['='], e => { e.preventDefault(); LocalSettings.columnSize$.set(state$ => state$.value + 1); this.resize(); $Notify.push(`The delta of post grid column number set to ${LocalSettings.columnSize$.value}`) })
71+
.keydown(['-'], e => { e.preventDefault(); LocalSettings.columnSize$.set(state$ => state$.value - 1); this.resize(); $Notify.push(`The delta of post grid column number set to ${LocalSettings.columnSize$.value}`) })
6872
}
6973

7074
protected async loader() {
@@ -81,7 +85,8 @@ export class $PostGrid extends $Layout {
8185
}
8286

8387
protected resize() {
84-
const col = Math.round(this.dom.clientWidth / 300);
88+
89+
const col = Math.round(this.dom.clientWidth / 300) + LocalSettings.columnSize$.value;
8590
this.column(col >= 2 ? col : 2);
8691
}
8792

client/src/component/Searchbar/$TagInput.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export class $TagInput extends $Container {
3636
this.value('');
3737
if (this.$input.inDOM()) this.$inputor.replace($tag);
3838
else this.insert($tag);
39+
if (tagName.endsWith(':')) this.editTag($tag);
3940
return this;
4041
}
4142

client/src/structure/LocalSettings.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ export class LocalSettings {
1010

1111
static get localdata() { const data = localStorage.getItem('local_settings_data'); return data ? JSON.parse(data) as LocalSettingsStoreData : null }
1212
static set localdata(data: LocalSettingsStoreData | null) { localStorage.setItem('local_settings_data', JSON.stringify(data)) }
13+
14+
static columnSize$ = $.state(this.localdata?.columnSizeDelta ?? 0).on('update', state$ => this.localdata = {...this.localdata, columnSizeDelta: state$.value})
1315
}
1416

1517
export interface LocalSettingsStoreData {
1618
detailPanelEnabled?: boolean;
1719
previewPanelEnabled?: boolean;
20+
columnSizeDelta?: number;
1821
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "danbooru-viewer",
33
"module": "index.ts",
44
"type": "module",
5-
"version": "0.15.1",
5+
"version": "0.15.2",
66
"license": "MIT",
77
"author": {
88
"email": "[email protected]",

0 commit comments

Comments
 (0)