Uživatel:Miroslav.gajda/common.js: Porovnání verzí
| Řádek 1: | Řádek 1: | ||
document.write("ahoj"); | document.write("ahoj"); | ||
| − | mw.hook( 've.activationComplete' ).add(function(){ | + | //mw.hook( 've.activationComplete' ).add(function(){ |
| − | alert("visual editor"); | + | //alert("visual editor"); |
| − | }); | + | //}); |
| + | |||
| + | mw.libs.ve.addPlugin('ext.gadget.VeDirectionMarkTool'); | ||
| + | |||
| + | /** | ||
| + | * 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: wgFormattedNamespaces[10]+ ':'+ mw.config.get('rlmTemplateName'), | ||
| + | wt: mw.config.get('rlmTemplateName') | ||
| + | }, | ||
| + | params: {} | ||
| + | } | ||
| + | }] | ||
| + | } | ||
| + | } | ||
| + | }]); | ||
| + | }; | ||
| + | |||
| + | DirectionTool.prototype.onUpdateState = function () { | ||
| + | this.setActive( false ); | ||
| + | }; | ||
| + | |||
| + | ve.ui.toolFactory.register( DirectionTool ); | ||
| + | |||
| + | })(); | ||
Verze z 7. 12. 2014, 11:19
document.write("ahoj");
//mw.hook( 've.activationComplete' ).add(function(){
//alert("visual editor");
//});
mw.libs.ve.addPlugin('ext.gadget.VeDirectionMarkTool');
/**
* 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: wgFormattedNamespaces[10]+ ':'+ mw.config.get('rlmTemplateName'),
wt: mw.config.get('rlmTemplateName')
},
params: {}
}
}]
}
}
}]);
};
DirectionTool.prototype.onUpdateState = function () {
this.setActive( false );
};
ve.ui.toolFactory.register( DirectionTool );
})();