setInterval(function() {
if($gameMessage.hasText() && $gameMessage._texts[0].indexOf("Do you want to give up?")!=-1) {
// Clear the message = unfreeze the game, but popup message stays on the screen
$gameMessage.clear();
// Click enter to confirm the message popup if it appeared on the screen
document.dispatchEvent(new KeyboardEvent('keydown', {
key: 'Enter',
code: 'Enter',
keyCode: 13, // Enter key corresponds to keyCode 13
which: 13, // 'which' property is similar to keyCode
bubbles: true, // Allows the event to bubble up through the DOM
cancelable: true // Allows event to be canceled
}));
console.log("REMOVED POPUP MESSAGE!");
}
}, 1);