Finished updating content to new style, Updated heading styles, Added backgrounds

Update scripts.php, sidebar.php, and 24 more files...
This commit is contained in:
2023-05-24 03:46:43 +02:00
parent b1f11e122d
commit 3cadb29be5
26 changed files with 822 additions and 912 deletions

View File

@@ -4,15 +4,15 @@ if(basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
header('HTTP/1.1 403 Forbidden');
die();
}
?>
<script src="/resources/NibblePoker/js/nibblepoker.min.js"></script>
<?php
if($enable_glider) {
echo('<script src="/resources/GliderJs/1.7.6/glider.min.js"></script>');
}
if($enable_code_highlight) {
echo('<script src="/resources/HighlightJS/11.6.0/highlight.min.js"></script>');
echo('<script src="/resources/HighlightJS/11.6.0/languages/csharp.min.js"></script>');
//echo('<script src="/resources/Azias/js/code-highlighter.js"></script>');
}
?>
?>
<script src="/resources/NibblePoker/js/nibblepoker.min.js"></script>

View File

@@ -12,7 +12,7 @@ if(!isset($SIDEBAR_ID)) {
}
function printSidebarEntry($url, $title, $icon) {
echo('<a class="bland-link" href="' . $url . '"><p class="t-size-18 t-w-500 py-xs sidebar-entry">');
echo('<a class="bland-link" href="' . $url . '" title="HTML5 anchor element"><p class="t-size-18 t-w-500 py-xs sidebar-entry">');
echo('<i class="' . $icon . ' pr-xs t-size-12"></i><span class="t-size-12">' . $title . '</span></p></a>');
}

View File

