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

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

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

Материал из Urbanculture
Перейти к: навигация, поиск
 
(не показаны 93 промежуточные версии 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) }) });
+
        return this;
+
    }
+
};
+
 
+
addOnloadHook(function() { Queue.runOnce().runEachFragment(document); })
+
/** /Processing queue ****/
+
 
+
/** Collapsible tables ****/
+
/*  Description: Allows tables to be collapsed, showing only the header. */
+
/* Authors: rewrite by [[User:Tachikoma]] based on [[Wikipedia:NavFrame]] */
+
 
+
// Используется в коллапсерах
+
var autoCollapse = 2;
+
var collapseCaption = "скрыть";
+
var expandCaption = "показать";
+
 
+
function createTableCollapsers(scope) {
+
 
+
    function collapseTable(tbl) {
+
         var rows = $('tr', tbl).not('tr:first')
+
        var btn = $('a.collapselink', tbl)
+
 
+
        if (btn.text() == collapseCaption) {
+
            rows.hide(); btn.text(expandCaption)
+
        } else {
+
             rows.show(); btn.text(collapseCaption)
+
        }
+
    }
+
 
+
    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 ****/
+
 
+
 
+
/** Dynamic Navigation Bars (experimental) *************************************
+
  *
+
  *  Description: See [[Wikipedia:NavFrame]].
+
  * Authors: rewrite by [[User:Tachikoma]] based on [[Wikipedia:NavFrame]]
+
  */
+
 
+
  function createHiderButtons(scope) {
+
      // set up the words in your language
+
      var NavigationBarHide = '[' + collapseCaption + ']';
+
      var NavigationBarShow = '[' + expandCaption + ']';
+
 
+
    $('div.NavFrame', scope).each(function(i, e) {
+
        var _ = $(this), head = _.children('.NavHead')
+
 
+
        if(!head.size()) return;
+
 
+
        var shown = true;
+
        var NavToggle = $('<a href="#"></a>').text(NavigationBarHide)
+
 
+
        function toggle() {
+
            shown = !shown;
+
            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);
+
    /** 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'
 +
            ))
 +
    ));
  
/** /Morph LM Edition ****/
+
    /** Collapsible tables ****/
 +
    // Используется в коллапсерах
 +
    Queue.addEachFragment('UC.tablecollapsers', 'createTableCollapsers', !mw.config.get('wgCanonicalSpecialPageName'));
 +
    Queue.addEachFragment('UC.tablecollapsers', 'createHiderButtons', !mw.config.get('wgCanonicalSpecialPageName'));
  
/** Tabbed Edittools **************************************/
+
    /** 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'));
  
(function() {
+
    /** Dynamic gallery ****/
  $('#toolbar').before($('.mw-editTools'));
+
    Queue.addEachFragment('UC.gallerymodify', 'dynamicGallery', !mw.config.get('wgCanonicalSpecialPageName'));
  $('ul.tabs').delegate('li:not(.current)', 'click', function() {
+
    $(this).addClass('current').siblings().removeClass('current')
+
      .parents('div.section').find('div.box').hide().eq($(this).index()).fadeIn(150)
+
  })
+
  $('#close-all').click(function() {
+
  $('div.box').hide();
+
  $('ul.tabs li.current').removeClass('current');
+
  })
+
 
+
  $('.subchar').hide()
+
  $('.subchar').before('<span class="openchar">+</span>')
+
  $('.openchar').click(function() {
+
      $('.openchar').show()
+
      $(this).hide()
+
      $('.subchar').hide()
+
      $(this).next('.subchar').fadeIn()
+
  });
+
})();
+
  
/** /Tabbed Edittools ****/
+
    /** Ajaxed *****/
 +
    Queue.addEachFragment('UC.ajaxed', 'ajaxed', !mw.config.get('wgCanonicalSpecialPageName'));
  
/** Ref tooltips******************************************
+
    /** Sidebar scroll *****/
  *
+
    Queue.addOnce('jquery.slimscroll', function () {
  *  Description: Replace references with JQuery-based tooltips
+
         if ($(window).width() > '980') {
  *  Made by:  Tachikoma
+
             $('#mw-panel').slimScroll({
  */
+
                color: '#ffffff',
 
+
                 distance: '3px'
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})
+
            .data('action','noclick')
+
            .on('mousedown', 'input', function(e) {
+
                if(e.which == 3) toolbar.data('action','rightClick');
+
 
             });
 
             });
 +
        };
  
        var timer;
+
         $('#toc > ul').slimScroll({
        var interval;
+
             color: '#333333',
         $(new_header).hover(
+
            distance: '3px',
            function() {
+
             allowPageScroll: false
                if(toolbar.data('action') === 'hoverout') { clearInterval(interval); toolbar.data('action','hoverin');}
+
                timer = setTimeout(function(){ var pos = headline.offset(); toolbar.show().offset({left:pos.left-6, top:pos.top-6}); }, 300);
+
             },
+
            function() {
+
                clearTimeout(timer);
+
                toolbar.data('action','hoverout');
+
                interval = setInterval(function(){ if(toolbar.data('action') === 'hoverout') {clearInterval(interval); toolbar.hide();} else {toolbar.data('action','hoverout');}}, 1000);
+
             }
+
        )
+
 
         });
 
         });
     $(window).scroll(function(){$('.showmenu').hide()})
