From bdda7e717fd00517e6155943f482e9c3e0fb6949 Mon Sep 17 00:00:00 2001 From: piotrb Date: Mon, 20 May 2024 11:38:56 +0200 Subject: [PATCH] i --- fetch.js | 25 +++++++++++++++++++++++ get.php | 17 ++++++++++++++++ index.html | 28 +++++++++++++++++++++++++ qstack.php | 17 ++++++++++++++++ styles.css | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 147 insertions(+) create mode 100644 fetch.js create mode 100644 get.php create mode 100644 index.html create mode 100644 qstack.php create mode 100644 styles.css diff --git a/fetch.js b/fetch.js new file mode 100644 index 0000000..03bc607 --- /dev/null +++ b/fetch.js @@ -0,0 +1,25 @@ +const url = "http://localhost/p20/get.php" + +fetch(url) + .then(response => response.json()) + .then(data => { + sortujSufiksy(data) + }); + +function sortujSufiksy(data) { + const slowo = document.getElementById('slowo').value; + // console.log("tetst" + slowo) + const sufiksy = []; + for (let i = 0; i < slowo.length; i++) { + sufiksy.push(slowo.slice(i)); + } + + data.forEach((element) => document.querySelector('#nieposortowane').innerHTML += `
  • ${JSON.stringify(element.osoby)}
  • `); + // console.log(formatSufiksy(sufiksy)); + // sufiksy.sort(); + // document.querySelector('#posortowane').innerHTML += formatSufiksy(sufiksy); +} + +function formatSufiksy(sufiksy) { + // console.log(sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n')); +} \ No newline at end of file diff --git a/get.php b/get.php new file mode 100644 index 0000000..3c36680 --- /dev/null +++ b/get.php @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..9a261cd --- /dev/null +++ b/index.html @@ -0,0 +1,28 @@ + + + + + + + Sortowanie Sufiksów + + + + + +

    Sortowanie Sufiksów

    + + +

    Nieposortowane Sufiksy

    +
    +

    Posortowane Sufiksy

    +
    + + +
  • +
      +
    1. + + + + \ No newline at end of file diff --git a/qstack.php b/qstack.php new file mode 100644 index 0000000..9fcfd11 --- /dev/null +++ b/qstack.php @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..59e6944 --- /dev/null +++ b/styles.css @@ -0,0 +1,60 @@ +body { + font-family: Arial, sans-serif; + background-color: #f5f5f5; + color: #333; + margin: 0; + padding: 20px; + line-height: 1.6; +} + +h1 { + text-align: center; + color: #0056b3; + margin-bottom: 20px; +} + +input[type="text"] { + width: calc(100% - 22px); + padding: 10px; + margin-bottom: 10px; + border: 1px solid #ccc; + border-radius: 4px; + box-sizing: border-box; +} + +button { + display: block; + width: 100%; + padding: 10px; + background-color: #0056b3; + color: white; + border: none; + border-radius: 4px; + cursor: pointer; + font-size: 16px; +} + +button:hover { + background-color: #004494; +} + +h2 { + color: #0056b3; + border-bottom: 2px solid #0056b3; + padding-bottom: 5px; + margin-top: 20px; +} + +#nieposortowane { + display: flex; + flex-direction: column; +} + + +/* .pre { + background-color: #fff; + border: 1px solid #ccc; + padding: 10px; + border-radius: 4px; + overflow-x: auto; +} */ \ No newline at end of file