Widget:indexSorterGrouper: Difference between revisions
Jump to navigation
Jump to search
Two different approachs? |
m Missed some parts |
||
(4 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
RLQ.push(['jquery', function () { | RLQ.push(['jquery', function () { | ||
$(document).ready(function() { | $(document).ready(function() { | ||
// initially remove the paragraph | |||
var parents = $(".mw-headline").closest("h2"); | |||
parents.each(function() { | |||
var parent = $(this); | |||
var paragraph = parent.next('p'); | |||
paragraph.replaceWith(paragraph.children()); | |||
}); | |||
// For now, we have to make sure the data is there (Change the template, dammit!) | // For now, we have to make sure the data is there (Change the template, dammit!) | ||
$(". | $(".gfl-doll-card").each(function() { | ||
var element = $(this); | var element = $(this); | ||
var name = element.find('.name').first().text(); | var name = element.find('.name').first().text(); | ||
Line 247: | Line 255: | ||
} | } | ||
var groupHeaderText = getNumberText( | var currentIdxShow = currentTen; | ||
if (sortOrder != -1 && currentIdxShow > 1) currentIdxShow += 1; | |||
var groupHeaderText = getNumberText(currentIdxShow) + "..." + getNumberText(nextElementTen); | |||
var groupHeader = $("<h3 />").text(groupHeaderText).addClass("addedbysorter"); | var groupHeader = $("<h3 />").text(groupHeaderText).addClass("addedbysorter"); | ||
Line 273: | Line 283: | ||
$('[data-tdollserverbutton="true"]').removeClass("enabled"); | $('[data-tdollserverbutton="true"]').removeClass("enabled"); | ||
$('. | $('.gfl-doll-card.unreleased').removeClass('unreleased'); | ||
$('. | $('.gfl-doll-card').each(function() { | ||
var element = $(this); | var element = $(this); | ||
var nameToSet = ""; | var nameToSet = ""; | ||
Line 296: | Line 306: | ||
var parent = $(this); | var parent = $(this); | ||
// All elements inside the paragraph after the h2 which have special class | // All elements inside the paragraph after the h2 which have special class | ||
var elements = parent | var elements = parent.nextUntil("h2", ".gfl-doll-card"); | ||
elements.detach().sort(comparer); | elements.detach().sort(comparer); |
Revision as of 22:28, 24 June 2024
Released on this server: