Pentis subproject and new Bash script added

This commit is contained in:
F. Y. H. 2022-12-30 22:52:57 +01:00
parent 410003b961
commit 580c7ab858
8 changed files with 1811 additions and 0 deletions

View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
#Migration selon Freedesktop.org
cd || exit 1
if [ ! -d .local/share/GIMP/2.10/ ]
then
mkdir -v -p .local/share/GIMP/2.10/
fi
for GIMP_DIR in brushes dynamics patterns palettes gradients fonts tool-presets scripts themes icons fractalexplorer gfig gflare gimpressionist
do
if [ -d .config/GIMP/2.10/${GIMP_DIR} ]
then
mv -v .config/GIMP/2.10/${GIMP_DIR}/ .local/share/GIMP/2.10/${GIMP_DIR}
else
mkdir -v -p .local/share/GIMP/2.10/${GIMP_DIR}
fi
done
if [ ! -d .local/lib/GIMP/2.10/ ]
then
mkdir -v -p .local/lib/GIMP/2.10/
fi
for GIMP_DIR in plug-ins modules interpreters environ
do
if [ -d .config/GIMP/2.10/${GIMP_DIR} ]
then
mv -v .config/GIMP/2.10/${GIMP_DIR}/ .local/lib/GIMP/2.10/${GIMP_DIR}
else
mkdir -v -p .local/lib/GIMP/2.10/${GIMP_DIR}
fi
done

55
Web/Pentis/Pentis.html Normal file
View file

@ -0,0 +1,55 @@
<!DOCTYPE html>
<!--Il faut lancer main.js par NodeJS-->
<!--Adresse: http://127.0.0.1:1337/Pentis.html-->
<html lang="fr-FR, fr">
<head>
<title>
Pentis
</title>
<meta charset="utf-8">
<meta name="author" content="Alnotz">
<meta name="color-scheme" content="dark light">
<meta name="keywords" content="alnotz, Pentis, canvas, interaction">
<meta name="description" content="Une page HTML dédiée au mini-jeu Pentis. Conçue par Alnotz et sous GPL3+.">
<link rel="stylesheet" title="dark" href="http://localhost:1337/Pentis_sombre.css" type="text/css" media="screen">
<link rel="canonical" href="http://localhost:1337/Pentis.html">
<link rel="alternate stylesheet" title="light" href="http://localhost:1337/Pentis_clair.css" type="text/css" media="screen">
<link rel="icon" href="http://localhost:1337/Pentis_icone.svg" type="image/png">
</head>
<body>
<h1>
Pentis
</h1>
<p>
Intéressé par les pentominos ?
</p>
<canvas id="toile" width="600" height="800">
Si ça ne peut pas marcher avec la
<em>
Canvas API
</em>
, on tentera autre chose.
</canvas>
<p>
Envie de voir derrière la scène ? Cliquer
<a id="ici" href="#">ici</a>
&#x20;
<span id="iciTexte">
affichera la grille
</span>.
</p>
<div id="grille">
<code id="tableau">
<pre>
</pre>
</code>
</div>
<noscript>
<p>
Sans le JavaScript, il n'y a pas grande chose à afficher vu que c'est la base de l'application. :-/
</p>
</noscript>
</body>
<script src="http://localhost:1337/Pentis.js" type="application/javascript">
</script>
</html>

1510
Web/Pentis/Pentis.js Normal file

File diff suppressed because it is too large Load diff

5
Web/Pentis/Pentis_404.md Normal file
View file

@ -0,0 +1,5 @@
# 404 !
## Fichier non trouvé.
## :-(

View file

@ -0,0 +1,32 @@
/* Style clair. */
body
{
background: white;
color: black;
}
/* Toile où dessiner les pentominos. */
canvas#toile
{
border: 2px solid red;
width: 600px;
height: 800px;
margin: 1em;
}
/* Texte où faire apparaître la grille. */
a#ici
{
text-decoration: none;
}
a#ici:hover
{
text-decoration: underline;
}
/* Grille effective. */
div#grille
{
width: 50%;
height: auto;
border: 2px dotted yellow;
line-height:0.8em;
display: none;
}

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">]>
<!--D'après l'œuvre de R. A. Nonenmacher.
Source:https://upload.wikimedia.org/wikipedia/commons/a/aa/All_18_Pentominoes.svg-->
<svg version="1.1"
id="FPentomino"
xmlns="&ns_svg;"
xmlns:xlink="&ns_xlink;"
width="800"
height="800"
viewBox="135 75 55 75"
overflow="visible"
enable-background="new 135 75 55 75"
xml:space="preserve">
<title>
Icone de Pentis.
</title>
<desc>
Symbole du pentomino 'F'.
</desc>
<g id="F_1">
<rect x="150" y="75" fill="#DDBB99" stroke="#000000" stroke-width="0.25" width="25" height="25"/>
<rect x="150" y="100" fill="#DDBB99" stroke="#000000" stroke-width="0.25" width="25" height="25"/>
<rect x="150" y="125" fill="#DDBB99" stroke="#000000" stroke-width="0.25" width="25" height="25"/>
<rect x="175" y="75" fill="#DDBB99" stroke="#000000" stroke-width="0.25" width="25" height="25"/>
<rect x="125" y="100" fill="#DDBB99" stroke="#000000" stroke-width="0.25" width="25" height="25"/>
<polygon fill="none" stroke="#000000" stroke-width="3" points="150,75 200,75 200,100 175,100 175,150 150,150 150,125 125,125 125,100 150,100"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,32 @@
/* Style sombre. */
body
{
background: black;
color: white;
}
/* Toile où dessiner les pentominos. */
canvas#toile
{
border: 2px solid red;
width: 600px;
height: 800px;
margin: 1em;
}
/* Texte où faire apparaître la grille. */
a#ici
{
text-decoration: none;
}
a#ici:hover
{
text-decoration: underline;
}
/* Grille effective. */
div#grille
{
width: 50%;
height: auto;
border: 2px dotted yellow;
line-height:0.8em;
display: none;
}

