mirror of https://github.com/kiwix/libkiwix.git
Merge pull request #559 from kiwix/Css_revamp
Revamped Kiwix Serve Welcome page layout
This commit is contained in:
commit
60f0f81286
|
@ -18,6 +18,7 @@ skin/jquery-ui/images/ui-bg_glass_95_fef1ec_1x400.png
|
||||||
skin/jquery-ui/jquery-ui.theme.min.css
|
skin/jquery-ui/jquery-ui.theme.min.css
|
||||||
skin/jquery-ui/jquery-ui.min.css
|
skin/jquery-ui/jquery-ui.min.css
|
||||||
skin/caret.png
|
skin/caret.png
|
||||||
|
skin/search-icon.svg
|
||||||
skin/taskbar.js
|
skin/taskbar.js
|
||||||
skin/langList.js
|
skin/langList.js
|
||||||
skin/categoryList.js
|
skin/categoryList.js
|
||||||
|
@ -25,6 +26,9 @@ skin/iso6391To3.js
|
||||||
skin/isotope.pkgd.min.js
|
skin/isotope.pkgd.min.js
|
||||||
skin/index.js
|
skin/index.js
|
||||||
skin/taskbar.css
|
skin/taskbar.css
|
||||||
|
skin/home.css
|
||||||
|
skin/fonts/Poppins.ttf
|
||||||
|
skin/fonts/Roboto.ttf
|
||||||
skin/block_external.js
|
skin/block_external.js
|
||||||
templates/search_result.html
|
templates/search_result.html
|
||||||
templates/no_search_result.html
|
templates/no_search_result.html
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,378 @@
|
||||||
|
*,
|
||||||
|
*::after,
|
||||||
|
*::before {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-size: 62.5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
::selection {
|
||||||
|
background-color: #00b4e4;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kiwixNav {
|
||||||
|
background-color: #f4f6f8;
|
||||||
|
width: 100%;
|
||||||
|
padding: 20px 11vw 25px;
|
||||||
|
height: 140px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kiwixHomeBody__results {
|
||||||
|
font-size: 1.6rem;
|
||||||
|
color: #333333;
|
||||||
|
font-family: poppins;
|
||||||
|
margin: 10px 0 -5px;
|
||||||
|
position: relative;
|
||||||
|
top: -10px;
|
||||||
|
left: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kiwixNav__filters {
|
||||||
|
display: grid;
|
||||||
|
grid-gap: 20px;
|
||||||
|
grid-template-columns: 231px 231px;
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kiwixNav__kiwixFilter {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
-ms-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
outline: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
border: 0 !important;
|
||||||
|
background: white;
|
||||||
|
background-image: none;
|
||||||
|
border-radius: 1px;
|
||||||
|
width: 195px;
|
||||||
|
height: 35px;
|
||||||
|
flex: 1;
|
||||||
|
color: black;
|
||||||
|
padding: 7px 10px 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kiwixNav__kiwixFilter:-ms-expand {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kiwixNav__select {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
width: 231px;
|
||||||
|
height: 35px;
|
||||||
|
line-height: 3;
|
||||||
|
background: #909090;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px solid #b5b2b2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kiwixNav__select::after {
|
||||||
|
content: '\25BC';
|
||||||
|
color: #fff;
|
||||||
|
background-color: #909090;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
padding: 0 1em;
|
||||||
|
cursor: pointer;
|
||||||
|
pointer-events: none;
|
||||||
|
-webkit-transition: .25s all ease;
|
||||||
|
-o-transition: .25s all ease;
|
||||||
|
transition: .25s all ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kiwixNav__kiwixFilter option {
|
||||||
|
background-color: #fff;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kiwixSearch {
|
||||||
|
height: 35px;
|
||||||
|
width: 229px;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: solid 1px #b5b2b2;
|
||||||
|
padding: 10px;
|
||||||
|
background-image: url('./search-icon.svg');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: right center;
|
||||||
|
background-origin: content-box;
|
||||||
|
background-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchButton {
|
||||||
|
margin: 0 17px;
|
||||||
|
height: 35px;
|
||||||
|
width: 100px;
|
||||||
|
border-radius: 10px;
|
||||||
|
color: white;
|
||||||
|
background-color: #909090;
|
||||||
|
border: solid 1px #b5b2b2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchButton:hover {
|
||||||
|
background-color: #858585;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kiwixHomeBody {
|
||||||
|
padding: 20px 15vw;
|
||||||
|
min-height: calc(100vh - 170px);
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book__list {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book {
|
||||||
|
border-color: #acacac;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book__wrapper {
|
||||||
|
color: #444343;
|
||||||
|
height: 280px;
|
||||||
|
width: 250px;
|
||||||
|
margin: 15px;
|
||||||
|
background-color: #f7f7f7;
|
||||||
|
border: 1px solid #ececec;
|
||||||
|
border-radius: 3px;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 65px 1fr;
|
||||||
|
grid-template-rows: 70px 120px 1fr 1fr;
|
||||||
|
grid-gap: 5px;
|
||||||
|
transition: transform 0.25s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book__wrapper:hover {
|
||||||
|
transform: scale(1.07);
|
||||||
|
}
|
||||||
|
|
||||||
|
.book__icon {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
align-content: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin: 10px 0 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book__icon--image {
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book__title {
|
||||||
|
display: grid;
|
||||||
|
font-family: poppins;
|
||||||
|
color: black;
|
||||||
|
padding: 12px 10px 0 2px;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
align-items: center;
|
||||||
|
align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bookSize {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
margin: 3px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bookTitle {
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
font-size: 1.45rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book__description {
|
||||||
|
grid-column: 1 / 3;
|
||||||
|
margin: 10px 10px 5px;
|
||||||
|
overflow: hidden;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 7;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
font-family: roboto;
|
||||||
|
font-weight: 300;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
color: #4d4d4d;
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book__languageTag {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-shadow: 0 0 2px #acacac;
|
||||||
|
background-color: #ffffff;
|
||||||
|
font-weight: bold;
|
||||||
|
font-family: roboto;
|
||||||
|
color: black;
|
||||||
|
height: 25px;
|
||||||
|
width: 25px;
|
||||||
|
margin: 10px auto 0 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book__tags {
|
||||||
|
display: flex;
|
||||||
|
text-align: end;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
justify-content: flex-end;
|
||||||
|
color: #909090;
|
||||||
|
font-family: roboto;
|
||||||
|
margin-right: 10px;
|
||||||
|
margin-top: 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book__tags--wrapper {
|
||||||
|
overflow: hidden;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book__links {
|
||||||
|
display: flex;
|
||||||
|
text-align: end;
|
||||||
|
justify-content: flex-end;
|
||||||
|
grid-column: 2 / 3;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
margin: 10px 4px;
|
||||||
|
color: #00b4e4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book__links > a, .book__links > span {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #00b4e4;
|
||||||
|
position: relative;
|
||||||
|
padding: 1px 6px 0;
|
||||||
|
font-family: roboto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book__links > a:hover {
|
||||||
|
background: #00b4e4;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fadeOut {
|
||||||
|
position: fixed;
|
||||||
|
display: none;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1;
|
||||||
|
background: linear-gradient(180deg, rgba(232, 232, 232, 0) 0%, #ffffff 100%);
|
||||||
|
height: 80px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.noResults {
|
||||||
|
font-size: 1.6rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.noResults > a {
|
||||||
|
color: #3498db;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loader-spinner {
|
||||||
|
position: absolute;
|
||||||
|
top: -50%;
|
||||||
|
left: 50%;
|
||||||
|
border: 5px solid #f3f3f3;
|
||||||
|
border-radius: 50%;
|
||||||
|
border-top: 5px solid #3498db;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
margin: auto;
|
||||||
|
-webkit-animation: spin 1s linear infinite; /* Safari */
|
||||||
|
animation: spin 1s linear infinite;
|
||||||
|
margin-top: 35px;
|
||||||
|
margin-bottom: -35px;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
/* Safari */
|
||||||
|
@-webkit-keyframes spin {
|
||||||
|
0% { -webkit-transform: rotate(0deg); }
|
||||||
|
100% { -webkit-transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
0% { transform: rotate(0deg); }
|
||||||
|
100% { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.loader {
|
||||||
|
display: none;
|
||||||
|
position: relative;
|
||||||
|
height: 70px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kiwixfooter {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
justify-content: center;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.6rem;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kiwixfooter > a {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 1100px) {
|
||||||
|
|
||||||
|
.kiwixHomeBody {
|
||||||
|
padding: 20px 10vw;
|
||||||
|
min-height: calc(100vh - 170px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.kiwixNav__filters {
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 590px) {
|
||||||
|
|
||||||
|
.kiwixNav {
|
||||||
|
height: 257px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kiwixHomeBody {
|
||||||
|
min-height: calc(100vh - 287px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.kiwixSearch {
|
||||||
|
margin-top: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchButton {
|
||||||
|
margin: 19px 0;
|
||||||
|
width: 229px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kiwixNav__filters {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 340px) {
|
||||||
|
.kiwixHomeBody {
|
||||||
|
padding: 20px 5vw;
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,7 @@
|
||||||
const bookOrderMap = new Map();
|
const bookOrderMap = new Map();
|
||||||
const filterCookieName = 'filters';
|
const filterCookieName = 'filters';
|
||||||
const oneDayDelta = 86400000;
|
const oneDayDelta = 86400000;
|
||||||
|
let loader;
|
||||||
let footer;
|
let footer;
|
||||||
let fadeOutDiv;
|
let fadeOutDiv;
|
||||||
let iso;
|
let iso;
|
||||||
|
@ -41,12 +42,23 @@
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const humanFriendlySize = (fileSize) => {
|
||||||
|
if (fileSize === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
const units = ['bytes', 'kB', 'MB', 'GB', 'TB'];
|
||||||
|
let quotient = Math.floor(Math.log10(fileSize) / 3);
|
||||||
|
quotient = quotient < units.length ? quotient : units.length - 1;
|
||||||
|
fileSize /= (1000 ** quotient);
|
||||||
|
return `${+fileSize.toFixed(2)} ${units[quotient]}`;
|
||||||
|
};
|
||||||
|
|
||||||
function htmlEncode(str) {
|
function htmlEncode(str) {
|
||||||
return str.replace(/[\u00A0-\u9999<>\&]/gim, (i) => `&#${i.charCodeAt(0)};`);
|
return str.replace(/[\u00A0-\u9999<>\&]/gim, (i) => `&#${i.charCodeAt(0)};`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function viewPortToCount(){
|
function viewPortToCount(){
|
||||||
return Math.floor(window.innerHeight/100 + 1)*(window.innerWidth>1000 ? 3 : 2);
|
return Math.floor(window.innerHeight/300 + 1)*(window.innerWidth>1000 ? 4 : 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getInnerHtml(node, query) {
|
function getInnerHtml(node, query) {
|
||||||
|
@ -59,22 +71,38 @@
|
||||||
const description = getInnerHtml(book, 'summary');
|
const description = getInnerHtml(book, 'summary');
|
||||||
const id = getInnerHtml(book, 'id');
|
const id = getInnerHtml(book, 'id');
|
||||||
const iconUrl = getInnerHtml(book, 'icon');
|
const iconUrl = getInnerHtml(book, 'icon');
|
||||||
const articleCount = getInnerHtml(book, 'articleCount');
|
const language = getInnerHtml(book, 'language');
|
||||||
const mediaCount = getInnerHtml(book, 'mediaCount');
|
const tags = getInnerHtml(book, 'tags');
|
||||||
|
let tagHtml = tags.split(';').filter(tag => {return !(tag.split(':')[0].startsWith('_'))})
|
||||||
const linkTag = document.createElement('a');
|
.map((tag) => {return tag.charAt(0).toUpperCase() + tag.slice(1)})
|
||||||
linkTag.setAttribute('class', 'book');
|
.join(' | ').replace(/_/g, ' ');
|
||||||
linkTag.setAttribute('data-id', id);
|
let downloadLink;
|
||||||
linkTag.setAttribute('href', link);
|
let zimSize = 0;
|
||||||
if (sort) {
|
try {
|
||||||
linkTag.setAttribute('data-idx', bookOrderMap.get(id));
|
const downloadBookLink = book.querySelector('link[type="application/x-zim"]')
|
||||||
|
zimSize = parseInt(downloadBookLink.getAttribute('length'));
|
||||||
|
downloadLink = downloadBookLink.getAttribute('href').split('.meta4')[0];
|
||||||
|
} catch {
|
||||||
|
downloadLink = '';
|
||||||
}
|
}
|
||||||
linkTag.innerHTML = `<div class='book__background' style="background-image: url('${iconUrl}');">
|
humanFriendlyZimSize = humanFriendlySize(zimSize);
|
||||||
<div class='book__title' title='${title}'>${title}</div>
|
|
||||||
|
const divTag = document.createElement('div');
|
||||||
|
divTag.setAttribute('class', 'book');
|
||||||
|
divTag.setAttribute('data-id', id);
|
||||||
|
if (sort) {
|
||||||
|
divTag.setAttribute('data-idx', bookOrderMap.get(id));
|
||||||
|
}
|
||||||
|
divTag.innerHTML = `<div class="book__wrapper"><div class='book__icon' ><img class="book__icon--image" src='${iconUrl}'></div>
|
||||||
|
<div class='book__title' title='${title}'>
|
||||||
|
<div id="bookTitle">${title}</div>
|
||||||
|
${humanFriendlyZimSize ? `<div id='bookSize'>${humanFriendlyZimSize}</div>`: ''}
|
||||||
|
</div>
|
||||||
<div class='book__description' title='${description}'>${description}</div>
|
<div class='book__description' title='${description}'>${description}</div>
|
||||||
<div class='book__info'>${articleCount} articles, ${mediaCount} medias</div>
|
<div class='book__languageTag'>${language.substr(0, 2).toUpperCase()}</div>
|
||||||
</div>`;
|
<div class='book__tags'><div class="book__tags--wrapper">${tagHtml}</div></div>
|
||||||
return linkTag;
|
<div class='book__links'> <a href="${link}" data-hover="Preview">Preview</a>${downloadLink ? ` | <a href="${downloadLink}" data-hove="Download" download>Download</a>` : ''} </div></div>`;
|
||||||
|
return divTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleFooter(show=false) {
|
function toggleFooter(show=false) {
|
||||||
|
@ -87,7 +115,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadBooks() {
|
async function loadBooks() {
|
||||||
const loader = document.querySelector('.loader');
|
|
||||||
loader.style.display = 'block';
|
loader.style.display = 'block';
|
||||||
return await fetch(queryUrlBuilder()).then(async (resp) => {
|
return await fetch(queryUrlBuilder()).then(async (resp) => {
|
||||||
const data = new window.DOMParser().parseFromString(await resp.text(), 'application/xml');
|
const data = new window.DOMParser().parseFromString(await resp.text(), 'application/xml');
|
||||||
|
@ -96,12 +123,23 @@
|
||||||
bookOrderMap.set(getInnerHtml(book, 'id'), idx);
|
bookOrderMap.set(getInnerHtml(book, 'id'), idx);
|
||||||
});
|
});
|
||||||
incrementalLoadingParams.start += books.length;
|
incrementalLoadingParams.start += books.length;
|
||||||
if (parseInt(data.querySelector('totalResults').innerHTML) === bookOrderMap.size) {
|
const results = parseInt(data.querySelector('totalResults').innerHTML)
|
||||||
|
if (results === bookOrderMap.size) {
|
||||||
incrementalLoadingParams.count = 0;
|
incrementalLoadingParams.count = 0;
|
||||||
toggleFooter(true);
|
toggleFooter(true);
|
||||||
} else {
|
} else {
|
||||||
toggleFooter();
|
toggleFooter();
|
||||||
}
|
}
|
||||||
|
const kiwixResultText = document.querySelector('.kiwixHomeBody__results')
|
||||||
|
if (results) {
|
||||||
|
let resultText = `${results} books`;
|
||||||
|
if (results === 1) {
|
||||||
|
resultText = `${results} book`;
|
||||||
|
}
|
||||||
|
kiwixResultText.innerHTML = resultText;
|
||||||
|
} else {
|
||||||
|
kiwixResultText.innerHTML = ``;
|
||||||
|
}
|
||||||
loader.style.display = 'none';
|
loader.style.display = 'none';
|
||||||
return books;
|
return books;
|
||||||
});
|
});
|
||||||
|
@ -115,28 +153,42 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkAndInjectEmptyMessage() {
|
function checkAndInjectEmptyMessage() {
|
||||||
|
const kiwixHomeBody = document.querySelector('.kiwixHomeBody');
|
||||||
if (!bookOrderMap.size) {
|
if (!bookOrderMap.size) {
|
||||||
if (!noResultInjected) {
|
if (!noResultInjected) {
|
||||||
noResultInjected = true;
|
noResultInjected = true;
|
||||||
iso.remove(document.getElementsByClassName('book__list')[0].getElementsByTagName('a'));
|
iso.remove(document.getElementsByClassName('book__list')[0].getElementsByTagName('div'));
|
||||||
iso.layout();
|
iso.layout();
|
||||||
const spanTag = document.createElement('span');
|
setTimeout(() => {
|
||||||
spanTag.setAttribute('class', 'noResults');
|
const divTag = document.createElement('div');
|
||||||
spanTag.innerHTML = `No result. Would you like to <a href="/?lang=">reset filter?</a>`;
|
divTag.setAttribute('class', 'noResults');
|
||||||
document.querySelector('body').append(spanTag);
|
divTag.innerHTML = `No result. Would you like to <a href="/?lang=">reset filter</a>?`;
|
||||||
spanTag.getElementsByTagName('a')[0].onclick = (event) => {
|
kiwixHomeBody.append(divTag);
|
||||||
event.preventDefault();
|
kiwixHomeBody.setAttribute('style', 'display: flex; justify-content: center; align-items: center');
|
||||||
window.history.pushState({}, null, `${window.location.href.split('?')[0]}?lang=`);
|
divTag.getElementsByTagName('a')[0].onclick = (event) => {
|
||||||
setCookie(filterCookieName, 'lang=');
|
event.preventDefault();
|
||||||
resetAndFilter();
|
window.history.pushState({}, null, `${window.location.href.split('?')[0]}?lang=`);
|
||||||
filterTypes.forEach(key => {document.getElementsByName(key)[0].value = params.get(key) || ''});
|
setCookie(filterCookieName, 'lang=');
|
||||||
};
|
resetAndFilter();
|
||||||
|
document.querySelectorAll('.filter').forEach(filter => {
|
||||||
|
filter.value = params.get(filter.name) || '';
|
||||||
|
if (filter.value) {
|
||||||
|
filter.style = 'background-color: #858585; color: #fff';
|
||||||
|
} else {
|
||||||
|
filter.style = 'background-color: #ffffff; color: black';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
loader.setAttribute('style', 'position: absolute; top: 50%');
|
||||||
|
}, 300);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (noResultInjected) {
|
} else if (noResultInjected) {
|
||||||
noResultInjected = false;
|
noResultInjected = false;
|
||||||
document.getElementsByClassName('noResults')[0].remove();
|
document.getElementsByClassName('noResults')[0].remove();
|
||||||
|
kiwixHomeBody.removeAttribute('style');
|
||||||
}
|
}
|
||||||
|
loader.removeAttribute('style');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,12 +237,19 @@
|
||||||
window.history.pushState({}, null, `${window.location.href.split('?')[0]}?${params.toString()}`);
|
window.history.pushState({}, null, `${window.location.href.split('?')[0]}?${params.toString()}`);
|
||||||
setCookie(filterCookieName, params.toString());
|
setCookie(filterCookieName, params.toString());
|
||||||
}
|
}
|
||||||
|
document.querySelectorAll('.filter').forEach(filter => {
|
||||||
|
if (filter.value) {
|
||||||
|
filter.style = 'background-color: #858585; color: #fff';
|
||||||
|
} else {
|
||||||
|
filter.style = 'background-color: #ffffff; color: black';
|
||||||
|
}
|
||||||
|
});
|
||||||
await loadAndDisplayBooks(true);
|
await loadAndDisplayBooks(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('popstate', async () => {
|
window.addEventListener('popstate', async () => {
|
||||||
await resetAndFilter();
|
await resetAndFilter();
|
||||||
filterTypes.forEach(key => {document.getElementsByName(key)[0].value = params.get(key) || ''});
|
document.querySelectorAll('.filter').forEach(filter => {filter.value = params.get(filter.name) || ''});
|
||||||
});
|
});
|
||||||
|
|
||||||
async function loadSubset() {
|
async function loadSubset() {
|
||||||
|
@ -223,16 +282,21 @@
|
||||||
return index ? parseInt(index) : Infinity;
|
return index ? parseInt(index) : Infinity;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sortBy: 'weight'
|
sortBy: 'weight',
|
||||||
|
layoutMode: 'cellsByRow',
|
||||||
|
cellsByRow: {
|
||||||
|
columnWidth: '.book',
|
||||||
|
rowHeight: '.book'
|
||||||
|
}
|
||||||
});
|
});
|
||||||
footer = document.getElementById('kiwixfooter');
|
footer = document.getElementById('kiwixfooter');
|
||||||
fadeOutDiv = document.getElementById('fadeOut');
|
fadeOutDiv = document.getElementById('fadeOut');
|
||||||
|
loader = document.querySelector('.loader');
|
||||||
await loadAndDisplayBooks();
|
await loadAndDisplayBooks();
|
||||||
await loadAndDisplayOptions('#languageFilter', langList);
|
await loadAndDisplayOptions('#languageFilter', langList);
|
||||||
await loadAndDisplayOptions('#categoryFilter', categoryList);
|
await loadAndDisplayOptions('#categoryFilter', categoryList);
|
||||||
filterTypes.forEach((filter) => {
|
document.querySelectorAll('.filter').forEach(filter => {
|
||||||
const filterTag = document.getElementsByName(filter)[0];
|
filter.addEventListener('change', () => {resetAndFilter(filter.name, filter.value)});
|
||||||
filterTag.addEventListener('change', () => {resetAndFilter(filterTag.name, filterTag.value)});
|
|
||||||
});
|
});
|
||||||
if (filters) {
|
if (filters) {
|
||||||
window.history.pushState({}, null, `${window.location.href.split('?')[0]}?${params.toString()}`);
|
window.history.pushState({}, null, `${window.location.href.split('?')[0]}?${params.toString()}`);
|
||||||
|
@ -245,6 +309,13 @@
|
||||||
langFilter.value = browserLang.length === 3 ? browserLang : iso6391To3[browserLang];
|
langFilter.value = browserLang.length === 3 ? browserLang : iso6391To3[browserLang];
|
||||||
langFilter.dispatchEvent(new Event('change'));
|
langFilter.dispatchEvent(new Event('change'));
|
||||||
}
|
}
|
||||||
|
document.querySelectorAll('.filter').forEach(filter => {
|
||||||
|
if (filter.value) {
|
||||||
|
filter.style = 'background-color: #858585; color: #fff';
|
||||||
|
} else {
|
||||||
|
filter.style = 'background-color: #ffffff; color: black';
|
||||||
|
}
|
||||||
|
});
|
||||||
setCookie(filterCookieName, params.toString());
|
setCookie(filterCookieName, params.toString());
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,6 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="512.000000" height="512.000000" preserveAspectRatio="xMidYMid meet" style=""><rect id="backgroundrect" width="100%" height="100%" x="0" y="0" fill="none" stroke="none"/>
|
||||||
|
|
||||||
|
|
||||||
|
<g class="currentLayer" style=""><title>Layer 1</title><g transform="translate(0,512) scale(0.10000000149011612,-0.10000000149011612) " fill="#484848" stroke="none" id="svg_1" class="selected" fill-opacity="1">
|
||||||
|
<path d="M1858 5104 c-341 -50 -678 -192 -963 -408 -104 -78 -304 -278 -384 -384 -124 -164 -256 -409 -315 -583 -311 -929 47 -1926 877 -2442 662 -410 1535 -405 2188 14 l76 49 125 -128 c69 -70 352 -364 630 -653 574 -597 548 -575 688 -567 85 5 123 21 176 75 52 52 77 114 77 193 0 98 -24 142 -151 273 -420 434 -1132 1177 -1132 1182 0 3 22 33 49 68 164 209 291 471 362 746 159 614 28 1255 -363 1774 -78 104 -279 305 -386 386 -288 218 -618 355 -974 406 -130 19 -448 18 -580 -1z m502 -545 c308 -38 607 -184 844 -409 476 -455 606 -1146 327 -1745 -128 -273 -356 -519 -626 -674 -387 -222 -857 -259 -1282 -102 -626 231 -1040 879 -983 1540 13 146 33 241 77 371 214 634 830 1060 1493 1032 36 -1 103 -7 150 -13z" id="svg_2" fill="#484848" fill-opacity="1"/>
|
||||||
|
</g></g></svg>
|
After Width: | Height: | Size: 1.2 KiB |
|
@ -2,6 +2,7 @@
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||||
<title>Welcome to Kiwix Server</title>
|
<title>Welcome to Kiwix Server</title>
|
||||||
<script
|
<script
|
||||||
type="text/javascript"
|
type="text/javascript"
|
||||||
|
@ -21,159 +22,20 @@
|
||||||
href="{{root}}/skin/jquery-ui/jquery-ui.theme.min.css"
|
href="{{root}}/skin/jquery-ui/jquery-ui.theme.min.css"
|
||||||
rel="Stylesheet"
|
rel="Stylesheet"
|
||||||
/>
|
/>
|
||||||
|
<link
|
||||||
|
type="text/css"
|
||||||
|
href="{{root}}/skin/home.css"
|
||||||
|
rel="Stylesheet"
|
||||||
|
/>
|
||||||
<style>
|
<style>
|
||||||
html {
|
@font-face {
|
||||||
min-height: 100%;
|
font-family: "poppins";
|
||||||
position: relative;
|
src: url("{{root}}/skin/fonts/Poppins.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
body {
|
|
||||||
background: radial-gradient(#eeeeee 15%, transparent 16%) 0 0,
|
@font-face {
|
||||||
radial-gradient(#eeeeee 15%, transparent 16%) 8px 8px,
|
font-family: "roboto";
|
||||||
radial-gradient(rgba(255, 255, 255, 0.1) 15%, transparent 20%) 0 1px,
|
src: url("{{root}}/skin/fonts/Roboto.ttf") format("truetype");
|
||||||
radial-gradient(rgba(255, 255, 255, 0.1) 15%, transparent 20%) 8px 9px;
|
|
||||||
background-color: #e8e8e8;
|
|
||||||
background-size: 16px 16px;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
max-width: 1100px;
|
|
||||||
min-height: 100%;
|
|
||||||
}
|
|
||||||
.book__list {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.kiwixHomeBody {
|
|
||||||
position: relative;
|
|
||||||
text-align: center;
|
|
||||||
min-height: 100%;
|
|
||||||
margin: 0 0 15px;
|
|
||||||
}
|
|
||||||
.book {
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: bottom;
|
|
||||||
margin: 8px;
|
|
||||||
padding: 12px 15px;
|
|
||||||
width: 300px;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 8px;
|
|
||||||
text-align: left;
|
|
||||||
color: #000;
|
|
||||||
font-family: sans-serif;
|
|
||||||
font-size: 13px;
|
|
||||||
background-color: #f1f1f1;
|
|
||||||
box-shadow: 2px 2px 5px 0 #ccc;
|
|
||||||
}
|
|
||||||
#kiwixfooter {
|
|
||||||
text-align: center;
|
|
||||||
margin: 0.5em;
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
left: 46%;
|
|
||||||
}
|
|
||||||
.kiwixHomeNavbar {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
.kiwixFilter {
|
|
||||||
margin: 8px 10px;
|
|
||||||
}
|
|
||||||
.kiwixSearch, .searchButton {
|
|
||||||
margin: 0 13px 0 0;
|
|
||||||
}
|
|
||||||
.kiwixSearchForm {
|
|
||||||
margin: 8px 10px;
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
@media (max-width: 1100px) {
|
|
||||||
.kiwixHomeBody {
|
|
||||||
padding: 0 125px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.book:hover {
|
|
||||||
background-color: #f9f9f9;
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
.book__background {
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-size: 48px 48px;
|
|
||||||
background-position: top right;
|
|
||||||
}
|
|
||||||
.book__title {
|
|
||||||
padding: 0 55px 0 0;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
font-size: 18px;
|
|
||||||
color: #0645ad;
|
|
||||||
line-height: 1em;
|
|
||||||
}
|
|
||||||
.book__description {
|
|
||||||
padding: 5px 55px 5px 0;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
font-size: 15px;
|
|
||||||
line-height: 1em;
|
|
||||||
}
|
|
||||||
.book__info {
|
|
||||||
color: #777;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 13px;
|
|
||||||
line-height: 1em;
|
|
||||||
}
|
|
||||||
a:link {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
a:visited {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
.noResults {
|
|
||||||
position: absolute;
|
|
||||||
top: 48%;
|
|
||||||
left: 42%;
|
|
||||||
}
|
|
||||||
.loader-spinner {
|
|
||||||
position: absolute;
|
|
||||||
top: -50%;
|
|
||||||
left: 50%;
|
|
||||||
border: 5px solid #f3f3f3;
|
|
||||||
border-radius: 50%;
|
|
||||||
border-top: 5px solid #3498db;
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
margin: auto;
|
|
||||||
-webkit-animation: spin 1s linear infinite; /* Safari */
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
margin-top: 35px;
|
|
||||||
margin-bottom: -35px;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
/* Safari */
|
|
||||||
@-webkit-keyframes spin {
|
|
||||||
0% { -webkit-transform: rotate(0deg); }
|
|
||||||
100% { -webkit-transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
0% { transform: rotate(0deg); }
|
|
||||||
100% { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
position: relative;
|
|
||||||
height: 70px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.fadeOut {
|
|
||||||
position: fixed;
|
|
||||||
display: none;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 1;
|
|
||||||
background: linear-gradient(180deg, rgba(232, 232, 232, 0) 0%, rgb(232, 232, 232) 100%);
|
|
||||||
height: 80px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.spacer {
|
|
||||||
height: 20px;
|
|
||||||
background: transparent;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script src="{{root}}/skin/isotope.pkgd.min.js" defer></script>
|
<script src="{{root}}/skin/isotope.pkgd.min.js" defer></script>
|
||||||
|
@ -182,25 +44,31 @@
|
||||||
<script src="{{root}}/skin/iso6391To3.js"></script>
|
<script src="{{root}}/skin/iso6391To3.js"></script>
|
||||||
<script type="text/javascript" src="{{root}}/skin/index.js" defer></script>
|
<script type="text/javascript" src="{{root}}/skin/index.js" defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body class="kiwix">
|
<body>
|
||||||
<div class='kiwixHomeNavbar'>
|
<div class='kiwixNav'>
|
||||||
<select name="lang" id="languageFilter" class='kiwixFilter'>
|
<div class="kiwixNav__filters">
|
||||||
<option value="" selected>All languages</option>
|
<div class="kiwixNav__select">
|
||||||
</select>
|
<select name="lang" id="languageFilter" class='kiwixNav__kiwixFilter filter'>
|
||||||
<select name="category" id="categoryFilter" class='kiwixFilter'>
|
<option value="" selected>All languages</option>
|
||||||
<option value="" selected>All categories</option>
|
</select>
|
||||||
</select>
|
</div>
|
||||||
<form id='kiwixSearchForm' class='kiwixSearchForm'>
|
<div class="kiwixNav__select">
|
||||||
<input type="text" name="q" id="searchFilter" class='kiwixSearch'>
|
<select name="category" id="categoryFilter" class='kiwixNav__kiwixFilter filter'>
|
||||||
|
<option value="" selected>All categories</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<form id='kiwixSearchForm' class='kiwixNav__SearchForm'>
|
||||||
|
<input type="text" name="q" placeholder="Search" id="searchFilter" class='kiwixSearch filter'>
|
||||||
<input type="submit" class="searchButton" value="Search"/>
|
<input type="submit" class="searchButton" value="Search"/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="kiwixHomeBody">
|
<div class="kiwixHomeBody">
|
||||||
|
<h3 class="kiwixHomeBody__results"></h3>
|
||||||
<div class="book__list"></div>
|
<div class="book__list"></div>
|
||||||
<div id="fadeOut" class="fadeOut"></div>
|
<div id="fadeOut" class="fadeOut"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="loader"><div class="loader-spinner"></div></div>
|
<div class="loader" style="position: absolute; top: 50%"><div class="loader-spinner"></div></div>
|
||||||
<div class="spacer"></div>
|
<div id="kiwixfooter" class="kiwixfooter">Powered by <a href="https://kiwix.org">Kiwix</a></div>
|
||||||
<div id="kiwixfooter">Powered by <a href="https://kiwix.org">Kiwix</a></div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue