Code cosmetics
This commit is contained in:
parent
0be17ed157
commit
0224d45961
|
@ -1,9 +1,26 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# import logging
|
# This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
|
||||||
# from logging.handlers import SMTPHandler, RotatingFileHandler
|
# Copyright (C) 2018-2019 OzzieIsaacs, cervinko, jkrehm, bodybybuddha, ok11,
|
||||||
# import os
|
# andy29485, idalin, Kyosfonica, wuqi, Kennyl, lemmsh,
|
||||||
|
# falgh1, grunjol, csitko, ytils, xybydy, trasba, vrabe,
|
||||||
|
# ruben-herold, marblepebble, JackED42, SiphonSquirrel,
|
||||||
|
# apetresc, nanu-c, mutschler
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import mimetypes
|
import mimetypes
|
||||||
from flask import Flask, request, g
|
from flask import Flask, request, g
|
||||||
from flask_login import LoginManager
|
from flask_login import LoginManager
|
||||||
|
|
|
@ -39,10 +39,9 @@ from gdriveutils import is_gdrive_ready, gdrive_support, downloadFile, deleteDat
|
||||||
import helper
|
import helper
|
||||||
from werkzeug.security import generate_password_hash
|
from werkzeug.security import generate_password_hash
|
||||||
try:
|
try:
|
||||||
from urllib.parse import quote
|
|
||||||
from imp import reload
|
from imp import reload
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from urllib import quote
|
pass
|
||||||
|
|
||||||
feature_support = dict()
|
feature_support = dict()
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
/* This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
|
||||||
|
* Copyright (C) 2018 OzzieIsaacs
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
var direction = 0; // Descending order
|
var direction = 0; // Descending order
|
||||||
|
|
||||||
|
@ -8,7 +24,6 @@ $("#desc").click(function() {
|
||||||
var list = $('#list');
|
var list = $('#list');
|
||||||
var listItems = list.children(".row");
|
var listItems = list.children(".row");
|
||||||
list.append(listItems.get().reverse());
|
list.append(listItems.get().reverse());
|
||||||
console.log("desc")
|
|
||||||
direction = 0;
|
direction = 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -17,10 +32,9 @@ $("#asc").click(function() {
|
||||||
if (direction === 1) {
|
if (direction === 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var list = $('#list');
|
var list = $("#list");
|
||||||
var listItems = list.children(".row");
|
var listItems = list.children(".row");
|
||||||
list.append(listItems.get().reverse());
|
list.append(listItems.get().reverse());
|
||||||
console.log("asc")
|
|
||||||
direction = 1;
|
direction = 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -31,12 +45,10 @@ $("#all").click(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".char").click(function() {
|
$(".char").click(function() {
|
||||||
console.log(this.innerText);
|
|
||||||
var character = this.innerText;
|
var character = this.innerText;
|
||||||
// var listItems = ;
|
|
||||||
|
|
||||||
$(".row").each(function() {
|
$(".row").each(function() {
|
||||||
if (this.attributes['data-id'].value.charAt(0).toUpperCase() !== character) {
|
if (this.attributes["data-id"].value.charAt(0).toUpperCase() !== character) {
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
} else {
|
} else {
|
||||||
$(this).show();
|
$(this).show();
|
||||||
|
|
|
@ -35,9 +35,9 @@ $(document).on("change","select[data-control]", function(){
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var name = $this.data("control");
|
var name = $this.data("control");
|
||||||
var showOrHide = $this.val();
|
var showOrHide = $this.val();
|
||||||
var showOrHideLast = $("#"+name + " option:last").val()
|
// var showOrHideLast = $("#" + name + " option:last").val()
|
||||||
for (i = 0; i < $(this)[0].length; i++){
|
for (var i = 0; i < $(this)[0].length; i++) {
|
||||||
if (parseInt($(this)[0][i].value) == showOrHide){
|
if (parseInt($(this)[0][i].value) === showOrHide) {
|
||||||
$("[data-related=\"" + name + "-" + i + "\"]").show();
|
$("[data-related=\"" + name + "-" + i + "\"]").show();
|
||||||
} else {
|
} else {
|
||||||
$("[data-related=\"" + name + "-" + i + "\"]").hide();
|
$("[data-related=\"" + name + "-" + i + "\"]").hide();
|
||||||
|
@ -110,7 +110,7 @@ $(function() {
|
||||||
//animate : true, # ToDo: Reenable function
|
//animate : true, # ToDo: Reenable function
|
||||||
//extraScrollPx: 300
|
//extraScrollPx: 300
|
||||||
});
|
});
|
||||||
$loadMore.on( 'append.infiniteScroll', function( event, response, path, data ) {
|
$loadMore.on( "append.infiniteScroll", function( event, response, path, data ) {
|
||||||
$(".pagination").addClass("hidden");
|
$(".pagination").addClass("hidden");
|
||||||
$(".load-more .row").isotope( "appended", $(data), null );
|
$(".load-more .row").isotope( "appended", $(data), null );
|
||||||
});
|
});
|
||||||
|
|
|
@ -27,7 +27,7 @@ $(function() {
|
||||||
async: true,
|
async: true,
|
||||||
timeout: 900,
|
timeout: 900,
|
||||||
success:function(data){
|
success:function(data){
|
||||||
$('#domain-table').bootstrapTable("load", data);
|
$("#domain-table"").bootstrapTable("load", data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -65,11 +65,11 @@ $(function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function TableActions (value, row, index) {
|
/*function TableActions (value, row, index) {
|
||||||
return [
|
return [
|
||||||
"<a class=\"danger remove\" data-toggle=\"modal\" data-target=\"#DeleteDomain\" data-domain-id=\"" + row.id
|
"<a class=\"danger remove\" data-toggle=\"modal\" data-target=\"#DeleteDomain\" data-domain-id=\"" + row.id
|
||||||
+ "\" title=\"Remove\">",
|
+ "\" title=\"Remove\">",
|
||||||
"<i class=\"glyphicon glyphicon-trash\"></i>",
|
"<i class=\"glyphicon glyphicon-trash\"></i>",
|
||||||
"</a>"
|
"</a>"
|
||||||
].join("");
|
].join("");
|
||||||
}
|
}*/
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
* Version 1.0.0
|
* Version 1.0.0
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function($) {
|
(function($) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
@ -57,13 +58,13 @@
|
||||||
|
|
||||||
// Translate texts
|
// Translate texts
|
||||||
this.$modalTitle.text(this.options.modalTitle)
|
this.$modalTitle.text(this.options.modalTitle)
|
||||||
this.$modalFooter.children("button").text(this.options.modalFooter)
|
this.$modalFooter.children("button").text(this.options.modalFooter);
|
||||||
|
|
||||||
this.$modal.on("hidden.bs.modal", $.proxy(this.reset, this));
|
this.$modal.on("hidden.bs.modal", $.proxy(this.reset, this));
|
||||||
},
|
},
|
||||||
|
|
||||||
reset: function() {
|
reset: function() {
|
||||||
this.$modalTitle.text(this.options.modalTitle)
|
this.$modalTitle.text(this.options.modalTitle);
|
||||||
this.$modalFooter.hide();
|
this.$modalFooter.hide();
|
||||||
this.$modalBar.addClass("progress-bar-success");
|
this.$modalBar.addClass("progress-bar-success");
|
||||||
this.$modalBar.removeClass("progress-bar-danger");
|
this.$modalBar.removeClass("progress-bar-danger");
|
||||||
|
@ -103,7 +104,7 @@
|
||||||
// HTTP 500 ends up here!?!
|
// HTTP 500 ends up here!?!
|
||||||
return this.error(xhr);
|
return this.error(xhr);
|
||||||
}
|
}
|
||||||
this.set_progress(100);
|
this.setProgress(100);
|
||||||
var url;
|
var url;
|
||||||
var contentType = xhr.getResponseHeader("Content-Type");
|
var contentType = xhr.getResponseHeader("Content-Type");
|
||||||
|
|
||||||
|
@ -132,25 +133,25 @@
|
||||||
// Replace the contents of the form, with the returned html
|
// Replace the contents of the form, with the returned html
|
||||||
if (xhr.status === 422) {
|
if (xhr.status === 422) {
|
||||||
var newHtml = $.parseHTML(xhr.responseText);
|
var newHtml = $.parseHTML(xhr.responseText);
|
||||||
this.replace_form(newHtml);
|
this.replaceForrm(newHtml);
|
||||||
this.$modal.modal("hide");
|
this.$modal.modal("hide");
|
||||||
}
|
}
|
||||||
// Write the error response to the document.
|
// Write the error response to the document.
|
||||||
else{
|
else{
|
||||||
var responseText = xhr.responseText;
|
|
||||||
// Handle no response error
|
// Handle no response error
|
||||||
if (contentType) {
|
if (contentType) {
|
||||||
|
var responseText = xhr.responseText;
|
||||||
if (contentType.indexOf("text/plain") !== -1) {
|
if (contentType.indexOf("text/plain") !== -1) {
|
||||||
responseText = "<pre>" + responseText + "</pre>";
|
responseText = "<pre>" + responseText + "</pre>";
|
||||||
}
|
}
|
||||||
document.write(xhr.responseText);
|
document.write(responseText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
set_progress: function(percent){
|
setProgress: function(percent) {
|
||||||
var txt = percent + "%";
|
var txt = percent + "%";
|
||||||
if (percent == 100) {
|
if (percent === 100) {
|
||||||
txt = this.options.uploadedMsg;
|
txt = this.options.uploadedMsg;
|
||||||
}
|
}
|
||||||
this.$modalBar.attr("aria-valuenow", percent);
|
this.$modalBar.attr("aria-valuenow", percent);
|
||||||
|
@ -160,19 +161,18 @@
|
||||||
|
|
||||||
progress: function(/*ProgressEvent*/e) {
|
progress: function(/*ProgressEvent*/e) {
|
||||||
var percent = Math.round((e.loaded / e.total) * 100);
|
var percent = Math.round((e.loaded / e.total) * 100);
|
||||||
this.set_progress(percent);
|
this.setProgress(percent);
|
||||||
},
|
},
|
||||||
|
|
||||||
// replace_form replaces the contents of the current form
|
// replaceForm replaces the contents of the current form
|
||||||
// with the form in the html argument.
|
// with the form in the html argument.
|
||||||
// We use the id of the current form to find the new form in the html
|
// We use the id of the current form to find the new form in the html
|
||||||
replace_form: function(html) {
|
replaceForm: function(html) {
|
||||||
var newForm;
|
var newForm;
|
||||||
var formId = this.$form.attr("id");
|
var formId = this.$form.attr("id");
|
||||||
if(formId !== undefined){
|
if (typeof(formId) !== "undefined") {
|
||||||
newForm = $(html).find("#" + formId);
|
newForm = $(html).find("#" + formId);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
newForm = $(html).find("form");
|
newForm = $(html).find("form");
|
||||||
}
|
}
|
||||||
// add the filestyle again
|
// add the filestyle again
|
||||||
|
@ -181,11 +181,11 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$.fn.uploadprogress = function(options, value){
|
$.fn.uploadprogress = function(options) {
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
var _options = $.extend({}, $.fn.uploadprogress.defaults, options);
|
var _options = $.extend({}, $.fn.uploadprogress.defaults, options);
|
||||||
var file_progress = new UploadProgress(this, _options);
|
var fileProgress = new UploadProgress(this, _options);
|
||||||
file_progress.constructor();
|
fileProgress.constructor();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
from tempfile import gettempdir
|
from tempfile import gettempdir
|
||||||
import hashlib
|
import hashlib
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
import logging
|
|
||||||
import os
|
import os
|
||||||
from flask_babel import gettext as _
|
from flask_babel import gettext as _
|
||||||
import comic
|
import comic
|
||||||
|
@ -31,7 +30,6 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
lxmlversion = None
|
lxmlversion = None
|
||||||
|
|
||||||
# logger = logging.getLogger("uploader")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from wand.image import Image
|
from wand.image import Image
|
||||||
|
|
Loading…
Reference in New Issue
Block a user