User:Boomboompsh/monobook.js

//Random smiley script. By User:ais523, based on the suggestion by User:TomasBat. addOnloadHook(function{ if(document.referrer.indexOf("RandomSmileyGenerator") != -1 && mw.config.get('wgNamespaceNumber') == 2 && mw.config.get('wgTitle').indexOf("/") == -1 && mw.config.get('wgPageName').indexOf(mw.config.get('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(mw.config.get('wgTitle'))+"&action=edit&section=new&randomsmiley=1";  }  else if(document.referrer.indexOf("RandomSmileyGenerator") != -1 && mw.config.get('wgNamespaceNumber') == 2 && location.href.indexOf("RandomSmileyGenerator") == -1 && mw.config.get('wgPageName').indexOf(mw.config.get('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  } });