diff --git a/scripts/system/html/users.html b/scripts/system/html/users.html index 0b55490aed..98c3db38c7 100644 --- a/scripts/system/html/users.html +++ b/scripts/system/html/users.html @@ -243,7 +243,14 @@ // Don't display yourself if (data.users[i].username !== myUsername) { console.log(data.users[i].username + " @ " + data.users[i].location.root.name); - element.append("
  • " + data.users[i].username + " @ " + data.users[i].location.root.name + "
  • "); + // Create a list item and put user info in data-* attributes, also make it trigger the jump to confirmation modal + $("
  • ", { + "data-toggle": "modal", + "data-target": "#myModal", + "data-username": data.users[i].username, + "data-placename": data.users[i].location.root.name, + text: data.users[i].username + " @ " + data.users[i].location.root.name + }).appendTo(element); } } } @@ -309,6 +316,18 @@ $(this).addClass("current"); }); + // Jump to user: Fill confirmation modal with data of the selected user + $("#myModal").on("show.bs.modal", function (event) { + // Get the element that triggered the modal + var li = $(event.relatedTarget); + // Extract info from data-* attributes + var username = li.data("username"); + var placename = li.data("placename"); + // Write info to the modal + var modal = $(this); + modal.find(".modal-title").text("Jump to " + username + " @ " + placename); + }) + // Listen for events from hifi EventBridge.scriptEventReceived.connect(onScriptEventReceived); @@ -316,7 +335,7 @@ var eventObject = {"type": "ready"}; EventBridge.emitWebEvent(JSON.stringify(eventObject)); - // Click listener mangage friends button + // Click listener for add/remove friends button $("#friends-button").click(function() { // Send a manage friends event to hifi eventObject = {"type": "manage-friends"};