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
 
Trying to get the costume array to run
Line 18: Line 18:
}
}


function swap_costume(element) {
function swap_costume(element, targetId) {
   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 26:
   // 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);
          
          
Line 39: Line 39:
           chibiCostumeName = "_costume" + costumeSelectionIndex
           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).find('.chibiAnimation,.live2dAnimation,.artTab').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 48:
         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 55:


</script>
</script>
<div style="display:flex">
<select class="gf-droplist" autocomplete="off" onchange="swap_costume(this, '<!--{$target|escape:'html'}-->')" >
<select class="gf-droplist" autocomplete="off" onchange="swap_costume(this)" >
<option value="{{BASEPAGENAME}}" 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 ''}--><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>

Revision as of 15:10, 7 July 2018