|
|
(не показаны 4 промежуточные версии этого же участника) |
Строка 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: {
| + | |
− | "quotes": {
| + | |
− | label: 'Кавычки',
| + | |
− | type: 'button',
| + | |
− | icon: '//upload.wikimedia.org/wikipedia/commons/a/ac/Norwegian_quote_sign.png',
| + | |
− | action: {
| + | |
− | type: 'encapsulate',
| + | |
− | options: {
| + | |
− | pre: "«",
| + | |
− | post: "»"
| + | |
− | }
| + | |
− | }
| + | |
− | }
| + | |
− | }
| + | |
− | });
| + | |
− | $('#wpTextbox1').wikiEditor('addToToolbar', {
| + | |
− | 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: {
| + | |
− | "code": {
| + | |
− | label: 'Code',
| + | |
− | type: 'button',
| + | |
− | icon: '//upload.wikimedia.org/wikipedia/commons/6/62/Toolbar_code.png',
| + | |
− | action: {
| + | |
− | type: 'encapsulate',
| + | |
− | options: {
| + | |
− | pre: "<code>",
| + | |
− | post: "</code>"
| + | |
− | }
| + | |
− | }
| + | |
− | }
| + | |
− | }
| + | |
− | });
| + | |
− | $('#wpTextbox1').wikiEditor('addToToolbar', {
| + | |
− | section: 'advanced',
| + | |
− | group: 'format',
| + | |
− | tools: {
| + | |
− | "pre": {
| + | |
− | label: 'Pre',
| + | |
− | type: 'button',
| + | |
− | icon: '//upload.wikimedia.org/wikipedia/commons/b/b9/Toolbar_pre_vector.png',
| + | |
− | action: {
| + | |
− | type: 'encapsulate',
| + | |
− | options: {
| + | |
− | pre: "<pre>",
| + | |
− | post: "</pre>"
| + | |
− | }
| + | |
− | }
| + | |
− | }
| + | |
− | }
| + | |
− | });
| + | |
− | $('#wpTextbox1').wikiEditor('addToToolbar', {
| + | |
− | section: 'advanced',
| + | |
− | group: 'format',
| + | |
− | tools: {
| + | |
− | "template": {
| + | |
− | label: 'Шаблон',
| + | |
− | type: 'button',
| + | |
− | icon: '//upload.wikimedia.org/wikipedia/commons/d/dd/Vector_toolbar_template_button.png',
| + | |
− | action: {
| + | |
− | type: 'encapsulate',
| + | |
− | options: {
| + | |
− | pre: "{{",
| + | |
− | post: "}}"
| + | |
− | }
| + | |
− | }
| + | |
− | }
| + | |
− | }
| + | |
− | });
| + | |
− | $('#wpTextbox1').wikiEditor('addToToolbar', {
| + | |
− | section: 'advanced',
| + | |
− | group: 'insert',
| + | |
− | tools: {
| + | |
− | "refs": {
| + | |
− | label: 'Примечания',
| + | |
− | type: 'button',
| + | |
− | icon: '//upload.wikimedia.org/wikipedia/commons/c/cf/Toolbar_insert_reference.png',
| + | |
− | action: {
| + | |
− | type: 'encapsulate',
| + | |
− | options: {
| + | |
− | pre: "<references />"
| + | |
− | }
| + | |
− | }
| + | |
− | }
| + | |
− | }
| + | |
− | });
| + | |
− | };
| + | |
− |
| + | |
− | /* 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 );
| + | |
− | });
| + | |
− | }
| + | |
− | });
| + | |
− | }
| + | |
| | | |
− | /* Добавление дополнительных кнопок в WikiEditor на страницах LiquidThreads' */
| + | /* Код отслеживания Yandex.Metrika */ |
− | mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );
| + | importScript( 'MediaWiki:Common.js/ym.js' ); |
− | | + | |
− | | + | |
− | | + | |
− | /* Код отслеживания Google Analytics */ | + | |
− | (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | + | |
− | (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
| + | |
− | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
| + | |
− | })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
| + | |
− | ga('create', 'UA-26921269-3', 'psylab.info');
| + | |
− | ga('require', 'displayfeatures');
| + | |
− | ga('send', 'pageview');
| + | |