Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasrhee1208wastaken authored Jan 17, 2024
1 parent a862726 commit e4ff624
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@
<div class="upload-result"></div>
<script>
var swfobject = {};
var isEmbedded = false;

swfobject.embedSWF = function(url, cont, width, height){
var ruffle = window.RufflePlayer.newest(),
existingPlayer = document.getElementById(cont).querySelector('.ruffle-player');

if (existingPlayer) {
existingPlayer.parentNode.removeChild(existingPlayer);
if (isEmbedded) {
return; // Skip embedding if already embedded
}

var ruffle = window.RufflePlayer.newest();
var player = Object.assign(document.getElementById(cont).appendChild(ruffle.createPlayer()), {
width: width,
height: height,
style: 'width: ' + width + 'px; height: ' + height + 'px',
});

player.load({ url: url });
isEmbedded = true;
};

document.addEventListener('DOMContentLoaded', function () {
Expand Down

0 comments on commit e4ff624

Please sign in to comment.