Allow "e" keyboard shortcut to edit a post
This commit is contained in:
parent
2849692fc1
commit
b99e63dbcd
2 changed files with 14 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
})
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
<link rel="stylesheet" id="code-light" href="{% static 'code-light.css' %}" type="text/css">
|
||||
<link rel="stylesheet" id="code-dark" href="{% static 'code-dark.css' %}" type="text/css">
|
||||
<link rel="stylesheet" href="{% static 'style.css' %}" type="text/css">
|
||||
<script src="{% static 'toggle-dark-mode.js' %}" async></script>
|
||||
<script src="{% static 'scripts.js' %}" async></script>
|
||||
<link rel="alternate" type="application/rss+xml" title="Gab's Notes » Feed" href="{% url 'complete-feed' %}">
|
||||
{% include "articles/favicon.html" %}
|
||||
{% include "articles/analytics.html" %}
|
||||
|
|
Reference in a new issue