如何使用用户脚本(SquareSpace ESC)禁用网站使用的快捷方式?
How to disable a shortcut used by a website with a userscript (SquareSpace ESC)?
一些用SquareSpace制作的网站(比如这个website) redirect the user to the login page when ESC is pressed. How can I prevent this redirection? (I am not the owner of this website so I can't disable this feature in the Website Settings)
这是我尝试过的方法,但这并不能阻止重定向的发生:
if (document.getElementsByTagName("head")[0].innerHTML.includes("squarespace") ==true){
window.addEventListener("keydown", dispatchkeyboardSquareSpace);
function dispatchkeyboardSquareSpace(key) {
if (key.key == "Escape") { ///66 = b https://keycode.info/
console.log("escape neutralized because squarespace")
};
}
}
试试这个(它应该是不言自明的):
Static.SQUARESPACE_CONTEXT.websiteSettings.useEscapeKeyToLogin = false;
一些用SquareSpace制作的网站(比如这个website) redirect the user to the login page when ESC is pressed. How can I prevent this redirection? (I am not the owner of this website so I can't disable this feature in the Website Settings)
这是我尝试过的方法,但这并不能阻止重定向的发生:
if (document.getElementsByTagName("head")[0].innerHTML.includes("squarespace") ==true){
window.addEventListener("keydown", dispatchkeyboardSquareSpace);
function dispatchkeyboardSquareSpace(key) {
if (key.key == "Escape") { ///66 = b https://keycode.info/
console.log("escape neutralized because squarespace")
};
}
}
试试这个(它应该是不言自明的):
Static.SQUARESPACE_CONTEXT.websiteSettings.useEscapeKeyToLogin = false;