diff options
author | cel 馃尭 <cel@blos.sm> | 2024-01-26 13:56:41 +0000 |
---|---|---|
committer | cel 馃尭 <cel@blos.sm> | 2024-01-26 13:56:41 +0000 |
commit | 709d07c9b4452105ae61b8d878c32cdaa988f21b (patch) | |
tree | 2fca454d9fce2d95a698c111d22eed795f6ad9b2 | |
download | bunnyring-709d07c9b4452105ae61b8d878c32cdaa988f21b.tar.gz bunnyring-709d07c9b4452105ae61b8d878c32cdaa988f21b.tar.bz2 bunnyring-709d07c9b4452105ae61b8d878c32cdaa988f21b.zip |
initial commit
-rw-r--r-- | README.md | 26 | ||||
-rw-r--r-- | bunnyring.js | 107 |
2 files changed, 133 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..95c72f1 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# the bunny web! + +come join the bunny web!!! the webring for all bunny enjoyers 馃悋 + +## rules and guidelines + +- personal websites only (nothing commercial) +- no blog hosters, social media profiles or something (neocities is fine) +- no hate speech or majorly disturbing content on the site + +## how to join: + +1. add this to where you would like the bunnyring widget to be on your site: + +```html +<div id="bunnyring"></div> +<script type="text/javascript" src="https://bunny.garden/bunnyring/plain/bunnyring.js" /> +``` + +2. send an email to bunnyring@bunny.garden with your site's url, the maintainers will add you to the webring if all looks good. + +## maintainers + +cel [blos.sm](https://blos.sm) +lian [libre.town](https://libre.town) + diff --git a/bunnyring.js b/bunnyring.js new file mode 100644 index 0000000..f08547d --- /dev/null +++ b/bunnyring.js @@ -0,0 +1,107 @@ +/* + L I BBB RRRR EEEE RRRR I N N GGGG + L I B B R R E R R I NN N G + L I BBBB RRRR EEE RRRR I N N N G GG + L I B B R R E R R I N NN G G + LLLLL I BBBB R R EEEE R R I N N GGGG + + LIBRERING is a simple javascript webring script. + It should be compatible with HTML and XHTML and supports rudimentary configuration options. + + Copyright 2023: Lian B. of Libre.Town + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +// 路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路 +// : ADMINISTRATOR SECTION :: This section contains configuration options : +// 路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路 + +// List of all members in the webring. Add onto this manually whenever you want to add someone new to the ring. +var bunnyring_members = [ + 'https://blos.sm', + 'https://libre.town', +] +// Various config options that should be self-documenting. +// Again, if you're hosting this Librering, please change all the instances of bunnyring to your particular webring name in lower case, and insert valid image URLs for the badges and navigation. +var bunnyring_ringurl = "https://bunny.garden/bunnyring"; // The URL of the webring itself, for contact and information purposes. +// var bunnyring_badgeurl = "https://bunny.garden/bunnyring/badge.png"; // The URL of the main badge of the webring; 88x31 recommended, but any size goes. +// var bunnyring_prevurl = "https://thewebringitself.site/prev.png"; // The URL of the PREVIOUS badge of the webring; in the original design, a quarter of the main badge. +// var bunnyring_nexturl = "https://thewebringitself.site/next.png"; // The URL of the NEXT badge of the webring; in the original design, a quarter of the main badge. +// var bunnyring_randomurl = "https://thewebringitself.site/random.png"; // The URL of the RANDOM badge of the webring; in the original design, a quarter of the main badge. +// var bunnyring_abouturl = "https://thewebringitself.site/about.png"; // The URL of the ABOUT LIBRERING badge of the webring; in the original design, a quarter of the main badge. + +// 路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路 +// : DISPLAY SECTION :: This defines whatever happens on a member's individual site: most notably, inserting a little display. : +// 路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路路 + +// Before you can use this, please replace all instances of bunnyring with your webring name in lower case. +// This will allow you to have multiple webrings on the same site without them conflicting with each other. +// Please also carefully read through these options to see what you can (and have to) change; the design, the layout and the links. +// For more information and a step-by-step tutorial, see: https://libre.town/creative/development/librering.xhtml + +// ... Let's begin. + +// For displaying messages of all kinds, as well as the working webring display, we want to keep our little HTML element in mind. +// Remember to insert your webring's name here, just like everywhere, if you host this webring. +var displayElement = document.getElementById("bunnyring"); + +// First of all, we want to check whether we are even a member of this particular webring, and if so, at which position. +var currentLocation = window.location.href; +var siteIndex = bunnyring_members.indexOf(currentLocation); + +// If our current location is NOT in the webring, display an error message. The rest of the code only runs if the site has been found in the webring. +if (siteIndex == -1) { + displayElement.innerHTML = + "<p>I am sorry, but the bunnyring display has failed to find you in the member list.<br />Please contact the webring administrator for support if you are the webmaster of this site and believe this to be in error.</p>"; +} + +// If our current location IS in the webring, this is where it continues. +// else { +// // This is a readable (but technologically not very sound) way to loop around when you are either the first or last member of the webring. +// var beforeID; +// var afterID; +// if (siteIndex == 0) { beforeID = bunnyring_members.length - 1; } +// else { beforeID = siteIndex - 1; } +// if (siteIndex == bunnyring_members.length - 1) { afterID = 0; } +// else { afterID = siteIndex + 1; } + +// // This chooses a random website from a copy of the member list. +// var randomID; +// randomID = Math.floor(Math.random() * bunnyring_members.length); + +// // Now it is time to get to the meaty stuff. This will replace our little display container with the actual display content: a general badge, next/previous buttons, and a webring info and random link. +// // Remove, swap around or change these components as you see fit. +// displayElement.innerHTML = +// "<a href='" + bunnyring_ringurl + "'><img alt='Badge: bunnyring webring' src='" + bunnyring_badgeurl + "' /></a><br />" + +// "<a href='" + bunnyring_members[beforeID] + "'><img alt='Previous' src='" + bunnyring_prevurl + "' /></a>" + +// "<a href='" + bunnyring_members[randomID] + "'><img alt='Random' src='" + bunnyring_randomurl + "' /></a>" + +// "<a href='https://libre.town/creative/development/librering.xhtml'><img alt='About LibreRing' src='" + bunnyring_abouturl + "' /></a>" + +// "<a href='" + bunnyring_members[afterID] + "'><img alt='Next' src='" + bunnyring_nexturl + "' /></a>"; +// } + +// If you want to choose a text-based display instead without any images, remove or comment up the entire else block above and instead uncomment this one. +else { + // This is a readable (but technologically not very sound) way to loop around when you are either the first or last member of the webring. + var beforeID; + var afterID; + if (siteIndex == 0) { beforeID = bunnyring_members.length - 1; } + else { beforeID = siteIndex - 1; } + if (siteIndex == bunnyring_members.length - 1) { afterID = 0; } + else { afterID = siteIndex + 1; } + + // This chooses a random website from a copy of the member list. + var randomID; + randomID = Math.floor(Math.random() * bunnyring_members.length); + + // Now it is time to get to the meaty stuff. This will replace our little display container with the actual display content: a general badge, next/previous buttons, and a webring info and random link. + // Remove, swap around or change these components as you see fit. + displayElement.innerHTML = + "<p><a href='" + bunnyring_ringurl + "'>this site is part of the bunny web!!</a></br>" + + "<a href='" + bunnyring_members[beforeID] + "'>previous |</a>" + + " <a href='" + bunnyring_members[randomID] + "'>random |</a>" + + " <a href='https://libre.town/creative/development/librering.xhtml'>about LibreRing |</a>" + + " <a href='" + bunnyring_members[afterID] + "'>next</a></p>"; +} |