TopBar transitions
All checks were successful
Android Build / publish (push) Successful in 41s
Linux Build / publish (push) Successful in 50s

This commit is contained in:
olcxja 2026-05-15 10:04:29 +02:00
commit bb736b26bd
24 changed files with 397 additions and 142 deletions

View file

@ -55,51 +55,21 @@
</sidebar> </sidebar>
<sidebar class="second" id="roomsbar"> <sidebar class="second" id="roomsbar">
<roomtopbar> <roomtopbar>
<blah>title.home</blah> <inherit></inherit>
</roomtopbar> </roomtopbar>
<div class="sidebar-section-header"> <roomcontent2>
<button class="collapse-text-button" id="collapse-dms"> </roomcontent2>
<span><blah>title.dms</blah></span>
<svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="var(--text-color)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
<button class="add-action-button" id="add-dm-btn">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="var(--text-color)"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
</button>
</div>
<div class="sidebar-section-header">
<button class="collapse-text-button" id="collapse-groups">
<span><blah>title.groups</blah></span>
<svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="var(--text-color)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
<button class="add-action-button" id="add-group-btn">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="var(--text-color)"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
</button>
</div>
</sidebar> </sidebar>
<roomcontent> <roomcontent>
<roomtopbar> <roomtopbar>
<inherit></inherit>
</roomtopbar> </roomtopbar>
<roomcontent2> <roomcontent2>
</roomcontent2> </roomcontent2>
</roomcontent> </roomcontent>
<sidebar class="second" id="roomdetailsbar" style="display: none;"> <sidebar class="second" id="roomdetailsbar" style="display: none;">
<roomtopbar> <roomtopbar>
<inherit></inherit>
</roomtopbar> </roomtopbar>
<roomcontent2> <roomcontent2>
</roomcontent2> </roomcontent2>
@ -115,7 +85,7 @@
async function start() { async function start() {
updateLoadingStatus("loading.loading"); updateLoadingStatus("loading.loading");
try { try {
switchRoomContent("title.splash", splashScreen, false, "", true); gotoHome();
if (host != null) if (host != null)
{ {
await updateProtocolAndUrl(host); await updateProtocolAndUrl(host);

View file

@ -29,9 +29,6 @@ try {
var loadingStatus = document.getElementById("loadingstatus"); var loadingStatus = document.getElementById("loadingstatus");
var collapseDmsBtn = document.getElementById("collapse-dms");
var collapseGroupsBtn = document.getElementById("collapse-groups");
var addDmBtn = document.getElementById("add-dm-btn"); var addDmBtn = document.getElementById("add-dm-btn");
var addGroupBtn = document.getElementById("add-group-btn"); var addGroupBtn = document.getElementById("add-group-btn");
@ -45,13 +42,14 @@ try {
var roomDetailsBar = document.getElementById("roomdetailsbar"); var roomDetailsBar = document.getElementById("roomdetailsbar");
var roomContent = document.getElementsByTagName("roomcontent")[0]; var roomContent = document.getElementsByTagName("roomcontent")[0];
var roomsBar = document.getElementById("roomsbar"); var roomsBar = document.getElementsByTagName("roomcontent2")[0];
var sideBar = document.getElementsByTagName("sidebar")[0]; var sideBar = document.getElementsByTagName("sidebar")[0];
var roomContentMain = document.getElementsByTagName("roomcontent2")[0]; var roomContentMain = document.getElementsByTagName("roomcontent2")[1];
var roomContentBar = roomContent.children[0]; var roomContentBar = roomContent.children[0];
var roomsTopBar = document.getElementsByTagName("roomtopbar")[0];
var roomTopBar = document.getElementsByTagName("roomtopbar")[1]; var roomTopBar = document.getElementsByTagName("roomtopbar")[1];
var sidebarProfile = document.getElementById("sidebar-profile"); var sidebarProfile = document.getElementById("sidebar-profile");
@ -685,11 +683,60 @@ function showFixedContextMenu(rect, html) {
fixedContextMenu.classList.add("show"); fixedContextMenu.classList.add("show");
} }
async function switchRoomsBar(title, content) {
let roomsTopBarTransition = roomsTopBar.children.item(0);
roomsBar.style.transform = "scale(0.85)";
roomsBar.style.opacity = "0";
roomsTopBarTransition.style.transform = "scale(0.85)";
roomsTopBarTransition.style.opacity = "0";
await delay(200);
roomsTopBarTransition.innerHTML = processBlah(title);
let parser = new DOMParser();
let doc = parser.parseFromString(content, "text/html");
let blahTags = doc.getElementsByTagName("blah");
for (let i = 0; i < blahTags.length; i++) {
blahTags[i].innerHTML = processBlah(blahTags[i].innerHTML);
}
blahTags = doc.getElementsByClassName("blah");
for (let i = 0; i < blahTags.length; i++) {
blahTags[i].innerHTML = processBlah(blahTags[i].innerHTML);
}
let placeholders = doc.querySelectorAll("[placeholder]");
for (let i = 0; i < placeholders.length; i++) {
if (placeholders[i].placeholder.startsWith("{blah("))
{
let value = placeholders[i].placeholder.split("{blah(")[1].split(")}")[0];
placeholders[i].placeholder = processBlah(value);
}
}
roomsBar.innerHTML = doc.body.innerHTML;
roomsBar.style.transform = "";
roomsBar.style.opacity = "";
roomsTopBarTransition.style.transform = "";
roomsTopBarTransition.style.opacity = "";
}
async function switchRoomContent(title, content, showRoomBar, icon = "", skipMobileSlide = false) async function switchRoomContent(title, content, showRoomBar, icon = "", skipMobileSlide = false)
{ {
let roomsTopBarTransition = roomTopBar.children.item(0);
roomContentMain.style.transform = "scale(0.85)"; roomContentMain.style.transform = "scale(0.85)";
roomContentMain.style.opacity = "0"; roomContentMain.style.opacity = "0";
roomsTopBarTransition.style.transform = "scale(0.85)";
roomsTopBarTransition.style.opacity = "0";
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize); const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
if (window.innerWidth <= 52 * rem && !skipMobileSlide) { if (window.innerWidth <= 52 * rem && !skipMobileSlide) {
if (title != "title.splash") //do not show splash on mobile if (title != "title.splash") //do not show splash on mobile
@ -706,7 +753,7 @@ async function switchRoomContent(title, content, showRoomBar, icon = "", skipMob
let detailsBtnHtml = showRoomBar ? detailsBtn : ''; let detailsBtnHtml = showRoomBar ? detailsBtn : '';
roomTopBar.innerHTML = `${backBtnHtml}${icon}<space></space><inherit>${processBlah(title)}</inherit><div class="flex-spacer"></div>${detailsBtnHtml}`; roomsTopBarTransition.innerHTML = `${backBtnHtml}${icon}<space></space><inherit>${processBlah(title)}</inherit><div class="flex-spacer"></div>${detailsBtnHtml}`;
roomDetailsBar.style.display = showRoomBar ? "flex" : "none"; roomDetailsBar.style.display = showRoomBar ? "flex" : "none";
let parser = new DOMParser(); let parser = new DOMParser();
@ -735,25 +782,37 @@ async function switchRoomContent(title, content, showRoomBar, icon = "", skipMob
roomContentMain.style.transform = ""; roomContentMain.style.transform = "";
roomContentMain.style.opacity = ""; roomContentMain.style.opacity = "";
roomsTopBarTransition.style.transform = "";
roomsTopBarTransition.style.opacity = "";
} }
collapseDmsBtn.addEventListener("click", () => { function clickCollapseDms()
{
var collapseDmsBtn = document.getElementById("collapse-dms");
collapseDmsBtn.classList.toggle("collapsed"); collapseDmsBtn.classList.toggle("collapsed");
}); }
collapseGroupsBtn.addEventListener("click", () => { function clickCollapseGroups()
{
var collapseGroupsBtn = document.getElementById("collapse-groups");
collapseGroupsBtn.classList.toggle("collapsed"); collapseGroupsBtn.classList.toggle("collapsed");
}); }
addDmBtn.addEventListener("click", async () => { function clickAddGroup()
switchRoomContent("title.create.dm", addDmScreen, false); {
});
addGroupBtn.addEventListener("click", async () => {
switchRoomContent("title.create.group", createGroupScreen, false); switchRoomContent("title.create.group", createGroupScreen, false);
}); }
function clickAddDm()
{
switchRoomContent("title.create.dm", addDmScreen, false);
}
var indicatorBeforeFixedMenu; var indicatorBeforeFixedMenu;
sidebarAddButton.addEventListener("click", (e) => { sidebarAddButton.addEventListener("click", (e) => {
e.stopPropagation(); e.stopPropagation();
console.log("hi")
if (fixedContextMenu.classList.contains("show")) { if (fixedContextMenu.classList.contains("show")) {
fixedContextMenu.classList.remove("show"); fixedContextMenu.classList.remove("show");
setActiveSidebarIndicator(indicatorBeforeFixedMenu); setActiveSidebarIndicator(indicatorBeforeFixedMenu);
@ -768,9 +827,11 @@ document.addEventListener("click", (e) => {
if (fixedContextMenu.classList.contains("show")) { if (fixedContextMenu.classList.contains("show")) {
if (!fixedContextMenu.contains(e.target)) { if (!fixedContextMenu.contains(e.target)) {
fixedContextMenu.classList.remove("show"); fixedContextMenu.classList.remove("show");
if (!e.target.closest('sidebarelement')) {
setActiveSidebarIndicator(indicatorBeforeFixedMenu); setActiveSidebarIndicator(indicatorBeforeFixedMenu);
} }
} }
}
if (mainScreen && mainScreen.classList.contains('mobile-details')) { if (mainScreen && mainScreen.classList.contains('mobile-details')) {
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize); const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
@ -803,6 +864,7 @@ function gotoJoinSpace() {
function gotoHome() { function gotoHome() {
setActiveSidebarIndicator(sidebarHomeIndicator); setActiveSidebarIndicator(sidebarHomeIndicator);
switchRoomContent("title.splash", splashScreen, false); switchRoomContent("title.splash", splashScreen, false);
switchRoomsBar("title.home", homeRoomBar);
} }
function setActiveSidebarIndicator(element, skipDisabling = false) function setActiveSidebarIndicator(element, skipDisabling = false)
@ -833,18 +895,70 @@ function mobileNavBack() {
function mobileNavDetails() { function mobileNavDetails() {
mainScreen.classList.add('mobile-details'); mainScreen.classList.add('mobile-details');
} }
let touchStartX = 0; let touchStartX = 0;
let touchEndX = 0; let touchEndX = 0;
let touchStartY = 0; let touchStartY = 0;
let touchEndY = 0; let touchEndY = 0;
let touchMoved = false;
document.addEventListener('touchstart', e => { document.addEventListener('touchstart', e => {
touchStartX = e.changedTouches[0].screenX; touchStartX = e.changedTouches[0].screenX;
touchStartY = e.changedTouches[0].screenY; touchStartY = e.changedTouches[0].screenY;
}); touchMoved = false;
activeTouchButton = e.target.closest('button, input');
if (activeTouchButton) {
activeTouchButton.classList.add('is-pressed');
}
}, { passive: true });
document.addEventListener('touchmove', e => {
if (!touchMoved) {
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
let diffX = Math.abs(e.changedTouches[0].screenX - touchStartX);
let diffY = Math.abs(e.changedTouches[0].screenY - touchStartY);
if (diffX > rem || diffY > rem) {
touchMoved = true;
if (activeTouchButton) {
activeTouchButton.classList.remove('is-pressed');
activeTouchButton = null;
}
}
}
}, { passive: true });
document.addEventListener('touchend', e => { document.addEventListener('touchend', e => {
touchEndX = e.changedTouches[0].screenX; touchEndX = e.changedTouches[0].screenX;
touchEndY = e.changedTouches[0].screenY; touchEndY = e.changedTouches[0].screenY;
handleMobileSwipe(); handleMobileSwipe();
if (activeTouchButton) {
activeTouchButton.classList.remove('is-pressed');
if (!touchMoved) {
if (e.cancelable) {
e.preventDefault();
}
activeTouchButton.click();
}
activeTouchButton = null;
}
});
document.addEventListener('touchcancel', () => {
if (activeTouchButton) {
activeTouchButton.classList.remove('is-pressed');
activeTouchButton = null;
}
});
document.addEventListener('contextmenu', e => {
if (e.target.closest('button')) {
e.preventDefault();
}
}); });
function handleMobileSwipe() { function handleMobileSwipe() {
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize); const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
@ -853,7 +967,7 @@ function handleMobileSwipe() {
let diffX = touchEndX - touchStartX; let diffX = touchEndX - touchStartX;
let diffY = touchEndY - touchStartY; let diffY = touchEndY - touchStartY;
if (Math.abs(diffX) > Math.abs(diffY) && Math.abs(diffX) > 60) { if (Math.abs(diffX) > Math.abs(diffY) && Math.abs(diffX) > 4 * rem) {
if (diffX > 0) { if (diffX > 0) {
mobileNavBack(); mobileNavBack();
} else { } else {

View file

@ -73,6 +73,45 @@ var joinSpaceScreen = `
</div> </div>
`; `;
//roombars
var homeRoomBar = `
<div class="sidebar-section-header">
<button class="collapse-text-button" id="collapse-dms" onclick="clickCollapseDms()">
<span><blah>title.dms</blah></span>
<svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="var(--text-color)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
<button class="add-action-button" id="add-dm-btn" onclick="clickAddDm()">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="var(--text-color)"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
</button>
</div>
<div class="sidebar-section-header">
<button class="collapse-text-button" id="collapse-groups" onclick="clickCollapseGroups()">
<span><blah>title.groups</blah></span>
<svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="var(--text-color)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
<button class="add-action-button" id="add-group-btn" onclick="clickAddGroup()">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="var(--text-color)"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
</button>
</div>
`;
//context menus //context menus
var addSpaceMenu = ` var addSpaceMenu = `

View file

@ -87,9 +87,13 @@ button, input {
transform: translateZ(0); transform: translateZ(0);
will-change: transform; will-change: transform;
transform-origin: center center; transform-origin: center center;
touch-action: manipulation;
-webkit-touch-callout: none;
} }
input { input {
padding-left: calc(var(--button-margin) * 2); padding-left: calc(var(--button-margin) * 2);
-webkit-touch-callout: default;
} }
@ -143,9 +147,6 @@ indicator.active {
pointer-events: none !important; pointer-events: none !important;
} }
button:active, input:active {
transform: var(--press-scale);
}
roomcontent { roomcontent {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -348,13 +349,14 @@ herotitle {
color: var(--text-color); color: var(--text-color);
} }
} }
button:active, input:active { button:active, button.is-pressed, input:active, input.is-pressed {
background-color: rgba(255, 255, 255, 0.1); background-color: rgba(255, 255, 255, 0.1);
transform: var(--press-scale);
} }
.submit-button:active { .submit-button:active, .submit-button.is-pressed {
background-color: rgba(255, 255, 255, 0.5); background-color: rgba(255, 255, 255, 0.5);
} }
.add-action-button:active { .add-action-button:active, .add-action-button.is-pressed {
background-color: rgba(255, 255, 255, 0.1); background-color: rgba(255, 255, 255, 0.1);
color: var(--text-color); color: var(--text-color);
} }
@ -372,8 +374,9 @@ blah, inherit, .inherit {
all: inherit; all: inherit;
padding: 0; padding: 0;
margin: 0; margin: 0;
display: inline; display: flex;
opacity: 1; opacity: 1;
border: none;
} }
space{ space{
margin-left: 0.4rem; margin-left: 0.4rem;
@ -428,9 +431,9 @@ space{
color: var(--text-color); color: var(--text-color);
cursor: pointer; cursor: pointer;
} }
.mobile-nav-btn:active { .mobile-nav-btn:active, .mobile-nav-btn.is-pressed {
background-color: rgba(255, 255, 255, 0.1); background-color: rgba(255, 255, 255, 0.1);
border-radius: 0.8rem; transform: var(--press-scale);
} }
.mobile-nav-btn.right { .mobile-nav-btn.right {
margin-right: 0; margin-right: 0;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Before After
Before After

View file

@ -1,4 +1,4 @@
<svg width="1024" height="1024" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"> <svg width="1497" height="2656" viewBox="0 0 1497 2656" xmlns="http://www.w3.org/2000/svg">
<defs> <defs>
<linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%"> <linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#b870ff;stop-opacity:1" /> <stop offset="0%" style="stop-color:#b870ff;stop-opacity:1" />
@ -9,6 +9,8 @@
<stop offset="100%" stop-color="#a64aff" /> <stop offset="100%" stop-color="#a64aff" />
</linearGradient> </linearGradient>
</defs> </defs>
<g transform="translate(748.5 1328) scale(0.4) translate(-512 -512)">
<rect width="1024" height="1024" fill="url(#bg_grad)" rx="190" /> <rect width="1024" height="1024" fill="url(#bg_grad)" rx="190" />
<g transform="translate(112, 112) scale(1.55)"> <g transform="translate(112, 112) scale(1.55)">
@ -26,4 +28,5 @@
<circle cx="322" cy="405" r="15" fill="#F0F0F5" /> <circle cx="322" cy="405" r="15" fill="#F0F0F5" />
</g> </g>
</g> </g>
</g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before After
Before After

View file

@ -55,51 +55,21 @@
</sidebar> </sidebar>
<sidebar class="second" id="roomsbar"> <sidebar class="second" id="roomsbar">
<roomtopbar> <roomtopbar>
<blah>title.home</blah> <inherit></inherit>
</roomtopbar> </roomtopbar>
<div class="sidebar-section-header"> <roomcontent2>
<button class="collapse-text-button" id="collapse-dms"> </roomcontent2>
<span><blah>title.dms</blah></span>
<svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="var(--text-color)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
<button class="add-action-button" id="add-dm-btn">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="var(--text-color)"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
</button>
</div>
<div class="sidebar-section-header">
<button class="collapse-text-button" id="collapse-groups">
<span><blah>title.groups</blah></span>
<svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="var(--text-color)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
<button class="add-action-button" id="add-group-btn">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="var(--text-color)"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
</button>
</div>
</sidebar> </sidebar>
<roomcontent> <roomcontent>
<roomtopbar> <roomtopbar>
<inherit></inherit>
</roomtopbar> </roomtopbar>
<roomcontent2> <roomcontent2>
</roomcontent2> </roomcontent2>
</roomcontent> </roomcontent>
<sidebar class="second" id="roomdetailsbar" style="display: none;"> <sidebar class="second" id="roomdetailsbar" style="display: none;">
<roomtopbar> <roomtopbar>
<inherit></inherit>
</roomtopbar> </roomtopbar>
<roomcontent2> <roomcontent2>
</roomcontent2> </roomcontent2>
@ -115,7 +85,7 @@
async function start() { async function start() {
updateLoadingStatus("loading.loading"); updateLoadingStatus("loading.loading");
try { try {
switchRoomContent("title.splash", splashScreen, false, "", true); gotoHome();
if (host != null) if (host != null)
{ {
await updateProtocolAndUrl(host); await updateProtocolAndUrl(host);

View file

@ -29,9 +29,6 @@ try {
var loadingStatus = document.getElementById("loadingstatus"); var loadingStatus = document.getElementById("loadingstatus");
var collapseDmsBtn = document.getElementById("collapse-dms");
var collapseGroupsBtn = document.getElementById("collapse-groups");
var addDmBtn = document.getElementById("add-dm-btn"); var addDmBtn = document.getElementById("add-dm-btn");
var addGroupBtn = document.getElementById("add-group-btn"); var addGroupBtn = document.getElementById("add-group-btn");
@ -45,13 +42,14 @@ try {
var roomDetailsBar = document.getElementById("roomdetailsbar"); var roomDetailsBar = document.getElementById("roomdetailsbar");
var roomContent = document.getElementsByTagName("roomcontent")[0]; var roomContent = document.getElementsByTagName("roomcontent")[0];
var roomsBar = document.getElementById("roomsbar"); var roomsBar = document.getElementsByTagName("roomcontent2")[0];
var sideBar = document.getElementsByTagName("sidebar")[0]; var sideBar = document.getElementsByTagName("sidebar")[0];
var roomContentMain = document.getElementsByTagName("roomcontent2")[0]; var roomContentMain = document.getElementsByTagName("roomcontent2")[1];
var roomContentBar = roomContent.children[0]; var roomContentBar = roomContent.children[0];
var roomsTopBar = document.getElementsByTagName("roomtopbar")[0];
var roomTopBar = document.getElementsByTagName("roomtopbar")[1]; var roomTopBar = document.getElementsByTagName("roomtopbar")[1];
var sidebarProfile = document.getElementById("sidebar-profile"); var sidebarProfile = document.getElementById("sidebar-profile");
@ -685,11 +683,60 @@ function showFixedContextMenu(rect, html) {
fixedContextMenu.classList.add("show"); fixedContextMenu.classList.add("show");
} }
async function switchRoomsBar(title, content) {
let roomsTopBarTransition = roomsTopBar.children.item(0);
roomsBar.style.transform = "scale(0.85)";
roomsBar.style.opacity = "0";
roomsTopBarTransition.style.transform = "scale(0.85)";
roomsTopBarTransition.style.opacity = "0";
await delay(200);
roomsTopBarTransition.innerHTML = processBlah(title);
let parser = new DOMParser();
let doc = parser.parseFromString(content, "text/html");
let blahTags = doc.getElementsByTagName("blah");
for (let i = 0; i < blahTags.length; i++) {
blahTags[i].innerHTML = processBlah(blahTags[i].innerHTML);
}
blahTags = doc.getElementsByClassName("blah");
for (let i = 0; i < blahTags.length; i++) {
blahTags[i].innerHTML = processBlah(blahTags[i].innerHTML);
}
let placeholders = doc.querySelectorAll("[placeholder]");
for (let i = 0; i < placeholders.length; i++) {
if (placeholders[i].placeholder.startsWith("{blah("))
{
let value = placeholders[i].placeholder.split("{blah(")[1].split(")}")[0];
placeholders[i].placeholder = processBlah(value);
}
}
roomsBar.innerHTML = doc.body.innerHTML;
roomsBar.style.transform = "";
roomsBar.style.opacity = "";
roomsTopBarTransition.style.transform = "";
roomsTopBarTransition.style.opacity = "";
}
async function switchRoomContent(title, content, showRoomBar, icon = "", skipMobileSlide = false) async function switchRoomContent(title, content, showRoomBar, icon = "", skipMobileSlide = false)
{ {
let roomsTopBarTransition = roomTopBar.children.item(0);
roomContentMain.style.transform = "scale(0.85)"; roomContentMain.style.transform = "scale(0.85)";
roomContentMain.style.opacity = "0"; roomContentMain.style.opacity = "0";
roomsTopBarTransition.style.transform = "scale(0.85)";
roomsTopBarTransition.style.opacity = "0";
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize); const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
if (window.innerWidth <= 52 * rem && !skipMobileSlide) { if (window.innerWidth <= 52 * rem && !skipMobileSlide) {
if (title != "title.splash") //do not show splash on mobile if (title != "title.splash") //do not show splash on mobile
@ -706,7 +753,7 @@ async function switchRoomContent(title, content, showRoomBar, icon = "", skipMob
let detailsBtnHtml = showRoomBar ? detailsBtn : ''; let detailsBtnHtml = showRoomBar ? detailsBtn : '';
roomTopBar.innerHTML = `${backBtnHtml}${icon}<space></space><inherit>${processBlah(title)}</inherit><div class="flex-spacer"></div>${detailsBtnHtml}`; roomsTopBarTransition.innerHTML = `${backBtnHtml}${icon}<space></space><inherit>${processBlah(title)}</inherit><div class="flex-spacer"></div>${detailsBtnHtml}`;
roomDetailsBar.style.display = showRoomBar ? "flex" : "none"; roomDetailsBar.style.display = showRoomBar ? "flex" : "none";
let parser = new DOMParser(); let parser = new DOMParser();
@ -735,25 +782,37 @@ async function switchRoomContent(title, content, showRoomBar, icon = "", skipMob
roomContentMain.style.transform = ""; roomContentMain.style.transform = "";
roomContentMain.style.opacity = ""; roomContentMain.style.opacity = "";
roomsTopBarTransition.style.transform = "";
roomsTopBarTransition.style.opacity = "";
} }
collapseDmsBtn.addEventListener("click", () => { function clickCollapseDms()
{
var collapseDmsBtn = document.getElementById("collapse-dms");
collapseDmsBtn.classList.toggle("collapsed"); collapseDmsBtn.classList.toggle("collapsed");
}); }
collapseGroupsBtn.addEventListener("click", () => { function clickCollapseGroups()
{
var collapseGroupsBtn = document.getElementById("collapse-groups");
collapseGroupsBtn.classList.toggle("collapsed"); collapseGroupsBtn.classList.toggle("collapsed");
}); }
addDmBtn.addEventListener("click", async () => { function clickAddGroup()
switchRoomContent("title.create.dm", addDmScreen, false); {
});
addGroupBtn.addEventListener("click", async () => {
switchRoomContent("title.create.group", createGroupScreen, false); switchRoomContent("title.create.group", createGroupScreen, false);
}); }
function clickAddDm()
{
switchRoomContent("title.create.dm", addDmScreen, false);
}
var indicatorBeforeFixedMenu; var indicatorBeforeFixedMenu;
sidebarAddButton.addEventListener("click", (e) => { sidebarAddButton.addEventListener("click", (e) => {
e.stopPropagation(); e.stopPropagation();
console.log("hi")
if (fixedContextMenu.classList.contains("show")) { if (fixedContextMenu.classList.contains("show")) {
fixedContextMenu.classList.remove("show"); fixedContextMenu.classList.remove("show");
setActiveSidebarIndicator(indicatorBeforeFixedMenu); setActiveSidebarIndicator(indicatorBeforeFixedMenu);
@ -768,9 +827,11 @@ document.addEventListener("click", (e) => {
if (fixedContextMenu.classList.contains("show")) { if (fixedContextMenu.classList.contains("show")) {
if (!fixedContextMenu.contains(e.target)) { if (!fixedContextMenu.contains(e.target)) {
fixedContextMenu.classList.remove("show"); fixedContextMenu.classList.remove("show");
if (!e.target.closest('sidebarelement')) {
setActiveSidebarIndicator(indicatorBeforeFixedMenu); setActiveSidebarIndicator(indicatorBeforeFixedMenu);
} }
} }
}
if (mainScreen && mainScreen.classList.contains('mobile-details')) { if (mainScreen && mainScreen.classList.contains('mobile-details')) {
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize); const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
@ -803,6 +864,7 @@ function gotoJoinSpace() {
function gotoHome() { function gotoHome() {
setActiveSidebarIndicator(sidebarHomeIndicator); setActiveSidebarIndicator(sidebarHomeIndicator);
switchRoomContent("title.splash", splashScreen, false); switchRoomContent("title.splash", splashScreen, false);
switchRoomsBar("title.home", homeRoomBar);
} }
function setActiveSidebarIndicator(element, skipDisabling = false) function setActiveSidebarIndicator(element, skipDisabling = false)
@ -833,18 +895,70 @@ function mobileNavBack() {
function mobileNavDetails() { function mobileNavDetails() {
mainScreen.classList.add('mobile-details'); mainScreen.classList.add('mobile-details');
} }
let touchStartX = 0; let touchStartX = 0;
let touchEndX = 0; let touchEndX = 0;
let touchStartY = 0; let touchStartY = 0;
let touchEndY = 0; let touchEndY = 0;
let touchMoved = false;
document.addEventListener('touchstart', e => { document.addEventListener('touchstart', e => {
touchStartX = e.changedTouches[0].screenX; touchStartX = e.changedTouches[0].screenX;
touchStartY = e.changedTouches[0].screenY; touchStartY = e.changedTouches[0].screenY;
}); touchMoved = false;
activeTouchButton = e.target.closest('button, input');
if (activeTouchButton) {
activeTouchButton.classList.add('is-pressed');
}
}, { passive: true });
document.addEventListener('touchmove', e => {
if (!touchMoved) {
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
let diffX = Math.abs(e.changedTouches[0].screenX - touchStartX);
let diffY = Math.abs(e.changedTouches[0].screenY - touchStartY);
if (diffX > rem || diffY > rem) {
touchMoved = true;
if (activeTouchButton) {
activeTouchButton.classList.remove('is-pressed');
activeTouchButton = null;
}
}
}
}, { passive: true });
document.addEventListener('touchend', e => { document.addEventListener('touchend', e => {
touchEndX = e.changedTouches[0].screenX; touchEndX = e.changedTouches[0].screenX;
touchEndY = e.changedTouches[0].screenY; touchEndY = e.changedTouches[0].screenY;
handleMobileSwipe(); handleMobileSwipe();
if (activeTouchButton) {
activeTouchButton.classList.remove('is-pressed');
if (!touchMoved) {
if (e.cancelable) {
e.preventDefault();
}
activeTouchButton.click();
}
activeTouchButton = null;
}
});
document.addEventListener('touchcancel', () => {
if (activeTouchButton) {
activeTouchButton.classList.remove('is-pressed');
activeTouchButton = null;
}
});
document.addEventListener('contextmenu', e => {
if (e.target.closest('button')) {
e.preventDefault();
}
}); });
function handleMobileSwipe() { function handleMobileSwipe() {
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize); const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
@ -853,7 +967,7 @@ function handleMobileSwipe() {
let diffX = touchEndX - touchStartX; let diffX = touchEndX - touchStartX;
let diffY = touchEndY - touchStartY; let diffY = touchEndY - touchStartY;
if (Math.abs(diffX) > Math.abs(diffY) && Math.abs(diffX) > 60) { if (Math.abs(diffX) > Math.abs(diffY) && Math.abs(diffX) > 4 * rem) {
if (diffX > 0) { if (diffX > 0) {
mobileNavBack(); mobileNavBack();
} else { } else {

View file

@ -73,6 +73,45 @@ var joinSpaceScreen = `
</div> </div>
`; `;
//roombars
var homeRoomBar = `
<div class="sidebar-section-header">
<button class="collapse-text-button" id="collapse-dms" onclick="clickCollapseDms()">
<span><blah>title.dms</blah></span>
<svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="var(--text-color)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
<button class="add-action-button" id="add-dm-btn" onclick="clickAddDm()">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="var(--text-color)"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
</button>
</div>
<div class="sidebar-section-header">
<button class="collapse-text-button" id="collapse-groups" onclick="clickCollapseGroups()">
<span><blah>title.groups</blah></span>
<svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="var(--text-color)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
<button class="add-action-button" id="add-group-btn" onclick="clickAddGroup()">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="var(--text-color)"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
</button>
</div>
`;
//context menus //context menus
var addSpaceMenu = ` var addSpaceMenu = `

View file

@ -87,9 +87,13 @@ button, input {
transform: translateZ(0); transform: translateZ(0);
will-change: transform; will-change: transform;
transform-origin: center center; transform-origin: center center;
touch-action: manipulation;
-webkit-touch-callout: none;
} }
input { input {
padding-left: calc(var(--button-margin) * 2); padding-left: calc(var(--button-margin) * 2);
-webkit-touch-callout: default;
} }
@ -143,9 +147,6 @@ indicator.active {
pointer-events: none !important; pointer-events: none !important;
} }
button:active, input:active {
transform: var(--press-scale);
}
roomcontent { roomcontent {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -348,13 +349,14 @@ herotitle {
color: var(--text-color); color: var(--text-color);
} }
} }
button:active, input:active { button:active, button.is-pressed, input:active, input.is-pressed {
background-color: rgba(255, 255, 255, 0.1); background-color: rgba(255, 255, 255, 0.1);
transform: var(--press-scale);
} }
.submit-button:active { .submit-button:active, .submit-button.is-pressed {
background-color: rgba(255, 255, 255, 0.5); background-color: rgba(255, 255, 255, 0.5);
} }
.add-action-button:active { .add-action-button:active, .add-action-button.is-pressed {
background-color: rgba(255, 255, 255, 0.1); background-color: rgba(255, 255, 255, 0.1);
color: var(--text-color); color: var(--text-color);
} }
@ -372,8 +374,9 @@ blah, inherit, .inherit {
all: inherit; all: inherit;
padding: 0; padding: 0;
margin: 0; margin: 0;
display: inline; display: flex;
opacity: 1; opacity: 1;
border: none;
} }
space{ space{
margin-left: 0.4rem; margin-left: 0.4rem;
@ -428,9 +431,9 @@ space{
color: var(--text-color); color: var(--text-color);
cursor: pointer; cursor: pointer;
} }
.mobile-nav-btn:active { .mobile-nav-btn:active, .mobile-nav-btn.is-pressed {
background-color: rgba(255, 255, 255, 0.1); background-color: rgba(255, 255, 255, 0.1);
border-radius: 0.8rem; transform: var(--press-scale);
} }
.mobile-nav-btn.right { .mobile-nav-btn.right {
margin-right: 0; margin-right: 0;