MediaWiki:Common.js — различия между версиями

Материал Psylab.info - энциклопедии психодиагностики
Перейти к: навигация, поиск
м
м
 
(не показано 16 промежуточных версий этого же участника)
Строка 1: Строка 1:
 
/* Дополнительные кнопки в WikiEditor */
 
/* Дополнительные кнопки в WikiEditor */
 +
importScript( 'MediaWiki:Common.js/extra-buttons.js' );
  
var customizeToolbar = function() {
+
/* Код отслеживания Google Analytics */
    $('#wpTextbox1').wikiEditor('addToToolbar', {
+
importScript( 'MediaWiki:Common.js/ga.js' );
section: 'advanced',
+
group: 'format',
+
tools: {
+
    "math": {
+
label: 'Math',
+
type: 'button',
+
icon: '//upload.wikimedia.org/wikipedia/commons/3/38/Button_Math.png',
+
action: {
+
    type: 'encapsulate',
+
    options: {
+
pre: "<math>",
+
post: "</math>"
+
    }
+
}
+
    }
+
}
+
    });
+
    $('#wpTextbox1').wikiEditor('addToToolbar', {
+
section: 'advanced',
+
group: 'format',
+
tools: {
+
    "math": {
+
label: 'Code',
+
type: 'button',
+
icon: '//upload.wikimedia.org/wikipedia/commons/7/73/Toolbaricon_code.png',
+
action: {
+
    type: 'encapsulate',
+
    options: {
+
pre: "<code>",
+
post: "</code>"
+
    }
+
}
+
    }
+
}
+
    });
+
};
+
+
/* 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', function () {
+
if ( mw.user.options.get('usebetatoolbar') ) {
+
mw.loader.using( 'ext.wikiEditor.toolbar', function () {
+
$(document).ready( customizeToolbar );
+
} );
+
}
+
} );
+
}
+
// Add the customizations to LiquidThreads' edit toolbar, if available
+
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );
+
  
 
+
/* Код отслеживания Yandex.Metrika */
/* Подсветка синтаксиса при помощи highlight.js */
+
importScript( 'MediaWiki:Common.js/ym.js' );
 
+
/*
+
mw.loader.load( 'http://yandex.st/highlightjs/8.0/highlight.min.js', 'text/javascript' );
+
mw.loader.load( 'http://yandex.st/highlightjs/8.0/languages/r.min.js', 'text/javascript' );
+
mw.loader.load( 'http://yandex.st/highlightjs/8.0/styles/idea.min.css', 'text/css' );
+
 
+
window.onload = function() {
+
    var aCodes = document.getElementsByTagName('pre');
+
    for (var i=0; i < aCodes.length; i++) {
+
        hljs.highlightBlock(aCodes[i]);
+
    }
+
};
+
 
+
(function($) {
+
    $(document).ready(function() {
+
        $('pre').each(function(i, e) {
+
            hljs.highlightBlock(e)
+
        });
+
    });
+
}(jQuery));
+
 
+
 
+
 
+
//hljs.configure({tabReplace: '    '});
+
hljs.initHighlightingOnLoad();
+
*/
+

Текущая версия на 20:10, 23 декабря 2014

/* Дополнительные кнопки в WikiEditor */
importScript( 'MediaWiki:Common.js/extra-buttons.js' );

/* Код отслеживания Google Analytics */
importScript( 'MediaWiki:Common.js/ga.js' );

/* Код отслеживания Yandex.Metrika */
importScript( 'MediaWiki:Common.js/ym.js' );