1240: рэндеринг рекламы

banners.js under_search banner load separation from others
remotes/origin/top_year_choice
Alexander Burdeiny 10 years ago
parent cad1d233b5
commit a44a4dfdcd
  1. 31
      static/client/js/rejs/banners.js
  2. 1
      static/client/js/rejs/tops.js
  3. 12
      templates/client/accounts/feed.html
  4. 12
      templates/client/accounts/user_events.html
  5. 2
      templates/client/blank.html
  6. 12
      templates/client/city/city.html
  7. 12
      templates/client/country/country.html
  8. 12
      templates/client/exposition/catalog.html
  9. 13
      templates/client/exposition/catalog_theme.html
  10. 2
      templates/client/includes/banners/tops.html
  11. 13
      templates/client/includes/banners/tops_head_js.html
  12. 2
      templates/client/includes/exposition/price.html

@ -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);});
})();

@ -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');

@ -15,17 +15,7 @@
{% endblock %}
{% if object_list %}
{% block head_scripts %}
<script>
(function() {
var DOMtopjsElementInserted = new Event('DOMtopjsElementInserted');
window.marker_DOMtopjsElementInserted = window.marker_DOMtopjsElementInserted || false;
document.addEventListener("DOMtopjsElementInserted", function() {
// console.info("DOMtopjsElementInserted fired");
window.marker_DOMtopjsElementInserted = true
});
})();
</script>
<script type="text/javascript" src="{% static 'client/js/rejs/tops.js' %}" async></script>
{% include "client/includes/banners/tops_head_js.html" %}
{% endblock head_scripts %}
{% endif %}
{% block page_body %}

@ -19,17 +19,7 @@
{% if object_list %}
{% block head_scripts %}
<script>
(function() {
var DOMtopjsElementInserted = new Event('DOMtopjsElementInserted');
window.marker_DOMtopjsElementInserted = window.marker_DOMtopjsElementInserted || false;
document.addEventListener("DOMtopjsElementInserted", function() {
// console.info("DOMtopjsElementInserted fired");
window.marker_DOMtopjsElementInserted = true
});
})();
</script>
<script type="text/javascript" src="{% static 'client/js/rejs/tops.js' %}" async></script>
{% include "client/includes/banners/tops_head_js.html" %}
{% endblock head_scripts %}
{% endif %}

@ -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
});
})();
</script>

@ -14,17 +14,7 @@
{% if object.get_events %}
{% block head_scripts %}
<script>
(function() {
var DOMtopjsElementInserted = new Event('DOMtopjsElementInserted');
window.marker_DOMtopjsElementInserted = window.marker_DOMtopjsElementInserted || false;
document.addEventListener("DOMtopjsElementInserted", function() {
// console.info("DOMtopjsElementInserted fired");
window.marker_DOMtopjsElementInserted = true
});
})();
</script>
<script type="text/javascript" src="{% static 'client/js/rejs/tops.js' %}" async></script>
{% include "client/includes/banners/tops_head_js.html" %}
{% endblock head_scripts %}
{% endif %}

@ -14,17 +14,7 @@
{% if object.get_events %}
{% block head_scripts %}
<script>
(function() {
var DOMtopjsElementInserted = new Event('DOMtopjsElementInserted');
window.marker_DOMtopjsElementInserted = window.marker_DOMtopjsElementInserted || false;
document.addEventListener("DOMtopjsElementInserted", function() {
// console.info("DOMtopjsElementInserted fired");
window.marker_DOMtopjsElementInserted = true
});
})();
</script>
<script type="text/javascript" src="{% static 'client/js/rejs/tops.js' %}" async></script>
{% include "client/includes/banners/tops_head_js.html" %}
{% endblock head_scripts %}
{% endif %}

@ -24,17 +24,7 @@
{% if object_list %}
{% block head_scripts %}
<script>
(function() {
var DOMtopjsElementInserted = new Event('DOMtopjsElementInserted');
window.marker_DOMtopjsElementInserted = window.marker_DOMtopjsElementInserted || false;
document.addEventListener("DOMtopjsElementInserted", function() {
// console.info("DOMtopjsElementInserted fired");
window.marker_DOMtopjsElementInserted = true
});
})();
</script>
<script type="text/javascript" src="{% static 'client/js/rejs/tops.js' %}" async></script>
{% include "client/includes/banners/tops_head_js.html" %}
{% endblock head_scripts %}
{% endif %}

@ -5,18 +5,7 @@
{% if object_list %}
{% block head_scripts %}
<script>
(function() {
var DOMtopjsElementInserted = new Event('DOMtopjsElementInserted');
window.DOMtopjsElementInserted = DOMtopjsElementInserted;
window.marker_DOMtopjsElementInserted = window.marker_DOMtopjsElementInserted || false;
document.addEventListener("DOMtopjsElementInserted", function() {
// console.info("DOMtopjsElementInserted fired");
window.marker_DOMtopjsElementInserted = true
});
})();
</script>
<script type="text/javascript" src="{% static 'client/js/rejs/tops.js' %}" async></script>
{% include "client/includes/banners/tops_head_js.html" %}
{% endblock head_scripts %}
{% endif %}

@ -3,9 +3,7 @@
<script>
(function() {
try {
// console.info("DOMtopjsElementInserted fire trying");
document.dispatchEvent(window.DOMtopjsElementInserted);
// console.info("in DOM!");
}
catch (error) {
console.info(error);

@ -0,0 +1,13 @@
{% load static %}
<script>
(function() {
var DOMtopjsElementInserted = new Event('DOMtopjsElementInserted');
window.DOMtopjsElementInserted = DOMtopjsElementInserted;
window.marker_DOMtopjsElementInserted = window.marker_DOMtopjsElementInserted || false;
document.addEventListener("DOMtopjsElementInserted", function() {
// console.info("DOMtopjsElementInserted fired");
window.marker_DOMtopjsElementInserted = true
});
})();
</script>
<script type="text/javascript" src="{% static 'client/js/rejs/tops.js' %}" async></script>

@ -37,7 +37,7 @@ f{% load i18n %}
<h1 class="i-title">
{% if meta.h1 %}
{{ meta.h1 }}
{% if exposition.main_title %}
{% elif exposition.main_title %}
{{ exposition.main_title|safe }}
{% else %}
{{ exposition.name|safe }}

Loading…
Cancel
Save