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

Материал из Русского эксперта
Перейти к навигации Перейти к поиску
Нет описания правки
Нет описания правки
Строка 33: Строка 33:
         }
         }
     } );
     } );
}
};


/*************************/
/*************************/

Версия от 17:48, 20 июня 2023

/*WikiEditor/Викификатор*/
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
    mw.loader.load( '//ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-wikificator.js&action=raw&ctype=text/javascript' );
}

var customizeToolbar = function() {
    
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'group': 'format',
        'tools': {
            'wikify': {
                label: 'Викификатор',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/0/06/Wikify-toolbutton.png',
                action: {
                    type: 'callback',
                    execute: function(context){
                        Wikify();
                    }
                }
            }
        }
    } );
};

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 );
            } );
        }
    } );
};

/*************************/
/* Реклама Яндекс Директ */
/*************************/



let path = window.location.pathname;
if(path.indexOf(":") === -1 && path.indexOf("=") === -1){

/* Блок 1 */

(function() {
 $('#top').after('<div id="yandex_rtb_R-A-446933-1"></div>');
})();

(function(w, d, n, s, t) {
w[n] = w[n] || [];
w[n].push(function() {
Ya.Context.AdvManager.render({
blockId: "R-A-446933-1",
renderTo: "yandex_rtb_R-A-446933-1",
async: true
});
});
t = d.getElementsByTagName("script")[0];
s = d.createElement("script");
s.type = "text/javascript";
s.src = "//an.yandex.ru/system/context.js";
s.async = true;
t.parentNode.insertBefore(s, t);
})(this, this.document, "yandexContextAsyncCallbacks");

/* Блок 2 */

(function() {
 $('#mw-content-text').after('<div id="yandex_rtb_R-A-446933-2"></div>');
})();

(function(w, d, n, s, t) {
w[n] = w[n] || [];
w[n].push(function() {
Ya.Context.AdvManager.render({
blockId: "R-A-446933-2",
renderTo: "yandex_rtb_R-A-446933-2",
async: true
});
});
t = d.getElementsByTagName("script")[0];
s = d.createElement("script");
s.type = "text/javascript";
s.src = "//an.yandex.ru/system/context.js";
s.async = true;
t.parentNode.insertBefore(s, t);
})(this, this.document, "yandexContextAsyncCallbacks");

}