def __str__(self):
return str(self.paragraphs)
+ @classmethod
+ def get_all(cls, request):
+ Membership = apps.get_model('club', 'Membership')
+ if Membership.is_active_for(request.user) and not request.user.is_staff:
+ return cls.objects.none()
+ return cls.objects.all()
+
+
def choose(self):
return self.dynamictextinserttext_set.order_by('?').first()
$target.slideDown('fast');
$on.hide();
if (Modernizr.localstorage) localStorage.removeItem(tag);
+ _paq.push(['trackEvent', 'banner', 'unhide', $on.attr('data-target')]);
});
$off.click(function() {
$target.slideUp('fast');
$on.show();
if (Modernizr.localstorage) localStorage[tag] = true;
+ _paq.push(['trackEvent', 'banner', 'hide', $on.attr('data-target')]);
});
if (Modernizr.localstorage) {
if (!localStorage[tag]) {
$on.hide();
$target.show();
+ _paq.push(['trackEvent', 'banner', 'show', $on.attr('data-target')]);
}
}
});
+ $(document).on('click', ".annoy-banner a", function() {
+ banner = $(this).closest('.annoy-banner');
+ _paq.push(['trackEvent', 'banner', 'click', banner.attr('id')]);
+ });
+ $(document).on('click', ".dynamic-insert a", function() {
+ banner = $(this).closest('.dynamic-insert');
+ _paq.push(['trackEvent', 'dynamic-insert', 'click', banner.attr('data-paragraphs'), banner.attr('data-textid')]);
+ });
+
});
})(jQuery);
.dynamic-insert {
background: orange;
+ margin: 1em 0;
&.with-image {
min-height: 120px;
.text {
padding: 2em;
flex: 1;
+ align-self: center;
}
img {
border-radius: 100%;
margin: 1em;
+ align-self: center;
}
}
}
var counter = 0;
$(".paragraph, .stanza").each(function() {
var p = $(this);
+ if (p.prev().hasClass('anchor')) p = p.prev();
if (!underFold) {
if (p.offset().top > fold) {
underFold = true;
{% load thumbnail %}
{% with text=insert.choose %}
- <div class="dynamic-insert{% if text.image %} with-image{% endif %}" style="{% if text.own_colors %}background-color: {{ text.background_color }};{% endif %}" data-paragraphs="{{ insert.paragraphs }}">
- <a href="{% url 'club' %}">
+ <div class="dynamic-insert{% if text.image %} with-image{% endif %}" style="{% if text.own_colors %}background-color: {{ text.background_color }};{% endif %}" data-paragraphs="{{ insert.paragraphs }}" data-textid="{{ text.pk }}">
+ <a href="{{ insert.url }}">
<div class="text" style="{% if text.own_colors %}color:{{ text.text_color }}{% endif %}">
{{ text.text|safe|linebreaks }}
</div>
<link rel="icon" href="{% static "img/favicon.png" %}" type="image/png" />
{% stylesheet 'main' %}
{% stylesheet "player" %}
+ {% tracking_code %}
</head>
<body id="{% block bodyid %}player{% endblock %}">
{% if book.cover_thumb %}
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
{% javascript "player" %}
- {% tracking_code %}
</body>
</html>
<link rel="icon" href="{% static "img/favicon.png" %}" type="image/x-icon" />
{% stylesheet "book_text" %}
{% block extrahead %}{% endblock %}
+ {% tracking_code %}
</head>
<body id="{% block body-id %}reader{% endblock %}">
{% annoy_banner 'blackout' %}
</script>
{% javascript "book_text" %}
- {% tracking_code %}
{% block extrabody %}{% endblock %}
<script src="{% static "js/contrib/modernizr.custom.19652.js" %}"></script>
</body>
return render(request, 'catalogue/book_text.html', {
'book': book,
'book_text': book_text,
- 'inserts': DynamicTextInsert.objects.all()
+ 'inserts': DynamicTextInsert.get_all(request)
})
</div>
</div>
+{% chunk 'club_form_bottom' %}
+
</div>
{% endblock %}
<link rel="manifest" href="/manifest.json">
{% stylesheet "main" %}
{% block extrahead %}{% endblock %}
+ {% tracking_code %}
</head>
<body id="{% block bodyid %}base{% endblock %}">
</script>
{% javascript "base" %}
- {% tracking_code %}
-
{% block extrabody %}{% endblock %}
<script src="{% static "js/contrib/modernizr.custom.19652.js" %}"></script>
-<!-- Piwik -->
+<!-- Matomo -->
<script type="text/javascript">
- var pkBaseURL = "{{ url }}";
-document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
-</script><script type="text/javascript">
-try {
-var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", {{ id }});
-{% for ab, abval in AB.items %}
- piwikTracker.setCustomVariable({{ forloop.counter }}, "{{ ab }}", "{{ abval }}", "page");
-{% endfor %}
-piwikTracker.trackPageView();
-piwikTracker.enableLinkTracking();
-} catch( err ) {}
-</script><noscript><p><img src="{{ url }}piwik.php?idsite={{ id }}" style="border:0" alt="" /></p></noscript>
-<!-- End Piwik Tracking Code -->
+ var _paq = window._paq || [];
+ {% for ab, abval in AB.items %}
+ _paq.push(['setCustomVariable', '{{ forloop.counter }}', "{{ ab }}", "{{ abval }}", "page"]);
+ {% endfor %}
+ _paq.push(['trackPageView']);
+ _paq.push(['enableLinkTracking']);
+ (function() {
+ var u="{{ url }}";
+ _paq.push(['setTrackerUrl', u+'matomo.php']);
+ _paq.push(['setSiteId', '{{ id }}']);
+ var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
+ g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
+ })();
+</script><noscript><p><img src="{{ url }}matomo.php?idsite={{ id }}&rec=1" style="border:0;" alt="" /></p></noscript>
+<!-- End Matomo Code -->