}
});
+ $(document).on('gadjo:dialog-loaded', function(e, form) {
+ var $select = $('select#id_jingle');
+ var audio = null;
+ $select.css('width', '80%').css('margin-right', '1em').after('<button id="play-jingle">⏵</button>');
+ $('#play-jingle').on('click', function() {
+ var val = $select.val();
+ if (audio) { audio.pause(); }
+ audio = new Audio('/nonstop/api/jingle/' + val + '/');
+ audio.play();
+ return false;
+ });
+ });
+
});
</script>
{% endblock %}