quicksave hotkey
This commit is contained in:
parent
7a0a7ee605
commit
5dfdca9a76
|
|
@ -447,27 +447,35 @@ try {
|
||||||
document.getElementById("gameDiv").before(qlb);
|
document.getElementById("gameDiv").before(qlb);
|
||||||
document.getElementById("gameDiv").before(document.createElement("br"));
|
document.getElementById("gameDiv").before(document.createElement("br"));
|
||||||
|
|
||||||
quickloadDetectorLastKeys = [];
|
quickSlDetectorLastKeys = [];
|
||||||
justPromptedQuickload = false;
|
justPromptedQuickSL = false;
|
||||||
|
|
||||||
document.addEventListener("keydown", function(e) { //prop prompt listener
|
document.addEventListener("keydown", function(e) { //prop prompt listener
|
||||||
quickloadDetectorLastKeys.push(e.key);
|
quickSlDetectorLastKeys.push(e.key);
|
||||||
if(quickloadDetectorLastKeys.length > 2) {
|
if(quickSlDetectorLastKeys.length > 3) {
|
||||||
quickloadDetectorLastKeys.shift();
|
quickSlDetectorLastKeys.shift();
|
||||||
};
|
};
|
||||||
justPromptedQuickload = false;
|
justPromptedQuickSL = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener("keydown", function(e) { //prop prompt listener
|
document.addEventListener("keydown", function(e) { //prop prompt listener
|
||||||
if (e.key == "@" && !justPromptedQuickload && quickloadDetectorLastKeys[quickloadDetectorLastKeys.length - 2] == "@") {
|
if (quickSlDetectorLastKeys.join(",") == "(,(,L") {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var confirm = prompt("Are you sure you want to quickload? (Type 'yes' to confirm)");
|
var confirm = prompt("Are you sure you want to quickLOAD? (Type 'yes' to confirm)");
|
||||||
if(confirm == "yes") {
|
if(confirm == "yes") {
|
||||||
clearAll();
|
clearAll();
|
||||||
quickload(true,false,true);
|
quickload(true,false,true);
|
||||||
};
|
};
|
||||||
justPromptedQuickload = true;
|
justPromptedQuickSL = true;
|
||||||
quickloadDetectorLastKeys = [];
|
quickSlDetectorLastKeys = [];
|
||||||
|
} else if (quickSlDetectorLastKeys.join(",") == "(,(,S") {
|
||||||
|
e.preventDefault();
|
||||||
|
var confirm = prompt("Are you sure you want to quickSAVE? (Type 'yes' to confirm)");
|
||||||
|
if(confirm == "yes") {
|
||||||
|
quicksave(true,true);
|
||||||
|
};
|
||||||
|
justPromptedQuickSL = true;
|
||||||
|
quickSlDetectorLastKeys = [];
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue