diff --git a/depell/src/index.js b/depell/src/index.js
index 304d317e..56548924 100644
--- a/depell/src/index.js
+++ b/depell/src/index.js
@@ -331,10 +331,11 @@ function cacheInputs(target) {
}
}
-function updaetTab() {
+/** @param {string} [path] */
+function updaetTab(path) {
for (const elem of document.querySelectorAll("button[hx-push-url]")) {
if (elem instanceof HTMLButtonElement)
- elem.disabled = elem.getAttribute("hx-push-url") === window.location.pathname;
+ elem.disabled = elem.getAttribute("hx-push-url") === (path ?? window.location.pathname);
}
}
@@ -368,17 +369,11 @@ if (window.location.hostname === 'localhost') {
document.body.addEventListener('htmx:afterSwap', (ev) => {
if (!(ev.target instanceof HTMLElement)) never();
wireUp(ev.target);
- if (ev.target.tagName == "MAIN") updaetTab();
+ if (ev.target.tagName == "MAIN" || ev.target.tagName == "BODY")
+ updaetTab(ev['detail'].pathInfo.finalRequestPath);
+ console.log(ev);
});
-//document.body.addEventListener('htmx:beforeSend', (ev) => {
-// const target = ev.target;
-// if (target instanceof HTMLButtonElement && target.hasAttribute("hx-push-url")) {
-//
-// document.getElementById("extra-style").textContent = `[hx-push-url="${target.getAttribute("hx-push-url")}"]{background: var(--primary)}`
-// }
-//});
-
getFmtInstance().then(inst => {
document.body.addEventListener('htmx:configRequest', (ev) => {
const details = ev['detail'];
diff --git a/depell/src/main.rs b/depell/src/main.rs
index 1c71391c..3aa6fd74 100644
--- a/depell/src/main.rs
+++ b/depell/src/main.rs
@@ -175,8 +175,8 @@ impl Page for Feed {
let mut last_timestamp = None;
for post in cursor {
write!(buf, "{}", post).unwrap();
- last_timestamp = Some(post.timestamp);
if buf.len() - base_len > MAX_FEED_SIZE {
+ last_timestamp = Some(post.timestamp);
break;
}
}
@@ -561,9 +561,6 @@ fn base(body: impl FnOnce(&mut String), path: &str, session: Option<&Session>) -
- //