Kontent qismiga oʻtish

MediaWiki:Gadget-AggregateInterprojectLinks.js

Vikilug‘atdan olingan

Eslatma: Saqlaganingizdan soʻng, oʻzgarishlarni koʻrish uchun brauzeringiz keshini tozalashingizga toʻgri kelishi mumkin.

  • Firefox / Safari: Shift tugmasini bosgan holda, Yangilash unsurlar darchasini bosing, yoki Ctrl-F5 yoki Ctrl-R (Macda ⌘-R) ni bosing
  • Google Chrome: Ctrl-Shift-R (Macda ⌘-Shift-R) ni bosing
  • Internet Explorer / Edge: Ctrlni bosgan holda, Yangilashni bosing, yoki Ctrl-F5ni bosing
  • Opera: Ctrl-F5ni bosing.
/*
** {{pedia}} va shu kabi andozalardan boshqa loyihalarga havolalar yon panel roʻyxatini yaratadi.
** <nowiki>
*/
$(function () {
	// Broken on Minerva...
	if (mw.config.values.skin === "minerva") return;

	var spans = $('span.interProject a:first-child').clone();
	if (spans.length === 0) return;

	// sort alphabetically
	function sortbylabel(a, b) {
		// get labels
		a = $(a).text();
		b = $(b).text();
		// return sort order
		if (a < b) return -1;
		if (a > b) return 1;
		return 0;
	}
	
	spans.sort(sortbylabel);
	
	var isVector2022 = mw.config.get('skin') === 'vector-2022';
	var newLinksWrapper = $('<div>', {
		'class': 'pBody body vector-menu-content',
		'style': 'display:block'
	});
	if (isVector2022)
		newLinksWrapper.addClass('mw-portlet mw-portlet-projects');

	$(spans).wrap('<li class="mw-list-item">').parent()
		.appendTo($('<ul class="vector-menu-content-list">')).parent()
			.appendTo(newLinksWrapper);
	
	var collapsed = mw.cookie.get("vector-nav-p-projects") == "false";
	var projectBox = $('<div>', {
		addClass: 'vector-menu vector-menu-portal portlet portal ' + (collapsed ? "collapsed" : "expanded"),
		id: 'p-projects'
	})
	.append($(isVector2022 
				? '<div id="p-projects-label" class="vector-menu-heading">In other projects</div>'
				: '<label id="p-projects-label" aria-label="" class="vector-menu-heading"><span class="vector-menu-heading-label">In other projects</span></label>'))
	.append(newLinksWrapper);
		
	$('#p-tb').after(projectBox);
});
//</nowiki>