Forum:Pagenamefunction inside href

I try to add an pagename function inside this js switch function. But I can't find how to add this function in js. This what I got for the moment. I currently use $wgPageName. But it need something to see it as function and not as url.

/** Add JS buttom to Account Navigation in the Wikia skin **/

$(document).ready(function {   if ( skin == 'oasis' )        $( '#GlobalNavigation' ).prepend( '' );

});

--Jens Ingels (talk) 15:59, August 4, 2012 (UTC)


 * is a PHP variable, it won't work in JavaScript. You'll need to use this:

mw.config.get( 'wgPageName' )
 * This assumes the wiki is already up to date. Also you can't place the variable inside a string like that in JavaScript either (again unlike PHP). You'll need to concat them:

$( '#GlobalNavigation' ).prepend( '' );
 * Finally, if this is not for personal CSS, make sure you don't mess up the GlobalNavigation too much. - Tjcool007 (Talk) 16:58, August 4, 2012 (UTC)

Thx for the fix. I couldn't figure it out myself. The switch buttom works great.--Jens Ingels (talk) 18:02, August 4, 2012 (UTC)