Natbrown/common.js
< User:Natbrown
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/**
* Keep code in MediaWiki:Common.js to a minimum!!!
*/
/**
* Extra buttons in toolbar
*
*/
jQuery.getScript('//en.wikipedia.org/wiki/User:V111P/js/addToolbarButtons.js&action=raw&ctype=text/javascript', function () {
// Backlink: https://en.wikipedia.org/wiki/User:V111P/js/addToolbarButtons.js
var button1 = {
id: 'insertTemplateButton',
tooltip: 'Insert a template',
before: '{{',
between: '<Template name>',
after: '}}',
callback: function (event) {
if (window.console && console.log)
console.log(this.id + ' button clicked');
}, // you can remove this callback property, remember that it's not required
iconUrl: '//upload.wikimedia.org/wikipedia/commons/'
+ 'thumb/f/fb/Template_icon.svg/22px-Template_icon.svg.png',
iconUrlClassic: '//upload.wikimedia.org/wikipedia/commons/9/97/Template_button.png'
};
var button2 = {
id: 'removeEndOfLineSpacesButton',
tooltip: 'Remove whitespace from end of lines',
section: 'advanced',
group: 'format',
callback: function (event) {
var ta = $('#wpTextbox1');
ta.val(ta.val().replace(/\s+\n/g, '\n'));
},
iconUrl: '//upload.wikimedia.org/wikipedia/commons/'
+ 'thumb/4/40/Edit-select-all.svg/22px-Edit-select-all.svg.png'
};