mirror of
https://github.com/janeczku/calibre-web
synced 2025-11-15 14:37:37 +00:00
Fix duplicate user and email (now case insensitive #948)
Fix sorting in comics (#950) Fix log error on Calibre converter error (#953) Fix long running tasks (#954)
This commit is contained in:
@@ -1,3 +1,67 @@
|
||||
/* alphanum.js (C) Brian Huisman
|
||||
* Based on the Alphanum Algorithm by David Koelle
|
||||
* The Alphanum Algorithm is discussed at http://www.DaveKoelle.com
|
||||
*
|
||||
* Distributed under same license as original
|
||||
*
|
||||
* Released under the MIT License - https://opensource.org/licenses/MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
/* ********************************************************************
|
||||
* Alphanum sort() function version - case insensitive
|
||||
* - Slower, but easier to modify for arrays of objects which contain
|
||||
* string properties
|
||||
*
|
||||
*/
|
||||
function alphanumCase(a, b) {
|
||||
function chunkify(t) {
|
||||
var tz = new Array();
|
||||
var x = 0, y = -1, n = 0, i, j;
|
||||
|
||||
while (i = (j = t.charAt(x++)).charCodeAt(0)) {
|
||||
var m = (i == 46 || (i >=48 && i <= 57));
|
||||
if (m !== n) {
|
||||
tz[++y] = "";
|
||||
n = m;
|
||||
}
|
||||
tz[y] += j;
|
||||
}
|
||||
return tz;
|
||||
}
|
||||
|
||||
var aa = chunkify(a.filename.toLowerCase());
|
||||
var bb = chunkify(b.filename.toLowerCase());
|
||||
|
||||
for (x = 0; aa[x] && bb[x]; x++) {
|
||||
if (aa[x] !== bb[x]) {
|
||||
var c = Number(aa[x]), d = Number(bb[x]);
|
||||
if (c == aa[x] && d == bb[x]) {
|
||||
return c - d;
|
||||
} else return (aa[x] > bb[x]) ? 1 : -1;
|
||||
}
|
||||
}
|
||||
return aa.length - bb.length;
|
||||
}
|
||||
// ===========================================================================
|
||||
|
||||
|
||||
/**
|
||||
* archive.js
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user