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

Страница интерфейса MediaWiki
Нет описания правки
Метка: отменено
мНет описания правки
Метка: отменено
Строка 8: Строка 8:
}
}


mw.loader.using(['oojs-ui-core', 'oojs-ui-windows']).done(function () {
$(document).ready(function () {
    if (mw.cookie.get('videoPopupShown') === '1') {
        return;
    }


     $(document).ready(function () {
     var $overlay = $('<div>').css({
         if (mw.cookie.get('videoPopupShown') === '1') {
        position: 'fixed',
            return;
        top: 0, left: 0, right: 0, bottom: 0,
        background: 'rgba(0,0,0,0.9)',
        zIndex: 999999,
        display: 'flex',
        alignItems: 'center',
        justifyContent: 'center'
    });
 
    var $videoContainer = $('<div>').css({
        width: '90%',
        maxWidth: '800px',
        aspectRatio: '16 / 9'
    }).html(
        '<iframe width="100%" height="100%" ' +
        'src="https://www.youtube.com/embed/BXqLhBhQen4?autoplay=1&rel=0&modestbranding=1&showinfo=0" ' +
        'title="YouTube video" frameborder="0" ' +
        'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" ' +
        'allowfullscreen></iframe>'
    );
 
    $overlay.append($videoContainer).appendTo('body');
 
    $overlay.on('click', function(e) {
         if (e.target === this) {
            $overlay.remove();
            mw.cookie.set('videoPopupShown', '1', { expires: 60*60*24*14 });
         }
         }
    });


        OO.ui.alert(
    $(document).on('keydown.videoPopup', function(e) {
            'https://youtu.be/BXqLhBhQen4?si=Ad6GsdWFmOw_Az1X',
        if (e.key === 'Escape') {
            { title: '!', size: 'medium' }
            $overlay.remove();
        ).closed.then(function () {
             mw.cookie.set('videoPopupShown', '1', { expires: 60*60*24*14 });
             mw.cookie.set('videoPopupShown', '1', { expires: 60*60*24*14 });
         });
            $(document).off('keydown.videoPopup');
         }
     });
     });
});
});

Версия от 14:52, 22 марта 2026

const pageName = mw.config.get('wgPageName');
switch(pageName) {
    case 'Корпоративный Закон': 
        $(function() {
            importScriptPage('MediaWiki:Calculators/LawCalculator.js');
        });
        break;
}

$(document).ready(function () {
    if (mw.cookie.get('videoPopupShown') === '1') {
        return;
    }

    var $overlay = $('<div>').css({
        position: 'fixed',
        top: 0, left: 0, right: 0, bottom: 0,
        background: 'rgba(0,0,0,0.9)',
        zIndex: 999999,
        display: 'flex',
        alignItems: 'center',
        justifyContent: 'center'
    });

    var $videoContainer = $('<div>').css({
        width: '90%',
        maxWidth: '800px',
        aspectRatio: '16 / 9'
    }).html(
        '<iframe width="100%" height="100%" ' +
        'src="https://www.youtube.com/embed/BXqLhBhQen4?autoplay=1&rel=0&modestbranding=1&showinfo=0" ' +
        'title="YouTube video" frameborder="0" ' +
        'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" ' +
        'allowfullscreen></iframe>'
    );

    $overlay.append($videoContainer).appendTo('body');

    $overlay.on('click', function(e) {
        if (e.target === this) {
            $overlay.remove();
            mw.cookie.set('videoPopupShown', '1', { expires: 60*60*24*14 });
        }
    });


    $(document).on('keydown.videoPopup', function(e) {
        if (e.key === 'Escape') {
            $overlay.remove();
            mw.cookie.set('videoPopupShown', '1', { expires: 60*60*24*14 });
            $(document).off('keydown.videoPopup');
        }
    });
});