// ==UserScript== // @name LZTConversationEsc // @namespace http://tampermonkey.net/ // @version 0.1 // @description The script allows you to exit the dialog using the Esc keys // @author MeloniuM // @license MIT // @match *://zelenka.guru/conversations/* // @match *://lolz.guru/conversations/* // @match *://lolz.live/conversations/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; let loc = window.location.pathname; if (!(loc.startsWith('/conversations/'))){ return; } window.addEventListener( "keydown", (event) => { if (event.defaultPrevented) { return; // Do nothing if the event was already processed } switch (event.key) { case "Esc": // IE/Edge specific value case "Escape": if (loc != "/conversations/"){ //window.location.href = "/conversations/"; window.history.back(); } break; default: return; // Quit when this doesn't handle the key event. } // Cancel the default action to avoid it being handled twice event.preventDefault(); }, true ); })();