Compare commits

..

No commits in common. "34ddd1d50772aca61c5f84ea2bb02b536306e8ba" and "7ca3832286ac510438482f797f77c7297bc0f135" have entirely different histories.

12 changed files with 250 additions and 726 deletions

View file

@ -61,11 +61,7 @@
"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,15 +21,22 @@
</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 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)"/> <path
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"> <button class="icon-button" onclick="gotoCreateSpace()">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="var(--text-color)" <svg 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-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>
@ -42,7 +49,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="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> <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>
</button> </button>
</sidebarelement> </sidebarelement>
<sidebarelement id="sidebar-profile"> <sidebarelement id="sidebar-profile">
@ -53,6 +60,7 @@
</button> </button>
</sidebarelement> </sidebarelement>
</sidebar> </sidebar>
<sidebar class="second" id="roomsbar"> <sidebar class="second" id="roomsbar">
<roomtopbar> <roomtopbar>
<blah>title.home</blah> <blah>title.home</blah>
@ -61,12 +69,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="var(--text-color)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> stroke="currentColor" 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="var(--text-color)" <svg 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-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>
@ -78,12 +86,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="var(--text-color)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> stroke="currentColor" 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="var(--text-color)" <svg 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-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>
@ -94,16 +102,19 @@
<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>
@ -111,7 +122,6 @@
async function start() { async function start() {
updateLoadingStatus("loading.loading"); updateLoadingStatus("loading.loading");
try { try {
switchRoomContent("title.splash", splashScreen, false, "", true);
if (host != null) if (host != null)
{ {
await updateProtocolAndUrl(host); await updateProtocolAndUrl(host);
@ -120,6 +130,7 @@
{ {
await updateProtocolAndUrl(window.location.hostname); await updateProtocolAndUrl(window.location.hostname);
} }
sidebarPfp.src = await getAvatarUrl(username); sidebarPfp.src = await getAvatarUrl(username);
showAction("Authenticating...", "startauth"); showAction("Authenticating...", "startauth");
@ -177,6 +188,7 @@
async function createGroup() { async function createGroup() {
} }
</script> </script>
<script src="main.js"></script> <script src="main.js"></script>
<script src="userscript.js"></script> <script src="userscript.js"></script>

View file

@ -66,7 +66,6 @@ try {
var sidebarInboxIndicator = sidebarInbox.children.item(0); var sidebarInboxIndicator = sidebarInbox.children.item(0);
var fixedContextMenu = document.getElementById("fixed-context-menu");
} catch (e) { } catch (e) {
} }
@ -654,48 +653,25 @@ 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");
let blahTags = doc.getElementsByTagName("blah"); //Invite to dm, addDmScreen, false
for (let i = 0; i < blahTags.length; i++) { async function switchRoomContent(title, content, showRoomBar)
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 = "", skipMobileSlide = false)
{ {
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);
let backBtnHtml = `<button class="mobile-nav-btn" onclick="mobileNavBack()"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg></button>`;
let detailsBtnHtml = showRoomBar ? `<button class="mobile-nav-btn right" onclick="mobileNavDetails()"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg></button>` : '';
roomTopBar.innerHTML = `${backBtnHtml}${icon}<space></space><inherit>${processBlah(title)}</inherit><div class="flex-spacer"></div>${detailsBtnHtml}`; roomTopBar.innerHTML = processBlah(title);
roomDetailsBar.style.display = showRoomBar ? "flex" : "none"; roomDetailsBar.style.display = showRoomBar ? "flex" : "none";
//content blah parsing
let parser = new DOMParser(); let parser = new DOMParser();
let doc = parser.parseFromString(content, "text/html"); let doc = parser.parseFromString(content, "text/html");
@ -715,25 +691,16 @@ async function switchRoomContent(title, content, showRoomBar, icon = "", skipMob
let value = placeholders[i].placeholder.split("{blah(")[1].split(")}")[0]; let value = placeholders[i].placeholder.split("{blah(")[1].split(")}")[0];
placeholders[i].placeholder = processBlah(value); placeholders[i].placeholder = processBlah(value);
} }
} }
roomContentMain.innerHTML = doc.body.innerHTML; roomContentMain.innerHTML = doc.body.innerHTML;
roomContentMain.style.transform = ""; roomContentMain.style.transform = "";
roomContentMain.style.opacity = ""; roomContentMain.style.opacity = "";
}
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
if (window.innerWidth <= 52 * rem && !skipMobileSlide) {
mainScreen.classList.remove('mobile-details');
mainScreen.classList.add('mobile-content');
}
}
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);
}); });
@ -741,107 +708,47 @@ 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);
} }
function gotoCreateSpace() { async 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");
}
function mobileNavBack() { /* replaced with css
if(mainScreen.classList.contains('mobile-details')) { sidebarHomeButton.addEventListener("mouseenter", () => {
mainScreen.classList.remove('mobile-details'); sidebarHomeIndicator.classList.add("hover");
mainScreen.classList.add('mobile-content');
} else {
mainScreen.classList.remove('mobile-content');
}
}
function mobileNavDetails() {
mainScreen.classList.add('mobile-details');
}
let touchStartX = 0;
let touchEndX = 0;
let touchStartY = 0;
let touchEndY = 0;
document.addEventListener('touchstart', e => {
touchStartX = e.changedTouches[0].screenX;
touchStartY = e.changedTouches[0].screenY;
}); });
document.addEventListener('touchend', e => { sidebarHomeButton.addEventListener("mouseleave", () => {
touchEndX = e.changedTouches[0].screenX; sidebarHomeIndicator.classList.remove("hover");
touchEndY = e.changedTouches[0].screenY;
handleMobileSwipe();
}); });
function handleMobileSwipe() {
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
if (window.innerWidth > 52 * rem) return;
let diffX = touchEndX - touchStartX; sidebarAddButton.addEventListener("mouseenter", () => {
let diffY = touchEndY - touchStartY; sidebarAddIndicator.classList.add("hover");
});
sidebarAddButton.addEventListener("mouseleave", () => {
sidebarAddIndicator.classList.remove("hover");
});
if (Math.abs(diffX) > Math.abs(diffY) && Math.abs(diffX) > 60) { sidebarProfileButton.addEventListener("mouseenter", () => {
if (diffX > 0) { sidebarProfileIndicator.classList.add("hover");
mobileNavBack(); });
} else { sidebarProfileButton.addEventListener("mouseleave", () => {
if (mainScreen.classList.contains('mobile-content') && roomDetailsBar.style.display !== 'none') { sidebarProfileIndicator.classList.remove("hover");
mobileNavDetails(); });
}
} sidebarInboxButton.addEventListener("mouseenter", () => {
} sidebarInboxIndicator.classList.add("hover");
} });
sidebarInboxButton.addEventListener("mouseleave", () => {
sidebarInboxIndicator.classList.remove("hover");
});
*/

View file

@ -1,11 +1,3 @@
//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>
@ -14,7 +6,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>
@ -45,7 +37,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="createspace-name"><blah>title.name</blah></label> <label for="addgroup-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">
@ -53,35 +45,3 @@ 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,7 +5,6 @@
: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);
@ -70,6 +69,7 @@ loading {
user-select: none !important; user-select: none !important;
-webkit-user-drag: none !important; -webkit-user-drag: none !important;
} }
button, input { button, input {
border-radius: 0.8rem; border-radius: 0.8rem;
background-color: rgba(255, 255, 255, 0.05); background-color: rgba(255, 255, 255, 0.05);
@ -180,6 +180,7 @@ sidebar.second {
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.collapse-text-button { .collapse-text-button {
padding-left: calc(var(--button-margin) + 0.2rem); padding-left: calc(var(--button-margin) + 0.2rem);
flex-shrink: 0; flex-shrink: 0;
@ -190,13 +191,16 @@ sidebar.second {
font-weight: 600; font-weight: 600;
gap: 0.3rem; gap: 0.3rem;
} }
.collapse-text-button .chevron { .collapse-text-button .chevron {
width: 1.25rem; width: 1.25rem;
height: 1.25rem; height: 1.25rem;
} }
.collapse-text-button.collapsed .chevron { .collapse-text-button.collapsed .chevron {
transform: rotate(-90deg); transform: rotate(-90deg);
} }
.add-action-button { .add-action-button {
border: none; border: none;
background-color: transparent; background-color: transparent;
@ -207,6 +211,7 @@ sidebar.second {
justify-content: center; justify-content: center;
color: rgba(255, 255, 255, 0.5); color: rgba(255, 255, 255, 0.5);
} }
.add-action-button svg { .add-action-button svg {
width: 1.25rem; width: 1.25rem;
height: 1.25rem; height: 1.25rem;
@ -219,6 +224,8 @@ hr {
width: 60%; width: 60%;
margin-left: 20%; margin-left: 20%;
} }
#notification-container { #notification-container {
padding-top: env(safe-area-inset-top); padding-top: env(safe-area-inset-top);
position: fixed; position: fixed;
@ -232,10 +239,12 @@ hr {
pointer-events: none; pointer-events: none;
align-items: center; align-items: center;
} }
.notification { .notification {
background: rgba(255, 255, 255, 0.015); background: rgba(255, 255, 255, 0.015);
backdrop-filter: blur(1.2rem); backdrop-filter: blur(1.2rem);
-webkit-backdrop-filter: blur(1.2rem); -webkit-backdrop-filter: blur(1.2rem);
border: var(--border-width) solid var(--light-border-color); border: var(--border-width) solid var(--light-border-color);
border-radius: 0.9rem; border-radius: 0.9rem;
@ -254,21 +263,27 @@ hr {
transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
background-color 0.2s ease; background-color 0.2s ease;
} }
.notification.show { .notification.show {
opacity: 1; opacity: 1;
transform: translateY(0); transform: translateY(0);
} }
.notification.info { .notification.info {
border-color: var(--big-default); border-color: var(--big-default);
} }
.notification.error { .notification.error {
border-color: var(--big-red); border-color: var(--big-red);
} }
.notification.success { .notification.success {
border-color: var(--big-green); border-color: var(--big-green);
} }
roomtopbar { roomtopbar {
height: calc(var(--button-height) * 1.5); height: calc(var(--button-height) * 1.5);
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -278,11 +293,11 @@ roomtopbar {
line-height: calc(var(--button-height) * 1.5); line-height: calc(var(--button-height) * 1.5);
font-weight: bold; font-weight: bold;
padding-left: calc(var(--button-margin) * 3); padding-left: calc(var(--button-margin) * 3);
padding-right: calc(var(--button-margin) * 3);
font-size: 1.5rem; font-size: 1.5rem;
} }
sidebar.second#roomdetailsbar { sidebar.second#roomdetailsbar {
height: calc(var(--button-height) * 1.5); height: calc(var(--button-height) * 1.5);
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -296,24 +311,32 @@ herotitle {
font-weight: bold; font-weight: bold;
font-size: 1.6rem; font-size: 1.6rem;
} }
.input-group { .input-group {
text-align: left; text-align: left;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 0.2rem; gap: 0.2rem;
width: 90%; width: 90%;
max-width: 30rem; max-width: 30rem;
} }
.input-group label { .input-group label {
font-size: 0.75rem; font-size: 0.75rem;
font-weight: 800; font-weight: 800;
margin-left: 0.6rem; margin-left: 0.6rem;
margin-bottom: -0.2rem; margin-bottom: -0.2rem;
opacity: 0.4; opacity: 0.4;
letter-spacing: 0.05rem; letter-spacing: 0.05rem;
position: relative; position: relative;
z-index: 1; z-index: 1;
} }
.submit-button { .submit-button {
justify-content: center; justify-content: center;
background-color: var(--text-color); background-color: var(--text-color);
@ -322,9 +345,11 @@ herotitle {
border: none; border: none;
font-size: 1.05rem; font-size: 1.05rem;
} }
.bottom-element { .bottom-element {
margin-top: auto; margin-top: auto;
} }
@media (hover: hover) { @media (hover: hover) {
sidebarelement:hover indicator:not(.active) { sidebarelement:hover indicator:not(.active) {
content: ""; content: "";
@ -367,149 +392,11 @@ sidebarelement:has(.icon-button:active) indicator:not(.active) {
border-radius: 0.8rem; border-radius: 0.8rem;
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, inherit, .inherit {
blah {
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);
}
.mobile-nav-btn {
display: none;
background: transparent;
border: none;
height: 2.4rem;
width: 2.4rem;
padding: 0;
margin: 0;
margin-right: 0.8rem;
align-items: center;
justify-content: center;
flex-shrink: 0;
color: var(--text-color);
cursor: pointer;
}
.mobile-nav-btn:active {
background-color: rgba(255, 255, 255, 0.1);
border-radius: 0.8rem;
}
.mobile-nav-btn.right {
margin-right: 0;
margin-left: 0.8rem;
}
.mobile-nav-btn svg {
width: 1.5rem;
height: 1.5rem;
}
.flex-spacer {
flex-grow: 1;
}
@media (max-width: 52rem) {
.mobile-nav-btn {
display: flex;
}
main {
position: relative;
width: 100vw;
overflow: hidden;
}
sidebar, sidebar.second, roomcontent {
position: absolute !important;
height: 100%;
transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}
sidebar {
left: 0;
z-index: 1;
}
#roomsbar {
left: calc(var(--icon-button-height) + (var(--button-margin) * 2) + var(--border-width));
width: calc(100vw - (var(--icon-button-height) + (var(--button-margin) * 2) + var(--border-width))) !important;
min-width: unset !important;
max-width: none !important;
z-index: 1;
}
roomcontent {
left: 0;
width: 100vw !important;
transform: translateX(100vw);
border-right: none !important;
z-index: 2;
background-color: var(--main-bg-color);
}
#roomdetailsbar {
left: 0;
width: 100vw !important;
min-width: unset !important;
max-width: none !important;
transform: translateX(100vw);
z-index: 3;
background-color: var(--main-bg-color);
}
main.mobile-content sidebar,
main.mobile-content #roomsbar {
transform: translateX(-30vw);
}
main.mobile-content roomcontent {
transform: translateX(0);
}
main.mobile-details sidebar,
main.mobile-details #roomsbar {
transform: translateX(-60vw);
}
main.mobile-details roomcontent {
transform: translateX(-30vw);
}
main.mobile-details #roomdetailsbar {
transform: translateX(0);
}
}

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,11 +61,7 @@
"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,15 +21,22 @@
</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 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)"/> <path
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"> <button class="icon-button" onclick="gotoCreateSpace()">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="var(--text-color)" <svg 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-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>
@ -42,7 +49,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="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> <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>
</button> </button>
</sidebarelement> </sidebarelement>
<sidebarelement id="sidebar-profile"> <sidebarelement id="sidebar-profile">
@ -53,6 +60,7 @@
</button> </button>
</sidebarelement> </sidebarelement>
</sidebar> </sidebar>
<sidebar class="second" id="roomsbar"> <sidebar class="second" id="roomsbar">
<roomtopbar> <roomtopbar>
<blah>title.home</blah> <blah>title.home</blah>
@ -61,12 +69,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="var(--text-color)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> stroke="currentColor" 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="var(--text-color)" <svg 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-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>
@ -78,12 +86,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="var(--text-color)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> stroke="currentColor" 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="var(--text-color)" <svg 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-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>
@ -94,16 +102,19 @@
<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>
@ -111,7 +122,6 @@
async function start() { async function start() {
updateLoadingStatus("loading.loading"); updateLoadingStatus("loading.loading");
try { try {
switchRoomContent("title.splash", splashScreen, false, "", true);
if (host != null) if (host != null)
{ {
await updateProtocolAndUrl(host); await updateProtocolAndUrl(host);
@ -120,6 +130,7 @@
{ {
await updateProtocolAndUrl(window.location.hostname); await updateProtocolAndUrl(window.location.hostname);
} }
sidebarPfp.src = await getAvatarUrl(username); sidebarPfp.src = await getAvatarUrl(username);
showAction("Authenticating...", "startauth"); showAction("Authenticating...", "startauth");
@ -177,6 +188,7 @@
async function createGroup() { async function createGroup() {
} }
</script> </script>
<script src="main.js"></script> <script src="main.js"></script>
<script src="userscript.js"></script> <script src="userscript.js"></script>

View file

@ -66,7 +66,6 @@ try {
var sidebarInboxIndicator = sidebarInbox.children.item(0); var sidebarInboxIndicator = sidebarInbox.children.item(0);
var fixedContextMenu = document.getElementById("fixed-context-menu");
} catch (e) { } catch (e) {
} }
@ -654,48 +653,25 @@ 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");
let blahTags = doc.getElementsByTagName("blah"); //Invite to dm, addDmScreen, false
for (let i = 0; i < blahTags.length; i++) { async function switchRoomContent(title, content, showRoomBar)
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 = "", skipMobileSlide = false)
{ {
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);
let backBtnHtml = `<button class="mobile-nav-btn" onclick="mobileNavBack()"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg></button>`;
let detailsBtnHtml = showRoomBar ? `<button class="mobile-nav-btn right" onclick="mobileNavDetails()"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg></button>` : '';
roomTopBar.innerHTML = `${backBtnHtml}${icon}<space></space><inherit>${processBlah(title)}</inherit><div class="flex-spacer"></div>${detailsBtnHtml}`; roomTopBar.innerHTML = processBlah(title);
roomDetailsBar.style.display = showRoomBar ? "flex" : "none"; roomDetailsBar.style.display = showRoomBar ? "flex" : "none";
//content blah parsing
let parser = new DOMParser(); let parser = new DOMParser();
let doc = parser.parseFromString(content, "text/html"); let doc = parser.parseFromString(content, "text/html");
@ -715,25 +691,16 @@ async function switchRoomContent(title, content, showRoomBar, icon = "", skipMob
let value = placeholders[i].placeholder.split("{blah(")[1].split(")}")[0]; let value = placeholders[i].placeholder.split("{blah(")[1].split(")}")[0];
placeholders[i].placeholder = processBlah(value); placeholders[i].placeholder = processBlah(value);
} }
} }
roomContentMain.innerHTML = doc.body.innerHTML; roomContentMain.innerHTML = doc.body.innerHTML;
roomContentMain.style.transform = ""; roomContentMain.style.transform = "";
roomContentMain.style.opacity = ""; roomContentMain.style.opacity = "";
}
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
if (window.innerWidth <= 52 * rem && !skipMobileSlide) {
mainScreen.classList.remove('mobile-details');
mainScreen.classList.add('mobile-content');
}
}
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);
}); });
@ -741,107 +708,47 @@ 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);
} }
function gotoCreateSpace() { async 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");
}
function mobileNavBack() { /* replaced with css
if(mainScreen.classList.contains('mobile-details')) { sidebarHomeButton.addEventListener("mouseenter", () => {
mainScreen.classList.remove('mobile-details'); sidebarHomeIndicator.classList.add("hover");
mainScreen.classList.add('mobile-content');
} else {
mainScreen.classList.remove('mobile-content');
}
}
function mobileNavDetails() {
mainScreen.classList.add('mobile-details');
}
let touchStartX = 0;
let touchEndX = 0;
let touchStartY = 0;
let touchEndY = 0;
document.addEventListener('touchstart', e => {
touchStartX = e.changedTouches[0].screenX;
touchStartY = e.changedTouches[0].screenY;
}); });
document.addEventListener('touchend', e => { sidebarHomeButton.addEventListener("mouseleave", () => {
touchEndX = e.changedTouches[0].screenX; sidebarHomeIndicator.classList.remove("hover");
touchEndY = e.changedTouches[0].screenY;
handleMobileSwipe();
}); });
function handleMobileSwipe() {
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
if (window.innerWidth > 52 * rem) return;
let diffX = touchEndX - touchStartX; sidebarAddButton.addEventListener("mouseenter", () => {
let diffY = touchEndY - touchStartY; sidebarAddIndicator.classList.add("hover");
});
sidebarAddButton.addEventListener("mouseleave", () => {
sidebarAddIndicator.classList.remove("hover");
});
if (Math.abs(diffX) > Math.abs(diffY) && Math.abs(diffX) > 60) { sidebarProfileButton.addEventListener("mouseenter", () => {
if (diffX > 0) { sidebarProfileIndicator.classList.add("hover");
mobileNavBack(); });
} else { sidebarProfileButton.addEventListener("mouseleave", () => {
if (mainScreen.classList.contains('mobile-content') && roomDetailsBar.style.display !== 'none') { sidebarProfileIndicator.classList.remove("hover");
mobileNavDetails(); });
}
} sidebarInboxButton.addEventListener("mouseenter", () => {
} sidebarInboxIndicator.classList.add("hover");
} });
sidebarInboxButton.addEventListener("mouseleave", () => {
sidebarInboxIndicator.classList.remove("hover");
});
*/

View file

@ -1,11 +1,3 @@
//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>
@ -14,7 +6,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>
@ -45,7 +37,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="createspace-name"><blah>title.name</blah></label> <label for="addgroup-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">
@ -53,35 +45,3 @@ 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,7 +5,6 @@
: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);
@ -70,6 +69,7 @@ loading {
user-select: none !important; user-select: none !important;
-webkit-user-drag: none !important; -webkit-user-drag: none !important;
} }
button, input { button, input {
border-radius: 0.8rem; border-radius: 0.8rem;
background-color: rgba(255, 255, 255, 0.05); background-color: rgba(255, 255, 255, 0.05);
@ -180,6 +180,7 @@ sidebar.second {
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.collapse-text-button { .collapse-text-button {
padding-left: calc(var(--button-margin) + 0.2rem); padding-left: calc(var(--button-margin) + 0.2rem);
flex-shrink: 0; flex-shrink: 0;
@ -190,13 +191,16 @@ sidebar.second {
font-weight: 600; font-weight: 600;
gap: 0.3rem; gap: 0.3rem;
} }
.collapse-text-button .chevron { .collapse-text-button .chevron {
width: 1.25rem; width: 1.25rem;
height: 1.25rem; height: 1.25rem;
} }
.collapse-text-button.collapsed .chevron { .collapse-text-button.collapsed .chevron {
transform: rotate(-90deg); transform: rotate(-90deg);
} }
.add-action-button { .add-action-button {
border: none; border: none;
background-color: transparent; background-color: transparent;
@ -207,6 +211,7 @@ sidebar.second {
justify-content: center; justify-content: center;
color: rgba(255, 255, 255, 0.5); color: rgba(255, 255, 255, 0.5);
} }
.add-action-button svg { .add-action-button svg {
width: 1.25rem; width: 1.25rem;
height: 1.25rem; height: 1.25rem;
@ -219,6 +224,8 @@ hr {
width: 60%; width: 60%;
margin-left: 20%; margin-left: 20%;
} }
#notification-container { #notification-container {
padding-top: env(safe-area-inset-top); padding-top: env(safe-area-inset-top);
position: fixed; position: fixed;
@ -232,10 +239,12 @@ hr {
pointer-events: none; pointer-events: none;
align-items: center; align-items: center;
} }
.notification { .notification {
background: rgba(255, 255, 255, 0.015); background: rgba(255, 255, 255, 0.015);
backdrop-filter: blur(1.2rem); backdrop-filter: blur(1.2rem);
-webkit-backdrop-filter: blur(1.2rem); -webkit-backdrop-filter: blur(1.2rem);
border: var(--border-width) solid var(--light-border-color); border: var(--border-width) solid var(--light-border-color);
border-radius: 0.9rem; border-radius: 0.9rem;
@ -254,21 +263,27 @@ hr {
transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
background-color 0.2s ease; background-color 0.2s ease;
} }
.notification.show { .notification.show {
opacity: 1; opacity: 1;
transform: translateY(0); transform: translateY(0);
} }
.notification.info { .notification.info {
border-color: var(--big-default); border-color: var(--big-default);
} }
.notification.error { .notification.error {
border-color: var(--big-red); border-color: var(--big-red);
} }
.notification.success { .notification.success {
border-color: var(--big-green); border-color: var(--big-green);
} }
roomtopbar { roomtopbar {
height: calc(var(--button-height) * 1.5); height: calc(var(--button-height) * 1.5);
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -278,11 +293,11 @@ roomtopbar {
line-height: calc(var(--button-height) * 1.5); line-height: calc(var(--button-height) * 1.5);
font-weight: bold; font-weight: bold;
padding-left: calc(var(--button-margin) * 3); padding-left: calc(var(--button-margin) * 3);
padding-right: calc(var(--button-margin) * 3);
font-size: 1.5rem; font-size: 1.5rem;
} }
sidebar.second#roomdetailsbar { sidebar.second#roomdetailsbar {
height: calc(var(--button-height) * 1.5); height: calc(var(--button-height) * 1.5);
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -296,24 +311,32 @@ herotitle {
font-weight: bold; font-weight: bold;
font-size: 1.6rem; font-size: 1.6rem;
} }
.input-group { .input-group {
text-align: left; text-align: left;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 0.2rem; gap: 0.2rem;
width: 90%; width: 90%;
max-width: 30rem; max-width: 30rem;
} }
.input-group label { .input-group label {
font-size: 0.75rem; font-size: 0.75rem;
font-weight: 800; font-weight: 800;
margin-left: 0.6rem; margin-left: 0.6rem;
margin-bottom: -0.2rem; margin-bottom: -0.2rem;
opacity: 0.4; opacity: 0.4;
letter-spacing: 0.05rem; letter-spacing: 0.05rem;
position: relative; position: relative;
z-index: 1; z-index: 1;
} }
.submit-button { .submit-button {
justify-content: center; justify-content: center;
background-color: var(--text-color); background-color: var(--text-color);
@ -322,9 +345,11 @@ herotitle {
border: none; border: none;
font-size: 1.05rem; font-size: 1.05rem;
} }
.bottom-element { .bottom-element {
margin-top: auto; margin-top: auto;
} }
@media (hover: hover) { @media (hover: hover) {
sidebarelement:hover indicator:not(.active) { sidebarelement:hover indicator:not(.active) {
content: ""; content: "";
@ -367,149 +392,11 @@ sidebarelement:has(.icon-button:active) indicator:not(.active) {
border-radius: 0.8rem; border-radius: 0.8rem;
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, inherit, .inherit {
blah {
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);
}
.mobile-nav-btn {
display: none;
background: transparent;
border: none;
height: 2.4rem;
width: 2.4rem;
padding: 0;
margin: 0;
margin-right: 0.8rem;
align-items: center;
justify-content: center;
flex-shrink: 0;
color: var(--text-color);
cursor: pointer;
}
.mobile-nav-btn:active {
background-color: rgba(255, 255, 255, 0.1);
border-radius: 0.8rem;
}
.mobile-nav-btn.right {
margin-right: 0;
margin-left: 0.8rem;
}
.mobile-nav-btn svg {
width: 1.5rem;
height: 1.5rem;
}
.flex-spacer {
flex-grow: 1;
}
@media (max-width: 52rem) {
.mobile-nav-btn {
display: flex;
}
main {
position: relative;
width: 100vw;
overflow: hidden;
}
sidebar, sidebar.second, roomcontent {
position: absolute !important;
height: 100%;
transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}
sidebar {
left: 0;
z-index: 1;
}
#roomsbar {
left: calc(var(--icon-button-height) + (var(--button-margin) * 2) + var(--border-width));
width: calc(100vw - (var(--icon-button-height) + (var(--button-margin) * 2) + var(--border-width))) !important;
min-width: unset !important;
max-width: none !important;
z-index: 1;
}
roomcontent {
left: 0;
width: 100vw !important;
transform: translateX(100vw);
border-right: none !important;
z-index: 2;
background-color: var(--main-bg-color);
}
#roomdetailsbar {
left: 0;
width: 100vw !important;
min-width: unset !important;
max-width: none !important;
transform: translateX(100vw);
z-index: 3;
background-color: var(--main-bg-color);
}
main.mobile-content sidebar,
main.mobile-content #roomsbar {
transform: translateX(-30vw);
}
main.mobile-content roomcontent {
transform: translateX(0);
}
main.mobile-details sidebar,
main.mobile-details #roomsbar {
transform: translateX(-60vw);
}
main.mobile-details roomcontent {
transform: translateX(-30vw);
}
main.mobile-details #roomdetailsbar {
transform: translateX(0);
}
}