diff --git a/YongeStreet/Views/Home/City.cshtml b/YongeStreet/Views/Home/City.cshtml index 3f588ae..a9976cc 100644 --- a/YongeStreet/Views/Home/City.cshtml +++ b/YongeStreet/Views/Home/City.cshtml @@ -10,7 +10,7 @@
diff --git a/YongeStreet/wwwroot/js/site.js b/YongeStreet/wwwroot/js/site.js index 0937657..c2670b8 100644 --- a/YongeStreet/wwwroot/js/site.js +++ b/YongeStreet/wwwroot/js/site.js @@ -1,4 +1,20 @@ -// Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification -// for details on configuring this project to bundle and minify static web assets. + +const state ={height: -1, url: ''}; -// Write your JavaScript code. +function urlWithoutOrigin(url){ + return url.replace(new URL(url).origin, ""); +} + +function sendEvent(){ + const height = document.documentElement.offsetHeight; + const url = urlWithoutOrigin(document.URL); + if(height === state.height && url === state.url){ + return; + } + state.height = height; + state.url = url; + const event = {... state}; + window.parent.postMessage(event, "*"); +} + +window.setInterval(sendEvent, 100) \ No newline at end of file