mirror of
https://github.com/standardebooks/web.git
synced 2025-07-12 09:32:24 -04:00
Add donation alerts during the holidays
This commit is contained in:
parent
b07f406d9f
commit
0e7100cfe8
5 changed files with 77 additions and 0 deletions
|
@ -34,6 +34,9 @@ const AVERAGE_READING_WORDS_PER_MINUTE = 275;
|
||||||
|
|
||||||
define('PD_YEAR', intval(gmdate('Y')) - 96);
|
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.
|
// No trailing slash on any of the below constants.
|
||||||
const SITE_URL = 'https://standardebooks.org';
|
const SITE_URL = 'https://standardebooks.org';
|
||||||
const SITE_ROOT = '/standardebooks.org';
|
const SITE_ROOT = '/standardebooks.org';
|
||||||
|
|
4
templates/DonationAlert.php
Normal file
4
templates/DonationAlert.php
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<aside class="donation">
|
||||||
|
<p>We rely on your support to help us keep producing beautiful, free, and unrestricted editions of literature for the digital age.</p>
|
||||||
|
<p>Will you <a href="/donate">support our efforts with a donation</a> this holiday season?</p>
|
||||||
|
</aside>
|
|
@ -1722,6 +1722,55 @@ main.ebooks nav ol li.highlighted:nth-last-child(2)::after{
|
||||||
text-align: center;
|
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 */
|
@media (hover: none) and (pointer: coarse){ /* target ipads and smartphones without a mouse */
|
||||||
/* For iPad, unset the height so it matches the other elements */
|
/* For iPad, unset the height so it matches the other elements */
|
||||||
select[multiple]{
|
select[multiple]{
|
||||||
|
@ -1997,6 +2046,11 @@ main.ebooks nav ol li.highlighted:nth-last-child(2)::after{
|
||||||
main.ebooks nav ol li.highlighted::after{
|
main.ebooks nav ol li.highlighted::after{
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aside.donation,
|
||||||
|
article.ebook section aside.donation{
|
||||||
|
text-align: justify;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media(max-width: 550px){
|
@media(max-width: 550px){
|
||||||
|
@ -2284,6 +2338,16 @@ main.ebooks nav ol li.highlighted:nth-last-child(2)::after{
|
||||||
border-color: var(--border-light);
|
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,
|
select,
|
||||||
input[type="search"]{
|
input[type="search"]{
|
||||||
box-shadow: 1px 1px 0 rgba(0, 0, 0, .5) inset;
|
box-shadow: 1px 1px 0 rgba(0, 0, 0, .5) inset;
|
||||||
|
|
|
@ -110,6 +110,9 @@ catch(\Exception $ex){
|
||||||
|
|
||||||
<section id="description">
|
<section id="description">
|
||||||
<h2>Description</h2>
|
<h2>Description</h2>
|
||||||
|
<? if(DONATION_ALERT_ON){ ?>
|
||||||
|
<?= Template::DonationAlert() ?>
|
||||||
|
<? } ?>
|
||||||
<? if($ebook->LongDescription === null){ ?>
|
<? if($ebook->LongDescription === null){ ?>
|
||||||
<p><i>There’s no description for this ebook yet.</i></p>
|
<p><i>There’s no description for this ebook yet.</i></p>
|
||||||
<? }else{ ?>
|
<? }else{ ?>
|
||||||
|
|
|
@ -129,6 +129,9 @@ catch(\Exception $ex){
|
||||||
?><?= Template::Header(['title' => $pageTitle, 'highlight' => 'ebooks', 'description' => $pageDescription]) ?>
|
?><?= Template::Header(['title' => $pageTitle, 'highlight' => 'ebooks', 'description' => $pageDescription]) ?>
|
||||||
<main class="ebooks">
|
<main class="ebooks">
|
||||||
<h1><?= $pageHeader ?></h1>
|
<h1><?= $pageHeader ?></h1>
|
||||||
|
<? if(DONATION_ALERT_ON){ ?>
|
||||||
|
<?= Template::DonationAlert() ?>
|
||||||
|
<? } ?>
|
||||||
<? if($collection === null){ ?>
|
<? if($collection === null){ ?>
|
||||||
<?= Template::SearchForm(['query' => $query, 'tags' => $tags, 'sort' => $sort, 'view' => $view, 'perPage' => $perPage]) ?>
|
<?= Template::SearchForm(['query' => $query, 'tags' => $tags, 'sort' => $sort, 'view' => $view, 'perPage' => $perPage]) ?>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue