Added <header>, <main> and <footer> tags; Added version info and source link to footer

This commit is contained in:
fanir 2017-06-01 02:28:19 +02:00
parent e575bb3a72
commit 2844fe18cc
1 changed files with 68 additions and 36 deletions

104
index.php
View File

@ -11,10 +11,19 @@
}
h1 {
font-size: 2rem;
border-bottom: 0.2rem solid lightgray;
border-bottom: 0.1em solid lightgray;
display: inline-block;
}
footer {
display: inline-block;
border-top: 0.2em solid lightgray;
}
footer,
footer * {
font-size: 0.75rem;
}
table#result {
border-collapse: collapse;
}
@ -82,7 +91,6 @@
}
:required:invalid, :focus:invalid {
/* insert your own styles for invalid form input */
background-color: #ffeeee;
}
</style>
@ -106,7 +114,10 @@
</script>
</head>
<body>
<h1>MtG Card Data Collector</h1>
<header>
<h1>MtG Card Data Collector</h1>
</header>
<main>
<?php
require 'vendor/autoload.php';
@ -205,12 +216,12 @@ function x() {
}
x()
?>
<form id=form method=post>
<div class="table">
<div class="row">
<label for="format">Output Format:</label>
<div>
<select type="text" id="format" name="format" required>
<form id=form method=post>
<div class="table">
<div class="row">
<label for="format">Output Format:</label>
<div>
<select type="text" id="format" name="format" required>
<?php
foreach ([
"Card name" => "cardname",
@ -221,38 +232,59 @@ foreach ([
echo "<option value=\"$value\" $selected>$label</option>";
}
?>
</select>
<label style="display: block; margin: 0.25em 0;">
<input name=prefix value=1 type=checkbox <?= !empty($_REQUEST["prefix"]) ? "checked" : "" ?>>
Prefix with input and raw result URL
</label>
</select>
<label style="display: block; margin: 0.25em 0;">
<input name=prefix value=1 type=checkbox <?= !empty($_REQUEST["prefix"]) ? "checked" : "" ?>>
Prefix with input and raw result URL
</label>
</div>
</div>
</div>
<div class="row">
<label for="query">Cards:<br><small id=linecounter>0/100</small></label>
<textarea id="query" name="query" rows="20" onkeyup="updateLineCounter()" <?= !isset($_REQUEST['query']) ? "autofocus" : "" ?> required placeholder="M12 7
<div class="row">
<label for="query">Cards:<br><small id=linecounter>0/100</small></label>
<textarea id="query" name="query" rows="20" onkeyup="updateLineCounter();" <?= !isset($_REQUEST['query']) ? "autofocus" : "" ?> required placeholder="M12 7
ORI 25
AER 178"><?= !empty($_REQUEST['query']) ? $_REQUEST['query'] : "" ?></textarea>
</div>
<div class="row">
<div></div>
<div>
<p>
Please keep in mind the data source for this service enforces a daily request limit,
so please don't waste it. If no cards are found and you are sure your set codes and
card numbers are valid, try again in a few hours or use the raw result URLs.
</p>
<p>
Depending on how many cards you entered, loading the data will take a while.
</p>
</div>
<div class="row">
<div></div>
<div>
<p>
Please keep in mind the data source for this service enforces a daily request limit,
so please don't waste it. If no cards are found and you are sure your set codes and
card numbers are valid, try again in a few hours or use the raw result URLs.
</p>
<p>
Depending on how many cards you entered, loading the data will take a while.
</p>
</div>
</div>
<div class="row">
<span></span>
<button id=submit type="submit">Submit</button>
</div>
</div>
<div class="row">
<span></span>
<button id=submit type="submit">Submit</button>
</div>
</div>
</form>
</form>
</main>
<footer>
<p>
Version:
<?php
$stdout=[];
exec("git log --format=\"%h|%cd|%d\" --decorate=short --date=short HEAD~1..HEAD", $stdout);
$parts = explode("|", $stdout[0]);
$offset_start = strpos($parts[2], "tag: ");
if ($offset_start !== false) {
$offset_start += 5;
$offset_end = strpos($parts[2], ",", $offset_start) or strpos($parts[1], ")", $offset_start);
echo substr($parts[2], $offset_start, $offset_end - $offset_start), "; ";
}
echo $parts[0], " (", $parts[1], ")";
?>
| <a href="https://git.zom.bi/fanir/mtg-cdc">Source</a>
</p>
</footer>
<script type="text/javascript">updateLineCounter()</script>
</body>
</html>