Difference between revisions of "Widget:StatTable"
Jump to navigation
Jump to search
Pianoforte (talk | contribs) |
(Added document-ready wait functionality as the MediaWiki does not wait for DOM) |
||
(18 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
<script> | <script> | ||
− | |||
− | |||
function swap_costume() { | function swap_costume() { | ||
costumeSelection = document.getElementById("costumeSelection").value; | costumeSelection = document.getElementById("costumeSelection").value; | ||
− | $("#fullart a").attr("href", | + | $("#fullart a").attr("href", costumeSelection); |
$("#fullart a img").attr("src", costumeSelection); | $("#fullart a img").attr("src", costumeSelection); | ||
− | $("#fullart a img").attr("alt", | + | $("#fullart a img").attr("alt", costumeSelection); |
− | $("#fullart a img").attr("srcset", "/wiki/Special:Redirect/file/Springfield" + costumeSelection + ".png 1.5x, /wiki/Special:Redirect/file/Springfield" + costumeSelection + ".png 2x"); | + | //$("#fullart a img").attr("srcset", "/wiki/Special:Redirect/file/Springfield" + costumeSelection + ".png 1.5x, /wiki/Special:Redirect/file/Springfield" + costumeSelection + ".png 2x"); |
$(".tdoll_chibi").attr("src", "/wiki/Special:Redirect/file/Springfield" + costumeSelection + "_S.png"); | $(".tdoll_chibi").attr("src", "/wiki/Special:Redirect/file/Springfield" + costumeSelection + "_S.png"); | ||
+ | |||
+ | // As we change the link, we have to update the Thumb-Cache of the Media Viewer | ||
+ | // Clear up the thumbs cache | ||
+ | if (mv && mv.mmv && mv.mmv.bootstrap && mv.mmv.bootstrap.viewer) { | ||
+ | mw.mmv.bootstrap.thumbs = []; | ||
+ | // Search for all thumbs | ||
+ | mw.mmv.bootstrap.processThumbs($("#content")); | ||
+ | // Re-Init the viewer with the new thumbs | ||
+ | mw.mmv.bootstrap.viewer.initWithThumbs(mw.mmv.bootstrap.thumbs); | ||
+ | } | ||
} | } | ||
− | + | RLQ.push(['jquery', function () { | |
− | RLQ.push(function () { | + | $(document).ready(function() { |
− | $(document).ready(function() { | ||
if (document.getElementById("stat_table")) { | if (document.getElementById("stat_table")) { | ||
st_element = document.getElementById("stat_table"); | st_element = document.getElementById("stat_table"); | ||
Line 21: | Line 28: | ||
} | } | ||
swap_costume(); | swap_costume(); | ||
− | }); | + | }); |
− | }); | + | }]); |
</script> | </script> | ||
Line 48: | Line 55: | ||
}} | }} | ||
− | <div id="fullart">[[file:Springfield.png|420px]]</div> | + | <div id="fullart" style="float:left; padding: 10px;">[[file:Springfield.png|420px]]</div> |
− | [[File:Springfield_chibi.png|link=|center|class=tdoll_chibi]] | + | <div id="dummydiv" style="float:left; padding: 10px; border: thin solid white;" onclick="alert('hi');">[[File:Springfield_chibi.png|link=|center|class=tdoll_chibi]]</div> |
</noinclude> | </noinclude> |