diff --git a/lib/Constants.php b/lib/Constants.php
index b1bc184a..c3bb08eb 100644
--- a/lib/Constants.php
+++ b/lib/Constants.php
@@ -34,6 +34,9 @@ const AVERAGE_READING_WORDS_PER_MINUTE = 275;
define('PD_YEAR', intval(gmdate('Y')) - 96);
+const DONATION_ALERT_ALWAYS_ON = false;
+const DONATION_ALERT_ON_DURING_HOLIDAYS = true;
+define('DONATION_ALERT_ON', DONATION_ALERT_ALWAYS_ON | (DONATION_ALERT_ON_DURING_HOLIDAYS && (strtotime('December 1, ' . gmdate('Y')) < time() && time() < strtotime('January 7, ' . (intval(gmdate('Y') + 1))))));
// No trailing slash on any of the below constants.
const SITE_URL = 'https://standardebooks.org';
const SITE_ROOT = '/standardebooks.org';
diff --git a/templates/DonationAlert.php b/templates/DonationAlert.php
new file mode 100644
index 00000000..8fb22143
--- /dev/null
+++ b/templates/DonationAlert.php
@@ -0,0 +1,4 @@
+
diff --git a/www/css/core.css b/www/css/core.css
index 53a4c791..f79070a1 100644
--- a/www/css/core.css
+++ b/www/css/core.css
@@ -1722,6 +1722,55 @@ main.ebooks nav ol li.highlighted:nth-last-child(2)::after{
text-align: center;
}
+aside.donation,
+article.ebook section aside.donation{
+ position: relative;
+ border: 1px solid var(--body-text);
+ color: var(--body-text);
+ text-align: center;
+ padding: 2rem;
+ font-size: 1rem;
+ margin-top: 0;
+ border-radius: .25rem;
+ margin-bottom: 2rem;
+ background-color: rgba(255, 255, 255, .5);
+ font-style: italic;
+ font-size: 1.2rem;
+}
+
+aside.donation::before{
+ content: "";
+ display: block;
+ position: absolute;
+ height: calc(1rem + 2px);
+ width: calc(1rem + 2px);
+ top: 0;
+ left: 0;
+ clip-path: polygon(0% 0%, 100% 100%, 0% 100%);
+ transform: rotate(90deg);
+ border-radius: 0 0 0 .25rem;
+ background: rgba(0, 0, 0, .5);
+}
+
+aside.donation::after{
+ content: "";
+ display: block;
+ position: absolute;
+ height: 1rem;
+ width: 1rem;
+ top: 0;
+ left: 0;
+ clip-path: polygon(0% 0%, 100% 100%, 0% 100%);
+ transform: rotate(90deg);
+ border-radius: 0 0 0 .25rem;
+ background: #dda82a;
+}
+
+article.ebook section aside.donation p::before,
+article.ebook section aside.donation p::after{
+ display: none;
+}
+
@media (hover: none) and (pointer: coarse){ /* target ipads and smartphones without a mouse */
/* For iPad, unset the height so it matches the other elements */
select[multiple]{
@@ -1997,6 +2046,11 @@ main.ebooks nav ol li.highlighted:nth-last-child(2)::after{
main.ebooks nav ol li.highlighted::after{
display: none;
}
+
+ aside.donation,
+ article.ebook section aside.donation{
+ text-align: justify;
+ }
}
@media(max-width: 550px){
@@ -2284,6 +2338,16 @@ main.ebooks nav ol li.highlighted:nth-last-child(2)::after{
border-color: var(--border-light);
}
+ aside.donation,
+ article.ebook section aside.donation{
+ background: rgba(0, 0, 0, .25);
+ }
+
+ aside.donation,
+ article.ebook section aside.donation{
+ box-shadow: none;
+ }
+
select,
input[type="search"]{
box-shadow: 1px 1px 0 rgba(0, 0, 0, .5) inset;
diff --git a/www/ebooks/ebook.php b/www/ebooks/ebook.php
index f35993a8..e1294257 100644
--- a/www/ebooks/ebook.php
+++ b/www/ebooks/ebook.php
@@ -110,6 +110,9 @@ catch(\Exception $ex){
Description
+ if(DONATION_ALERT_ON){ ?>
+ = Template::DonationAlert() ?>
+ } ?>
if($ebook->LongDescription === null){ ?>
There’s no description for this ebook yet.
}else{ ?>
diff --git a/www/ebooks/index.php b/www/ebooks/index.php
index 61e19106..f0dedf10 100644
--- a/www/ebooks/index.php
+++ b/www/ebooks/index.php
@@ -129,6 +129,9 @@ catch(\Exception $ex){
?>= Template::Header(['title' => $pageTitle, 'highlight' => 'ebooks', 'description' => $pageDescription]) ?>
= $pageHeader ?>
+ if(DONATION_ALERT_ON){ ?>
+ = Template::DonationAlert() ?>
+ } ?>
if($collection === null){ ?>
= Template::SearchForm(['query' => $query, 'tags' => $tags, 'sort' => $sort, 'view' => $view, 'perPage' => $perPage]) ?>
} ?>