From f0575be98fcc10ba8a7955dbda94f2afba212867 Mon Sep 17 00:00:00 2001
From: Alex Cabal
Date: Wed, 23 Jan 2019 17:46:35 -0600
Subject: [PATCH] Add DP OLS to known sources
---
lib/Constants.php | 3 ++-
lib/Ebook.php | 3 +++
www/css/core.css | 4 ++++
www/ebooks/ebook.php | 1 +
www/images/distributed-proofreaders.svg | 5 +++++
5 files changed, 15 insertions(+), 1 deletion(-)
create mode 100644 www/images/distributed-proofreaders.svg
diff --git a/lib/Constants.php b/lib/Constants.php
index bb248c7e..1d87730d 100644
--- a/lib/Constants.php
+++ b/lib/Constants.php
@@ -17,7 +17,8 @@ const SOURCE_HATHI_TRUST = 1;
const SOURCE_WIKISOURCE = 2;
const SOURCE_INTERNET_ARCHIVE = 3;
const SOURCE_GOOGLE_BOOKS = 4;
-const SOURCE_OTHER = 5;
+const SOURCE_DP_OLS = 5;
+const SOURCE_OTHER = 6;
const AVERAGE_READING_WORDS_PER_MINUTE = 275;
diff --git a/lib/Ebook.php b/lib/Ebook.php
index ed15ca4e..be4158dd 100644
--- a/lib/Ebook.php
+++ b/lib/Ebook.php
@@ -289,6 +289,9 @@ class Ebook{
elseif(mb_stripos($e, 'books.google.com/') !== false){
$this->Sources[] = new EbookSource(SOURCE_GOOGLE_BOOKS, $e);
}
+ elseif(mb_stripos($e, 'www.pgdp.org/ols/') !== false){
+ $this->Sources[] = new EbookSource(SOURCE_DP_OLS, $e);
+ }
else{
$this->Sources[] = new EbookSource(SOURCE_OTHER, $e);
}
diff --git a/www/css/core.css b/www/css/core.css
index e59a2cb1..51dac454 100644
--- a/www/css/core.css
+++ b/www/css/core.css
@@ -794,6 +794,10 @@ time{
background-image: url('/images/google.svg');
}
+.distributed-proofreaders::before{
+ background-image: url('/images/distributed-proofreaders.svg');
+}
+
article.ebook h1{
border: none;
margin: 0;
diff --git a/www/ebooks/ebook.php b/www/ebooks/ebook.php
index cb99d309..7014cee3 100644
--- a/www/ebooks/ebook.php
+++ b/www/ebooks/ebook.php
@@ -153,6 +153,7 @@ catch(\Exception $ex){
if($source->Type == SOURCE_INTERNET_ARCHIVE){ ?>Page scans at the Internet Archive } ?>
if($source->Type == SOURCE_HATHI_TRUST){ ?>Page scans at HathiTrust } ?>
if($source->Type == SOURCE_GOOGLE_BOOKS){ ?>Page scans at Google Books } ?>
+ if($source->Type == SOURCE_DP_OLS){ ?>Page scans at Distributed Proofreaders Open Library System } ?>
if($source->Type == SOURCE_OTHER){ ?>= Formatter::ToPlainText(preg_replace(['|https?://(en\.)?|', '|/.+$|'], '', $source->Url) ?? '') ?> } ?>
diff --git a/www/images/distributed-proofreaders.svg b/www/images/distributed-proofreaders.svg
new file mode 100644
index 00000000..24a26a81
--- /dev/null
+++ b/www/images/distributed-proofreaders.svg
@@ -0,0 +1,5 @@
+
+