Fix modal and dropdown colors in dark mode

and get rid of the hacky `styleModal` function
This commit is contained in:
Alex Ling 2020-07-22 12:06:29 +00:00
parent a994c43857
commit 6c2350c9c7
5 changed files with 38 additions and 26 deletions

View File

@ -101,3 +101,23 @@ td>.uk-dropdown {
.grayscale {
filter: grayscale(100%);
}
.uk-light .uk-navbar-dropdown,
.uk-light .uk-modal-header,
.uk-light .uk-modal-body,
.uk-light .uk-modal-footer {
background: #222;
}
.uk-light .uk-dropdown {
background: #333;
}
.uk-light .uk-navbar-dropdown,
.uk-light .uk-dropdown {
color: #ccc;
}
.uk-light .uk-nav-header {
color: #555;
}

View File

@ -51,7 +51,6 @@ const download = () => {
UIkit.modal.confirm(`${successCount} of ${successCount + failCount} chapters added to the download queue. Proceed to the download manager?`).then(() => {
window.location.href = base_url + 'admin/downloads';
});
styleModal();
})
.fail((jqXHR, status) => {
alert('danger', `Failed to add chapters to the download queue. Error: [${jqXHR.status}] ${jqXHR.statusText}`);
@ -61,7 +60,6 @@ const download = () => {
$('#download-btn').removeAttr('hidden');
});
});
styleModal();
};
const toggleSpinner = () => {
var attr = $('#spinner').attr('hidden');

View File

@ -57,14 +57,15 @@ $(function() {
$('#page-select').change(function() {
jumpTo(parseInt($('#page-select').val()));
});
function showControl(idx) {
const pageCount = $('#page-select > option').length;
const progressText = `Progress: ${idx}/${pageCount} (${(idx/pageCount * 100).toFixed(1)}%)`;
$('#progress-label').text(progressText);
$('#page-select').val(idx);
UIkit.modal($('#modal-sections')).show();
styleModal();
}
function jumpTo(page) {
var ary = window.location.pathname.split('/');
ary[ary.length - 1] = page;
@ -72,10 +73,12 @@ function jumpTo(page) {
ary.unshift(window.location.origin);
window.location.replace(ary.join('/'));
}
function replaceHistory(url) {
history.replaceState(null, "", url);
console.log('reading ' + url);
}
function redirect(url) {
window.location.replace(url);
}

View File

@ -53,13 +53,6 @@ const setTheme = (theme) => {
}
};
const styleModal = () => {
const color = loadTheme() === 'dark' ? '#222' : '';
$('.uk-modal-header').css('background', color);
$('.uk-modal-body').css('background', color);
$('.uk-modal-footer').css('background', color);
};
// do it before document is ready to prevent the initial flash of white on
// most pages
setTheme();

View File

@ -58,7 +58,6 @@ function showModal(encodedPath, pages, percentage, encodedeTitle, encodedEntryTi
$('#modal-download-btn').attr('href', `/opds/download/${titleID}/${entryID}`);
UIkit.modal($('#modal')).show();
styleModal();
}
const updateProgress = (tid, eid, page) => {
@ -144,7 +143,6 @@ const edit = (eid) => {
setupUpload(eid);
UIkit.modal($('#edit-modal')).show();
styleModal();
};
const setupUpload = (eid) => {