_
This commit is contained in:
parent
954ef22ca9
commit
526315d65c
@ -1,14 +1,22 @@
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
let base_url = "http://localhost:8000/";
|
let base_url = "http://lohost:8000/";
|
||||||
|
let ids_list = [];
|
||||||
|
|
||||||
|
$.get("ip.txt", function(data) {
|
||||||
|
console.log(data);
|
||||||
|
base_url = `http://${data}:8000/`;
|
||||||
|
init_wesite();
|
||||||
|
});
|
||||||
|
|
||||||
function append_element(image_urls, descriptions, title, id) {
|
function append_element(image_urls, descriptions, title, id) {
|
||||||
|
ids_list.push(id);
|
||||||
|
|
||||||
let template = `
|
let template = `
|
||||||
<div class="wsList hey">
|
<div class="wsList hey">
|
||||||
<div></div>
|
<div></div>
|
||||||
<img src="${image_urls[0]}" alt="#" class="obrazok_small">
|
<img src="${image_urls[0]}" alt="#" class="obrazok_small">
|
||||||
<div class="list_item_holder">
|
<div id="list_item_holder${id}" class="list_item_holder">
|
||||||
<div class="title${id}">${title}</div>
|
<div class="title${id}">${title}</div>
|
||||||
<div class="short_description">${descriptions[0]}</div>
|
<div class="short_description">${descriptions[0]}</div>
|
||||||
</div>
|
</div>
|
||||||
@ -23,7 +31,7 @@ $(document).ready(function() {
|
|||||||
<div class="info_small"></div>
|
<div class="info_small"></div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Veľké zobrazenie -->
|
<!-- Veľké zobrazenie -->
|
||||||
<div class="big">
|
<div id="big${id}" class="big">
|
||||||
<div class="imgBig"><img class="obrazok_big" src="${image_urls[1]}" alt="#"></div>
|
<div class="imgBig"><img class="obrazok_big" src="${image_urls[1]}" alt="#"></div>
|
||||||
<div class="text_big">${descriptions[1]}</div>
|
<div class="text_big">${descriptions[1]}</div>
|
||||||
<div class="sensors_big">
|
<div class="sensors_big">
|
||||||
@ -54,36 +62,53 @@ $(document).ready(function() {
|
|||||||
id.a();
|
id.a();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(".list_item_holder").click(function() {
|
||||||
|
let id = this.id;
|
||||||
|
id = id.slice(id.length-1, id.length);
|
||||||
|
|
||||||
|
clear_big_display();
|
||||||
|
$(`#big${id}`).show();
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$.get(`${base_url}devices_list`, function(data) {
|
function clear_big_display(){
|
||||||
|
ids_list.forEach(function(id) {
|
||||||
|
$(`#big${id}`).hide();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let connected_id = data[0]["connected_id"];
|
function init_wesite() {
|
||||||
let urls = ["", ""];
|
$.get(`${base_url}devices_list`, function(data) {
|
||||||
let descriptions = ["", ""];
|
|
||||||
let title = "";
|
|
||||||
let query = [[]];
|
|
||||||
|
|
||||||
for (let i = 1; i < data.length; i++) {
|
let connected_id = data[0]["connected_id"];
|
||||||
let spot_data = data[i];
|
let urls = ["", ""];
|
||||||
let spot_id = spot_data["ID"]
|
let descriptions = ["", ""];
|
||||||
urls = [`${base_url}files/${spot_id}/${spot_data["description"]["photo_s"]}`,
|
let title = "";
|
||||||
`${base_url}files/${spot_id}/${spot_data["description"]["photo_b"]}`];
|
let query = [[]];
|
||||||
descriptions = [spot_data["description"]["description_s"],
|
|
||||||
spot_data["description"]["description_l"]];
|
|
||||||
title = spot_data["description"]["title"];
|
|
||||||
|
|
||||||
if (spot_id == connected_id) {
|
for (let i = 1; i < data.length; i++) {
|
||||||
query[0] = [urls, descriptions, title, parseInt(spot_id)];
|
let spot_data = data[i];
|
||||||
} else {
|
let spot_id = spot_data["ID"]
|
||||||
query.push([urls, descriptions, title, parseInt(spot_id)]);
|
urls = [`${base_url}files/${spot_id}/${spot_data["description"]["photo_s"]}`,
|
||||||
|
`${base_url}files/${spot_id}/${spot_data["description"]["photo_b"]}`];
|
||||||
|
descriptions = [spot_data["description"]["description_s"],
|
||||||
|
spot_data["description"]["description_l"]];
|
||||||
|
title = spot_data["description"]["title"];
|
||||||
|
|
||||||
|
if (spot_id == connected_id) {
|
||||||
|
query[0] = [urls, descriptions, title, parseInt(spot_id)];
|
||||||
|
} else {
|
||||||
|
query.push([urls, descriptions, title, parseInt(spot_id)]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < query.length; i++) {
|
for (let i = 0; i < query.length; i++) {
|
||||||
append_element(query[i][0], query[i][1], query[i][2], query[i][3]);
|
append_element(query[i][0], query[i][1], query[i][2], query[i][3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
init_wesite();
|
||||||
})
|
})
|
||||||
|
1
website/ip.txt
Normal file
1
website/ip.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
localhost
|
@ -1,8 +0,0 @@
|
|||||||
sf
|
|
||||||
fsd
|
|
||||||
f
|
|
||||||
sdf
|
|
||||||
sd
|
|
||||||
fsd
|
|
||||||
f
|
|
||||||
sd
|
|
Loading…
Reference in New Issue
Block a user