ref: navigation buttons

This commit is contained in:
leukipp
2025-07-09 16:11:28 +02:00
parent cab2052477
commit e64f092f6c
4 changed files with 26 additions and 9 deletions
+11 -5
View File
@@ -46,16 +46,19 @@
li.dynamic { li.dynamic {
flex: 1 1 0%; flex: 1 1 0%;
} }
li.hidden {
display: none;
}
li.disabled {
opacity: 0.5;
pointer-events: none;
}
button { button {
width: 32px; width: 32px;
height: 32px; height: 32px;
border: none; border: none;
background-color: transparent; background-color: transparent;
} }
button.disabled {
opacity: 0.5;
pointer-events: none;
}
input { input {
width: 100%; width: 100%;
min-width: 0; min-width: 0;
@@ -144,7 +147,10 @@
const registerReceiveEvents = () => { const registerReceiveEvents = () => {
ipcRenderer.on("button-disabled", (e, button) => { ipcRenderer.on("button-disabled", (e, button) => {
document.getElementById(button.id).classList.toggle("disabled", button.disabled); document.getElementById(button.id).parentNode.classList.toggle("disabled", button.disabled);
});
ipcRenderer.on("button-hidden", (e, button) => {
document.getElementById(button.id).parentNode.classList.toggle("hidden", button.hidden);
}); });
ipcRenderer.on("input-blur", (e, input) => { ipcRenderer.on("input-blur", (e, input) => {
document.getElementById(input.id).blur(); document.getElementById(input.id).blur();
+9 -1
View File
@@ -46,6 +46,14 @@
border-bottom: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color);
background: var(--background-color); background: var(--background-color);
} }
li {
display: flex;
align-items: center;
flex: 0 0 auto;
}
li.hidden {
display: none;
}
button { button {
width: 32px; width: 32px;
height: 32px; height: 32px;
@@ -114,7 +122,7 @@
const registerReceiveEvents = () => { const registerReceiveEvents = () => {
ipcRenderer.on("button-hidden", (e, button) => { ipcRenderer.on("button-hidden", (e, button) => {
document.getElementById(button.id).parentNode.hidden = button.hidden; document.getElementById(button.id).parentNode.classList.toggle("hidden", button.hidden);
}); });
ipcRenderer.on("data-theme", (e, data) => { ipcRenderer.on("data-theme", (e, data) => {
document.documentElement.setAttribute("data-theme", data.theme); document.documentElement.setAttribute("data-theme", data.theme);
+3
View File
@@ -413,6 +413,9 @@ const updateKeyboard = () => {
* Initializes the page number and handles the execute logic. * Initializes the page number and handles the execute logic.
*/ */
const initPageNumber = () => { const initPageNumber = () => {
if (WEBVIEW.viewUrls.length < 3) {
return;
}
const root = `${INTEGRATION.root}/page_number`; const root = `${INTEGRATION.root}/page_number`;
const config = { const config = {
name: "Page Number", name: "Page Number",
+3 -3
View File
@@ -183,10 +183,10 @@ const updateNavigation = () => {
const defaultUrl = WEBVIEW.viewUrls[WEBVIEW.viewActive]; const defaultUrl = WEBVIEW.viewUrls[WEBVIEW.viewActive];
const currentUrl = view.webContents.getURL(); const currentUrl = view.webContents.getURL();
// Disable pager button // Hide pager button
WEBVIEW.navigation.webContents.send("button-disabled", { WEBVIEW.navigation.webContents.send("button-hidden", {
id: "pager", id: "pager",
disabled: WEBVIEW.views.length < 3, hidden: WEBVIEW.viewUrls.length < 3,
}); });
// Update url text // Update url text