Hey, Mediawiki folks....
So I have what I think is a very simple problem that I can't quite figure out. If anybody could help me, that'd be great.
I'd like to add a little bit of JavaScript to my wiki pages. Let's assume I'm an idiot and want to include a pop-up alert every time somebody visits a page.
I see that one way of doing this is to just edit my MonoBook.php file so that I can add an "onLoad" function to my <body> tag. Something like this...
<body <?php if($this->data['body_ondblclick']) { ?>ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?> <?php if($this->data['body_onload' ]) { ?>onload="<?php $this->text('body_onload') ?>"<?php } ?> class="mediawiki <?php $this->text('nsclass') ?> <?php $this->text('dir') ?> <?php $this->text('pageclass') ?>"
onLoad = "alert('Hello world!');"
But this clearly doesn't seem like the right thing to do.
If I'm reading the code above it correctly, it looks like we've got a script that's looking for any values associated with the "body_onload" key in an associative array called "data". So it seems like the right thing to do is to somehow add my awesome alert code into this array, but I can't figure out how or where to do that, or if there's something else I should be doing instead.
Can anybody help me out here?
--T
P.S. Yes, I know I should really be copying over the MonoSkin into a separate skin so that everything doesn't get overwritten when I upgrade the wiki. Just ignore that for now.
mediawiki-l@lists.wikimedia.org