Skip to content

Commit

Permalink
Version 277:
Browse files Browse the repository at this point in the history
* Ceased using `??` JavaScript syntax which was introduced in a recent UI3 release (should restore compatibility with some older web browsers).
  • Loading branch information
bp2008 committed Oct 11, 2024
1 parent 8f41cc3 commit 7c9d28a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
4 changes: 3 additions & 1 deletion ui3.htm
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
var biVersionStr = "unknown";
if (typeof bi_version != "undefined")
biVersionStr = bi_version;
if (!url)
url = "";
url = url.replace(/\/\/.*?\//, '//censored_hostname/');
var errStr = "An unexpected error has occurred in " + location.pathname + " (v " + uiVersionStr + " / " + biVersionStr + "). A full refresh may solve the problem (CTRL + F5). If you wish to report the error, please SCREENSHOT the browser now.\n\n" + msg + "\nat " + url + " [" + line + ":" + charIdx + "]\n" + navigator.userAgent;

Expand Down Expand Up @@ -88,7 +90,7 @@
};
</script>
<script type="text/javascript">
var ui_version = "276";
var ui_version = "277";
var bi_version = "%%VERSION%%";
var appPath_raw = "%%VIRTDIR%%";
var local_bi_session = "%%SESSION%%";
Expand Down
23 changes: 17 additions & 6 deletions ui3/ui3.js
Original file line number Diff line number Diff line change
Expand Up @@ -7877,15 +7877,15 @@ function GamepadPtzController()
var buttonIndex = parseInt(binding.substr("button ".length));
if (!isNaN(buttonIndex))
{
return GetAnalogButtonValue(buttonIndex) ?? 0;
return firstNonFalsy(GetAnalogButtonValue(buttonIndex), 0);
}
}
else if (binding.indexOf("axis ") === 0)
{
var axisIndex = parseInt(binding.substr("axis ".length));
if (!isNaN(axisIndex))
{
var v = GetAxisValue(axisIndex) ?? 0;
var v = firstNonFalsy(GetAxisValue(axisIndex), 0);
if (v)
{
var negative = binding.indexOf("-") > 0;
Expand Down Expand Up @@ -7985,10 +7985,10 @@ function GamepadPtzController()
}

// Read axis inputs
var a0 = GetAxisValue(0) ?? 0;
var a1 = GetAxisValue(1) ?? 0;
var a2 = GetAxisValue(2) ?? 0;
var a3 = GetAxisValue(3) ?? 0;
var a0 = firstNonFalsy(GetAxisValue(0), 0);
var a1 = firstNonFalsy(GetAxisValue(1), 0);
var a2 = firstNonFalsy(GetAxisValue(2), 0);
var a3 = firstNonFalsy(GetAxisValue(3), 0);
if (a0 || a1)
{
if (a0)
Expand Down Expand Up @@ -37818,4 +37818,15 @@ function getSvgIconToEmbed(svgId, newId, classes)
else
str = str.replace(' id="' + svgId + '"', '');
return str;
}
function firstNonFalsy()
{
if (arguments.length)
{
for (var i = 0; i < arguments.length; i++)
if (arguments[i])
return arguments[i];
return arguments[arguments.length - 1];
}
return undefined;
}

0 comments on commit 7c9d28a

Please sign in to comment.