Content deleted Content added
Polygnotus (talk | contribs) No edit summary |
Polygnotus (talk | contribs) use OOUI |
||
(14 intermediate revisions by the same user not shown) | |||
Line 1:
//I should be able to combine these
//colours are weird in dark mode
//https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization
// <nowiki>
Line 23 ⟶ 25:
},
element: function ( context ) {▼
var button = new OO.ui.ButtonInputWidget( {▼
icon: 'lightbulb',▼
} );▼
button.connect( null, {▼
click: function ( e ) {▼
var text = '{{refideas\n|1=\n}}';▼
var textarea = context.$textarea[0];
var start = textarea.selectionStart;
var end = textarea.selectionEnd;
var currentText = textarea.value;
textarea.value = currentText.substring(0, start) + text + currentText.substring(end);
textarea.selectionStart = textarea.selectionEnd = start + text.length;
textarea.focus();
$(textarea).trigger('input');
$('#wpSummary').val('Added {{refideas}} template');
}▼
} );▼
return button.$element;
}▼
},
wpPolicy: {
var button = new OO.ui.ButtonInputWidget( {
▲ filters: [ 'body.ns-3' ],
label: 'ReadThis',
▲ element: function ( context ) {
icon: 'articles'
▲ var button = new OO.ui.ButtonInputWidget( {
button.connect( null, {
▲ icon: 'lightbulb'
▲ } );
var policy = prompt('Enter Wikipedia policy/guideline abbreviation (e.g., NPOV, V, RS):');▼
▲ button.connect( null, {
if (policy !== null && policy.trim() !== '') {▼
▲ click: function ( e ) {
var text = '== [[WP:' + policy.trim() + ']] ==\nPlease read [[WP:' + policy.trim() + ']], thanks and have a nice day, ~~~~';▼
▲ var text = '{{refideas\n|1=\n}}';
context.
pre: text
}
return button.$element;
}
},
▲ execute: function( context ) {
▲ var policy = prompt('Enter Wikipedia policy/guideline abbreviation (e.g., NPOV, V, RS):');
▲ if (policy !== null && policy.trim() !== '') {
▲ var text = '== [[WP:' + policy.trim() + ']] ==\nPlease read [[WP:' + policy.trim() + ']], thanks and have a nice day, ~~~~';
context.$textarea.textSelection('encapsulateSelection', {▼
▲ pre: text
▲ });
▲ }
▲ }
exlinkInBody: {
filters: [ 'body.ns-3' ],
▲ width: 26,
var text = '{{subst:' + 'User:Polygnotus/Templates/exlink}} ~~' + '~~';
▲ type: 'encapsulate',
▲ context.$textarea.textSelection('encapsulateSelection', {
▲ options: {
});
}
} );
return button.$element;
}
},
uwSpam: {
filters: [ 'body.ns-3' ],
var button = new OO.ui.ButtonInputWidget( {
▲ icon: '//upload.wikimedia.org/wikipedia/commons/c/c8/No-spam.svg',
icon: '//upload.wikimedia.org/wikipedia/commons/c/c8/No-spam.svg'
▲ type: 'encapsulate',
button.connect( null,
var text = '{{subst:' + 'uw-spam}} ~~' + '~~';
context.$textarea.textSelection('encapsulateSelection', {
pre: text
});
}
} );
return button.$element;
}
},
|