|
|
|
@ -13,15 +13,24 @@ define('sort', ['components'], function (components) {
|
|
|
|
|
$('body')
|
|
|
|
|
.off('click', '[component="thread/sort"] a')
|
|
|
|
|
.on('click', '[component="thread/sort"] a', function () {
|
|
|
|
|
var newSetting = $(this).attr('data-sort');
|
|
|
|
|
socket.emit(method, newSetting, function (err) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return app.alertError(err.message);
|
|
|
|
|
}
|
|
|
|
|
function refresh(newSetting, params) {
|
|
|
|
|
config[field] = newSetting;
|
|
|
|
|
var qs = decodeURIComponent($.param(utils.params()));
|
|
|
|
|
var qs = decodeURIComponent($.param(params));
|
|
|
|
|
ajaxify.go(gotoOnSave + (qs ? '?' + qs : ''));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
var newSetting = $(this).attr('data-sort');
|
|
|
|
|
if (app.user.uid) {
|
|
|
|
|
socket.emit(method, newSetting, function (err) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return app.alertError(err.message);
|
|
|
|
|
}
|
|
|
|
|
refresh(newSetting, utils.params());
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
var urlParams = utils.params();
|
|
|
|
|
urlParams.sort = newSetting;
|
|
|
|
|
refresh(newSetting, urlParams);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|