diff --git a/articles/static/toggle-dark-mode.js b/articles/static/scripts.js similarity index 52% rename from articles/static/toggle-dark-mode.js rename to articles/static/scripts.js index 74cb25d..aaa4bda 100644 --- a/articles/static/toggle-dark-mode.js +++ b/articles/static/scripts.js @@ -17,3 +17,16 @@ function darkModeListener(e) { let mql = window.matchMedia("(prefers-color-scheme: dark)"); darkModeListener(mql); mql.addListener(darkModeListener); + +window.onload = function () { + const adminLinkElement = document.querySelector(".article-detail .metadata a.admin-link"); + if (adminLinkElement === undefined || adminLinkElement === null) { + return; + } + const adminLocation = adminLinkElement.href; + document.addEventListener("keydown", event => { + if (event.code === "KeyE") { + window.location = adminLocation; + } + }) +} diff --git a/articles/templates/articles/base.html b/articles/templates/articles/base.html index 4fbeb15..586c52b 100644 --- a/articles/templates/articles/base.html +++ b/articles/templates/articles/base.html @@ -8,7 +8,7 @@ - + {% include "articles/favicon.html" %} {% include "articles/analytics.html" %}