Участник:Karaby/common.js: различия между версиями

Материал из Буквицы
Перейти к навигации Перейти к поиску
мНет описания правки
мНет описания правки
Строка 1: Строка 1:
var customizeMyToolbar = function () {
var customizeMyToolbar = function () {
/*  $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
  $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
     'section': 'advanced',
     'section': 'advanced',
     'group': 'blanks',
     'group': 'blanks',
Строка 22: Строка 22:
         }
         }
     }
     }
   } );*/
   } );
};
};



Версия от 08:41, 15 сентября 2020

var customizeMyToolbar = function () {
  $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
    'section': 'advanced',
    'group': 'blanks',
    'tools':  {
        'blank-user': {
            'label': 'Мои инструменты',
            'type': 'select',
            'list': {
                'blank-user-1' : { // Вставить ...
                      'label': 'Просмотрено de visu',
                      'action':   {
                          'type': 'encapsulate',
                          'options': {
                              'pre': '',
                              'peri': '', // <== сюда курсор (текущее выделение)
                              'post': '{{e02|vc|dv}}',
                          }       
                      }
                }
            }
        }
    }
  } );
};




/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
/*
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
	mw.loader.using( 'user.options' ).then( function () {
		// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor.toolbar' ), $.ready
			).then( customizeToolbar );
		}
	} );
}
*/

if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
        mw.loader.using( 'user.options', function () {
                if ( mw.user.options.get('usebetatoolbar') ) {
                        mw.loader.using( 'ext.wikiEditor.toolbar', function () {
                                $(document).ready( customizeMyToolbar );
                        } );
                }
        } );
}


/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
/*
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
	mw.loader.using( 'user.options' ).then( function () {
		// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor' ), $.ready
			).then( customizeToolbar );
		}
	} );
}
*/