Welcome to IOPWiki, Commander.
With the release of the Global Beta, we encourage contributions to topics related to Girls' Frontline 2. Learn how to contribute and join our Discord server to discuss major changes.

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
Fixed Index grouping
Added reverse sorting and some name bugfix
Line 25: Line 25:


function orderByName(currentButton) {
function orderByName(currentButton) {
   tdollSorterActiveButton(currentButton);
   var sortOrder = tdollSorterActiveButton(currentButton);
    
    
   var comparer = function (a, b) {
   var comparer = function (a, b) {
     var nameA=$(a).data('name').toLowerCase();
     var nameA=$(a).data('name').toLowerCase();
     var nameB=$(b).data('name').toLowerCase();
     var nameB=$(b).data('name').toLowerCase();
     if (nameA < nameB) return -1;
     if (nameA < nameB) return -1 * sortOrder;
     if (nameA > nameB) return 1;
     if (nameA > nameB) return 1 * sortOrder;
     return 0;
     return 0;
   };
   };
    
    
   var grouper = function (parent, elements) {
   var grouper = function (parent, elements) {
     if (parent.find('#Unreleased_T-Dolls').length > 0 || parent.find('#Extra_T-Dolls').length > 0) {
     var currentLetter = getFirstLetterGroup($(elements).first().data('name'));
      return;
     var groupHeader = $("<h3 />").text(currentLetter.toUpperCase() + "...").addClass("addedbysorter");
    }
   
     var groupHeader = $("<h3 />").text("#...").addClass("addedbysorter");
     groupHeader.insertBefore(elements.first());
     groupHeader.insertBefore(elements.first());
      
      
Line 75: Line 72:


function orderByRarityClassName(currentButton) {
function orderByRarityClassName(currentButton) {
   tdollSorterActiveButton(currentButton);
   var sortOrder = tdollSorterActiveButton(currentButton);
    
    
   var comparer = function (a, b) {
   var comparer = function (a, b) {
       var contentA = getSortKeyForRarityClassName($(a));
       var contentA = getSortKeyForRarityClassName($(a));
       var contentB = getSortKeyForRarityClassName($(b));
       var contentB = getSortKeyForRarityClassName($(b));
       return (contentA < contentB) ? -1 : (contentA > contentB) ? 1 : 0;
       var comp = (contentA < contentB) ? -1 : (contentA > contentB) ? 1 : 0;
      return comp * sortOrder;
     };
     };
    
    
Line 89: Line 87:


function orderByClassRarityName(currentButton) {
function orderByClassRarityName(currentButton) {
   tdollSorterActiveButton(currentButton);
   var sortOrder = tdollSorterActiveButton(currentButton);
    
    
   var comparer = function (a, b) {
   var comparer = function (a, b) {
       var contentA = getSortKeyForClassRarityName($(a));
       var contentA = getSortKeyForClassRarityName($(a));
       var contentB = getSortKeyForClassRarityName($(b));
       var contentB = getSortKeyForClassRarityName($(b));
       return (contentA < contentB) ? -1 : (contentA > contentB) ? 1 : 0;
       var comp = (contentA < contentB) ? -1 : (contentA > contentB) ? 1 : 0;
      return comp * sortOrder;
     };
     };
    
    
Line 182: Line 181:


function orderByIndex(currentButton) {
function orderByIndex(currentButton) {
   tdollSorterActiveButton(currentButton);
   var sortOrder = tdollSorterActiveButton(currentButton);
    
    
   var comparer = function (a, b) {
   var comparer = function (a, b) {
       var contentA = parseInt($(a).data('index'));
       var contentA = parseInt($(a).data('index'));
       var contentB = parseInt($(b).data('index'));
       var contentB = parseInt($(b).data('index'));
       return (contentA < contentB) ? -1 : (contentA > contentB) ? 1 : 0;
       var comp = (contentA < contentB) ? -1 : (contentA > contentB) ? 1 : 0;
      return comp * sortOrder;
     };
     };
    
    
Line 236: Line 236:
   $('[data-tdollsortbutton="true"]').removeClass("enabled");
   $('[data-tdollsortbutton="true"]').removeClass("enabled");
   $(butt).addClass("enabled");
   $(butt).addClass("enabled");
 
  if ($(butt).is('.ascending')) {
    $(butt).removeClass('ascending');
    return 1;
  } else {
    $(butt).addClass('ascending');
    return -1;
  }
}
}



Revision as of 18:18, 1 May 2018


 

Released on this server:

Some heading