|
|
@ -112,9 +112,9 @@ define([
|
|
|
|
var val = states[i].getContent().doc;
|
|
|
|
var val = states[i].getContent().doc;
|
|
|
|
c = i;
|
|
|
|
c = i;
|
|
|
|
if (typeof onUpdate === "function") { onUpdate(); }
|
|
|
|
if (typeof onUpdate === "function") { onUpdate(); }
|
|
|
|
$hist.find('.next, .previous').show();
|
|
|
|
$hist.find('.next, .previous').css('visibility', '');
|
|
|
|
if (c === states.length - 1) { $hist.find('.next').hide(); }
|
|
|
|
if (c === states.length - 1) { $hist.find('.next').css('visibility', 'hidden'); }
|
|
|
|
if (c === 0) { $hist.find('.previous').hide(); }
|
|
|
|
if (c === 0) { $hist.find('.previous').css('visibility', 'hidden'); }
|
|
|
|
return val || '';
|
|
|
|
return val || '';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -132,15 +132,16 @@ define([
|
|
|
|
$right.hide();
|
|
|
|
$right.hide();
|
|
|
|
$cke.hide();
|
|
|
|
$cke.hide();
|
|
|
|
var $prev =$('<button>', {
|
|
|
|
var $prev =$('<button>', {
|
|
|
|
'class': 'previous fa fa-step-backward',
|
|
|
|
'class': 'previous fa fa-step-backward btn btn-primary',
|
|
|
|
title: Messages.history_prev
|
|
|
|
title: Messages.history_prev
|
|
|
|
}).appendTo($hist);
|
|
|
|
}).appendTo($hist);
|
|
|
|
|
|
|
|
var $nav = $('<div>', {'class': 'goto'}).appendTo($hist);
|
|
|
|
var $next = $('<button>', {
|
|
|
|
var $next = $('<button>', {
|
|
|
|
'class': 'next fa fa-step-forward',
|
|
|
|
'class': 'next fa fa-step-forward btn btn-primary',
|
|
|
|
title: Messages.history_next
|
|
|
|
title: Messages.history_next
|
|
|
|
}).appendTo($hist);
|
|
|
|
}).appendTo($hist);
|
|
|
|
|
|
|
|
|
|
|
|
var $nav = $('<div>', {'class': 'goto'}).appendTo($hist);
|
|
|
|
var $label = $('<label>').text(Messages.history_version).appendTo($nav);
|
|
|
|
var $cur = $('<input>', {
|
|
|
|
var $cur = $('<input>', {
|
|
|
|
'class' : 'gotoInput',
|
|
|
|
'class' : 'gotoInput',
|
|
|
|
'type' : 'number',
|
|
|
|
'type' : 'number',
|
|
|
@ -151,19 +152,15 @@ define([
|
|
|
|
e.stopPropagation();
|
|
|
|
e.stopPropagation();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
var $label = $('<label>').text(' / '+ states.length).appendTo($nav);
|
|
|
|
var $label = $('<label>').text(' / '+ states.length).appendTo($nav);
|
|
|
|
var $goTo = $('<button>', {
|
|
|
|
|
|
|
|
'class': 'fa fa-check',
|
|
|
|
|
|
|
|
'title': Messages.history_goTo
|
|
|
|
|
|
|
|
}).appendTo($nav);
|
|
|
|
|
|
|
|
$('<br>').appendTo($nav);
|
|
|
|
$('<br>').appendTo($nav);
|
|
|
|
var $rev = $('<button>', {
|
|
|
|
|
|
|
|
'class':'revertHistory',
|
|
|
|
|
|
|
|
title: Messages.history_restoreTitle
|
|
|
|
|
|
|
|
}).text(Messages.history_restore).appendTo($nav);
|
|
|
|
|
|
|
|
var $close = $('<button>', {
|
|
|
|
var $close = $('<button>', {
|
|
|
|
'class':'closeHistory',
|
|
|
|
'class':'closeHistory',
|
|
|
|
title: Messages.history_closeTitle
|
|
|
|
title: Messages.history_closeTitle
|
|
|
|
}).text(Messages.history_close).appendTo($nav);
|
|
|
|
}).text(Messages.history_close).appendTo($nav);
|
|
|
|
|
|
|
|
var $rev = $('<button>', {
|
|
|
|
|
|
|
|
'class':'revertHistory btn btn-success',
|
|
|
|
|
|
|
|
title: Messages.history_restoreTitle
|
|
|
|
|
|
|
|
}).text(Messages.history_restore).appendTo($nav);
|
|
|
|
|
|
|
|
|
|
|
|
onUpdate = function () {
|
|
|
|
onUpdate = function () {
|
|
|
|
$cur.attr('max', states.length);
|
|
|
|
$cur.attr('max', states.length);
|
|
|
@ -181,7 +178,6 @@ define([
|
|
|
|
// Buttons actions
|
|
|
|
// Buttons actions
|
|
|
|
$prev.click(function () { render(getPrevious()); });
|
|
|
|
$prev.click(function () { render(getPrevious()); });
|
|
|
|
$next.click(function () { render(getNext()); });
|
|
|
|
$next.click(function () { render(getNext()); });
|
|
|
|
$goTo.click(function () { render( get($cur.val() - 1) ); });
|
|
|
|
|
|
|
|
$cur.keydown(function (e) {
|
|
|
|
$cur.keydown(function (e) {
|
|
|
|
var p = function () { e.preventDefault(); };
|
|
|
|
var p = function () { e.preventDefault(); };
|
|
|
|
if (e.which === 13) { p(); return render( get($cur.val() - 1) ); } // Enter
|
|
|
|
if (e.which === 13) { p(); return render( get($cur.val() - 1) ); } // Enter
|
|
|
@ -192,7 +188,7 @@ define([
|
|
|
|
if (e.which === 27) { p(); $close.click(); }
|
|
|
|
if (e.which === 27) { p(); $close.click(); }
|
|
|
|
}).focus();
|
|
|
|
}).focus();
|
|
|
|
$cur.on('change', function () {
|
|
|
|
$cur.on('change', function () {
|
|
|
|
$goTo.click();
|
|
|
|
render( get($cur.val() - 1) );
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$close.click(function () {
|
|
|
|
$close.click(function () {
|
|
|
|
states = [];
|
|
|
|
states = [];
|
|
|
|