[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:42 -0500 (EST) |
branch: old/qt-info
commit e6bf0953f8603814e54fcee83ad92f9fe198d2a7
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Apr 13 21:51:00 2019 +0100
Defer calling fix_links.
(init_top_page) <on_load>: Do not call fix_links.
(init_iframe) <on_message>: Accept message type "fix-links" to
call fix_links.
(resolve_page): Pass a "fix-links" message.
(actions) <cache_index_links>: Save the entire href attribute,
not just the fragment.
(Text_input) <Enter pressed>: Call with_sidebar_query before
set_current_url action, as the hrefs in the saved index entries
are what was in the file originally.
This greatly speeds up opening a manual with a large index (for
example, the Concept Index in Texinfo's manual).
---
ChangeLog | 17 +++++++++++++++++
js/docbrowser/qtinfo.js | 12 ++++++++++--
js/info.js | 21 +++++++++++++++++----
3 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d055b5c81a..f50dded49b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2019-04-13 Gavin Smith <gavinsmith0123@gmail.com>
+
+ Defer calling fix_links.
+
+ (init_top_page) <on_load>: Do not call fix_links.
+ (init_iframe) <on_message>: Accept message type "fix-links" to
+ call fix_links.
+ (resolve_page): Pass a "fix-links" message.
+ (actions) <cache_index_links>: Save the entire href attribute,
+ not just the fragment.
+ (Text_input) <Enter pressed>: Call with_sidebar_query before
+ set_current_url action, as the hrefs in the saved index entries
+ are what was in the file originally.
+
+ This greatly speeds up opening a manual with a large index (for
+ example, the Concept Index in Texinfo's manual).
+
2019-04-12 Gavin Smith <gavinsmith0123@gmail.com>
Remove wc_controlled conditional.
diff --git a/js/docbrowser/qtinfo.js b/js/docbrowser/qtinfo.js
index 8cb05f5ab7..63c3ee37ff 100644
--- a/js/docbrowser/qtinfo.js
+++ b/js/docbrowser/qtinfo.js
@@ -65,8 +65,16 @@ function wc_init()
alert("asked to go to " + url);
});
- channel.objects.core.set_current_url.connect(function(linkid) {
- store.dispatch (actions.set_current_url (linkid));
+ channel.objects.core.set_current_url.connect(function(anchor) {
+ /* For deferring the link conversion, as running fix_links on
+ a large index is very slow.
+ If the links have been converted already (the case for menus),
+ this works anyway: running with_sidebar_query on text already
+ in 'linkid' format doesn't change it. */
+
+ var linkid = with_sidebar_query (anchor)
+ console.log("LINKID "+linkid);
+ store.dispatch (actions.set_current_url (href_hash (linkid)));
});
channel.objects.core.search.connect(function(string) {
diff --git a/js/info.js b/js/info.js
index 8dbeb60f2c..1320a54b9f 100644
--- a/js/info.js
+++ b/js/info.js
@@ -152,7 +152,7 @@ var user_config = window["INFO_CONFIG"];
for (var i = 0; i < links.length; i += 1)
{
var link = links[i];
- dict[link.textContent] = href_hash (link.getAttribute ("href"));
+ dict[link.textContent] = link.getAttribute ("href");
}
return { type: "cache-index-links", links: dict };
},
@@ -561,7 +561,8 @@ var user_config = window["INFO_CONFIG"];
{
var linkid = this.data[this.input.value];
if (linkid)
- store.dispatch (actions.set_current_url (linkid));
+ store.dispatch (actions.set_current_url
+ (href_hash(with_sidebar_query (linkid))));
}
event.stopPropagation ();
}).bind (this));
@@ -932,6 +933,11 @@ var user_config = window["INFO_CONFIG"];
}
if (visible)
{
+ /* Delay fixing the links until the page is actually
+ due to be displayed. */
+ msg = { message_kind: "fix-links" };
+ post_message (pageid, msg);
+
div.removeAttribute ("hidden");
msg = { message_kind: "scroll-to", hash: link.hash };
post_message (pageid, msg);
@@ -1355,7 +1361,6 @@ var user_config = window["INFO_CONFIG"];
function
on_load ()
{
- fix_links (document.links);
var links = {};
var linkid = basename (location.pathname, /[.]x?html$/);
links[linkid] = navigation_links (document);
@@ -1387,6 +1392,14 @@ var user_config = window["INFO_CONFIG"];
var found = search (document.body, data.regexp);
store.dispatch ({ type: "search-result", found: found });
}
+ else if (data.message_kind === "fix-links")
+ {
+ if (!window.links_fixed)
+ {
+ window.links_fixed = 1;
+ fix_links (document.links);
+ }
+ }
else if (data.message_kind === "scroll-to")
{
/* Scroll to the anchor corresponding to HASH. */
@@ -2048,7 +2061,7 @@ function init() {
else if (inside_iframe)
{
store = new Remote_store ();
- var iframe = init_iframe (undefined);
+ var iframe = init_iframe ();
window.addEventListener ("DOMContentLoaded", iframe.on_load, false);
window.addEventListener ("message", iframe.on_message, false);
}
- [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 <=
- [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