Skip to content

Commit dc90601

Browse files
committed
fix mobile search better
1 parent 26d5ba3 commit dc90601

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/webpage/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ import {I18n} from "./i18n.js";
173173
searchBox.parentElement!.classList.add("searching");
174174
}
175175
});
176+
const sideContainDiv = document.getElementById("sideContainDiv") as HTMLElement;
177+
searchBox.onclick = () => {
178+
sideContainDiv.classList.remove("hideSearchDiv");
179+
};
176180
searchX.onclick = () => {
177181
if (searchX.classList.contains("svg-plainx")) {
178182
markdown.txt = [];

src/webpage/localuser.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2845,6 +2845,7 @@ class Localuser {
28452845
for (const elm of htmls) elm.remove();
28462846
}
28472847
const htmls: HTMLElement[] = [];
2848+
sideContainDiv.classList.remove("hideSearchDiv");
28482849
for (const message of messages) {
28492850
if (channel !== message.channel) {
28502851
channel = message.channel;
@@ -2857,6 +2858,7 @@ class Localuser {
28572858
const html = message.buildhtml(undefined, true);
28582859
html.addEventListener("click", async () => {
28592860
try {
2861+
sideContainDiv.classList.add("hideSearchDiv");
28602862
await message.channel.focus(message.id);
28612863
} catch (e) {
28622864
console.error(e);

src/webpage/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2721,6 +2721,10 @@ fieldset input[type="radio"] {
27212721
#sideContainDiv.searchDiv {
27222722
right: 0;
27232723
overflow: auto;
2724+
transition: transform 0.2s;
2725+
}
2726+
.hideSearchDiv {
2727+
transform: translate(100%);
27242728
}
27252729
#page:has(#maintoggle:checked) #maintoggleicon {
27262730
rotate: 180deg;

0 commit comments

Comments
 (0)