aboutsummaryrefslogtreecommitdiffhomepage
path: root/static/index.js
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-06-23 02:47:25 +0900
committernsfisis <nsfisis@gmail.com>2025-06-23 02:50:24 +0900
commit27bfc8f1d9588322d85197e31b7346601cc680b3 (patch)
tree9782a857f8b7a76be75774e10674d59e3fa260a0 /static/index.js
parent6522702f59706c84f419491d4ac8b86cfba2ffe2 (diff)
downloadfeedaka-27bfc8f1d9588322d85197e31b7346601cc680b3.tar.gz
feedaka-27bfc8f1d9588322d85197e31b7346601cc680b3.tar.zst
feedaka-27bfc8f1d9588322d85197e31b7346601cc680b3.zip
feat: add biome
Diffstat (limited to 'static/index.js')
-rw-r--r--static/index.js80
1 files changed, 40 insertions, 40 deletions
diff --git a/static/index.js b/static/index.js
index d546dba..6354bbd 100644
--- a/static/index.js
+++ b/static/index.js
@@ -1,47 +1,47 @@
const markAllArticles = (feedId, el, read) => {
- const basePath = window.BASE_PATH;
- const apiUrl = `${basePath}/api/feeds/${feedId}/${read ? 'read' : 'unread'}`;
- fetch(apiUrl, { method: 'PUT' })
- .then(_data => {
- el.parentNode.nextElementSibling.remove();
- el.parentNode.remove();
- })
- .catch(error => {
- alert(error);
- });
+ const basePath = window.BASE_PATH;
+ const apiUrl = `${basePath}/api/feeds/${feedId}/${read ? "read" : "unread"}`;
+ fetch(apiUrl, { method: "PUT" })
+ .then((_data) => {
+ el.parentNode.nextElementSibling.remove();
+ el.parentNode.remove();
+ })
+ .catch((error) => {
+ alert(error);
+ });
};
const markOneArticle = (articleId, el, read) => {
- const basePath = window.BASE_PATH;
- const apiUrl = `${basePath}/api/articles/${articleId}/${read ? 'read' : 'unread'}`;
- fetch(apiUrl, { method: 'PUT' })
- .then(_data => {
- el.parentNode.remove();
- })
- .catch(error => {
- alert(error);
- });
+ const basePath = window.BASE_PATH;
+ const apiUrl = `${basePath}/api/articles/${articleId}/${read ? "read" : "unread"}`;
+ fetch(apiUrl, { method: "PUT" })
+ .then((_data) => {
+ el.parentNode.remove();
+ })
+ .catch((error) => {
+ alert(error);
+ });
};
-document.addEventListener('DOMContentLoaded', () => {
- document.querySelectorAll('.js-unread-feed').forEach(el => {
- el.addEventListener('click', () => {
- markAllArticles(el.dataset.feedId, el, false);
- });
- });
- document.querySelectorAll('.js-unread-article').forEach(el => {
- el.addEventListener('click', () => {
- markOneArticle(el.dataset.articleId, el, false);
- });
- });
- document.querySelectorAll('.js-read-feed').forEach(el => {
- el.addEventListener('click', () => {
- markAllArticles(el.dataset.feedId, el, true);
- });
- });
- document.querySelectorAll('.js-read-article').forEach(el => {
- el.addEventListener('click', () => {
- markOneArticle(el.dataset.articleId, el, true);
- });
- });
+document.addEventListener("DOMContentLoaded", () => {
+ document.querySelectorAll(".js-unread-feed").forEach((el) => {
+ el.addEventListener("click", () => {
+ markAllArticles(el.dataset.feedId, el, false);
+ });
+ });
+ document.querySelectorAll(".js-unread-article").forEach((el) => {
+ el.addEventListener("click", () => {
+ markOneArticle(el.dataset.articleId, el, false);
+ });
+ });
+ document.querySelectorAll(".js-read-feed").forEach((el) => {
+ el.addEventListener("click", () => {
+ markAllArticles(el.dataset.feedId, el, true);
+ });
+ });
+ document.querySelectorAll(".js-read-article").forEach((el) => {
+ el.addEventListener("click", () => {
+ markOneArticle(el.dataset.articleId, el, true);
+ });
+ });
});