From 3ba082323e19bdbcaa589743e6d6c69256b41633 Mon Sep 17 00:00:00 2001 From: Herwin Date: Fri, 15 Apr 2022 22:19:39 +0200 Subject: [PATCH] Improved content renderer, Added lscom links, Fixed CSS rules Update content.php, strings.json, and 5 more files... --- commons/content.php | 155 +++++++++++--- commons/strings.json | 5 + content/index.json | 2 +- content/index.php | 2 +- content/items/lscom-cli.json | 276 ++++++++++++++++++++++++- resources/Azias/css/nibblepoker.lu.css | 4 +- sitemap.txt | 3 + 7 files changed, 407 insertions(+), 40 deletions(-) diff --git a/commons/content.php b/commons/content.php index 4942e12..e7ee4a0 100644 --- a/commons/content.php +++ b/commons/content.php @@ -122,10 +122,9 @@ $content_error_message = localize($content_error_message_key); // These functions are placed here to prevent the main file from becoming impossible to read. function startMainCard($iconClasses, $title, $subTitle) { echo('
'); - echo('

'); - echo('  '.localize($title).'

'); - echo('

'.$subTitle.'

'); - echo('
'); + echo('

  '.localize($title)); + echo(''.$subTitle.'

'); + echo('
'); } function endMainCard() { @@ -178,43 +177,143 @@ function createElementNode(mixed $elementNode) : void { } switch($elementNode["type"]) { + case "container": + // Grabbing the global padding. + $_containerPadding = "10"; + if(array_key_exists("padding", $elementNode)) { + $_containerPadding = $elementNode["padding"]; + } + + // Reading and processing the modifiers. + $_modNoTopMargin = false; + $_modNoTopPadding = false; + $_modNoSizePadding = false; + if(array_key_exists("modifiers", $elementNode)) { + for ($i = 0; $i < count($elementNode["modifiers"]); $i++) { + switch($elementNode["modifiers"][$i]) { + case "no-top-margin": + $_modNoTopMargin = true; + break; + case "no-top-padding": + $_modNoTopPadding = true; + break; + case "no-side-padding": + $_modNoSizePadding = true; + break; + } + } + } + + // Opening container. + echo('
'); + + // Adding content. + if(array_key_exists("content", $elementNode)) { + if (array_key_exists("parts", $elementNode["content"])) { + for ($iPart = 0; $iPart < count($elementNode["content"]["parts"]); $iPart++) { + createElementNode($elementNode["content"]["parts"][$iPart]); + } + } else { + echo(getContentItemText($elementNode["content"], false, true)); + } + } + + // Closing container. + echo('
'); + + break; + case "button": + // Reading and processing the modifiers. + $_modRawStyle = false; + $_modThinStyle = false; + $_modThickStyle = false; + $_modRoundShape = false; + $_modCircleShape = false; + if(array_key_exists("modifiers", $elementNode)) { + for ($i = 0; $i < count($elementNode["modifiers"]); $i++) { + switch($elementNode["modifiers"][$i]) { + case "raw": + $_modRawStyle = true; + break; + case "thin": + $_modThinStyle = true; + break; + case "thick": + $_modThickStyle = true; + break; + case "rounded": + $_modRoundShape = true; + break; + case "circle": + $_modCircleShape = true; + break; + } + } + } + + // Adding link if needed. + if(array_key_exists("link", $elementNode)) { + echo(''); + } + + // Opening button. + echo(''); + + // Adding content. + if(array_key_exists("content", $elementNode)) { + if (array_key_exists("parts", $elementNode["content"])) { + for ($iPart = 0; $iPart < count($elementNode["content"]["parts"]); $iPart++) { + createElementNode($elementNode["content"]["parts"][$iPart]); + } + } else { + echo(getContentItemText($elementNode["content"], false, true)); + } + } + + // Closing button. + echo(''); + if(array_key_exists("link", $elementNode)) { + echo(''); + } + + break; case "table": - //printInfoTextElement('table item type'); - - // Reading and processing the modifiers + // Reading and processing the modifiers. $_modNoOuterPadding = false; $_modStriped = false; $_modHover = false; $_modInnerBordered = false; if(array_key_exists("modifiers", $elementNode)) { for ($i = 0; $i < count($elementNode["modifiers"]); $i++) { - //printInfoTextElement('>> Modifier: '.$elementNode["modifiers"][$i]); switch($elementNode["modifiers"][$i]) { case "no-outer-padding": - // Removes the rounding on the external edges. $_modNoOuterPadding = true; break; case "striped": - // Removes the internal padding and adds 0.01em to the top to prevent gaps from margins. $_modStriped = true; break; case "hover": - // Removes the standard top margin. $_modHover = true; break; case "inner-bordered": - // Removes the standard top margin. $_modInnerBordered = true; break; } } } - // Preparing table + // Preparing table. echo(''); - // Creating "thead" + // Creating "thead". if(array_key_exists("head", $elementNode)) { echo(''); for ($iTableHead = 0; $iTableHead < count($elementNode["head"]); $iTableHead++) { @@ -231,7 +330,7 @@ function createElementNode(mixed $elementNode) : void { echo(''); } - // Creating "tbody" + // Creating "tbody". if(array_key_exists("body", $elementNode)) { echo(''); for ($iTableBodyRow = 0; $iTableBodyRow < count($elementNode["body"]); $iTableBodyRow++) { @@ -261,14 +360,12 @@ function createElementNode(mixed $elementNode) : void { echo(''); } - // Ending table + // Ending table. echo('
'); break; case "collapse": - //printInfoTextElement('collapse item type'); - - // Preparing some stuff + // Preparing some stuff. $_title = ''.localize("error.content.data.no.title").''; $_subtitle = ''; if(array_key_exists("title", $elementNode)) { @@ -277,17 +374,14 @@ function createElementNode(mixed $elementNode) : void { if(array_key_exists("subtitle", $elementNode)) { $_subtitle = getContentItemText($elementNode["subtitle"], true, true); } - //printInfoTextElement('> title: "'.$_title); - //printInfoTextElement('> subtitle: "'.$_subtitle); - // Reading and processing the modifiers + // Reading and processing the modifiers. $_modNoRounding = false; $_modNoContentPadding = false; $_modNoTopMargin = false; $_modIsClosed = false; if(array_key_exists("modifiers", $elementNode)) { for ($i = 0; $i < count($elementNode["modifiers"]); $i++) { - //printInfoTextElement('>> Modifier: '.$elementNode["modifiers"][$i]); switch($elementNode["modifiers"][$i]) { case "no-rounding": // Removes the rounding on the external edges. @@ -309,28 +403,25 @@ function createElementNode(mixed $elementNode) : void { } } - // Starting the collapse - echo('
'); + // Starting the collapse. + echo('
'); echo(''); - echo('

