diff options
author | Adam Hovorka <[email protected]> | 2020-05-13 19:30:02 -0600 |
---|---|---|
committer | Adam Hovorka <[email protected]> | 2020-05-13 19:30:02 -0600 |
commit | 143ec6503417530f831c8d42b5eb50cd9f2e47ac (patch) | |
tree | 3ca548e24df5852ef36c787f64b9bc8cf91c9a2e | |
parent | 41ec8ac05a86527c49403f4972eb9b857372790a (diff) |
-rw-r--r-- | index.html | 1 | ||||
-rw-r--r-- | main.js | 4 |
2 files changed, 5 insertions, 0 deletions
@@ -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> @@ -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"); |