Widget:chibiCostumeSwitcher: Difference between revisions
Jump to navigation
Jump to search
m missing equals operand |
No edit summary |
||
Line 3: | Line 3: | ||
$(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(); | ||
}); | }); | ||
}); | }); | ||
function swap_costume(element, targetId) { | function swap_costume(element, targetId) { | ||
Line 32: | Line 21: | ||
function swap_costume_intern(element, targetId) { | function swap_costume_intern(element, targetId) { | ||
var selectBox = $(element); | var selectBox = $(element); | ||
console.log("1", element, targetId); | |||
costumeSelectionIndex = selectBox.prop('selectedIndex'); | costumeSelectionIndex = selectBox.prop('selectedIndex'); | ||
Line 41: | Line 31: | ||
var targetSelector = targetId == "" ? ".chibiAnimationContainer" : ("#" + targetId); | var targetSelector = targetId == "" ? ".chibiAnimationContainer" : ("#" + targetId); | ||
$(targetSelector).attr('tdoll-id', chibiCostumeName); | |||
$(targetSelector).find('.chibiAnimation,.live2dAnimation,.artTab').trigger("costume_changed", chibiCostumeName); | $(targetSelector).find('.chibiAnimation,.live2dAnimation,.artTab').trigger("costume_changed", chibiCostumeName); | ||
console.log("2", element, targetSelector); | |||
var tdollId = selectBox.closest('.costumeContainer').find('.tdoll_chibi').data('tdollId'); | var tdollId = selectBox.closest('.costumeContainer').find('.tdoll_chibi').data('tdollId'); | ||
Line 50: | Line 42: | ||
var basePath = "/"; | var basePath = "/"; | ||
var chibiPath = basePath + cpp(costumeId +"_chibi.png") + costumeId +"_chibi.png"; | var chibiPath = basePath + cpp(costumeId +"_chibi.png") + costumeId +"_chibi.png"; | ||
console.log("3", chibiPath ); | |||
$(".tdoll_chibi>img,.chibiAnimationContainer>img").attr("src", chibiPath); | $(".tdoll_chibi>img,.chibiAnimationContainer>img").attr("src", chibiPath); | ||
Line 55: | Line 48: | ||
</script> | </script> | ||
<select class="gf-droplist" 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="{{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}--> |
Revision as of 15:17, 7 July 2018