},
changeGlyph: function(resElem){
+ //wait image element
+ var waitImg = "<img id='wait' src='"+static_url+"telemeta/images/wait.gif' style='width: 15px;'/>";
+ //load filepath when the elment id is the public_id of resource element.
+ if(resElem.indexOf("/")==-1){
+ $('#'+resElem).removeClass().append(waitImg);
+ json_sync([resElem, "mp3"], "telemeta.get_item_export_url", function (data) {
+ $('#'+resElem).attr('id', data.result);
+ resElem = data.result;
+ console.log(data.result);
+ });
+ }
if(this.playing === '' || this.playing === resElem){
if(this.state === 'stop'){
+ //if wait image is not displayed
+ if($('#wait').length==0){
+ $('[id="'+resElem+'"]').append(waitImg);
+ }
this.state = 'play';
document.getElementById(resElem).setAttribute("class", "glyphicon glyphicon-pause");
playlistUtils.loadAudio(resElem);
}
}
-
-
}
+
+$(function () {
+ //event in order to remove wait image when audio is playing
+ playlistUtils.audio.onplay = function () {
+ $('#wait').remove();
+ }
+})
{% endblock %}
{% block extra_javascript %}
+<script> var static_url = {{ STATIC_URL }}</script>
<script src="{{ STATIC_URL }}telemeta/js/popupdiv.js" type="text/javascript"></script>
<script src="{{ STATIC_URL }}telemeta/js/playlist.js" type="text/javascript"></script>
<script src="{{ STATIC_URL }}tablesorter/jquery.tablesorter.min.js" type="text/javascript"></script>
<tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
<td align="center" style="vertical-align:middle;">
{% if resource.element.file %}
- <a href="#" id="{{ resource.public_id }}" onclick="playlistUtils.changeGlyph(this.id)" class="glyphicon glyphicon-play" style="font-size: 1.3em;text-decoration: none"><p style="opacity:0;font-size:0">d</p></a>
+ <a href="#" id="{{ resource.element.public_id }}" onclick="playlistUtils.changeGlyph(this.id)" class="glyphicon glyphicon-play" style="font-size: 1.3em;text-decoration: none"><p style="opacity:0;font-size:0">d</p></a>
{% endif %}
</td>
<td style="max-width:200px">