Template:SNDS PREVIEW

From Olekdia Wiki
Revision as of 16:22, 24 January 2019 by Oleksandr (talk | contribs)

<-- children[0] is an <audio> element
<button onclick="var numChild=2;var children=this.children;this.firstChild.paused?this.firstChild.play():this.firstChild.pause();children[1].src='a/olekdia/wiki_resources/'+(this.firstChild.paused?'ic_play.svg':'ic_pause.svg');this.firstChild.onended=function(){if(children.length>numChild){this.src='a/prana_breath/soundfiles/'+children[numChild].innerHTML;numChild++;this.load();this.play();}else{children[1].src='a/olekdia/wiki_resources/ic_play.svg';}}">
    <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>