Удзельнік:Nux/monobook.js
Зьвесткі зь Вікіпэдыі — вольнай энцыкляпэдыі.
Note: After saving, you may have to bypass your browser's cache to see the changes. Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac); IE: hold Ctrl while clicking Refresh, or press Ctrl-F5; Konqueror:: simply click the Reload button, or press F5; Opera users may need to completely clear their cache in Tools→Preferences.
/* ==== Automatic summaries ==== * Author: [[:pl:User:Adziura|Adam Dziura]] * Fixes: [[:pl:User:Nux|Maciej Jaros]] <pre> */ // main function addOnloadHook(function () { // stop before starting if (window.autoSummariesDone) return; // // check if user is editing and if this is a summary field (not a section header field) var el = document.getElementById('wpSummary'); if (el) { if (el.getAttribute('tabindex')==1) // hack! hopefully will not be changed return // stop ; } else { return; // stop } // // adding element that will hold buttons el = el.nextSibling; var parent = document.createElement('span'); parent.id = 'userSummaryButtonsA' el.parentNode.insertBefore(document.createElement('br'), el) el.parentNode.insertBefore(parent, el) // // adding summary buttons var cl = ''; // class is not needed (as on may style with the element above) // drobne różne addSummaryBtn(parent, 'артаг.', 'addSumm("артаграфія")', cl, 'артаграфія (ort.)'); addSummaryBtn(parent, 'стыл.', 'addSumm("стылевые правки")', cl, 'стылевые правки (style)'); addSummaryBtn(parent, 'спасылкi', 'addSumm("выпраўленьне спасылак")', cl, 'спасылкi (linkfix)'); addSummaryBtn(parent, 'дапаўн.', 'addSumm("дапаўненьне")', cl, 'дапаўненьне (expand)'); addSummaryBtn(parent, 'абнаўл.', 'addSumm("абнаўленьне зьвестак")', cl, 'абнаўленьне зьвестак (update)'); addSummaryBtn(parent, 'інтэрвікі', 'addSumm("інтэрвікі")', cl, 'інтэрвікі (interwiki)'); addSummaryBtn(parent, 'катэг.', 'addSumm("катэгорыя")', cl, 'катэгорыя (category)'); addSummaryBtn(parent, 'шаблён', 'addSumm("шаблён")', cl, 'шаблён (template)'); }); /* Params: * el - parent element to hold buttons * t - text to appear in the button * a - action (as string) to be run after clicking a button; may be more then one function * c - optional class name to be attached to the button * d - a tooltip to be show when one highlights the button */ function addSummaryBtn(el, t, a, c, d) { var btn = document.createElement('a'); btn.appendChild(document.createTextNode(t)); btn.title = d; if (c!='') btn.className = c ; btn.onclick = new Function(a); el.appendChild(btn); } function addSumm(txt) { var wpS = document.editform.wpSummary; if (wpS.value != '' && wpS.value.charAt(wpS.value.length-2) != '/') wpS.value += ', ' + txt else wpS.value += txt ; } // </pre>