write about refresh

This commit is contained in:
sophie 2024-04-26 06:03:58 +01:00
parent 747947e144
commit d97c29ad15
5 changed files with 118 additions and 101 deletions

View File

@ -11,9 +11,6 @@ category info
about this website and how it is constructed
press ESC to enable lazy browsing (desktop only)
=> /wiki/lazymode.ln 💺 lazy browsing mode
=> https://zvava.org 🕸️ view html version
=> https://git.zvava.org/zvava/zvava.org 📦 source code
@ -24,9 +21,11 @@ press ESC to enable lazy browsing (desktop only)
=> /wiki/ass.ln 🍑 actually simple syndication
## history
=> /wiki/website-refresh2024.ln refresh - 2024
=> /wiki/archiving-2024.ln archiving - 2024
=> /wiki/website-refresh2023.ln refresh - 2023
=> /wiki/archiving-2022.ln archiving
=> /wiki/lazymode.ln lazy browsing mode
=> /wiki/website-rewrite2022.ln rewrite - 2022
=> /wiki/introducing-notes.ln begin wiki - 2021
=> /wiki/website-rewrite2020.ln rewrite

View File

@ -1,4 +1,4 @@
# website refresh
# website refresh (2023)
=> /images/t/redesign.png thumbnail
```
created 2023/06/01

View File

@ -0,0 +1,20 @@
# website refresh
=> /images/t/redesign.png thumbnail
```
created 2024/04/26
category text
```
updated the look of the site, for http(s) browsers anyway
## sidebar
if you look closely, there is a new sidebar! on widescreen desktop at least. it drew heavy inspiration from zenith's website
=> https://zencorner.xyz/ zencorner.xyz
## retiring lazymode
as i have never really used it and the code for windows was growing, i have decided to retire "lazy browsing mode" in favor of a far more complicated and useless feature. this is also because i could not be assed to repair it after it became kinda wonky with the sidebar in place, the webrings and large collection of buttons at the end of the page tripped it up (albeit manageably) too
## windows
so i've been spending a lot of time on [misskey fork] and misskey has this neat feature where you can open things in a window, not a popup or new tab, in a little iframe residing on the very page you're already looking at. i grew fond of it after using it to prevent losing my scroll position on the timeline, and have decide it to implement it on my webby site. i just thought it would look kinda cool and be kinda fun, i already
the backend code is really getting out of hand now though... definitely time for a rewrite, though there is so much content i still have to write, and so much other stuff to do. wawawawawawawa

View File

@ -1,7 +1,5 @@
if (!!navigator.brave) {
document.cookie = "Brave-User=true; Max-Age=1707109200; Secure"
location.reload()
}
if (!!navigator.brave) { // hooks into the Caddyfile to block brave browser users
document.cookie = "Brave-User=true; Max-Age=1707109200; Secure"; location.reload() }
let z_sidebar
let z_windows = []
@ -16,7 +14,7 @@ function openWindow(url = "/", title) {
// create window
let z = document.createElement("div")
z.classList.add("window")
let zW = 800 * (window.innerWidth / 1920)
let zW = window.innerWidth > window.innerHeight ? (800 * (window.innerWidth / 1920)) : Math.min(window.innerWidth - 16, 300)
let zH = 600 * (window.innerHeight / 1080)
z.style.width = zW + "px"
z.style.height = zH + "px"
@ -66,6 +64,98 @@ function openWindow(url = "/", title) {
}
}
function closeWindow(z) {
z && z.classList && z.classList.remove("open")
setTimeout(() => {
z && z.remove && z.remove()
let i = z_windows.findIndex((v) => v == z)
if (i > -1) z_windows.splice(i, 1)
}, 150)
}
function closeContextMenu() {
let menus = document.getElementsByClassName("context-menu")
for (i in menus) {
let z = menus[i]
z && z.classList && z.classList.remove("open")
setTimeout(() => {
z && z.remove && z.remove()
z == z_contextMenu && (z_contextMenu = null)
}, 150)
}
}
window.addEventListener("click", (e) => {
if (z_contextMenu) {
if (e.target != z_contextMenu && e.target.parent != z_contextMenu) {
e.preventDefault()
closeContextMenu();
}
}
})
window.addEventListener("contextmenu", (e) => {
if (e.target.nodeName == "A" || e.target.parentNode.nodeName == "A") {
e.preventDefault()
if (z_contextMenu) closeContextMenu()
let link = e.target.parentNode.nodeName == "A" ? e.target.parentNode : e.target
let isSidebar = e.target.classList.contains("sidebar__link")
// create context menu
let z = z_contextMenu = document.createElement("div")
z.classList.add("context-menu")
z.style.left = e.layerX + "px"
z.style.top = (isSidebar ? e.clientY : e.layerY) + "px"
if (isSidebar) z.style.position = "fixed"
document.body.appendChild(z)
setTimeout(() => z.classList.add("open"), 5)
{ // create context menu name
let c = document.createElement("div")
c.classList.add("context-menu__text")
c.innerText = link.innerText
z.appendChild(c)
}
{ // create open in window action
let c = document.createElement("div")
c.classList.add("context-menu__link")
c.innerText = "open in window"
c.addEventListener("click", () => {
openWindow(link.getAttribute("href"), link.innerText)
closeContextMenu()
})
z.appendChild(c)
}
{ // create open in window action
let c = document.createElement("div")
c.classList.add("context-menu__link")
c.innerText = "open in new tab"
c.addEventListener("click", () => {
window.open(link.getAttribute("href"), "_blank").focus();
closeContextMenu()
})
z.appendChild(c)
}
{ // create copy action
let c = document.createElement("div")
c.classList.add("context-menu__link")
c.innerText = "copy link"
c.addEventListener("click", () => {
navigator.clipboard.writeText(link.getAttribute("href"))
closeContextMenu()
})
z.appendChild(c)
}
if (e.clientX > document.body.clientWidth * .9)
z.style.left = (e.layerX - z.clientWidth) + "px"
}
})
function attachDragHandler(handle, wrapper) {
handle.onmousedown = e => e.button == 0 ? windowDragEvent(e, wrapper) : undefined;
@ -108,95 +198,3 @@ function attachDragHandler(handle, wrapper) {
}
}
}
function closeContextMenu() {
let menus = document.getElementsByClassName("context-menu")
for (i in menus) {
let z = menus[i]
z && z.classList && z.classList.remove("open")
setTimeout(() => {
z && z.remove && z.remove()
z == z_contextMenu && (z_contextMenu = null)
}, 150)
}
}
function closeWindow(z) {
z && z.classList && z.classList.remove("open")
setTimeout(() => {
z && z.remove && z.remove()
let i = z_windows.findIndex((v) => v == z)
if (i > -1) z_windows.splice(i, 1)
}, 150)
}
window.addEventListener("click", (e) => {
if (z_contextMenu) {
if (e.target != z_contextMenu && e.target.parent != z_contextMenu) {
e.preventDefault()
closeContextMenu();
}
}
})
window.addEventListener("contextmenu", (e) => {
if (e.target.nodeName == "A" || e.target.parentNode.nodeName == "A") {
e.preventDefault()
if (z_contextMenu) closeContextMenu()
let link = e.target.parentNode.nodeName == "A" ? e.target.parentNode : e.target
let isSidebar = e.target.classList.contains("sidebar__link")
// create context menu
let z = z_contextMenu = document.createElement("div")
z.classList.add("context-menu")
z.style.left = e.layerX + "px"
z.style.top = (isSidebar ? e.clientY : e.layerY) + "px"
if (isSidebar) z.style.position = "fixed"
document.body.appendChild(z)
setTimeout(() => z.classList.add("open"), 5)
{ // create context menu name
let c = document.createElement("div")
c.classList.add("context-menu__text")
c.innerText = link.innerText
z.appendChild(c)
}
{ // create open in window action
let c = document.createElement("div")
c.classList.add("context-menu__link")
c.innerText = "Open in New Window"
c.addEventListener("click", () => {
openWindow(link.getAttribute("href"), link.innerText)
closeContextMenu()
})
z.appendChild(c)
}
{ // create open in window action
let c = document.createElement("div")
c.classList.add("context-menu__link")
c.innerText = "Open in New Tab"
c.addEventListener("click", () => {
window.open(link.getAttribute("href"), "_blank").focus();
closeContextMenu()
})
z.appendChild(c)
}
{ // create copy action
let c = document.createElement("div")
c.classList.add("context-menu__link")
c.innerText = "Copy Link"
c.addEventListener("click", () => {
navigator.clipboard.writeText(link.getAttribute("href"))
closeContextMenu()
})
z.appendChild(c)
}
if (e.clientX > document.body.clientWidth * .9)
z.style.left = (e.layerX - z.clientWidth) + "px"
}
})