Widget:chibiCostumeSwitcher: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Changed the way chibi costume IDs are determined |
||
(2 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 | ||
$('.chibi-costume-switcher').change(); | $('.chibi-costume-switcher').change(); | ||
}); | }); | ||
}); | }]); | ||
function swap_costume(element, targetId) { | function swap_costume(element, targetId) { | ||
Line 21: | Line 21: | ||
function swap_costume_intern(element, targetId) { | function swap_costume_intern(element, targetId) { | ||
var selectBox = $(element); | var selectBox = $(element); | ||
var chibiCostumeName = selectBox.val(); | |||
if (chibiCostumeName != "") { | |||
chibiCostumeName = "_" + chibiCostumeName; | |||
chibiCostumeName = " | |||
} | } | ||
Line 33: | Line 31: | ||
$(targetSelector).attr('data-tdoll-costume', chibiCostumeName); | $(targetSelector).attr('data-tdoll-costume', chibiCostumeName); | ||
$(targetSelector).find('.chibiAnimation').trigger("costume_changed", 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'); | ||
Line 42: | Line 39: | ||
var basePath = "/"; | var basePath = "/"; | ||
var chibiPath = basePath + cpp(costumeId +"_chibi.png") + costumeId +"_chibi.png"; | var chibiPath = basePath + cpp(costumeId +"_chibi.png") + costumeId +"_chibi.png"; | ||
$(".tdoll_chibi>img,.chibiAnimationContainer>img").attr("src", chibiPath); | $(".tdoll_chibi>img,.chibiAnimationContainer>img").attr("src", chibiPath); | ||
Line 49: | Line 45: | ||
</script> | </script> | ||
<select class="gf-droplist chibi-costume-switcher" autocomplete="off" onchange="swap_costume(this, '<!--{$target|escape:'html'}-->')" > | <select class="gf-droplist chibi-costume-switcher" autocomplete="off" onchange="swap_costume(this, '<!--{$target|escape:'html'}-->')" > | ||
<option value=" | <option value="" selected="selected">Default</option> | ||
<!--{foreach from=$costumes key=key item=item}--> | <!--{foreach from=$costumes key=key item=item}--> | ||
<!--{if $item neq ''}--><option value="<!--{$key|escape:'html'}-->"><!--{$item|escape:'html'}--></option><!--{/if}--> | <!--{if $item neq ''}--><option value="<!--{$key|escape:'html'}-->"><!--{$item|escape:'html'}--></option><!--{/if}--> |
Latest revision as of 23:26, 7 April 2020