' + + msg.no_result + + "!
" + + $("#meta-info")[0].innerHTML + ); + } + }, + error: function error() { + $("#meta-info").html( + '' + + msg.search_error + + "!
" + + $("#meta-info")[0].innerHTML + ); + }, + }); + } + } + + function populate_provider() { + $("#metadata_provider").empty(); + $.ajax({ + url: getPath() + "/metadata/provider", + type: "get", + dataType: "json", + success: function success(data) { + data.forEach(function (provider) { + var checked = ""; + if (provider.active) { + checked = "checked"; + } + var $provider_button = + ''; + $("#metadata_provider").append($provider_button); + }); + }, + }); + } + + $(document).on("change", ".pill", function () { + var element = $(this); + var id = element.data("control"); + var initial = element.data("initial"); + var val = element.prop("checked"); + var params = { id: id, value: val }; + if (!initial) { + params["initial"] = initial; + params["query"] = keyword; + } + $.ajax({ + method: "post", + contentType: "application/json; charset=utf-8", + dataType: "json", + url: getPath() + "/metadata/provider/" + id, + data: JSON.stringify(params), + success: function success(data) { + element.data("initial", "true"); + data.forEach(function (book, idx) { + var $book = $(templates.bookResult({ book: book, index: idx })); + $book.find("button").on("click", function () { + populateForm(book, idx); + }); + $("#book-list").append($book); + }); + }, + }); + }); + + $("#meta-search").on("submit", function (e) { + e.preventDefault(); + keyword = $("#keyword").val(); + $(".pill").each(function () { + $(this).data("initial", $(this).prop("checked")); + }); + doSearch(keyword); + }); + + $("#get_meta").click(function () { + populate_provider(); + var bookTitle = $("#title").val(); + $("#keyword").val(bookTitle); + keyword = bookTitle; + doSearch(bookTitle); + }); + $("#metaModal").on("show.bs.modal", function (e) { + $(e.relatedTarget).one("focus", function (e) { + $(this).blur(); + }); + }); +}); diff --git a/root/app/calibre-web/cps/static/user-profile-data/CWA-profile-updater.js b/root/app/calibre-web/cps/static/user-profile-data/CWA-profile-updater.js new file mode 100644 index 0000000..dd49c12 --- /dev/null +++ b/root/app/calibre-web/cps/static/user-profile-data/CWA-profile-updater.js @@ -0,0 +1,21 @@ +fetch('/user_profiles.json') + .then(response => response.json()) + .then(usernameToImage => { + var usernameElement = document.querySelector('#top_user .hidden-sm'); + if (usernameElement) { + var username = usernameElement.textContent.trim(); + + if (usernameToImage[username]) { + var style = document.createElement('style'); + style.innerHTML = ` + .profileDrop > span:before { + background-image: url(${usernameToImage[username]}) !important; + } + body.me > div.container-fluid > div.row-fluid > div.col-sm-10:before { + background-image: url(${usernameToImage[username]}) !important; + } + `; + document.head.appendChild(style); + } + } + }); diff --git a/root/app/calibre-web/cps/templates/admin.html b/root/app/calibre-web/cps/templates/admin.html index bf3d490..957862b 100644 --- a/root/app/calibre-web/cps/templates/admin.html +++ b/root/app/calibre-web/cps/templates/admin.html @@ -51,6 +51,7 @@ {{_('Edit Users')}} {% endif %} {{_('Add New User')}} + {{ _('Manage Profile Pictures') }} {% if (config.config_login_type == 1) %}
{{ _('Description:') }}
+ {{ entry.comments[0].text|safe }} +