/*
* Usage :Include a call to <code>addForceSummary()</code> in your page load function</s>
* Possible improvements :Make any form submission force a summary. Note that requiring an edit summary on preview or diff is not useful since "save" still needs to gain focus or be clicked before a commit can occur.
A heavily modified and expanded version of this code is now in use across the entire [[SourceWatch]] wiki. Here's a [http://www.sourcewatch.org/index.php?title=MediaWiki:Monobook.js#Edit_summary_stuff direct link to the code]. A particular enhancement in the SourceWatch code is that it provides a dropdown next to the edit summary textfield containing common edit summaries. Selecting one of these automatically inserts that summary into the textfield. The code also examines which subproject of SourceWatch the page belongs to, and adds an appropriate prefix to the edit summary.
<source lang=javascript> */
function addForceSummary()
{
if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return;
if(/§ion=new/.test(window.location.href)) return;
if(!document.forms.editform) return;
document.forms.editform.wpSave.onclick = forceSummary;
// The second invocation of this will cause extra annoyance if there is no edit summary present. If there *is* an edit summary, the dialog box will not appear.
document.forms.editform.wpSave.onfocus = forceSummary;
}
function forceSummary()
{
if(!document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/,'$1'))
{
var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:','[[User Talk:Flyingidiot|(fi)]]');
if(r == null) { return false; }
document.forms.editform.wpSummary.value = r;
}
return true;
}
$(addForceSummary);
/*split user warnings and deletions <nowiki>*/
function getUserName() {
switch (wgCanonicalNamespace) {
case 'User':
/*<![CDATA[*/
addButton('http://upload.wikimedia.org/wikipedia/commons/3/33/Button_exclamation.png','delete your own user page','{{','}}','subst:user:flyingidiot/2','mw-editbutton-media');
/*]]>*/;
break
case 'User_talk':
/*<![CDATA[*/
addButton('http://upload.wikimedia.org/wikipedia/commons/f/fc/Important-2.svg','autobio','{{subst:User:Flyingidiot/wb1|','}}','Article','mw-editbutton-media');
addButton('http://upload.wikimedia.org/wikipedia/commons/4/44/Warn1.png','First User Warning Vandal','{{subst:uw-vandalism1|','|--~~~~}}','Article','mw-editbutton-media');
addButton('http://upload.wikimedia.org/wikipedia/commons/e/e4/Warn2.png','Second User Warning Vandal','{{subst:uw-vandalism2|','|--~~~~}}','article','mw-editbutton-math');
addButton('http://upload.wikimedia.org/wikipedia/commons/8/84/Warn3.png','Third User Warning Vandal','{{subst:uw-vandalism3|','|--~~~~}}','Article','mw-editbutton-nowiki');
addButton('http://upload.wikimedia.org/wikipedia/commons/b/bd/Warn4.png','Final User Warning Vandal','{{subst:uw-vandalism4|','|--~~~~}}','article','mw-editbutton-nowiki');
addButton('http://upload.wikimedia.org/wikipedia/commons/7/76/Testwarn1.png','testpage userwarn 1','{{subst:Uw-test1|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/03/Testwarn2.png','testpage userwarn 2','{{subst:uw-test2|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/7/72/Testwarn3.png','testpage userwarn 3','{{subst:Uw-test3|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/9/9d/Testwarn4.png','testpage userwarn 4','{{subst:uw-test4|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/4/48/Deletewarn1.png','Userwarn delete 1','{{subst:uw-delete1|','|--~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/7/7d/Deletewarn2.png','Userwarn delete 2','{{subst:uw-delete2|','|--~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/07/Deletewarn3.png','Userwarn delete 3','{{subst:uw-delete3|','|--~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/f/f4/Deletewarn4.png','Userwarn delete 4','{{subst:uw-delete4|','|--~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/c/cd/Warncreate1.png','Userwarn create nonsense 1','{{subst:Uw-create1|','| --~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/01/Warncreate2.png','Userwarn create nonsense 2','{{subst:Uw-create2|','| --~~~~}}','Article','mw-editbutton-table');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/09/Warncreate3.png','Userwarn create nonsense 3','{{subst:Uw-create3|','|--~~~~}}','Article','mw-editbutton-link');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/00/Warncreate4.png','Userwarn create nonsense 4','{{subst:Uw-create4|','|--~~~~}}','Article','mw-editbutton-link');/*]]>*/;
addButton('http://upload.wikimedia.org/wikipedia/commons/a/a4/Spam1.png','spam userwarn 1','{{subst:Uw-spam1|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/2/27/Spam2.png','spam userwarn 2','{{subst:Uw-spam2|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/0/02/Spam3.png','spam userwarn 3','{{subst:Uw-spam3|','|--~~~~}}','Article','mw-editbutton-signature');
addButton('http://upload.wikimedia.org/wikipedia/commons/f/fb/Spam4.png','spam userwarn 4','{{subst:Uw-spam4|','|--~~~~}}','Article','mw-editbutton-signature');
break
default:
/*<![CDATA[*/
addButton('http://upload.wikimedia.org/wikipedia/commons/3/33/Button_exclamation.png','FIdeletion','{{user:Flyingidiot/del|','}}','|','mw-editbutton-media');
addButton('http://upload.wikimedia.org/wikipedia/commons/3/3d/ButtonSpam.png','Delete spam','{{','}}','Db-spam','mw-editbutton-bold');
addButton('http://upload.wikimedia.org/wikipedia/commons/c/ca/NonsenseDelete.png','Delete nonsense','{{','}}','Db-nonsense','mw-editbutton-italic');
addButton('http://upload.wikimedia.org/wikipedia/commons/2/28/Nonnotable.png','Delete unnotable','{{','}}','db-bio','mw-editbutton-link');
addButton('http://upload.wikimedia.org/wikipedia/commons/6/62/Button_stop.png','Delete for a special reason','{{db','}}','|','Reason','mw-editbutton-extlink');
addButton('http://upload.wikimedia.org/wikipedia/commons/e/e2/Button_contexto.png','Delete empty or no context','{{','}}','db-nocontext','mw-editbutton-headline');
addButton('http://upload.wikimedia.org/wikipedia/commons/3/3b/Button_crocs.png','Delete attack page','{{','}}','db-attack','mw-editbutton-image');
addButton('http://upload.wikimedia.org/wikipedia/commons/c/cc/Bouton_Vandale2.png','Delete blanked','{{','}}','db-blankcsd','mw-editbutton-image');
addButton('http://commons.wikimedia.org/wiki/Image:Wiki_test.GIF','Delete test','{{','}}','db-test','mw-editbutton-image');
addButton('http://upload.wikimedia.org/wikipedia/commons/6/62/Button_desambig.png','Disambiguate the page','{{disambig','}}','','mw-editbutton-hr');
/*]]>*/;
}
}
$(getUserName());
/* </source> */