Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-sapletta-com authored Jan 7, 2024
1 parent 9793676 commit c4c3778
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,29 @@

<body>

<h1>Odczyt pliku YAML</h1>
<input type="text" id="yaml-url" value="https://raw.githubusercontent.com/apiunit/www/master/project.yaml" />
<button onclick="loadYAML()">Odczytaj plik</button>
<pre id="yaml-content"></pre>

<script>
function loadYAML() {
var url = document.getElementById('yaml-url').value;
fetch(url)
.then(response => {
if (response.ok) return response.text();
throw new Error('Błąd sieci lub nie znaleziono pliku!');
})
.then(data => {
var yamlContent = jsyaml.load(data);
document.getElementById('yaml-content').textContent = JSON.stringify(yamlContent, null, 2);
})
.catch(error => {
document.getElementById('yaml-content').textContent = error.message;
});
}
</script>


<h1>Project Progress</h1>
<pre id="progress-container"></pre>
Expand Down

0 comments on commit c4c3778

Please sign in to comment.