[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Gavin D. Smith |
Date: |
Sat, 5 Oct 2024 16:48:49 -0400 (EDT) |
branch: master
commit 1f807c51e293546eba217fb875fd59c1d5a48c37
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Oct 5 21:48:25 2024 +0100
Rename info.js variable
* js/info.js (init_index_page, updater):
Rename "index" variable and fields to "TI_index" to mark it as a
Text_input object and make it clearer when this object is being
used as opposed to other various contradictory uses of the
word "index".
---
ChangeLog | 10 ++++++++++
js/info.js | 27 +++++++++++++--------------
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6abc56469f..3dd88596ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-10-05 Gavin Smith <gavinsmith0123@gmail.com>
+
+ Rename info.js variable
+
+ * js/info.js (init_index_page, updater):
+ Rename "index" variable and fields to "TI_index" to mark it as a
+ Text_input object and make it clearer when this object is being
+ used as opposed to other various contradictory uses of the
+ word "index".
+
2024-10-05 Gavin Smith <gavinsmith0123@gmail.com>
* js/info.js (init_index_page, navigation_links): rename
diff --git a/js/info.js b/js/info.js
index dab3c3bbae..cf301adaff 100644
--- a/js/info.js
+++ b/js/info.js
@@ -252,8 +252,8 @@ updater (state, action)
}
case "cache-index-links":
{
- // Initially res.index is undefined, which is ignored.
- res.index = Object.assign ({}, res.index, action.links);
+ // Initially res.TI_index is undefined, which is ignored.
+ res.TI_index = Object.assign ({}, res.TI_index, action.links);
return res;
}
case "section":
@@ -348,9 +348,9 @@ updater (state, action)
/* When CURRENT is in index but doesn't have the requested
direction, ask its corresponding 'pageid'. */
var is_index_ref =
- Object.keys (state.index)
+ Object.keys (state.TI_index)
.reduce (function (acc, val) {
- return acc || state.index[val] === current;
+ return acc || state.TI_index[val] === current;
}, false);
if (is_index_ref)
{
@@ -683,12 +683,11 @@ init_index_page ()
}
};
- var index = new Text_input ("index");
- index.render = function (state) {
- if (state.text_input === "index")
- {
- if (state.index)
- this.show (state.index);
+ var TI_index = new Text_input ("index");
+ TI_index.render = function (state) {
+ if (state.text_input === "index") {
+ if (state.TI_index)
+ this.show (state.TI_index);
else
store.dispatch (actions.warn ("No index in this document"))
}
@@ -701,7 +700,7 @@ init_index_page ()
};
elem.appendChild (TI_menu.element);
- elem.appendChild (index.element);
+ elem.appendChild (TI_index.element);
elem.appendChild (search.element);
/* Create a container for warning when no menu in current page.*/
@@ -711,7 +710,7 @@ init_index_page ()
this.element = elem;
this.TI_menu = TI_menu;
- this.index = index;
+ this.TI_index = TI_index;
this.search = search;
this.warn = warn$;
this.toid = null;
@@ -737,12 +736,12 @@ init_index_page ()
if (!state.text_input || state.warning)
{
this.TI_menu.hide ();
- this.index.hide ();
+ this.TI_index.hide ();
this.search.hide ();
}
else
{
- this.index.render (state);
+ this.TI_index.render (state);
this.TI_menu.render (state);
this.search.render (state);
}