From 3c6653a77b8951672ea169d175db154495a981fe Mon Sep 17 00:00:00 2001 From: r Date: Sun, 12 Jan 2020 17:16:57 +0000 Subject: Add dark mode --- static/fluoride.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'static/fluoride.js') diff --git a/static/fluoride.js b/static/fluoride.js index 25ab4a3..6a1b5fb 100644 --- a/static/fluoride.js +++ b/static/fluoride.js @@ -1,8 +1,12 @@ var actionIcons = { "like": "/static/icons/star-o.png", + "dark-like": "/static/icons/dark-star-o.png", "unlike": "/static/icons/liked.png", + "dark-unlike": "/static/icons/liked.png", "retweet": "/static/icons/retweet.png", - "unretweet": "/static/icons/retweeted.png" + "dark-retweet": "/static/icons/dark-retweet.png", + "unretweet": "/static/icons/retweeted.png", + "dark-unretweet": "/static/icons/retweeted.png" }; var reverseActions = { @@ -31,7 +35,11 @@ function http(method, url, success, error) { } function updateActionForm(id, f, action) { - f.children[1].src = actionIcons[action]; + if (Array.from(document.body.classList).indexOf("dark") > -1) { + f.children[1].src = actionIcons["dark-" + action]; + } else { + f.children[1].src = actionIcons[action]; + } f.action = "/" + action + "/" + id; f.dataset.action = action; } -- cgit v1.2.3