-
Notifications
You must be signed in to change notification settings - Fork 35
/
media_tree_gallery.html
89 lines (77 loc) · 2.84 KB
/
media_tree_gallery.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{% load i18n media_tree_thumbnail %}
<div id="{{ plugin.id_attr }}" class="gallery">
{% if folders and folders|length > 1 %}
<ul class="folders">asd
{{ folders|unordered_list }}
</ul>
{% endif %}
{% if nodes %}
<div class="slideshow">
{% for image_node in nodes %}
{% include "cms/plugins/media_tree_image.html" %}
{% endfor %}
</div>
{% ifnotequal nodes|length 1 %}
<div class="nav">
<ul>
<li class="button"><a class="prev" href="javascript:void(0);">{% trans "Previous" %}</a></li>
<li><ul class="pager"></ul></li>
<li class="button"><a class="next" href="javascript:void(0);">{% trans "Next" %}</a></li>
<li class="button"><a class="play" href="javascript:void(0);">{% trans "Play" %}</a></li>
<li class="button"><a class="pause" href="javascript:void(0);">{% trans "Pause" %}</a></li>
</ul>
</div>
{% endifnotequal %}
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
{% ifnotequal nodes|length 1 %}
var thumbs = [
{% for node in nodes %}
{% if not forloop.first %},{% endif %}'<li><a href="#">{% if pager_thumbnails %}<img src="{% thumbnail node pager_thumbnail_size as thumb%}{{ thumb.url }}" alt="{{ node.get_alt }}"/>{% else %}{{ forloop.counter}}{% endif %}</a></li>'
{% endfor %}
]
{% endifnotequal %}
var containerHeight = 0;
$('#{{ plugin.id_attr }} .slideshow p').each(function() {
if ($(this).outerHeight(true) > containerHeight) {
containerHeight = $(this).outerHeight(true);
}
});
$('#{{ plugin.id_attr }} .slideshow').css('height', containerHeight+'px');
$('#{{ plugin.id_attr }} .slideshow').cycle({
fx: '{{ fx }}'
{% ifnotequal speed "normal" %},speed: '{{ speed }}'{% endifnotequal %}
,timeout: {{ timeout }}
{% ifnotequal nodes|length 1 %}
,prev: '#{{ plugin.id_attr }} .prev'
,next: '#{{ plugin.id_attr }} .next'
,pager: '#{{ plugin.id_attr }} .pager'
,pagerAnchorBuilder: function(idx, slide) {
return thumbs[idx];
}
{% endifnotequal %}
});
{% ifnotequal nodes|length 1 %}
{% if auto_play %}
$('#{{ plugin.id_attr }} .play').closest('li').hide();
{% else %}
$('#{{ plugin.id_attr }} .pause').closest('li').hide();
$('#{{ plugin.id_attr }} .slideshow').cycle('pause');
{% endif %}
$('#{{ plugin.id_attr }} .play').click(function(e) {
$('#{{ plugin.id_attr }} .play').closest('li').hide();
$('#{{ plugin.id_attr }} .pause').closest('li').show();
$('#{{ plugin.id_attr }} .slideshow').cycle();
});
$('#{{ plugin.id_attr }} .pause').click(function(e) {
$('#{{ plugin.id_attr }} .play').closest('li').show();
$('#{{ plugin.id_attr }} .pause').closest('li').hide();
$('#{{ plugin.id_attr }} .slideshow').cycle('pause');
});
{% endifnotequal %}
});
//]]>
</script>
{% endif %}
</div>