WebManifest

This commit is contained in:
Miraty 2019-03-28 22:44:06 +01:00
parent 8a2a605f45
commit cb782988d4
6 changed files with 91 additions and 11 deletions

View File

@ -27,6 +27,7 @@
<link rel="icon" type="image/png" href="favicons/<?php echo $theme; ?>-512.png" sizes="512x512"/>
<meta name="theme-color" content="<?php echo $couleurPrincipale; ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="manifest" href="manifest.php">
<link rel="search" type="application/opensearchdescription+xml" title="Générer un code QR" href="opensearch.php" />
<style>
<?php require "lessphp/lessc.inc.php";
@ -39,9 +40,8 @@
<?php if (!isset($_GET["texte"])) { // Si OpenSearch n'a pas été utilisé ?>
<header>
<a href=""><img id="logo" src="<?php echo $theme; ?>.png" alt="Logo <?php echo $theme; ?>"> <h1>Générateur de codes QR</h1></a>
<a href="<?php echo $cheminInstall; ?>"><img id="logo" src="favicons/<?php echo $theme; ?>-48.png" alt="Logo de code QR"> <h1>Générateur de codes QR</h1></a>
</header>
<form method="post">
@ -168,6 +168,12 @@
QRcode::png($_GET['texte'], $cheminImage, "H", 4, 2); ?>
<header>
<a href="<?php echo $cheminInstall; ?>"><img id="logo" src="favicons/<?php echo $theme; ?>-48.png" alt="Logo <?php echo $theme; ?>"> <h1>Générateur de codes QR</h1></a>
</header>
<br>
<div class="centrer">
<a href="<?php echo $cheminImage; ?>" class="bouton" download="<?php echo htmlspecialchars($_GET['texte']); ?>.png">Télécharger ce code QR</a>
</div>
@ -176,6 +182,10 @@
<a href="<?php echo $cheminImage; ?>"><img alt='Un code QR contenant "<?php echo htmlspecialchars($_GET['texte']); ?>"' id="codeQR" src="<?php echo $cheminImage; ?>"/></a>
</div>
<footer>
<a class="lienCodeSource" href="https://code.antopie.org/miraty/qr">Code source</a>
</footer>
<?php } } ?>

67
manifest.php Executable file
View File

@ -0,0 +1,67 @@
<?php require "options.inc.php"; ?>
{
"dir": "ltr",
"lang": "fr-FR",
"name": "Générateur de code QR",
"short_name": "Code QR",
"description": "Générez un code QR rapidement",
"start_url": "<?php echo $cheminInstall; ?>",
"scope": "<?php echo $cheminInstall; ?>"
"display": "standalone",
"theme_color": "<?php echo $couleurPrincipale; ?>",
"background_color": "<?php echo $couleurPrincipale; ?>",
"orientation": "portrait",
"icons":
[
{
"src": "favicons/<?php echo $theme; ?>-16.png",
"sizes": "16x16",
"type": "image/png"
},
{
"src": "favicons/<?php echo $theme; ?>-32.png",
"sizes": "32x32",
"type": "image/png"
},
{
"src": "favicons/<?php echo $theme; ?>-48.png",
"sizes": "48x48",
"type": "image/png"
},
{
"src": "favicons/<?php echo $theme; ?>-64.png",
"sizes": "64x64",
"type": "image/png"
},
{
"src": "favicons/<?php echo $theme; ?>-96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "favicons/<?php echo $theme; ?>-128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "favicons/<?php echo $theme; ?>-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "favicons/<?php echo $theme; ?>-256.png",
"sizes": "256x256",
"type": "image/png"
},
{
"src": "favicons/<?php echo $theme; ?>-384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "favicons/<?php echo $theme; ?>-512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}

View File

@ -1,6 +1,4 @@
<?php
require "options.inc.php";
?>
<?php require "options.inc.php"; ?>
<?xml version="1.0" encoding="UTF-8" ?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Générer un code QR</ShortName>
@ -18,4 +16,5 @@
<Language>fr</Language>
<InputEncoding>UTF-8</InputEncoding>
<Url type="text/html" template="<?php echo $cheminInstall; ?>?texte={searchTerms}"/>
<Url type="application/opensearchdescription+xml" rel="self" template="<?php echo $cheminInstall; ?>opensearch.php" />
</OpenSearchDescription>

View File

@ -1,6 +1,11 @@
<?php
// Paramètres :
supprimerVieuxQR(60 * 60 * 24 * 7); // Indique le temps en secondes après lequel le code qr sera supprimé quand qq chargera la page
$theme = "defaut"; // defaut ou parinux
$cheminInstall = "https://example.org"; // L'adresse racine depuis laquelle le générateur sera accessible (avec le slash final)
if ($theme == "defaut") {
$couleurPrincipale = "#2D2F34";
@ -8,10 +13,6 @@ if ($theme == "defaut") {
$couleurPrincipale = "#157097";
}
$cheminInstall = "http://localhost:8888/qr/";
function generateRandomString($length) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);

View File

@ -154,12 +154,15 @@ h1, #logo {
}
#logo {
width: 64px;
width: 48px;
}
::placeholder {
color: fadeout(@texte, 50%);
opacity: 1;
font-family: "ubuntu", "ubuntu-dl";
font-weight: normal;
font-size: 1em;
}
/* Infobulle */

View File

@ -5,6 +5,6 @@
@bordure: #48aed9;
@bordureHover: #87d1f1;
@bordureFocus: #e2f6ff;
@texte: #B4EAFF;
@texte: #d5f3ff;
@texteForm: #e2f6ff;
@texteLienCodeSource: #3da3cf;