Board Thread:General Wiki Discussion/@comment-25230922-20150704031010/@comment-25941663-20150704145928

Underscorre wrote: Strange, it goes to a random page for me. Hmm. Have you purged your cache? No no, it does go to a random page as intended. But because the link reads "Writer's Showcase" one might think that it goes to the Showcase (and not in a random page).

The slowness is because, when one of the links is pressed, it is downloading another page, so basically, it doubles the page load time for the redirect pages. My knowledge of web development is a bit rusty, so care to explain this a bit to me? From what I understand, clicking on the link "sends" the user to a special page that in turn redirects the user to a random link.

So, in that special page, the code finds via a method a random page, right? Can't this be done without the middle step (going to the special page)?

If we were to do that calculation in the main page it would speed things up significantly. Then, instead of linking to the special page, we could link directly to the random page.

The code is horrible and inefficient, since I never do Javascript and I made this in about half an hour (I'm almost embarrassed to post it), but it's stored at MediaWiki:Wikia.js at the wiki in question.

With regards to PHP code, there's no way to add it to a wiki without staff assistance, but I believe staff are happy to install extensions (which I assume would include custom extensions by the wiki's community) if the community can show a need for it. Hehe, that syntax reminded me why I hate web programming so much...

Anyway, thanks for the code. I have one thing I need clarified though:

window.location.replace("/wiki/Thread:" + thread);

I believe that this is the line that redirects to the random thread, right?