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