MediaWiki:PortalAvailability.js

if (wgNamespaceNumber === 112 || wgNamespaceNumber === 2) { function submitAvailability { importScriptPage("MediaWiki:ApiKey.js", "wlb");

setTimeout(function { newStatus = $("#personal-availability-form").find("select").val;

// Ajax URL var url = _api.server + '/api.php?action=edit&title=User:' + wgUserName + '/' + 'availability&text=' + newStatus + '&summary=Updated availability&token=' + encodeURIComponent(_api.edittoken); console.log('Got the url: ',url); $.post(url, function (r) { console.log('Should be done now:',r);       window.location.reload;    }); console.log('Sent request...'); }, 1000);

}

$("#personal-availability span").click(function {

$(this).fadeOut;

$(this).after(' Submit ');

dropdown = ' ' + 'Select new availability ' + ' Available ' + ' Busy ' + ' Unavailable ' + ' Inactive '; + ' ';

$("#personal-availability-form").prepend(dropdown + " ");

}); }