MediaWiki:DisableDrafts.js

/* DisableDrafts * * Completely disables draft saving, and always clears all drafts from localStorage * Obviously, it's for personal use * I'm sure staff would love to know why you use this and what does the extension lack that drives people to using this kinda stuff * But hey, I'm only a script hog, not a feedback giver * * @author Dorumin */

(function {   if (!['edit', 'submit'].includes(wgAction)) return;

// Define the module again. // This won't override the previously defined module, but will catch message walls // They have wgAction === "edit" but don't have the module defined // A try...catch around the require call doesn't do the trick, async? // Or I dunno, the module could be renamed/deleted ¯\_(ツ)_/¯ define('EditDraftSaving', $.noop);

require(['EditDraftSaving'], function(eds) {   	if (eds) {    	    eds.storeDraft = $.noop;    	}

Object.keys(localStorage).forEach(function(key) {   		if (key.slice(-6) == '-draft') {    			localStorage.removeItem(key);    		}    	}); }); });