Compare commits
No commits in common. "2ac625d825865062029a6489739144b7bbd3d680" and "364c6f3ca9b4ba8788adc7021f3ea791646cfcf2" have entirely different histories.
2ac625d825
...
364c6f3ca9
21
fetch.js
21
fetch.js
|
@ -1,22 +1,7 @@
|
||||||
const url = "http://localhost/p20/get.php"
|
const url = "http://localhost/15.05/get.php"
|
||||||
|
|
||||||
fetch(url)
|
fetch( url + 'get.php')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then( data => {
|
||||||
console.log(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);
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatSufiksy(sufiksy) {
|
|
||||||
return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n');
|
|
||||||
}
|
|
2
get.php
2
get.php
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?
|
||||||
$dbhost = "localhost";
|
$dbhost = "localhost";
|
||||||
$dbuser = "root";
|
$dbuser = "root";
|
||||||
$dbpass = "";
|
$dbpass = "";
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="pl">
|
<html lang="pl">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
@ -8,7 +7,6 @@
|
||||||
<link rel="stylesheet" href="styles.css">
|
<link rel="stylesheet" href="styles.css">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>Sortowanie Sufiksów</h1>
|
<h1>Sortowanie Sufiksów</h1>
|
||||||
<input type="text" id="slowo" placeholder="Podaj słowo">
|
<input type="text" id="slowo" placeholder="Podaj słowo">
|
||||||
|
@ -17,7 +15,7 @@
|
||||||
<pre id="nieposortowane"></pre>
|
<pre id="nieposortowane"></pre>
|
||||||
<h2>Posortowane Sufiksy</h2>
|
<h2>Posortowane Sufiksy</h2>
|
||||||
<pre id="posortowane"></pre>
|
<pre id="posortowane"></pre>
|
||||||
<script src="fetch.js"></script>
|
<script src="js.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
1
js.js
1
js.js
|
@ -8,7 +8,6 @@ function sortujSufiksy() {
|
||||||
sufiksy.sort();
|
sufiksy.sort();
|
||||||
document.getElementById('posortowane').textContent = formatSufiksy(sufiksy);
|
document.getElementById('posortowane').textContent = formatSufiksy(sufiksy);
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatSufiksy(sufiksy) {
|
function formatSufiksy(sufiksy) {
|
||||||
return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n');
|
return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n');
|
||||||
}
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
|
@ -13,6 +14,7 @@ h1 {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
input[type="text"] {
|
input[type="text"] {
|
||||||
width: calc(100% - 22px);
|
width: calc(100% - 22px);
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
@ -22,6 +24,7 @@ input[type="text"] {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
button {
|
button {
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -38,6 +41,7 @@ button:hover {
|
||||||
background-color: #004494;
|
background-color: #004494;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
color: #0056b3;
|
color: #0056b3;
|
||||||
border-bottom: 2px solid #0056b3;
|
border-bottom: 2px solid #0056b3;
|
||||||
|
|
Loading…
Reference in New Issue