mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-10 09:28:37 +08:00
20 lines
440 B
JavaScript
20 lines
440 B
JavaScript
/* global GLOBAL_CONSTANTS I18n */
|
|
|
|
(function() {
|
|
'use strict';
|
|
|
|
function initUnsavedWorkDialog() {
|
|
$(document).on('turbolinks:before-visit', () => {
|
|
let exit = true;
|
|
let editing = $(`.${GLOBAL_CONSTANTS.REPOSITORY_ROW_EDITOR_FORM_CLASS_NAME}`).length > 0;
|
|
|
|
if (editing) {
|
|
exit = confirm(I18n.t('repositories.js.leaving_warning'));
|
|
}
|
|
|
|
return exit;
|
|
});
|
|
}
|
|
|
|
initUnsavedWorkDialog();
|
|
}());
|