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 the data of Girls' Frontline and Project Neural Cloud characters.
You can contribute without an account. Learn how to contribute and join our Discord server.

Widget:chibiCostumeSwitcher: 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
Initial setup for testing
 
Changed the way chibi costume IDs are determined
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly><script>
<includeonly><script>
RLQ.push(function () {
RLQ.push(['jquery', function () {
   $(document).ready(function() {
   $(document).ready(function() {
     // Let's make sure the correct values are shown
     // Let's make sure the correct values are shown
     $('.modswitcher').change();
     $('.chibi-costume-switcher').change();
   });
   });
});
}]);


function updateCalculatedValues(data) {
function swap_costume(element, targetId) {
  var ret = data;
 
  // Calculating Max HP for full dummied T-Doll
  if (ret.hasOwnProperty("max_hp_t")) {
    ret.hpmaxwd = ret.max_hp_t * 5;
  }
 
  return ret;
}
 
function swap_costume(element) {
   var neededGadgets = [ 'ext.gadget.md5hasher' ];
   var neededGadgets = [ 'ext.gadget.md5hasher' ];
   if (mw.user.options.get("gadget-chibiAnimation") == 1) {
   if (mw.user.options.get("gadget-chibiAnimation") == 1) {
Line 26: Line 15:
   // Switch costume when everything is ready
   // Switch costume when everything is ready
   mw.loader.using(neededGadgets).then(function () {
   mw.loader.using(neededGadgets).then(function () {
     swap_costume_intern(element);
     swap_costume_intern(element, targetId);
   });
   });
}
}


function swap_costume_intern(element) {
function swap_costume_intern(element, targetId) {
         var selectBox = $(element);
         var selectBox = $(element);
          
          
         costumeSelectionIndex = selectBox.prop('selectedIndex');
         var chibiCostumeName = selectBox.val();
          
          
         var chibiCostumeName = "";
         if (chibiCostumeName != "") {
        if (costumeSelectionIndex != 0) {
           chibiCostumeName = "_" + chibiCostumeName;
           chibiCostumeName = "_costume" + costumeSelectionIndex
         }
         }
        selectBox.closest('.costumeContainer').find('.chibiAnimation,.live2dAnimation,.artTab').trigger("costume_changed", chibiCostumeName);
          
          
         var basePath = "https://en.gfwiki.com/images/"; // ToDo: find a better way to find out the base path
         var targetSelector = targetId == "" ? ".chibiAnimationContainer" : ("#" + targetId);
        $(targetSelector).attr('data-tdoll-costume', chibiCostumeName);
        $(targetSelector).find('.chibiAnimation').trigger("costume_changed", chibiCostumeName);
       
         var tdollId = selectBox.closest('.costumeContainer').find('.tdoll_chibi').data('tdollId');
         var tdollId = selectBox.closest('.costumeContainer').find('.tdoll_chibi').data('tdollId');
         var costumeId = tdollId + chibiCostumeName;
         var costumeId = tdollId + chibiCostumeName;
Line 48: Line 37:
         var cpp = window.gfUtils.createWikiPathPart;
         var cpp = window.gfUtils.createWikiPathPart;
          
          
         var fullartSPath = basePath + cpp (costumeId +"_S.png") + costumeId +"_S.png";
         var basePath = "/";      
         var chibiPath = basePath + cpp(costumeId +"_chibi.png") + costumeId +"_chibi.png";
         var chibiPath = basePath + cpp(costumeId +"_chibi.png") + costumeId +"_chibi.png";
          
          
Line 55: Line 44:


</script>
</script>
<div style="display:flex">
<select class="gf-droplist chibi-costume-switcher" autocomplete="off" onchange="swap_costume(this, '<!--{$target|escape:'html'}-->')" >
<select class="gf-droplist" autocomplete="off" onchange="swap_costume(this)" >
<option value="" selected="selected">Default</option>
<option value="{{BASEPAGENAME}}" selected="selected">Default</option>
<!--{foreach from=$costumes key=key item=item}-->
<!--{foreach from=$costumes key=key item=item}-->
  <option value="<!--{$key|escape:'html'}-->"><!--{$item|escape:'html'}--></option>
  <!--{if $item neq ''}--><option value="<!--{$key|escape:'html'}-->"><!--{$item|escape:'html'}--></option><!--{/if}-->
<!--{/foreach}-->
<!--{/foreach}-->
</select></div></includeonly>
</select></includeonly>


<noinclude>
<noinclude>
{{#widget:chibiCostumeSwitcher
{{#widget:chibiCostumeSwitcher
|target=enemyChibiAnimation
|target=enemyChibiAnimation
|costumes.Executioner_Elite=Elite form
|costumes.costume1=Elite form
|costumes.Executioner_costume2=Another variant
|costumes.costume2=Another variant
|costumes.Executioner_Wedding_Lol=Third variant
|costumes.costume3=Third variant
|costumes.costume4=
|costumes.costume5=
|costumes.costume6=
}}
}}


<div id="enemyChibiAnimation" class="chibiAnimationContainer" data-tdoll-id="Executioner" data-tdoll-hidedormbutton="true"></div>
<div id="enemyChibiAnimation" class="chibiAnimationContainer" data-tdoll-id="Executioner" data-tdoll-hidedormbutton="true" style="border: thin dashed gray;">&nbsp;</div>
</noinclude>
</noinclude>

Latest revision as of 23:26, 7 April 2020