From a92ebde07d3d5f15c1e7cbe83ab3b88cfaf94193 Mon Sep 17 00:00:00 2001 From: Tucan444 <66880425+Tucan444@users.noreply.github.com> Date: Sun, 9 May 2021 14:38:09 +0200 Subject: [PATCH] _ --- websites/.vscode/launch.json | 15 --- websites/WikiSpotWS.html | 178 +++++++---------------------------- websites/desc_short.js | 174 ++++++++++++++-------------------- 3 files changed, 105 insertions(+), 262 deletions(-) delete mode 100644 websites/.vscode/launch.json diff --git a/websites/.vscode/launch.json b/websites/.vscode/launch.json deleted file mode 100644 index 2ba986f..0000000 --- a/websites/.vscode/launch.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "chrome", - "request": "launch", - "name": "Launch Chrome against localhost", - "url": "http://localhost:8080", - "webRoot": "${workspaceFolder}" - } - ] -} \ No newline at end of file diff --git a/websites/WikiSpotWS.html b/websites/WikiSpotWS.html index 13f8ef9..6e4e487 100644 --- a/websites/WikiSpotWS.html +++ b/websites/WikiSpotWS.html @@ -1,146 +1,36 @@ - - - - - - Flextest - - - - -
- -
- - - - - -
- # -
-
Kniznica
-
Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatem, numquam facilis aut officia.
-
-
-
- -
- # -
Lorem ipsum dolor sit amet consectetur adipisicing elit. Minus recusandae et repellat saepe modi tenetur provident. Perferendis dolorum odit dolorem delectus consequatur eos, deleniti, pariatur corporis in magnam dolor quam? Consequuntur asperiores provident repellendus itaque tenetur, accusantium aperiam nemo architecto cum magnam amet necessitatibus dolore eaque tempore iusto incidunt nihil voluptatem dolores facilis rem cumque animi perferendis. Error, molestias deserunt.
-
-
Teplota
-
-
-
-
- -
- # -
Lorem ipsum dolor sit amet consectetur adipisicing elit. Minus recusandae et repellat saepe modi tenetur provident. Perferendis dolorum odit dolorem delectus consequatur eos, deleniti, pariatur corporis in magnam dolor quam? Consequuntur asperiores provident repellendus itaque tenetur, accusantium aperiam nemo architecto cum magnam amet necessitatibus dolore eaque tempore iusto incidunt nihil voluptatem dolores facilis rem cumque animi perferendis. Error, molestias deserunt.
-
- - - - -
- # -
-
Kniznica
-
Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatem, numquam facilis aut officia.
-
-
-
- -
- # -
Lorem ipsum dolor sit amet consectetur adipisicing elit. Minus recusandae et repellat saepe modi tenetur provident. Perferendis dolorum odit dolorem delectus consequatur eos, deleniti, pariatur corporis in magnam dolor quam? Consequuntur asperiores provident repellendus itaque tenetur, accusantium aperiam nemo architecto cum magnam amet necessitatibus dolore eaque tempore iusto incidunt nihil voluptatem dolores facilis rem cumque animi perferendis. Error, molestias deserunt.
-
-
Teplota
-
-
-
-
- -
- # -
Lorem ipsum dolor sit amet consectetur adipisicing elit. Minus recusandae et repellat saepe modi tenetur provident. Perferendis dolorum odit dolorem delectus consequatur eos, deleniti, pariatur corporis in magnam dolor quam? Consequuntur asperiores provident repellendus itaque tenetur, accusantium aperiam nemo architecto cum magnam amet necessitatibus dolore eaque tempore iusto incidunt nihil voluptatem dolores facilis rem cumque animi perferendis. Error, molestias deserunt.
-
- - - - -
- # -
-
Kniznica
-
Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatem, numquam facilis aut officia.
-
-
-
- -
- # -
Lorem ipsum dolor sit amet consectetur adipisicing elit. Minus recusandae et repellat saepe modi tenetur provident. Perferendis dolorum odit dolorem delectus consequatur eos, deleniti, pariatur corporis in magnam dolor quam? Consequuntur asperiores provident repellendus itaque tenetur, accusantium aperiam nemo architecto cum magnam amet necessitatibus dolore eaque tempore iusto incidunt nihil voluptatem dolores facilis rem cumque animi perferendis. Error, molestias deserunt.
-
-
Teplota
-
-
-
-
- -
- # -
Lorem ipsum dolor sit amet consectetur adipisicing elit. Minus recusandae et repellat saepe modi tenetur provident. Perferendis dolorum odit dolorem delectus consequatur eos, deleniti, pariatur corporis in magnam dolor quam? Consequuntur asperiores provident repellendus itaque tenetur, accusantium aperiam nemo architecto cum magnam amet necessitatibus dolore eaque tempore iusto incidunt nihil voluptatem dolores facilis rem cumque animi perferendis. Error, molestias deserunt.
-
- - - - -
- # -
-
Kniznica
-
Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatem, numquam facilis aut officia.
-
-
-
- -
- # -
Lorem ipsum dolor sit amet consectetur adipisicing elit. Minus recusandae et repellat saepe modi tenetur provident. Perferendis dolorum odit dolorem delectus consequatur eos, deleniti, pariatur corporis in magnam dolor quam? Consequuntur asperiores provident repellendus itaque tenetur, accusantium aperiam nemo architecto cum magnam amet necessitatibus dolore eaque tempore iusto incidunt nihil voluptatem dolores facilis rem cumque animi perferendis. Error, molestias deserunt.
-
-
Teplota
-
-
-
-
- -
- # -
Lorem ipsum dolor sit amet consectetur adipisicing elit. Minus recusandae et repellat saepe modi tenetur provident. Perferendis dolorum odit dolorem delectus consequatur eos, deleniti, pariatur corporis in magnam dolor quam? Consequuntur asperiores provident repellendus itaque tenetur, accusantium aperiam nemo architecto cum magnam amet necessitatibus dolore eaque tempore iusto incidunt nihil voluptatem dolores facilis rem cumque animi perferendis. Error, molestias deserunt.
-
- - - - - \ No newline at end of file + + + + + + Flextest + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/websites/desc_short.js b/websites/desc_short.js index 809c3c5..2be92e3 100644 --- a/websites/desc_short.js +++ b/websites/desc_short.js @@ -1,118 +1,86 @@ -// fetch("http://192.168.1.105:8000/devices_list") -// .then(function(response){ -// return response.json(); -// }) -// .then(function(data){ -// appendData(data); -// }) -// .catch(function(err){ -// console.log(err); -// }); -// function appendData(data){ -// console.log(data); -// console.log(data[1]["files"][0]); -// var myJson = JSON.stringify(data[1]["description"]["description_s"]); -// var myJson1 = JSON.stringify(data[1]["description"]["title"]); -// var myJson2 = JSON.stringify(data[1]["description"]["description_l"]); -// var uJson = myJson.replace(/\"/g, ""); -// var str = (uJson); -// var str_esc = escape(str); -// console.log(str_esc + "
" + myJson1); -// console.log(unescape(str_esc)); -// var mainContainer = document.getElementById("hou1"); -// var div = document.createElement("div"); -// div.setAttribute("id", "hou"); -// div.innerHTML = unescape(str_esc); - -// mainContainer.appendChild(div); - -// var mainContainer1 = document.getElementById("hey1"); -// var uJson1 = myJson1.replace(/\"/g, ""); -// var div1 = document.createElement("div"); -// div1.setAttribute("id", "hey"); -// div1.innerHTML = unescape(escape(uJson1)); -// var uJson1 = myJson1.replace(/\"/g, ""); - -// mainContainer1.appendChild(div1); -// } $(document).ready(function() { - let urls = ["http://192.168.1.105:8000/files/0/library.jpg", "http://192.168.1.105:8000/files/0/library.jpg", "http://192.168.1.105:8000/files/0/library.jpg"]; - let descriptions = ["here", "there"]; - let n = 1; - function append_element(urls, descriptions, n) { + let base_url = "http://192.168.1.156:8000/"; - let template = `
-
- # -
-
-
-
-
-
- -
- # -
${descriptions[0]}
-
-
Teplota
-
-
-
-
- -
- # -
${descriptions[1]}
-
`; + function append_element(image_urls, descriptions, title, id) { + + let template = ` +
+
+ # +
+
${title}
+
${descriptions[0]}
+
+
+
+ +
+ # +
${descriptions[1]}
+
+
+
+
+ +
+ # +
${descriptions[1]}
+
`; $("body").append(template); + + $.get(`http://192.168.1.156:8000/${id}/sensors`, function(data1) { + console.log(data1); + Object.keys(data1).forEach(function(key) { + let value = data1[key]; + if (key.startsWith("[translate]-")) { + key = key.slice(12, key.length); + } + $(".sensors").append(`

