Widget:Live2DSwitcher: Difference between revisions
Jump to navigation
Jump to search
m Waiting for different gadget |
Added document-ready wait functionality as the MediaWiki does not wait for DOM |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly><div><script> | <includeonly><div><script> | ||
RLQ.push(['jquery', function () { | RLQ.push(['jquery', function () { | ||
$(document).ready(function() { | |||
var containers = $('.dollLive2d'); | var containers = $('.dollLive2d'); | ||
if (containers.length < 1) return; | if (containers.length < 1) return; | ||
Line 7: | Line 8: | ||
var container = $(val); | var container = $(val); | ||
var doll = container.data('t-doll'); | var doll = container.data('t-doll'); | ||
container.on("live2dloaded", function(event) { | |||
container.find('.live2dswitcher option').remove(); | container.find('.live2dswitcher option').remove(); | ||
var settingsContainer = container.find('.live2dsettings').first(); | var settingsContainer = container.find('.live2dsettings').first(); | ||
Line 31: | Line 33: | ||
}); | }); | ||
}); | }); | ||
}); | |||
}]); | }]); | ||
Line 54: | Line 57: | ||
<option value="" selected="selected">Loading...</option> | <option value="" selected="selected">Loading...</option> | ||
</select></div></includeonly><noinclude> | </select></div></includeonly><noinclude> | ||
<div class="dollLive2d" data-t-doll="Thompson" data-costume="costume1" style="height: 800px; width: 700px;"> | <div class="dollLive2d" data-live2d-needed="true" data-t-doll="Thompson" data-costume="costume1" style="height: 800px; width: 700px;"> | ||
{{#widget:Live2DSwitcher}} | {{#widget:Live2DSwitcher}} | ||
<div class="live2dsettings" style="display:none">{{:Thompson/Live2DSettings}}</div> | <div class="live2dsettings" style="display:none">{{:Thompson/Live2DSettings}}</div> | ||
</div> | </div> | ||
</noinclude> | </noinclude> |