X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/e8c45077de2d4ada496850fd77fa5035f07f8a4d..969f365b3ee6d3cb54f98b23e1ebb97df9f801dd:/modules/data/data.js?ds=sidebyside diff --git a/modules/data/data.js b/modules/data/data.js index 8c35436..8bd553c 100644 --- a/modules/data/data.js +++ b/modules/data/data.js @@ -6,6 +6,7 @@ return function(sandbox) { var doc = sandbox.getBootstrappedData().document; var document_id = sandbox.getBootstrappedData().document_id; + var document_version = sandbox.getBootstrappedData().version; var history = sandbox.getBootstrappedData().history; @@ -29,7 +30,7 @@ return function(sandbox) { for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); - if (c.indexOf(nameEQ) == 0) return unescape(c.substring(nameEQ.length, c.length)); + if (c.indexOf(nameEQ) === 0) return unescape(c.substring(nameEQ.length, c.length)); } return null; } @@ -52,7 +53,7 @@ return function(sandbox) { sandbox.publish('historyItemAdded', data.slice(-1)[0]); }, }); - } + }; return { start: function() { @@ -99,7 +100,7 @@ return function(sandbox) { url: '/' + gettext('editor') + '/' + document_id + '/diff', data: {from: ver1, to: ver2}, success: function(data) { - sandbox.publish('diffFetched', {table: data, ver1: ver1, ver2: ver2}) + sandbox.publish('diffFetched', {table: data, ver1: ver1, ver2: ver2}); }, }); }, @@ -113,13 +114,20 @@ return function(sandbox) { data: JSON.stringify(options), success: function(data) { doc = data.document; + document_version = data.version; reloadHistory(); - sandbox.publish('documentReverted', {document: data.document, version: data.version}); + sandbox.publish('documentReverted', data); }, }); } + }, + getDocumentId: function() { + return document_id; + }, + getDocumentVersion: function() { + return document_version; } - } + }; }; }); \ No newline at end of file