[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:45 -0500 (EST) |
branch: old/qt-info
commit e2d72c0f4fff7a154e8e3476e1b311ce117c4302
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Apr 20 23:38:02 2019 +0100
Avoid white flash when changing node.
* js/info.js
(Pages.prototype.render): Do not hide the div containing the
previous node here.
(resolve_page): Take an argument that is the previous div
containing an iframe containing a node. Hide it only when the
next node is loaded and displayed. This avoids a "white flash"
appearing when the node changes and gives navigation a snappier
feel.
---
ChangeLog | 13 +++++++++++++
js/info.js | 17 +++++++++++++----
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 28de8fae08..d7642c2c9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2019-04-20 Gavin Smith <gavinsmith0123@gmail.com>
+
+ Avoid white flash when changing node.
+
+ * js/info.js
+ (Pages.prototype.render): Do not hide the div containing the
+ previous node here.
+ (resolve_page): Take an argument that is the previous div
+ containing an iframe containing a node. Hide it only when the
+ next node is loaded and displayed. This avoids a "white flash"
+ appearing when the node changes and gives navigation a snappier
+ feel.
+
2019-04-20 Gavin Smith <gavinsmith0123@gmail.com>
Change Top link in sidebar.
diff --git a/js/info.js b/js/info.js
index 0051df4c5b..7ca426c5c0 100644
--- a/js/info.js
+++ b/js/info.js
@@ -809,15 +809,16 @@ init_top_page ()
if (state.current !== this.prev_id)
{
+ var prev_div;
if (this.prev_id)
{
- this.prev_div.setAttribute ("hidden", "true");
+ prev_div = this.prev_div;
/* Remove previous highlights. */
var old = linkid_split (this.prev_id);
var msg = { message_kind: "highlight", regexp: null };
post_message (old.pageid, msg);
}
- var div = resolve_page (state.current, true);
+ var div = resolve_page (state.current, true, prev_div);
/* Remove any anchor. */
var link = linkid_split (state.current);
state.current = link.pageid;
@@ -905,7 +906,7 @@ init_top_page ()
@arg {boolean} [visible]
@return {HTMLElement} the div element. */
function
- resolve_page (linkid, visible)
+ resolve_page (linkid, visible, prev_div)
{
var msg;
var link = linkid_split (linkid);
@@ -922,6 +923,8 @@ init_top_page ()
if ((pageid === config.TOP_ID) && visible)
{
div.removeAttribute ("hidden");
+ if (visible && prev_div)
+ prev_div.setAttribute ("hidden", "true");
}
else
{
@@ -934,9 +937,15 @@ init_top_page ()
div.appendChild (iframe);
iframe.addEventListener ("load", function () {
- store.dispatch ({ type: "iframe-ready", id: pageid });
+ if (visible && prev_div)
+ prev_div.setAttribute ("hidden", "true");
+ store.dispatch ({ type: "iframe-ready", id: pageid,
+ prev_div: prev_div });
}, false);
}
+ else if (visible && prev_div)
+ prev_div.setAttribute ("hidden", "true");
+
if (visible)
{
div.removeAttribute ("hidden");
- [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