• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Difference between revisions of "Widget:AudioPlayer"

From Kancolle Wiki
Jump to navigation Jump to search
m
Line 11: Line 11:
 
     <button onclick="document.getElementById('player').muted=!document.getElementById('player').muted">Mute/ Unmute</button>
 
     <button onclick="document.getElementById('player').muted=!document.getElementById('player').muted">Mute/ Unmute</button>
 
</div>
 
</div>
 +
 +
<audio id="myTune">
 +
<source src="https://yksk.kancollewiki.net/w/images/a/a4/Ayanami_Mid_Autumn2015.ogg">
 +
</audio>
 +
<div class="btn-group btn-group-xs">
 +
 +
<a href="javascript:void(0)" class="btn btn-default" data-toggle="tooltip" title="Preview" onclick="aud_play_pause()"><i id="stateicon" class="fa fa-play"></i></a>
 +
 +
<script>
 +
  function aud_play_pause() {
 +
    var myAudio = document.getElementById("myTune");
 +
    if (myAudio.paused) {
 +
      $('#stateicon').removeClass('fa fa-play');
 +
      $('#stateicon').addClass('fa fa-pause');
 +
      myAudio.play();
 +
    } else {
 +
      $('#stateicon').removeClass('fa fa-pause');
 +
      $('#stateicon').addClass('fa fa-play');
 +
      myAudio.pause();
 +
  }
 +
}
 +
 
</includeonly>
 
</includeonly>

Revision as of 06:00, 1 November 2020

Test