-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add notifications + other small changes
- Loading branch information
1 parent
a9ebce0
commit 348c047
Showing
12 changed files
with
228 additions
and
142 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,42 @@ | ||
const jsonPath = "https://www.soteria-security.us/PWA/assets/data.json"; | ||
|
||
document.addEventListener('DOMContentLoaded', () => { | ||
fetch(jsonPath) | ||
.then(response => response.json()) | ||
.then(data => { | ||
const container = document.getElementById("floorplan-container"); | ||
const floorplan = document.getElementById("floorplan"); | ||
|
||
function positionDots() { | ||
const containerBox = container.getBoundingClientRect(); | ||
const floorplanBox = floorplan.getBoundingClientRect(); | ||
const width = floorplanBox.width; | ||
const height = floorplanBox.height; | ||
|
||
const existingDots = document.querySelectorAll(".overlay"); | ||
existingDots.forEach(dot => dot.remove()); | ||
|
||
data.cameras.forEach(camera => { | ||
const x = parseFloat(camera.x) * width + floorplanBox.x - containerBox.x; | ||
const y = parseFloat(camera.y) * height + floorplanBox.y - containerBox.y; | ||
|
||
const dot = document.createElement("img"); | ||
dot.src = "https://www.soteria-security.us/PWA/assets/reddot.svg"; | ||
dot.classList.add("overlay"); | ||
dot.style.left = `${x}px`; | ||
dot.style.top = `${y}px`; | ||
container.appendChild(dot); | ||
}); | ||
} | ||
const jsonPath = "assets/data.json"; | ||
|
||
fetch(jsonPath) | ||
.then(response => response.json()) | ||
.then(data => { | ||
const container = document.getElementById("floorplan-container"); | ||
const floorplan = document.getElementById("floorplan"); | ||
|
||
floorplan.onload = function() { | ||
positionDots(); | ||
}; | ||
|
||
function positionDots() { | ||
let containerBox = container.getBoundingClientRect(); | ||
let floorplanBox = floorplan.getBoundingClientRect(); | ||
let width = floorplanBox.width; | ||
let height = floorplanBox.height; | ||
|
||
const existingDots = document.querySelectorAll(".overlay"); | ||
existingDots.forEach(dot => dot.remove()); | ||
|
||
data.cameras.forEach(camera => { | ||
const x = parseFloat(camera.x) * width + floorplanBox.x - containerBox.x; | ||
const y = parseFloat(camera.y) * height + floorplanBox.y - containerBox.y; | ||
|
||
const dot = document.createElement("img"); | ||
dot.src = "https://www.soteria-security.us/PWA/assets/reddot.svg"; | ||
dot.alt = "🔴"; | ||
dot.classList.add("overlay"); | ||
dot.style.left = `${x}px`; | ||
dot.style.top = `${y}px`; | ||
container.appendChild(dot); | ||
}); | ||
} | ||
|
||
if (floorplan.complete) { | ||
positionDots(); | ||
window.addEventListener("resize", positionDots); | ||
}) | ||
.catch(error => console.error("Error loading JSON:", error)); | ||
}); | ||
} | ||
|
||
window.addEventListener("resize", positionDots); | ||
}) | ||
.catch(error => console.error("Error loading JSON:", error)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
document.addEventListener("DOMContentLoaded", () => { | ||
const btn = document.getElementById("infoBox"); | ||
const modal = document.getElementById("popup"); | ||
const span = document.getElementsByClassName("close")[0]; | ||
const btn = document.getElementById("infoBox"); | ||
const modal = document.getElementById("popup"); | ||
const span = document.getElementsByClassName("close")[0]; | ||
|
||
btn.onclick = function() { | ||
modal.style.display = "block"; | ||
} | ||
btn.onclick = function() { | ||
modal.style.display = "block"; | ||
} | ||
|
||
span.onclick = function() { | ||
modal.style.display = "none"; | ||
} | ||
span.onclick = function() { | ||
modal.style.display = "none"; | ||
} | ||
|
||
window.onclick = function(event) { | ||
if (event.target === modal) { | ||
modal.style.display = "none"; | ||
} | ||
window.onclick = function(event) { | ||
if (event.target === modal) { | ||
modal.style.display = "none"; | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const webPush = require('web-push'); | ||
// const vapidKeys = webPush.generateVAPIDKeys(); | ||
// | ||
// console.log('VAPID Public Key:', vapidKeys.publicKey); | ||
// console.log('VAPID Private Key:', vapidKeys.privateKey); |
Oops, something went wrong.