User:TheLedBalloon/Welcum.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes.
- Internet Explorer: hold down the Ctrl key and click the Refresh or Reload button, or press Ctrl+F5.
- Firefox: hold down the Shift key while clicking Reload; alternatively press Ctrl+F5 or Ctrl-Shift-R.
- Opera, Konqueror and Safari users can just click the Reload button.
- Chrome: press Ctrl+F5 or Shift+F5
// <pre><nowiki>
function replaceTalk() {
var d = document.links;
for ( var l in d ) {
if ( d[l].className == 'new' && d[l].href.indexOf('User_talk') >= 0 && d[l-1].title.indexOf('User:') == 0) {
d[l].href += '&autoWelcome=true';
d[l].className = 'limegreen';
}
else if ( d[l].id == 'pt-userpage' ) break;
}
}
function doAutoWelcome() {
carryon = queryString('autoWelcome');
if(carryon == null)
return;
if(document.getElementById('wpTextbox1').value != '') {
alert('looks like someone beat you to it');
return;
}
document.getElementById('wpTextbox1').value = '{{subst:User:TheLedBalloon/Welcome}} ~~~ <br /></div>';
document.getElementById('wpSummary').value = 'Welcome to Uncyclopedia!';
document.getElementById('editform').submit();
}
function autoTalkLoad() {
replaceTalk();
doAutoWelcome();
}
function queryString(p) {
var re = RegExp('[&?]' + p + '=([^&]*)');
var matches;
if (matches = re.exec(document.location)) {
try {
return decodeURI(matches[1]);
} catch (e) {
}
}
return null;
};
YAHOO.util.Event.onDOMReady(autoTalkLoad);
//</nowiki></pre>