forked from olcxjas-softworks/LarpixClient
Fix indicators again
This commit is contained in:
parent
0bade1e5c5
commit
c943dee794
4 changed files with 60 additions and 46 deletions
|
|
@ -39,6 +39,7 @@ try {
|
|||
var sidebarAdd = document.getElementById("sidebar-add");
|
||||
var sidebarAddButton = sidebarAdd.children.item(1);
|
||||
var sidebarAddIndicator = sidebarAdd.children.item(0);
|
||||
var roomsBarContainer = document.getElementById("roomsbar");
|
||||
|
||||
var roomDetailsBar = document.getElementById("roomdetailsbar");
|
||||
var roomContent = document.getElementsByTagName("roomcontent")[0];
|
||||
|
|
@ -861,14 +862,15 @@ function clickAddDm()
|
|||
}
|
||||
|
||||
|
||||
var indicatorBeforeFixedMenu;
|
||||
var currentMainIndicator = null;
|
||||
sidebarAddButton.addEventListener("click", (e) => {
|
||||
e.stopPropagation();
|
||||
history.pushState({trap: true}, "", location.href);
|
||||
|
||||
if (fixedContextMenu.classList.contains("show")) {
|
||||
fixedContextMenu.classList.remove("show");
|
||||
setActiveSidebarIndicator(indicatorBeforeFixedMenu);
|
||||
|
||||
setActiveSidebarIndicator(currentMainIndicator);
|
||||
} else {
|
||||
setActiveSidebarIndicator(sidebarAddIndicator, true);
|
||||
const rect = sidebarAddButton.getBoundingClientRect();
|
||||
|
|
@ -883,7 +885,7 @@ document.addEventListener("click", (e) => {
|
|||
if (!fixedContextMenu.contains(e.target)) {
|
||||
fixedContextMenu.classList.remove("show");
|
||||
if (!e.target.closest('sidebarelement')) {
|
||||
setActiveSidebarIndicator(indicatorBeforeFixedMenu);
|
||||
setActiveSidebarIndicator(currentMainIndicator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -924,52 +926,57 @@ function gotoSideProfilePopup() {
|
|||
|
||||
}
|
||||
function gotoInbox() {
|
||||
if (roomsBarContainer) roomsBarContainer.style.display = ""; //show roombar
|
||||
setActiveSidebarIndicator(sidebarInboxIndicator);
|
||||
switchRoomsBar("title.inbox", inboxRoomBar);
|
||||
gotoInvites();
|
||||
}
|
||||
|
||||
function gotoCreateSpace() {
|
||||
fixedContextMenu.classList.remove("show");
|
||||
if (roomsBarContainer) roomsBarContainer.style.display = "none"; //hide roombar
|
||||
switchRoomContent("title.create.space", createSpaceScreen, false);
|
||||
}
|
||||
|
||||
function gotoJoinSpace() {
|
||||
fixedContextMenu.classList.remove("show");
|
||||
if (roomsBarContainer) roomsBarContainer.style.display = "none"; //hide roombar
|
||||
switchRoomContent("title.join.space", joinSpaceScreen, false);
|
||||
}
|
||||
|
||||
function gotoHome() {
|
||||
if (roomsBarContainer) roomsBarContainer.style.display = ""; //show roombar
|
||||
setActiveSidebarIndicator(sidebarHomeIndicator);
|
||||
switchRoomContent("title.splash", splashScreen, false);
|
||||
switchRoomsBar("title.home", homeRoomBar);
|
||||
}
|
||||
|
||||
function setActiveSidebarIndicator(element, skipDisabling = false)
|
||||
{
|
||||
function setActiveSidebarIndicator(element, isTemporary = false) {
|
||||
let indicators = document.getElementsByTagName("indicator");
|
||||
for (let i = 0; i < indicators.length; i++) {
|
||||
if (indicators[i].classList.contains("active"))
|
||||
{
|
||||
|
||||
if (!skipDisabling) //DOKONCZ JEBANY INDICATOR UZYJE DO TEGO indicatorBeforeFixedMenu ZE ON MA BYC AKTYWNY PO MOBILE COFCE
|
||||
{
|
||||
indicatorBeforeFixedMenu = indicators[i];
|
||||
indicators[i].classList.remove("active");
|
||||
}
|
||||
}
|
||||
indicators[i].classList.remove("active");
|
||||
}
|
||||
|
||||
element.classList.add("active");
|
||||
}
|
||||
if (element) {
|
||||
element.classList.add("active");
|
||||
}
|
||||
|
||||
if (!isTemporary && element) {
|
||||
currentMainIndicator = element;
|
||||
}
|
||||
}
|
||||
function mobileNavBack() {
|
||||
if(mainScreen.classList.contains('mobile-details')) {
|
||||
mainScreen.classList.remove('mobile-details');
|
||||
mainScreen.classList.add('mobile-content');
|
||||
|
||||
setActiveSidebarIndicator(indicatorBeforeFixedMenu);
|
||||
setActiveSidebarIndicator(currentMainIndicator);
|
||||
} else {
|
||||
mainScreen.classList.remove('mobile-content');
|
||||
|
||||
setActiveSidebarIndicator(sidebarHomeIndicator);
|
||||
setActiveSidebarIndicator(currentMainIndicator);
|
||||
|
||||
if (roomsBarContainer) roomsBarContainer.style.display = ""; //restore roombar on mobile
|
||||
}
|
||||
}
|
||||
function mobileNavDetails() {
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ roomcontent {
|
|||
flex-direction: column;
|
||||
|
||||
height: 100%;
|
||||
width: calc(100vw - (var(--icon-button-height) + (var(--button-margin) * 2) + var(--border-width)) - 17rem);
|
||||
flex-grow: 1;
|
||||
border-right: var(--border-width) solid var(--light-border-color);
|
||||
}
|
||||
roomcontent2 {
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ try {
|
|||
var sidebarAdd = document.getElementById("sidebar-add");
|
||||
var sidebarAddButton = sidebarAdd.children.item(1);
|
||||
var sidebarAddIndicator = sidebarAdd.children.item(0);
|
||||
var roomsBarContainer = document.getElementById("roomsbar");
|
||||
|
||||
var roomDetailsBar = document.getElementById("roomdetailsbar");
|
||||
var roomContent = document.getElementsByTagName("roomcontent")[0];
|
||||
|
|
@ -861,14 +862,15 @@ function clickAddDm()
|
|||
}
|
||||
|
||||
|
||||
var indicatorBeforeFixedMenu;
|
||||
var currentMainIndicator = null;
|
||||
sidebarAddButton.addEventListener("click", (e) => {
|
||||
e.stopPropagation();
|
||||
history.pushState({trap: true}, "", location.href);
|
||||
|
||||
if (fixedContextMenu.classList.contains("show")) {
|
||||
fixedContextMenu.classList.remove("show");
|
||||
setActiveSidebarIndicator(indicatorBeforeFixedMenu);
|
||||
|
||||
setActiveSidebarIndicator(currentMainIndicator);
|
||||
} else {
|
||||
setActiveSidebarIndicator(sidebarAddIndicator, true);
|
||||
const rect = sidebarAddButton.getBoundingClientRect();
|
||||
|
|
@ -883,7 +885,7 @@ document.addEventListener("click", (e) => {
|
|||
if (!fixedContextMenu.contains(e.target)) {
|
||||
fixedContextMenu.classList.remove("show");
|
||||
if (!e.target.closest('sidebarelement')) {
|
||||
setActiveSidebarIndicator(indicatorBeforeFixedMenu);
|
||||
setActiveSidebarIndicator(currentMainIndicator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -924,52 +926,57 @@ function gotoSideProfilePopup() {
|
|||
|
||||
}
|
||||
function gotoInbox() {
|
||||
if (roomsBarContainer) roomsBarContainer.style.display = ""; //show roombar
|
||||
setActiveSidebarIndicator(sidebarInboxIndicator);
|
||||
switchRoomsBar("title.inbox", inboxRoomBar);
|
||||
gotoInvites();
|
||||
}
|
||||
|
||||
function gotoCreateSpace() {
|
||||
fixedContextMenu.classList.remove("show");
|
||||
if (roomsBarContainer) roomsBarContainer.style.display = "none"; //hide roombar
|
||||
switchRoomContent("title.create.space", createSpaceScreen, false);
|
||||
}
|
||||
|
||||
function gotoJoinSpace() {
|
||||
fixedContextMenu.classList.remove("show");
|
||||
if (roomsBarContainer) roomsBarContainer.style.display = "none"; //hide roombar
|
||||
switchRoomContent("title.join.space", joinSpaceScreen, false);
|
||||
}
|
||||
|
||||
function gotoHome() {
|
||||
if (roomsBarContainer) roomsBarContainer.style.display = ""; //show roombar
|
||||
setActiveSidebarIndicator(sidebarHomeIndicator);
|
||||
switchRoomContent("title.splash", splashScreen, false);
|
||||
switchRoomsBar("title.home", homeRoomBar);
|
||||
}
|
||||
|
||||
function setActiveSidebarIndicator(element, skipDisabling = false)
|
||||
{
|
||||
function setActiveSidebarIndicator(element, isTemporary = false) {
|
||||
let indicators = document.getElementsByTagName("indicator");
|
||||
for (let i = 0; i < indicators.length; i++) {
|
||||
if (indicators[i].classList.contains("active"))
|
||||
{
|
||||
|
||||
if (!skipDisabling) //DOKONCZ JEBANY INDICATOR UZYJE DO TEGO indicatorBeforeFixedMenu ZE ON MA BYC AKTYWNY PO MOBILE COFCE
|
||||
{
|
||||
indicatorBeforeFixedMenu = indicators[i];
|
||||
indicators[i].classList.remove("active");
|
||||
}
|
||||
}
|
||||
indicators[i].classList.remove("active");
|
||||
}
|
||||
|
||||
element.classList.add("active");
|
||||
}
|
||||
if (element) {
|
||||
element.classList.add("active");
|
||||
}
|
||||
|
||||
if (!isTemporary && element) {
|
||||
currentMainIndicator = element;
|
||||
}
|
||||
}
|
||||
function mobileNavBack() {
|
||||
if(mainScreen.classList.contains('mobile-details')) {
|
||||
mainScreen.classList.remove('mobile-details');
|
||||
mainScreen.classList.add('mobile-content');
|
||||
|
||||
setActiveSidebarIndicator(indicatorBeforeFixedMenu);
|
||||
setActiveSidebarIndicator(currentMainIndicator);
|
||||
} else {
|
||||
mainScreen.classList.remove('mobile-content');
|
||||
|
||||
setActiveSidebarIndicator(sidebarHomeIndicator);
|
||||
setActiveSidebarIndicator(currentMainIndicator);
|
||||
|
||||
if (roomsBarContainer) roomsBarContainer.style.display = ""; //restore roombar on mobile
|
||||
}
|
||||
}
|
||||
function mobileNavDetails() {
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ roomcontent {
|
|||
flex-direction: column;
|
||||
|
||||
height: 100%;
|
||||
width: calc(100vw - (var(--icon-button-height) + (var(--button-margin) * 2) + var(--border-width)) - 17rem);
|
||||
flex-grow: 1;
|
||||
border-right: var(--border-width) solid var(--light-border-color);
|
||||
}
|
||||
roomcontent2 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue