aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/js/index.js8
-rw-r--r--static/js/pager.ts12
-rw-r--r--themes/default/layouts/partials/author-card.html2
-rw-r--r--themes/default/layouts/partials/context-profile.html2
-rw-r--r--themes/default/layouts/partials/meta-handle.html2
5 files changed, 21 insertions, 5 deletions
diff --git a/assets/js/index.js b/assets/js/index.js
index 9f684bf..b284ce8 100644
--- a/assets/js/index.js
+++ b/assets/js/index.js
@@ -12,10 +12,13 @@
if (localStorage["settings"]) {
settings = JSON.parse(localStorage["settings"]);
}
- if (self.location.href.indexOf("#") >= 0) {
+ if (self.location.hash.length > 0) {
settings["pager"][url] = self.pageYOffset;
localStorage["settings"] = JSON.stringify(settings);
document.getElementById(location.hash.slice(1)).scrollIntoView();
+ self.addEventListener("load", function() {
+ document.getElementById(location.hash.slice(1)).scrollIntoView();
+ });
return;
}
if (settings["pager"][url] > 0) {
@@ -29,6 +32,9 @@
const currentPosition = self.pageYOffset;
settings["pager"][url] = currentPosition;
localStorage["settings"] = JSON.stringify(settings);
+ if (self.location.hash.length === 0) {
+ history.replaceState({}, document.title, window.location.href.split("#")[0]);
+ }
});
self.addEventListener("DOMContentLoaded", function() {
const up = document.getElementById("top");
diff --git a/static/js/pager.ts b/static/js/pager.ts
index f01de10..88e9f83 100644
--- a/static/js/pager.ts
+++ b/static/js/pager.ts
@@ -7,10 +7,13 @@
if (localStorage["settings"]) {
settings = JSON.parse(localStorage["settings"]);
}
- if (self.location.href.indexOf("#") >= 0) {
+ if (self.location.hash.length > 0) {
settings["pager"][url] = self.pageYOffset;
localStorage["settings"] = JSON.stringify(settings);
document.getElementById(location.hash.slice(1)).scrollIntoView();
+ self.addEventListener("load", function () {
+ document.getElementById(location.hash.slice(1)).scrollIntoView();
+ });
return;
}
if (settings["pager"][url] > 0) {
@@ -25,6 +28,13 @@
const currentPosition = self.pageYOffset;
settings["pager"][url] = currentPosition;
localStorage["settings"] = JSON.stringify(settings);
+ if (self.location.hash.length === 0) {
+ history.replaceState(
+ {},
+ document.title,
+ window.location.href.split("#")[0],
+ );
+ }
});
self.addEventListener("DOMContentLoaded", function () {
diff --git a/themes/default/layouts/partials/author-card.html b/themes/default/layouts/partials/author-card.html
index 90e7781..bd34ce8 100644
--- a/themes/default/layouts/partials/author-card.html
+++ b/themes/default/layouts/partials/author-card.html
@@ -6,7 +6,7 @@
<micro-summary>
<micro-thumbnail>
<figure>
- <a title="{{ .Data.name }}" href="{{ "" | absURL }}/{{ .Data.user }}">
+ <a title="{{ .Data.name }}" href="{{ "" | absURL }}/{{ .Data.user }}#">
<picture>
{{- with $image }}
{{- $image = .Content | resources.FromString (print "/data/static/images/" ($image | urlize)) }}
diff --git a/themes/default/layouts/partials/context-profile.html b/themes/default/layouts/partials/context-profile.html
index 3647ba2..1a71bd0 100644
--- a/themes/default/layouts/partials/context-profile.html
+++ b/themes/default/layouts/partials/context-profile.html
@@ -8,7 +8,7 @@
{{- with .Params.feed.name -}}
<a title="{{ . }}" href="http://{{ $.Params.feed.domain }}">
{{- else -}}
- <a title="{{ $author.name }}" href="{{ .Site.BaseURL }}/{{ $author.user }}">
+ <a title="{{ $author.name }}" href="{{ .Site.BaseURL }}/{{ $author.user }}#">
{{- end -}}
<picture>
{{ partial "author-picture" . }}
diff --git a/themes/default/layouts/partials/meta-handle.html b/themes/default/layouts/partials/meta-handle.html
index f22d818..c6608b0 100644
--- a/themes/default/layouts/partials/meta-handle.html
+++ b/themes/default/layouts/partials/meta-handle.html
@@ -7,7 +7,7 @@
{{- else -}}
<a
title="{{ partial "author-user.html" . }}@{{ (urls.Parse .Site.BaseURL).Host }}"
- href="{{ .Site.BaseURL }}/{{ partial "author-user.html" . }}">
+ href="{{ .Site.BaseURL }}/{{ partial "author-user.html" . }}#">
@{{ (urls.Parse .Site.BaseURL).Host -}}
</a>
{{- end -}}