Война в Украине

Все мы знаем, какой пиздец сейчас происходит с Украиной и одной известной вам страной-победительницей-фашизма. Если вы хотите почитать об этом, помочь актуализировать информацию или высказать свое мнение — можете сделать это в статье Война в Украине и в обсуждении.

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

Материал из Urbanculture
Перейти к: навигация, поиск
 
(не показаны 122 промежуточные версии 2 участников)
Строка 1: Строка 1:
 
/** Misc common defines ****/
 
/** Misc common defines ****/
  
/** Frame ***
 
function frame_resize(){
 
    document.getElementById('frame').width='100%';
 
    document.getElementById('frame').height=document.getElementById('frame').contentWindow.document.body.scrollHeight;
 
}
 
*/
 
  
 
/* Неоднократно нужные проверки: */
 
/* Неоднократно нужные проверки: */
Строка 12: Строка 6:
 
/*** _is_editable - у меня есть права на правку текущей страницы? */
 
/*** _is_editable - у меня есть права на правку текущей страницы? */
 
/*** _is_autoconfirmed  */
 
/*** _is_autoconfirmed  */
var _is_editpage = wgAction == 'edit' || wgAction == 'submit';
+
var _is_editpage = mw.config.get('wgAction') == 'edit' || mw.config.get('wgAction') == 'submit';
 
var _is_editable = (function isEditable() {
 
var _is_editable = (function isEditable() {
var restrict = (typeof wgRestrictionEdit !== 'undefined'?wgRestrictionEdit:wgRestrictionCreate);
+
    var restrict = mw.config.get('wgRestrictionEdit') || [], g;
     if (restrict.length < 1) return true;
+
     if (restrict.length < 1) { return true; }
     if (!wgUserGroups) return false;
+
     if (!mw.config.get('wgUserGroups')) { return false; }
     for(var g=0; g<wgUserGroups.length; g++) if ($.inArray(wgUserGroups[g], restrict)!=-1) return true;
+
     for (g = 0; g < mw.config.get('wgUserGroups').length; g++) { if ($.inArray(mw.config.get('wgUserGroups')[g], restrict) != -1) { return true; } }
 
     return false;
 
     return false;
})();
+
}());
var _is_autoconfirmed = wgUserGroups && ($.inArray('autoconfirmed', wgUserGroups) != -1);
+
var _is_autoconfirmed = mw.config.get('wgUserGroups') && ($.inArray('autoconfirmed', mw.config.get('wgUserGroups')) != -1),
var f5s=('localStorage' in window) && window['localStorage']!==null ? window['localStorage'] : false;
+
    f5s = ('localStorage' in window) && window.localStorage !== null ? window.localStorage : false,
 +
    Queue
 +
    ;
 
/** /Misc common defines ****/
 
/** /Misc common defines ****/
 
  
 
/** Processing queue ****/
 
/** Processing queue ****/
  
/**** Queue.addOnce(function(){}, condition = true) - adds function to run once on page load */
+
/**** Queue.addOnce(function(){}, condition = true) - adds a function to run once on page load */
 +
/**** Queue.addOnce('module.name', [function(){} | function name string string], condition = true) - loads a module and adds a function to run once on page load */
 
/**** Queue.addEachFragment(function(scope){}, condtion = true) - adds function to run on page load AND on each AJAX loaded fragment */
 
/**** Queue.addEachFragment(function(scope){}, condtion = true) - adds function to run on page load AND on each AJAX loaded fragment */
 +
/**** Queue.addEachFragment('module.name', [function(scope){} | function name string string], condtion = true) - loads a module and adds function to run on page load AND on each AJAX loaded fragment */
 
/****    Function must take a single parameter - currently processed fragment */
 
/****    Function must take a single parameter - currently processed fragment */
 
/**** Both functions take optional second parameter - if false, function won't be run on current page */
 
/**** Both functions take optional second parameter - if false, function won't be run on current page */
Строка 34: Строка 31:
 
/**** Queue.runEachFragment(scope) - scope can be an html element or array of elements */
 
/**** Queue.runEachFragment(scope) - scope can be an html element or array of elements */
  
