Skip to content

Commit

Permalink
path corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
divinsmathew committed May 19, 2021
1 parent fe3b26f commit 48cee58
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 5 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="./css/styles.css">
<title>CoWatch</title>

<script src="./js/cowatch.js" defer></script>
<script src="./js/districts.js" defer></script>
<script src="./js/utils.js"></script>
<script>let relativePath = getUrlParts(window.location.href).pathname.replace('index.html', '')</script>
</head>

<body onload="onload()">
Expand Down Expand Up @@ -138,9 +143,6 @@
</table>
</div>
</div>
<script src="./js/cowatch.js"></script>
<script src="./js/districts.js"></script>
<script src="./js/utils.js"></script>
</body>

</html>
6 changes: 3 additions & 3 deletions js/cowatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function onload()
resetFilter()
fillDistricts()

window.history.pushState('', '', "/index.html?districtId=" + districtsSelect.value)
window.history.pushState('', '', relativePath + "?districtId=" + districtsSelect.value)
previousDetailsHtml = ''
previousSessionCountMap.clear()
refreshTable(true)
Expand All @@ -41,7 +41,7 @@ async function onload()
districtsSelect.addEventListener('change', () =>
{
resetFilter()
window.history.pushState('', '', "/index.html?districtId=" + districtsSelect.value)
window.history.pushState('', '', relativePath + "?districtId=" + districtsSelect.value)
previousDetailsHtml = ''
previousSessionCountMap.clear()
refreshTable(true)
Expand All @@ -52,7 +52,7 @@ async function onload()
{
if(!isNumeric(qDistrictId) || !states.find(s => s.districts.some(d => d.districtId == qDistrictId)))
{
window.location.replace('/index.html')
window.location.replace(relativePath)
return
}

Expand Down
3 changes: 1 addition & 2 deletions js/districts.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ function cleanName(name)

async function buildAllDistrictIdMapLocal()
{
let path = getUrlParts(window.location.href).pathname.replace('index.html','');
let endpoint = path + 'assets/districts.json'
let endpoint = relativePath + 'assets/districts.json'

let response = await fetch(endpoint)
let responseAsJson = await response.json()
Expand Down

0 comments on commit 48cee58

Please sign in to comment.