کاربر:محمد/insertPakVE.js: تفاوت میان نسخهها
ظاهر
صفحهای تازه حاوی «function makeInsertPakVE() { var pakTemplate = [{ type: 'mwTransclusionInline', attributes: { mw: { parts: [{ template: { target: { href: 'الگو:پک', wt: 'پک' }, params: { 1: {...» ایجاد کرد |
(بدون تفاوت)
|
نسخهٔ کنونی تا ۲۴ ژانویهٔ ۲۰۲۵، ساعت ۱۵:۰۵
function makeInsertPakVE() {
var pakTemplate = [{
type: 'mwTransclusionInline',
attributes: {
mw: {
parts: [{
template: {
target: {
href: 'الگو:پک',
wt: 'پک'
},
params: {
1: {
wt: ''
},
2: {
wt: ''
},
'ک': {
wt: ''
},
'ف': {
wt: ''
},
'ج': {
wt: ''
},
'ص': {
wt: ''
}
}
}
}]
}
}
}, {
type: '/mwTransclusionInline'
}];
function InsertAndOpenCommand(name, options) {
InsertAndOpenCommand.parent.call(this, name, null, null, options);
}
OO.inheritClass(InsertAndOpenCommand, ve.ui.Command);
InsertAndOpenCommand.prototype.execute = function(surface, args) {
args = args || this.args;
surface.getModel().getFragment().collapseToEnd().insertContent(args[0], args[1]).select();
surface.execute('window', 'open', 'transclusion');
return true;
};
ve.ui.commandRegistry.register(
new InsertAndOpenCommand('insertpak', {
args: [pakTemplate, false],
supportedSelections: ['linear']
})
);
if (ve.ui.wikitextCommandRegistry) {
ve.ui.wikitextCommandRegistry.register(
new ve.ui.Command('insertpak', 'mwWikitext', 'wrapSelection', {
args: ['<ref>{{پک|', '}}</ref>', '', '', '', '', '', ''],
supportedSelections: ['linear']
})
);
}
function insertPakVE() {
insertPakVE.parent.apply(this, arguments);
}
OO.inheritClass(insertPakVE, ve.ui.MWTransclusionDialogTool);
insertPakVE.static.name = 'insertpakve';
insertPakVE.static.group = 'insert';
insertPakVE.static.title = 'پک';
insertPakVE.static.commandName = 'insertpak';
insertPakVE.static.icon = 'book';
ve.ui.triggerRegistry.register(
'insertpak', {
mac: new ve.ui.Trigger('cmd+shift+,'),
pc: new ve.ui.Trigger('ctrl+shift+,')
}
);
ve.ui.toolFactory.register(insertPakVE);
}
mw.hook('ve.loadModules').add(function(addPlugin) {
addPlugin(makeInsertPakVE);
});