Difference between revisions of "User:Tark/Sandbox/Page.js"

From Team Fortress Wiki
Jump to: navigation, search
m (already implemented)
m
Line 1: Line 1:
// Todo...
+
// Audio player thing
 +
// Imported from pwiki, modified
 +
function toggleAudio(el) {
 +
    var theParent = $(el).parent();
 +
    var theAudio = theParent.find('audio').get(0);
 +
    var theFancyText = theParent.find('a');
 +
    theAudio.play()
 +
    theAudio.addEventListener("play", function () {
 +
        theFancyText.text("Playing")
 +
    });
 +
    theAudio.addEventListener("ended", function () {
 +
        theFancyText.text("Play")
 +
    });
 +
};

Revision as of 04:59, 21 September 2021

// Audio player thing
// Imported from pwiki, modified
function toggleAudio(el) {
    var theParent = $(el).parent();
    var theAudio = theParent.find('audio').get(0);
    var theFancyText = theParent.find('a');
    theAudio.play()
    theAudio.addEventListener("play", function () {
        theFancyText.text("Playing")
    });
    theAudio.addEventListener("ended", function () {
        theFancyText.text("Play")
    });
};