Commit be64961d authored by Ozzieisaacs's avatar Ozzieisaacs

Code cosmetics comic reader

parent 405a3909
...@@ -24,40 +24,45 @@ ...@@ -24,40 +24,45 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. * USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
/* ******************************************************************** /* ********************************************************************
* Alphanum sort() function version - case insensitive * Alphanum sort() function version - case insensitive
* - Slower, but easier to modify for arrays of objects which contain * - Slower, but easier to modify for arrays of objects which contain
* string properties * string properties
* *
*/ */
/* exported alphanumCase */
function alphanumCase(a, b) { function alphanumCase(a, b) {
function chunkify(t) { function chunkify(t) {
var tz = new Array(); var tz = new Array();
var x = 0, y = -1, n = 0, i, j; var x = 0, y = -1, n = 0, i, j;
while (i = (j = t.charAt(x++)).charCodeAt(0)) { while (i = (j = t.charAt(x++)).charCodeAt(0)) {
var m = (i == 46 || (i >=48 && i <= 57)); var m = (i === 46 || (i >= 48 && i <= 57));
if (m !== n) { if (m !== n) {
tz[++y] = ""; tz[++y] = "";
n = m; n = m;
} }
tz[y] += j; tz[y] += j;
}
return tz;
} }
return tz;
} var aa = chunkify(a.filename.toLowerCase());
var bb = chunkify(b.filename.toLowerCase());
var aa = chunkify(a.filename.toLowerCase());
var bb = chunkify(b.filename.toLowerCase()); for (var x = 0; aa[x] && bb[x]; x++) {
if (aa[x] !== bb[x]) {
for (x = 0; aa[x] && bb[x]; x++) { var c = Number(aa[x]), d = Number(bb[x]);
if (aa[x] !== bb[x]) { if (c === aa[x] && d === bb[x]) {
var c = Number(aa[x]), d = Number(bb[x]); return c - d;
if (c == aa[x] && d == bb[x]) { } else {
return c - d; return (aa[x] > bb[x]) ? 1 : -1;
} else return (aa[x] > bb[x]) ? 1 : -1; }
}
} }
} return aa.length - bb.length;
return aa.length - bb.length;
} }
// =========================================================================== // ===========================================================================
......
This diff is collapsed.
...@@ -46,19 +46,19 @@ function init(logType) { ...@@ -46,19 +46,19 @@ function init(logType) {
}; };
r.send();*/ r.send();*/
$.ajax({ $.ajax({
url: "/ajax/log/" + logType, url: "/ajax/log/" + logType,
datatype: 'text', datatype: "text",
cache: false cache: false
}) })
.done( function(data) { .done( function(data) {
var text; var text;
$("#renderer").text(""); $("#renderer").text("");
text = (data).split("\n"); text = (data).split("\n");
console.log(text.length); // console.log(text.length);
for (var i = 0; i < text.length; i++) { for (var i = 0; i < text.length; i++) {
$("#renderer").append( "<div>" + _sanitize(text[i]) + "</div>" ); $("#renderer").append( "<div>" + _sanitize(text[i]) + "</div>" );
} }
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment