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

// // THIS SCRIPT IS FOR THE USERONLINE TEMPLATE // SEE THE DOCUMENTATION FOR ITS USE //

function CustomizeLinkModifications { var un = mw.config.get('wgUserName') var ONLINEpagetoedit = "//en.wikipedia.org/w/index.php?title=User:" + encodeURIComponent(un) + "/Status&action=edit&newstatus=online"; var OFFLINEpagetoedit = "//en.wikipedia.org/w/index.php?title=User:" + encodeURIComponent(un) + "/Status&action=edit&newstatus=offline"; var HUGGLEpagetoedit = "//en.wikipedia.org/w/index.php?title=User:" + encodeURIComponent(un) + "/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; } $(CustomizeLinkModifications);