Community Central

Admin Forum:Help needed for a small script

18,810pages on
this wiki
Add New Page
Add New Page Talk0

This Forum has been archived

Forums: Admin Central Index Admin Watercooler Help needed for a small script
Central's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
Note: This topic has been unedited for 1325 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.

Hi everyone.

I am making my first script for a wiki, and I want some help. I've made this script


as seen here, which is pretty much the SkinSwitchButton just for a different function.

I am asking you: Shouldn't my script work? What am I overlooking? Am I not importing it the right way? Since it's in my global.js shouldn't it be loaded everywhere? All corrections and advice are welcome. Regards
EDIT: The issue is resolved, the final script is here if anyone wants it. --Noemon *talk* 03:29, March 11, 2012 (UTC)

Why not just hit Ctrl-Home? Rappy 03:30, March 11, 2012 (UTC)
Don't you have to upload it to MediaWiki:Whatever.js and then put the // importScriptPage('MediaWiki:Whatever.js', 'WikiName'); on your Global.js?
Rappy, I've tried this, still nothing. I don't think it loads at all for me, I cannot find it in the loaded scripts on Firebug.
Iggyvolz, I don't really know, I had the impression that if it's in my global.js it should load, can you enlighten me on this? --Noemon *talk* 03:42, March 11, 2012 (UTC)

(Reset indent) Your script works. I've only tested the core:

$(function () {
    if ("oasis" == skin) {
	$('<li id="backtotop"><a href="#WikiaHeader">Back To Top</a></li>').appendTo('#WikiaFooter > .toolbar > .tools');

but that definitely works. It most likely is a caching issue. -- Pecoes 05:15, March 11, 2012 (UTC)

Got it! It was a very stupid mistake really. Instead of giving the function a different name than the variable, I had named them both BackToTop. Also, as Pecoes noted, only the #WikiaHeader is needed, I came to realise it myself as well while I was trying to pinpoint my error. I'll upload it to the Dev wiki as well. Cheers to all!
EDIT: Final script is here if anyone wants it. --Noemon *talk* 06:21, March 11, 2012 (UTC)

Also on Fandom

Random Wiki