loleaflet: Prevent intermixing of multiple timeouts
Clear a timeout before setting it. Change-Id: Ic808962b880a4c18b24e2f603dc1d351d65419ed
This commit is contained in:
parent
f26900399d
commit
cc0814df04
1 changed files with 13 additions and 4 deletions
17
loleaflet/dist/toolbar/toolbar.js
vendored
17
loleaflet/dist/toolbar/toolbar.js
vendored
|
@ -170,6 +170,9 @@ var formatButtons = ['undo', 'redo', 'save',
|
||||||
'fontcolor', 'backcolor', 'bullet', 'numbering', 'alignleft', 'alignhorizontal', 'alignright', 'alignblock',
|
'fontcolor', 'backcolor', 'bullet', 'numbering', 'alignleft', 'alignhorizontal', 'alignright', 'alignblock',
|
||||||
'incrementindent', 'decrementindent', 'insertgraphic'];
|
'incrementindent', 'decrementindent', 'insertgraphic'];
|
||||||
|
|
||||||
|
var takeEditPopupMessage = '<div>You are viewing now.<br/>Click here to take edit</div>';
|
||||||
|
var takeEditPopupTimeout = null;
|
||||||
|
|
||||||
function onSearch(e) {
|
function onSearch(e) {
|
||||||
if (e.keyCode === 13) {
|
if (e.keyCode === 13) {
|
||||||
var toolbar = w2ui['toolbar-down'];
|
var toolbar = w2ui['toolbar-down'];
|
||||||
|
@ -882,11 +885,14 @@ map.on('editlock', function (e) {
|
||||||
$('#takeeditlabel').html('VIEWING');
|
$('#takeeditlabel').html('VIEWING');
|
||||||
$('#tb_toolbar-down_item_takeedit')
|
$('#tb_toolbar-down_item_takeedit')
|
||||||
.w2overlay({
|
.w2overlay({
|
||||||
html: '<div>You are viewing now.<br/>Click to take edit</div>',
|
html: takeEditPopupMessage,
|
||||||
style: 'padding: 5px'
|
style: 'padding: 5px'
|
||||||
});
|
});
|
||||||
setTimeout(function() {
|
clearTimeout(takeEditPopupTimeout);
|
||||||
|
takeEditPopupTimeout = setTimeout(function() {
|
||||||
$('#tb_toolbar-down_item_takeedit').w2overlay('');
|
$('#tb_toolbar-down_item_takeedit').w2overlay('');
|
||||||
|
clearTimeout(takeEditPopupTimeout);
|
||||||
|
takeEditPopupTimeout = null;
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -906,11 +912,14 @@ map.on('mouseup keypress', function(e) {
|
||||||
$('#takeeditlabel').html('VIEWING');
|
$('#takeeditlabel').html('VIEWING');
|
||||||
$('#tb_toolbar-down_item_takeedit')
|
$('#tb_toolbar-down_item_takeedit')
|
||||||
.w2overlay({
|
.w2overlay({
|
||||||
html: '<div>You are viewing now.<br/>Click to take edit</div>',
|
html: takeEditPopupMessage,
|
||||||
style: 'padding: 5px'
|
style: 'padding: 5px'
|
||||||
});
|
});
|
||||||
setTimeout(function() {
|
clearTimeout(takeEditPopupTimeout);
|
||||||
|
takeEditPopupTimeout = setTimeout(function() {
|
||||||
$('#tb_toolbar-down_item_takeedit').w2overlay('');
|
$('#tb_toolbar-down_item_takeedit').w2overlay('');
|
||||||
|
clearTimeout(takeEditPopupTimeout);
|
||||||
|
takeEditPopupTimeout = null;
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue