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 * */ $('#wpSummary').after(' \nDefault summary: \n \n'); $('#wpDefaultSummary').change(function{ //Maybe this could be escaped, but nah	document.cookie = "default_summary=" + document.forms.editform.wpDefaultSummary.value + ";path=/"; }); $('#wpSave').click(function{	if(wgArticleId === 0 && !document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/, '$1')){		document.forms.editform.wpSummary.value = 'created page';	}else if(!document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/, '$1')){		var summary = '';		decodeURIComponent(document.cookie).split(';').forEach(function(cookie){ var theCookie = /default_summary=(.+)/.exec(cookie); if(theCookie !== null){ summary = theCookie[1]; return; }		});		document.forms.editform.wpSummary.value = summary;	} });