Jump to content

User:IgniX/scripts/useronline.js/Version2.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//
// THIS SCRIPT IS FOR THE USERONLINE TEMPLATE
// SEE THE DOCUMENTATION FOR ITS USE
//

function CustomizeLinkModifications() {
    var ONLINEpagetoedit = "http://en.wikipedia.org/w/index.php?title=User:IgniX/Status&action=edit&newstatus=online";
    var OFFLINEpagetoedit = "http://en.wikipedia.org/w/index.php?title=User:IgniX/Status&action=edit&newstatus=offline";
    var HUGGLEpagetoedit = "http://en.wikipedia.org/w/index.php?title=User:IgniX/Status&action=edit&newstatus=huggle";
    var hovertext = "Update Your Status!"
 
    //Sidebar
    mw.util.addPortletLink("p-navigation", ONLINEpagetoedit, "Online", "pt-statusnav", hovertext, "", "");
    mw.util.addPortletLink("p-navigation", OFFLINEpagetoedit, "Offline", "pt-statusnav", hovertext, "", "");
    mw.util.addPortletLink("p-navigation", HUGGLEpagetoedit, "Huggle", "pt-statusnav", hovertext, "", "");
 
    //Topbar
    mw.util.addPortletLink("p-personal", ONLINEpagetoedit, "Online", "pt-statuspers", hovertext, "", document.getElementById("pt-userpage"));
    mw.util.addPortletLink("p-personal", OFFLINEpagetoedit, "Offline", "pt-statuspers", hovertext, "", document.getElementById("pt-userpage"));
    mw.util.addPortletLink("p-personal", HUGGLEpagetoedit, "Huggle", "pt-statuspers", hovertext, "", document.getElementById("pt-userpage"));
 
 if (location.href.indexOf("&action=edit&newstatus=") == -1) return;
  //Get new status
  statusRegExp = /&action=edit&newstatus=(.*)/;
  var status = statusRegExp.exec(location.href)[1];
  //Modify the form
  document.getElementById('wpTextbox1').value = status;
  document.getElementById('wpSummary').value = "Updating online status";
  document.getElementById('wpMinoredit').checked = true;
  //Submit it!
  document.getElementById('editform').submit();
}
 
addOnloadHook(CustomizeLinkModifications);