function HistoryPanel(div, tabHeader) { this._div = div; this._tabHeader = tabHeader; this.update(); } HistoryPanel.prototype.resize = function() { var body = this._div.find(".history-panel-body"); var controls = this._div.find(".history-panel-controls"); var bodyControls = this._div.find(".history-panel-body-controls"); var nowDiv = this._div.find(".history-now"); var bodyPaddings = body.outerHeight(true) - body.height(); body.height((this._div.height() - controls.outerHeight(true) - bodyControls.outerHeight(true) - bodyPaddings) + "px"); body[0].scrollTop = nowDiv[0].offsetTop + nowDiv[0].offsetHeight - body[0].offsetHeight; }; HistoryPanel.prototype.update = function(onDone) { var self = this; Ajax.chainGetJSON( "/command/core/get-history?" + $.param({ project: theProject.id }), null, function(data) { self._data = data; self._render(); if (onDone) { onDone(); } } ); }; HistoryPanel.prototype._render = function() { var self = this; this._tabHeader.html('Undo / Redo ' + this._data.past.length + ''); this._div .empty() .unbind() .html( '
Don\'t worry about making mistakes. Every change you make will be shown here, and you can undo your changes anytime.
' + '' + '' + 'Paste the JSON code encoding the operations to perform.' + ' |
' + '' + ' |