@@ -9,7 +9,8 @@ if (basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
$_npDomUtilsHeadingCount = 0;
function getMainHeader(string $text, ?string $iconId = null, ?string $rightText = null, ?string $anchorId = null,
bool $addTopMargin = true, ?string $backgroundClass = "bkgd-grid", int $hLevel = 2): string {
bool $addTopMargin = true, ?string $backgroundClass = "bkgd-grid", int $hLevel = 2,
bool $autoWidth = false, bool $chungusMode = false, bool $makeSmaller = false): string {
if(is_null($backgroundClass)) {
$backgroundClass = "bkgd-grid";
}
@@ -21,17 +22,18 @@ function getMainHeader(string $text, ?string $iconId = null, ?string $rightText
}
$htmlCode .= '<div class="heading-main p-xs border r-s ' . ($addTopMargin > 0 ? "mt-l " : "") . $backgroundClass .
'"><h' . $hLevel . ' class="t-w-500 t-size-14">';
($autoWidth ? " d-inline-block" : "") . '"><h' . $hLevel . ' class="t-w-500 ' .
($chungusMode ? "t-size-16" : ($makeSmaller ? "t-size-11" : "t-size-14")) . '">';
// TODO: Add a simple and nicer divider.
if(!is_null($iconId)) {
$htmlCode .= '<i class="' . $iconId . ' t-size-12 t-muted"></i>';
$htmlCode .= '<i class="' . $iconId . ' t-muted ' . ($chungusMode ? "t-size-14" : "t-size-12") . '"></i>';
}
$htmlCode .= $text;
if(!is_null($rightText)) {
$htmlCode .= '<span class="ml-auto t-muted t-size-10">' . $rightText . '</span>';
$htmlCode .= '<span class="ml-auto ' . ($chungusMode ? "t-size-12 mr-xs" : "t-size-10 t-muted") . '">' . $rightText . '</span>';
}
$htmlCode .= '</h' . $hLevel . '></div>';

View File

@@ -85,6 +85,10 @@ abstract class ComposerElementModifiers {
const GENERIC_PADDING_NO_Y = ["py-0", "py-0"];
const GENERIC_PADDING_NONE = ["p-0" , "p-0" ];
// Generic > Others
const GENERIC_FULL_WIDTH = ["w-full", "w-full"];
const GENERIC_BOLD = ["bold", "f-w-500"];
// Containers
const CONTAINER_SCROLL_HORIZONTAL = ["horizontal-scroll", "overflow-x-scroll hide-scrollbar"];
const CONTAINER_CARD = ["card", "card"];
@@ -109,6 +113,8 @@ abstract class ComposerElementModifiers {
const TABLE_HOVER = ["hover", "table-hover"];
const TABLE_INNER_BORDER = ["inner-bordered", "table-inner-bordered"];
const TABLE_OUTER_BORDER = ["outer-bordered", "table-outer-bordered"];
const TABLE_V2_STYLISH = ["stylish", "stylish"];
const TABLE_V2_CELL_PADDING = ["auto-cell-padding", "table-p-xs"];
// Code
const CODE_BLOCK = ["code-block", "w-full d-inline-block"];
@@ -320,8 +326,12 @@ class ComposerContentMetadata {
$this->article->icon,
localize_private($this->article->subtitle, $content_root->strings, false),
null,
false
) . $inner_html;
false,
null,
3,
false,
true
) . '<div class="px-xxs">' . $inner_html . '</div>';
// Appending the tags if any are present
if(sizeof($this->article->tags) > 0) {
@@ -461,10 +471,14 @@ class ComposerElement {
// Galleries parameters
private array $images;
// Screen readers parameters
private ?string $srTitle;
function __construct(string $type, ?array $modifiers, ?string $link, ?array $parts, ?string $content,
bool $localize, ?int $padding, ?int $margin, ?int $size, ?array $head, ?array $body,
int $colspan, int $rowspan, ?int $indent, ?array $code, ?string $codeLanguage,
bool $codeCopyable, ?string $color, ?string $source, ?string $thumbnail, ?array $images) {
bool $codeCopyable, ?string $color, ?string $source, ?string $thumbnail, ?array $images,
?string $srTitle) {
$this->type = $type;
$this->modifiers = $modifiers;
$this->link = $link;
@@ -497,6 +511,7 @@ class ComposerElement {
} else {
$this->images = $images;
}
$this->srTitle = $srTitle;
}
static function from_json_array(?array $json_dataArray) : array {
@@ -532,6 +547,7 @@ class ComposerElement {
key_exists("source", $json_data) ? $json_data["source"] : null,
key_exists("thumbnail", $json_data) ? $json_data["thumbnail"] : null,
key_exists("images", $json_data) ? $json_data["images"] : null,
key_exists("sr_title", $json_data) ? $json_data["sr_title"] : null,
);
}
@@ -627,9 +643,10 @@ class ComposerElement {
public function get_html(ComposerContent $content_root) : string {
$htmlCode = "";
// Setting up the link and its title if needed.
if(!is_null($this->link)) {
$htmlCode .= '<a href="' . $this->link . '"' .
($this->type == ComposerElementTypes::BUTTON ? 'class="button-link"' : '') . '>';
($this->type == ComposerElementTypes::BUTTON ? 'class="button-link"' : '') .'>';
}
switch($this->type) {
@@ -649,8 +666,11 @@ class ComposerElement {
null,
!ComposerElementModifiers::is_modifier_in_modifiers(
ComposerElementModifiers::GENERIC_MARGIN_NO_TOP, $this->modifiers),
null,
3
"bkgd-math", // heading-dyn-width-1
3,
false,
false,
true
);
break;
@@ -688,6 +708,16 @@ class ComposerElement {
$_paragraph_margin_modifier = 'mt-xs ';
}
// Adding other tags manually
// FIXME: Use the standard functions FFS...
$_paragraph_margin_modifier .= (
ComposerElementModifiers::is_modifier_in_modifiers(
ComposerElementModifiers::GENERIC_BOLD, $this->modifiers)
) ? "t-w-500 " : "";
// Fixes some "overflowing" issue when indent is bigger than 2.
$_paragraph_margin_modifier .= "mr-s ";
// Composing the paragraph
$htmlCode .= '<p class="' . $_paragraph_margin_modifier . $_paragraph_ident_level .
'">' . $this->get_inner_html($content_root) . '</p>';
@@ -811,7 +841,7 @@ class ComposerElement {
case ComposerElementTypes::TABLE:
// Composing table.
$htmlCode .= '<table class="table ' . $this->get_modifiers_classes() . '">';
$htmlCode .= '<table class="' . $this->get_modifiers_classes() . '">';
if(!is_null($this->head)) {
$htmlCode .= '<thead><tr>';

File diff suppressed because one or more lines are too long

View File

@@ -60,5 +60,12 @@
"content.commons.github": "GitHub Repository",
"content.commons.gitea": "Self-hosted Gitea Repository",
"content.commons.nuget": "Nuget Package",
"content.commons.license.mit.single": "MIT License"
"content.commons.license.mit.single": "MIT License",
"content.commons.lang.english": "English",
"content.commons.lang.french": "French",
"content.commons.lang.luxembourgish": "Luxembourgish",
"content.commons.lang.english.639-3": "English (eng)",
"content.commons.lang.french.639-3": "French (fra)",
"content.commons.lang.luxembourgish.639-3": "Luxembourgish (ltz)"
}

View File

@@ -59,5 +59,12 @@
"content.commons.github": "Dépôt GitHub",
"content.commons.gitea": "Dépôt Gitea auto-hébergé",
"content.commons.nuget": "Packet Nuget",
"content.commons.license.mit.single": "License MIT"
"content.commons.license.mit.single": "License MIT",
"content.commons.lang.english": "Anglais",
"content.commons.lang.french": "Français",
"content.commons.lang.luxembourgish": "Luxembourgeois",
"content.commons.lang.english.639-3": "Anglais (eng)",
"content.commons.lang.french.639-3": "Français (fra)",
"content.commons.lang.luxembourgish.639-3": "Luxembourgeois (ltz)"
}