mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 00:13:53 +02:00
fill confirmation modal with data of the selected user
This commit is contained in:
parent
fda20694b3
commit
59aea60be0
1 changed files with 21 additions and 2 deletions
|
@ -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("<li data-toggle='modal' data-target='#myModal'>" + data.users[i].username + " @ " + data.users[i].location.root.name + "</li>");
|
||||
// Create a list item and put user info in data-* attributes, also make it trigger the jump to confirmation modal
|
||||
$("<li></li>", {
|
||||
"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"};
|
||||
|
|
Loading…
Reference in a new issue