116
Web/Pentis/main.js Normal file
View file

@ -0,0 +1,116 @@
#!/bin/env node
var http = require('http');
var url = require('url');
var fs = require('fs');
var console = require('console');
console.log('Bonjour.');
function deployment(req, res)//À déployer.
{
var myURL = url.parse(req.url, true);//URL récupéré.
var name = myURL.query.name;//Option 'name'.
console.log('Début.');
console.log("L'adresse est\' "+req.url+" \'avec "+myURL.pathname+" pour chemin.");
/* Contrôle des pages. */
var uRLTest = (myURL.pathname !== "/Pentis.html") &&//Page principale.
(myURL.pathname !== "/Pentis.js") &&//JS principal.
(myURL.pathname !== "/Pentis_sombre.css") &&//CSS sombre.
(myURL.pathname !== "/Pentis_clair.css") &&//CSS clair.
(myURL.pathname !== "/Pentis_icone.svg") &&//Icone de page.
(myURL.pathname !== "/Pentis_404.md") &&//MD 404.
(myURL.pathname !== "/");//Racine.
function callback(err, data)
{
if(err)
{
console.error("Illisible ou inexistant!",err);
res.writeHead(302, {'Location': '/Pentis_404.md'});
res.end();
}
res.end(data);
}
if(uRLTest)//Page absente.
{
res.writeHead(302, {'Location': '/Pentis_404.md'});
res.end();
console.log("Adresse modifiée : /Pentis_404.md");
}
if (myURL.pathname === "/Pentis_sombre.css")//Si on demande le CSS.
{
console.log('Début CSS sombre.');
res.writeHead(200, {'Content-type' : 'text/css;charset=UTF-8', 'Content-Language': 'fr-FR, fr'});
fs.readFile("Pentis_sombre.css", 'utf8', callback);
console.log('CSS sombre envoyé.');
}
if (myURL.pathname === "/Pentis_clair.css")//Si on demande le CSS.
{
console.log('Début CSS clair.');
res.writeHead(200, {'Content-type' : 'text/css;charset=UTF-8', 'Content-Language': 'fr-FR, fr'});
fs.readFile("Pentis_clair.css", 'utf8', callback);
console.log('CSS clair envoyé.');
}
if (myURL.pathname === "/Pentis.js")//Si on demande le JS.
{
console.log('Début JS.');
res.writeHead(200, {'Content-type' : 'application/javascript;charset=UTF-8', 'Content-Language': 'fr-FR, fr'});
fs.readFile("Pentis.js", 'utf8', callback);
console.log('JS envoyé.');
}
if (myURL.pathname === "/Pentis_icone.svg")//Si on demande l'icone SVG.
{
console.log('Début icone-SVG.');
res.writeHead(200, {'Content-type' : 'image/svg+xml;charset=UTF-8', 'Content-Language': 'fr-FR, fr'});
fs.readFile("Pentis_icone.svg", 'utf8', callback);
console.log('icone-SVG envoyé.');
}
if(myURL.pathname === "/")//Redirection (alias) vers HTML.
{
res.writeHead(302, {'Location': '/Pentis.html'});
res.end();
console.log("Adresse modifiée : /Pentis.html");
}
if(myURL.pathname === "/Pentis.html")//Si on demande le HTML.
{
console.log('Début HTML.');
res.writeHead(200, {'Content-Type': 'text/html;charset=UTF-8', 'Content-Language': 'fr-FR, fr'});
fs.readFile('Pentis.html', 'utf8', callback);
console.log('HTML envoyé.');
console.log("----------res");
for(let item in res.headers)
{
console.log(item + ": " + res.headers[item]);
}
console.log("----------req");
for(let item in req.headers)
{
console.log(item + ": " + req.headers[item]);
}
console.log("----------\nRequête début:\n"+req.rawHeaders+"\nRequête fin\n----------");
console.log("----------\nRéponse début:\n"+res.rawHeaders+"\nRéponse fin\n----------");
}
if(myURL.pathname === "/Pentis_404.md")//Si on demande le MD 404.
{
console.log('Début MD 404.');
res.writeHead(200, {'Content-Type': 'text/markdown;charset=UTF-8, text/plain;charset=UTF-8', 'Content-Language': 'fr-FR, fr'});
fs.readFile('Pentis_404.md', 'utf8', callback);
console.log('MD 404 envoyé.');
}
console.log('Fin.');
}
var server = http.createServer(deployment);//Objet serveur à déployer.
var listener = server.listen(1337, '127.0.0.1');//Sur écoute.
console.log('Server running at http://127.0.0.1:1337/');
var opt = {
host: '127.0.0.1',
port: '1337',
path: '/Pentis.html'};
function lecture(res)
{
console.log('--En-tête de réponse HTTP (HTML)--');
for(var item in res.headers)
{
console.log(item + ": " + res.headers[item]);
}
console.log('----');
}
http.get(opt, lecture);