var Queue = {
+
mw.loader.using('UC.queue', function () {
    _once: [],
+
    _each: [],
+
    addOnce: function(f, pre) { if (pre !== false) this._once.push(f); return this; },
+
    addEachFragment: function(f, pre) { if (pre !== false) this._each.push(f); return this; },
+
  
     runOnce: function() {
+
     Queue.addOnce(function () {
         $.each(this._once, function(i, f) { f() })
+
         $('.boxes a').each(function () {
        return this;
+
            var parentalt = $(this).parent().attr('title');
    },
+
            $(this).attr('alt', parentalt);
    runEachFragment: function(sc) {
+
            if ($(this).parent().hasClass('menuicon')) {
        var que = this._each, sc = sc || document;
+
                $(this).html('<span class="glyphicon"></span>')
 +
            };
 +
        });
 +
    });
  
         $(sc).each(function(x, e) { $.each(que, function(i, f) { f(e) }) });
+
    /** Drafts save ****/
        return this;
+
    Queue.addOnce('UC.draftarticle', 'draftArticle', (
     }
+
         (!mw.config.get('wgCanonicalSpecialPageName') &&
};
+
            (
 +
                location.href.match(/&action=(?:edit|submit)/) !== null ||
 +
                mw.config.get('wgAction') == 'edit' ||
 +
                mw.config.get('wgAction') == 'submit'
 +
            ))
 +
     ));
  
addOnloadHook(function() { Queue.runOnce().runEachFragment(document); })
+
    /** Collapsible tables ****/
/** /Processing queue ****/
+
    // Используется в коллапсерах
 +
    Queue.addEachFragment('UC.tablecollapsers', 'createTableCollapsers', !mw.config.get('wgCanonicalSpecialPageName'));
 +
    Queue.addEachFragment('UC.tablecollapsers', 'createHiderButtons', !mw.config.get('wgCanonicalSpecialPageName'));
  
/** Collapsible tables ****/
+
    /** NSFW Gallery Items ****/
/* Description: Allows tables to be collapsed, showing only the header. */
+
    /* Description: Hides images with |NSFW in description from galleries */
/* Authors: rewrite by [[User:Tachikoma]] based on [[Wikipedia:NavFrame]] */
+
    /* Authors: [[User:Anotubus]], [[User:Obvious]] */
 +
    Queue.addEachFragment('UC.gallerymodify', 'processNSFWGalleryItems', !mw.config.get('wgCanonicalSpecialPageName'));
  
// Используется в коллапсерах
+
    /** Dynamic gallery ****/
var autoCollapse = 2;
+
    Queue.addEachFragment('UC.gallerymodify', 'dynamicGallery', !mw.config.get('wgCanonicalSpecialPageName'));
var collapseCaption = "скрыть";
+
var expandCaption = "показать";
+
  
function createTableCollapsers(scope) {
+
    /** Ajaxed *****/
 +
    Queue.addEachFragment('UC.ajaxed', 'ajaxed', !mw.config.get('wgCanonicalSpecialPageName'));
  
     function collapseTable(tbl) {
+
     /** Sidebar scroll *****/
         var rows = $('tr', tbl).not('tr:first')
+
    Queue.addOnce('jquery.slimscroll', function () {
        var btn = $('a.collapselink', tbl)
+
         if ($(window).width() > '980') {
 +
            $('#mw-panel').slimScroll({
 +
                color: '#ffffff',
 +
                distance: '3px'
 +
            });
 +
        };
  
         if (btn.text() == collapseCaption) {
+
         $('#toc > ul').slimScroll({
            rows.hide(); btn.text(expandCaption)
+
            color: '#333333',
        } else {
+
            distance: '3px',
            rows.show(); btn.text(collapseCaption)
+
            allowPageScroll: false
        }
+
         });
    }
+
 
+
    var autocollapse_count = 0;
+
    $('table.collapsible', scope).each(function(i, e) {
+
        var header = $('tr th:first', e)
+
        if (!header.size()) return;
+
 
+
        autocollapse_count++;
+
 
+
        var collapselink = $('<a href="#" class="collapselink"/>').text(collapseCaption)
+
        collapselink.click(function(ev) { ev.preventDefault(); collapseTable(e) })
+
 
+
        var collapsebutton = $('<span style="float:right; text-align:right; width:6em; font-weight:normal">[<a></a>]</span>')
+
        $('a', collapsebutton).replaceWith(collapselink)
+
 
+
         header.prepend(collapsebutton)
+
 
+
        if ($(e).hasClass('collapsed') || ( autocollapse_count >= autoCollapse && $(e).hasClass('autocollapsible'))) collapseTable(e)
+
 
     });
 
     });
};
 
  
Queue.addEachFragment( createTableCollapsers );
 
  
/** /Collapsible tables ****/
+
    /** Ref tooltips******************************************
 +
      *
 +
      * Description: Replace references with JQuery-based tooltips
 +
      * Made by:  Tachikoma
 +
      */
  
 +
    Queue.addOnce(function () {
 +
        $(window).click(function (e) {
 +
            if (!($(e.target).hasClass('areference') || $(e.target).parents().andSelf().hasClass('tooltip'))) {
 +
                $('.tooltip').hide(250); $('.curreference').removeClass('curreference');
 +
            }
 +
        });
 +
    }, !mw.config.get('wgCanonicalSpecialPageName')).addEachFragment(function (scope) {
 +
        var refs = $('ol.references', scope);
 +
        if (!refs.size()) { return; }
 +
        refs.before($('<a href="#">[показать примечания]</a>').click(function (e) { e.preventDefault(); refs.toggle(); })).hide();
 +
        $('.reference a', scope).click(function (e) {
 +
            e.preventDefault();
 +
            var x = $(this), iscurrent = x.hasClass('curreference'), i = $('.tooltip').hide(250),
 +
                par = x.parent(), o = par.offset(), l = o.left, t = o.top + 13,
 +
                b = $('body'), mh = b.height(), mw = b.width(),
 +
                c = $(x.attr('href'), refs).clone().find('a:first').remove().end().html();
 +
            $('.curreference').removeClass('curreference');
 +
            if (iscurrent) { return; }
  
/** Dynamic Navigation Bars (experimental) *************************************
+
            x.addClass('areference').addClass('curreference');
  *
+
            if (!i.size()) { i = $('<div/>').addClass('tooltip'); }
  *  Description: See [[Wikipedia:NavFrame]].
+
            i.appendTo(b).queue(function () {
  * Authors: rewrite by [[User:Tachikoma]] based on [[Wikipedia:NavFrame]]
+
                i.empty().append(c).css({ 'left': l - ((l + i.width() >= mw) && i.width()), 'top': t - ((t + i.height() >= mh) && (i.height() + 26)) }).dequeue();
  */
+
            }).show(250);
 +
        });
 +
    }, !mw.config.get('wgCanonicalSpecialPageName'));
  
  function createHiderButtons(scope) {
+
    /** Morph LM Edition **************************************/
      // set up the words in your language
+
    Queue.addEachFragment('UC.morphobjects', 'createMorphObjects', !mw.config.get('wgCanonicalSpecialPageName'));
      var NavigationBarHide = '[' + collapseCaption + ']';
+
      var NavigationBarShow = '[' + expandCaption + ']';
+
  
     $('div.NavFrame', scope).each(function(i, e) {
+
     /** Pre lines******************************************
        var _ = $(this), head = _.children('.NavHead')
+
      *
 +
      *  Description: add lines to <pre> tags
 +
      *  Made by: Munhgauzen
 +
      */
  
        if(!head.size()) return;
+
     Queue.addOnce(function () {
 
+
        $('pre').each(function () {
        var shown = true;
+
             var rows_count = Math.round($(this).height() / parseInt($(this).css('line-height')));
        var NavToggle = $('<a href="#"></a>').text(NavigationBarHide)
+
             var $pre = $(this);
 
+
             var html = $pre.html();
        function toggle() {
+
             var nl = /\n|\r|\r\n/g;
            shown = !shown;
+
            $pre.html(('\n' + html).replace(nl, '</div><div class="row">'));
            if(shown) {
+
                _.children('.NavContent').show(); _.children('.NavPic').show(); NavToggle.text(NavigationBarHide)
+
            } else {
+
                _.children('.NavContent').hide(); _.children('.NavPic').hide(); NavToggle.text(NavigationBarShow)
+
            };
+
        }
+
 
+
        NavToggle.click(function(ev) { ev.preventDefault(); toggle(); })
+
        head.append(NavToggle);
+
 
+
        if($(this).hasClass('NavHideByDefault')) toggle();
+
     })
+
  }
+
 
+
Queue.addEachFragment( createHiderButtons );
+
 
+
/** /Dynamic Navigation Bars ****/
+
 
+
 
+
/** NSFW Gallery Items ****/
+
/* Description: Hides images with |NSFW in description from galleries */
+
/* Authors: [[User:Anotubus]], [[User:Obvious]] */
+
 
+
function processNSFWGalleryItems(scope) {
+
    $('div.gallerytext', scope).each(function(i, el) {
+
        var descP = $('p:first', el)
+
        if (!descP.size()) return;
+
 
+
        var desc = descP.html()
+
        if (desc.match(/(?:\|NSFW|NSFW\||^NSFW\s$)/i)) {
+
            descP.html(desc.replace(/(.*)(?:\|NSFW|NSFW\||^NSFW\s$)(.*)/i,'$1$2'));
+
             var NSFWFrame = $(el).parent().find('div:first')
+
            NSFWFrame.children().css('visibility', 'hidden')
+
            NSFWFrame.css({'background':'url(/skins/common/images/nsfw.png) no-repeat center center', 'cursor':'pointer'})
+
            NSFWFrame.click(function(e) {
+
                NSFWFrame.css({'background':'none', 'cursor':'default'})
+
                NSFWFrame.children().css('visibility', 'visible')
+
            })
+
        }
+
    })
+
};
+
 
+
Queue.addEachFragment(processNSFWGalleryItems);
+
 
+
/** /NSFW Gallery Items ****/
+
 
+
 
+
/** 0sectionedit ****/
+
function Sect0Edit(){
+
  var editlink = $("#ca-edit a")
+
  if (!editlink.size()) return;
+
  var spansect0span = $('<span class="editsection">[<a>править</a>]</span>')
+
  $('a', spansect0span).attr('href', editlink.attr('href')+"&section=0")
+
  $(".firstHeading").append(spansect0span)
+
};
+
 
+
Queue.addOnce(Sect0Edit, wgIsArticle == true && skin!='impetus')
+
/** /0sectionedit ****/
+
 
+
/** Morph LM Edition *************************************
+
  *
+
  *  Description: слайдер скрытого контента
+
  *  Stolen^W Made by:  hikki-zadrot, Tachikoma, Anotubus
+
  */
+
 
+
function createMorphObjects(scope) {
+
    $('.morphcontainer', scope).each(function() {
+
        var _this = this, all = $('*', this)
+
 
+
        var containers = $('* .morphcontainer', this);
+
        containers.each(function() { all = all.not($('*', this)) })
+
 
+
        var morphlinks = all.filter('.morphlink')
+
        var morphcontents = all.filter('.morphcontent')
+
        var morphlink_hilight = $(_this).children('.morphlink_hilight').size()? $(_this).children('.morphlink_hilight').eq(0).attr('style'):'color:blue; text-decoration:underline; cursor: pointer;',
+
            morphlink_default = $(_this).children('.morphlink_default').size()? $(_this).children('.morphlink_default').eq(0).attr('style'):'color:blue; cursor: pointer;',
+
             selmethod = $(_this).hasClass('hover') ? 'mouseover' : 'click',
+
            currentsel = 0;
+
        $(morphcontents).hide();
+
        $(_this).children('.morphlink_hilight, .morphlink_default').remove();
+
        $(morphlinks).attr('style', morphlink_default).each(function(i, e) {
+
             var assocmorphcontents = $('');
+
             if ($(_this).hasClass('manualsort')) {
+
                var morphlinkers = $(e).attr('class').replace(/(.*)morphlink(.*)/, '$1$2').match(/morph\S+/g);
+
                for (x in morphlinkers)
+
                assocmorphcontents = $(assocmorphcontents).add($(morphcontents).filter('.' + morphlinkers[x]));
+
            } else {
+
                assocmorphcontents = $(assocmorphcontents).add($(morphcontents).eq(i));
+
            }
+
            $(e).bind(selmethod, function() {
+
                $(morphlinks).attr('style', morphlink_default);
+
                $(e).attr('style', morphlink_hilight);
+
                $(morphcontents).hide();
+
                $(assocmorphcontents).show();
+
                currentsel = i;
+
            });
+
 
         });
 
         });
        all.filter('.morphprev, .morphnext').click(function() {
 
            var totrigger = $(this).hasClass('morphprev') ? (currentsel - 1) : ((currentsel + 1));
 
            if (totrigger < 0) totrigger = morphlinks.size() - 1;
 
            if (totrigger > morphlinks.size() - 1) totrigger = 0;
 
            $(morphlinks).eq(totrigger).triggerHandler(selmethod);
 
        });
 
        $(morphlinks).eq(currentsel).triggerHandler(selmethod);
 
 
     });
 
     });
}
 
  
Queue.addEachFragment(createMorphObjects);
+
    /** Linkchecker ***/
 +
    function linkchecker(scope) {
 +
        $('.linkchecker', scope).each(function (i, e) {
 +
            var lc_if = $(".linkcheckerif a", this),
 +
                lc_then = $(".linkcheckerthen", this),
 +
                lc_else = $(".linkcheckerelse", this)
 +
                ;
  
/** /Morph LM Edition ****/
+
            if (lc_if.size() && lc_then.size()) {
 +
                if (lc_if.hasClass('new')) { lc_then.hide(); } else { lc_else.hide(); }
 +
                lc_if.parent().hide();
 +
            } else { $(this).hide(); }
 +
        });
 +
    }
 +
    Queue.addEachFragment(linkchecker, !mw.config.get('wgCanonicalSpecialPageName'));
  
/** Tabbed Edittools *************************************
+
    /** ShortDiffURL ****/
  *
+
    Queue.addOnce(function shortdiffurl() {
  * Description: Делает из таблицы edittools страницы с табами.
+
        if (!mw.config.get('wgCanonicalSpecialPageName') && window.location.href.indexOf("diff=") != '-1' && $("#ca-history").size() > 0) {
  * Made by:  Tachikoma, Anotubus
+
            $("#ca-history").after('<li id="ca-diff" class="collapsible"><span><a href="' + location.href.replace(/^(.+\?).*&?(diff=(?:\d+|prev|next|curr)).*?(&oldid=\d+)?.*$/, "$1$2$3") + '" title="Короткая ссылка на дифф">Дифф</a></span></li>');
  */
+
        };
 +
    });
  
