Replace all references to #gametext with game_text

Come to think of it, I'm not sure where the variable "gametext" was even
defined. Is this some kind of sorcery?
This commit is contained in:
Gnome Ann 2021-09-27 16:04:42 -04:00
parent 3b19d4518a
commit 5f154b8b55
1 changed files with 8 additions and 8 deletions

View File

@ -954,16 +954,16 @@ function chunkOnSelectionChange(event) {
// This gets run when you defocus the editor by clicking // This gets run when you defocus the editor by clicking
// outside of the editor or by pressing escape or tab // outside of the editor or by pressing escape or tab
function chunkOnFocusOut(event) { function chunkOnFocusOut(event) {
if(!gametext_bound || event.target !== gametext) { if(!gametext_bound || event.target !== game_text[0]) {
return; return;
} }
setTimeout(function() { setTimeout(function() {
if(document.activeElement === gametext || gametext.contains(document.activeElement)) { if(document.activeElement === game_text[0] || game_text[0].contains(document.activeElement)) {
return; return;
} }
syncAllModifiedChunks(true); syncAllModifiedChunks(true);
setTimeout(function() { setTimeout(function() {
var blurred = $("#gametext")[0] !== document.activeElement; var blurred = game_text[0] !== document.activeElement;
if(blurred) { if(blurred) {
deleteEmptyChunks(); deleteEmptyChunks();
} }
@ -975,7 +975,7 @@ function chunkOnFocusOut(event) {
} }
function bindGametext() { function bindGametext() {
mutation_observer.observe($("#gametext")[0], {characterData: true, childList: true, subtree: true}); mutation_observer.observe(game_text[0], {characterData: true, childList: true, subtree: true});
gametext_bound = true; gametext_bound = true;
} }
@ -1071,7 +1071,7 @@ $(document).ready(function(){
$('#allowediting').prop('checked', allowedit).prop('disabled', false).change().off('change').on('change', function () { $('#allowediting').prop('checked', allowedit).prop('disabled', false).change().off('change').on('change', function () {
if(allowtoggle) { if(allowtoggle) {
allowedit = $(this).prop('checked'); allowedit = $(this).prop('checked');
$(gametext).attr('contenteditable', allowedit); game_text.attr('contenteditable', allowedit);
} }
}); });
} else if(msg.cmd == "updatescreen") { } else if(msg.cmd == "updatescreen") {
@ -1348,7 +1348,7 @@ $(document).ready(function(){
}); });
// Register editing events // Register editing events
$(gametext).on('keydown', game_text.on('keydown',
chunkOnKeyDown chunkOnKeyDown
).on('paste', ).on('paste',
chunkOnPaste chunkOnPaste
@ -1365,8 +1365,8 @@ $(document).ready(function(){
// because the gods of HTML and JavaScript say so // because the gods of HTML and JavaScript say so
$(document.body).on('focusin', function(event) { $(document.body).on('focusin', function(event) {
setTimeout(function() { setTimeout(function() {
if(document.activeElement !== gametext && gametext.contains(document.activeElement)) { if(document.activeElement !== game_text[0] && game_text[0].contains(document.activeElement)) {
gametext.focus(); game_text[0].focus();
} }
}, 2); }, 2);
}); });