User:TomasBat/Random Smiley Script
Appearance
This is a random smiley script by ais523. By clicking a simple link, you can automatically award a random user with the random smiley award. Just follow the instructions below for it to work:
- Copy the following code to your monobook. If you are using a skin other than the default monobook, copy the following code to the corresponding .js page.
//Random smiley script. By [[User:ais523]], based on the suggestion by [[User:TomasBat]].
addOnloadHook(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=wgServer+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:Elipongo/SmileyAward2}} ~~"+"~~";
document.editform['wpPreview'].click(); //change to wpSave to save without a preview
}
});
- Click on this link: Special:MyPage/RandomSmileyGenerator (creates a subpage recognized by the script).
- On that subpage/link, click on the tab "create this page".
- Add the following to that subpage and save the page:
*[[Special:Random/User|Send a random user a random smiley!]] ==Usage== For this to work for you, follow the instructions [[User:TomasBat/Random Smiley Script|here]].
- Click on the link "Send a random user a random smiley!". You can click on it as many times as you want.