Template:SNDS PREVIEW

From Olekdia Wiki
Revision as of 14:10, 25 January 2019 by Oleksandr (talk | contribs)

<-- children[0] is an <audio> element, children[1] is an <img> element -->
<button onclick="var i=2;var c=this.children;var stop=function(){c[0].pause();c[1].src='a/olekdia/wiki_resources/ic_play.svg';c[0].src='a/prana_breath/soundfiles/{{{1}}}';};if(c[0].paused){c[0].play();c[1].src='a/olekdia/wiki_resources/ic_pause.svg';c[0].onended=function(){if(c.length>i){c[0].src='a/prana_breath/soundfiles/'+c[i].innerHTML;i++;c[0].load();c[0].play();}else{stop();} } }else{stop();};">
    <audio>
        <-- Here first audio data is inserted -->
        <source src="a/prana_breath/soundfiles/sound_0.ogg" type="audio/ogg">
    </audio>
    
    <-- Image inside button -->
    <img src="a/olekdia/wiki_resources/ic_play.svg" width="30"/>

    <!-- Here sound elements is inserted -->
    <span style="display: none;">sound_2.ogg</span>
    <span style="display: none;">sound_1.ogg</span>
    <span style="display: none;">sound_4.ogg</span>
</button>