Welcome to IOPWiki, Commander.
We are searching for new editors to keep track of Girls' Frontline 2 content, as well as veteran players to complete existing Girls' Frontline and Project Neural Cloud articles.
You can contribute without an account. Learn how to contribute and join our Discord server.

Widget:indexSorterGrouper: 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
Added grouping for class/rarity
Fixed Index grouping
Line 191: Line 191:
    
    
   var grouper = function (parent, elements) {
   var grouper = function (parent, elements) {
     var firstTen = Math.ceil(parseInt(elements.first().data('index')) / 10) * 10;
     var firstIndex = elements.first().data('index');
     var groupHeader = $("<h3 />").text("..." + firstTen).addClass("addedbysorter");
    var firstTen = Math.ceil(parseInt(firstIndex) / 10) * 10;
     var groupHeader = $("<h3 />").text(getNumberText(firstIndex) + "..." + getNumberText(firstTen)).addClass("addedbysorter");
     groupHeader.insertBefore(elements.first());
     groupHeader.insertBefore(elements.first());
      
      
     $.grep(elements, function(element, i) {
     $.grep(elements, function(element, i) {
       var currentTen = Math.ceil(parseInt($(element).data('index')) / 10) * 10;
       if (elements <= i+1) {
      var nextElementTen = Math.ceil(parseInt($(elements[i+1]).data('index')) / 10) * 10;
         return true;
      if (currentTen !== nextElementTen) {
         var linebreaker = $("<br />").addClass("addedbysorter");
        linebreaker.insertAfter(element);
       
        var groupHeaderText = currentTen + "..." + nextElementTen;
        if (!isNaN(nextElementTen)) {
          var groupHeader = $("<h3 />").text(groupHeaderText).addClass("addedbysorter");
          groupHeader.insertAfter(linebreaker);
        }
       }
       }
      var nextElement = $(elements[i+1]);
     
      createIndexGroup(element, nextElement);
     
       return true;
       return true;
     });
     });
Line 213: Line 209:
    
    
   tdollSorter(comparer, grouper);
   tdollSorter(comparer, grouper);
}
function getNumberText(val) {
  if (!val || isNaN(val)) {
    return "";
  }
  return "" + val;
}
function createIndexGroup(element, nextElement) {
  var currentTen = Math.ceil(parseInt($(element).data('index')) / 10) * 10;
  var nextElementTen = Math.ceil(parseInt(nextElement.data('index')) / 10) * 10;
  if (currentTen !== nextElementTen) {
    var linebreaker = $("<br />").addClass("addedbysorter");
    linebreaker.insertAfter(element);
   
    var groupHeaderText = getNumberText(currentTen) + "..." + getNumberText(nextElementTen);
    if (!isNaN(nextElementTen)) {
      var groupHeader = $("<h3 />").text(groupHeaderText).addClass("addedbysorter");
      groupHeader.insertAfter(linebreaker);
    }
  }
}
}



Revision as of 17:57, 1 May 2018


 

Released on this server:

Some heading