+
     });
}
+
  
SectionToolbar.addButton(function(elt, out) {
 
    var
 
        div = $('<div class="shorturl" />'),
 
        input = $('<input class="shortlink" type="text" value="http://tinyurl.com/..." readonly="readonly" />').css('color', '#bbb').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>')
 
  
 +
    /** Ref tooltips******************************************
 +
      *
 +
      *  Description: Replace references with JQuery-based tooltips
 +
      *  Made by:  Tachikoma
 +
      */
  
     function gentlyEncode(string) {
+
     Queue.addOnce(function () {
         return ( encodeURIComponent
+
         $(window).click(function (e) {
        ? encodeURIComponent(string).replace(/%20(\D)?/g, "+$1").replace(/'/g, escape("'"))
+
            if (!($(e.target).hasClass('areference') || $(e.target).parents().andSelf().hasClass('tooltip'))) {
        : escape(string).replace(/\+/g, "%2B").replace(/%20/g, "+") );
+
                 $('.tooltip').hide(250); $('.curreference').removeClass('curreference');
    }
+
    var href = /^([^#]+)#?.*$/.exec(location.href)[1]+'#'+$('.mw-headline',elt).attr('id')
+
 
+
    function getTinyLink(evt) {
+
        evt.preventDefault()
+
 
+
        $.ajax({
+
            url:"http://json-tinyurl.appspot.com/?callback=?&url=" + gentlyEncode(href),
+
            dataType: 'json',
+
            success: function(data) {
+
                var tinyurl = data.tinyurl;
+
                input.val(tinyurl).css('color', 'black').show().select()
+
                 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()
+
 
             }
 
             }
         })
+
         });
     }
+
     }, !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; }
  
    url_out.one('click', getTinyLink)
+
            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'));
  
     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;}}
+
     /** Morph LM Edition **************************************/
     url_in.click(function(e) {
+
     Queue.addEachFragment('UC.morphobjects', 'createMorphObjects', !mw.config.get('wgCanonicalSpecialPageName'));
        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() })
+
     /** Pre lines******************************************
    $('.buttons-line', out).append(url_out).append(url_in)
+
      *
    $(out).append(div.append(input))
+
      *  Description: add lines to <pre> tags
})
+
      *  Made by: Munhgauzen
 +
      */
  
Queue.addOnce(addSectionMenus, skin=='impetus');
+
    Queue.addOnce(function () {
/** /Section menus ***************************************** */
+
        $('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)
 +
                ;
  
/** Autochange skin ***************************************** */
+
            if (lc_if.size() && lc_then.size()) {
function addcurskintolinks() {
+
                if (lc_if.hasClass('new')) { lc_then.hide(); } else { lc_else.hide(); }
$('a:not([href*="useskin"])').each(function(i){
+
                lc_if.parent().hide();
var hd = /^([^\#]*)(\#?.*)$/.exec($(this).attr('href'));
+
             } else { $(this).hide(); }
var h = hd[1];
+
         });
if (/^(?:\/|http:\/\/urbanculture\.in)/.test(h)) {
+
h += (h.indexOf("?") == -1)?'?':'&';
+
h += 'useskin=' + skin.toLowerCase();
+
$(this).attr('href',h+hd[2]);
+
}
+
});
+
}
+
 
+
Queue.addOnce(addcurskintolinks, location.href.indexOf("useskin=") > 0)
+
/** /Autochange skin ***************************************** */
+
 
+
 
+
/** collapsibledivs *****/
+
;(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) {
+
     Queue.addEachFragment(linkchecker, !mw.config.get('wgCanonicalSpecialPageName'));
        var t = [];
+
        $.each(items, function(i, e) { if (e) t.push(i); })
+
  
         t = t.join('|').replace(/(?:^[\s\|]*|\|{2,}|[\s\|]*$)/g,'')
+
    /** ShortDiffURL ****/
         if (t!='') localStorage.clpsd = t; else delete localStorage.clpsd;
+
    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>');
 +
         };
 +
     });
  
     var saved = fromStorage();
+
     /** 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");*/
  
    function togglest(th) {
 
        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) {
+
     /** Section menus ****************************************** */
        return (cur)?'/skins/common/images/Maximize.png':'/skins/common/images/Minimize.png';
+
    /* 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');
  
    function maxiorminiclass(cur) {
 
        return (cur)?'maximinibutton maximinibutton-minimized':'maximinibutton maximinibutton-maximized';
 
    }
 
  
     function minimizediv(o, tdv, save) {
+
     /** collapsibledivs *****/
        tdv.slideToggle('fast');
+
    Queue.addOnce('UC.collapsiblesidebar', 'collapsibleSideBar', f5s && mw.config.get('skin') == 'vector');
        var itval = o.attr('src').indexOf('Maximize')==-1;
+
        o.attr('src',maxiorminiicon(itval));
+
        o.attr('class',maxiorminiclass(itval));
+
  
        if (save && f5s) {
+
    /* empty pagename ****/
            var id1 = tdv.attr('id').replace(/\:/g,' ');
+
     Queue.addOnce(function () {
            saved[id1] = itval;
+
         $('#bodySearch').submit(function (e) {
 
+
             var wrap = $(this).children(".bodySearchWrap");
            toStorage(saved)
+
             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(); }));
 
+
                 }
     Queue.addOnce(function() {
+
                 return false;
         $('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;})
+
            $(this).before($('<div class="maximinipanel"></div>').append(img));
+
 
+
            if (itval) $(this).hide();
+
        });
+
    })
+
 
+
    Queue.addOnce(function() {
+
        $('div.portlet').each(function() {
+
            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');
+
     }, !mw.config.get('wgCanonicalSpecialPageName') && mw.config.get('wgPageName') == "Urbanculture:Новая_статья");
  
})()
+
    /* b-yauser ****/
/** /collapsibledivs ****/
+
    Queue.addEachFragment(function (sc) { $('.b-yauser a', sc).each(function (i) { $(this).html($(this).html().replace(/^([^<])/, '<b>$1</b>')); }); });
  
/* 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:Новая_статья");
 
  
/* /empty pagename ****/
+
    /* prettyPhoto ****/
 +
    Queue.addOnce('UC.prettyphotify', 'prettyPhotifyOptions', f5s && mw.config.get('wgCanonicalSpecialPageName') == 'Preferences');
 +
    Queue.addEachFragment('UC.prettyphotify', 'prettyPhotify', f5s && localStorage.getItem('gallery_slideshow') != 'false');
  
/* b-yauser ****/
+
    /* By ****/
Queue.addEachFragment(function(sc) { $('.b-yauser a', sc).each(function(i) { $(this).html($(this).html().replace(/^([^<])/,'<b>$1</b>')); }); });
+
    Queue.addOnce(function () {
/* /b-yauser ****/
+
        $('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'));
  
/** Ajaxed ****
+
    /* new gallerytemplate ****/
  *
+
    //Queue.addEachFragment('UC.newgallerytemplate', 'newGalleryTemplate', !mw.config.get( 'wgCanonicalSpecialPageName' ));
  *  Description: динамическая подгрузка произвольных страниц
+
  *  Authors: [[User:Tachikoma]], [[User:T_kns]]
+
  */
+
Queue.addEachFragment(function(scope) {
+
    var placeholder = $('<div style="text-align:center;"><img src="/skins/common/images/ajax-loader.gif" alt="l" /></div>')
+
  
    $(".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;
+
    /*** Resize textarea ***/
        if($(this).hasClass('ajax_addhider')) { add_hider = $(".ajax_addhider.ajaxhide"+contcl[1], scope).eq(0); if(!add_hider.length) add_hider = false; }
+
    //Queue.addOnce('jquery.autoSizeTextArea', function () {
        var target = $(".ajaxcont"+contcl[1], scope).eq(0)
+
    //    $('#wpTextbox1').autoSizeTextArea();
 +
    //    $(document).ready(function () {
 +
    //        $('#wpTextbox1').autoSizeTextArea('update')
 +
    //    });
 +
    //});
  
        function show(cont, tgt) {
+
    /* LazyLoad EmbedVideo****/
            if(lastshown == cont[0]) { if(!tgt.is(':visible')) tgt.show(); return };
+
    Queue.addEachFragment(['ext.embedVideo', 'ext.embedVideo-lazy', 'ext.embedVideo-playpause'], 'embedVideoLazyLoad', !mw.config.get('wgCanonicalSpecialPageName'));
  
            lastshown = cont[0]
 
  
             var d = cont.data('remote');
+
    /***********    Modern gallery Toggler    ***********/
             if(!d) return;
+
    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'));
  
            tgt.empty().append( d.clone() )
+
    Queue.addOnce(function () {//console.log('Modern gallery Toggler addOnce', $(document))
            if(add_hider)
+
         $('body').on('click', '.gallery_toggle', function () {
                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); })) );
+
             var t = $(this),
            Queue.runEachFragment(tgt);
+
                 tGall = t.closest('.combinedgallery, .videogallery')
            tgt.show()
+
                 ;//console.log(t)
        }
+
             tGall.toggleClass('__hide_content __show_content')
 
+
         $("a:not(.external):not(.new)", this).addClass('ajaxlink').one('click', function(e) {
+
$('.ajaxinclude'+contcl[1]).css("display","block");
+
            e.preventDefault()
+
 
+
             var $this = $(this)
+
 
+
            $this.data('remote', placeholder.clone())
+
            target.empty().append(placeholder.clone());
+
 
+
            $.ajax({
+
                 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 ****/
+
 
+
/* prettyPhoto ****/
+
 
+
Queue.addOnce(function() {
+
        var wpisid = (wgVersion=='1.17')?'#wpImageSize':'#mw-input-thumbsize';
+
        $(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>');
+
 
+
        if (localStorage.getItem('gallery_slideshow') != 'false') { $('#mw-gallery-slide-show').prop("checked", true); };
+
 
+
        var wpsbtnid = (wgVersion=='1.17')?'input.btnSavePrefs':'#prefcontrol';
+
 
+
        $(wpsbtnid).click( function () {
+
             if ( $('#mw-gallery-slide-show:checked').size() > 0 ) { localStorage.setItem('gallery_slideshow', 'true'); }
+
              else { localStorage.setItem('gallery_slideshow', 'false'); };
+
 
         });
 
         });
}, f5s && wgCanonicalSpecialPageName == "Preferences");
+
    }, !mw.config.get('wgCanonicalSpecialPageName'))
  
function gallerySlideshow(scope) {
 
    $.ajax({
 
        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() {
+
    /***********    /Modern gallery Toggler    ***********/
                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() {
+
    /***********    Scale    ***********/
                var src;
+
    Queue.addOnce('UC.scalemap', 'scaleMap', f5s && mw.config.get('skin') == 'vector');
 +
    /***********    /Scale    ***********/
  
                if($(this).parent('a').hasClass('image') && (src=/^\/images(?:\/thumb)?\/(.\/..\/[^\/]+)/.exec($(this).attr('src'))[1])) {
+
    /*** define the functions, that will be ran on each Comments display refresh ***/
                    var descr;
+
    window.commentJSrunMultiHooks = function (scope) { };
                    title = ((descr=$(this).parent().parent().children('div.thumbcaption')).size()>0?descr.text().replace(/\s*(?:\|NSFW|NSFW\||^NSFW\s$|\[\d+\])\s*/g,''):'');
+
  
                    desc = descr.clone();
+
});
                    desc.children('div.magnify,sup.reference').remove();
+
  
                    $(this).parent('a')
+
/** /Processing queue ****/
                        .data('htmlDesc',desc.html())
+
                        .attr({
+
                            'title':title,
+
                            'alt':imagepath+src,
+
                            'rel':'prettyPhoto'
+
                        });
+
                }
+
            });
+
  
            $('table.gallery, div.morphfileimages', scope).each(function(galnum) {
 
                $('a.image > img[src^="/images/"]',this).each(function() {
 
                    var src;
 
                    var descr;
 
                    var title;
 
  
                    if($(this).parent('a').hasClass('image')
+
/*** Scroll menu ***/
                            && (src=/^\/images(?:\/thumb)?\/(.\/..\/[^\/]+)/.exec($(this).attr('src'))[1])
+
                            && (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();
+
var scrollmenu = false;
                        desc.children('sup.reference').remove();
+
$(document).ready(function () {
 
+
    var windowWidth = $(window).width();
                        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>')
+
    $(document).scroll(function () {
 
+
        if ((scrollmenu == false) && ($(window).scrollTop() > 112) && ($(window).height() > 900) && ($('#content').outerHeight() > 950) && (mw.config.get('skin') == 'vector')) {
                        $(this).parent('a')
+
            $(".editbox").css('position', 'fixed');
                            .data('htmlDesc',desc.html())
+
            $(".editbox").css('top', '0');
                            .attr({
+
            scrollmenu = true;
                                'title':title,
+
        } else if ((scrollmenu === true) && ($(window).scrollTop() < 113)) {
                                'alt':imagepath+src,
+
            $(".editbox").css('position', 'absolute');
                                'rel':'prettyPhoto[gallery_'+galnum+']'
+
            $(".editbox").css('top', '');
                            });
+
             scrollmenu = false;
                    }
+
                });
+
            });
+
 
+
            $("a[rel^='prettyPhoto']", scope).prettyPhoto({
+
                modal:false,
+
                deeplinking:false,
+
                animation_speed: 'fast',
+
                opacity:0,
+
                gallery_markup:'',
+
                social_tools:false,
+
                ie6_fallback: false,
+
                show_title:false,
+
 
+
                changepicturecallback: function(){
+
                    var desc = (arguments[1]=='prettyPhoto')?arguments[0].data('htmlDesc'):$('a.image[rel="'+arguments[1].replace(/([\]\[])/g,'\\$1')+'"]',scope).eq(arguments[3]).data('htmlDesc');
+
 
+
                    var fname = decodeURIComponent(/images\/.\/..\/(.+)$/.exec($('#fullResImage').attr('src'))[1])
+
                    var edesc = $('<div class="imagepagelink"/>')
+
                                    .append($('<a/>')
+
                                                .attr('href','/Файл:'+fname)
+
                                                .text(/^(.{0,30})/
+
                                                        .exec(fname)[1]
+
                                                    //  .replace(/\.([^\.]+)$/,'')
+
                                                        .replace(/_/g,' ')));
+
 
+
                    $('.pp_description')
+
                        .html($('.pp_description').is(':hidden')?'':desc)
+
                        .append(edesc).show();
+
 
+
                    if($('#fullResImage').width() < 145) {
+
                        $('.pp_pic_holder,.pp_default,.ppt,.pp_hoverContainer,.pp_details')
+
                            .css('width','+=200'); // jQuery 1.6
+
                    }
+
                }
+
             });
+
 
         }
 
         }
 
     });
 
     });
}
+
});
  
Queue.addEachFragment( gallerySlideshow, f5s && localStorage.getItem('gallery_slideshow') != 'false' );
+
/*** /Scroll menu ***/
/* /prettyPhoto ****/
+
 
+
/* By ****/
+
Queue.addOnce(function() {
+
    $('body').addClass('ns-talk');
+
},wgPageName == "Urbanculture:Вниманию_участников");
+
/* /By ****/
+
  
/* Spoilers ****/
+
/*** Title page ***/
Queue.addEachFragment(function(scope) {
+
$('#write-article a').click(function () {
     $('.spoiler',scope).click(function() {
+
    $(this).hide();
         $(this).toggleClass('spoilered');
+
     $('#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;
 
});
 
});
/* /Spoilers ****/
 
  
/* new gallerytemplate ****/
+
/*** Blog page ***/
function newgallerytemplate(scope) {
+
$(document).ready(function () {
     $('table.gallerytemplate table.gallery > tbody,table.gallerytemplate table.videogallery > tbody',scope).each(function() {
+
     $('div.news.old').first().before("<div id='oldnews'></div>");
 
+
    $('div.news.old').appendTo($('#oldnews'));
        var params = {
+
    $('#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>");
            'min_visible_rows':1,
+
    $('#showarchive a').click(function () {
            'max_visible_rows':2,
+
        if ($(this).hasClass('show-link')) {
            'collapsible':true,
+
            $('#oldnews').fadeIn();
            'expand_caption':'Показать',
+
            $(this).hide().siblings().show()
            'collapse_caption':'Скрыть',
+
                .stop();
            'rows_in_table':$('> tr',this).size(),
+
        } else {
             'collapsible_rows':{}
+
             $('#oldnews').hide();
 +
            $(this).hide().siblings().show()
 +
                .stop();
 
         }
 
         }
 +
    });
 +
});
  
/*******************************************
 
*******************************************/
 
  
        if($(this).parent().parent('td').size() > 0
+
/*** Mobile menu ***/
            && ($(this).parent().parent('td').attr('class') == 'gallerytemplate-preview'
+
if (mw.config.get('skin') == 'mobile') {
                || $(this).parent().parent('td').attr('class') == 'gallerytemplate-content')) {
+
    $('.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');
 +
    });
 +
}
  
            var paramblock = $(this).parent().parent().parent().parent().children('tr[class="gallerytemplate-params"]');
+
/***********    NSFW    ***********/
 +
$(document).on('click', '.NSFW', function (e) {
 +
    e.preventDefault();
  
            $('td',paramblock).each(function() {
+
    $(this).removeClass('NSFW');
                params[$(this).attr('title')] = $(this).text();
+
});
            });
+
/***********    /NSFW    ***********/
  
            if(params['min_visible_rows'] < 1) {params['min_visible_rows'] = 1}
+
/* Saladificator */
            if(params['collapsible'] == 'no'
+
var now = new Date(),
                    || params['collapsible'] == 'false'
+
    now_month = now.getMonth() + 1,
                    || params['collapsible'] == 0) {
+
    now_day = now.getDate(),
                params['collapsible'] = false;
+
    hash = window.location.hash.substr(1);
            } else {
+
                params['collapsible'] = true;
+
            }
+
  
        } else {
+
$(document).ready(function () {
/************************/
+
     if ((now_month + '' + now_day) > 1228 || (now_month + '' + now_day) < 13) {
            return true;
+
        //$('#mw-panel').addClass('saladificator')
/************************/
+
        }
+
 
+
/*******************************************
+
*******************************************/
+
     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/>')
+
    if (!hash.includes("WG7Pg4o"))
            .attr({'colspan':$('tr:first > td',this).size(),'class':'galpreview-showhidebutton'})
+
        $('#mw-panel').addClass('ukraine');
            .append($('<span/>').text(params['expand_caption']))
+
    else
            .click(function() {
+
        $('#siteNotice').hide();
  
                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)
+
    /* TOC sticky */
            .slice(0,params['min_visible_rows'])
+
    const toc = document.getElementById('toc');
            .attr('class','galpreview');
+
  
        $('tr.galpreview:last',this).after($('<tr class="galpreview"/>').append(expandgal));
+
    if (toc) {
 +
        const directParent = toc.parentElement.classList.contains('tocright');
  
         params['collapsible_rows'] = $('> tr:not(.galpreview)',this);
+
         var goToTopButton = document.createElement('div');
  
         params['collapsible_rows'].hide();
+
         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();
  
Queue.addEachFragment(newgallerytemplate);
+
                var anchorText = this.getAttribute('href'),
 +
                    anchorId = anchorText.substring(1, anchorText.length);
  
/* /new gallerytemplate ****/
+
                document.getElementById(anchorId).scrollIntoView({
 +
                    behavior: 'smooth'
 +
                });
  
/*** Scroll menu ***/
+
                toc.classList.add('__hidden');
  
var scrollmenu=false;
+
                // Update the URL without reloading the page
$(document).ready(function() {
+
                var url = window.location.href.split('#')[0] + anchorText;
var windowWidth = $(window).width();
+
                history.pushState(null, null, url);
if (windowWidth > '640') {
+
            });
$(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;
+
}
+
});
+
}
+
});
+
  
/*** /Scroll menu ***/
+
        if (!directParent) {
  
/*** Resize textarea ***/
+
            var tocHeight = -toc.offsetHeight,
 +
                topPos = toc.getBoundingClientRect().top - tocHeight,
 +
                tocToggler = document.getElementById('toctitle');
  
$(document).ready(function($){ 
+
             if (topPos <= tocHeight) {
    $.fn.autoResize = function(options) { 
+
                 toc.classList.add('__sticky', '__ontop', '__hidden');
        var settings = $.extend({ 
+
             }
             onResize : function(){ 
+
            }, 
+
            animate : true, 
+
            animateDuration : 150, 
+
            animateCallback : function(){}, 
+
            extraSpace : 20, 
+
            limit: 700 
+
        }, options); 
+
        this.filter('textarea').each(function(){
+
            var textarea = $(this).css({resize:'none','overflow-y':'auto'}),
+
                 origHeight = textarea.height(),
+
                clone = (function(){
+
                    var props = ['height','width','lineHeight','textDecoration','letterSpacing'],
+
                        propOb = {};
+
                    $.each(props, function(i, prop){
+
                        propOb[prop] = textarea.css(prop);
+
                    });
+
                    return textarea.clone().removeAttr('id').removeAttr('name').css({
+
                        position: 'absolute',  
+
                        top: 0,
+
                        left: -9999
+
                    }).css(propOb).attr('tabIndex','-1').insertBefore(textarea);
+
                })(),
+
                lastScrollTop = null,
+
                updateSize = function() {
+
                    clone.height(0).val($(this).val()).scrollTop(10000);
+
                    var scrollTop = Math.max(clone.scrollTop(), origHeight) + settings.extraSpace,
+
                        toChange = $(this).add(clone);
+
                    if (lastScrollTop === scrollTop) { return; }
+
                    lastScrollTop = scrollTop;
+
                    if ( scrollTop >= settings.limit ) {
+
                        $(this).css('overflow-y','');
+
                        return;
+
                    }
+
                    settings.onResize.call(this);
+
                  settings.animate && textarea.css('display') === 'block' ?
+
                        toChange.stop().animate({height:scrollTop}, settings.animateDuration, settings.animateCallback)
+
                        : toChange.height(scrollTop);
+
+
                };  
+
             textarea
+
                .unbind('.dynSiz')
+
                .bind('keyup.dynSiz', updateSize)
+
                .bind('keydown.dynSiz', updateSize)
+
                .bind('change.dynSiz', updateSize);
+
        });
+
        return this;
+
    };
+
$(function(){
+
    $('textarea').autoResize({ 
+
        extraSpace:0 
+
    }); 
+
}) 
+
});
+
  
/*** AddThis ***/
+
            tocToggler.addEventListener("click", function () {
var addthis_config = {
+
                toc.classList.toggle("__hidden");
"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 ***/
+
            document.addEventListener('scroll', function (e) {
$('#write-article a').click(function () {
+
                topPos = toc.getBoundingClientRect().top;
  $(this).hide();
+
                setTimeout(function () {
  $('#create-page-lay').fadeIn();
+
                    if (topPos <= tocHeight) {
  $('#create-page-lay .createboxInput').focus();
+
                        toc.classList.add('__sticky', '__ontop', '__hidden');
$("#create-page-lay .createboxInput").focusout(function () {
+
                    } else if (topPos && topPos >= 1) {
if ($(this).val() == "") {
+
                        toc.classList.remove('__sticky', '__ontop');
$('#create-page-lay').hide(),
+
                    }
$('#write-article a').fadeIn() }
+
                }, 50);
});
+
            });
  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);
            });
        }
    }
 
});