make faction chat display almost work

This commit is contained in:
Stefan Breunig
2013-02-03 13:19:56 +01:00
parent 4da97f48e3
commit b7f1270ff6
10 changed files with 599 additions and 217 deletions

View File

@ -48,13 +48,14 @@ window.digits = function(d) {
// error: see above. Additionally it is logged if the request failed.
window.postAjax = function(action, data, success, error) {
data = JSON.stringify($.extend({method: 'dashboard.'+action}, data));
var remove = function(data, textStatus, jqXHR) { window.requests.remove(jqXHR); };
var errCnt = function(jqXHR) { window.failedRequestCount++; window.requests.remove(jqXHR); };
return $.ajax({
url: 'rpc/dashboard.'+action,
type: 'POST',
data: data,
dataType: 'json',
success: success,
success: [remove, success],
error: error ? [errCnt, error] : errCnt,
contentType: 'application/json; charset=utf-8',
beforeSend: function(req) {
@ -110,3 +111,11 @@ window.getPaddedBounds = function() {
window._storedPaddedBounds = p;
return p;
}
// returns number of pixels left to scroll down before reaching the
// bottom. Works similar to the native scrollTop function.
window.scrollBottom = function(elm) {
if(typeof elm === 'string') elm = $(elm);
return elm.get(0).scrollHeight - elm.innerHeight() - elm.scrollTop();
}