poll improved(tm)
This commit is contained in:
parent
7434dbcb0f
commit
ea5301be13
@ -211,7 +211,7 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Any time the realtime object changes, call this function */
|
/* Any time the realtime object changes, call this function */
|
||||||
var change = function (o, n, path, throttle) {
|
var change = function (o, n, path, throttle, cb) {
|
||||||
if (path && !Cryptpad.isArray(path)) {
|
if (path && !Cryptpad.isArray(path)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -262,6 +262,11 @@ define([
|
|||||||
Render.updateTable(table, displayedObj2, conf);
|
Render.updateTable(table, displayedObj2, conf);
|
||||||
updateDisplayedTable();
|
updateDisplayedTable();
|
||||||
setFocus(f);
|
setFocus(f);
|
||||||
|
if (typeof(cb) === "function")
|
||||||
|
{
|
||||||
|
console.log("change cb");
|
||||||
|
cb();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (throttle) {
|
if (throttle) {
|
||||||
@ -273,7 +278,9 @@ define([
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.setTimeout(updateTable);
|
window.setTimeout(function() {
|
||||||
|
updateTable();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var getRealtimeId = function (input) {
|
var getRealtimeId = function (input) {
|
||||||
@ -332,11 +339,8 @@ define([
|
|||||||
});
|
});
|
||||||
} else if (isEdit) {
|
} else if (isEdit) {
|
||||||
unlockRow(id, function () {
|
unlockRow(id, function () {
|
||||||
change();
|
change(null, null, null, null, function() {
|
||||||
|
$('input[data-rt-id="' + id + '"]').focus();
|
||||||
setTimeout(function() {
|
|
||||||
var $newest = $('input[data-rt-id="' + id + '"]');
|
|
||||||
$newest.focus();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -350,11 +354,8 @@ define([
|
|||||||
});
|
});
|
||||||
} else if (isEdit) {
|
} else if (isEdit) {
|
||||||
unlockColumn(id, function () {
|
unlockColumn(id, function () {
|
||||||
change();
|
change(null, null, null, null, function() {
|
||||||
|
$('input[data-rt-id="' + id + '"]').focus();
|
||||||
setTimeout(function() {
|
|
||||||
var $newest = $('[data-rt-id="' + id + '"]');
|
|
||||||
$newest.focus();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -365,8 +366,8 @@ define([
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var hideInputs = function (e) {
|
var hideInputs = function (e, isKeyup) {
|
||||||
if ($(e.target).is('[type="text"]')) {
|
if (!isKeyup && $(e.target).is('[type="text"]')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$('.lock[data-rt-id!="' + APP.userid + '"]').html(lockHTML);
|
$('.lock[data-rt-id!="' + APP.userid + '"]').html(lockHTML);
|
||||||
@ -400,6 +401,9 @@ define([
|
|||||||
switch (nodeName) {
|
switch (nodeName) {
|
||||||
case 'INPUT':
|
case 'INPUT':
|
||||||
handleInput(target);
|
handleInput(target);
|
||||||
|
if (isKeyup && (e.keyCode === 13 || e.keyCode === 27)) {
|
||||||
|
hideInputs(e, isKeyup);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'SPAN':
|
case 'SPAN':
|
||||||
//case 'LABEL':
|
//case 'LABEL':
|
||||||
@ -558,19 +562,17 @@ define([
|
|||||||
var $createRow = APP.$createRow = $('#create-option').click(function () {
|
var $createRow = APP.$createRow = $('#create-option').click(function () {
|
||||||
//console.error("BUTTON CLICKED! LOL");
|
//console.error("BUTTON CLICKED! LOL");
|
||||||
Render.createRow(proxy, function (empty, id) {
|
Render.createRow(proxy, function (empty, id) {
|
||||||
unlockRow(id, function () {
|
change(null, null, null, null, function() {
|
||||||
change();
|
|
||||||
|
|
||||||
setTimeout(function() {
|
|
||||||
$('.edit[data-rt-id="' + id + '"]').click();
|
$('.edit[data-rt-id="' + id + '"]').click();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
var $createCol = APP.$createCol = $('#create-user').click(function () {
|
var $createCol = APP.$createCol = $('#create-user').click(function () {
|
||||||
Render.createColumn(proxy, function () {
|
Render.createColumn(proxy, function (empty, id) {
|
||||||
change();
|
change(null, null, null, null, function() {
|
||||||
|
$('.edit[data-rt-id="' + id + '"]').click();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user