Grab value and play sound?

Hey can any one help me with this? I’m trying to modify someones windows .gadget (with permission) to play a PING sound when a specific word/name appears in the “Last” And “Next” area. I’m not very good with this sort of thing, I searched all around the web and i couldn’t find an answer. If any one can help i would be very grateful. Thanks :slight_smile:


 <script type="text/javascript">
      var updateUrl = "http://www.pathofexile.com/index/beta-invite-query/mode/next?id=0";
      var infoLast = "";
      var infoNext = "";
      var infoSeconds = -1;
      var updateIntervalId = -1;
      
      System.Gadget.settingsUI = "settings.html";
      System.Gadget.onSettingsClosed = SettingsClosed;
      
      var sBackgroundColor, sTextColor, sHighlightColor;
      var sScaleFactor;
      
      function SettingsClosed() {
        loadSettings();
        writeCSS();
      }
      
      function init() {
        $.support.cors = true;
        loadSettings();
        if (sBackgroundColor == null || sBackgroundColor == "") {
          sBackgroundColor = "black";
          System.Gadget.Settings.writeString("sBackgroundColor", sBackgroundColor);
        }
        if (sTextColor == null || sTextColor == "") {
          sTextColor = "#dfcf99";
          System.Gadget.Settings.writeString("sTextColor", sTextColor);
        }
        if (sHighlightColor == null || sHighlightColor == "") {
          sHighlightColor = "white";
          System.Gadget.Settings.writeString("sHighlightColor", sHighlightColor);
        }
        if (sScaleFactor == null || sScaleFactor == "") {
          sScaleFactor = 100;
          System.Gadget.Settings.write("sScaleFactor", sScaleFactor);
        }
        writeCSS();
        getInfo();
      }
      
      function loadSettings() {
        sBackgroundColor = System.Gadget.Settings.readString("sBackgroundColor");
        sTextColor = System.Gadget.Settings.readString("sTextColor");
        sHighlightColor = System.Gadget.Settings.readString("sHighlightColor");
        sScaleFactor = System.Gadget.Settings.read("sScaleFactor");
      }
      
      function writeCSS() {
        $("#css").html(
          " <style type=\\"text/css\\">" +
          " body {" +
          "   width: " + (380 * sScaleFactor / 100) + "px;" +
          "   height: " + (80 * sScaleFactor / 100) + "px;" +
          "   font-size: " + (21 * sScaleFactor / 100) + "px;" +
          "   color: " + sTextColor + ";" +
          "   background-color: " + sBackgroundColor + ";" +
          " }" +
          " a {" +
          "   color: " + sTextColor + ";" +
          " }" +
          " .profile-link:hover {" +
          "   color: " + sHighlightColor + ";" +
          " }" +
          " a:hover {" +
          "   color: " + sHighlightColor + ";" +
          " }" +
          " #websitelink {" +
          "   font-size: " + (12 * sScaleFactor / 100) + "px;" +
          "   right: " + (9 * sScaleFactor / 100) + "px; " +
          "   bottom: " + (5 * sScaleFactor / 100) + "px; " +
          " }" +
          " </style>"
        );
        $("body")
          .css("width", (380 * sScaleFactor / 100) + "px")
          .css("height", (80 * sScaleFactor / 100) + "px");
      }
      
      function getInfo() {
        $("#info_timer").text("refreshing...");
        $.getJSON(updateUrl, function(data) {
          infoLast = data.p1.last.name.replace('<a', '<a target="_blank"').replace('href="/', 'href="http://www.pathofexile.com/');
          infoNext = data.p1.upcoming[0].name.replace('<a', '<a target="_blank"').replace('href="/', 'href="http://www.pathofexile.com/');
          infoSeconds = data.p1.next_s;
          $("#info_last").html(infoLast);
          $("#info_next").html(infoNext);
          updateTimer();
          if (updateIntervalId == -1) updateIntervalId = setInterval('updateTimer();', 1000);
        })
        .error(function () {
          $("#info_last").text("error!");
          $("#info_next").text("waiting...");
          infoSeconds = 60;
          updateTimer();
          if (updateIntervalId == -1) updateIntervalId = setInterval('updateTimer();', 1000);
          setTimeout('getInfo();', 60 * 1000);
        });
      }
      
      function updateTimer() {
        if (infoSeconds <= 0) {
          clearInterval(updateIntervalId);
          updateIntervalId = -1;
          $("#info_timer").text("refreshing...");
          getInfo();
          return;
        }
        var timerSeconds = infoSeconds;
        var timerString = "";
        if (timerSeconds >= (60 * 60)) {
          var hours = Math.floor(timerSeconds / (60 * 60));
          timerSeconds -= hours * (60 * 60);
          timerString += hours + "h ";
        }
        if (timerSeconds >= 60) {
          var minutes = Math.floor(timerSeconds / 60);
          timerSeconds -= minutes * 60;
          timerString += minutes + "m ";
        }
        timerString += timerSeconds + "s";
        $("#info_timer").html(timerString);
        infoSeconds--;
      }
    </script>