This commit is contained in:
2023-10-06 18:50:41 +03:00
parent b65a668e77
commit 735a84bf9a
4 changed files with 32 additions and 10 deletions

View File

@@ -1,6 +1,7 @@
page_iterator = 2
standart_page_iterator = 1
separator_iterator = 1
iterator_f_check = 1
function load_routes (el,news=null) {
let local_page_iterator = standart_page_iterator
@@ -8,12 +9,12 @@ function load_routes (el,news=null) {
local_page_iterator = page_iterator
}
let number_last_route = el.id
let incrase = 3
let incrase = 2
if (!news){
incrase = 11
incrase = 10
}
let data_d = {
'from_el':parseInt(number_last_route) + 1,
'from_el':parseInt(number_last_route),
'to_el':parseInt(number_last_route) + incrase
}
let get_url = ""
@@ -65,7 +66,10 @@ function load_routes (el,news=null) {
place_ins.innerHTML = data.html
let old_page_iterator = local_page_iterator
// standart_page_iterator++
local_page_iterator++
page_iterator++
standart_page_iterator++
loader.classList.toggle("show")
if (!data.last_block_routes){
el.classList.toggle("hide")
@@ -81,12 +85,31 @@ function load_routes (el,news=null) {
$(new_page_routes).insertAfter(".page_paging_elements_" + old_page_iterator);
let line_separator = document.createElement("div")
line_separator.classList.add("line_separator_page_w_el")
$(line_separator).insertAfter(".page_paging_elements_" + separator_iterator);
if (news){
if (iterator_f_check === 1){
//
} else {
$(line_separator).insertAfter(".page_paging_elements_" + separator_iterator);
separator_iterator++
}
} else {
$(line_separator).insertAfter(".page_paging_elements_" + separator_iterator);
separator_iterator++
}
// document.querySelector(".info_profile").innerHTML = data.html;
el.setAttribute("id",parseInt(number_last_route) + 11)
el.setAttribute("id",parseInt(number_last_route) + incrase)
history.pushState({'data':data_d,'str_data':get_url}, "state_filters", `?${get_url}`);
separator_iterator++
// number_last_route = parseInt(number_last_route) + "11"
iterator_f_check++
if (data.last_block === true){
el.classList.add("hide")
} else if (data.last_block === false){
if (el.classList.contains("hide")) {
el.classList.remove("hide")
}
}
},
error: function (data){

View File

@@ -3,5 +3,4 @@
<div class="page_paging_elements_1">
{% include "blocks/articles/b_news_elements.html" %}
</div>
<div class="page_paging_elements_2"></div>
<div class="clear_both"></div>

View File

@@ -19,7 +19,7 @@
<div class="clear_both"></div>
{% if last_block_routes == False %}
{% if last_block == False %}
<div class="text-align-center">
<button class="button-find-more-routes" id="{{ last_el }}" onclick="load_routes(this)">{% trans "Показать ещё 10" %}</button>
<div class="width-100 text-align-center mb-10">

View File

@@ -33,13 +33,13 @@
</div>
<div class="block_w_paging">
{% with from_el=3 %}
{% include 'blocks/articles/b_news_elements.html' %}
{% include 'blocks/articles/b_news_elements_content.html' %}
{% endwith %}
{# boris edited #}
{% if last_block == False %}
<div class="text-align-center">
{% csrf_token %}
<button class="button-find-more-routes" id="{{ last_el }}" onclick="load_routes(this,'news')">{% trans "Показать ещё 10" %}</button>
<button class="button-find-more-routes" id="{{ last_el }}" onclick="load_routes(this,'news')">{% trans "Показать ещё 2" %}</button>
<div class="width-100 text-align-center mb-10">
<img class="loader_f_loading_routes" src="{% static "img/svg/loader.svg" %}">
</div>