diff --git a/db.php b/db.php new file mode 100644 index 0000000..5e75908 --- /dev/null +++ b/db.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/fetch.js b/fetch.js index bacf672..1b5763d 100644 --- a/fetch.js +++ b/fetch.js @@ -1,7 +1,22 @@ const url = "http://localhost/15.05/get.php" -fetch( url + 'get.php') +fetch( url) .then(response => response.json()) .then( data => { console.log(data) - }) \ No newline at end of file + }) + + + function sortujSufiksy() { + const slowo = document.getElementById('slowo').value; + const sufiksy = []; + for (let i = 0; i < slowo.length; i++) { + sufiksy.push(slowo.slice(i)); + } + document.getElementById('nieposortowane').textContent = formatSufiksy(sufiksy); + sufiksy.sort(); + document.getElementById('posortowane').textContent = formatSufiksy(sufiksy); + } + function formatSufiksy(sufiksy) { + return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n'); + } \ No newline at end of file diff --git a/js.js b/js.js index 62d2912..de8fb21 100644 --- a/js.js +++ b/js.js @@ -15,7 +15,7 @@ function sortujSufiksy() { document.getElementById('nieposortowane').textContent = formatSufiksy(sufiksy); sufiksy.sort(); document.getElementById('posortowane').textContent = formatSufiksy(sufiksy); -}git +} function formatSufiksy(sufiksy) { return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n'); }