mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-24 04:20:56 -04:00
rewrite welcome page
This commit is contained in:
parent
2fe1a9443c
commit
1aeeaa2c3b
@ -879,26 +879,46 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
/* Compute the Welcome HTML */
|
||||
string welcomeBooksHtml;
|
||||
string welcomeBooksCss = ""
|
||||
"<style>"
|
||||
".book__list { text-align: center; }"
|
||||
".book {"
|
||||
"display: inline-block; vertical-align: bottom; margin: 10px; padding: 15px 20px; width: 300px;"
|
||||
"border: 1px solid #ccc; border-radius: 15px;"
|
||||
"text-align: left; color: #000; font-family: sans-serif; font-size: 13px;"
|
||||
"}"
|
||||
".book:hover { background-color: #eee; box-shadow: 2px 2px 5px 0px #ccc}"
|
||||
".book__background { background-repeat: no-repeat; background-size: auto; background-position: top right; }"
|
||||
".book__title { font-size: 18px; color: #0645ad; }"
|
||||
".book__description { padding: 5px 50px 5px 0px; font-size: 15px; }"
|
||||
".book__info { line-height: 18px; color: #777; font-weight: bold; font-size: 13px; }"
|
||||
"</style>";
|
||||
|
||||
string welcomeBooksHtml = ""
|
||||
"<div class='book__list'>";
|
||||
for (itr = booksIds.begin(); itr != booksIds.end(); ++itr) {
|
||||
libraryManager.getBookById(*itr, currentBook);
|
||||
|
||||
if (!currentBook.path.empty() && readers.find(currentBook.getHumanReadableIdFromPath()) != readers.end()) {
|
||||
welcomeBooksHtml += "<h3><a href=\"#\">" + currentBook.title + "</a></h3>\n \
|
||||
<table style=\"overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px;\"><tr>\n \
|
||||
<td style=\"background-repeat: no-repeat; background-image: url(data:" + currentBook.faviconMimeType+ ";base64," + currentBook.favicon + ")\"><div style=\"width: 50px\"></div></td>\n \
|
||||
<td style=\"width: 100%;\">" + currentBook.description +
|
||||
"<br/><table style=\"font-size: small; color: grey; width: 100%;\">" +
|
||||
"<tr><td style=\"width: 50%\">Size: " + kiwix::beautifyFileSize(atoi(currentBook.size.c_str())) + " (" + kiwix::beautifyInteger(atoi(currentBook.articleCount.c_str())) + " articles, " + kiwix::beautifyInteger(atoi(currentBook.mediaCount.c_str())) + " medias)\n \
|
||||
</td><td>Date: " + currentBook.date + "</td><td style=\"vertical-align: bottom; width: 20%\" rowspan=\"3\"><form action=\"/" + currentBook.getHumanReadableIdFromPath() + "/\" method=\"GET\"><input style=\"align: right; right: 0px; float:right; width: 100%; height: 60px; font-weight: bold;\" type=\"submit\" value=\"Load\" /></form></td></tr>\n \
|
||||
<tr><td>Author: " + currentBook.creator + "</td><td>Language: " + currentBook.language + "</td></tr>\n \
|
||||
<tr><td>Publisher: " + (currentBook.publisher.empty() ? "unknown" : currentBook.publisher ) + "</td><td></td></tr>\n \
|
||||
</table>\n \
|
||||
</td></tr>\n \
|
||||
</table>\n\n";
|
||||
welcomeBooksHtml += ""
|
||||
"<a href='/" + currentBook.getHumanReadableIdFromPath() + "/'>"
|
||||
"<div class='book'>"
|
||||
"<div class='book__background' style='background-image: url(data:" + currentBook.faviconMimeType+ ";base64," + currentBook.favicon + ");'>"
|
||||
"<div class='book__title'>" + currentBook.title + "</div>"
|
||||
"<div class='book__description'>" + currentBook.description + "</div>"
|
||||
"<div class='book__info'>"
|
||||
"" + kiwix::beautifyInteger(atoi(currentBook.articleCount.c_str())) + " articles, " + kiwix::beautifyInteger(atoi(currentBook.mediaCount.c_str())) + " medias"
|
||||
"</div>"
|
||||
"</div>"
|
||||
"</div>"
|
||||
"</a>";
|
||||
}
|
||||
}
|
||||
welcomeHTML = replaceRegex(RESOURCE::home_html_tmpl, welcomeBooksHtml, "__BOOKS__");
|
||||
welcomeBooksHtml += ""
|
||||
"</div>";
|
||||
|
||||
welcomeHTML = replaceRegex(replaceRegex(RESOURCE::home_html_tmpl, welcomeBooksCss, "__BOOKS_STYLE__"), welcomeBooksHtml, "__BOOKS__");
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
/* Fork if necessary */
|
||||
|
@ -7,6 +7,7 @@
|
||||
<script type="text/javascript" src="/skin/jquery-ui/jquery-ui.min.js"></script>
|
||||
<link type="text/css" href="/skin/jquery-ui/jquery-ui.min.css" rel="Stylesheet" />
|
||||
<link type="text/css" href="/skin/jquery-ui/jquery-ui.theme.min.css" rel="Stylesheet" />
|
||||
__BOOKS_STYLE__
|
||||
<script>
|
||||
$(function() {
|
||||
$( "#accordion" ).accordion();
|
||||
@ -15,7 +16,7 @@ $( "#accordion" ).accordion();
|
||||
</head>
|
||||
<body class="kiwix">
|
||||
|
||||
<div id="accordion" class="kiwix">
|
||||
<div class="kiwix">
|
||||
__BOOKS__
|
||||
</div>
|
||||
</body>
|
||||
|
Loading…
x
Reference in New Issue
Block a user