Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/darshanbaral/ghazal.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarshan Baral <darshanbaral@users.noreply.github.com>2020-04-24 21:19:29 +0300
committerGitHub <noreply@github.com>2020-04-24 21:19:29 +0300
commit23df198d88e1133a578f33248c6ac1835d70bdd7 (patch)
treef63bd8cdedd8781f464cc804f618d1391277c197
parentf2a6c838b9b12a9909c1ac83b6dc3c2aed104425 (diff)
parent1cb017191320496f3390107af144a87dd7b9c6d9 (diff)
Merge pull request #2 from darshanbaral/alt-animation-in-home
keyboard navigation for list page
-rw-r--r--layouts/_default/list.html40
-rw-r--r--layouts/index.html1
2 files changed, 35 insertions, 6 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index e020f51..f76389a 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -7,18 +7,48 @@
<div>
{{ range (.Paginator .Site.Params.theme.paginateNum).Pages }}
<div
- style="border: solid 1px; margin: 30px 0; padding: 10px; border-radius: 5px; background-color: var(--bgAltColor);"
+ style="
+ border: solid 1px;
+ margin: 30px 0;
+ padding: 10px;
+ border-radius: 5px;
+ background-color: var(--bgAltColor);
+ "
>
<a href="{{ .Permalink | relURL }}">
<h2 style="margin: 0; font-size: 1.2em;">{{ .Title -}}</h2>
</a>
<span style="font-size: 0.65em; font-style: italic;"
- ><time
- >{{- dateFormat .Site.Params.theme.dateFormat .Date }}</time
- > &middot; {{.Site.Params.author }}</span
+ ><time>{{- dateFormat .Site.Params.theme.dateFormat .Date }}</time>
+ &middot; {{.Site.Params.author }}</span
>
- <p style="margin: 0; font-size: 0.8em;">{{ substr .Summary 0 125 | plainify }}...</p>
+ <p style="margin: 0; font-size: 0.8em;">
+ {{ .Summary | plainify | truncate 180 }}
+ </p>
</div>
{{ end }}
</div>
+<script>
+ document.onkeydown = function (e) {
+ const thisPage = document.querySelector(".page-item.active");
+ if (thisPage) {
+ switch (e.keyCode) {
+ case 37:
+ //left key
+ let previousPage = thisPage.previousElementSibling.querySelector("a");
+ if (previousPage) {
+ previousPage.click();
+ }
+ break;
+ case 39:
+ //right key
+ let nextPage = thisPage.nextElementSibling.querySelector("a");
+ if (nextPage) {
+ nextPage.click();
+ }
+ break;
+ }
+ }
+ };
+</script>
{{ end }}
diff --git a/layouts/index.html b/layouts/index.html
index 84625a1..ce5598a 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -50,7 +50,6 @@
opacity: 1;
visibility: visible;
transition: opacity 0.8s, width 0.8s, transform 0.8s;
- cursor: pointer;
width: 100%;
transform: none;
"