diff options
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 32 |
1 files changed, 31 insertions, 1 deletions
@@ -202,6 +202,29 @@ function is_action(action) { function on_log(text) { // eslint-disable-line no-unused-vars
let p = document.createElement("div")
+//Check if adding influence the the same place as the previous influence
+
+ //let last_log_entry = document.getElementById("log").lastElementChild
+ console.log('view.log', view.log)
+ let last_log_entry = document.querySelector(`#log div:nth-child(${view.log.length-1})`)
+ let last_log_entry_text
+ console.log('last_log_entry', last_log_entry)
+ if (last_log_entry) {
+ last_log_entry_text = last_log_entry.innerHTML
+ console.log('last_log_entry_text', last_log_entry_text)
+ }
+
+
+/*
+ let last_text = last_log_entry ? last_log_entry.split(' ') : []
+ console.log('last text', last_text, 'text', text.split(' ')[3])
+ if (last_text[0] === 'Added' && last_text[4] === text.split(' ')[4]) {
+ let new_influence = parseInt(last_text[1]) + 1
+ new_text = `Added ${new_influence} influence in ${last_text[4]}`
+ console.log('new_influence', new_influence, 'new_text', new_text)
+ } */
+
+
if (text.match(/^>/)) {
text = text.substring(1)
p.className = 'i'
@@ -235,6 +258,13 @@ function on_log(text) { // eslint-disable-line no-unused-vars p.className = 'h3'
}
+ //console.log('view.log', view.log)
+ console.log('new text', text)
+ if (last_log_entry_text) {
+ console.log('log = text', last_log_entry_text === text)
+ }
+
+
p.innerHTML = text
return p
}
@@ -595,7 +625,7 @@ if (view.persistent_events['the_tyrant_is_gone'] > 0) { action_button("done", "Done")
action_button("undo", "Undo")
- console.log('view.log', view.log)
+ //console.log('view.log', view.log)
}
|