From 433fcc4754470db02d916709dd9dc26c32287fcf Mon Sep 17 00:00:00 2001 From: piotrb Date: Mon, 20 May 2024 07:14:55 +0200 Subject: [PATCH 1/2] init --- fetch.js | 6 +++--- get.php | 2 +- index.html | 6 ++++-- js.js | 3 ++- styles.css | 4 ---- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/fetch.js b/fetch.js index bacf672..a4bc3a3 100644 --- a/fetch.js +++ b/fetch.js @@ -1,7 +1,7 @@ -const url = "http://localhost/15.05/get.php" +const url = "http://localhost/p20/get.php" -fetch( url + 'get.php') +fetch(url) .then(response => response.json()) - .then( data => { + .then(data => { console.log(data) }) \ No newline at end of file diff --git a/get.php b/get.php index e33c2a4..503e13c 100644 --- a/get.php +++ b/get.php @@ -1,4 +1,4 @@ - + @@ -7,15 +8,16 @@ +

Sortowanie Sufiksów

- +

Nieposortowane Sufiksy


     

Posortowane Sufiksy


-    
+    
 
 
 
diff --git a/js.js b/js.js
index 6f31706..658ae99 100644
--- a/js.js
+++ b/js.js
@@ -8,6 +8,7 @@ function sortujSufiksy() {
     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/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;

From 2ac625d825865062029a6489739144b7bbd3d680 Mon Sep 17 00:00:00 2001
From: piotrb 
Date: Mon, 20 May 2024 10:04:52 +0200
Subject: [PATCH 2/2] qstack + localhost

---
 fetch.js | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/fetch.js b/fetch.js
index a4bc3a3..6f62e7d 100644
--- a/fetch.js
+++ b/fetch.js
@@ -4,4 +4,19 @@ 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