Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
No edit summary
No edit summary
Line 204: Line 204:
}
}


function groupClassCategoryHeading($heading) {
function groupClassCategoryHeading($heading, category) {
var title = getHeadingLabel($heading);
var $inner = $heading.children('.wizlords-mobile-class-category-heading-inner').first();
var $inner = $heading.children('.wizlords-mobile-class-category-heading-inner').first();
var $indicator = $heading.children('.indicator, .mf-icon').first();
var $headline = $heading.children('.mw-headline').first();
var $icon = $heading.children('.wizlords-mobile-class-category-heading-icon').first();
var $editSection = $heading.children('.mw-editsection').first();
var $editSection = $heading.children('.mw-editsection').first();
$heading
.contents()
.filter(function () {
return this.nodeType === 3;
})
.remove();
$heading
.children('.indicator, .mf-icon, .mw-headline, .wizlords-mobile-class-category-heading-icon')
.remove();


if (!$inner.length) {
if (!$inner.length) {
Line 221: Line 230:
}
}


if ($indicator.length) {
$inner.empty().append(
$inner.append($indicator);
$('<span>')
}
.addClass('wizlords-mobile-class-category-heading-title')
 
.text(title)
if ($headline.length) {
).append(
$inner.append($headline);
$('<span>')
}
.addClass('wizlords-mobile-class-category-heading-icon')
 
.append(getClassCategoryIcon(category.icon))
if ($icon.length) {
);
$inner.append($icon);
}
}
}


Line 238: Line 245:


if ($inner.length) {
if ($inner.length) {
$inner.children().insertBefore($inner);
var title = $.trim($inner.children('.wizlords-mobile-class-category-heading-title').first().text());
 
if (title) {
$inner.before(document.createTextNode(title));
}
 
$inner.remove();
$inner.remove();
}
}
Line 255: Line 267:
.addClass('wizlords-mobile-class-category-heading-' + category.variant);
.addClass('wizlords-mobile-class-category-heading-' + category.variant);


if (!$heading.children('.wizlords-mobile-class-category-heading-icon').length) {
groupClassCategoryHeading($heading, category);
var $icon = $('<span>')
.addClass('wizlords-mobile-class-category-heading-icon')
.append(getClassCategoryIcon(category.icon));
var $editSection = $heading.children('.mw-editsection').first();
 
if ($editSection.length) {
$icon.insertBefore($editSection);
} else {
$heading.append($icon);
}
}
 
groupClassCategoryHeading($heading);
} else {
} else {
ungroupClassCategoryHeading($heading);
ungroupClassCategoryHeading($heading);