From: Jan Schneider Date: Wed, 18 Feb 2009 10:21:32 +0000 (+0100) Subject: Merge from DIMP, fix syntax. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=36b5a207085ad95aa4582e44d41c8e4435e9629b;p=horde.git Merge from DIMP, fix syntax. --- diff --git a/kronolith/js/src/kronolith.js b/kronolith/js/src/kronolith.js index cfe6fcce3..5f1502497 100644 --- a/kronolith/js/src/kronolith.js +++ b/kronolith/js/src/kronolith.js @@ -1007,15 +1007,18 @@ Element.addMethods({ /* Create some utility functions. */ Object.extend(Array.prototype, { + // Need our own diff() function because prototypejs's without() function + // does not handle array input. + diff: function(values) + { + return this.select(function(value) { + return !values.include(value); + }); + }, numericSort: function() { - return this.sort(function(a, b) { - if (a > b) { - return 1; - } else if (a < b) { - return -1; - } - return 0; + return this.collect(Number).sort(function(a,b) { + return (a > b) ? 1 : ((a < b) ? -1 : 0); }); } }); @@ -1076,7 +1079,7 @@ Object.extend(Date.prototype, { * * @return string Date and time. */ - dateString() + dateString: function() { return this.toString('yyyyMMdd'); }