helialprofile.png
Welcome to IOPWiki, Commander.
We are lacking editors focused on Girls' Frontline and Girls' Frontline 2. You can contribute without an account. Learn how to contribute and join our Discord server.

Difference between revisions of "MediaWiki:Gadget-artTab.js"

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
m (Debugging)
m (Typo)
Line 3: Line 3:
 
   var artTabDiv = currentElement .closest('.artTab');
 
   var artTabDiv = currentElement .closest('.artTab');
 
   artTabDiv.find('.artTabLinks').removeClass('active');
 
   artTabDiv.find('.artTabLinks').removeClass('active');
   artTabDiv.find('.artTabContent fullart').hide();
+
   artTabDiv.find('.artTabContent .fullart').hide();
 
    
 
    
 
   var live2dActive = false; // ToDo
 
   var live2dActive = false; // ToDo
Line 9: Line 9:
 
     console.log("?");
 
     console.log("?");
 
   } else {
 
   } else {
    console.log("[data-variant='" + currentElement.data('variant') +"']");
 
    console.log(artTabDiv.find("[data-variant='" + currentElement.data('variant') +"']"));
 
 
     artTabDiv.find("[data-variant='" + currentElement.data('variant') +"']").show();
 
     artTabDiv.find("[data-variant='" + currentElement.data('variant') +"']").show();
 
   }
 
   }

Revision as of 02:32, 13 January 2018

function switchVariant(event, variant) {
  var currentElement = $(event.target);
  var artTabDiv = currentElement .closest('.artTab');
  artTabDiv.find('.artTabLinks').removeClass('active');
  artTabDiv.find('.artTabContent .fullart').hide();
  
  var live2dActive = false; // ToDo
  if (live2dActive) {
    console.log("?");
  } else {
    artTabDiv.find("[data-variant='" + currentElement.data('variant') +"']").show();
  }

  // Set "active" at the end
  currentElement.addClass('active');
}

RLQ.push(function () {
  $(document).ready(function() { 
    var artTabDiv = $('.artTab');
  
    var normalButton = $('<button></button>');
    normalButton.addClass('artTabLinks');
    normalButton.click(switchVariant);
    normalButton.data('variant', "");
    normalButton.text("Normal");

    var damagedButton = $('<button></button>');
    damagedButton.addClass('artTabLinks');
    damagedButton.click(switchVariant);
    damagedButton.data('variant', "D");
    damagedButton.text("Damaged");
  
    var variantswitcher = $('<div></div>');
    variantswitcher.addClass('variantswitcher');
    variantswitcher.append(normalButton);
    variantswitcher.append(damagedButton);
    
    artTabDiv.prepend(variantswitcher);

    normalButton.click();
  });
});