Welcome to IOPWiki, Commander.
With the release of the new game, we encourage contributions to topics related to Girls' Frontline 2. Learn how to contribute, read the maintenance guide, and join our Discord server to discuss major changes.
If you or someone you know can help deciphering the game files, contact our administrator.

Widget:indexSorterGrouper/sandbox: Difference between revisions

Welcome to IOP Wiki. This website is maintained by the Girls' Frontline community and is free to edit by anyone.
Jump to navigation Jump to search
Adding functions step by step
Removing first function
 
Line 55: Line 55:
   });
   });
}]);
}]);
function orderByName(currentButton) {
  var sortOrder = tdollSorterActiveButton(currentButton);
 
  var comparer = function (a, b) {
    var nameA=$(a).data('name').toLowerCase();
    var nameB=$(b).data('name').toLowerCase();
    if (nameA < nameB) return -1 * sortOrder;
    if (nameA > nameB) return 1 * sortOrder;
    return 0;
  };
 
  var grouper = function (parent, elements) {
    var currentLetter = getFirstLetterGroup($(elements).first().data('name'));
    var groupHeader = $("<h3><span class="mw-headline" id="Some_heading">").text(currentLetter.toUpperCase() + "...").addClass("addedbysorter");
    groupHeader.insertBefore(elements.first());
   
    $.grep(elements, function(element, i) {
      var currentLetter = getFirstLetterGroup($(element).data('name'));
      var nextElementLetter = getFirstLetterGroup($(elements[i+1]).data('name'));
      if (currentLetter !== nextElementLetter) {
        var groupHeaderText = nextElementLetter.toUpperCase() + "...";
        if (groupHeaderText.trim() != "...") {
          var groupHeader = $("<h3 />").text(groupHeaderText).addClass("addedbysorter");
          groupHeader.insertAfter(element);
        }
      }
      return true;
    });
  };
 
  tdollSorter(comparer, grouper);
}


function getFirstLetterGroup(element) {
function getFirstLetterGroup(element) {

Latest revision as of 00:23, 27 July 2024


 

Released on this server:

Some heading