1, 4: Fixing 404 after logged out, adding market entry

This commit is contained in:
metacryst
2025-11-10 04:05:21 -06:00
parent 6f9ed49b2e
commit 41c0bb57a3
16 changed files with 494 additions and 136 deletions

View File

@@ -1,6 +1,7 @@
/*
Sam Russell
Captured Sun
11.9.25 - changed p(innerText) to p(innerHTML), adjusted onNavigate to work for multiple elements and with correct "this" scope
11.7.25 - changed registerShadow() to register(), changed onClick() to be like onHover()
11.6.25 - adding default value for "button()" "children" parameter
10.29.25 - adding "gap()" and "label()" functions
@@ -562,12 +563,12 @@ HTMLImageElement.prototype.backgroundColor = function(value) {
return this; // Always returns the element itself
};
window.p = function p(innerText) {
window.p = function p(innerHTML) {
let el = document.createElement("p")
if(typeof innerText === "function") {
el.render = innerText
el.render = innerHTML
} else {
el.innerText = innerText
el.innerHTML = innerHTML
}
el.style.margin = "0";
quill.render(el)
@@ -765,13 +766,15 @@ HTMLElement.prototype.onKeyDown = function(cb) {
return this;
};
/* QUIRK 1:
In all the other callback functions, the user can choose the scope of "this". It can be either the parent shadow or the element itself.
This listener only allows for the latter functionality. This is because the navigate event fires on the window.
Without binding, "this" would refer only to the window. So here we are compromising on one of the two.
/* WHY THIS LISTENER IS THE WAY IT IS:
- If we dispatch the "navigate" event on the window (as one would expect for a "navigate" event), a listener placed on the element will not pick it up.
- However, if we add the event as a window event, it won't have the "this" scope that a callback normally would.
- Then, if we try to add that scope using bind(), it makes the function.toString() unreadable, which means we will get false positives for duplicate listeners.
- Therefore, we just have to attach the navigate event to the element, and manually trigger that when the window listener fires.
*/
HTMLElement.prototype.onNavigate = function(cb) {
window._storeListener(window, "navigate", cb.bind(this));
this._storeListener("navigate", cb);
window.addEventListener("navigate", () => this.dispatchEvent(new CustomEvent("navigate")))
return this;
};