Skip to content

Commit

Permalink
Merge pull request #206 from Suwayomi/main
Browse files Browse the repository at this point in the history
remove the jank right arrow stuff on quick menu
  • Loading branch information
Robonau authored Jun 25, 2024
2 parents 52876c0 + a190668 commit 60198c8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 45 deletions.
77 changes: 34 additions & 43 deletions src/routes/QuickSearchModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
$: $category, $categories, value, doCategory();
$: $sources, value, doSource();
function doCategory() {
async function doCategory() {
if (value.startsWith('#')) {
const parsed = value.slice(1).split(/[/:]/);
const categorySearch: string | undefined = parsed[0];
Expand All @@ -132,16 +132,41 @@
| undefined = undefined;
let includeChapters: ResultOf<typeof ChapterTypeFragment>[] | undefined =
undefined;
if (mangaSearch && includeCategory?.[0]) {
if (mangaSearch !== undefined && includeCategory?.[0]) {
catId = includeCategory[0].id;
includeMangas = $category?.data?.category?.mangas.nodes.filter((e) =>
e.title.toLowerCase().includes(mangaSearch.toLowerCase())
);
if (chapterNameSearch && includeMangas?.[0]) {
includeMangas = await new Promise((resolve) => {
window.requestAnimationFrame(() => {
let unSub = () => {};
unSub = category.subscribe((ee) => {
if (ee?.data?.category?.mangas?.nodes) {
unSub();
resolve(
ee.data.category.mangas.nodes.filter((e) =>
e.title.toLowerCase().includes(mangaSearch.toLowerCase())
)
);
}
});
});
});
if (chapterNameSearch !== undefined && includeMangas?.[0]) {
mangaId = includeMangas[0].id;
includeChapters = $manga?.data?.manga?.chapters.nodes?.filter((e) =>
e.name.toLowerCase().includes(chapterNameSearch.toLowerCase())
);
includeChapters = await new Promise((resolve) => {
let unSub = () => {};
unSub = manga.subscribe((ee) => {
if (ee?.data?.manga?.chapters?.nodes) {
unSub();
resolve(
ee.data.manga.chapters.nodes.filter((e) =>
e.name
.toLowerCase()
.includes(chapterNameSearch.toLowerCase())
)
);
}
});
});
}
}
Expand Down Expand Up @@ -256,40 +281,6 @@
previous.focus();
return;
}
if (event.key === 'ArrowRight') {
let selectEnd = inputEl?.selectionEnd;
if (selectEnd === value.length) {
let SelectedItem: item;
if (inputElement) {
SelectedItem = items[0];
} else {
const tabElements = [...document.querySelectorAll('.tabindex')] as (
| HTMLInputElement
| HTMLAnchorElement
)[];
const index = tabElements.findIndex(
(e) => e === document.activeElement
);
SelectedItem = items[index];
}
if ('str' in SelectedItem) {
if (!value.includes(SelectedItem.str)) {
value += SelectedItem.str;
}
} else if ('firstLineBoldText' in SelectedItem) {
if (!value.includes(SelectedItem.firstLineBoldText)) {
value += SelectedItem.firstLineBoldText;
}
} else if (!value.includes(SelectedItem.firstLine)) {
value += SelectedItem.firstLine;
}
(
document.querySelector('.tabindex') as
| HTMLInputElement
| HTMLAnchorElement
).focus();
}
}
}
$: if (catId !== undefined)
Expand Down
2 changes: 1 addition & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const config = {
adapter: adapter({
pages: 'build',
assets: 'build',
fallback: '404.html',
fallback: 'index.html',
precompress: false
})
}
Expand Down
2 changes: 1 addition & 1 deletion versionToServerVersionMapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
{
"tag": "v1.1.0",
"uiVersion": "r1042",
"uiVersion": "r1067",
"serverVersion": "r1502",
"comment": "the server version is between 1.0.0 and 1.1.0 release",
"comment2": "because its the preview version that implemented the breaking changes"
Expand Down

0 comments on commit 60198c8

Please sign in to comment.