Artifacts Gallery Guilds Search Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining?
Autumn, 22 Sep 2026 - @947.06
Forum Activity: Three Stars Random | Recent Posts | Guild Recents
News: :ha: :pc: Hello Melonland! :pc: :happy: Guild Events: weekly zine jam 13: hope

+  MelonLand Forum
|-+  Communities & Online Life
| |-+  ☮︎ ∙ Jams, Communities & Webrings
| | |-+  A fix for random site for onionrings!


« previous next »
Pages: [1] Print Embed
Author Topic: A fix for random site for onionrings!  (Read 1388 times)
jack_dawlia
Jr. Member ⚓︎
**
View Profile WWWArt


catgirl irl
⛺︎ My Room

Guild Memberships:
Artifacts:
GLaDOS' Test Chamber VeteranJoined 2024!
« on: Winter, 10 Feb 2026 @898 » Embed

I recently realised an issue with my webrings (made using garlic.garden's amazing onionring :]), when i clicked the random button on the sites with my webring it would sometimes work and sometimes link to completely random places ',:'

After some digging i found the issue and a simple solution :)!

The issue lies in the widget code in the randomText variable: onclick='randomSite()'

I believe when a site has many onionrings or other scripts with a function named randomSite(), it will do likely that randomSite() rather than your webrings, so it will link to other sites that arent part of it! (thats why it works fine on the index page, there no other randoms :P)

So how do you fix it?

Simply naming your randomSite() to something unique to your webring should do the trick! e.g. i have randomApertureSite() for my aperture webring ^_^

Original code:
Code
...
function randomSite() {
  otherSites = sites.slice(); //create a copy of the sites list
  otherSites.splice(thisIndex, 1); //remove the current site so we don't just land on it again
  randomIndex = Math.floor(Math.random() * otherSites.length);
  location.href = otherSites[randomIndex];
}

...
  if (useRandom) {
    randomText = `<a href='javascript:void(0)' onclick='randomSite()'>random</a> | `;
  }
...

Fixed code:
Code
...
function randomYourWebringSite() {
  otherSites = sites.slice(); //create a copy of the sites list
  otherSites.splice(thisIndex, 1); //remove the current site so we don't just land on it again
  randomIndex = Math.floor(Math.random() * otherSites.length);
  location.href = otherSites[randomIndex];
}

...
  if (useRandom) {
    randomText = `<a href='javascript:void(0)' onclick='randomYourWebringSite()'>random</a> | `;
  }
...

Hope this can help someone else out :D!

Logged

- the silly (xe/xir)
PurpleHello98
Sr. Member ⚓︎
****
View Profile WWW


'Cause I'm your girl, hold me baby <3
⛺︎ My Room
StatusCafe: purplehello98

Artifacts:
First 1000 Members!Joined 2022!
« Reply #1 on: Summer, 01 Jul 2026 @670 » Embed

THANK YOU SO MUCH!!!! I had been wondering about this for ages for my K-pop webring and now it looks to be working perfectly. :) <3

Logged

"...And we are not angels, to be comforted by seeing the means for which everything is sent."
-Elizabeth Gaskell, Wives and Daughters


https://purplehello98.neocities.org/graphics/userbars/46535.png
https://purplehello98.neocities.org/graphics/buttons/purplehello98.gifhttps://purplehello98.neocities.org/graphics/buttons/neocities-pink.gifhttps://purplehello98.neocities.org/graphics/buttons/vrvr-purple.gif
Cele
Hero Member ⚓︎
*****
View Profile WWW


⛺︎ My Room

Artifacts:
Great Posts PacmanFirst 1000 Members!Joined 2022!
« Reply #2 on: Summer, 17 Jul 2026 @455 » Toggle Font Embed

Just dropping in to say thank you, I've utilized your fix

Logged

https://64.media.tumblr.com/f339750d47b841f86b411f210c89bc48/a3f9ac693d24060d-e8/s400x600/2fce684b29380077b902465628201ec7b63f98ff.png
http://www.tiptopglobe.com/userbar/7fa851235decd83fb1f04728a2473956.png
http://www.tiptopglobe.com/userbar/f082aecc2519321c0a13c39f701907bf.png
https://img.pokemondb.net/sprites/black-white/anim/normal/gothorita.gif
Pages: [1] Print Embed 
« previous next »
 

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | Send Feedback | Supporters ♥ Forum Guide | Rules | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi
@000 Melon
Land
Index Recent Edits Tenement Arcade Forum Art Hub Chat Webring Want to Login or Join ?
Link Land Web Craft Guide Graphic Catalogue Wiki Newsletters Image Stream Help Im Lost! Zap! Minecraft: Online
Passport Sites Asatte Add your site?
Melonking MelonLand Aero Archive Onio Cafe 32 Bit Cafe Status Cafe