Scroll Test

This commit is contained in:
ebolam
2022-07-14 19:45:11 -04:00
parent 454bab3863
commit 56d150abc9
2 changed files with 10 additions and 7 deletions

View File

@@ -38,8 +38,8 @@ function disconnect() {
function reset_story() {
console.log("Resetting story");
var story_area = document.getElementById('Selected Text');
while (story_area.firstChild) {
story_area.removeChild(story_area.firstChild);
while (story_area.lastChild.id != 'story_prompt') {
story_area.removeChild(story_area.lastChild);
}
var option_area = document.getElementById("Select Options");
while (option_area.firstChild) {
@@ -992,10 +992,13 @@ function update_token_lengths() {
}
max_chunk = -1;
for (item of document.getElementById("Selected Text").childNodes) {
if (item.id != "story_prompt") {
chunk_num = parseInt(item.id.replace("Selected Text Chunk ", ""));
if (chunk_num > max_chunk) {
max_chunk = chunk_num;
console.log(item);
if (item.id != undefined) {
if (item.id != "story_prompt") {
chunk_num = parseInt(item.id.replace("Selected Text Chunk ", ""));
if (chunk_num > max_chunk) {
max_chunk = chunk_num;
}
}
}
}

View File

@@ -32,7 +32,7 @@
<div class="menubar3"></div>
</div>
<!------------ Game Text Screen--------------------->
<div class="gamescreen rawtext" id="gamescreen">
<div class="gamescreen" id="gamescreen">
<div class="gametext" id="Selected Text">
<span id="story_prompt" class="var_sync_story_prompt var_sync_alt_story_prompt_length rawtext" contenteditable=true onchange="sync_to_server(this);" onkeydown="detect_enter_text"></span>
</div>