User:AHRtbA==/useronline.js

//Current status var uoStatus = null;

//When the user clicks "Logout" let's set the status to "offline" $(document).ready(function {    $("#pt-logout > a").attr("href", "javascript:uoLogout;void(0);"); });

//Init uoCheckGround;

function uoCheckGround {       //Check to see what the status should be    uoStatus = $.cookie("UserOnline"); if(uoStatus != "online") { //If they've come back from editing, or offline, let's say that they are now online uoSetStatus("online"); } }

function uoSetStatus(status) {   $.cookie("UserOnline", status, { expires: 30, path: "/" }); uoStatus = status; wpAPI.init; wpAPI.Page.load("User:" + wgUserName, uoSetTemplate) }

function uoSetTemplate(uPage) {   var d = new Date; var y = d.getUTCFullYear; var m = (d.getUTCMonth < 10) ? ("0" + (d.getUTCMonth + 1)) : (d.getUTCMonth + 1); var dt = (d.getUTCDate < 10) ? ("0" + d.getUTCDate) : d.getUTCDate; var h = (d.getUTCHours < 10) ? ("0" + d.getUTCHours) : d.getUTCHours; var mt = (d.getUTCMinutes < 10) ? ("0" + d.getUTCMinutes) : d.getUTCMinutes; var s = (d.getUTCSeconds < 10) ? ("0" + d.getUTCSeconds) : d.getUTCSeconds; var uoTplAttr = (uoStatus == "online") ? uoStatus + "|" + y + m + dt + h + mt + s : uoStatus; if(uPage.tplExists("user:AHRtbA==/UserOnline")) { uPage.text = uPage.replaceTpl("user:AHRtbA==/UserOnline", "user:AHRtbA==/UserOnline|" + uoTplAttr); } else { uPage.text = "\n" + uPage.text; }   var uoOnSuccess = (uoStatus == "offline") ? uoSendLogout : null; uPage.save(uPage.text, "UO: Changing my status to " + uoStatus + "...", true, uoOnSuccess); }

function uoLogout {   uoSetStatus("offline"); $("#pt-logout").text("Logging out..."); }

function uoSendLogout {   window.location = wpAPI.site + "index.php?title=Special:UserLogout&returnto=" + wgPageName; }