User:Writ Keeper/Scripts/archiveTopChecker.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.
$(document).ready(function()
{
	if(mw.config.get("wgAction") == "edit" &&
	   ((mw.config.get("wgNamespaceNumber") == 4 && mw.config.get("wgTitle").search("noticeboard") != -1) || 
	    (mw.config.get("wgNamespaceNumber") == 3 && mw.config.get("wgTitle") == mw.config.get("wgUserName"))
	   ))
	{
		$("#editform").submit(function()
		{
			if(/{{archive top\|.*status=[^\|}]*[[User:Writ Keeper|Writ Keeper]] [[User Talk: Writ Keeper|⚇]][[Special:Contributions/Writ_Keeper|♔]] 17:38, 29 July 2014 (UTC)/.test($("#wpTextbox1").val()))
			{
				alert('Archive top params are the wrong way around! Switch "status" and "result".');
				return false;
			}
		});
	}
});