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

Материал из Народного Брифли
Перейти к:навигация, поиск
Нет описания правки
Нет описания правки
 
Строка 1: Строка 1:
function inject(url) {
function inject(url) {
    const script = document.createElement("script");
  var script = document.createElement("script");
    script.src = url;
  script.src = url;
    document.head.appendChild(script);
  script.defer = true;
  document.head.appendChild(script);
}
}
/* 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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-253409-3', 'auto');
ga('send', 'pageview');


/* Google Analytics v4 */
/* Google Analytics v4 */
inject('https://www.googletagmanager.com/gtag/js?id=G-68CNGJ9RVG');
window.dataLayer = [];
window.gtag = function() {
  window.dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "G-68CNGJ9RVG");
inject("https://www.googletagmanager.com/gtag/js?id=G-68CNGJ9RVG");


window.dataLayer = window.dataLayer || [];
/* Yandex Metrika */
 
window.ym = function () {
function gtag() {
  ym.a.push(arguments);
    dataLayer.push(arguments);
};
}
ym.a = [];
ym.l = Date.now();
ym(97541317, "init", {
  clickmap: true,
  trackLinks: true,
  accurateTrackBounce: true
});
inject("https://mc.yandex.ru/metrika/tag.js");


gtag('js', new Date());
gtag('config', 'G-68CNGJ9RVG');





Текущая версия от 12:21, 11 июня 2024

function inject(url) {
  var script = document.createElement("script");
  script.src = url;
  script.defer = true;
  document.head.appendChild(script);
}

/* Google Analytics v4 */
window.dataLayer = [];
window.gtag = function() {
  window.dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "G-68CNGJ9RVG");
inject("https://www.googletagmanager.com/gtag/js?id=G-68CNGJ9RVG");

/* Yandex Metrika */
window.ym = function () {
  ym.a.push(arguments);
};
ym.a = [];
ym.l = Date.now();
ym(97541317, "init", {
  clickmap: true,
  trackLinks: true,
  accurateTrackBounce: true
});
inject("https://mc.yandex.ru/metrika/tag.js");




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