button brings up add/remove friends page

This commit is contained in:
Faye Li 2017-01-27 11:34:38 -08:00
parent bfbee20f43
commit bf51ba7195
2 changed files with 25 additions and 2 deletions

View file

@ -100,6 +100,7 @@
</div>
<div id="tab-2" class="tab-content">
<ul></ul>
<button id="friends-button">Add/Remove Friends</button>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
@ -190,6 +191,13 @@
// Send a ready event to hifi
var eventObject = {"type": "ready"};
EventBridge.emitWebEvent(JSON.stringify(eventObject));
// Click listener mangage friends button
$("#friends-button").click(function() {
// Send a manage friends event to hifi
eventObject = {"type": "manage-friends"};
EventBridge.emitWebEvent(JSON.stringify(eventObject));
});
});
</script>
</body>

View file

@ -12,9 +12,12 @@
(function() { // BEGIN LOCAL_SCOPE
var USERS_URL = "https://hifi-content.s3.amazonaws.com/faye/tablet-dev/users.html";
var FRIENDS_WINDOW_URL = "https://metaverse.highfidelity.com/user/friends";
var FRIENDS_WINDOW_WIDTH = 290;
var FRIENDS_WINDOW_HEIGHT = 500;
var FRIENDS_WINDOW_TITLE = "Add/Remove Friends";
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
// TODO: work with Alan to make new icon art
icon: "icons/tablet-icons/people-i.svg",
text: "Users"
});
@ -37,7 +40,19 @@
};
print("sending username: " + myUsername);
tablet.emitScriptEvent(JSON.stringify(object));
}
}
if (event.type === "manage-friends") {
// open a web overlay to metaverse friends page
var friendsWindow = new OverlayWebWindow({
title: FRIENDS_WINDOW_TITLE,
width: FRIENDS_WINDOW_WIDTH,
height: FRIENDS_WINDOW_HEIGHT,
visible: false
});
friendsWindow.setURL(FRIENDS_WINDOW_URL);
friendsWindow.setVisible(true);
friendsWindow.raise();
}
}
button.clicked.connect(onClicked);