2 {% for cell in cells %}
3 <ul class="footer-list-{{forloop.counter0}} {{ cell.css_class_names }}">
4 {% for link in cell.get_items %}
5 <li class="{{ link.link_page.slug }}"><a href="{{ link.get_url }}"><span>{{ link.get_additional_label }}</span></a></li>
12 function init_page() {
14 if ($('#extra-menu.with-links').length == 0) {
15 $('.footer-list-1').clone().appendTo($('#extra-menu'));
16 $('.footer-list-0').clone().appendTo($('#extra-menu'));
17 $('#extra-menu').addClass('with-links').find('a').ajaxifyClick();
20 init_newsletter_form();
23 var roll_timeout = null;
24 function init_roll_buttons() {
25 if ($('#focus').length == 0) return;
26 if ($('#focus').hasClass('initialized')) return;
28 clearTimeout(roll_timeout);
31 $('#next').on('click', function(ev, autoroll) {
32 if (roll_timeout && !autoroll) { clearTimeout(roll_timeout); roll_timeout = null; }
33 var current_position = $(window).scrollTop();
34 var $first = $('#focus .item:not(.transition)').first();
35 var $last = $('#focus .item:not(.transition)').last();
36 if ($first.length == 0) return;
37 var $cloned = $first.clone();
38 $cloned.addClass('transition').insertBefore($('#focus .item').first());
39 $cloned.on('transitionend', function() { $cloned.remove(); });
40 $first.detach().insertAfter($last);
41 $cloned[0].offsetHeight; // redraw
42 $cloned.addClass('faded');
44 /* this is required to avoid some strange autoscrolling when the next
45 button is not in the viewport */
46 $(window).scrollTop(current_position);
48 if (autoroll) { roll_timeout = setTimeout(function() {$('#next').trigger('click', ['autoroll']); }, 10000); }
50 $('#prev').on('click', function(ev, autoroll) {
51 if (roll_timeout && !autoroll) { clearTimeout(roll_timeout); roll_timeout = null; }
52 var $first = $('#focus .item:not(.transition)').first();
53 var $last = $('#focus .item:not(.transition)').last();
54 if ($first.length == 0) return;
55 var $cloned = $first.clone();
56 $cloned.addClass('transition').insertBefore($('#focus .item').first());
57 $cloned.on('transitionend', function() { $cloned.remove(); });
58 $last.detach().insertBefore($first);
59 $cloned[0].offsetHeight; // redraw
60 $cloned.addClass('faded');
61 if (autoroll) { roll_timeout = setTimeout(function() {$('#next').trigger('click', ['autoroll']); }, 10000); }
63 $('#focus').addClass('initialized');
64 roll_timeout = setTimeout(function() {$('#next').trigger('click', ['autoroll']); }, 10000);
66 function init_newsletter_form() {
67 $('#subscribe-form').off('submit').on('submit', function() {
69 var url = $form.attr('action');
70 var data = $form.serialize();
71 $.post(url, data).done(function() {
72 $form.removeClass('error');
73 $form.find('input').attr('disabled', 'disabled');
74 $form.find('button').text('OK').attr('disabled', 'disabled');
76 $form.addClass('error');
81 $(document).on('panikweb:load-page', init_page);
85 $(document).on('panikweb:week-change', function() {
86 var $week_title = $('#week > h2');
87 if ($('#week .current-week').length) {
88 $week_title.text($week_title.data('this-week-label'));
90 $week_title.text($week_title.data('other-week-label') +
91 ' (' + $('.program.tabs button').first().data('neau-text') +
92 ' - ' + $('.program.tabs button').last().data('neau-text') + ')');