diff --git a/static/client/js/rejs/banners.js b/static/client/js/rejs/banners.js index 6db6190a..da5511ed 100644 --- a/static/client/js/rejs/banners.js +++ b/static/client/js/rejs/banners.js @@ -3,7 +3,7 @@ var API_URL_ROOT = "/expo-b/get-banners/"; - var getUrl = function () { + var getUrl = function (top_load) { var search = []; var parts = /^\/([^\/]+)(?:\/|$)/i.exec(location.pathname); @@ -13,9 +13,13 @@ search.push("catalog="); } - var elements = $("[id^=\"expo_b_\"]"); - for (var j = 0; j < elements.length; j++) { - search.push("places=" + encodeURIComponent($(elements[j]).attr("id"))); + if (!top_load) { + var elements = $("[id^=\"expo_b_\"]").not("[id=\"expo_b_under_search\"]"); + for (var j = 0; j < elements.length; j++) { + search.push("places=" + encodeURIComponent($(elements[j]).attr("id"))); + } + } else { + search.push("places=" + encodeURIComponent('expo_b_under_search')); } var data = window.sendData; @@ -47,15 +51,14 @@ // console.info('callback Done'); }; - var getBanners = function (url, callback) { + var getBanners = function (url, callback, top_load) { var xhr = new XMLHttpRequest(); xhr.open("GET", url, true); xhr.onreadystatechange = function (event) { if (event.target.readyState === 4) { if (event.target.status === 200) { - console.info(event.target.responseText); - if (document.readyState === "loading" && !window.marker_DOMbannersjsElementInserted) { + if (document.readyState === "loading" && top_load && !window.marker_DOMbannersjsElementInserted) { document.addEventListener("DOMbannersjsElementInserted", function() { runCallback(callback, event.target.responseText); }); @@ -117,12 +120,16 @@ } }; - var main = function () { - console.info(getUrl()); - getBanners(getUrl(), insertBanners); + var main = function (top_load) { + // top_load - load expo_b_under_search banner or all other + var top_load = top_load || false; + getBanners(getUrl(top_load), insertBanners, top_load); }; - main(); + // load expo_b_under_search top banner + main(true); + // old // window.addEventListener("load", main); - // document.addEventListener("DOMContentLoaded", main); + // load all other banners + document.addEventListener("DOMContentLoaded", function(){main(false);}); })(); diff --git a/static/client/js/rejs/tops.js b/static/client/js/rejs/tops.js index d293bd26..1cfffe7b 100644 --- a/static/client/js/rejs/tops.js +++ b/static/client/js/rejs/tops.js @@ -50,7 +50,6 @@ xhr.onreadystatechange = function (event) { if (event.target.readyState === 4) { if (event.target.status === 200) { - console.info(document.readyState); if (document.readyState === "loading" && !window.marker_DOMtopjsElementInserted) { // console.info('setting DOMContentLoaded event listener'); // console.info('setting DOMtopjsElementInserted event listener'); diff --git a/templates/client/accounts/feed.html b/templates/client/accounts/feed.html index 1e280ef7..0b834380 100644 --- a/templates/client/accounts/feed.html +++ b/templates/client/accounts/feed.html @@ -15,17 +15,7 @@ {% endblock %} {% if object_list %} {% block head_scripts %} - - + {% include "client/includes/banners/tops_head_js.html" %} {% endblock head_scripts %} {% endif %} {% block page_body %} diff --git a/templates/client/accounts/user_events.html b/templates/client/accounts/user_events.html index eee53d98..1ba65594 100644 --- a/templates/client/accounts/user_events.html +++ b/templates/client/accounts/user_events.html @@ -19,17 +19,7 @@ {% if object_list %} {% block head_scripts %} - - + {% include "client/includes/banners/tops_head_js.html" %} {% endblock head_scripts %} {% endif %} diff --git a/templates/client/blank.html b/templates/client/blank.html index 6aa9af84..51db06dc 100644 --- a/templates/client/blank.html +++ b/templates/client/blank.html @@ -66,7 +66,7 @@ This template include basic anf main styles and js files, window.marker_DOMbannersjsElementInserted = window.marker_DOMbannersjsElementInserted || false; document.addEventListener("DOMbannersjsElementInserted", function() { // console.info("DOMbannersjsElementInserted fired"); - window.marker_DOMtopjsElementInserted = true + window.marker_DOMbannersjsElementInserted = true }); })(); diff --git a/templates/client/city/city.html b/templates/client/city/city.html index 32d3e91d..6f66f219 100644 --- a/templates/client/city/city.html +++ b/templates/client/city/city.html @@ -14,17 +14,7 @@ {% if object.get_events %} {% block head_scripts %} - - + {% include "client/includes/banners/tops_head_js.html" %} {% endblock head_scripts %} {% endif %} diff --git a/templates/client/country/country.html b/templates/client/country/country.html index e5323dc3..f6747e28 100644 --- a/templates/client/country/country.html +++ b/templates/client/country/country.html @@ -14,17 +14,7 @@ {% if object.get_events %} {% block head_scripts %} - - + {% include "client/includes/banners/tops_head_js.html" %} {% endblock head_scripts %} {% endif %} diff --git a/templates/client/exposition/catalog.html b/templates/client/exposition/catalog.html index 8d109598..aed55be1 100644 --- a/templates/client/exposition/catalog.html +++ b/templates/client/exposition/catalog.html @@ -24,17 +24,7 @@ {% if object_list %} {% block head_scripts %} - - + {% include "client/includes/banners/tops_head_js.html" %} {% endblock head_scripts %} {% endif %} diff --git a/templates/client/exposition/catalog_theme.html b/templates/client/exposition/catalog_theme.html index 20287f74..45277f6f 100644 --- a/templates/client/exposition/catalog_theme.html +++ b/templates/client/exposition/catalog_theme.html @@ -5,18 +5,7 @@ {% if object_list %} {% block head_scripts %} - - + {% include "client/includes/banners/tops_head_js.html" %} {% endblock head_scripts %} {% endif %} diff --git a/templates/client/includes/banners/tops.html b/templates/client/includes/banners/tops.html index 1884289c..e6beea9d 100644 --- a/templates/client/includes/banners/tops.html +++ b/templates/client/includes/banners/tops.html @@ -3,9 +3,7 @@ + diff --git a/templates/client/includes/exposition/price.html b/templates/client/includes/exposition/price.html index dc5ba8e0..11f0a984 100644 --- a/templates/client/includes/exposition/price.html +++ b/templates/client/includes/exposition/price.html @@ -37,7 +37,7 @@ f{% load i18n %}

{% if meta.h1 %} {{ meta.h1 }} - {% if exposition.main_title %} + {% elif exposition.main_title %} {{ exposition.main_title|safe }} {% else %} {{ exposition.name|safe }}