Участник:T kns/common.js

Материал из Lurkmore
Перейти к навигацииПерейти к поиску

Замечание: Возможно, после публикации вам придётся очистить кэш своего браузера, чтобы увидеть изменения.

  • Firefox / Safari: Удерживая клавишу Shift, нажмите на панели инструментов Обновить либо нажмите Ctrl+F5 или Ctrl+R (⌘+R на Mac)
  • Google Chrome: Нажмите Ctrl+Shift+R (⌘+Shift+R на Mac)
  • Edge: Удерживая Ctrl, нажмите Обновить либо нажмите Ctrl+F5
  • Opera: Нажмите Ctrl+F5.
//<source lang="javascript">
/*********************************************/

//importStylesheet('Участник:T kns/common.css');

appendCSS('#mw_content {width: 740px;} #mw_portlets {position:fixed;height: 90%; overflow: auto;} a.mw-redirect {color:#338800} a.mw-redirect:visited {color:#338899}');

$('#footer').slideToggle();
$('#firstHeading').attr('contentEditable','true');

(function($) {
    $.fn.getAttributes = function() {
        var attributes = {};

        if(!this.length)
            return this;

        $.each(this[0].attributes, function(index, attr) {
            attributes[attr.name] = attr.value;
        });

        return attributes;
    }
})(jQuery);


if(wgIsArticle && $('#ca-edit').length) {
    $('#mw_contentholder > .mw-topboxes').after('<h2><span class="editsection" style="font-weight: 700;">[<a href="/index.php?title='+encodeURIComponent(wgPageName)+'&action=edit&section=0" title="Править введение">править</a>]</span><span class="mw_headline">'+wgTitle+'</span></h2>');
}

var sidebarlinks = $('#p-tb .pBody ul');
function addsidebarlink(link,yep) {
    if(yep !== false) sidebarlinks.append(link);
}

(function() {
    addsidebarlink('<li><a href="'+($('#t-permalink a').attr('href')||'').replace(/\&oldid=.*$/,'')+'">Правильный линк</li>',$('#t-permalink a').size()>0);
    addsidebarlink('<li><a href="//lurkmore.to/_/'+wgArticleId+'">Короткий урл</a></li>',wgArticleId>0);
    addsidebarlink('<li><a href="'+wgScript+'?curid='+wgArticleId+'&diff=0'+'">Последняя правка</a></li>',wgCurRevisionId > 0);
    addsidebarlink('<li><a href="'+wgScript+'?title='+encodeURIComponent(wgPageName)+'&action=purge'+'">Пурж!</a></li>',wgCurRevisionId > 0);
    addsidebarlink('<li><a href="/Lurkmore:Ban/public">В баню!</a></li>');
    addsidebarlink($('<li><a href="#">Свернутые простыни</a></li>').click(function(e) {e.preventDefault();alert(localStorage.clpsd);}));

var ul2ol = $('<li><a href="#">UL -> OL</a></li>').click(function(e) {
    e.preventDefault();
    $('#mw_contentholder ul').each(function() {
        var newol = $('<ol/>');
        newol.attr($(this).getAttributes()).html($(this).html());
        $(this).replaceWith(newol);
    });
});

    addsidebarlink(ul2ol);
    addsidebarlink('<li><a href="/Special:PrefixIndex/'+wgPageName+'">Подстраницы</a></li>');
//    addsidebarlink();
//    addsidebarlink();
})();

if(wgPageName == "Служебная:AbuseFilter") {
	$('td.TablePager_col_af_hit_count > a').each(function() {
		$(this).attr('href',$(this).attr('href')+'&curhitcount='+/^(\d+)\D/.exec($(this).text())[1])
	});

	$('.TablePager_col_af_actions').each(function() {
		if($(this).text().indexOf('Блокировка') != -1) {
			var p = $(this).parent();
			if(p.hasClass('mw-abusefilter-list-enabled')) {
				p.css({'color':'#cd5c5c'});
			}
		}
	});
}

if(wgPageName == "Служебная:AbuseLog") {
	$('#mw_contentholder > ul > li').each(function() {
		if($(this).text().indexOf('Блокировка') != -1) {
			$(this).css({'color':'#cd5c5c'});
		}
	});
	$('div.mw-abuselog-var-value').attr('contenteditable','true');
}

/*
// nyudtest

$('img[src^="/"]').each(function() {
	$(this).attr('src',wgServer+'.nyud.net'+$(this).attr('src'));
});
*/

if(wgPageName == "Служебная:AbuseFilter") {
    importStylesheetURI('//dl.dropbox.com/u/931669/lm/JSCal2-1.9/src/css/jscal2.css');
    importStylesheetURI('//dl.dropbox.com/u/931669/lm/JSCal2-1.9/src/css/border-radius.css');

    $.ajax({
        url:'//dl.dropbox.com/u/931669/lm/JSCal2-1.9/src/js/jscal2.js',
        dataType: 'script',
        cache:true,
        success: function() {
            importScriptURI('//dl.dropbox.com/u/931669/lm/JSCal2-1.9/src/js/unicode-letter.js');
            $.ajax({
                url:'//dl.dropbox.com/u/931669/lm/JSCal2-1.9/src/js/lang/en.js',
                dataType: 'script',
                cache:true,
                success: function() {
                    var from = $('td.mw-input > input[name="wpTestPeriodStart"]'),
                        to = $('td.mw-input > input[name="wpTestPeriodEnd"]'),
                        btn = '<button id="%s_trigger" type="button">...</button>',
                        dateFormat = '%Y%m%d040000',
                        trigger = '%s_trigger';

                    from.attr('id','wpTestPeriodStart');
                    to.attr('id','wpTestPeriodEnd');
                    from.after(btn.replace('%s',from.attr('id')));
                    to.after(btn.replace('%s',to.attr('id')));

                    var CAL1 = new Calendar({
                        inputField:from.attr('id'),
                        dateFormat:dateFormat,
                        showTime: 24,
                        trigger:trigger.replace('%s',from.attr('id'))
                    });

                    var CAL2 = new Calendar({
                        inputField:to.attr('id'),
                        dateFormat:dateFormat,
                        showTime: 24,
                        trigger:trigger.replace('%s',to.attr('id'))
                    });
                }
            });
        }
    });
}

if(_is_autoconfirmed && wgNamespaceNumber == -1 && wgCanonicalSpecialPageName == "Watchlist") {
    $.ajax({url:'//dl.dropbox.com/u/931669/lm/tinycon/tinycon.js', dataType:'script', cache:true}).success(function() {
        Tinycon.setBubble($('strong.mw-watched').length);
    });
}


/*********************************************/
//importStylesheetURI('//dl.dropbox.com/u/931669/lm/calendar/calendar.css');
/*********************************************/
/*********************************************/
importScript('Участник:T kns/cps.js');
importScript('Участник:T kns/contribsrange.js');
importScriptURI('/skins/common/hotcat.js');
/*********************************************/
//</source>