// JavaScript Document var soil = 1; // кол-во изьятых страниц с билетами let lastData = false; let moreButton = $('#loadMore'); let isSuper = false; let winnerContainer = $('#winnerContainer'); let catId = 0 // new Swiper('.swiper-container', { navigation: { nextEl: '.button-next', prevEl: '.button-prev', }, breakpoints: { // when window width is >= 320px 320: { slidesPerView: 'auto', spaceBetween: 10, freeMode: true }, }, }); function addSuperButtonEvent(el) { el.click(() => { if (el.is(':checked')) { catId = 4; } else { catId = 0; } excavate(true, winnerContainer) }) } function winnersOnLoad() { //коррекция url //window.history.replaceState(null, null, window.location.pathname); //загружаем первую страницу excavate(false, winnerContainer); // Привязываемся к кнопке moreButton.click(function () { excavate(false, winnerContainer); }); if (checkMobileDevice()) { addSuperButtonEvent($('#onlySuperMobile')); } else { addSuperButtonEvent($('#onlySuper')); } } // Достаем следующие 6 записей function excavate(clear, container) { if (clear) { $(container).html(''); moreButton.prop('style', ''); soil = 1; lastData = false; }; $.ajax({ url: 'https://rpo.logycom.kz/tm/threemen.dll/srv', type: 'POST', data: { 'srv': 'news', "module": 10, "category": catId, 'page': soil }, dataType: 'text', success: function () { }, error: function (err) { console.log(err) }, complete: function (data) { var msg = uparams(data.responseText), news; if (msg['status'] !== 'OK') { showError(msg['msg'] ? msg['msg'] : 'Что-то пошло не так'); forRet = false; return } news = JSON.parse(atob(msg['msg'])); let result = ''; news.forEach((i) => { let template = `

${i.newsField2 ? i.newsField2 : ''}

${i.newsField4 ? i.newsField4 : ''}

${i.newsField3 ? i.newsField3 : ''}${i.newsField6 ? i.newsField6 : ''}

` result += template; if (i.lastData == true) { moreButton.prop('style', 'display: none'); return; } }); soil++; container.append(result); } }); }