8000 [pull] main from miniflux:main by pull[bot] · Pull Request #272 · abcdlsj/miniflux · GitHub
[go: up one dir, main page]

Skip to content
Merged
< 8000 /div>
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions internal/ui/static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ function showToastNotification(iconType, notificationMessage) {
* @param {boolean} reloadOnFail - If true, reload the current page if the target page is not found.
*/
function goToPage(page, reloadOnFail = false) {
const element = document.querySelector(":is(a, button)[data-page=" + page + "]");
const element = document.querySelector(`:is(a, button)[data-page=${page}]`);

if (element) {
document.location.href = element.href;
Expand Down Expand Up @@ -491,9 +491,9 @@ function toggleAriaAttributesOnMainMenu() {
homePageLinkElement.tabIndex = -1;
} else {
// Remove mobile menu button attributes
["role", "tabindex", "aria-expanded", "aria-label"].forEach(attr =>
logoElement.removeAttribute(attr)
);
["role", "tabindex", "aria-expanded", "aria-label"].forEach(attr => {
logoElement.removeAttribute(attr);
});
homePageLinkElement.removeAttribute("tabindex");
}
}
Expand Down Expand Up @@ -649,7 +649,7 @@ function toggleEntryStatus(element, toasting) {
showToastNotification(newStatus, currentStatus === "read" ? buttonElement.dataset.toastUnread : buttonElement.dataset.toastRead);
}

element.classList.replace("item-status-" + currentStatus, "item-status-" + newStatus);
element.classList.replace(`item-status-${currentStatus}`, `item-status-${newStatus}`);

if (isListView() && getVisibleEntries().length === 0) {
window.location.reload();
Expand Down Expand Up @@ -953,7 +953,7 @@ function handleConfirmationMessage(linkElement, callback) {
};

questionElement.className = "confirm";
questionElement.appendChild(document.createTextNode(linkElement.dataset.labelQuestion + " "));
questionElement.appendChild(document.createTextNode(`${linkElement.dataset.labelQuestion} `));
questionElement.appendChild(yesElement);
questionElement.appendChild(document.createTextNode(", "));
questionElement.appendChild(noElement);
Expand Down
10 changes: 5 additions & 5 deletions internal/ui/static/js/keyboard_handler.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
class KeyboardHandler {
constructor() {
this.queue = [];
this.shortcuts = {};
this.shortcuts = new Map();
this.triggers = new Set();
}

on(combination, callback) {
this.shortcuts[combination] = callback;
this.shortcuts.set(combination, callback);
this.triggers.add(combination.split(" ")[0]);
}

Expand All @@ -23,18 +23,18 @@ class KeyboardHandler {

this.queue.push(key);

for (const combination in this.shortcuts) {
for (const [combination, callback] of this.shortcuts.entries()) {
const keys = combination.split(" ");

if (keys.every((value, index) => value === this.queue[index])) {
this.queue = [];
this.shortcuts[combination](event);
callback(event);
return;
}

if (keys.length === 1 && key === keys[0]) {
this.queue = [];
this.shortcuts[combination](event);
callback(event);
return;
}
}
Expand Down
13 changes: 8 additions & 5 deletions internal/ui/static/js/touch_handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class TouchHandler {

const tx = (absDistance > 75 ? Math.sqrt(absDistance - 75) + 75 : absDistance) * Math.sign(distance);

this.touch.element.style.transform = "translateX(" + tx + "px)";
this.touch.element.style.transform = `translateX(${tx}px)`;

event.preventDefault();
}
Expand Down Expand Up @@ -158,20 +158,23 @@ class TouchHandler {
element.addEventListener("touchstart", (e) => this.onItemTouchStart(e), eventListenerOptions);
element.addEventListener("touchmove", (e) => this.onItemTouchMove(e));
element.addEventListener("touchend", (e) => this.onItemTouchEnd(e), eventListenerOptions);
element.addEventListener("touchcancel", this.reset, eventListenerOptions);
// Use arrow to keep TouchHandler context; otherwise this would become the DOM element on cancel.
element.addEventListener("touchcancel", () => this.reset(), eventListenerOptions);
});

const element = document.querySelector(".entry-content");
if (element) {
if (element.classList.contains("gesture-nav-tap")) {
element.addEventListener("touchend", (e) => this.onTapEnd(e), eventListenerOptions);
element.addEventListener("touchmove", this.reset, eventListenerOptions);
element.addEventListener("touchcancel", this.reset, eventListenerOptions);
// Use arrow to keep TouchHandler context; otherwise this would become the DOM element on cancel.
element.addEventListener("touchmove", () => this.reset(), eventListenerOptions);
element.addEventListener("touchcancel", () => this.reset(), eventListenerOptions);
} else if (element.classList.contains("gesture-nav-swipe")) {
element.addEventListener("touchstart", (e) => this.onContentTouchStart(e), eventListenerOptions);
element.addEventListener("touchmove", (e) => this.onContentTouchMove(e), eventListenerOptions);
element.addEventListener("touchend", (e) => this.onContentTouchEnd(e), eventListenerOptions);
element.addEventListener("touchcancel", this.reset, eventListenerOptions);
// Use arrow to keep TouchHandler context; otherwise this would become the DOM element on cancel.
element.addEventListener("touchcancel", () => this.reset(), eventListenerOptions);
}
}
}
Expand Down
16 changes: 10 additions & 6 deletions internal/ui/static/js/webauthn_handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class WebAuthnHandler {
async post(urlKey, username, data) {
let url = document.body.dataset[urlKey];
if (username) {
url += "?username=" + encodeURIComponent(username);
url += `?username=${encodeURIComponent(username)}`;
}

return sendPOSTRequest(url, data);
Expand All @@ -57,7 +57,7 @@ class WebAuthnHandler {
async get(urlKey, username) {
let url = document.body.dataset[urlKey];
if (username) {
url += "?username=" + encodeURIComponent(username);
url += `?username=${encodeURIComponent(username)}`;
}
return fetch(url);
}
Expand Down Expand Up @@ -93,7 +93,9 @@ class WebAuthnHandler {
credentialCreationOptions.publicKey.challenge = this.decodeBuffer(credentialCreationOptions.publicKey.challenge);
credentialCreationOptions.publicKey.user.id = this.decodeBuffer(credentialCreationOptions.publicKey.user.id);
if (Object.hasOwn(credentialCreationOptions.publicKey, 'excludeCredentials')) {
credentialCreationOptions.publicKey.excludeCredentials.forEach((credential) => credential.id = this.decodeBuffer(credential.id));
credentialCreationOptions.publicKey.excludeCredentials.forEach((credential) => {
credential.id = this.decodeBuffer(credential.id);
});
} 8000

let attestation;
Expand Down Expand Up @@ -121,7 +123,7 @@ class WebAuthnHandler {
}

if (!registrationFinishResponse.ok) {
throw new Error("Registration failed with HTTP status code " + registrationFinishResponse.status);
throw new Error(`Registration failed with HTTP status code ${registrationFinishResponse.status}`);
}

const jsonData = await registrationFinishResponse.json();
Expand All @@ -148,7 +150,9 @@ class WebAuthnHandler {
credentialRequestOptions.publicKey.challenge = this.decodeBuffer(credentialRequestOptions.publicKey.challenge);

if (Object.hasOwn(credentialRequestOptions.publicKey, 'allowCredentials')) {
credentialRequestOptions.publicKey.allowCredentials.forEach((credential) => credential.id = this.decodeBuffer(credential.id));
credentialRequestOptions.publicKey.allowCredentials.forEach((credential) => {
credential.id = this.decodeBuffer(credential.id);
});
}

if (abortController) {
Expand Down Expand Up @@ -192,7 +196,7 @@ class WebAuthnHandler {
}

if (!loginFinishResponse.ok) {
throw new Error("Login failed with HTTP status code " + loginFinishResponse.status);
throw new Error(`Login failed with HTTP status code ${loginFinishResponse.status}`);
}

window.location.reload();
Expand Down
Loading
0