User:Xbony2/common/autosummary.js

/** * Does a few things: * - Creates a default summary of "created page" when without a provided summary for new pages. * - Adds a default summary for general edits that can be configured right from the editor. Saved via cookies. * * @author User:Xbony2 * @author User:Chocohead (for new page fix) * Original code poked these a little bit: * - wikipedia:Wikipedia:WikiProject User scripts/Scripts/Force edit summary * - https://habbo.gamepedia.com/User:Developaws/common.js * */ function getDefaultSummary{ var summary = ''; decodeURIComponent(document.cookie).split(';').forEach(function(cookie){		var regex = /default_summary=(.+)/.exec(cookie);		if(regex !== null){			summary = regex[1];			return summary;		}	}); return summary; } $('#wpSummary').after(' \nDefault summary: \n \n'); $("#wpDefaultSummary").val(getDefaultSummary); $('#wpDefaultSummary').change(function{ //Maybe this could be escaped, but nah	document.cookie = "default_summary=" + $('#wpDefaultSummary').val + ";path=/"; }); $('#wpSave').click(function{	if($('#wpSummary').val === '')		$('#wpSummary').val(wgArticleId === 0 ? 'created page' : getDefaultSummary); });