new input area, no empty spans

This commit is contained in:
Tristan Schneider 2020-12-11 13:00:53 +01:00
parent 7545e83cfb
commit 5709e182c6
2 changed files with 30 additions and 11 deletions

View File

@ -33,7 +33,9 @@ if (array_key_exists("submitted", $_REQUEST)) {
$content .= "<br>\n"; $content .= "<br>\n";
} }
if (!empty($word)) {
fwrite($sentences, $content); fwrite($sentences, $content);
}
fclose($sentences); fclose($sentences);
header("location: ".htmlentities($_SERVER['PHP_SELF'])); header("location: ".htmlentities($_SERVER['PHP_SELF']));
} }
@ -46,7 +48,8 @@ $config_data = json_decode($raw_json_config, false);
<html> <html>
<head> <head>
<title><?php print($config_data->title ?? "One Word Each"); ?></title> <title><?php print($config_data->title ?? "One Word Each"); ?></title>
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css?newinputarea">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" integrity="sha512-+4zCK9k+qNFUR5X+cKL9EIR+ZOhtIloNl9GIKS57V1MyNsYpYcUrUeQc9vNfzsWfV28IaLL3i96P9sdNyeRssA==" crossorigin="anonymous" />
<link rel="icon" href="<?php print($config_data->logo->icon_path ?? "favicon.ico"); ?>" type="image/x-icon"> <link rel="icon" href="<?php print($config_data->logo->icon_path ?? "favicon.ico"); ?>" type="image/x-icon">
</head> </head>
<body> <body>
@ -55,7 +58,7 @@ $config_data = json_decode($raw_json_config, false);
<td width="50%"><img src="<?php print($config_data->logo->image_path ?? "OWE_Logo.png"); ?>" width="90%"></td> <td width="50%"><img src="<?php print($config_data->logo->image_path ?? "OWE_Logo.png"); ?>" width="90%"></td>
<td><h1><?php print($config_data->headline ?? "One Word Each Seite"); ?></h1></td> <td><h1><?php print($config_data->headline ?? "One Word Each Seite"); ?></h1></td>
</tr> </tr>
<table> </table>
<p> <p>
<?php <?php
@ -70,17 +73,18 @@ $config_data = json_decode($raw_json_config, false);
?> ?>
</p> </p>
<button onclick="onReloadClicked()" id="but-reload">aktualisieren</button> <button onclick="onReloadClicked()" id="but-reload">aktualisieren</button>
<br><br> <br>
<form action="./#wordform" method="post" autocomplete="off" id="wordform"> <form action="./#wordform" method="post" autocomplete="off" id="wordform"></form>
<table> <div class="word_input_area">
<tr> <td>Nächstes Wort:</td> <td><input type="text" name="submitted" id="wordinput"></td> </tr> <input type="text" name="submitted" id="wordinput" form="wordform" placeholder="Nächstes Wort"> <button type="submit" form="wordform" class="send_button"><i class="far fa-paper-plane"></i></button>
<tr> <td></td> <td><input type="submit" value="senden"></td> </tr> </div>
</table>
</form>
<script> <script>
var previousTextLength; var previousTextLength;
document.getElementById("wordinput").focus();
function loadSentences(alertIfNew = false) { function loadSentences(alertIfNew = false) {
fetch("./data/sentences.txt", {headers: {"Cache-Control": "no-cache, no-store"}}) fetch("./data/sentences.txt", {headers: {"Cache-Control": "no-cache, no-store"}})
.then((response) => { .then((response) => {

View File

@ -22,6 +22,21 @@ a {
#wordinput { #wordinput {
color: black; color: black;
background-color: white; background-color: white;
display: flex;
flex-wrap: wrap;
width: auto;
}
input, .send_button {
border: none;
font-size: 2em;
margin: 10px;
}
.word_input_area {
border: 2px solid white;
display: inline-flex;
} }
table { table {