1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-10-26 12:57:40 +00:00

Merge branch 'master' into Develop

# Conflicts:
#	cps/static/css/style.css
#	cps/web.py
This commit is contained in:
Ozzieisaacs
2021-11-13 17:41:16 +04:00
74 changed files with 4045 additions and 3404 deletions

View File

@@ -21,47 +21,59 @@ var $list = $("#list").isotope({
itemSelector: ".book",
layoutMode: "fitRows",
getSortData: {
title: ".title",
}
title: ".title"
},
});
$("#desc").click(function() {
if (direction === 0) {
return;
}
$("#asc").removeClass("active");
$("#desc").addClass("active");
var page = $(this).data("id");
$.ajax({
method:"post",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: window.location.pathname + "/../../ajax/view",
url: getPath() + "/ajax/view",
data: "{\"" + page + "\": {\"dir\": \"desc\"}}",
});
// invert sorting order to make already inverted start order working
$list.isotope({
sortBy: "name",
sortAscending: true
sortAscending: !$list.data('isotope').options.sortAscending
});
direction = 0;
});
$("#asc").click(function() {
if (direction === 1) {
return;
}
$("#desc").removeClass("active");
$("#asc").addClass("active");
var page = $(this).data("id");
$.ajax({
method:"post",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: window.location.pathname + "/../../ajax/view",
url: getPath() + "/ajax/view",
data: "{\"" + page + "\": {\"dir\": \"asc\"}}",
});
$list.isotope({
sortBy: "name",
sortAscending: false
sortAscending: !$list.data('isotope').options.sortAscending
});
direction = 1;
});
$("#all").click(function() {
$(".char").removeClass("active");
$("#all").addClass("active");
// go through all elements and make them visible
$list.isotope({ filter: function() {
return true;
@@ -70,6 +82,9 @@ $("#all").click(function() {
});
$(".char").click(function() {
$(".char").removeClass("active");
$(this).addClass("active");
$("#all").removeClass("active");
var character = this.innerText;
$list.isotope({ filter: function() {
return this.attributes["data-id"].value.charAt(0).toUpperCase() === character;

View File

@@ -19,6 +19,7 @@ var direction = $("#asc").data('order'); // 0=Descending order; 1= ascending or
var sort = 0; // Show sorted entries
$("#sort_name").click(function() {
$("#sort_name").toggleClass("active");
var className = $("h1").attr("Class") + "_sort_name";
var obj = {};
obj[className] = sort;
@@ -68,12 +69,15 @@ $("#desc").click(function() {
if (direction === 0) {
return;
}
$("#asc").removeClass("active");
$("#desc").addClass("active");
var page = $(this).data("id");
$.ajax({
method:"post",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: window.location.pathname + "/../../ajax/view",
url: getPath() + "/ajax/view",
data: "{\"" + page + "\": {\"dir\": \"desc\"}}",
});
var index = 0;
@@ -112,16 +116,18 @@ $("#desc").click(function() {
$("#asc").click(function() {
if (direction === 1) {
return;
}
$("#desc").removeClass("active");
$("#asc").addClass("active");
var page = $(this).data("id");
$.ajax({
method:"post",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: window.location.pathname + "/../../ajax/view",
url: getPath() + "/ajax/view",
data: "{\"" + page + "\": {\"dir\": \"asc\"}}",
});
var index = 0;
@@ -159,6 +165,8 @@ $("#asc").click(function() {
});
$("#all").click(function() {
$("#all").addClass("active");
$(".char").removeClass("active");
var cnt = $("#second").contents();
$("#list").append(cnt);
// Find count of middle element
@@ -176,6 +184,9 @@ $("#all").click(function() {
});
$(".char").click(function() {
$(".char").removeClass("active");
$(this).addClass("active");
$("#all").removeClass("active");
var character = this.innerText;
var count = 0;
var index = 0;

View File

@@ -28,14 +28,17 @@ $(function () {
function populateForm (book) {
tinymce.get("description").setContent(book.description);
var uniqueTags = [];
var uniqueTags = $.map($("#tags").val().split(","), $.trim);
if ( uniqueTags.length == 1 && uniqueTags[0] == "") {
uniqueTags = [];
}
$.each(book.tags, function(i, el) {
if ($.inArray(el, uniqueTags) === -1) uniqueTags.push(el);
});
var ampSeparatedAuthors = (book.authors || []).join(" & ");
$("#bookAuthor").val(ampSeparatedAuthors);
$("#book_title").val(book.title);
$("#tags").val(uniqueTags.join(","));
$("#tags").val(uniqueTags.join(", "));
$("#rating").data("rating").setValue(Math.round(book.rating));
if(book.cover !== null){
$(".cover img").attr("src", book.cover);

View File

@@ -652,6 +652,9 @@ function singlecheckboxFormatter(value, row){
}
function ratingFormatter(value, row) {
if (value == 0) {
return "";
}
return (value/2);
}