Finish implementing the player tracker

This commit is contained in:
Chris Wilson
2021-02-25 01:16:22 -05:00
parent 69c1e138b4
commit 8615b2f0f5
5 changed files with 98 additions and 103 deletions

View File

@@ -1,3 +1,20 @@
window.addEventListener('load', () => {
// setTimeout(() => window.location.reload(), 15000);
const url = window.location;
setInterval(() => {
const ajax = new XMLHttpRequest();
ajax.onreadystatechange = () => {
if (ajax.readyState !== 4) { return; }
// Create a fake DOM using the returned HTML
const domParser = new DOMParser();
const fakeDOM = domParser.parseFromString(ajax.responseText, 'text/html');
// Update item and location trackers
document.getElementById('inventory-table').innerHTML = fakeDOM.getElementById('inventory-table').innerHTML;
document.getElementById('location-table').innerHTML = fakeDOM.getElementById('location-table').innerHTML;
};
ajax.open('GET', url);
ajax.send();
}, 15000)
});

View File

@@ -1,12 +1,16 @@
#player-tracker-wrapper{
margin: 0;
}
#inventory-table{
border: 2px solid black;
border-radius: 4px;
margin-bottom: 5px;
width: 250px;
border-top: 2px solid #000000;
border-left: 2px solid #000000;
border-right: 2px solid #000000;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
padding: 3px 3px 10px;
width: 260px;
background-color: #42b149;
}
#inventory-table td{
@@ -33,24 +37,27 @@
}
#location-table{
width: 250px;
border: 2px solid black;
border-radius: 4px;
width: 260px;
border-left: 2px solid #000000;
border-right: 2px solid #000000;
border-bottom: 2px solid #000000;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
background-color: #42b149;
padding: 0 3px 3px;
}
#location-table th{
vertical-align: middle;
text-align: right;
text-align: center;
padding-right: 10px;
}
#location-table td{
padding-top: 2px;
padding-bottom: 2px;
}
#location-table th.counter{
padding-right: 10px;
text-align: center;
padding-right: 5px;
line-height: 20px;
}
#location-table td.counter{