forked from FlatAssembler/PicoBlaze_Simulator_in_JS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewer.js
27 lines (23 loc) · 811 Bytes
/
viewer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
document.addEventListener("DOMContentLoaded", function() {
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.has('id')) {
const id = urlParams.get('id');
const url = `db.php?id=${encodeURIComponent(id)}`;
console.log(url);
fetch(url)
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.text();
})
.then(data => {
const asm = document.getElementById("assemblyCode");
data = data.replace("\r\n", "\n");
document.getElementById('assemblyCode').innerText = data;
console.log(asm.textContent);
setUpLineNumbers();
})
.catch(error => { console.error('Error:', error); });
}
});