(function(){
+
    /** Needed page **/
var TabSwitchTimer = null
+
    Queue.addOnce(function () {
var TabSwitchGlobState = 0
+
        $('.mw-redirect').addClass('neededpagerdrcts');
var MyEditTools = {
+
        $('ul').addClass('neededpagelist');
 +
    }, !mw.config.get('wgCanonicalSpecialPageName') && mw.config.get('wgPageName') == 'Urbanculture:R');
  
updateFirstVisible: function() {
+
    /** Image Categorizer  ************************************* */
$('.first').removeClass('first'); $("#editpage-specialchars table tr:visible").eq(0).addClass('first')
+
    /** Author: Anotubus  */
},
+
    /* if ( (mw.config.get( 'wgCanonicalNamespace' ) == 'File' || mw.config.get( 'wgNamespaceNumber' ) == 6) && _is_autoconfirmed && _is_editable ) importScriptURI("/skins/common/imgcat.js");*/
  
setAll: function(t) {
 
var rows = $('#editpage-specialchars table tr'), sw = $("#switcher div")
 
if (t) {
 
var cl = t>0?"visible":"hidden"; rows.each(function(i) { if (!TabSwitchGlobState) $(this).data('prevstate', this.className); this.className = cl })
 
var cl = t>0?"fixed":""; sw.each(function(i) { if (!TabSwitchGlobState) $(this).data('prevstate', this.className); this.className = cl })
 
} else {
 
rows.each(function(i) { this.className = $(this).data('prevstate') || '' })
 
sw.each(function(i) { this.className = $(this).data('prevstate') || '' })
 
}
 
TabSwitchGlobState = t
 
$('#pageShowAll').attr('class', t > 0 ? 'swon' : 'swoff'); $('#pageHideAll').attr('class', t < 0 ? 'swon' : 'swoff')
 
MyEditTools.updateFirstVisible()
 
},
 
  
clearTimer: function() {
+
    /** Section menus ****************************************** */
if (TabSwitchTimer) { window.clearTimeout(TabSwitchTimer); TabSwitchTimer = null }
+
    /* Authors: [[User:Tachikoma]], [[User:T_kns]], [[User:Мопец Ципельман]] */
},
+
    window.excludedSectionHeaders = $('.c-comment :header');
 +
    Queue.addOnce('UC.sectionmenus', 'addSectionMenus', !mw.config.get('wgCanonicalSpecialPageName') && mw.config.get('skin') == 'vector');
  
clearSelected: function() {
 
$('#switcher div.selected').removeClass('selected')
 
$('#editpage-specialchars table tr.selected').removeClass('visible').addClass('hidden').removeClass('selected')
 
},
 
  
init: function() {
+
    /** collapsibledivs *****/
if (!$('#editpage-specialchars').size()) return
+
    Queue.addOnce('UC.collapsiblesidebar', 'collapsibleSideBar', f5s && mw.config.get('skin') == 'vector');
  
$('#editpage-specialchars').css('border', "none")
+
     /* empty pagename ****/
 
+
    Queue.addOnce(function () {
//var switcher = $('<div id="switcher"/>').insertBefore($("#editpage-specialchars table"))
+
         $('#bodySearch').submit(function (e) {
            var switcher = $('<caption style="text-align:left" id="switcher"/>').prependTo($("#editpage-specialchars table"));
+
             var wrap = $(this).children(".bodySearchWrap");
var rows = $("#editpage-specialchars table tr")
+
             if (/^\s*$/.test(wrap.children('#bodySearchInput').val())) {
rows.each(function(i) {
+
                if (wrap.children('.pagenameneeded').size() === 0) {
var id = "page"+i,td = $('td:first', this)
+
                    wrap.append($('<p class="pagenameneeded">Введите имя статьи</p>').delay(1500).fadeOut('slow', function () { $(this).remove(); }));
var row = $(this).attr('id', 'r'+id).addClass(i == 0 ? "visible" : "hidden").toggleClass("first", !i).toggleClass("selected",!i)
+
                 }
var sw = $('<div/>')
+
                 return false;
.attr("id", "sw"+id).html((td.html() || '').replace(/:/, ''))
+
.hover(function(e) {
+
MyEditTools.clearTimer()
+
if (sw.hasClass("fixed")) return
+
TabSwitchTimer = window.setTimeout(function() {
+
MyEditTools.clearSelected()
+
sw.addClass('selected'); row.addClass('selected').removeClass('hidden').addClass('visible')
+
MyEditTools.updateFirstVisible()
+
}, 50)
+
}, MyEditTools.clearTimer)
+
.click(function(e){
+
MyEditTools.clearTimer()
+
if (!sw.hasClass('fixed')) {
+
sw.removeClass("selected").addClass("fixed")
+
row.removeClass("selected").removeClass("hidden").addClass("visible")
+
} else {
+
MyEditTools.clearSelected()
+
sw.removeClass("fixed").addClass("selected")
+
}
+
MyEditTools.updateFirstVisible()
+
})
+
.appendTo(switcher)
+
.toggleClass("selected", !i)
+
})
+
 
+
with(switcher){
+
append($('<div id="pageHideAll" class="swoff">Hide All</div>').click(function() {
+
MyEditTools.clearTimer(); MyEditTools.setAll(TabSwitchGlobState<0?0:-1)
+
}))
+
append($('<div id="pageShowAll" class="swoff">Show All</div>').click(function() {
+
MyEditTools.clearTimer(); MyEditTools.setAll(TabSwitchGlobState>0?0:1)
+
}))
+
}
+
 
+
$('#toolbar').before($('.mw-editTools'))
+
}
+
}
+
 
+
     Queue.addOnce(MyEditTools.init);
+
})();
+
 
+
/** /Tabbed Edittools ****/
+
 
+
 
+
/** Ref tooltips******************************************
+
  *
+
  *  Description: Replace references with JQuery-based tooltips
+
  *  Made by:  Tachikoma
+
  */
+
 
+
Queue.addOnce(function() {
+
    $(window).click(function(e) {
+
         if (!($(e.target).hasClass('areference') || $(e.target).parents().andSelf().hasClass('tooltip'))) {
+
            $('.tooltip').hide(250); $('.curreference').removeClass('curreference')
+
        }
+
    })
+
}).addEachFragment(function(scope) {
+
    var refs = $('ol.references', scope)
+
    if (!refs.size()) return;
+
    refs.before($('<a href="#">[показать примечания]</a>').click(function(e) { e.preventDefault(); refs.toggle() } )).hide()
+
    $('.reference a', scope).click(function(e) {
+
        e.preventDefault();
+
        var x = $(this), iscurrent = x.hasClass('curreference'), i = $('.tooltip').hide(250)
+
        $('.curreference').removeClass('curreference');
+
        if (iscurrent) return;
+
 
+
        var par = x.parent(), o = par.offset(), l = o.left, t = o.top+13
+
        var b = $('body'), mh = b.height(), mw = b.width()
+
        var c=$(x.attr('href'), refs).clone().find('a:first').remove().end().html()
+
 
+
        x.addClass('areference').addClass('curreference')
+
        if (!i.size()) i = $('<div/>').addClass('tooltip')
+
        i.appendTo(b).queue(function() {
+
             i.empty().append(c).css({ 'left': l-((l+i.width() >= mw) && i.width()), 'top': t-((t+i.height() >= mh) && (i.height()+26)) }).dequeue()
+
        }).show(250)
+
    })
+
})
+
/** /Ref tooltips****************************************/
+
 
+
 
+
/** Linkchecker **********************************************************/
+
 
+
function linkchecker(scope) {
+
    $('.linkchecker', scope).each(function(i, e) {
+
        var lc_if = $(".linkcheckerif a", this)
+
        var lc_then = $(".linkcheckerthen", this)
+
        var lc_else = $(".linkcheckerelse", this)
+
 
+
        if (lc_if.size() && lc_then.size()) {
+
            if (lc_if.hasClass('new')) lc_then.hide(); else lc_else.hide();
+
             lc_if.parent().hide()
+
        } else $(this).hide()
+
    })
+
};
+
 
+
Queue.addEachFragment(linkchecker);
+
/** /Linkchecker ****/
+
 
+
 
+
/** ShortDiffURL ****/
+
function shortdiffurl() {
+
if ($("#ca-history").size() > 0 ){
+
$("#ca-history").after('<li><a href="'+location.href.replace(/^(.+\?).*&?(diff=(?:\d+|prev|next|curr)).*?(&oldid=\d+)?.*$/,"$1$2$3")+'" title="Короткая ссылка на дифф">url</a></li>');
+
}
+
};
+
 
+
Queue.addOnce(shortdiffurl, location.href.indexOf("diff=") != -1)
+
/** /ShortDiffURL ****/
+
 
+
 
+
/** Needed page **/
+
Queue.addOnce(function() {
+
      $('.mw-redirect').addClass('neededpagerdrcts');
+
      $('ul').addClass('neededpagelist');
+
}, wgPageName == 'Urbanculture:R')
+
/** /Needed page **/
+
 
+
/** Wikificator  ************************************* */
+
if (wgAction == "edit" || wgAction == "submit" || wgPageName == "Special:Upload") //scripts specific to editing pages
+
{
+
    importScriptURI("/skins/common/wikificator.js");
+
}
+
 
+
function wikification() {
+
    $('<button id="Wikifybutton" onclick="Wikify();" type="button">Викифицировать</button>').insertBefore($('#wpSave'));
+
    if(wgNamespaceNumber==-1 || wgNamespaceNumber==102) {$('#Wikifybutton').attr('disabled','disabled');}
+
    $('#editpage-copywarn').insertAfter('.editOptions');
+
}
+
Queue.addOnce(wikification);
+
/** /Wikificator  ************************************* */
+
 
+
 
+
/** Image Categorizer  ************************************* */
+
/** Author: Anotubus  */
+
if ( (wgCanonicalNamespace == 'File' || wgNamespaceNumber == 6) && _is_autoconfirmed && _is_editable ) importScriptURI("/skins/common/imgcat.js");
+
/** Image Categorizer  ************************************* */
+
 
+
 
+
/** Section menus ****************************************** */
+
/* Authors: [[User:Tachikoma]], [[User:T_kns]], [[User:Мопец Ципельман]] */
+
 
+
// SectionToolbar.addButton(function(elt, out) { var button = $(elt).find('something'); $(out).doAnythingWith(button); })
+
// SectionToolbar.appendButton(function(elt) { var button = $(elt).find('something'); return button; }
+
var SectionToolbar = {
+
    _buttons: [],
+
    addButton: function(fn) { this._buttons.push(fn); return this },
+
    appendButton: function(fn) { this._buttons.push(function(elt, out) { $(out).append(fn(elt)) }); return this },
+
    _run: function(elt, out) { var btn = this._buttons; for(var i in btn) btn[i](elt, out) }
+
}
+
 
+
function addSectionMenus() {
+
    if (!wgIsArticle) return;
+
 
+
    var editimg = '<img src="/skins/Impetus/pencil.png" width="16" height="16" alt="Править" title="Править"/>'
+
    var viewimg = '<img src="/skins/Impetus/magnifier.png" width="16" height="16" alt="Просмотр" title="Просмотр"/>'
+
 
+
    var new_header = $('<h1 class="firstHeading" id="firstHeading"></h1>')
+
    var headline = $('<span></span>').text($('#firstHeading').text()).appendTo(new_header)
+
    var toolbar = $('<div class="showmenu"/>').appendTo(new_header).hide()
+
    var toolsline = $('<div class="toolsline"/>')
+
    var headtext = $('<span class="headtext"/>').html(headline.html())
+
    var
+
        div = $('<div class="redact"/>'),
+
        link = $('<a/>').attr('href', wgScript+'?'+$.param({ title: wgPageName, action: 'edit', section: 0 }))
+
 
+
    $('.firstHeading').replaceWith(new_header);
+
    toolbar.append(toolsline.append(headtext).append(div.append(link.append(_is_editable ? editimg : viewimg))))
+
    $(toolbar).css({'position': 'fixed', 'left':0, 'top':0})
+
    $(new_header).hover(
+
        function() {
+
            var pos = headline.offset();
+
            toolbar.show().offset({left:pos.left-6, top:pos.top-6})
+
        }, function() { toolbar.hide() })
+
 
+
    $(':header:has(.mw-headline)').each(function(i, e) {
+
        var new_header = $(e).clone(true);
+
        new_header.children().remove(':not(.mw-headline)')
+
 
+
        var headline = $('.mw-headline', new_header)
+
        var toolbar = $('<div class="showmenu"/>').appendTo(new_header).hide()
+
        var toolsline = $('<div class="toolsline"/>')
+
        var headtext = $('<span class="headtext"/>').html(headline.html())
+
 
+
        toolsline.append(headtext)
+
 
+
        var original_link = $('.editsection a',e)
+
        if (original_link.size()) {
+
            var
+
                div = $('<div class="redact"/>'),
+
                link = $('<a/>').attr('href', $('.editsection a',e).attr('href'))
+
            toolsline.append(div.append(link.append(original_link.hasClass('viewlink')? viewimg : editimg)))
+
        }
+
        toolbar.append(toolsline)
+
 
+
        var buttons = $('<div class="buttons-line"/>').appendTo(toolsline)
+
        SectionToolbar._run(e, toolsline);
+
 
+
        $(e).replaceWith(new_header);
+
 
+
        toolbar.css({'position': 'fixed', 'left':0, 'top':0}).attr('rel','noClick');
+
 
+
        var timer;
+
        var interval;
+
        $(new_header).hover(
+
            function() {
+
                 if(toolbar.attr('rel') == 'hoverout') { clearInterval(interval); toolbar.attr('rel','hoverin');}
+
                 timer = setTimeout(function(){ var pos = headline.offset(); toolbar.show().offset({left:pos.left-6, top:pos.top-6}); }, 300);
+
            },
+
            function() {
+
                clearTimeout(timer);
+
                toolbar.attr('rel','hoverout');
+
                interval = setInterval(function(){ if(toolbar.attr('rel') == 'hoverout') {clearInterval(interval); toolbar.hide();} else {toolbar.attr('rel','hoverout');}}, 1000);
+
 
             }
 
             }
        )
 
 
         });
 
         });
     $(window).scroll(function(){$('.showmenu').hide()})
+
     }, !mw.config.get('wgCanonicalSpecialPageName') && mw.config.get('wgPageName') == "Urbanculture:Новая_статья");
}
+
  
