MediaWiki:Gadget-edit-summary-warning.js
Wygląd
Uwaga: aby zobaczyć zmiany po opublikowaniu, może zajść potrzeba wyczyszczenia pamięci podręcznej przeglądarki.
- Firefox / Safari: Przytrzymaj Shift podczas klikania Odśwież bieżącą stronę, lub naciśnij klawisze Ctrl+F5, lub Ctrl+R (⌘-R na komputerze Mac)
- Google Chrome: Naciśnij Ctrl-Shift-R (⌘-Shift-R na komputerze Mac)
- Internet Explorer / Edge: Przytrzymaj Ctrl, jednocześnie klikając Odśwież, lub naciśnij klawisze Ctrl+F5
- Opera: Naciśnij klawisze Ctrl+F5.
/*
== Informacja o niewpisaniu opisu zmian ==
; Autorzy (Authors): [[:pl:User:Adziura|Adam Dziura]], [[:pl:User:Nux|Maciej Jaros]]
; Wyłączenie (disable): window.NoSummaryWarningDone = true;
<pre>
*/
window.oSummaryWarning = {};
oSummaryWarning.version = 1;
oSummaryWarning.init = function ()
{
var that = this;
if (window.NoSummaryWarningDone) {
return;
}
// Ignore user's own pages
if ( mw.config.get('wgCanonicalNamespace') == "User" ) {
var m = mw.config.get('wgPageName').match(/^[^:]+:([^\/]+)(?:$|\/)/);
if (m && m[1] == mw.config.get('wgUserName')) {
return;
}
}
jQuery('#wpSave').click(function(event) {
if (!that.validateForm()) {
event.preventDefault();
}
});
};
oSummaryWarning.validateForm = function()
{
var input_el = document.getElementById('wpSummary');
if (!input_el) {
return true;
}
var summary = input_el.value;
// user has been warned
if (input_el.warningSet) {
return true;
}
// empty or nothing but section comment
if (summary === '' || summary.substring(summary.indexOf('*/'))=='*/ ')
{
// ignore redirects - there is autosummary
var wpTextbox1 = document.getElementById('wpTextbox1');
if (wpTextbox1.value.match(/^#(?:REDIRECT|PRZEKIERUJ|TAM|PATRZ)/i)) {
return true;
}
// do not check titles of sections on non-talk pages
if (mw.config.get('wgNamespaceNumber') % 2 === 0 && input_el.form.wpSection.value == 'new') {
return true;
}
// set warning, do not submit form
input_el.warningSet = true;
input_el.className += ' summaryWarning';
document.getElementById('wpSummaryLabel').className += ' summaryWarning';
return false;
}
return true;
};
jQuery(document).ready(function() { oSummaryWarning.init() });