//Random smiley script. By [[User:ais523]], based on the suggestion by [[User:TomasBat]].
$(function(){
if(document.referrer.indexOf("RandomSmileyGenerator") != -1 &&
wgNamespaceNumber == 2 && wgTitle.indexOf("/") == -1 &&
wgPageName.indexOf(wgUserName) == -1)
{
//we're trying to give a random smiley
location.href=mw.config.get('wgServer')+mw.config.get('wgScriptPath')+"/index.php?title=User_talk:"+
encodeURIComponent(wgTitle)+"&action=edit§ion=new&randomsmiley=1";
}
else if(document.referrer.indexOf("RandomSmileyGenerator") != -1 &&
wgNamespaceNumber == 2 && location.href.indexOf("RandomSmileyGenerator") == -1 &&
wgPageName.indexOf(wgUserName) == -1)
{
alert("This seems to be a user subpage, so there's no point in smiling at it. " +
"Why not go back and try again?");
}
else if(location.href.indexOf("&randomsmiley=1")!=-1)
{
document.editform.wpSummary.value="Random Smiley Award";
document.editform.wpTextbox1.value="{"+"{subst:User:Pedia-I/SmileyAward1}} ~~"+"~~";
document.editform['wpsave'].click(); //change to wpSave to save without a preview
}
});
('User:TheDJ/qui.js');