author | Clipperz <info@clipperz.com> | 2013-01-08 15:21:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-08 15:21:04 (UTC) |
commit | 816fc35420a434b1d54ae5833d617608f7456048 (patch) (side-by-side diff) | |
tree | 95b8caf354083593d7775e4dda6f4c556b44a2d9 /frontend/gamma/js/Clipperz/Base.js | |
parent | 267603e3aa3cf0029411e67ae14018b52344c296 (diff) | |
download | clipperz-816fc35420a434b1d54ae5833d617608f7456048.zip clipperz-816fc35420a434b1d54ae5833d617608f7456048.tar.gz clipperz-816fc35420a434b1d54ae5833d617608f7456048.tar.bz2 |
Updated version of /gamma
Tons of changes, included a new draft of the mobile version (still VERY rough)
Diffstat (limited to 'frontend/gamma/js/Clipperz/Base.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/Base.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/frontend/gamma/js/Clipperz/Base.js b/frontend/gamma/js/Clipperz/Base.js index 76b2c3f..9d399d9 100644 --- a/frontend/gamma/js/Clipperz/Base.js +++ b/frontend/gamma/js/Clipperz/Base.js @@ -16,128 +16,133 @@ refer to http://www.clipperz.com. be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. * You should have received a copy of the GNU Affero General Public License along with Clipperz Community Edition. If not, see <http://www.gnu.org/licenses/>. */ if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } if (typeof(Clipperz.Base) == 'undefined') { Clipperz.Base = {}; } Clipperz.Base.VERSION = "0.2"; Clipperz.Base.NAME = "Clipperz.Base"; MochiKit.Base.update(Clipperz.Base, { //------------------------------------------------------------------------- '__repr__': function () { return "[" + this.NAME + " " + this.VERSION + "]"; }, //------------------------------------------------------------------------- 'toString': function () { return this.__repr__(); }, //------------------------------------------------------------------------- 'itemgetter': function (aKeyPath) { // return MochiKit.Base.compose.apply(null, [MochiKit.Base.itemgetter('key3')]); return MochiKit.Base.compose.apply(null, MochiKit.Base.map( MochiKit.Base.itemgetter, MochiKit.Iter.reversed( aKeyPath.split('.') ) ) ); }, //------------------------------------------------------------------------- 'isUrl': function (aValue) { return (MochiKit.Base.urlRegExp.test(aValue)); }, 'isEmail': function (aValue) { return (MochiKit.Base.emailRegExp.test(aValue)); }, //------------------------------------------------------------------------- 'caseInsensitiveCompare': function (a, b) { return MochiKit.Base.compare(a.toLowerCase(), b.toLowerCase()); }, 'reverseComparator': function (aComparator) { return MochiKit.Base.compose(function(aResult) { return -aResult; }, aComparator); }, + 'caseInsensitiveKeyComparator': function (aKey) { + return function (a, b) { + return MochiKit.Base.compare(a[aKey].toLowerCase(), b[aKey].toLowerCase()); + } + }, //------------------------------------------------------------------------- /* 'dependsOn': function(module, deps) { if (!(module in Clipperz)) { MochiKit[module] = {}; } if (typeof(dojo) != 'undefined') { dojo.provide('Clipperz.' + module); } for (var i = 0; i < deps.length; i++) { if (typeof(dojo) != 'undefined') { dojo.require('Clipperz.' + deps[i]); } if (typeof(JSAN) != 'undefined') { JSAN.use('Clipperz.' + deps[i], []); } if (!(deps[i] in Clipperz)) { throw 'Clipperz.' + module + ' depends on Clipperz.' + deps[i] + '!' } } }, */ //------------------------------------------------------------------------- 'trim': function (aValue) { return aValue.replace(/^\s+|\s+$/g, ""); }, //------------------------------------------------------------------------- 'stringToByteArray': function (aValue) { var result; var i, c; result = []; c = aValue.length; for (i=0; i<c; i++) { result[i] = aValue.charCodeAt(i); } return result; }, //......................................................................... 'byteArrayToString': function (anArrayOfBytes) { var result; var i, c; result = ""; c = anArrayOfBytes.length; for (i=0; i<c; i++) { result += String.fromCharCode(anArrayOfBytes[i]); } return result; }, //------------------------------------------------------------------------- 'getValueForKeyInFormContent': function (aFormContent, aKey) { |