forked from 0x2620/oxjs
serialize/unserialize
This commit is contained in:
parent
5a655b3e20
commit
5ee998b263
4 changed files with 39 additions and 11 deletions
|
|
@ -96,7 +96,7 @@ Ox.user = function() {
|
|||
outerHeight: outerHeight,
|
||||
outerWidth: outerWidth
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
================================================================================
|
||||
|
|
@ -330,6 +330,14 @@ Ox.range = function(start, stop, step) {
|
|||
return range;
|
||||
};
|
||||
|
||||
Ox.serialize = function(obj) {
|
||||
var arr = [];
|
||||
Ox.each(obj, function(k, v) {
|
||||
arr.push(k + "=" + v);
|
||||
});
|
||||
return arr.join("&");
|
||||
};
|
||||
|
||||
Ox.shuffle = function(arr) {
|
||||
/*
|
||||
>>> Ox.shuffle([1, 2, 3]).length
|
||||
|
|
@ -368,6 +376,15 @@ Ox.sum = function(obj) {
|
|||
return sum;
|
||||
};
|
||||
|
||||
Ox.unserialize = function(str) {
|
||||
var arr, obj = {};
|
||||
Ox.each(str.split("&"), function(i, v) {
|
||||
arr = v.split("=");
|
||||
obj[arr[0]] = arr[1];
|
||||
});
|
||||
return obj;
|
||||
};
|
||||
|
||||
Ox.values = function(obj) {
|
||||
/*
|
||||
>>> Ox.values({"a": 1, "b": 2, "c": 3}).join(",")
|
||||
|
|
@ -1708,4 +1725,4 @@ Ox.isUndefined = function(val) {
|
|||
true
|
||||
*/
|
||||
return typeof val == "undefined";
|
||||
};
|
||||
};
|
||||
|
|
@ -3747,11 +3747,15 @@ requires
|
|||
};
|
||||
|
||||
that.disableItem = function(id) {
|
||||
|
||||
that.getItem(id).options({
|
||||
disabled: true
|
||||
});
|
||||
};
|
||||
|
||||
that.enableItem = function(id) {
|
||||
|
||||
that.getItem(id).options({
|
||||
disabled: false
|
||||
});
|
||||
};
|
||||
|
||||
that.getItem = function(id) {
|
||||
|
|
@ -3785,7 +3789,9 @@ requires
|
|||
};
|
||||
|
||||
that.uncheckItem = function(id) {
|
||||
|
||||
that.getItem(id).options({
|
||||
checked: false
|
||||
});
|
||||
};
|
||||
|
||||
return that;
|
||||
|
|
@ -4475,7 +4481,7 @@ requires
|
|||
}
|
||||
that.$status.html(value ? oxui.symbols.check : "")
|
||||
} else if (key == "disabled") {
|
||||
that.toggleClass("disabled"); // fixme: this will only work if onChange is only invoked on actual change
|
||||
that.toggleClass("OxDisabled"); // fixme: this will only work if onChange is only invoked on actual change
|
||||
} else if (key == "title") {
|
||||
|
||||
}
|
||||
|
|
@ -4790,4 +4796,4 @@ requires
|
|||
*/
|
||||
|
||||
|
||||
})();
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue