From 0fa7ba96b282e8c3db64c4480ec0d019122fb824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=BCnter?= Date: Sun, 16 Jul 2023 10:26:50 +0200 Subject: [PATCH] Fix hotkeys for edge browser control (#6344) Co-authored-by: Marc Bernard <59966492+mbtools@users.noreply.github.com> --- src/ui/zabapgit_js_common.w3mi.data.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/ui/zabapgit_js_common.w3mi.data.js b/src/ui/zabapgit_js_common.w3mi.data.js index bc3503954..6190bdbee 100644 --- a/src/ui/zabapgit_js_common.w3mi.data.js +++ b/src/ui/zabapgit_js_common.w3mi.data.js @@ -1666,14 +1666,22 @@ Hotkeys.prototype.showHotkeys = function() { } }; -Hotkeys.prototype.getAllSapEventsForSapEventName = function(sSapEvent) { - return [].slice.call( - document.querySelectorAll('a[href*="sapevent:' + sSapEvent + '"],' - + 'a[href*="SAPEVENT:' + sSapEvent + '"],' - + 'input[formaction*="sapevent:' + sSapEvent + '"],' - + 'input[formaction*="SAPEVENT:' + sSapEvent + '"],' - + 'form[action*="sapevent:' + sSapEvent + '"] input[type="submit"].main,' - + 'form[action*="SAPEVENT:' + sSapEvent + '"] input[type="submit"].main')); +Hotkeys.prototype.getAllSapEventsForSapEventName = function (sSapEvent) { + if (/^#+$/.test(sSapEvent)){ + // sSapEvent contains only #. Nothing sensible can be done here + return []; + } + + var includesSapEvent = function(text){ + return (text.includes("sapevent") || text.includes("SAPEVENT")); + }; + + return [].slice + .call(document.querySelectorAll("a[href*="+ sSapEvent +"], input[formaction*="+ sSapEvent+"]")) + .filter(function (elem) { + return (elem.nodeName === "A" && includesSapEvent(elem.href) + || (elem.nodeName === "INPUT" && includesSapEvent(elem.formAction))); + }); }; Hotkeys.prototype.getSapEventHref = function(sSapEvent) {