2011-06-27 20:43:54 +00:00
|
|
|
var Session;
|
|
|
|
Session = (function() {
|
|
|
|
Session.prototype.vk_params = null;
|
|
|
|
Session.prototype.user = null;
|
|
|
|
function Session(params) {
|
|
|
|
var attrs, key, _i, _len, _params;
|
|
|
|
attrs = ['expire', 'mid', 'secret', 'sid', 'sig'];
|
|
|
|
_params = {};
|
|
|
|
for (_i = 0, _len = attrs.length; _i < _len; _i++) {
|
|
|
|
key = attrs[_i];
|
|
|
|
if (params[key] != null) {
|
|
|
|
_params[key] = params[key];
|
2011-06-27 18:41:36 +00:00
|
|
|
}
|
2011-06-27 20:43:54 +00:00
|
|
|
}
|
|
|
|
this.vk_params = _params;
|
|
|
|
}
|
|
|
|
Session.prototype.setUser = function(user) {
|
|
|
|
this.user = user;
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
Session.prototype.getUser = function() {
|
|
|
|
return this.user;
|
|
|
|
};
|
|
|
|
Session.prototype.query = function(url, params, callback) {
|
|
|
|
var attr, q_params, _i, _len;
|
|
|
|
q_params = this.vk_params;
|
|
|
|
for (_i = 0, _len = params.length; _i < _len; _i++) {
|
|
|
|
attr = params[_i];
|
|
|
|
q_params[attr] = params[attr];
|
|
|
|
}
|
|
|
|
$.post(url, q_params, callback);
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
return Session;
|
|
|
|
})();
|