Додана сторінка "Розклад зібрань"
Перероблен генератор карточок територій APІ
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
const Stand_list = {
|
||||
list: [],
|
||||
renderIndex: 0,
|
||||
|
||||
init: async () => {
|
||||
let html = await fetch('/lib/pages/stand/list/index.html').then((response) => response.text());
|
||||
app.innerHTML = html;
|
||||
|
||||
Stand_list.renderIndex = 0;
|
||||
|
||||
Stand_list.setHTML();
|
||||
|
||||
if (USER.possibilities.can_add_stand) {
|
||||
@@ -11,6 +15,7 @@ const Stand_list = {
|
||||
document.getElementById("constructorButton").style.display = "";
|
||||
}
|
||||
},
|
||||
|
||||
loadAPI: async function (url) {
|
||||
const uuid = localStorage.getItem("uuid");
|
||||
const response = await fetch(url, {
|
||||
@@ -23,6 +28,7 @@ const Stand_list = {
|
||||
Stand_list.list = await response.json();
|
||||
return Stand_list.list;
|
||||
},
|
||||
|
||||
setHTML: async function () {
|
||||
const block = document.getElementById('list');
|
||||
const null_list = document.getElementById('null-list');
|
||||
@@ -52,12 +58,12 @@ const Stand_list = {
|
||||
block.innerHTML = html;
|
||||
}
|
||||
},
|
||||
renderCard: ({ element, pack=0 }) => {
|
||||
const images = [
|
||||
['stand_1.png', 'stand_2.png', 'stand_3.png'],
|
||||
['stand_4.png', 'stand_5.png']
|
||||
];
|
||||
const randomImage = images[pack][Math.floor(Math.random() * images[pack].length)];
|
||||
|
||||
renderCard: ({ element }) => {
|
||||
const imagesList = ['1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png'];
|
||||
// const randomImage = images[Math.floor(Math.random() * images.length)];
|
||||
const image = imagesList[Stand_list.renderIndex % imagesList.length];
|
||||
Stand_list.renderIndex++;
|
||||
|
||||
const editor = USER.possibilities.can_add_stand
|
||||
? `<a id="editor_button" class="button-edit" data-route title="Змінити графік" href="/stand/editor/${element.id}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"><path d="M 22.828125 3 C 22.316375 3 21.804562 3.1954375 21.414062 3.5859375 L 19 6 L 24 11 L 26.414062 8.5859375 C 27.195062 7.8049375 27.195062 6.5388125 26.414062 5.7578125 L 24.242188 3.5859375 C 23.851688 3.1954375 23.339875 3 22.828125 3 z M 17 8 L 5.2597656 19.740234 C 5.2597656 19.740234 6.1775313 19.658 6.5195312 20 C 6.8615312 20.342 6.58 22.58 7 23 C 7.42 23.42 9.6438906 23.124359 9.9628906 23.443359 C 10.281891 23.762359 10.259766 24.740234 10.259766 24.740234 L 22 13 L 17 8 z M 4 23 L 3.0566406 25.671875 A 1 1 0 0 0 3 26 A 1 1 0 0 0 4 27 A 1 1 0 0 0 4.328125 26.943359 A 1 1 0 0 0 4.3378906 26.939453 L 4.3632812 26.931641 A 1 1 0 0 0 4.3691406 26.927734 L 7 26 L 5.5 24.5 L 4 23 z"></path></svg></a>`
|
||||
@@ -67,7 +73,7 @@ const Stand_list = {
|
||||
<div class="card">
|
||||
<div class="contents">
|
||||
<div class="image">
|
||||
<img src="/img/${randomImage}">
|
||||
<img src="/img/stand/${image}">
|
||||
</div>
|
||||
<div class="info">
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user