'); - echo(''); + echo('

'); + echo(''); echo('  '.$_title.''.$_subtitle.''); echo('

'); - // Rendering sub-elements + // Rendering sub-elements. if(array_key_exists("parts", $elementNode)) { - //printInfoTextElement('> Processing sub-parts'); for ($i = 0; $i < count($elementNode["parts"]); $i++) { createElementNode($elementNode["parts"][$i]); } - //printInfoTextElement('> Done processing sub-parts'); } else { printErrorTextElement(localize("error.content.data.no.subpart")); } - // Ending the collapse + // Ending the collapse. echo('
'); - //printInfoTextElement('end of collapse'); break; default: diff --git a/commons/strings.json b/commons/strings.json index a8d5f15..7706fef 100644 --- a/commons/strings.json +++ b/commons/strings.json @@ -34,6 +34,9 @@ "lang.english": "English", "lang.french": "French", "lang.luxembourgish": "Luxembourgish", + "lang.english.639-3": "English (eng)", + "lang.french.639-3": "French (fra)", + "lang.luxembourgish.639-3": "Luxembourgish (ltz)", "privacy.title": "Privacy policy", "privacy.description": "Our privacy policy in a clear and easy to understand format.", "privacy.introduction.title": "Introduction", @@ -133,6 +136,7 @@ "content.commons.lang": "Language", "content.commons.download.single": "Download", "content.commons.download.multiple": "Downloads", + "content.commons.version": "Version", "about.biography.title": "Who am I ?", "about.philosophy.title": "Projects philosophy", @@ -278,6 +282,7 @@ "content.commons.lang": "Langue", "content.commons.download.single": "Téléchargement", "content.commons.download.multiple": "Téléchargements", + "content.commons.version": "Version", "about.biography.title": "Qui suis-je ?", "about.philosophy.title": "Philosophie des projets", diff --git a/content/index.json b/content/index.json index 5a0aaa4..3426268 100644 --- a/content/index.json +++ b/content/index.json @@ -36,7 +36,7 @@ "fr": "Excel-Worksheet-Password-Remover" }, "preamble": { - "en": "Small web page from which you can easily remove a password from an Excel worksheet without uploading any file, directly in your browser.
It works by leaving the task of editing the XML files on an Excel document to your browser instead to keep everything local.", + "en": "Small web page from which you can easily remove a password from an Excel worksheet without a central server.
It works by leaving the task of editing the XML files on an Excel document to your browser instead to keep everything local.", "fr": "Petite application web qui permet de facilement retirer le mot de passe d'une feuille de calcul Excel depuis votre navigateur web sans avoir à uploader le fichier sur internet.
Cette application laisse votre navigateur modifier les fichiers XML du fichier Excel afin de tout garder en local." }, "image": "/resources/Azias/imgs/excel-password-remover.png", diff --git a/content/index.php b/content/index.php index 36fb829..38809e7 100644 --- a/content/index.php +++ b/content/index.php @@ -213,7 +213,7 @@ if($content_has_error) { startMainCard($_title_icon, $_title_text_main, (is_null($_title_text_sub) ? "" : $_title_text_sub)); // Opening the content container. - echo('
'); + echo('
'); // Adding elements defined in the JSON file. if(array_key_exists("parts", $requested_item_data)) { diff --git a/content/items/lscom-cli.json b/content/items/lscom-cli.json index a84b212..c8450fa 100644 --- a/content/items/lscom-cli.json +++ b/content/items/lscom-cli.json @@ -17,6 +17,13 @@ } }, "parts": [ + { + "type": "container", + "modifiers": [], + "content": { + "key": "lang.english" + } + }, { "type": "collapse", "title": { @@ -58,7 +65,18 @@ "key": "lang.english" }, { - "en": "URL here" + "parts": [ + { + "type": "button", + "link": "https://files.nibblepoker.lu/downloads/PB-ListComPort/2.1.0/lscom_eng_x64.exe", + "modifiers": [ + "thin" + ], + "content": { + "en": "lscom_eng_x64.exe" + } + } + ] } ], [ @@ -66,7 +84,18 @@ "key": "lang.french" }, { - "en": "URL here" + "parts": [ + { + "type": "button", + "link": "https://files.nibblepoker.lu/downloads/PB-ListComPort/2.1.0/lscom_fra_x64.exe", + "modifiers": [ + "thin" + ], + "content": { + "en": "lscom_fra_x64.exe" + } + } + ] } ], [ @@ -78,7 +107,18 @@ "key": "lang.english" }, { - "en": "URL here" + "parts": [ + { + "type": "button", + "link": "https://files.nibblepoker.lu/downloads/PB-ListComPort/2.1.0/lscom_fra_x86.exe", + "modifiers": [ + "thin" + ], + "content": { + "en": "lscom_fra_x86.exe" + } + } + ] } ], [ @@ -86,7 +126,235 @@ "key": "lang.french" }, { - "en": "URL here" + "parts": [ + { + "type": "button", + "link": "https://files.nibblepoker.lu/downloads/PB-ListComPort/2.1.0/lscom_fra_x86.exe", + "modifiers": [ + "thin" + ], + "content": { + "en": "lscom_fra_x86.exe" + } + } + ] + } + ] + ] + } + ] + }, + { + "type": "collapse", + "title": { + "key": "content.commons.version.previous.multiple" + }, + "modifiers": [ + "no-rounding", + "no-padding-content", + "no-top-margin", + "closed" + ], + "parts": [ + { + "type": "table", + "modifiers": [ + "striped", + "inner-bordered" + ], + "head": [ + { + "key": "content.commons.version" + }, + { + "key": "content.commons.cpu" + }, + { + "key": "content.commons.lang" + }, + { + "key": "content.commons.download.single" + } + ], + "body": [ + [ + { + "en": "v2.0.0", + "rowspan": 4 + }, + { + "key": "content.commons.cpu.x64", + "rowspan": 2 + }, + { + "key": "lang.english" + }, + { + "parts": [ + { + "type": "button", + "link": "https://files.nibblepoker.lu/downloads/PB-ListComPort/2.0.0/lscom_eng_x64.exe", + "modifiers": [ + "thin" + ], + "content": { + "en": "lscom_eng_x64.exe" + } + } + ] + } + ], + [ + { + "key": "lang.french" + }, + { + "parts": [ + { + "type": "button", + "link": "https://files.nibblepoker.lu/downloads/PB-ListComPort/2.0.0/lscom_fra_x64.exe", + "modifiers": [ + "thin" + ], + "content": { + "en": "lscom_fra_x64.exe" + } + } + ] + } + ], + [ + { + "key": "content.commons.cpu.x86", + "rowspan": 2 + }, + { + "key": "lang.english" + }, + { + "parts": [ + { + "type": "button", + "link": "https://files.nibblepoker.lu/downloads/PB-ListComPort/2.0.0/lscom_fra_x86.exe", + "modifiers": [ + "thin" + ], + "content": { + "en": "lscom_fra_x86.exe" + } + } + ] + } + ], + [ + { + "key": "lang.french" + }, + { + "parts": [ + { + "type": "button", + "link": "https://files.nibblepoker.lu/downloads/PB-ListComPort/2.0.0/lscom_fra_x86.exe", + "modifiers": [ + "thin" + ], + "content": { + "en": "lscom_fra_x86.exe" + } + } + ] + } + ], + [ + { + "en": "v1.1.0", + "rowspan": 2 + }, + { + "key": "content.commons.cpu.x64" + }, + { + "key": "lang.english", + "rowspan": 2 + }, + { + "parts": [ + { + "type": "button", + "link": "https://files.nibblepoker.lu/downloads/PB-ListComPort/1.1.0/lscom-x64.exe", + "modifiers": [ + "thin" + ], + "content": { + "en": "lscom-x64.exe" + } + } + ] + } + ], + [ + { + "key": "content.commons.cpu.x86" + }, + { + "parts": [ + { + "type": "button", + "link": "https://files.nibblepoker.lu/downloads/PB-ListComPort/1.1.0/lscom-x86.exe", + "modifiers": [ + "thin" + ], + "content": { + "en": "lscom-x86.exe" + } + } + ] + } + ], + [ + { + "en": "v1.0.0", + "rowspan": 2 + }, + { + "key": "content.commons.cpu.x64" + }, + { + "key": "lang.english", + "rowspan": 2 + }, + { + "parts": [ + { + "type": "button", + "link": "https://files.nibblepoker.lu/downloads/PB-ListComPort/1.0.0/lscom-x64.exe", + "modifiers": [ + "thin" + ], + "content": { + "en": "lscom-x64.exe" + } + } + ] + } + ], + [ + { + "key": "content.commons.cpu.x86" + }, + { + "parts": [ + { + "type": "button", + "link": "https://files.nibblepoker.lu/downloads/PB-ListComPort/1.0.0/lscom-x86.exe", + "modifiers": [ + "thin" + ], + "content": { + "en": "lscom-x86.exe" + } + } + ] } ] ] diff --git a/resources/Azias/css/nibblepoker.lu.css b/resources/Azias/css/nibblepoker.lu.css index 9170282..a8c2f87 100644 --- a/resources/Azias/css/nibblepoker.lu.css +++ b/resources/Azias/css/nibblepoker.lu.css @@ -61,8 +61,8 @@ img.no-save { align-items: stretch; } .py-01 { - padding-top: 0.01rem!important; - padding-bottom: 0.01rem!important; + padding-top: 0.01rem; + padding-bottom: 0.01rem; } /* Unique rules */ diff --git a/sitemap.txt b/sitemap.txt index 3e63bac..af94445 100644 --- a/sitemap.txt +++ b/sitemap.txt @@ -1,17 +1,20 @@ https://nibblepoker.lu/ https://nibblepoker.lu/content/ +https://nibblepoker.lu/content/lscom-cli https://nibblepoker.lu/links/ https://nibblepoker.lu/about/ https://nibblepoker.lu/contact/ https://nibblepoker.lu/privacy/ https://nibblepoker.lu/en/ https://nibblepoker.lu/en/content/ +https://nibblepoker.lu/en/content/lscom-cli https://nibblepoker.lu/en/links/ https://nibblepoker.lu/en/about/ https://nibblepoker.lu/en/contact/ https://nibblepoker.lu/en/privacy/ https://nibblepoker.lu/fr/ https://nibblepoker.lu/fr/content/ +https://nibblepoker.lu/fr/content/lscom-cli https://nibblepoker.lu/fr/links/ https://nibblepoker.lu/fr/about/ https://nibblepoker.lu/fr/contact/