Compare commits
No commits in common. "65c5b618294c8783501fa1c727da659fec78b57d" and "e52791614967348caf758a89b80b49287389c849" have entirely different histories.
65c5b61829
...
e527916149
25
fetch.js
25
fetch.js
|
@ -1,13 +1,9 @@
|
|||
const url = "http://localhost/p20/get.php"
|
||||
<<<<<<< HEAD
|
||||
let lista
|
||||
=======
|
||||
>>>>>>> dev2
|
||||
|
||||
fetch(url)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
<<<<<<< HEAD
|
||||
// console.log(data)
|
||||
sortujSufiksy(data)
|
||||
})
|
||||
|
@ -29,25 +25,4 @@ function sortujSufiksy(data) {
|
|||
|
||||
function formatSufiksy(sufiksy) {
|
||||
return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n');
|
||||
=======
|
||||
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 += `<li> ${JSON.stringify(element.osoby)} </li>`);
|
||||
// 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'));
|
||||
>>>>>>> dev2
|
||||
}
|
|
@ -14,15 +14,9 @@
|
|||
<input type="text" id="slowo" placeholder="Podaj słowo">
|
||||
<button onclick="sortujSufiksy()">Sortuj Sufiksy</button>
|
||||
<h2>Nieposortowane Sufiksy</h2>
|
||||
<<<<<<< HEAD
|
||||
<pre id="nieposortowane"></pre>
|
||||
<h2>Posortowane Sufiksy</h2>
|
||||
<pre id="posortowane"></pre>
|
||||
=======
|
||||
<div class="pre" id="nieposortowane"></div>
|
||||
<h2>Posortowane Sufiksy</h2>
|
||||
<div class="pre" id="posortowane"></div>
|
||||
>>>>>>> dev2
|
||||
<script src="fetch.js"></script>
|
||||
|
||||
<li id="lista">
|
||||
|
|
17
qstack.php
17
qstack.php
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
$dbhost = "qstack.pl";
|
||||
$dbuser = "root";
|
||||
$dbpass = "";
|
||||
$dbname = "osoby";
|
||||
|
||||
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
|
||||
$ans = mysqli_query($conn, "SELECT * FROM osoby");
|
||||
$json = array();
|
||||
|
||||
|
||||
while ($row = mysqli_fetch_assoc($ans)) {
|
||||
$json[] = $row;
|
||||
}
|
||||
echo json_encode($json);
|
||||
|
||||
?>
|
14
styles.css
14
styles.css
|
@ -45,24 +45,10 @@ h2 {
|
|||
margin-top: 20px;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
pre {
|
||||
=======
|
||||
#nieposortowane {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
|
||||
/* .pre {
|
||||
>>>>>>> dev2
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
overflow-x: auto;
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
} */
|
||||
>>>>>>> dev2
|
||||
|
|
Loading…
Reference in New Issue