From: Radek Czajka Date: Thu, 21 Dec 2023 08:23:22 +0000 (+0100) Subject: blackout X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/48a6d2ddc3e5ce215beddd6369f01598651ad216?ds=sidebyside blackout --- diff --git a/src/annoy/static/annoy/banner.js b/src/annoy/static/annoy/banner.js index 44a1d0223..74a7292e6 100644 --- a/src/annoy/static/annoy/banner.js +++ b/src/annoy/static/annoy/banner.js @@ -22,12 +22,10 @@ _paq.push(['trackEvent', 'banner', 'banner-hide', $target.attr('id')]); }); - if (Modernizr.localstorage) { - if (!localStorage[tag]) { - $on.hide(); - $target.show(); - _paq.push(['trackEvent', 'banner', 'banner-show', $target.attr('id')]); - } + if (!localStorage[tag]) { + $on.hide(); + $target.show(); + _paq.push(['trackEvent', 'banner', 'banner-show', $target.attr('id')]); } }); diff --git a/src/annoy/templates/annoy/banner_blackout.html b/src/annoy/templates/annoy/banner_blackout.html new file mode 100644 index 000000000..c96751f38 --- /dev/null +++ b/src/annoy/templates/annoy/banner_blackout.html @@ -0,0 +1,40 @@ +{% if banner %} + {% if closable %} + + + {% endif %} +
+
+ +
+ {{ banner.get_text|safe|linebreaks }} + +
+ {% if banner.image %} +
+ +
+ {% endif %} +
+
+ +{% endif %} diff --git a/src/annoy/templatetags/annoy.py b/src/annoy/templatetags/annoy.py index 21f1bb85e..2bc93143c 100644 --- a/src/annoy/templatetags/annoy.py +++ b/src/annoy/templatetags/annoy.py @@ -14,6 +14,14 @@ def annoy_banner(context, place): 'closable': PLACES.get(place, False), } +@register.inclusion_tag('annoy/banner_blackout.html', takes_context=True) +def annoy_banner_blackout(context): + banners = Banner.choice('blackout', request=context['request']) + return { + 'banner': banners.first(), + 'closable': True, + } + @register.inclusion_tag('annoy/banners.html', takes_context=True) def annoy_banners(context, place): diff --git a/src/catalogue/templates/catalogue/preview_ad.html b/src/catalogue/templates/catalogue/preview_ad.html index b2c24462c..5cfbb1222 100644 --- a/src/catalogue/templates/catalogue/preview_ad.html +++ b/src/catalogue/templates/catalogue/preview_ad.html @@ -16,9 +16,11 @@