Admin Forum:Javascript last URL (spoiler reveal choice)

I know almost nothing about javascript ( , , ). I want to be able to make a verbatim that outputs the previous URL, so if the previous URL is the "spoiler" page, it would show the content, if not it would link to it. The spoiler page would link to the last page. Thanks, Iggyvolz 01:19, March 24, 2012 (UTC)


 * ( , , ) have nothing to do with Javascript. If that's all you know, you don't really know anything about HTML either, since those things are HTML. 65.92.180.188 04:51, March 24, 2012 (UTC)


 * You want a complete solution, don't you? :)


 * Below is a little snippet from my jQuery grab bag. It's not exactly what you were asking for, but it serves the same purpose. It checks if the word "spoiler" appears in the page's title and if so, it blackens the page and displays a dialog that will either send the visitor back or reveal the page.

' +       ' ');        $('#no').click(function  { $('#dialog').remove; history.back; });       $('#yes').click(function  { $('#dialog').remove; $('#blackout').fadeOut(2000, function {                $('#blackout').remove;            }); });   } }); --
 * It seems not to be working. I put a tag around it, and that made the code dissappear. (Link to script, link to page) Thanks, Iggyvolz 13:43, March 24, 2012 (UTC)


 * There are no tags in Wikicode. You need to add the code to one of the dedicated JavaScript pages. --


 * Is this CSS or JS? Iggyvolz 14:47, March 24, 2012 (UTC)


 * JS --


 * I tried it on MediaWiki:Common.js, but nothing happened. I'll be back in about 2hrs, I can make you admin of the wiki to put it in if you want. Thanks, Iggyvolz 15:09, March 24, 2012 (UTC)


 * Okay. Make me an admin. But don't forget to remove my privileges afterwards! --
 * This page should work now. You might have to refresh your browser's cache and/or wait a while before it starts to work. --

It's still not working, tried purging, clearing cache, and deleting browsing history. Is it coming up for you? Iggyvolz 19:25, March 24, 2012 (UTC)
 * Works fine for me. What browser are you using? 19:30, March 24, 2012 (UTC)
 * IE8. Used a different browser and it worked fine. However, I don't understand why it won't work in Internet Explorer. Iggyvolz 19:35, March 24, 2012 (UTC)
 * I think it may have been related to jQuery since Internet Explorer 8 did not pass the Acid3 standards test. 19:44, March 24, 2012 (UTC)


 * I've only tested it with IE9. It works well there. But, you're right: It does not seem to work with IE7 or IE8. That sucks. I kinda thought with jQuery such problems were a thing of the past. :( --
 * I'll be getting IE9 soon then. Thanks for all the help, Iggyvolz 20:06, March 24, 2012 (UTC)

It appears that  doesn't work in IE<9. If that's true, that's easy to fix. Replace this:

with this:

But let's wait 2hours until the browershots are finished. Who knows? There might be other "interesting" results... --


 * Is there an example of the JS above working somewhere? -- Fandyllic (talk &middot; contr) 27 Mar 2012 1:13 PM Pacific


 * I think Iggy made some additional changes, so if you want to see just the initial script, go here. --


 * Yeah, it works nicely on your sandbox wiki, but you might want to modify the JS so it doesn't activate when searching for "Spoiler". -- Fandyllic (talk &middot; contr) 27 Mar 2012 4:49 PM Pacific


 * Done. --