diff --git a/fetch.js b/fetch.js index d106a25..6f62e7d 100644 --- a/fetch.js +++ b/fetch.js @@ -1,8 +1,8 @@ -const url = "http://localhost/P20.05/get.php" +const url = "http://localhost/p20/get.php" fetch(url) .then(response => response.json()) - .then( data => { + .then(data => { console.log(data) }) @@ -15,7 +15,8 @@ function sortujSufiksy() { 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/get.php b/get.php index b58af0c..1f484c2 100644 --- a/get.php +++ b/get.php @@ -1,5 +1,9 @@ >>>>>> PiotrB $dbuser = "root"; $dbpass = ""; $dbname = "db"; diff --git a/index.html b/index.html index 236df3e..c010e6b 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,6 @@ + @@ -7,10 +8,11 @@ +

Sortowanie Sufiksów

- +

Nieposortowane Sufiksy


     

Posortowane Sufiksy

diff --git a/js.js b/js.js deleted file mode 100644 index 137afa9..0000000 --- a/js.js +++ /dev/null @@ -1,21 +0,0 @@ -const url = "http://localhost/P20.05" - -fetch('get.php') - .then(response => response.json()) - .then( data => { - console.log(data) - }) - -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); -}git -function formatSufiksy(sufiksy) { - return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n'); -} diff --git a/styles.css b/styles.css index c5012df..e2265d7 100644 --- a/styles.css +++ b/styles.css @@ -1,4 +1,3 @@ - body { font-family: Arial, sans-serif; background-color: #f5f5f5; @@ -14,7 +13,6 @@ h1 { margin-bottom: 20px; } - input[type="text"] { width: calc(100% - 22px); padding: 10px; @@ -24,7 +22,6 @@ input[type="text"] { box-sizing: border-box; } - button { display: block; width: 100%; @@ -41,7 +38,6 @@ button:hover { background-color: #004494; } - h2 { color: #0056b3; border-bottom: 2px solid #0056b3;