SectionToolbar.addButton(function(elt, out) {
+
    /* b-yauser ****/
    var
+
    Queue.addEachFragment(function (sc) { $('.b-yauser a', sc).each(function (i) { $(this).html($(this).html().replace(/^([^<])/, '<b>$1</b>')); }); });
        div = $('<div class="shorturl" />'),
+
        input = $('<input class="shortlink" type="text" value="http://tinyurl.com/..." readonly="readonly" />').css('color', '#bbb').mousedown(function(e) {if(e.which == 3) {$(this).parent().parent().parent('.showmenu').attr('rel','rightClick');}}).hide(),
+
        url_out = $('<a href="#"><img src="/skins/Impetus/url_out.png" width="16" height="16" alt="TinyURL" title="TinyURL"></a>'),
+
        url_in = $('<a href="#"><img src="/skins/Impetus/url_in.png" width="16" height="16" alt="Внутренняя ссылка" title="Внутренняя ссылка"></a>')
+
  
  
     function gentlyEncode(string) {
+
     /* prettyPhoto ****/
        return ( encodeURIComponent
+
    Queue.addOnce('UC.prettyphotify', 'prettyPhotifyOptions', f5s && mw.config.get('wgCanonicalSpecialPageName') == 'Preferences');
        ? encodeURIComponent(string).replace(/%20(\D)?/g, "+$1").replace(/'/g, escape("'"))
+
     Queue.addEachFragment('UC.prettyphotify', 'prettyPhotify', f5s && localStorage.getItem('gallery_slideshow') != 'false');
        : escape(string).replace(/\+/g, "%2B").replace(/%20/g, "+") );
+
     }
+
    var href = /^([^#]+)#?.*$/.exec(location.href)[1]+'#'+$('.mw-headline',elt).attr('id')
+
  
     function getTinyLink(evt) {
+
     /* By ****/
         evt.preventDefault()
+
    Queue.addOnce(function () {
 +
         $('body').addClass('ns-talk');
 +
    }, !mw.config.get('wgCanonicalSpecialPageName') && mw.config.get('wgPageName') == "Urbanculture:Вниманию_участников");
  
        $.ajax({
+
    /* Spoilers ****/
            url:"http://json-tinyurl.appspot.com/?callback=?&url=" + gentlyEncode(href),
+
    Queue.addEachFragment(function (scope) {
            dataType: 'json',
+
        $('.spoiler', scope).click(function () {
            success: function(data) {
+
            $(this).toggleClass('spoilered');
                var tinyurl = data.tinyurl;
+
        });
                input.val(tinyurl).css('color', 'black').show().select()
+
    }, !mw.config.get('wgCanonicalSpecialPageName'));
                url_out.click(function(e) { e.preventDefault(); input.val(tinyurl).show().select() })
+
                url_out.attr('href', tinyurl)
+
            },
+
            error: function() {
+
                url_out.one('click', getTinyLink); input.val("http://tinyurl.com/... :(((").show()
+
            }
+
        })
+
    }
+
  
     url_out.one('click', getTinyLink)
+
     /* new gallerytemplate ****/
 +
    //Queue.addEachFragment('UC.newgallerytemplate', 'newGalleryTemplate', !mw.config.get( 'wgCanonicalSpecialPageName' ));
  
    var Url={decode:function(string){return this._utf8_decode(unescape(string));},_utf8_decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}return string;}}
 
    url_in.click(function(e) {
 
        e.preventDefault()
 
        input.val('[['+wgPageName.replace(/_/g, ' ')+'#'+Url.decode( $('.mw-headline',elt).attr('id').replace(/\.([0-9A-F]{2})/g, '%$1').replace(/_/g, ' ') )+']]').css('color', 'black').show().select()
 
    })
 
    url_in.attr('href', href)
 
  
     input.select().focus(function(e){ this.select() })
+
     /*** Resize textarea ***/
     $('.buttons-line', out).append(url_out).append(url_in)
+
    //Queue.addOnce('jquery.autoSizeTextArea', function () {
     $(out).append(div.append(input))
+
     //    $('#wpTextbox1').autoSizeTextArea();
})
+
    //    $(document).ready(function () {
 +
     //        $('#wpTextbox1').autoSizeTextArea('update')
 +
    //    });
 +
    //});
  
Queue.addOnce(addSectionMenus, skin=='impetus');
+
    /* LazyLoad EmbedVideo****/
/** /Section menus ***************************************** */
+
    Queue.addEachFragment(['ext.embedVideo', 'ext.embedVideo-lazy', 'ext.embedVideo-playpause'], 'embedVideoLazyLoad', !mw.config.get('wgCanonicalSpecialPageName'));
  
  
/** Autochange skin ***************************************** */
+
    /***********     Modern gallery Toggler    ***********/
function addcurskintolinks() {
+
    Queue.addEachFragment(function (sc) {
$('a:not([href*="useskin"])').each(function(i){
+
        const gallery = $('.combinedgallery, .videogallery', sc)
var hd = /^([^\#]*)(\#?.*)$/.exec($(this).attr('href'));
+
            ;
var h = hd[1];
+
        gallery.each(function () {
if (/^(?:\/|http:\/\/urbanculture\.in)/.test(h)) {
+
            var t = $(this),
h += (h.indexOf("?") == -1)?'?':'&';
+
                tElLength = t.data('line-elems'),
h += 'useskin=' + skin.toLowerCase();
+
                tElems = t.find('.gallery_content_block').length
$(this).attr('href',h+hd[2]);
+
                ;//console.log(t)
}
+
            if (tElems > tElLength) t.addClass('__hide_content');
});
+
        });
}
+
    }, !mw.config.get('wgCanonicalSpecialPageName'));
  
Queue.addOnce(addcurskintolinks, location.href.indexOf("useskin=") > 0)
+
    Queue.addOnce(function () {//console.log('Modern gallery Toggler addOnce', $(document))
/** /Autochange skin ***************************************** */
+
        $('body').on('click', '.gallery_toggle', function () {
 +
            var t = $(this),
 +
                tGall = t.closest('.combinedgallery, .videogallery')
 +
                ;//console.log(t)
 +
            tGall.toggleClass('__hide_content __show_content')
 +
        });
 +
    }, !mw.config.get('wgCanonicalSpecialPageName'))
  
  
/** collapsibledivs *****/
+
    /***********    /Modern gallery Toggler    ***********/
;(function(){
+
    function fromStorage() {
+
        var items = {};
+
        var saved = f5s && typeof localStorage.clpsd !== 'undefined' && localStorage.clpsd != null && localStorage.clpsd;
+
        if (saved) {
+
            if (saved.indexOf(':')!=-1) { saved = saved.replace(/(.+?):\d+/g, '$1'); localStorage.clpsd = saved; }
+
            $.each(saved.split('|'), function(i, e) { items[e] = true })
+
        }
+
        return items;
+
    }
+
    function toStorage(items) {
+
        var t = [];
+
        $.each(items, function(i, e) { if (e) t.push(i); })
+
  
        t = t.join('|').replace(/(?:^[\s\|]*|\|{2,}|[\s\|]*$)/g,'')
+
    /***********    Scale    ***********/
        if (t!='') localStorage.clpsd = t; else delete localStorage.clpsd;
+
    Queue.addOnce('UC.scalemap', 'scaleMap', f5s && mw.config.get('skin') == 'vector');
     }
+
     /***********    /Scale    ***********/
  
     var saved = fromStorage();
+
     /*** define the functions, that will be ran on each Comments display refresh ***/
 +
    window.commentJSrunMultiHooks = function (scope) { };
  
 +
});
  
    function togglest(th) {
+
/** /Processing queue ****/
        saved[th.attr('id')] = !(saved[th.attr('id')] === true);
+
        th.children('.pBody').slideToggle();
+
        th.children('h5').attr('class',(saved[th.attr('id')]===true)?'portlet-title-minimized':'portlet-title-maximized');
+
        toStorage(saved);
+
    }
+
  
    function maxiorminiicon(cur) {
 
        return (cur)?'/skins/common/images/Maximize.png':'/skins/common/images/Minimize.png';
 
    }
 
  
    function maxiorminiclass(cur) {
+
/*** Scroll menu ***/
        return (cur)?'maximinibutton maximinibutton-minimized':'maximinibutton maximinibutton-maximized';
+
    }
+
 
+
    function minimizediv(o, tdv, save) {
+
        tdv.slideToggle('fast');
+
        var itval = o.attr('src').indexOf('Maximize')==-1;
+
        o.attr('src',maxiorminiicon(itval));
+
        o.attr('class',maxiorminiclass(itval));
+
 
+
        if (save && f5s) {
+
            var id1 = tdv.attr('id').replace(/\:/g,' ');
+
            saved[id1] = itval;
+
  
             toStorage(saved)
+
var scrollmenu = false;
 +
$(document).ready(function () {
 +
    var windowWidth = $(window).width();
 +
    $(document).scroll(function () {
 +
        if ((scrollmenu == false) && ($(window).scrollTop() > 112) && ($(window).height() > 900) && ($('#content').outerHeight() > 950) && (mw.config.get('skin') == 'vector')) {
 +
             $(".editbox").css('position', 'fixed');
 +
            $(".editbox").css('top', '0');
 +
            scrollmenu = true;
 +
        } else if ((scrollmenu === true) && ($(window).scrollTop() < 113)) {
 +
            $(".editbox").css('position', 'absolute');
 +
            $(".editbox").css('top', '');
 +
            scrollmenu = false;
 
         }
 
         }
     }
+
     });
 +
});
  
    Queue.addOnce(function() {
+
/*** /Scroll menu ***/
        $('div.collapsiblediv').each(function(i) {
+
            var _this = $(this), id = _this.attr('id');
+
            var save = !(id === undefined || id.length == 0)
+
            if(save) id = id.replace(/\:/g,' ');
+
            var itval = save && saved && saved[id] === true;
+
  
            var img = $('<img alt="_"></img>').attr('src', maxiorminiicon(itval)).attr('class',maxiorminiclass(itval)).click(function(){minimizediv(img, _this, save); return false;})
+
/*** Title page ***/
            $(this).before($('<div class="maximinipanel"></div>').append(img));
+
$('#write-article a').click(function () {
 
+
    $(this).hide();
            if (itval) $(this).hide();
+
     $('#create-page-lay').fadeIn();
        });
+
    $('#create-page-lay .createboxInput').focus();
     })
+
    $("#create-page-lay .createboxInput").focusout(function () {
 
+
        if ($(this).val() === "") {
    Queue.addOnce(function() {
+
            $('#create-page-lay').hide();
        $('div.portlet').each(function() {
+
             $('#write-article a').fadeIn();
            if($.inArray($(this).attr('id'),['p-categories','p-navigation','p-tb','p-lang','p-Autors']) != -1) {
+
                var _this = $(this);
+
                $('h5',this).css('cursor','pointer').click(function(){togglest(_this);return false;});
+
                if(saved[$(this).attr('id')] === true) {$('.pBody',this).hide();$('h5',this).attr('class','portlet-title-minimized');} else {$('h5',this).attr('class','portlet-title-maximized');}
+
             }
+
        });
+
    },skin != 'impetusmobile');
+
 
+
})()
+
/** /collapsibledivs ****/
+
 
+
/* empty pagename ****/
+
Queue.addOnce(function() {
+
    $('#bodySearch').submit(function(e) {
+
        var wrap = $(this).children(".bodySearchWrap")
+
        if(/^\s*$/.test(wrap.children('#bodySearchInput').val())) {
+
            if(wrap.children('.pagenameneeded').size() == 0) {
+
                wrap.append($('<p class="pagenameneeded">Введите имя статьи</p>').delay(1500).fadeOut('slow',function() {$(this).remove();}));
+
            }
+
            return false;
+
 
         }
 
         }
 
     });
 
     });
}, wgPageName == "Urbanculture:Новая_статья");
+
    return false;
 +
});
  
/* /empty pagename ****/
+
/*** Blog page ***/
 
+
$(document).ready(function () {
/* b-yauser ****/
+
    $('div.news.old').first().before("<div id='oldnews'></div>");
Queue.addEachFragment(function(sc) { $('.b-yauser a', sc).each(function(i) { $(this).html($(this).html().replace(/^([^<])/,'<b>$1</b>')); }); });
+
    $('div.news.old').appendTo($('#oldnews'));
/* /b-yauser ****/
+
     $('#oldnews').after("<div id='showarchive'><a class='show-link' href='#' class='showarchive'><span>Показать архив</span></a><a class='hide-link' href='#' class='showarchive' style='display:none'><span>Скрыть архив</span></a></div>");
 
+
     $('#showarchive a').click(function () {
 
+
         if ($(this).hasClass('show-link')) {
/** Ajaxed ****
+
            $('#oldnews').fadeIn();
  *
+
            $(this).hide().siblings().show()
  *  Description: динамическая подгрузка произвольных страниц
+
                .stop();
  *  Authors: [[User:Tachikoma]], [[User:T_kns]]
+
        } else {
  */
+
             $('#oldnews').hide();
Queue.addEachFragment(function(scope) {
+
            $(this).hide().siblings().show()
     var placeholder = $('<div style="text-align:center;"><img src="/skins/common/images/ajax-loader.gif" alt="l" /></div>')
+
                .stop();
 
+
     $(".ajaxed", scope).each(function(i, links){
+
        var contcl = /\bajaxtarget(\S+?)(?:\s|$)/.exec(this.className)
+
        if(!contcl) return;
+
        contcl[1] = contcl[1].replace(/(:|\.|\\|\/)/g,'\\$1');
+
 
+
        var lastshown, add_hider = false;
+
         if($(this).hasClass('ajax_addhider')) { add_hider = $(".ajax_addhider.ajaxhide"+contcl[1], scope).eq(0); if(!add_hider.length) add_hider = false; }
+
        var target = $(".ajaxcont"+contcl[1], scope).eq(0)
+
 
+
        function show(cont, tgt) {
+
            if(lastshown == cont[0]) { if(!tgt.is(':visible')) tgt.show(); return };
+
 
+
            lastshown = cont[0]
+
 
+
            var d = cont.data('remote');
+
            if(!d) return;
+
 
+
             tgt.empty().append( d.clone() )
+
            if(add_hider)
+
                tgt.append( $('<div style="clear:both;"/>').append( add_hider.clone().click(function(e) { e.preventDefault(); target.toggle(); if ( window.pageYOffset > ($(links).offset().top+$(links).height())) $('html,body').animate({scrollTop:$(links).offset().top}, 350); })) );
+
            Queue.runEachFragment(tgt);
+
            tgt.show()
+
 
         }
 
         }
 +
    });
 +
});
  
        $("a:not(.external):not(.new)", this).addClass('ajaxlink').one('click', function(e) {
 
$('.ajaxinclude'+contcl[1]).css("display","block");
 
            e.preventDefault()
 
  
            var $this = $(this)
+
/*** Mobile menu ***/
 +
if (mw.config.get('skin') == 'mobile') {
 +
    $('.portlet h5').click(function () {
 +
        var portlet = $(this);
 +
        $('#portlet-bg').fadeIn('slow');
 +
        portlet.parent().addClass('visible');
 +
    });
 +
    $('#close-portlet').click(function () {
 +
        $(this).parent().fadeOut('slow');
 +
        $('.portlet').removeClass('visible');
 +
    });
 +
}
  
            $this.data('remote', placeholder.clone())
+
/***********    NSFW    ***********/
            target.empty().append(placeholder.clone());
+
$(document).on('click', '.NSFW', function (e) {
 +
    e.preventDefault();
  
            $.ajax({
+
    $(this).removeClass('NSFW');
                url:wgScriptPath+'/api.php'+'?action=parse&format=json&redirects&prop=text&page='+encodeURIComponent($(this).attr('title')),
+
                dataType: 'json',
+
                success: function(data) {
+
                    var d = $(data.parse.text["*"]).wrap('<p/>'), inc;
+
                    inc = $('.ajaxinclude'+contcl[1], d); inc = inc.length ? inc : $('.ajaxinclude', d)
+
                    if(inc.length) d = inc;
+
                    $this.data('remote', d)
+
                    show($this, target)
+
                }
+
            })
+
            $this.click(function(e){ e.preventDefault(); show($this, target); })
+
        })
+
        $(".ajaxhide"+contcl[1], scope).click(function(e) { e.preventDefault(); target.toggle(); })
+
    })
+
 
});
 
});
/** /Ajaxed ****/
+
/***********    /NSFW    ***********/
  
/* prettyPhoto ****/
+
/* Saladificator */
 +
var now = new Date(),
 +
    now_month = now.getMonth() + 1,
 +
    now_day = now.getDate(),
 +
    hash = window.location.hash.substr(1);
  
Queue.addOnce(function() {
+
$(document).ready(function () {
        var wpisid = (wgVersion=='1.17')?'#wpImageSize':'#mw-input-thumbsize';
+
    if ((now_month + '' + now_day) > 1228 || (now_month + '' + now_day) < 13) {
        $(wpisid).parent().parent().parent().append('<tr class="mw-htmlform-field-HTMLSelectField"><td class="mw-label"></td><td class="mw-input"><input type="checkbox" id="mw-gallery-slide-show">&nbsp;<label for="mw-gallery-slide-show">Использовать улучшенную галерею и предпросмотр миниатюр (требуется JavaScript)</label></td></tr>');
+
        //$('#mw-panel').addClass('saladificator')
 +
    }
  
        if (localStorage.getItem('gallery_slideshow') != 'false') { $('#mw-gallery-slide-show').prop("checked", true); };
+
    if (!hash.includes("WG7Pg4o"))
 +
        $('#mw-panel').addClass('ukraine');
 +
    else
 +
        $('#siteNotice').hide();
  
        var wpsbtnid = (wgVersion=='1.17')?'input.btnSavePrefs':'#prefcontrol';
 
  
        $(wpsbtnid).click( function () {
+
    /* TOC sticky */
            if ( $('#mw-gallery-slide-show:checked').size() > 0 ) { localStorage.setItem('gallery_slideshow', 'true'); }
+
    const toc = document.getElementById('toc');
              else { localStorage.setItem('gallery_slideshow', 'false'); };
+
        });
+
}, f5s && wgCanonicalSpecialPageName == "Preferences");
+
  
function gallerySlideshow(scope) {
+
    if (toc) {
    $.ajax({
+
         const directParent = toc.parentElement.classList.contains('tocright');
         url:'/skins/common/jquery.prettyPhoto.js',
+
        dataType: 'script',
+
        cache:true,
+
        success: function() {
+
            var usecoralcdn = false;
+
            var imagepath = 'http://urbanculture.in'+(usecoralcdn?'.nyud.net':'')+'/images/';
+
  
            $('a.internal[href^="/images/"]', scope).each(function() {
+
        var goToTopButton = document.createElement('div');
                if(/\.(?:jpe?g|png|gif|svg)$/i.test($(this).attr('href'))) {
+
                    $(this)
+
                        .attr({'rel':'prettyPhoto','alt':$(this).attr('href')})
+
                        .addClass('mediafile')
+
                        .data('htmlDesc',(/^(?:Media|Медиа):/i.test($(this).text()) || $(this).text() == $(this).attr('title'))?'':$(this).html());
+
                }
+
            });
+
  
            $('div.thumbinner > a.image > img[src^="/images/"]', scope).each(function() {
+
        goToTopButton.addEventListener('click', function (e) {
                var src;
+
            window.scrollTo({ top: 0, behavior: 'auto' });
 +
        });
  
                if($(this).parent('a').hasClass('image') && (src=/^\/images(?:\/thumb)?\/(.\/..\/[^\/]+)/.exec($(this).attr('src'))[1])) {
+
        goToTopButton.setAttribute("id", "go_to_top");
                    var descr;
+
        goToTopButton.innerHTML = '<span class="icon"></span>';
                    title = ((descr=$(this).parent().parent().children('div.thumbcaption')).size()>0?descr.text().replace(/\s*(?:\|NSFW|NSFW\||^NSFW\s$|\[\d+\])\s*/g,''):'');
+
  
                    desc = descr.clone();
+
        toc.appendChild(goToTopButton);
                    desc.children('div.magnify,sup.reference').remove();
+
  
                    $(this).parent('a')
+
        toc.querySelectorAll(':scope a').forEach(function (anchor) {
                        .data('htmlDesc',desc.html())
+
            anchor.addEventListener('click', function (e) {
                        .attr({
+
                 e.preventDefault();
                            'title':title,
+
                            'alt':imagepath+src,
+
                            'rel':'prettyPhoto'
+
                        });
+
                 }
+
            });
+
  
            $('table.gallery, div.morphfileimages', scope).each(function(galnum) {
+
                var anchorText = this.getAttribute('href'),
                $('a.image > img[src^="/images/"]',this).each(function() {
+
                    anchorId = anchorText.substring(1, anchorText.length);
                    var src;
+
                    var descr;
+
                    var title;
+
  
                    if($(this).parent('a').hasClass('image')
+
                document.getElementById(anchorId).scrollIntoView({
                            && (src=/^\/images(?:\/thumb)?\/(.\/..\/[^\/]+)/.exec($(this).attr('src'))[1])
+
                    behavior: 'smooth'
                            && (title = ((descr =$(this).closest('div.gallerybox, div.morphcontent').children('div.gallerytext')).children('p').size()>0?descr.children('p').text().replace(/\s*(?:\|NSFW|NSFW\||^NSFW\s$|\[\d+\])\s*/g,''):''))!==false) {
+
                });
  
                        desc = descr.children('p').clone();
+
                toc.classList.add('__hidden');
                        desc.children('sup.reference').remove();
+
  
                        descr.prepend('<div class="magnify"><a href="'+$(this).parent('a').attr('href')+'" class="internal" title="Увеличить"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt=""></a></div>')
+
                // Update the URL without reloading the page
 
+
                var url = window.location.href.split('#')[0] + anchorText;
                        $(this).parent('a')
+
                history.pushState(null, null, url);
                            .data('htmlDesc',desc.html())
+
                            .attr({
+
                                'title':title,
+
                                'alt':imagepath+src,
+
                                'rel':'prettyPhoto[gallery_'+galnum+']'
+
                            });
+
                    }
+
                });
+
 
             });
 
             });
 +
        });
  
            $("a[rel^='prettyPhoto']", scope).prettyPhoto({
+
        if (!directParent) {
                modal:false,
+
                deeplinking:false,
+
                animation_speed: 'fast',
+
                opacity:0,
+
                gallery_markup:'',
+
                social_tools:false,
+
                ie6_fallback: false,
+
                show_title:false,
+
  
                changepicturecallback: function(){
+
            var tocHeight = -toc.offsetHeight,
                    var desc = (arguments[1]=='prettyPhoto')?arguments[0].data('htmlDesc'):$('a.image[rel="'+arguments[1].replace(/([\]\[])/g,'\\$1')+'"]',scope).eq(arguments[3]).data('htmlDesc');
+
                topPos = toc.getBoundingClientRect().top - tocHeight,
 +
                tocToggler = document.getElementById('toctitle');
  
                    var fname = decodeURIComponent(/images\/.\/..\/(.+)$/.exec($('#fullResImage').attr('src'))[1])
+
            if (topPos <= tocHeight) {
                    var edesc = $('<div class="imagepagelink"/>')
+
                toc.classList.add('__sticky', '__ontop', '__hidden');
                                    .append($('<a/>')
+
            }
                                                .attr('href','/Файл:'+fname)
+
                                                .text(/^(.{0,30})/
+
                                                        .exec(fname)[1]
+
                                                    //  .replace(/\.([^\.]+)$/,'')
+
                                                        .replace(/_/g,' ')));
+
  
                    $('.pp_description')
+
            tocToggler.addEventListener("click", function () {
                        .html($('.pp_description').is(':hidden')?'':desc)
+
                toc.classList.toggle("__hidden");
                        .append(edesc).show();
+
            });
  
                    if($('#fullResImage').width() < 145) {
+
            document.addEventListener('scroll', function (e) {
                         $('.pp_pic_holder,.pp_default,.ppt,.pp_hoverContainer,.pp_details')
+
                topPos = toc.getBoundingClientRect().top;
                            .css('width','+=200'); // jQuery 1.6
+
                setTimeout(function () {
 +
                    if (topPos <= tocHeight) {
 +
                         toc.classList.add('__sticky', '__ontop', '__hidden');
 +
                    } else if (topPos && topPos >= 1) {
 +
                        toc.classList.remove('__sticky', '__ontop');
 
                     }
 
                     }
                 }
+
                 }, 50);
 
             });
 
             });
 
         }
 
         }
    });
 
}
 
 
Queue.addEachFragment( gallerySlideshow, f5s && localStorage.getItem('gallery_slideshow') != 'false' );
 
/* /prettyPhoto ****/
 
 
/* By ****/
 
Queue.addOnce(function() {
 
    $('body').addClass('ns-talk');
 
},wgPageName == "Urbanculture:Вниманию_участников");
 
/* /By ****/
 
 
/* Spoilers ****/
 
Queue.addEachFragment(function(scope) {
 
    $('.spoiler',scope).click(function() {
 
        $(this).toggleClass('spoilered');
 
    });
 
});
 
/* /Spoilers ****/
 
 
/* new gallerytemplate ****/
 
function newgallerytemplate(scope) {
 
    $('table.gallerytemplate table.gallery > tbody,table.gallerytemplate table.videogallery > tbody',scope).each(function() {
 
 
        var params = {
 
            'min_visible_rows':1,
 
            'max_visible_rows':2,
 
            'collapsible':true,
 
            'expand_caption':'Показать',
 
            'collapse_caption':'Скрыть',
 
            'rows_in_table':$('> tr',this).size(),
 
            'collapsible_rows':{}
 
        }
 
 
/*******************************************
 
*******************************************/
 
 
        if($(this).parent().parent('td').size() > 0
 
            && ($(this).parent().parent('td').attr('class') == 'gallerytemplate-preview'
 
                || $(this).parent().parent('td').attr('class') == 'gallerytemplate-content')) {
 
 
            var paramblock = $(this).parent().parent().parent().parent().children('tr[class="gallerytemplate-params"]');
 
 
            $('td',paramblock).each(function() {
 
                params[$(this).attr('title')] = $(this).text();
 
            });
 
 
            if(params['min_visible_rows'] < 1) {params['min_visible_rows'] = 1}
 
            if(params['collapsible'] == 'no'
 
                    || params['collapsible'] == 'false'
 
                    || params['collapsible'] == 0) {
 
                params['collapsible'] = false;
 
            } else {
 
                params['collapsible'] = true;
 
            }
 
 
        } else {
 
/************************/
 
            return true;
 
/************************/
 
        }
 
 
/*******************************************
 
*******************************************/
 
    if(params['rows_in_table'] < params['max_visible_rows']
 
            || params['rows_in_table'] <= params['min_visible_rows']
 
/*            || params['min_visible_rows'] > params['max_visible_rows'] */
 
            || params['collapsible'] == false) {
 
        return true;
 
 
     }
 
     }
/*******************************************
 
*******************************************/
 
  
        var expandgal = $('<th/>')
 
            .attr({'colspan':$('tr:first > td',this).size(),'class':'galpreview-showhidebutton'})
 
            .append($('<span/>').text(params['expand_caption']))
 
            .click(function() {
 
 
                if($('span',this).text() == params['expand_caption']) {
 
                    params['collapsible_rows'].show();
 
                    $('span',this).text(params['collapse_caption'])
 
                } else {
 
                    params['collapsible_rows'].hide();
 
                    $('span',this).text(params['expand_caption'])
 
                }
 
            });
 
 
        $('> tr',this)
 
            .slice(0,params['min_visible_rows'])
 
            .attr('class','galpreview');
 
 
        $('tr.galpreview:last',this).after($('<tr class="galpreview"/>').append(expandgal));
 
 
        params['collapsible_rows'] = $('> tr:not(.galpreview)',this);
 
 
        params['collapsible_rows'].hide();
 
 
    });
 
 
}
 
 
 
Queue.addEachFragment(newgallerytemplate);
 
 
/* /new gallerytemplate ****/
 
 
var scrollmenu=false;
 
$(document).ready(function() {
 
$(document).scroll(function () {
 
if((scrollmenu==false) && ($(window).scrollTop()>112)){
 
$(".editbox").css('position','fixed');
 
$(".editbox").css('top','0');
 
scrollmenu=true;
 
}else if((scrollmenu==true) && ($(window).scrollTop()<113)){
 
$(".editbox").css('position','absolute');
 
$(".editbox").css('top','');
 
scrollmenu=false;
 
}
 
});
 
});
 
 
/*** AddThis ***/
 
var addthis_config = {
 
"ui_click":true,
 
"data_track_clickback":true,
 
services_custom:{
 
name: "my.ya.ru",
 
url: "http://my.ya.ru/posts_add_link.xml?URL={{URL}}&title={{TITLE}}&body=",
 
icon: "/skins/Impetus/Ya.png"}
 
};
 
var addthis_share = {"url":"http://urbanculture.in"+"/"+encodeURIComponent(wgPageName),"title":wgTitle,templates:{twitter: "{{title}} {{url}} from @Urbanculture_ru"}};
 
 
/*** Title page ***/
 
$('#write-article a').click(function () {
 
  $(this).hide();
 
  $('#create-page-lay').fadeIn();
 
  $('#create-page-lay .createboxInput').focus();
 
$("#create-page-lay .createboxInput").focusout(function () {
 
if ($(this).val() == "") {
 
$('#create-page-lay').hide(),
 
$('#write-article a').fadeIn() }
 
});
 
  return false;
 
});
 
 
/*** Blog page ***/
 
$('div.news.old').first().before("<div id='oldnews'></div>");
 
$('div.news.old').appendTo($('#oldnews'));
 
$('#oldnews').after("<div id='showarchive'><a id='show-link' href='#' class='showarchive'><span>Показать архив</span></a></div>");
 
$('#show-link').toggle( function() {
 
$('#oldnews').fadeIn();
 
$(this).html('<span>Скрыть архив</span>')
 
.stop();
 
}, function() {
 
$('#oldnews').hide();
 
$(this).html('<span>Показать архив</span>')
 
.stop();
 
 
});
 
});

Текущая версия на 22:20, 27 января 2024

/** Misc common defines ****/
 
 
/* Неоднократно нужные проверки: */
/*** _is_editpage - я на странице редактирования? */
/*** _is_editable - у меня есть права на правку текущей страницы? */
/*** _is_autoconfirmed  */
var _is_editpage = mw.config.get('wgAction') == 'edit' || mw.config.get('wgAction') == 'submit';
var _is_editable = (function isEditable() {
    var restrict = mw.config.get('wgRestrictionEdit') || [], g;
    if (restrict.length < 1) { return true; }
    if (!mw.config.get('wgUserGroups')) { return false; }
    for (g = 0; g < mw.config.get('wgUserGroups').length; g++) { if ($.inArray(mw.config.get('wgUserGroups')[g], restrict) != -1) { return true; } }
    return false;
}());
var _is_autoconfirmed = mw.config.get('wgUserGroups') && ($.inArray('autoconfirmed', mw.config.get('wgUserGroups')) != -1),
    f5s = ('localStorage' in window) && window.localStorage !== null ? window.localStorage : false,
    Queue
    ;
/** /Misc common defines ****/
 
/** Processing queue ****/
 
/**** Queue.addOnce(function(){}, condition = true) - adds a function to run once on page load */
/**** Queue.addOnce('module.name', [function(){} | function name string string], condition = true) - loads a module and adds a function to run once on page load */
/**** Queue.addEachFragment(function(scope){}, condtion = true) - adds function to run on page load AND on each AJAX loaded fragment */
/**** Queue.addEachFragment('module.name', [function(scope){} | function name string string], condtion = true) - loads a module and adds function to run on page load AND on each AJAX loaded fragment */
/****     Function must take a single parameter - currently processed fragment */
/**** Both functions take optional second parameter - if false, function won't be run on current page */
/**** Queue.runOnce - self-descriptive, shouldn't be run directly */
/**** Queue.runEachFragment(scope) - scope can be an html element or array of elements */
 
mw.loader.using('UC.queue', function () {
 
    Queue.addOnce(function () {
        $('.boxes a').each(function () {
            var parentalt = $(this).parent().attr('title');
            $(this).attr('alt', parentalt);
            if ($(this).parent().hasClass('menuicon')) {
                $(this).html('<span class="glyphicon"></span>')
            };
        });
    });
 
    /** Drafts save ****/
    Queue.addOnce('UC.draftarticle', 'draftArticle', (
        (!mw.config.get('wgCanonicalSpecialPageName') &&
            (
                location.href.match(/&action=(?:edit|submit)/) !== null ||
                mw.config.get('wgAction') == 'edit' ||
                mw.config.get('wgAction') == 'submit'
            ))
    ));
 
    /** Collapsible tables ****/
    // Используется в коллапсерах
    Queue.addEachFragment('UC.tablecollapsers', 'createTableCollapsers', !mw.config.get('wgCanonicalSpecialPageName'));
    Queue.addEachFragment('UC.tablecollapsers', 'createHiderButtons', !mw.config.get('wgCanonicalSpecialPageName'));
 
    /** NSFW Gallery Items ****/
    /* Description: Hides images with |NSFW in description from galleries */
    /* Authors: [[User:Anotubus]], [[User:Obvious]] */
    Queue.addEachFragment('UC.gallerymodify', 'processNSFWGalleryItems', !mw.config.get('wgCanonicalSpecialPageName'));
 
    /** Dynamic gallery ****/
    Queue.addEachFragment('UC.gallerymodify', 'dynamicGallery', !mw.config.get('wgCanonicalSpecialPageName'));
 
    /** Ajaxed *****/
    Queue.addEachFragment('UC.ajaxed', 'ajaxed', !mw.config.get('wgCanonicalSpecialPageName'));
 
    /** Sidebar scroll *****/
    Queue.addOnce('jquery.slimscroll', function () {
        if ($(window).width() > '980') {
            $('#mw-panel').slimScroll({
                color: '#ffffff',
                distance: '3px'
            });
        };
 
        $('#toc > ul').slimScroll({
            color: '#333333',
            distance: '3px',
            allowPageScroll: false
        });
    });
 
 
    /** Ref tooltips******************************************
      *
      *  Description: Replace references with JQuery-based tooltips
      *  Made by:  Tachikoma
      */
 
    Queue.addOnce(function () {
        $(window).click(function (e) {
            if (!($(e.target).hasClass('areference') || $(e.target).parents().andSelf().hasClass('tooltip'))) {
                $('.tooltip').hide(250); $('.curreference').removeClass('curreference');
            }
        });
    }, !mw.config.get('wgCanonicalSpecialPageName')).addEachFragment(function (scope) {
        var refs = $('ol.references', scope);
        if (!refs.size()) { return; }
        refs.before($('<a href="#">[показать примечания]</a>').click(function (e) { e.preventDefault(); refs.toggle(); })).hide();
        $('.reference a', scope).click(function (e) {
            e.preventDefault();
            var x = $(this), iscurrent = x.hasClass('curreference'), i = $('.tooltip').hide(250),
                par = x.parent(), o = par.offset(), l = o.left, t = o.top + 13,
                b = $('body'), mh = b.height(), mw = b.width(),
                c = $(x.attr('href'), refs).clone().find('a:first').remove().end().html();
            $('.curreference').removeClass('curreference');
            if (iscurrent) { return; }
 
            x.addClass('areference').addClass('curreference');
            if (!i.size()) { i = $('<div/>').addClass('tooltip'); }
            i.appendTo(b).queue(function () {
                i.empty().append(c).css({ 'left': l - ((l + i.width() >= mw) && i.width()), 'top': t - ((t + i.height() >= mh) && (i.height() + 26)) }).dequeue();
            }).show(250);
        });
    }, !mw.config.get('wgCanonicalSpecialPageName'));
 
    /** Morph LM Edition **************************************/
    Queue.addEachFragment('UC.morphobjects', 'createMorphObjects', !mw.config.get('wgCanonicalSpecialPageName'));
 
    /** Pre lines******************************************
      *
      *  Description: add lines to <pre> tags
      *  Made by: Munhgauzen
      */
 
    Queue.addOnce(function () {
        $('pre').each(function () {
            var rows_count = Math.round($(this).height() / parseInt($(this).css('line-height')));
            var $pre = $(this);
            var html = $pre.html();
            var nl = /\n|\r|\r\n/g;
            $pre.html(('\n' + html).replace(nl, '</div><div class="row">'));
        });
    });
 
    /** Linkchecker ***/
    function linkchecker(scope) {
        $('.linkchecker', scope).each(function (i, e) {
            var lc_if = $(".linkcheckerif a", this),
                lc_then = $(".linkcheckerthen", this),
                lc_else = $(".linkcheckerelse", this)
                ;
 
            if (lc_if.size() && lc_then.size()) {
                if (lc_if.hasClass('new')) { lc_then.hide(); } else { lc_else.hide(); }
                lc_if.parent().hide();
            } else { $(this).hide(); }
        });
    }
    Queue.addEachFragment(linkchecker, !mw.config.get('wgCanonicalSpecialPageName'));
 
    /** ShortDiffURL ****/
    Queue.addOnce(function shortdiffurl() {
        if (!mw.config.get('wgCanonicalSpecialPageName') && window.location.href.indexOf("diff=") != '-1' && $("#ca-history").size() > 0) {
            $("#ca-history").after('<li id="ca-diff" class="collapsible"><span><a href="' + location.href.replace(/^(.+\?).*&?(diff=(?:\d+|prev|next|curr)).*?(&oldid=\d+)?.*$/, "$1$2$3") + '" title="Короткая ссылка на дифф">Дифф</a></span></li>');
        };
    });
 
    /** Needed page **/
    Queue.addOnce(function () {
        $('.mw-redirect').addClass('neededpagerdrcts');
        $('ul').addClass('neededpagelist');
    }, !mw.config.get('wgCanonicalSpecialPageName') && mw.config.get('wgPageName') == 'Urbanculture:R');
 
    /** Image Categorizer  ************************************* */
    /** Author: Anotubus   */
    /* if ( (mw.config.get( 'wgCanonicalNamespace' ) == 'File' || mw.config.get( 'wgNamespaceNumber' ) == 6) && _is_autoconfirmed && _is_editable ) importScriptURI("/skins/common/imgcat.js");*/
 
 
    /** Section menus ****************************************** */
    /* Authors: [[User:Tachikoma]], [[User:T_kns]], [[User:Мопец Ципельман]] */
    window.excludedSectionHeaders = $('.c-comment :header');
    Queue.addOnce('UC.sectionmenus', 'addSectionMenus', !mw.config.get('wgCanonicalSpecialPageName') && mw.config.get('skin') == 'vector');
 
 
    /** collapsibledivs *****/
    Queue.addOnce('UC.collapsiblesidebar', 'collapsibleSideBar', f5s && mw.config.get('skin') == 'vector');
 
    /* empty pagename ****/
    Queue.addOnce(function () {
        $('#bodySearch').submit(function (e) {
            var wrap = $(this).children(".bodySearchWrap");
            if (/^\s*$/.test(wrap.children('#bodySearchInput').val())) {
                if (wrap.children('.pagenameneeded').size() === 0) {
                    wrap.append($('<p class="pagenameneeded">Введите имя статьи</p>').delay(1500).fadeOut('slow', function () { $(this).remove(); }));
                }
                return false;
            }
        });
    }, !mw.config.get('wgCanonicalSpecialPageName') && mw.config.get('wgPageName') == "Urbanculture:Новая_статья");
 
    /* b-yauser ****/
    Queue.addEachFragment(function (sc) { $('.b-yauser a', sc).each(function (i) { $(this).html($(this).html().replace(/^([^<])/, '<b>$1</b>')); }); });
 
 
    /* prettyPhoto ****/
    Queue.addOnce('UC.prettyphotify', 'prettyPhotifyOptions', f5s && mw.config.get('wgCanonicalSpecialPageName') == 'Preferences');
    Queue.addEachFragment('UC.prettyphotify', 'prettyPhotify', f5s && localStorage.getItem('gallery_slideshow') != 'false');
 
    /* By ****/
    Queue.addOnce(function () {
        $('body').addClass('ns-talk');
    }, !mw.config.get('wgCanonicalSpecialPageName') && mw.config.get('wgPageName') == "Urbanculture:Вниманию_участников");
 
    /* Spoilers ****/
    Queue.addEachFragment(function (scope) {
        $('.spoiler', scope).click(function () {
            $(this).toggleClass('spoilered');
        });
    }, !mw.config.get('wgCanonicalSpecialPageName'));
 
    /* new gallerytemplate ****/
    //Queue.addEachFragment('UC.newgallerytemplate', 'newGalleryTemplate', !mw.config.get( 'wgCanonicalSpecialPageName' ));
 
 
    /*** Resize textarea ***/
    //Queue.addOnce('jquery.autoSizeTextArea', function () {
    //    $('#wpTextbox1').autoSizeTextArea();
    //    $(document).ready(function () {
    //        $('#wpTextbox1').autoSizeTextArea('update')
    //    });
    //});
 
    /* LazyLoad EmbedVideo****/
    Queue.addEachFragment(['ext.embedVideo', 'ext.embedVideo-lazy', 'ext.embedVideo-playpause'], 'embedVideoLazyLoad', !mw.config.get('wgCanonicalSpecialPageName'));
 
 
    /***********     Modern gallery Toggler    ***********/
    Queue.addEachFragment(function (sc) {
        const gallery = $('.combinedgallery, .videogallery', sc)
            ;
        gallery.each(function () {
            var t = $(this),
                tElLength = t.data('line-elems'),
                tElems = t.find('.gallery_content_block').length
                ;//console.log(t)
            if (tElems > tElLength) t.addClass('__hide_content');
        });
    }, !mw.config.get('wgCanonicalSpecialPageName'));
 
    Queue.addOnce(function () {//console.log('Modern gallery Toggler addOnce', $(document))
        $('body').on('click', '.gallery_toggle', function () {
            var t = $(this),
                tGall = t.closest('.combinedgallery, .videogallery')
                ;//console.log(t)
            tGall.toggleClass('__hide_content __show_content')
        });
    }, !mw.config.get('wgCanonicalSpecialPageName'))
 
 
    /***********    /Modern gallery Toggler    ***********/
 
    /***********     Scale    ***********/
    Queue.addOnce('UC.scalemap', 'scaleMap', f5s && mw.config.get('skin') == 'vector');
    /***********    /Scale    ***********/
 
    /*** define the functions, that will be ran on each Comments display refresh ***/
    window.commentJSrunMultiHooks = function (scope) { };
 
});
 
/** /Processing queue ****/
 
 
/*** Scroll menu ***/
 
var scrollmenu = false;
$(document).ready(function () {
    var windowWidth = $(window).width();
    $(document).scroll(function () {
        if ((scrollmenu == false) && ($(window).scrollTop() > 112) && ($(window).height() > 900) && ($('#content').outerHeight() > 950) && (mw.config.get('skin') == 'vector')) {
            $(".editbox").css('position', 'fixed');
            $(".editbox").css('top', '0');
            scrollmenu = true;
        } else if ((scrollmenu === true) && ($(window).scrollTop() < 113)) {
            $(".editbox").css('position', 'absolute');
            $(".editbox").css('top', '');
            scrollmenu = false;
        }
    });
});
 
/*** /Scroll menu ***/
 
/*** Title page ***/
$('#write-article a').click(function () {
    $(this).hide();
    $('#create-page-lay').fadeIn();
    $('#create-page-lay .createboxInput').focus();
    $("#create-page-lay .createboxInput").focusout(function () {
        if ($(this).val() === "") {
            $('#create-page-lay').hide();
            $('#write-article a').fadeIn();
        }
    });
    return false;
});
 
/*** Blog page ***/
$(document).ready(function () {
    $('div.news.old').first().before("<div id='oldnews'></div>");
    $('div.news.old').appendTo($('#oldnews'));
    $('#oldnews').after("<div id='showarchive'><a class='show-link' href='#' class='showarchive'><span>Показать архив</span></a><a class='hide-link' href='#' class='showarchive' style='display:none'><span>Скрыть архив</span></a></div>");
    $('#showarchive a').click(function () {
        if ($(this).hasClass('show-link')) {
            $('#oldnews').fadeIn();
            $(this).hide().siblings().show()
                .stop();
        } else {
            $('#oldnews').hide();
            $(this).hide().siblings().show()
                .stop();
        }
    });
});
 
 
/*** Mobile menu ***/
if (mw.config.get('skin') == 'mobile') {
    $('.portlet h5').click(function () {
        var portlet = $(this);
        $('#portlet-bg').fadeIn('slow');
        portlet.parent().addClass('visible');
    });
    $('#close-portlet').click(function () {
        $(this).parent().fadeOut('slow');
        $('.portlet').removeClass('visible');
    });
}
 
/***********     NSFW     ***********/
$(document).on('click', '.NSFW', function (e) {
    e.preventDefault();
 
    $(this).removeClass('NSFW');
});
/***********    /NSFW     ***********/
 
/* Saladificator */
var now = new Date(),
    now_month = now.getMonth() + 1,
    now_day = now.getDate(),
    hash = window.location.hash.substr(1);
 
$(document).ready(function () {
    if ((now_month + '' + now_day) > 1228 || (now_month + '' + now_day) < 13) {
        //$('#mw-panel').addClass('saladificator')
    }
 
    if (!hash.includes("WG7Pg4o"))
        $('#mw-panel').addClass('ukraine');
    else
        $('#siteNotice').hide();
 
 
    /* TOC sticky */
    const toc = document.getElementById('toc');
 
    if (toc) {
        const directParent = toc.parentElement.classList.contains('tocright');
 
        var goToTopButton = document.createElement('div');
 
        goToTopButton.addEventListener('click', function (e) {
            window.scrollTo({ top: 0, behavior: 'auto' });
        });
 
        goToTopButton.setAttribute("id", "go_to_top");
        goToTopButton.innerHTML = '<span class="icon"></span>';
 
        toc.appendChild(goToTopButton);
 
        toc.querySelectorAll(':scope a').forEach(function (anchor) {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
 
                var anchorText = this.getAttribute('href'),
                    anchorId = anchorText.substring(1, anchorText.length);
 
                document.getElementById(anchorId).scrollIntoView({
                    behavior: 'smooth'
                });
 
                toc.classList.add('__hidden');
 
                // Update the URL without reloading the page
                var url = window.location.href.split('#')[0] + anchorText;
                history.pushState(null, null, url);
            });
        });
 
        if (!directParent) {
 
            var tocHeight = -toc.offsetHeight,
                topPos = toc.getBoundingClientRect().top - tocHeight,
                tocToggler = document.getElementById('toctitle');
 
            if (topPos <= tocHeight) {
                toc.classList.add('__sticky', '__ontop', '__hidden');
            }
 
            tocToggler.addEventListener("click", function () {
                toc.classList.toggle("__hidden");
            });
 
            document.addEventListener('scroll', function (e) {
                topPos = toc.getBoundingClientRect().top;
                setTimeout(function () {
                    if (topPos <= tocHeight) {
                        toc.classList.add('__sticky', '__ontop', '__hidden');
                    } else if (topPos && topPos >= 1) {
                        toc.classList.remove('__sticky', '__ontop');
                    }
                }, 50);
            });
        }
    }
 
});