From cb4a4439202c4fa6ec049d7bfc4b46429dcb9587 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Thu, 11 May 2023 21:43:40 -0400 Subject: [PATCH] Places App: Enter to teleport This PR add the possibility to press "Enter" to initiate a teleportation from the value in the search/address bar of the Places App. (In addition to the current teleport button) This is a more intuitive behaviour since everyone is used to this in the web browsers. --- scripts/system/places/places.html | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/scripts/system/places/places.html b/scripts/system/places/places.html index 5ac0357c1c..69e704b9c6 100644 --- a/scripts/system/places/places.html +++ b/scripts/system/places/places.html @@ -486,7 +486,7 @@ "channel": channel, "action": "GO_HOME" }; - EventBridge.emitWebEvent(JSON.stringify(message)); + EventBridge.emitWebEvent(JSON.stringify(message)); } function goBack() { @@ -494,7 +494,7 @@ "channel": channel, "action": "GO_BACK" }; - EventBridge.emitWebEvent(JSON.stringify(message)); + EventBridge.emitWebEvent(JSON.stringify(message)); } function goForward() { @@ -502,7 +502,7 @@ "channel": channel, "action": "GO_FORWARD" }; - EventBridge.emitWebEvent(JSON.stringify(message)); + EventBridge.emitWebEvent(JSON.stringify(message)); } function pinMetaverse(metaverseIndex, pinned) { @@ -569,8 +569,8 @@ } else { externalFilter = true; document.getElementById("extPlacesFilter").className = "externalFilterOn"; - } - } + } + } loadRecordsUpTo = NUMBER_OF_RECORDS_PER_LOAD; generateContent(); @@ -627,13 +627,13 @@ document.getElementById("maturityEveryone").className = "filterOff"; } else { document.getElementById("maturityEveryone").className = "everyoneFilterOn"; - } + } if (maturityFilter.indexOf("unrated") === -1) { document.getElementById("maturityUnrated").className = "filterOff"; } else { document.getElementById("maturityUnrated").className = "unratedFilterOn"; - } + } } function displaySearchFieldsFilter() { @@ -669,6 +669,12 @@ generateContent(); } + document.addEventListener("keyup", function(event) { + if (event.keyCode === 13) { + teleportUsingAddressBarValue(document.getElementById("search").value); + } + }); + function teleportUsingAddressBarValue(url) { var finalizedUrl = url; if (url.substr(0, 7).toLocaleLowerCase() !== "http://" &&