Skip to content

Commit

Permalink
[JENKINS-70910] Remove Prototype.Browser usages from `hudson-behavi…
Browse files Browse the repository at this point in the history
…or.js` (#7954)
  • Loading branch information
timja authored May 8, 2023
1 parent ffd412a commit 6b08a5c
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions war/src/main/webapp/scripts/hudson-behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -1046,22 +1046,11 @@ function helpButtonOnClick() {
return false;
}

function isGeckoCommandKey() {
return Prototype.Browser.Gecko && event.keyCode == 224;
}
function isOperaCommandKey() {
return Prototype.Browser.Opera && event.keyCode == 17;
}
function isWebKitCommandKey() {
return (
Prototype.Browser.WebKit && (event.keyCode == 91 || event.keyCode == 93)
);
}
function isCommandKey() {
return isGeckoCommandKey() || isOperaCommandKey() || isWebKitCommandKey();
function isCommandKey(event) {
return event.key === "Meta";
}
function isReturnKeyDown() {
return event.type == "keydown" && event.keyCode == Event.KEY_RETURN;
return event.type == "keydown" && event.key === "Enter";
}
function getParentForm(element) {
if (element == null) throw "not found a parent form";
Expand Down Expand Up @@ -1303,10 +1292,10 @@ function rowvgStartEachRow(recursive, f) {

// Mac (Command + Enter)
if (navigator.userAgent.indexOf("Mac") > -1) {
if (event.type == "keydown" && isCommandKey()) {
if (event.type == "keydown" && isCommandKey(event)) {
cmdKeyDown = true;
}
if (event.type == "keyup" && isCommandKey()) {
if (event.type == "keyup" && isCommandKey(event)) {
cmdKeyDown = false;
}
if (cmdKeyDown && isReturnKeyDown()) {
Expand Down

0 comments on commit 6b08a5c

Please # to comment.