[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Gavin D. Smith |
Date: |
Wed, 30 Nov 2022 13:36:44 -0500 (EST) |
branch: old/qt-info
commit 3754ae933893e9ee0e6b230b1e0c77a8ab9f52f6
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Apr 20 21:17:53 2019 +0100
Fix loading of nodes beginning "g_t".
* js/info.js:
(create_link_dict, navigation_links): Extract the filename instead of
the fragment identifier from the URL. Usually there is no difference,
but they differ when the node name does not begin with a letter, in
which case the fragment has "g_t" prefixed.
---
ChangeLog | 10 ++++++++++
js/info.js | 17 +++++++++++++----
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 79cbbf8d56..5c7bf8a787 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2019-04-20 Gavin Smith <gavinsmith0123@gmail.com>
+
+ Fix loading of nodes beginning "g_t".
+
+ * js/info.js:
+ (create_link_dict, navigation_links): Extract the filename instead of
+ the fragment identifier from the URL. Usually there is no difference,
+ but they differ when the node name does not begin with a letter, in
+ which case the fragment has "g_t" prefixed.
+
2019-04-20 Gavin Smith <gavinsmith0123@gmail.com>
Scroll to start of sidebar correctly.
diff --git a/js/info.js b/js/info.js
index efd3eb2e23..ca0af0be9d 100644
--- a/js/info.js
+++ b/js/info.js
@@ -1261,7 +1261,8 @@ var user_config = window["INFO_CONFIG"];
{
if (elem.matches ("a") && elem.hasAttribute ("href"))
{
- var id = href_hash (elem.getAttribute ("href"));
+ var id = basename (remove_hash (elem.getAttribute ("href")),
+ /[.]x?html$/);
links[prev_id] =
Object.assign ({}, links[prev_id], { forward: id });
links[id] = Object.assign ({}, links[id], { backward: prev_id });
@@ -1786,6 +1787,13 @@ var user_config = window["INFO_CONFIG"];
return "";
}
+ /** Remove a fragment identifier from the end of a URL. */
+ function
+ remove_hash (href)
+ {
+ return href.replace (/#.*$/, '');
+ }
+
/** Check if LINKID corresponds to a page containing index links. */
function
linkid_contains_index (linkid)
@@ -1810,11 +1818,12 @@ var user_config = window["INFO_CONFIG"];
var nav_id = navigation_links.dict[link.getAttribute ("accesskey")];
if (nav_id)
{
- var href = basename (link.getAttribute ("href"));
- if (href === config.TOP_NAME)
+ var linkid = basename (remove_hash (link.getAttribute ("href")),
+ /[.]x?html$/);
+ if (linkid === config.TOP_NAME)
res[nav_id] = config.TOP_ID;
else
- res[nav_id] = href_hash (href);
+ res[nav_id] = linkid;
}
else /* this link is part of local table of content. */
{
- [no subject], (continued)
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject], Gavin D. Smith, 2022/11/30
- [no subject],
Gavin D. Smith <=