Code cosmetics

This commit is contained in:
Ozzieisaacs 2019-03-04 20:03:09 +01:00
parent 0be17ed157
commit 0224d45961
7 changed files with 69 additions and 43 deletions

View File

@ -1,9 +1,26 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# import logging
# from logging.handlers import SMTPHandler, RotatingFileHandler
# import os
# This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
# Copyright (C) 2018-2019 OzzieIsaacs, cervinko, jkrehm, bodybybuddha, ok11,
# 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
from flask import Flask, request, g
from flask_login import LoginManager

View File

@ -39,10 +39,9 @@ from gdriveutils import is_gdrive_ready, gdrive_support, downloadFile, deleteDat
import helper
from werkzeug.security import generate_password_hash
try:
from urllib.parse import quote
from imp import reload
except ImportError:
from urllib import quote
pass
feature_support = dict()
try:

View File

@ -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
@ -8,7 +24,6 @@ $("#desc").click(function() {
var list = $('#list');
var listItems = list.children(".row");
list.append(listItems.get().reverse());
console.log("desc")
direction = 0;
});
@ -17,10 +32,9 @@ $("#asc").click(function() {
if (direction === 1) {
return;
}
var list = $('#list');
var list = $("#list");
var listItems = list.children(".row");
list.append(listItems.get().reverse());
console.log("asc")
direction = 1;
});
@ -31,12 +45,10 @@ $("#all").click(function() {
});
$(".char").click(function() {
console.log(this.innerText);
var character = this.innerText;
// var listItems = ;
$(".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();
} else {
$(this).show();

View File

@ -31,13 +31,13 @@ $(document).on("change", "input[type=\"checkbox\"][data-control]", function () {
// Generic control/related handler to show/hide fields based on a select' value
$(document).on("change","select[data-control]", function(){
$(document).on("change", "select[data-control]", function() {
var $this = $(this);
var name = $this.data("control");
var showOrHide = $this.val();
var showOrHideLast = $("#"+name + " option:last").val()
for (i = 0; i < $(this)[0].length; i++){
if (parseInt($(this)[0][i].value) == showOrHide){
// var showOrHideLast = $("#" + name + " option:last").val()
for (var i = 0; i < $(this)[0].length; i++) {
if (parseInt($(this)[0][i].value) === showOrHide) {
$("[data-related=\"" + name + "-" + i + "\"]").show();
} else {
$("[data-related=\"" + name + "-" + i + "\"]").hide();
@ -110,7 +110,7 @@ $(function() {
//animate : true, # ToDo: Reenable function
//extraScrollPx: 300
});
$loadMore.on( 'append.infiniteScroll', function( event, response, path, data ) {
$loadMore.on( "append.infiniteScroll", function( event, response, path, data ) {
$(".pagination").addClass("hidden");
$(".load-more .row").isotope( "appended", $(data), null );
});
@ -141,7 +141,7 @@ $(function() {
var buttonText = $this.html();
$this.html("...");
$("#update_error").addClass("hidden");
if ($("#message").length){
if ($("#message").length) {
$("#message").alert("close");
}
$.ajax({

View File

@ -27,15 +27,15 @@ $(function() {
async: true,
timeout: 900,
success:function(data){
$('#domain-table').bootstrapTable("load", data);
$("#domain-table"").bootstrapTable("load", data);
}
});
});
$("#domain-table").bootstrapTable({
formatNoMatches: function () {
return "";
},
striped: false
},
striped: false
});
$("#btndeletedomain").click(function() {
//get data-id attribute of the clicked element
@ -51,7 +51,7 @@ $(function() {
url: window.location.pathname + "/../../ajax/domainlist",
async: true,
timeout: 900,
success:function(data){
success:function(data) {
$("#domain-table").bootstrapTable("load", data);
}
});
@ -65,11 +65,11 @@ $(function() {
});
});
function TableActions (value, row, index) {
/*function TableActions (value, row, index) {
return [
"<a class=\"danger remove\" data-toggle=\"modal\" data-target=\"#DeleteDomain\" data-domain-id=\"" + row.id
+ "\" title=\"Remove\">",
"<i class=\"glyphicon glyphicon-trash\"></i>",
"</a>"
].join("");
}
}*/

View File

@ -6,6 +6,7 @@
* Version 1.0.0
* Licensed under the MIT license.
*/
(function($) {
"use strict";
@ -57,13 +58,13 @@
// Translate texts
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));
},
reset: function() {
this.$modalTitle.text(this.options.modalTitle)
this.$modalTitle.text(this.options.modalTitle);
this.$modalFooter.hide();
this.$modalBar.addClass("progress-bar-success");
this.$modalBar.removeClass("progress-bar-danger");
@ -103,7 +104,7 @@
// HTTP 500 ends up here!?!
return this.error(xhr);
}
this.set_progress(100);
this.setProgress(100);
var url;
var contentType = xhr.getResponseHeader("Content-Type");
@ -132,25 +133,25 @@
// Replace the contents of the form, with the returned html
if (xhr.status === 422) {
var newHtml = $.parseHTML(xhr.responseText);
this.replace_form(newHtml);
this.replaceForrm(newHtml);
this.$modal.modal("hide");
}
// Write the error response to the document.
else{
var responseText = xhr.responseText;
// Handle no response error
if (contentType) {
var responseText = xhr.responseText;
if (contentType.indexOf("text/plain") !== -1) {
responseText = "<pre>" + responseText + "</pre>";
}
document.write(xhr.responseText);
document.write(responseText);
}
}
},
set_progress: function(percent){
setProgress: function(percent) {
var txt = percent + "%";
if (percent == 100) {
if (percent === 100) {
txt = this.options.uploadedMsg;
}
this.$modalBar.attr("aria-valuenow", percent);
@ -158,21 +159,20 @@
this.$modalBar.css("width", percent + "%");
},
progress: function(/*ProgressEvent*/e){
progress: function(/*ProgressEvent*/e) {
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.
// 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 formId = this.$form.attr("id");
if(formId !== undefined){
if (typeof(formId) !== "undefined") {
newForm = $(html).find("#" + formId);
}
else{
} else {
newForm = $(html).find("form");
}
// add the filestyle again
@ -181,11 +181,11 @@
}
};
$.fn.uploadprogress = function(options, value){
$.fn.uploadprogress = function(options) {
return this.each(function() {
var _options = $.extend({}, $.fn.uploadprogress.defaults, options);
var file_progress = new UploadProgress(this, _options);
file_progress.constructor();
var fileProgress = new UploadProgress(this, _options);
fileProgress.constructor();
});
};

View File

@ -21,7 +21,6 @@
from tempfile import gettempdir
import hashlib
from collections import namedtuple
import logging
import os
from flask_babel import gettext as _
import comic
@ -31,7 +30,6 @@ try:
except ImportError:
lxmlversion = None
# logger = logging.getLogger("uploader")
try:
from wand.image import Image