پرش به محتوا

مدیاویکی:Gadget-VeDirectionMarkTool.js: تفاوت میان نسخه‌ها

از دانشنامه علوم انسانی
imported>Yamaha5
صفحه‌ای جدید حاوی «mw.libs.ve.addPlugin(function(){ ←* * Adds direction mark tool to VE (for adding RLM): (function () { // localization for button name...» ایجاد کرد
 
imported>Yamaha5
بدون خلاصۀ ویرایش
 
(یک نسخهٔ میانیِ ایجادشده توسط همین کاربر نشان داده نشد)
خط ۱: خط ۱:
mw.libs.ve.addPlugin(function(){
/**
/**
  * Adds direction mark tool to VE (for adding RLM)  
  * Adds direction mark tool to VE (for adding RLM)  
خط ۶: خط ۵:
// localization for button name
// localization for button name
if(!mw.messages.exists('DirectionTool-toolname')){
if(!mw.messages.exists('DirectionTool-toolname')){
mw.messages.set('DirectionTool-toolname', 'افزودن الگو رچ'); // translate it!
mw.messages.set('DirectionTool-toolname', 'الگو تغییر جهت');
}
}
// localization for rlm template name
// localization for rlm template name
if(!mw.config.exists('rlmTemplateName')){
if(!mw.config.exists('rlmTemplateName')){
// translate it!
mw.config.set('rlmTemplateName', 'رچ');
if ( wgContentLanguage == "fa" ) {
mw.config.set('rlmTemplateName', 'رچ');
} else {
mw.config.set('rlmTemplateName', 'Rlm');
}
 
}
}
//end of localization
//end of localization
 
function DirectionTool( toolGroup, config ) {
function DirectionTool( toolGroup, config ) {
OO.ui.Tool.call( this, toolGroup, config );
OO.ui.Tool.call( this, toolGroup, config );
}
}
OO.inheritClass( DirectionTool, OO.ui.Tool );
OO.inheritClass( DirectionTool, OO.ui.Tool );
 
DirectionTool.static.name = 'DirectionTool';
DirectionTool.static.name = 'DirectionTool';
DirectionTool.static.title = mw.msg('DirectionTool-toolname');
DirectionTool.static.title = mw.msg('DirectionTool-toolname');
 
DirectionTool.prototype.onSelect = function () {
DirectionTool.prototype.onSelect = function () {
this.toolbar.getSurface().getModel().getFragment().collapseRangeToEnd().insertContent([{
this.toolbar.getSurface().getModel().getFragment().collapseToEnd().insertContent([{
'type': 'mwTransclusionInline',
'type': 'mwTransclusionInline',
'attributes': {
'attributes': {
خط ۳۶: خط ۲۹:
template: {
template: {
target: {
target: {
href: wgFormattedNamespaces[10]+ ':'+ mw.config.get('rlmTemplateName'),
href: mw.config.get('wgFormattedNamespaces')[10]+ ':'+ mw.config.get('rlmTemplateName'),
wt: mw.config.get('rlmTemplateName')
wt: mw.config.get('rlmTemplateName')
},
},
خط ۴۶: خط ۳۹:
}]);
}]);
};
};
 
DirectionTool.prototype.onUpdateState = function () {
DirectionTool.prototype.onUpdateState = function () {
this.setActive( false );
this.setActive( false );
};
};
 
ve.ui.toolFactory.register( DirectionTool );
ve.ui.toolFactory.register( DirectionTool );
 
})();
})();
});

نسخهٔ کنونی تا ۸ مهٔ ۲۰۲۰، ساعت ۱۷:۵۲

/**
 * Adds direction mark tool to VE (for adding RLM) 
 */
(function () {
// localization for button name
if(!mw.messages.exists('DirectionTool-toolname')){
	mw.messages.set('DirectionTool-toolname', 'الگو تغییر جهت');
}
// localization for rlm template name
if(!mw.config.exists('rlmTemplateName')){
	mw.config.set('rlmTemplateName', 'رچ');
}
//end of localization

function DirectionTool( toolGroup, config ) {
	OO.ui.Tool.call( this, toolGroup, config );
}
OO.inheritClass( DirectionTool, OO.ui.Tool );

DirectionTool.static.name = 'DirectionTool';
DirectionTool.static.title = mw.msg('DirectionTool-toolname');

DirectionTool.prototype.onSelect = function () {
	this.toolbar.getSurface().getModel().getFragment().collapseToEnd().insertContent([{
		'type': 'mwTransclusionInline',
		'attributes': {
			'mw': {
				parts: [ {
					template: {
						target: {
							href: mw.config.get('wgFormattedNamespaces')[10]+ ':'+ mw.config.get('rlmTemplateName'),
							wt: mw.config.get('rlmTemplateName')
						},
						params: {}
					}
				}]
			}
		}
	}]);
};

DirectionTool.prototype.onUpdateState = function () {
	this.setActive( false );
};

ve.ui.toolFactory.register( DirectionTool );

})();