Forum:Some help with a two line script

Hey everyone. Recently, we got some extra namespaces in the Dead Space Wiki, one of them being the "Log" namespace.

As a result, the article names (the names of the Logs) in this namespace appear in the form of "Log:Some Name", like this.

I made a small script to filter out anything prior to the : in the article title, so that just the name of the Log appears.

The script is this:

I know it is correct, because it works on the dummy page I made, but it is not working in the wiki.

Any ideas?

By the way, the dummy page is this, just copy paste it in a new .html document and open it in your browser

<!DOCTYPE html>

  var wgCanonicalNamespace = 'Log'; alert ("type = "+wgCanonicalNamespace); $(document).ready( function {			if ( wgCanonicalNamespace == 'Log' ) { //to be updated with more namespaces				var filtered = $('#WikiaPageHeader h1').text.replace(/.+:/,"");				alert(filtered);				$('#WikiaPageHeader h1').replaceWith(' '+filtered+' ');			}		});

Something:Foo Bar


 * This code appears to be working (tested on Autopsy Report). However, there is a better way to do this. The only drawback is, it's not automated. Using on the page will display that title on the page without requiring JavaScript. The main benefit is: the user's don't see the change when viewing the page. I prefer the non-javascript solution personally because I hate seeing pages shift while they are loading. Rappy 04:24, June 30, 2012 (UTC)


 * Well, I'll be damned. For whatever reason, on Firefox, which I use as my main browser, some Javascript events fail to execute on wikia pages, like the dropdown lists from buttons. Strange, but definitely a problem on my end, will look at it. Everything, including my "problematic" script above works fine on Chrome.
 * Actually, would you or someone else please confirm that this kind of thing only happens to my Firefox browser? Try pressing the down arrow on buttons and see if the list comes up. Or if the script above worked for you on Firefox, that singles me out. (Note: I have cleared the browser's cache, to no avail. This may be like the time the editor failed to initialise on Firefoxn and I had to restore the installation)
 * About what you suggest, do I need to do something more than adding on the top of the page's content? Because I did just that, and I did not see a difference; the "Log:" prefix was still there for that split second until the script took it out. -- Noemo n  * talk *  05:00, June 30, 2012 (UTC)


 * I don't think the DISPLAYTITLE magic word can be used to omit the namespace from the article title. From mediawiki.org: "The value must be equivalent to the default title: only capitalization changes and replacing spaces with underscores are allowed". Correct me if I'm wrong on that, but that's my interpretation.
 * Couldn't you just do something like this?


 * stores the pagename with the namespace omitted. Matthew2602  Wall 05:30, June 30, 2012 (UTC)


 * Huh, you are absolutely right, I hadn't even noticed this variable. Cheers. -- Noemo n  * talk * 05:36, June 30, 2012 (UTC)
 * Haha, no worries. Matthew2602  Wall 05:45, June 30, 2012 (UTC)