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

104
index.php
View file

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