Use HTML summary/details to display help text

This commit is contained in:
Miraty 2021-03-07 19:06:32 +01:00
parent 6ced4390e7
commit 9944bfbb82
6 changed files with 46 additions and 96 deletions

View File

@ -135,14 +135,14 @@ if (badQuery()) {
<div id="firstWrapper">
<div class="param">
<label for="txt"><?= $loc['label_content'] ?></label>
<span class="helpContainer">
<span class="helpButton" tabindex="0"><img class="helpImg" src="help.svg.php?clr=<?= urlencode($variablesTheme["text"]) ?>" alt="<?= $loc['alt_help'] ?>"></span>
<span class="helpContent">
<label for="txt">
<details>
<summary><?= $loc['label_content'] ?></summary>
<p class="helpText">
<?= $loc['help_content'] ?>
</span>
</span>
<br>
</p>
</details>
</label>
<textarea rows="8" required="" id="txt" placeholder="<?= $loc['placeholder'] ?>" name="txt"><?php
if (isset($_GET['txt'])) {
@ -155,12 +155,14 @@ if (badQuery()) {
<div id="menusDeroulants">
<div class="param">
<label for="redondancy"><?= $loc['label_redondancy'] ?></label>
<span class="helpContainer">
<span class="helpButton" tabindex="0"><img class="helpImg" src="help.svg.php?clr=<?= urlencode($variablesTheme["text"]) ?>" alt="<?= $loc['alt_help'] ?>"></span>
<span class="helpContent"><?= $loc['help_redondancy'] ?></span>
</span>
<br>
<label for="redondancy">
<details>
<summary><?= $loc['label_redondancy'] ?></summary>
<p class="helpText">
<?= $loc['help_redondancy'] ?>
</p>
</details>
</label>
<select id="redondancy" name="redondancy">
<option <?php if (isset($_GET['redondancy']) AND ($_GET['redondancy'] == "L")) {echo 'selected="" ';} ?>value="L">L - 7%</option>
<option <?php if (isset($_GET['redondancy']) AND ($_GET['redondancy'] == "M")) {echo 'selected="" ';} ?>value="M">M - 15%</option>
@ -170,12 +172,14 @@ if (badQuery()) {
</div>
<div class="param">
<label for="margin"><?= $loc['label_margin'] ?></label>
<span class="helpContainer">
<span class="helpButton" tabindex="0"><img class="helpImg" src="help.svg.php?clr=<?= urlencode($variablesTheme["text"]) ?>" alt="<?= $loc['alt_help'] ?>"></span>
<span class="helpContent"><?= $loc['help_margin'] ?></span>
</span>
<br>
<label for="margin">
<details>
<summary><?= $loc['label_margin'] ?></summary>
<p class="helpText">
<?= $loc['help_margin'] ?>
</p>
</details>
</label>
<select id="margin" name="margin">
<option <?php if (isset($_GET['margin']) AND ($_GET['margin'] == "0")) {echo 'selected="" ';} ?>value="0">0</option>
<option <?php if (isset($_GET['margin']) AND ($_GET['margin'] == "1")) {echo 'selected="" ';} ?>value="1">1</option>
@ -189,12 +193,14 @@ if (badQuery()) {
</div>
<div class="param">
<label for="size"><?= $loc['label_size'] ?></label>
<span class="helpContainer">
<span class="helpButton" tabindex="0"><img class="helpImg" src="help.svg.php?clr=<?= urlencode($variablesTheme["text"]) ?>" alt="<?= $loc['alt_help'] ?>"></span>
<span class="helpContent"><?= $loc['help_size'] ?></span>
</span>
<br>
<label for="size">
<details>
<summary><?= $loc['label_size'] ?></summary>
<p class="helpText">
<?= $loc['help_size'] ?>
</p>
</details>
</label>
<select id="size" name="size">
<option <?php if (isset($_GET['size']) AND ($_GET['size'] == 1)) {echo 'selected="" ';} ?>value="1">1</option>
<option <?php if (isset($_GET['size']) AND ($_GET['size'] == 2)) {echo 'selected="" ';} ?>value="2">2</option>

View File

@ -35,7 +35,6 @@ $loc = array(
'title_showOnlyQR' => "Show this QR code only",
'alt_help' => "Help",
'alt_QR_before' => 'QR code meaning "',
'alt_QR_after' => '"',

View File

@ -35,7 +35,6 @@ $loc = array(
'title_showOnlyQR' => "Afficher uniquement ce code QR",
'alt_help' => "Aide",
'alt_QR_before' => "Code QR signifiant « ",
'alt_QR_after' => " »",

View File

@ -35,7 +35,6 @@ $loc = array(
'title_showOnlyQR' => "Mostrar sonque aqueste còdi QR",
'alt_help' => "Ajuda",
'alt_QR_before' => 'Significacion de còdi QR"',
'alt_QR_after' => '"',

View File

@ -24,7 +24,6 @@ $loc = array(
'title_showOnlyQR' => "title_showOnlyQR",
'alt_help' => "alt_help",
'alt_QR_before' => "alt_QR_before",
'alt_QR_after' => "alt_QR_after",

View File

@ -30,16 +30,23 @@ p {
margin: 10px;
}
details .helpText {
background-color: @bgHelp;
padding: 5px;
border-radius: 10px;
text-align: left;
}
#menusDeroulants summary {
text-align: center;
margin-left: 20px;
}
#firstWrapper {
display: flex;
flex-direction: row;
}
#menusDeroulants {
text-align: center;
margin-left: 20px;
}
#qrCode {
max-width: 480px;
}
@ -160,20 +167,13 @@ label[for=txt] {
}
.metaText {
color: @secondaryText;
transition: color 0.12s cubic-bezier(0.42, 0.0, 1.0, 1.0);
color: @text;
padding: 6px;
& a, a:visited {
transition: color 0.12s cubic-bezier(0.42, 0.0, 1.0, 1.0);
color: @secondaryText;
color: @text;
text-decoration: underline;
}
&:hover, &:hover a {
color: @text;
}
}
footer {
@ -260,58 +260,6 @@ input[type=color] {
border: 2px @border solid;
}
/* Help message */
.helpImg {
width: 22px;
height: 22px;
margin-bottom: -3px;
display: inline-block;
}
.helpButton {
height: 22px;
width: 22px;
color: @secondaryText;
cursor: help;
font-size: 0.8em;
display: inline-block;
}
.helpContainer {
display: inline-block;
margin-left: 5px;
}
.helpContent {
position: absolute;
transform: scale(0) rotate(-12deg);
color: @text;
background: @bgHelp;
padding: 15px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,.5);
margin-top: 23px;
margin-left: -35px;
transition: all .25s;
opacity: 0;
max-width: 500px;
font-size: 20px;
text-align: left;
@media (max-width: 500px) {
position: fixed;
margin: 5px;
left: 0px;
top: 0px;
}
}
.helpContainer:hover .helpContent, .helpContainer:focus-within .helpContent {
transform: scale(1) rotate(0);
opacity: 1;
}
/* Media queries */
@media (max-width: 850px) {