Merge branch 'master' of https://github.com/janeczku/calibre-web
This commit is contained in:
@@ -84,15 +84,24 @@ body {
|
||||
#progress .bar-load,
|
||||
#progress .bar-read {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: flex-end;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
transition: width 150ms ease-in-out;
|
||||
}
|
||||
|
||||
#progress .from-left {
|
||||
left: 0;
|
||||
align-items: flex-end;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
#progress .from-right {
|
||||
right: 0;
|
||||
align-items: flex-start;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
#progress .bar-load {
|
||||
color: #000;
|
||||
background-color: #ccc;
|
||||
|
||||
+26
-8
@@ -171,7 +171,10 @@ kthoom.ImageFile = function(file) {
|
||||
|
||||
function initProgressClick() {
|
||||
$("#progress").click(function(e) {
|
||||
var page = Math.max(1, Math.ceil((e.offsetX / $(this).width()) * totalImages)) - 1;
|
||||
var offset = $(this).offset();
|
||||
var x = e.pageX - offset.left;
|
||||
var rate = settings.direction === 0 ? x / $(this).width() : 1 - x / $(this).width();
|
||||
var page = Math.max(1, Math.ceil(rate * totalImages)) - 1;
|
||||
currentImage = page;
|
||||
updatePage();
|
||||
});
|
||||
@@ -285,6 +288,22 @@ function updatePage() {
|
||||
}
|
||||
|
||||
function updateProgress(loadPercentage) {
|
||||
if (settings.direction === 0) {
|
||||
$("#progress .bar-read")
|
||||
.removeClass("from-right")
|
||||
.addClass("from-left");
|
||||
$("#progress .bar-load")
|
||||
.removeClass("from-right")
|
||||
.addClass("from-left");
|
||||
} else {
|
||||
$("#progress .bar-read")
|
||||
.removeClass("from-left")
|
||||
.addClass("from-right");
|
||||
$("#progress .bar-load")
|
||||
.removeClass("from-left")
|
||||
.addClass("from-right");
|
||||
}
|
||||
|
||||
// Set the load/unzip progress if it's passed in
|
||||
if (loadPercentage) {
|
||||
$("#progress .bar-load").css({ width: loadPercentage + "%" });
|
||||
@@ -526,18 +545,17 @@ function keyHandler(evt) {
|
||||
break;
|
||||
case kthoom.Key.SPACE:
|
||||
var container = $("#mainContent");
|
||||
var atTop = container.scrollTop() === 0;
|
||||
var atBottom = container.scrollTop() >= container[0].scrollHeight - container.height();
|
||||
// var atTop = container.scrollTop() === 0;
|
||||
// var atBottom = container.scrollTop() >= container[0].scrollHeight - container.height();
|
||||
|
||||
if (evt.shiftKey && atTop) {
|
||||
if (evt.shiftKey) {
|
||||
evt.preventDefault();
|
||||
// If it's Shift + Space and the container is at the top of the page
|
||||
showLeftPage();
|
||||
} else if (!evt.shiftKey && atBottom) {
|
||||
showPrevPage();
|
||||
} else {
|
||||
evt.preventDefault();
|
||||
// If you're at the bottom of the page and you only pressed space
|
||||
showRightPage();
|
||||
container.scrollTop(0);
|
||||
showNextPage();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -114,6 +114,20 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
$(".session").click(function() {
|
||||
window.sessionStorage.setItem("back", window.location.pathname);
|
||||
});
|
||||
|
||||
$("#back").click(function() {
|
||||
var loc = sessionStorage.getItem("back");
|
||||
if (!loc) {
|
||||
loc = $(this).data("back");
|
||||
}
|
||||
sessionStorage.removeItem("back");
|
||||
window.location.href = loc;
|
||||
|
||||
});
|
||||
|
||||
function confirmDialog(id, dialogid, dataValue, yesFn, noFn) {
|
||||
var $confirm = $("#" + dialogid);
|
||||
$confirm.modal('show');
|
||||
|
||||
+93
-90
@@ -177,7 +177,6 @@ $(function() {
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
$("#domain_allow_submit").click(function(event) {
|
||||
event.preventDefault();
|
||||
$("#domain_add_allow").ajaxForm();
|
||||
@@ -388,7 +387,6 @@ $(function() {
|
||||
var target = $(e.relatedTarget).attr('id');
|
||||
var dataId;
|
||||
$(e.relatedTarget).one('focus', function(e){$(this).blur();});
|
||||
//$(e.relatedTarget).blur();
|
||||
if ($(e.relatedTarget).hasClass("button_head")) {
|
||||
dataId = $('#user-table').bootstrapTable('getSelections').map(a => a.id);
|
||||
} else {
|
||||
@@ -454,18 +452,28 @@ $(function() {
|
||||
$(this).next().text(elText);
|
||||
});
|
||||
},
|
||||
onLoadSuccess: function () {
|
||||
var guest = $(".editable[data-name='name'][data-value='Guest']");
|
||||
guest.editable("disable");
|
||||
$(".editable[data-name='locale'][data-pk='"+guest.data("pk")+"']").editable("disable");
|
||||
$("input[data-name='admin_role'][data-pk='"+guest.data("pk")+"']").prop("disabled", true);
|
||||
$("input[data-name='passwd_role'][data-pk='"+guest.data("pk")+"']").prop("disabled", true);
|
||||
$("input[data-name='edit_shelf_role'][data-pk='"+guest.data("pk")+"']").prop("disabled", true);
|
||||
$("input[data-name='sidebar_read_and_unread'][data-pk='"+guest.data("pk")+"']").prop("disabled", true);
|
||||
$(".user-remove[data-pk='"+guest.data("pk")+"']").hide();
|
||||
onPostHeader () {
|
||||
deactivateHeaderButtons();
|
||||
},
|
||||
onSort: function(a, b) {
|
||||
console.log("huh");
|
||||
onLoadSuccess: function () {
|
||||
loadSuccess();
|
||||
var element = $(".header_select");
|
||||
element.each(function() {
|
||||
var item = $(this).parent();
|
||||
var parent = item.parent().parent();
|
||||
if (parent.prop('nodeName') === "TH") {
|
||||
item.prependTo(parent);
|
||||
}
|
||||
});
|
||||
var element = $(".form-check");
|
||||
element.each(function() {
|
||||
var item = $(this).parent();
|
||||
var parent = item.parent().parent();
|
||||
if (parent.prop('nodeName') === "TH") {
|
||||
item.prependTo(parent);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
onColumnSwitch: function () {
|
||||
var visible = $("#user-table").bootstrapTable("getVisibleColumns");
|
||||
@@ -491,7 +499,18 @@ $(function() {
|
||||
$("#user_delete_selection").click(function() {
|
||||
$("#user-table").bootstrapTable("uncheckAll");
|
||||
});
|
||||
|
||||
$("#select_locale").on("change",function() {
|
||||
selectHeader(this, "locale");
|
||||
});
|
||||
$("#select_default_language").on("change",function() {
|
||||
selectHeader(this, "default_language");
|
||||
});
|
||||
$(".check_head").on("change",function() {
|
||||
var val = $(this).val() === "on";
|
||||
var name = $(this).data("name");
|
||||
var data = $(this).data("val");
|
||||
checkboxHeader(val, name, data);
|
||||
});
|
||||
function user_handle (userId) {
|
||||
$.ajax({
|
||||
method:"post",
|
||||
@@ -505,6 +524,7 @@ $(function() {
|
||||
timeout: 900,
|
||||
success:function(data) {
|
||||
$("#user-table").bootstrapTable("load", data);
|
||||
loadSuccess();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -560,10 +580,6 @@ function TableActions (value, row) {
|
||||
].join("");
|
||||
}
|
||||
|
||||
function editEntry(param)
|
||||
{
|
||||
console.log(param);
|
||||
}
|
||||
/* Function for deleting domain restrictions */
|
||||
function RestrictionActions (value, row) {
|
||||
return [
|
||||
@@ -582,7 +598,7 @@ function EbookActions (value, row) {
|
||||
].join("");
|
||||
}
|
||||
|
||||
/* Function for deleting books */
|
||||
/* Function for deleting Users */
|
||||
function UserActions (value, row) {
|
||||
return [
|
||||
"<div class=\"user-remove\" data-value=\"delete\" onclick=\"deleteUser(this, '" + row.id + "')\" data-pk=\"" + row.id + "\" title=\"Remove\">",
|
||||
@@ -600,7 +616,7 @@ function responseHandler(res) {
|
||||
}
|
||||
|
||||
function singleUserFormatter(value, row) {
|
||||
return '<a class="btn btn-default" href="' + window.location.pathname + '/../../admin/user/' + row.id + '">' + this.buttontext + '</a>'
|
||||
return '<a class="btn btn-default" onclick="storeLocation()" href="' + window.location.pathname + '/../../admin/user/' + row.id + '">' + this.buttontext + '</a>'
|
||||
}
|
||||
|
||||
function checkboxFormatter(value, row, index){
|
||||
@@ -610,33 +626,55 @@ function checkboxFormatter(value, row, index){
|
||||
return '<input type="checkbox" class="chk" data-pk="' + row.id + '" data-name="' + this.field + '" onchange="checkboxChange(this, ' + row.id + ', \'' + this.name + '\', ' + this.column + ')">';
|
||||
}
|
||||
|
||||
function loadSuccess() {
|
||||
var guest = $(".editable[data-name='name'][data-value='Guest']");
|
||||
guest.editable("disable");
|
||||
$(".editable[data-name='locale'][data-pk='"+guest.data("pk")+"']").editable("disable");
|
||||
$(".editable[data-name='locale'][data-pk='"+guest.data("pk")+"']").hide();
|
||||
$("input[data-name='admin_role'][data-pk='"+guest.data("pk")+"']").prop("disabled", true);
|
||||
$("input[data-name='passwd_role'][data-pk='"+guest.data("pk")+"']").prop("disabled", true);
|
||||
$("input[data-name='edit_shelf_role'][data-pk='"+guest.data("pk")+"']").prop("disabled", true);
|
||||
$("input[data-name='sidebar_read_and_unread'][data-pk='"+guest.data("pk")+"']").prop("disabled", true);
|
||||
$(".user-remove[data-pk='"+guest.data("pk")+"']").hide();
|
||||
}
|
||||
|
||||
function handleListServerResponse (data, disableButtons) {
|
||||
$("#flash_success").remove();
|
||||
$("#flash_danger").remove();
|
||||
if (!jQuery.isEmptyObject(data)) {
|
||||
$( ".navbar" ).after( '<div class="row-fluid text-center" style="margin-top: -20px;">' +
|
||||
'<div id="flash_'+data.type+'" class="alert alert-'+data.type+'">'+data.message+'</div>' +
|
||||
'</div>');
|
||||
}
|
||||
$.ajax({
|
||||
method: "get",
|
||||
url: window.location.pathname + "/../../ajax/listusers",
|
||||
async: true,
|
||||
timeout: 900,
|
||||
success: function (data) {
|
||||
$("#user-table").bootstrapTable("load", data);
|
||||
if (disableButtons) {
|
||||
deactivateHeaderButtons();
|
||||
}
|
||||
loadSuccess();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function checkboxChange(checkbox, userId, field, field_index) {
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: window.location.pathname + "/../../ajax/editlistusers/" + field,
|
||||
data: {"pk": userId, "field_index": field_index, "value": checkbox.checked},
|
||||
success: function (data) {
|
||||
if (!jQuery.isEmptyObject(data)) {
|
||||
$("#flash_success").remove();
|
||||
$("#flash_danger").remove();
|
||||
$( ".navbar" ).after( '<div class="row-fluid text-center" style="margin-top: -20px;">' +
|
||||
'<div id="flash_'+data.type+'" class="alert alert-'+data.type+'">'+data.message+'</div>' +
|
||||
'</div>');
|
||||
}
|
||||
$.ajax({
|
||||
method: "get",
|
||||
url: window.location.pathname + "/../../ajax/listusers",
|
||||
async: true,
|
||||
timeout: 900,
|
||||
success: function (data) {
|
||||
$("#user-table").bootstrapTable("load", data);
|
||||
}
|
||||
});
|
||||
}
|
||||
error: function(data) {
|
||||
handleListServerResponse({type:"danger", message:data.responseText})
|
||||
},
|
||||
success: handleListServerResponse
|
||||
});
|
||||
}
|
||||
|
||||
function deactivateHeaderButtons(e) {
|
||||
function deactivateHeaderButtons() {
|
||||
$("#user_delete_selection").addClass("disabled");
|
||||
$("#user_delete_selection").attr("aria-disabled", true);
|
||||
$(".check_head").attr("aria-disabled", true);
|
||||
@@ -655,18 +693,10 @@ function selectHeader(element, field) {
|
||||
method: "post",
|
||||
url: window.location.pathname + "/../../ajax/editlistusers/" + field,
|
||||
data: {"pk": result, "value": element.value},
|
||||
success: function () {
|
||||
$.ajax({
|
||||
method: "get",
|
||||
url: window.location.pathname + "/../../ajax/listusers",
|
||||
async: true,
|
||||
timeout: 900,
|
||||
success: function (data) {
|
||||
$("#user-table").bootstrapTable("load", data);
|
||||
deactivateHeaderButtons();
|
||||
}
|
||||
});
|
||||
}
|
||||
error: function (data) {
|
||||
handleListServerResponse({type:"danger", message:data.responseText})
|
||||
},
|
||||
success: handleListServerResponse,
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -679,25 +709,12 @@ function checkboxHeader(CheckboxState, field, field_index) {
|
||||
method: "post",
|
||||
url: window.location.pathname + "/../../ajax/editlistusers/" + field,
|
||||
data: {"pk": result, "field_index": field_index, "value": CheckboxState},
|
||||
success: function () {
|
||||
$.ajax({
|
||||
method: "get",
|
||||
url: window.location.pathname + "/../../ajax/listusers",
|
||||
async: true,
|
||||
timeout: 900,
|
||||
success: function (data) {
|
||||
$("#user-table").bootstrapTable("load", data);
|
||||
$("#user_delete_selection").addClass("disabled");
|
||||
$("#user_delete_selection").attr("aria-disabled", true);
|
||||
$(".check_head").attr("aria-disabled", true);
|
||||
$(".check_head").attr("disabled", true);
|
||||
$(".check_head").prop('checked', false);
|
||||
$(".button_head").attr("aria-disabled", true);
|
||||
$(".button_head").addClass("disabled");
|
||||
$(".header_select").attr("disabled", true);
|
||||
}
|
||||
});
|
||||
}
|
||||
error: function (data) {
|
||||
handleListServerResponse({type:"danger", message:data.responseText}, true)
|
||||
},
|
||||
success: function (data) {
|
||||
handleListServerResponse (data, true)
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -712,24 +729,10 @@ function deleteUser(a,b){
|
||||
method:"post",
|
||||
url: window.location.pathname + "/../../ajax/deleteuser",
|
||||
data: {"userid":b},
|
||||
success:function(data) {
|
||||
$("#flash_success").remove();
|
||||
$("#flash_danger").remove();
|
||||
if (!jQuery.isEmptyObject(data)) {
|
||||
$( ".navbar" ).after( '<div class="row-fluid text-center" style="margin-top: -20px;">' +
|
||||
'<div id="flash_'+data.type+'" class="alert alert-'+data.type+'">'+data.message+'</div>' +
|
||||
'</div>');
|
||||
}
|
||||
$.ajax({
|
||||
method: "get",
|
||||
url: window.location.pathname + "/../../ajax/listusers",
|
||||
async: true,
|
||||
timeout: 900,
|
||||
success: function (data) {
|
||||
$("#user-table").bootstrapTable("load", data);
|
||||
}
|
||||
});
|
||||
}
|
||||
success: handleListServerResponse,
|
||||
error: function (data) {
|
||||
handleListServerResponse({type:"danger", message:data.responseText})
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -741,6 +744,6 @@ function queryParams(params)
|
||||
return params;
|
||||
}
|
||||
|
||||
function test(){
|
||||
console.log("hello");
|
||||
function storeLocation() {
|
||||
window.sessionStorage.setItem("back", window.location.pathname);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user