User:Bility/statusupdate.js

if (mw.config.get('wgPageName')=='User:'+mw.config.get('wgUserName') || mw.config.get('wgPageName')=='User_talk:'+mw.config.get('wgUserName')) { $(document).ready(function {	if (typeof hideStatus == 'undefined') { hideStatus = false; };	if ($('#user-status')) {		if (hideStatus) { $('#user-status').attr('style','visibility:visible'); };		$('#user-status span').attr('style','cursor:pointer');		$('#user-status span').click(function { var statusText = $(this).html; var summ = 'updating status'; var token;

$.ajax({				url: '/w/api.php?action=query&prop=info&intoken=edit&titles=Main_page&format=json',				success: function(data) { token = data.query.pages[Object.keys(data.query.pages)].edittoken.replace(/\+\\$/g,'%2B%5C'); },				dataType: 'json',				async: false			});

$.ajax({				type: 'POST',				url: '/w/api.php?action=edit&title=User:'+mw.config.get('wgUserName')+'/Status&summary='+summ+'&minor=1&recreate=1&text='+statusText+'&token='+token,				async: false			});

window.location.reload; });	}; }); };