mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:29:32 +02:00
initialise the toggle button with correct info
This commit is contained in:
parent
3c3ff908b4
commit
9a22055c27
1 changed files with 9 additions and 2 deletions
|
@ -385,7 +385,13 @@
|
||||||
myVisibility = event.data.visibility;
|
myVisibility = event.data.visibility;
|
||||||
$("#dev-div").append("<p>myUsername is " + myUsername + "</p>");
|
$("#dev-div").append("<p>myUsername is " + myUsername + "</p>");
|
||||||
$("#dev-div").append("<p>myVisibility is " + myVisibility + "</p>");
|
$("#dev-div").append("<p>myVisibility is " + myVisibility + "</p>");
|
||||||
$("#visibility-toggle").html(myVisibility + "<span class='glyphicon glyphicon-menu-down'></span>")
|
var buttonText = "Online";
|
||||||
|
if (myVisibility === "none") {
|
||||||
|
buttonText = "Appear Offline";
|
||||||
|
} else if (myVisibility === "friends") {
|
||||||
|
buttonText = "Available To Friends Only";
|
||||||
|
}
|
||||||
|
$("#visibility-toggle").html(buttonText + "<span class='glyphicon glyphicon-menu-down'></span>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,12 +434,13 @@
|
||||||
|
|
||||||
// Click listener for toggling who can see me
|
// Click listener for toggling who can see me
|
||||||
$(".visibility-option").click(function() {
|
$(".visibility-option").click(function() {
|
||||||
|
myVisibility = $(this).data("visibility");
|
||||||
var newButtonText = $(this).find("h6").text();
|
var newButtonText = $(this).find("h6").text();
|
||||||
$("#visibility-toggle").html(newButtonText + "<span class='glyphicon glyphicon-menu-down'></span>");
|
$("#visibility-toggle").html(newButtonText + "<span class='glyphicon glyphicon-menu-down'></span>");
|
||||||
var visibilityObject = {
|
var visibilityObject = {
|
||||||
"type": "toggle-visibility",
|
"type": "toggle-visibility",
|
||||||
"data": {
|
"data": {
|
||||||
"visibility": $(this).data("visibility")
|
"visibility": myVisibility
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EventBridge.emitWebEvent(JSON.stringify(visibilityObject));
|
EventBridge.emitWebEvent(JSON.stringify(visibilityObject));
|
||||||
|
|
Loading…
Reference in a new issue