From fca4deb8c977f4a04bff7f8bee60870f67169660 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Tue, 11 May 2021 17:56:30 +0200 Subject: [PATCH] Add Google Fonts and Dark Mode --- bl-kernel/page.class.php | 25 +++-- .../popeye/css/{style.css => 01-style.css} | 49 +++++++++- .../css/{helpers.css => 02-helpers.css} | 6 +- bl-themes/popeye/css/99-darkmode.css | 39 ++++++++ bl-themes/popeye/index.php | 20 +++- bl-themes/popeye/init.php | 4 + bl-themes/popeye/php/footer.php | 9 +- bl-themes/popeye/php/home.php | 92 +++++++++++-------- bl-themes/popeye/php/navbar.php | 7 +- bl-themes/popeye/php/page.php | 60 ++++++++++-- 10 files changed, 243 insertions(+), 68 deletions(-) rename bl-themes/popeye/css/{style.css => 01-style.css} (57%) rename bl-themes/popeye/css/{helpers.css => 02-helpers.css} (76%) create mode 100644 bl-themes/popeye/css/99-darkmode.css create mode 100644 bl-themes/popeye/init.php diff --git a/bl-kernel/page.class.php b/bl-kernel/page.class.php index bfc0fa98..76f278fc 100644 --- a/bl-kernel/page.class.php +++ b/bl-kernel/page.class.php @@ -537,10 +537,11 @@ class Page { return $list; } - // Returns the amount of minutes takes to read the page - public function readingTime() { - global $L; + /* Returns the amount of minutes takes to read the page === Bludit v4 + @return string Returns the minutes as string + */ + public function readingTime() { $words = $this->content(true); $words = strip_tags($words); $words = str_word_count($words); @@ -548,10 +549,9 @@ class Page { $minutes = round($average); if ($minutes>1) { - return $minutes.' '.$L->get('minutes'); + return $minutes; } - - return '~1 '.$L->get('minute'); + return '~1'; } // Returns the value from the field, false if the fields doesn't exists @@ -571,9 +571,10 @@ class Page { The relation is based on the tags. @sortByDate boolean TRUE if you want to get sort by date the pages, FALSE random order + @getFirst int Amount of related pages, -1 indicates all related pages @return array Returns an array with the page keys related to page */ - public function related($sortByDate=false) { + public function related($sortByDate=false, $getFirst=-1) { global $tags; $pageTags = $this->tags(true); $list = array(); @@ -596,13 +597,17 @@ class Page { $listSortByDate = array(); foreach ($list as $pageKey) { $tmpPage = new Page($pageKey); - $listSortByDate[$tmpPage->date('U')] = new Page($pageKey); + $listSortByDate[$tmpPage->date('U')] = $pageKey; } krsort($listSortByDate); - return $listSortByDate; + $list = $listSortByDate; } - return $list; + if ($getFirst==-1) { + return $list; + } else { + return array_slice($list, 0, $getFirst); + } } /* Returns relative time (e.g. "1 minute ago") === Bludit v4 diff --git a/bl-themes/popeye/css/style.css b/bl-themes/popeye/css/01-style.css similarity index 57% rename from bl-themes/popeye/css/style.css rename to bl-themes/popeye/css/01-style.css index 3170c372..ba8cc319 100755 --- a/bl-themes/popeye/css/style.css +++ b/bl-themes/popeye/css/01-style.css @@ -32,9 +32,23 @@ pre { border-radius: 5px !important; } +/* BOOTSTRAP */ +.list-group-item { + background-color: inherit; +} + +.badge { + font-size: 0.8rem; + font-weight: 400; +} + +.bi { + margin-right: .5rem!important; +} + /* PAGE */ -section.page h1.title { - font-size: 2rem; +section.page { + font-size: 1.1rem; } section.page .description { @@ -45,6 +59,37 @@ section.page a { color: #0a58ca; } +section.page p { + margin-bottom: 1.2rem; +} + +section.page h1.page-title { + font-size: 2rem; +} + +section.page h2 { + font-size: 1.5rem; +} + +section.page h3 { + font-size: 1.3rem; +} + +section.page h4 { + font-size: 1.1rem; +} + +section.page h5 { + font-size: 1rem; +} + +section.page h2, +section.page h3, +section.page h4, +section.page h5 { + margin: 2rem 0 1rem 0; +} + /* VIDEO EMBED RESPONSIVE */ .video-embed { overflow:hidden; diff --git a/bl-themes/popeye/css/helpers.css b/bl-themes/popeye/css/02-helpers.css similarity index 76% rename from bl-themes/popeye/css/helpers.css rename to bl-themes/popeye/css/02-helpers.css index 0bce3543..4f465395 100644 --- a/bl-themes/popeye/css/helpers.css +++ b/bl-themes/popeye/css/02-helpers.css @@ -13,4 +13,8 @@ .italic { font-style: italic; -} \ No newline at end of file +} + +.bg-gray { + background-color: #ececec; +} diff --git a/bl-themes/popeye/css/99-darkmode.css b/bl-themes/popeye/css/99-darkmode.css new file mode 100644 index 00000000..7c73eb99 --- /dev/null +++ b/bl-themes/popeye/css/99-darkmode.css @@ -0,0 +1,39 @@ +body { + background-color: #1C1C1E !important; + color: #ddd !important; +} + +a { + color: #fff !important; +} + +a:hover { + color: #e2e2e2 !important +} + +a.badge:hover { + color: #999 !important; +} + +.form-text { + color: #989899 !important; +} + +.bg-light { + background-color: #000 !important; +} + +.color-blue { + color: #688bbd !important; +} + +.btn-outline-primary { + color: #688bbd !important; + border-color: #688bbd !important; +} + +.page-link { + color: #688bbd !important; + border-color: #688bbd !important; + background-color: #1C1C1E !important; +} \ No newline at end of file diff --git a/bl-themes/popeye/index.php b/bl-themes/popeye/index.php index 23489286..ee13ab80 100755 --- a/bl-themes/popeye/index.php +++ b/bl-themes/popeye/index.php @@ -21,7 +21,25 @@ - + + + + + + diff --git a/bl-themes/popeye/init.php b/bl-themes/popeye/init.php new file mode 100644 index 00000000..0ea95010 --- /dev/null +++ b/bl-themes/popeye/init.php @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/bl-themes/popeye/php/home.php b/bl-themes/popeye/php/home.php index ddb27014..f261adc7 100644 --- a/bl-themes/popeye/php/home.php +++ b/bl-themes/popeye/php/home.php @@ -1,9 +1,11 @@
+ + description()) : ?> @@ -11,6 +13,8 @@

description(); ?>

+ +
@@ -25,70 +29,84 @@
+
+ +
-
+
- + +
title() ?>
- - relativeTime() ?> + + + + relativeTime() ?> + +
- -

Some placeholder content in a paragraph.

+ + description()): ?> +

description(); ?>

+ + - + tags(true); if (!empty($tagsList)) { echo ''; foreach ($tagsList as $tagKey => $tagName) { - echo '' . $tagName . ''; + echo '' . $tagName . ''; } echo ''; } ?> + +
+ + + + 1) : ?> + + + +
- - - 1) : ?> - - \ No newline at end of file + \ No newline at end of file diff --git a/bl-themes/popeye/php/navbar.php b/bl-themes/popeye/php/navbar.php index a567f5e7..196c9767 100644 --- a/bl-themes/popeye/php/navbar.php +++ b/bl-themes/popeye/php/navbar.php @@ -1,12 +1,11 @@ -
- \ No newline at end of file + + + +related(true, 3); +?> + + + \ No newline at end of file