More animations

This commit is contained in:
olcxja 2026-05-14 22:35:22 +02:00
commit d29c5eea74
12 changed files with 388 additions and 78 deletions

View file

@ -61,7 +61,11 @@
"placeholder.create.group.input": "My group", "placeholder.create.group.input": "My group",
"placeholder.create.space.input": "My space", "placeholder.create.space.input": "My space",
"title.name": "Name", "title.name": "Name",
"desc.create.space": "Create, a space for your community", "desc.create.space": "Create a space for your community",
"desc.join.space": "Join a community that fits you",
"title.join.space": "Join space",
"title.space.id": "Space id",
"title.sign.up": "Sign Up", "title.sign.up": "Sign Up",
"title.sign.in": "Sign In", "title.sign.in": "Sign In",

View file

@ -21,22 +21,15 @@
</indicator> </indicator>
<button class="icon-button" onclick="gotoHome()"> <button class="icon-button" onclick="gotoHome()">
<svg viewBox="-1 -1 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg viewBox="-1 -1 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path <path d="M1 6V15H6V11C6 9.89543 6.89543 9 8 9C9.10457 9 10 9.89543 10 11V15H15V6L8 0L1 6Z" stroke="var(--text-color)" stroke-width="1.28" stroke-linejoin="round" stroke-linecap="round" transform="translate(0 0.5)"/>
d="M1 6V15H6V11C6 9.89543 6.89543 9 8 9C9.10457 9 10 9.89543 10 11V15H15V6L8 0L1 6Z"
stroke="currentColor"
stroke-width="1.28"
stroke-linejoin="round"
stroke-linecap="round"
transform="translate(0 0.5)"
/>
</svg> </svg>
</button> </button>
</sidebarelement> </sidebarelement>
<sidebarelement id="sidebar-add"> <sidebarelement id="sidebar-add">
<indicator> <indicator>
</indicator> </indicator>
<button class="icon-button" onclick="gotoCreateSpace()"> <button class="icon-button">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" <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"> stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"></line> <line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line> <line x1="5" y1="12" x2="19" y2="12"></line>
@ -49,7 +42,7 @@
<indicator> <indicator>
</indicator> </indicator>
<button class="icon-button" onclick="gotoInbox()"> <button class="icon-button" onclick="gotoInbox()">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="currentColor"><path d="M216-144q-29 0-50.5-21.5T144-216v-528q0-29.7 21.5-50.85Q187-816 216-816h528q29.7 0 50.85 21.15Q816-773.7 816-744v528q0 29-21.15 50.5T744-144H216Zm0-72h528v-144H632q-23 43-63.5 69.5T480-264q-49 0-89.5-26T328-360H216v144Zm332-148q28-28 28-68h168v-312H216v312h168q0 40 28 68t68 28q40 0 68-28ZM216-216h528-528Z"/></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M216-144q-29 0-50.5-21.5T144-216v-528q0-29.7 21.5-50.85Q187-816 216-816h528q29.7 0 50.85 21.15Q816-773.7 816-744v528q0 29-21.15 50.5T744-144H216Zm0-72h528v-144H632q-23 43-63.5 69.5T480-264q-49 0-89.5-26T328-360H216v144Zm332-148q28-28 28-68h168v-312H216v312h168q0 40 28 68t68 28q40 0 68-28ZM216-216h528-528Z"/></svg>
</button> </button>
</sidebarelement> </sidebarelement>
<sidebarelement id="sidebar-profile"> <sidebarelement id="sidebar-profile">
@ -69,12 +62,12 @@
<button class="collapse-text-button" id="collapse-dms"> <button class="collapse-text-button" id="collapse-dms">
<span><blah>title.dms</blah></span> <span><blah>title.dms</blah></span>
<svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" <svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> stroke="var(--text-color)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline> <polyline points="6 9 12 15 18 9"></polyline>
</svg> </svg>
</button> </button>
<button class="add-action-button" id="add-dm-btn"> <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="currentColor" <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"> stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"></line> <line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line> <line x1="5" y1="12" x2="19" y2="12"></line>
@ -86,12 +79,12 @@
<button class="collapse-text-button" id="collapse-groups"> <button class="collapse-text-button" id="collapse-groups">
<span><blah>title.groups</blah></span> <span><blah>title.groups</blah></span>
<svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" <svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> stroke="var(--text-color)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline> <polyline points="6 9 12 15 18 9"></polyline>
</svg> </svg>
</button> </button>
<button class="add-action-button" id="add-group-btn"> <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="currentColor" <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"> stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"></line> <line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line> <line x1="5" y1="12" x2="19" y2="12"></line>
@ -102,19 +95,16 @@
<roomcontent> <roomcontent>
<roomtopbar> <roomtopbar>
<blah>title.splash</blah>
</roomtopbar> </roomtopbar>
<roomcontent2> <roomcontent2>
<div style="display: flex;justify-content: center;align-items: center;height:100%;flex-direction: column;text-align: center;">
<img src="favicon.svg" style="width: 6rem">
<herotitle><blah>title.welcome.splash</blah></herotitle>
<p><blah>desc.welcome.splash</blah>. <span class="aqua">v<span class="clientver aqua">1.0</span></span></p>
</div>
</roomcontent2> </roomcontent2>
</roomcontent> </roomcontent>
<sidebar class="second" id="roomdetailsbar" style="display: none;"> <sidebar class="second" id="roomdetailsbar" style="display: none;">
</sidebar> </sidebar>
</main> </main>
<div id="fixed-context-menu" class="context-menu">
</div>
</body> </body>
</html> </html>
<script src="screens.js"></script> <script src="screens.js"></script>
@ -122,6 +112,7 @@
async function start() { async function start() {
updateLoadingStatus("loading.loading"); updateLoadingStatus("loading.loading");
try { try {
switchRoomContent("title.splash", splashScreen, false);
if (host != null) if (host != null)
{ {
await updateProtocolAndUrl(host); await updateProtocolAndUrl(host);

View file

@ -66,6 +66,7 @@ try {
var sidebarInboxIndicator = sidebarInbox.children.item(0); var sidebarInboxIndicator = sidebarInbox.children.item(0);
var fixedContextMenu = document.getElementById("fixed-context-menu");
} catch (e) { } catch (e) {
} }
@ -653,22 +654,44 @@ password = localStorage.getItem('password');
host = localStorage.getItem('host'); host = localStorage.getItem('host');
mainJS(); mainJS();
collapseDmsBtn.addEventListener("click", () => {
collapseDmsBtn.classList.toggle("collapsed");
});
collapseGroupsBtn.addEventListener("click", () => {
collapseGroupsBtn.classList.toggle("collapsed");
});
function showFixedContextMenu(rect, html) {
let parser = new DOMParser();
let doc = parser.parseFromString(html, "text/html");
//Invite to dm, addDmScreen, false let blahTags = doc.getElementsByTagName("blah");
async function switchRoomContent(title, content, showRoomBar) 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);
}
}
fixedContextMenu.innerHTML = doc.body.innerHTML;
fixedContextMenu.style.left = `${rect.right + 10}px`;
fixedContextMenu.style.top = `${rect.top}px`;
fixedContextMenu.classList.add("show");
}
async function switchRoomContent(title, content, showRoomBar, icon = "")
{ {
roomContentMain.style.transform = "scale(0.85)"; roomContentMain.style.transform = "scale(0.85)";
roomContentMain.style.opacity = "0"; roomContentMain.style.opacity = "0";
await delay(200); await delay(200);
roomTopBar.innerHTML = processBlah(title); roomTopBar.innerHTML = `${icon}<space></space><inherit>${processBlah(title)}</inherit>`
roomDetailsBar.style.display = showRoomBar ? "flex" : "none"; roomDetailsBar.style.display = showRoomBar ? "flex" : "none";
//content blah parsing //content blah parsing
@ -700,7 +723,12 @@ async function switchRoomContent(title, content, showRoomBar)
roomContentMain.style.transform = ""; roomContentMain.style.transform = "";
roomContentMain.style.opacity = ""; roomContentMain.style.opacity = "";
} }
collapseDmsBtn.addEventListener("click", () => {
collapseDmsBtn.classList.toggle("collapsed");
});
collapseGroupsBtn.addEventListener("click", () => {
collapseGroupsBtn.classList.toggle("collapsed");
});
addDmBtn.addEventListener("click", async () => { addDmBtn.addEventListener("click", async () => {
switchRoomContent("title.create.dm", addDmScreen, false); switchRoomContent("title.create.dm", addDmScreen, false);
}); });
@ -708,20 +736,68 @@ addGroupBtn.addEventListener("click", async () => {
switchRoomContent("title.create.group", createGroupScreen, false); switchRoomContent("title.create.group", createGroupScreen, false);
}); });
var indicatorBeforeFixedMenu;
sidebarAddButton.addEventListener("click", (e) => {
e.stopPropagation();
if (fixedContextMenu.classList.contains("show")) {
fixedContextMenu.classList.remove("show");
setActiveSidebarIndicator(indicatorBeforeFixedMenu);
} else {
setActiveSidebarIndicator(sidebarAddIndicator, true);
const rect = sidebarAddButton.getBoundingClientRect();
showFixedContextMenu(rect, addSpaceMenu);
}
});
document.addEventListener("click", (e) => {
if (fixedContextMenu.classList.contains("show")) {
if (!fixedContextMenu.contains(e.target)) {
fixedContextMenu.classList.remove("show");
setActiveSidebarIndicator(indicatorBeforeFixedMenu);
}
}
});
function gotoSideProfilePopup() { function gotoSideProfilePopup() {
} }
function gotoInbox() { function gotoInbox() {
setActiveSidebarIndicator(sidebarInboxIndicator);
} }
async function gotoCreateSpace() { function gotoCreateSpace() {
fixedContextMenu.classList.remove("show");
setActiveSidebarIndicator(sidebarAddIndicator);
switchRoomContent("title.create.space", createSpaceScreen, false); switchRoomContent("title.create.space", createSpaceScreen, false);
} }
function gotoJoinSpace() {
fixedContextMenu.classList.remove("show");
setActiveSidebarIndicator(sidebarAddIndicator);
switchRoomContent("title.join.space", joinSpaceScreen, false);
}
function gotoHome() { function gotoHome() {
setActiveSidebarIndicator(sidebarHomeIndicator);
switchRoomContent("title.splash", splashScreen, false);
} }
function setActiveSidebarIndicator(element, skipDisabling = false)
{
let indicators = document.getElementsByTagName("indicator");
for (let i = 0; i < indicators.length; i++) {
if (indicators[i].classList.contains("active"))
{
indicatorBeforeFixedMenu = indicators[i];
if (!skipDisabling)
{
indicators[i].classList.remove("active");
}
}
}
element.classList.add("active");
}
/* replaced with css /* replaced with css
sidebarHomeButton.addEventListener("mouseenter", () => { sidebarHomeButton.addEventListener("mouseenter", () => {

View file

@ -1,3 +1,11 @@
//room screens
var splashScreen = `
<div style="display: flex;justify-content: center;align-items: center;height:100%;flex-direction: column;text-align: center;">
<img src="favicon.svg" style="width: 6rem">
<herotitle><blah>title.welcome.splash</blah></herotitle>
<p><blah>desc.welcome.splash</blah>. <span class="aqua">v<span class="clientver aqua">1.0</span></span></p>
</div>
`;
var addDmScreen = ` var addDmScreen = `
<div style="display: flex;justify-content: center;align-items: center;height:100%;flex-direction: column;text-align: center;"> <div style="display: flex;justify-content: center;align-items: center;height:100%;flex-direction: column;text-align: center;">
<svg xmlns="http://www.w3.org/2000/svg" width="3rem" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M120-160v-600q0-33 23.5-56.5T200-840h480q33 0 56.5 23.5T760-760v203q-10-2-20-2.5t-20-.5q-10 0-20 .5t-20 2.5v-203H200v400h283q-2 10-2.5 20t-.5 20q0 10 .5 20t2.5 20H240L120-160Zm160-440h320v-80H280v80Zm0 160h200v-80H280v80Zm400 280v-120H560v-80h120v-120h80v120h120v80H760v120h-80ZM200-360v-400 400Z"/></svg> <svg xmlns="http://www.w3.org/2000/svg" width="3rem" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M120-160v-600q0-33 23.5-56.5T200-840h480q33 0 56.5 23.5T760-760v203q-10-2-20-2.5t-20-.5q-10 0-20 .5t-20 2.5v-203H200v400h283q-2 10-2.5 20t-.5 20q0 10 .5 20t2.5 20H240L120-160Zm160-440h320v-80H280v80Zm0 160h200v-80H280v80Zm400 280v-120H560v-80h120v-120h80v120h120v80H760v120h-80ZM200-360v-400 400Z"/></svg>
@ -6,7 +14,7 @@ var addDmScreen = `
<br> <br>
<div class="input-group"> <div class="input-group">
<label for="addchat-username"><blah>title.username</blah></label> <label for="addchat-username"><blah>title.username</blah></label>
<input type="text" id="addchat-username" placeholder="name@example.com" class="forminput"> <input type="text" id="addchat-username" placeholder="name:example.com" class="forminput">
</div> </div>
<div class="input-group"> <div class="input-group">
<button class="submit-button blah" onclick="addDm()">title.add.chat</button> <button class="submit-button blah" onclick="addDm()">title.add.chat</button>
@ -37,7 +45,7 @@ var createSpaceScreen = `
<p><blah>desc.create.space</blah></p> <p><blah>desc.create.space</blah></p>
<br> <br>
<div class="input-group"> <div class="input-group">
<label for="addgroup-name"><blah>title.name</blah></label> <label for="createspace-name"><blah>title.name</blah></label>
<input type="text" id="createspace-name" placeholder="{blah(placeholder.create.space.input)}" class="forminput"> <input type="text" id="createspace-name" placeholder="{blah(placeholder.create.space.input)}" class="forminput">
</div> </div>
<div class="input-group"> <div class="input-group">
@ -45,3 +53,35 @@ var createSpaceScreen = `
</div> </div>
</div> </div>
`; `;
var joinSpaceScreen = `
<div style="display: flex;justify-content: center;align-items: center;height:100%;flex-direction: column;text-align: center;">
<svg xmlns="http://www.w3.org/2000/svg" width="3rem" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"/></svg>
<herotitle><blah>title.join.space</blah></herotitle>
<p><blah>desc.join.space</blah></p>
<br>
<div class="input-group">
<label for="joinspace-id"><blah>title.space.id</blah></label>
<input type="text" id="joinspace-id" placeholder="id:example.com" class="forminput">
</div>
<div class="input-group">
<label for="joinspace-code"><blah>title.invitation.code</blah></label>
<input type="text" id="joinspace-code" placeholder="{blah(placeholder.invitation.code)}" class="forminput">
</div>
<div class="input-group">
<button class="submit-button blah" onclick="createGroup()">title.join.space</button>
</div>
</div>
`;
//context menus
var addSpaceMenu = `
<button onclick="gotoJoinSpace()">
<svg xmlns="http://www.w3.org/2000/svg" width="1.4rem" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"/></svg>
<span class="blah">title.join.space</span>
</button>
<button onclick="gotoCreateSpace()">
<svg xmlns="http://www.w3.org/2000/svg" width="1.4rem" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M80-120v-720h400v160h400v320h-80v-240H480v80h80v80h-80v80h80v80h-80v80h160v80H80Zm80-80h80v-80h-80v80Zm0-160h80v-80h-80v80Zm0-160h80v-80h-80v80Zm0-160h80v-80h-80v80Zm160 480h80v-80h-80v80Zm0-160h80v-80h-80v80Zm0-160h80v-80h-80v80Zm0-160h80v-80h-80v80ZM800-40v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80ZM640-440v-80h80v80h-80Zm0 160v-80h80v80h-80Z"/></svg>
<span class="blah">title.create.space</span>
</button>
`;

View file

@ -5,6 +5,7 @@
:root { :root {
--main-bg-color: rgb(20, 20, 20); --main-bg-color: rgb(20, 20, 20);
--text-color: rgb(240, 240, 245); --text-color: rgb(240, 240, 245);
--darker-text-color: rgb(210, 210, 215);
--icon-button-size: 2rem; --icon-button-size: 2rem;
--press-scale: scale(0.92); --press-scale: scale(0.92);
--light-border-color: rgba(255, 255, 255, 0.08); --light-border-color: rgba(255, 255, 255, 0.08);
@ -393,10 +394,53 @@ sidebarelement:has(.icon-button:active) indicator:not(.active) {
transform: translateY(calc( ( var(--icon-button-height) + (var(--button-margin) * 2) ) / 2 - 0.6rem)); transform: translateY(calc( ( var(--icon-button-height) + (var(--button-margin) * 2) ) / 2 - 0.6rem));
} }
blah { blah, inherit, .inherit {
all: inherit; all: inherit;
padding: 0; padding: 0;
margin: 0; margin: 0;
display: inline; display: inline;
opacity: 1; opacity: 1;
} }
space{
margin-left: 0.4rem;
}
.context-menu {
position: fixed;
background: var(--main-bg-color);
border: var(--border-width) solid var(--light-border-color);
border-radius: 0.8rem;
padding: 0.4rem;
display: flex;
flex-direction: column;
gap: 0.2rem;
z-index: 2000;
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.4);
opacity: 0;
transform: scale(0.95);
transform-origin: center left;
pointer-events: none;
}
.context-menu.show {
opacity: 1;
transform: scale(1);
pointer-events: auto;
}
.context-menu button {
margin: 0;
padding: 0.5rem 1rem;
border: none;
background: transparent;
width: 100%;
min-width: 10rem;
justify-content: flex-start;
gap: 0.5rem;
font-weight: 600;
}
.context-menu button:hover {
background-color: rgba(255, 255, 255, 0.08);
}

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

@ -61,7 +61,11 @@
"placeholder.create.group.input": "My group", "placeholder.create.group.input": "My group",
"placeholder.create.space.input": "My space", "placeholder.create.space.input": "My space",
"title.name": "Name", "title.name": "Name",
"desc.create.space": "Create, a space for your community", "desc.create.space": "Create a space for your community",
"desc.join.space": "Join a community that fits you",
"title.join.space": "Join space",
"title.space.id": "Space id",
"title.sign.up": "Sign Up", "title.sign.up": "Sign Up",
"title.sign.in": "Sign In", "title.sign.in": "Sign In",

View file

@ -21,22 +21,15 @@
</indicator> </indicator>
<button class="icon-button" onclick="gotoHome()"> <button class="icon-button" onclick="gotoHome()">
<svg viewBox="-1 -1 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg viewBox="-1 -1 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path <path d="M1 6V15H6V11C6 9.89543 6.89543 9 8 9C9.10457 9 10 9.89543 10 11V15H15V6L8 0L1 6Z" stroke="var(--text-color)" stroke-width="1.28" stroke-linejoin="round" stroke-linecap="round" transform="translate(0 0.5)"/>
d="M1 6V15H6V11C6 9.89543 6.89543 9 8 9C9.10457 9 10 9.89543 10 11V15H15V6L8 0L1 6Z"
stroke="currentColor"
stroke-width="1.28"
stroke-linejoin="round"
stroke-linecap="round"
transform="translate(0 0.5)"
/>
</svg> </svg>
</button> </button>
</sidebarelement> </sidebarelement>
<sidebarelement id="sidebar-add"> <sidebarelement id="sidebar-add">
<indicator> <indicator>
</indicator> </indicator>
<button class="icon-button" onclick="gotoCreateSpace()"> <button class="icon-button">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" <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"> stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"></line> <line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line> <line x1="5" y1="12" x2="19" y2="12"></line>
@ -49,7 +42,7 @@
<indicator> <indicator>
</indicator> </indicator>
<button class="icon-button" onclick="gotoInbox()"> <button class="icon-button" onclick="gotoInbox()">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="currentColor"><path d="M216-144q-29 0-50.5-21.5T144-216v-528q0-29.7 21.5-50.85Q187-816 216-816h528q29.7 0 50.85 21.15Q816-773.7 816-744v528q0 29-21.15 50.5T744-144H216Zm0-72h528v-144H632q-23 43-63.5 69.5T480-264q-49 0-89.5-26T328-360H216v144Zm332-148q28-28 28-68h168v-312H216v312h168q0 40 28 68t68 28q40 0 68-28ZM216-216h528-528Z"/></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M216-144q-29 0-50.5-21.5T144-216v-528q0-29.7 21.5-50.85Q187-816 216-816h528q29.7 0 50.85 21.15Q816-773.7 816-744v528q0 29-21.15 50.5T744-144H216Zm0-72h528v-144H632q-23 43-63.5 69.5T480-264q-49 0-89.5-26T328-360H216v144Zm332-148q28-28 28-68h168v-312H216v312h168q0 40 28 68t68 28q40 0 68-28ZM216-216h528-528Z"/></svg>
</button> </button>
</sidebarelement> </sidebarelement>
<sidebarelement id="sidebar-profile"> <sidebarelement id="sidebar-profile">
@ -69,12 +62,12 @@
<button class="collapse-text-button" id="collapse-dms"> <button class="collapse-text-button" id="collapse-dms">
<span><blah>title.dms</blah></span> <span><blah>title.dms</blah></span>
<svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" <svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> stroke="var(--text-color)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline> <polyline points="6 9 12 15 18 9"></polyline>
</svg> </svg>
</button> </button>
<button class="add-action-button" id="add-dm-btn"> <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="currentColor" <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"> stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"></line> <line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line> <line x1="5" y1="12" x2="19" y2="12"></line>
@ -86,12 +79,12 @@
<button class="collapse-text-button" id="collapse-groups"> <button class="collapse-text-button" id="collapse-groups">
<span><blah>title.groups</blah></span> <span><blah>title.groups</blah></span>
<svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" <svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> stroke="var(--text-color)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline> <polyline points="6 9 12 15 18 9"></polyline>
</svg> </svg>
</button> </button>
<button class="add-action-button" id="add-group-btn"> <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="currentColor" <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"> stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"></line> <line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line> <line x1="5" y1="12" x2="19" y2="12"></line>
@ -102,19 +95,16 @@
<roomcontent> <roomcontent>
<roomtopbar> <roomtopbar>
<blah>title.splash</blah>
</roomtopbar> </roomtopbar>
<roomcontent2> <roomcontent2>
<div style="display: flex;justify-content: center;align-items: center;height:100%;flex-direction: column;text-align: center;">
<img src="favicon.svg" style="width: 6rem">
<herotitle><blah>title.welcome.splash</blah></herotitle>
<p><blah>desc.welcome.splash</blah>. <span class="aqua">v<span class="clientver aqua">1.0</span></span></p>
</div>
</roomcontent2> </roomcontent2>
</roomcontent> </roomcontent>
<sidebar class="second" id="roomdetailsbar" style="display: none;"> <sidebar class="second" id="roomdetailsbar" style="display: none;">
</sidebar> </sidebar>
</main> </main>
<div id="fixed-context-menu" class="context-menu">
</div>
</body> </body>
</html> </html>
<script src="screens.js"></script> <script src="screens.js"></script>
@ -122,6 +112,7 @@
async function start() { async function start() {
updateLoadingStatus("loading.loading"); updateLoadingStatus("loading.loading");
try { try {
switchRoomContent("title.splash", splashScreen, false);
if (host != null) if (host != null)
{ {
await updateProtocolAndUrl(host); await updateProtocolAndUrl(host);

View file

@ -66,6 +66,7 @@ try {
var sidebarInboxIndicator = sidebarInbox.children.item(0); var sidebarInboxIndicator = sidebarInbox.children.item(0);
var fixedContextMenu = document.getElementById("fixed-context-menu");
} catch (e) { } catch (e) {
} }
@ -653,22 +654,44 @@ password = localStorage.getItem('password');
host = localStorage.getItem('host'); host = localStorage.getItem('host');
mainJS(); mainJS();
collapseDmsBtn.addEventListener("click", () => {
collapseDmsBtn.classList.toggle("collapsed");
});
collapseGroupsBtn.addEventListener("click", () => {
collapseGroupsBtn.classList.toggle("collapsed");
});
function showFixedContextMenu(rect, html) {
let parser = new DOMParser();
let doc = parser.parseFromString(html, "text/html");
//Invite to dm, addDmScreen, false let blahTags = doc.getElementsByTagName("blah");
async function switchRoomContent(title, content, showRoomBar) 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);
}
}
fixedContextMenu.innerHTML = doc.body.innerHTML;
fixedContextMenu.style.left = `${rect.right + 10}px`;
fixedContextMenu.style.top = `${rect.top}px`;
fixedContextMenu.classList.add("show");
}
async function switchRoomContent(title, content, showRoomBar, icon = "")
{ {
roomContentMain.style.transform = "scale(0.85)"; roomContentMain.style.transform = "scale(0.85)";
roomContentMain.style.opacity = "0"; roomContentMain.style.opacity = "0";
await delay(200); await delay(200);
roomTopBar.innerHTML = processBlah(title); roomTopBar.innerHTML = `${icon}<space></space><inherit>${processBlah(title)}</inherit>`
roomDetailsBar.style.display = showRoomBar ? "flex" : "none"; roomDetailsBar.style.display = showRoomBar ? "flex" : "none";
//content blah parsing //content blah parsing
@ -700,7 +723,12 @@ async function switchRoomContent(title, content, showRoomBar)
roomContentMain.style.transform = ""; roomContentMain.style.transform = "";
roomContentMain.style.opacity = ""; roomContentMain.style.opacity = "";
} }
collapseDmsBtn.addEventListener("click", () => {
collapseDmsBtn.classList.toggle("collapsed");
});
collapseGroupsBtn.addEventListener("click", () => {
collapseGroupsBtn.classList.toggle("collapsed");
});
addDmBtn.addEventListener("click", async () => { addDmBtn.addEventListener("click", async () => {
switchRoomContent("title.create.dm", addDmScreen, false); switchRoomContent("title.create.dm", addDmScreen, false);
}); });
@ -708,20 +736,68 @@ addGroupBtn.addEventListener("click", async () => {
switchRoomContent("title.create.group", createGroupScreen, false); switchRoomContent("title.create.group", createGroupScreen, false);
}); });
var indicatorBeforeFixedMenu;
sidebarAddButton.addEventListener("click", (e) => {
e.stopPropagation();
if (fixedContextMenu.classList.contains("show")) {
fixedContextMenu.classList.remove("show");
setActiveSidebarIndicator(indicatorBeforeFixedMenu);
} else {
setActiveSidebarIndicator(sidebarAddIndicator, true);
const rect = sidebarAddButton.getBoundingClientRect();
showFixedContextMenu(rect, addSpaceMenu);
}
});
document.addEventListener("click", (e) => {
if (fixedContextMenu.classList.contains("show")) {
if (!fixedContextMenu.contains(e.target)) {
fixedContextMenu.classList.remove("show");
setActiveSidebarIndicator(indicatorBeforeFixedMenu);
}
}
});
function gotoSideProfilePopup() { function gotoSideProfilePopup() {
} }
function gotoInbox() { function gotoInbox() {
setActiveSidebarIndicator(sidebarInboxIndicator);
} }
async function gotoCreateSpace() { function gotoCreateSpace() {
fixedContextMenu.classList.remove("show");
setActiveSidebarIndicator(sidebarAddIndicator);
switchRoomContent("title.create.space", createSpaceScreen, false); switchRoomContent("title.create.space", createSpaceScreen, false);
} }
function gotoJoinSpace() {
fixedContextMenu.classList.remove("show");
setActiveSidebarIndicator(sidebarAddIndicator);
switchRoomContent("title.join.space", joinSpaceScreen, false);
}
function gotoHome() { function gotoHome() {
setActiveSidebarIndicator(sidebarHomeIndicator);
switchRoomContent("title.splash", splashScreen, false);
} }
function setActiveSidebarIndicator(element, skipDisabling = false)
{
let indicators = document.getElementsByTagName("indicator");
for (let i = 0; i < indicators.length; i++) {
if (indicators[i].classList.contains("active"))
{
indicatorBeforeFixedMenu = indicators[i];
if (!skipDisabling)
{
indicators[i].classList.remove("active");
}
}
}
element.classList.add("active");
}
/* replaced with css /* replaced with css
sidebarHomeButton.addEventListener("mouseenter", () => { sidebarHomeButton.addEventListener("mouseenter", () => {

View file

@ -1,3 +1,11 @@
//room screens
var splashScreen = `
<div style="display: flex;justify-content: center;align-items: center;height:100%;flex-direction: column;text-align: center;">
<img src="favicon.svg" style="width: 6rem">
<herotitle><blah>title.welcome.splash</blah></herotitle>
<p><blah>desc.welcome.splash</blah>. <span class="aqua">v<span class="clientver aqua">1.0</span></span></p>
</div>
`;
var addDmScreen = ` var addDmScreen = `
<div style="display: flex;justify-content: center;align-items: center;height:100%;flex-direction: column;text-align: center;"> <div style="display: flex;justify-content: center;align-items: center;height:100%;flex-direction: column;text-align: center;">
<svg xmlns="http://www.w3.org/2000/svg" width="3rem" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M120-160v-600q0-33 23.5-56.5T200-840h480q33 0 56.5 23.5T760-760v203q-10-2-20-2.5t-20-.5q-10 0-20 .5t-20 2.5v-203H200v400h283q-2 10-2.5 20t-.5 20q0 10 .5 20t2.5 20H240L120-160Zm160-440h320v-80H280v80Zm0 160h200v-80H280v80Zm400 280v-120H560v-80h120v-120h80v120h120v80H760v120h-80ZM200-360v-400 400Z"/></svg> <svg xmlns="http://www.w3.org/2000/svg" width="3rem" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M120-160v-600q0-33 23.5-56.5T200-840h480q33 0 56.5 23.5T760-760v203q-10-2-20-2.5t-20-.5q-10 0-20 .5t-20 2.5v-203H200v400h283q-2 10-2.5 20t-.5 20q0 10 .5 20t2.5 20H240L120-160Zm160-440h320v-80H280v80Zm0 160h200v-80H280v80Zm400 280v-120H560v-80h120v-120h80v120h120v80H760v120h-80ZM200-360v-400 400Z"/></svg>
@ -6,7 +14,7 @@ var addDmScreen = `
<br> <br>
<div class="input-group"> <div class="input-group">
<label for="addchat-username"><blah>title.username</blah></label> <label for="addchat-username"><blah>title.username</blah></label>
<input type="text" id="addchat-username" placeholder="name@example.com" class="forminput"> <input type="text" id="addchat-username" placeholder="name:example.com" class="forminput">
</div> </div>
<div class="input-group"> <div class="input-group">
<button class="submit-button blah" onclick="addDm()">title.add.chat</button> <button class="submit-button blah" onclick="addDm()">title.add.chat</button>
@ -37,7 +45,7 @@ var createSpaceScreen = `
<p><blah>desc.create.space</blah></p> <p><blah>desc.create.space</blah></p>
<br> <br>
<div class="input-group"> <div class="input-group">
<label for="addgroup-name"><blah>title.name</blah></label> <label for="createspace-name"><blah>title.name</blah></label>
<input type="text" id="createspace-name" placeholder="{blah(placeholder.create.space.input)}" class="forminput"> <input type="text" id="createspace-name" placeholder="{blah(placeholder.create.space.input)}" class="forminput">
</div> </div>
<div class="input-group"> <div class="input-group">
@ -45,3 +53,35 @@ var createSpaceScreen = `
</div> </div>
</div> </div>
`; `;
var joinSpaceScreen = `
<div style="display: flex;justify-content: center;align-items: center;height:100%;flex-direction: column;text-align: center;">
<svg xmlns="http://www.w3.org/2000/svg" width="3rem" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"/></svg>
<herotitle><blah>title.join.space</blah></herotitle>
<p><blah>desc.join.space</blah></p>
<br>
<div class="input-group">
<label for="joinspace-id"><blah>title.space.id</blah></label>
<input type="text" id="joinspace-id" placeholder="id:example.com" class="forminput">
</div>
<div class="input-group">
<label for="joinspace-code"><blah>title.invitation.code</blah></label>
<input type="text" id="joinspace-code" placeholder="{blah(placeholder.invitation.code)}" class="forminput">
</div>
<div class="input-group">
<button class="submit-button blah" onclick="createGroup()">title.join.space</button>
</div>
</div>
`;
//context menus
var addSpaceMenu = `
<button onclick="gotoJoinSpace()">
<svg xmlns="http://www.w3.org/2000/svg" width="1.4rem" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"/></svg>
<span class="blah">title.join.space</span>
</button>
<button onclick="gotoCreateSpace()">
<svg xmlns="http://www.w3.org/2000/svg" width="1.4rem" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M80-120v-720h400v160h400v320h-80v-240H480v80h80v80h-80v80h80v80h-80v80h160v80H80Zm80-80h80v-80h-80v80Zm0-160h80v-80h-80v80Zm0-160h80v-80h-80v80Zm0-160h80v-80h-80v80Zm160 480h80v-80h-80v80Zm0-160h80v-80h-80v80Zm0-160h80v-80h-80v80Zm0-160h80v-80h-80v80ZM800-40v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80ZM640-440v-80h80v80h-80Zm0 160v-80h80v80h-80Z"/></svg>
<span class="blah">title.create.space</span>
</button>
`;

View file

@ -5,6 +5,7 @@
:root { :root {
--main-bg-color: rgb(20, 20, 20); --main-bg-color: rgb(20, 20, 20);
--text-color: rgb(240, 240, 245); --text-color: rgb(240, 240, 245);
--darker-text-color: rgb(210, 210, 215);
--icon-button-size: 2rem; --icon-button-size: 2rem;
--press-scale: scale(0.92); --press-scale: scale(0.92);
--light-border-color: rgba(255, 255, 255, 0.08); --light-border-color: rgba(255, 255, 255, 0.08);
@ -393,10 +394,53 @@ sidebarelement:has(.icon-button:active) indicator:not(.active) {
transform: translateY(calc( ( var(--icon-button-height) + (var(--button-margin) * 2) ) / 2 - 0.6rem)); transform: translateY(calc( ( var(--icon-button-height) + (var(--button-margin) * 2) ) / 2 - 0.6rem));
} }
blah { blah, inherit, .inherit {
all: inherit; all: inherit;
padding: 0; padding: 0;
margin: 0; margin: 0;
display: inline; display: inline;
opacity: 1; opacity: 1;
} }
space{
margin-left: 0.4rem;
}
.context-menu {
position: fixed;
background: var(--main-bg-color);
border: var(--border-width) solid var(--light-border-color);
border-radius: 0.8rem;
padding: 0.4rem;
display: flex;
flex-direction: column;
gap: 0.2rem;
z-index: 2000;
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.4);
opacity: 0;
transform: scale(0.95);
transform-origin: center left;
pointer-events: none;
}
.context-menu.show {
opacity: 1;
transform: scale(1);
pointer-events: auto;
}
.context-menu button {
margin: 0;
padding: 0.5rem 1rem;
border: none;
background: transparent;
width: 100%;
min-width: 10rem;
justify-content: flex-start;
gap: 0.5rem;
font-weight: 600;
}
.context-menu button:hover {
background-color: rgba(255, 255, 255, 0.08);
}