aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.html1
-rw-r--r--main.js4
2 files changed, 5 insertions, 0 deletions
diff --git a/index.html b/index.html
index 8bf6371..d3f9e0f 100644
--- a/index.html
+++ b/index.html
@@ -24,6 +24,7 @@
<div id="stats">
<div id="total-word-count">Total Word Count: <span></span></div>
<div id="path-word-count">Path Word Count: <span></span></div>
+ <div id="page-word-count">Page Word Count: <span></span></div>
<div id="unreachable"></div>
</div>
diff --git a/main.js b/main.js
index 9285947..18b8c97 100644
--- a/main.js
+++ b/main.js
@@ -26,6 +26,10 @@ const wordCount = () => {
nodes.reduce((a,p) => { const n = data.pages[data.paths[p]];
return a + n.body.trim().split(/\s+/).length +
n.choices.reduce((a,c) => a + c[1].trim().split(/\s+/).length, 0)}, 0);
+ const n = data.pages[data.paths[data.current]];
+ document.querySelector("#page-word-count span").innerText =
+ n.body.trim().split(/\s+/).length +
+ n.choices.reduce((a,c) => a + c[1].trim().split(/\s+/).length, 0);
};
const db = new Dexie("vanguard-editor");