${key}: ${value}

`); + }); + }); + + $(".arrow").click(function() { + + let id = this.id; + id = id.slice(id.length-1, id.length); + + $(`#arrow${id}`).toggleClass("mystyle"); + $(`#listExpand${id}`).toggleClass("expand"); + + }); } - append_element(urls, descriptions, n); - $.get("http://192.168.1.105:8000/devices_list", function(data) { - console.log(data); - var myJson = JSON.stringify(data[1]["description"]["description_s"]); - var myJson1 = JSON.stringify(data[1]["description"]["title"]); - console.log(myJson); - console.log(myJson1); - uJson = myJson.replace(/\"/g, ""); - var str = (uJson); - var str_esc = escape(str); - console.log(str_esc + "
" + myJson); - console.log(unescape(str_esc)); - var main = document.getElementById("hou1"); - var div = document.createElement("div"); - div.setAttribute("id", "hou"); - div.innerHTML = unescape(str_esc); + $.get(`${base_url}devices_list`, function(data) { - main.appendChild(div); + let connected_id = data[0]["connected_id"]; + let urls = ["", ""]; + let descriptions = ["", ""]; + let title = ""; + let query = [[]]; - var sub = document.getElementById("hey1"); - var uJson1 = myJson1.replace(/\"/g, ""); - var div1 = document.createElement("div"); - div1.setAttribute("id", "hey"); - div1.innerHTML = unescape(escape(uJson1)); + for (let i = 1; i < data.length; i++) { + let spot_data = data[i]; + let spot_id = spot_data["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"]; - sub.appendChild(div1); + if (spot_id == connected_id) { + query[0] = [urls, descriptions, title, parseInt(spot_id)]; + } else { + query.push([urls, descriptions, title, parseInt(spot_id)]); + } + } - - - ID = 0; - $.get(`http://192.168.1.105:8000/${ID}/sensors`, function(data1) { - console.log(data1); - var sens = JSON.stringify(data1["teplota"]); - console.log(sens); - var uSens = sens.replace(/\"/g, ""); - var heat = document.getElementById("heat"); - var div2 = document.createElement("div"); - div2.setAttribute("id", "hot"); - div2.innerHTML = unescape(escape(uSens)); - - heat.appendChild(div2); -}) + for (let i = 0; i < query.length; i++) { + append_element(query[i][0], query[i][1], query[i][2], query[i][3]); + } + }) })