Preliminary adition to transing the internet webring, and tweaks and optimization to previous code regarding javascript to php rewrite, more concise and legible code functions.
All checks were successful
Website Sync / website-sync (push) Successful in 5s
All checks were successful
Website Sync / website-sync (push) Successful in 5s
This commit is contained in:
73
includes/transfemwebring.js
Normal file
73
includes/transfemwebring.js
Normal file
@@ -0,0 +1,73 @@
|
||||
// based again off https://transring.neocities.org/ring.js :)
|
||||
// which is based off https://juneish.neocities.org/resources/webstring/
|
||||
|
||||
{
|
||||
const VALID_WIDGET_TYPES = ["transgender", "nonbinary"]
|
||||
|
||||
let transfemring = {
|
||||
// sitelist (oldest to newest)
|
||||
// strip the protocol off
|
||||
sites: [{"id":1,"description":"You're here!","site_link":"fem.nz","author":"me","in_the_ring":true,"notes":"","created_at":"2025-10-07T08:10:09.659Z","updated_at":"2025-10-07T08:10:09.659Z"},{"id":2,"description":"transfem webdev :p","site_link":"skyler.lol","author":"Skyler!","in_the_ring":false,"notes":"","created_at":"2025-10-07T08:10:35.275Z","updated_at":"2025-10-07T08:10:35.275Z"},{"id":3,"description":"just a personal site for music, musings, and blog posts! ran by a transfem enby :)","site_link":"transferns.neocities.org","author":"Andie/Fern","in_the_ring":true,"notes":"","created_at":"2025-10-07T08:10:57.429Z","updated_at":"2025-12-11T02:14:39.833Z"},{"id":4,"description":"the most evil and repulsive website on planet earth","site_link":"cresentri.com","author":"cresentri","in_the_ring":true,"notes":"","created_at":"2025-10-07T08:11:30.742Z","updated_at":"2025-10-07T08:11:30.883Z"},{"id":5,"description":"i'm messing around with trying to learn how to use html for somewhat interesting things i guess","site_link":"iseel.neocities.org","author":"IseeL","in_the_ring":true,"notes":"","created_at":"2025-10-07T08:12:18.126Z","updated_at":"2025-10-07T08:29:03.148Z"},{"id":6,"description":"Just a place for me to share info about my projects and talk about things i enjoy \u003c3","site_link":"vivslakes.moe","author":"Viv","in_the_ring":true,"notes":"","created_at":"2025-10-07T08:13:05.476Z","updated_at":"2025-10-07T08:13:05.567Z"},{"id":7,"description":"all kinds of things!","site_link":"fionaruthbo.neocities.org","author":"Fiona Ruthbo","in_the_ring":true,"notes":"","created_at":"2025-10-07T08:14:16.412Z","updated_at":"2025-10-07T08:14:16.428Z"},{"id":8,"description":"Poetry, halftones, and Twitchy.","site_link":"klara.nz","author":"me!","in_the_ring":true,"notes":"","created_at":"2025-10-07T08:39:07.132Z","updated_at":"2025-10-07T08:57:26.399Z"},{"id":9,"description":"a little birdie on the internet :)","site_link":"kestrel.pet","author":"Kestrel","in_the_ring":true,"notes":"","created_at":"2025-11-15T06:57:16.625Z","updated_at":"2025-11-15T06:57:26.268Z"},{"id":10,"description":"autistic artist musician webdev dragon(girl?)thing; very gay; rawr","site_link":"ytd.wtf","author":"Yuri the Dragon","in_the_ring":true,"notes":"","created_at":"2025-12-30T09:57:00.232Z","updated_at":"2025-12-30T11:19:58.022Z"},{"id":11,"description":"This website runs on my living room heater","site_link":"izzy.kiwi","author":"Just Izzy","in_the_ring":false,"notes":"","created_at":"2025-12-30T11:19:12.953Z","updated_at":"2026-01-01T02:54:57.059Z"},{"id":12,"description":"a dump for all of my projects and adhd thoughts","site_link":"ikelene.dev","author":"Ikelene","in_the_ring":true,"notes":"","created_at":"2026-01-23T01:52:44.443Z","updated_at":"2026-01-23T01:52:44.463Z"},{"id":13,"description":"contains my mind space, which includes gaming, references, easter eggs, art, programming, etc!","site_link":"theabsoluterealm.com","author":"ezra","in_the_ring":true,"notes":"","created_at":"2026-01-23T01:54:27.672Z","updated_at":"2026-01-23T01:56:27.520Z"},{"id":14,"description":"Just a trans girl that likes radios, computers, creative freedom, art, etc not much more to it!","site_link":"cafepots.neocities.org","author":"Cafe_Pots","in_the_ring":true,"notes":"","created_at":"2026-01-30T08:36:39.133Z","updated_at":"2026-01-30T08:36:51.946Z"},{"id":15,"description":"Extension of my cute, sparkley, sprinkle filled transfem brain! ദ്ദി◝ ⩊ ◜)","site_link":"winzpir.neocities.org","author":"Winzpir/Angel","in_the_ring":true,"notes":"","created_at":"2026-02-20T01:31:47.843Z","updated_at":"2026-02-20T01:31:47.843Z"}],
|
||||
root: "https://fem.nz"
|
||||
}
|
||||
console.log(transfemring)
|
||||
transfemring.index = location.href.startsWith("file://") ? 0 : transfemring.sites.findIndex((entry) => location.href.includes("://" + entry.site_link));
|
||||
let widget = document.currentScript.dataset.widget ?? "transgender";
|
||||
|
||||
function urlWithWidget(path) {
|
||||
return `${transfemring.root}/ring/${widget}/${path}`
|
||||
}
|
||||
|
||||
if (!VALID_WIDGET_TYPES.includes(widget)) {
|
||||
console.log("To web admin: transfem webring widget should have data-widget set to one of the following if configured (attribute will default to 'transgender'):", VALID_WIDGET_TYPES)
|
||||
console.log(`data-widget currently set to: ${widget}`)
|
||||
widget = "transgender"
|
||||
}
|
||||
|
||||
if (transfemring.index === -1) {
|
||||
document.currentScript.outerHTML = `
|
||||
<div>
|
||||
<div class="transfem-ring" style="display: flex; justify-content: center; align-items: center; gap: 3.278%; max-width: 244px; image-rendering: pixelated">
|
||||
<a href="${transfemring.root}" target="_top"><img width="168" height="61" src="${urlWithWidget("banner.png")}"></a>
|
||||
</div>
|
||||
(not yet, but maybe soon!)
|
||||
</div>
|
||||
`;
|
||||
} else {
|
||||
function nextActive() {
|
||||
let currentIndex = transfemring.index + 1
|
||||
while (!location.href.includes(transfemring.sites[currentIndex % transfemring.sites.length].site_link)) {
|
||||
if (transfemring.sites[currentIndex % transfemring.sites.length].in_the_ring) {
|
||||
return transfemring.sites[currentIndex % transfemring.sites.length]
|
||||
}
|
||||
currentIndex++
|
||||
}
|
||||
return transfemring.sites[currentIndex % transfemring.sites.length]
|
||||
}
|
||||
function previousActive() {
|
||||
let currentIndex = transfemring.index - 1
|
||||
while (!location.href.includes(transfemring.sites.at(currentIndex).site_link)) {
|
||||
if (transfemring.sites.at(currentIndex).in_the_ring) {
|
||||
return transfemring.sites.at(currentIndex)
|
||||
}
|
||||
currentIndex--
|
||||
}
|
||||
return transfemring.sites[currentIndex % transfemring.sites.length]
|
||||
}
|
||||
let next = "https://" + nextActive().site_link
|
||||
let prev = "https://" + previousActive().site_link;
|
||||
document.currentScript.outerHTML = `
|
||||
<div class="transfem-ring" style="display: flex; justify-content: center; align-items: center; gap: 3.278%; max-width: 244px; image-rendering: pixelated">
|
||||
<a href="${prev}" target="_top" style="width: 12.295%">
|
||||
<img width="30" height="32" src="${urlWithWidget("arrow.png")}" alt="previous site">
|
||||
</a>
|
||||
<a href="${transfemring.root}" target="_top" style="width: 68.852%">
|
||||
<img width="168" height="61" src="${urlWithWidget("banner.png")}" alt="transfem webring">
|
||||
</a>
|
||||
<a href="${next}" target="_top" style="width: 12.295%">
|
||||
<img width="30" height="32" src="${urlWithWidget("arrow.png")}" alt="next site" style="transform: scaleX(-1);">
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user