remove index, eq magic and just reference videos by db ids

This commit is contained in:
Sanj 2012-05-15 03:26:55 +05:30
parent e86eb2e096
commit 1500a97c35

View File

@ -92,7 +92,7 @@
{% endfor %} {% endfor %}
{% for v in talk.videos.all %} {% for v in talk.videos.all %}
<span class="talkIcon"> <span class="talkIcon">
<a href="/static/{{ v.padmavideo.padma_link }}" class="padmaLink" target="_blank"> <a href="/static/{{ v.padmavideo.padma_link }}" class="padmaLink" data-video-id="{{v.id}}" target="_blank">
<img src="/static/images/VideoIcon.jpg" title="<span class='ttTitle'>Video: {{ talk.title }}.</span><span class='rightclickHelp'>Click to view on page</span>"> <img src="/static/images/VideoIcon.jpg" title="<span class='ttTitle'>Video: {{ talk.title }}.</span><span class='rightclickHelp'>Click to view on page</span>">
</a> </a>
</span> </span>
@ -100,7 +100,7 @@
</span> </span>
&nbsp;&nbsp; {{ talk.title }} {% if talk.presenter %} by {{ talk.presenter }} {% endif %} &nbsp;&nbsp; {{ talk.title }} {% if talk.presenter %} by {{ talk.presenter }} {% endif %}
{% for v in talk.videos.all %} {% for v in talk.videos.all %}
<div class="padmaVideo" data-pandora-id="{{ v.padmavideo.padma_id }}" data-pandora-in="{{ v.time_in }}" data-pandora-out="{{ v.time_out }}" data-pandora-layers="transcripts" data-pandora-width="480" data-pandora-resolution="240p"></div> <div class="padmaVideo" data-pandora-id="{{ v.padmavideo.padma_id }}" data-video-id="{{ v.id }}" data-pandora-in="{{ v.time_in }}" data-pandora-out="{{ v.time_out }}" data-pandora-layers="transcripts" data-pandora-width="480" data-pandora-resolution="240p"></div>
{% endfor %} {% endfor %}
</li> </li>
@ -256,8 +256,9 @@
}); });
*/ */
$('a.padmaLink').toggle(function() { $('a.padmaLink').toggle(function() {
var index = $(this).index('.padmaLink'); var padma_id = $(this).attr("data-video-id");
var $video = $('.padmaVideo').eq(index);
var $video = $('.padmaVideo[data-video-id=' + padma_id + ']');
if ($video.data("padmaLoaded")) { if ($video.data("padmaLoaded")) {
$video.slideDown(); $video.slideDown();
} else { } else {