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

Материал из Space Station 14 Вики
мНет описания правки
мНет описания правки
Строка 1: Строка 1:
function test() {
function kerisar() {
console.log("test");
console.log("Проверка консоли");
alert("Проверка алерта");
const body = document.getElementById("bodyContent");
const firstBodyChild = body.firstChild;
console.log(body);
console.log(firstBodyChild);
}
}


window.onload = function() {
window.onload = function() {
    test();
const currentUrl = window.location.href;
     console.log("window.location.href", window.location.href);
     console.log("currentUrl", currentUrl);
     console.log("document.URL", document.URL);
     if (currentUrl.includes("Kerisar")) {
    kerisar();
    }
};
};



Версия от 20:07, 18 июня 2024

function kerisar() {
	console.log("Проверка консоли");
	alert("Проверка алерта");
	const body = document.getElementById("bodyContent");
	const firstBodyChild = body.firstChild;
	
	console.log(body);
	console.log(firstBodyChild);
}

window.onload = function() {
	const currentUrl = window.location.href;
    console.log("currentUrl", currentUrl);
    if (currentUrl.includes("Kerisar")) {
    	kerisar();
    }
};


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