From 5999ccf731a74fc74f825f350f149878260aa0b1 Mon Sep 17 00:00:00 2001 From: piro Date: Mon, 4 Jan 2010 04:03:07 +0000 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E3=81=AE=E3=83=90=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=81=A8API=E3=81=AE=E4=BA=92=E6=8F=9B?= =?UTF-8?q?=E6=80=A7=E3=82=92=E7=B6=AD=E6=8C=81=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5691 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/res/operationHistory.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/content/treestyletab/res/operationHistory.js b/content/treestyletab/res/operationHistory.js index bbf55d08..ecbe5b46 100644 --- a/content/treestyletab/res/operationHistory.js +++ b/content/treestyletab/res/operationHistory.js @@ -101,8 +101,9 @@ this._doingUndo = true; var data = history.entries[history.index--]; + var f = this._getAvailableFunction(data.onUndo, data.onundo, data.undo); try { - (data.onUndo || data.onundo)(); + if (f) f.call(data); } catch(e) { error = e; @@ -124,9 +125,9 @@ var error; this._doingUndo = true; - var data = history.entries[history.index++]; + var f = this._getAvailableFunction(data.onRedo, data.onredo, data.redo); try { - (data.onRedo || data.onredo)(this); + if (f) f.call(data); } catch(e) { error = e; @@ -251,6 +252,18 @@ }; }, + _getAvailableFunction : function() + { + var functions = Array.slice(arguments); + for (var i in functions) + { + let f = functions[i]; + if (f && typeof f == 'function') + return f; + } + return null; + }, + _deleteWindowTables : function() { var id = this.getWindowId(window);