Skip to content

Commit 587dc0d

Browse files
committed
Simplified closeModal definition
The `closeModal` function had legacy parameters `action` and `namespace` which are no longer being used. The `action` hasn't been used in quite a while. The `namespace` was previously needed to determine the specific model window. This was replaced with the `[id^=""]` selector in a previous update, thus eliminating that need. In addition, there's no need to call `modal('hide')` from _both_ the jQuery listener _and_ the `closeModal` function, so this is fixed. That was adding a bit of extra overhead which noticeably delayed the closing of the modal.
1 parent 3218898 commit 587dc0d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

OnTopic.Editor.AspNetCore/Shared/Scripts/NestedTopicList.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,8 @@ initEditorModal = function (namespace, title, targetUrl, onCloseFunction) {
7272
\-----------------------------------------------------------------------------------------------------------------------------*/
7373
/**
7474
* Closes the current modal window
75-
* @param {string} action - Default parameter supplied by JavaScript event (unused).
76-
* @param {string} namespace - The parent key of the nested topic container.
7775
*/
78-
window.closeModal = function (action, namespace) {
76+
window.closeModal = function () {
7977
$('[id^="EditorModal"]').modal('hide');
8078
};
8179

@@ -88,8 +86,7 @@ window.closeModal = function (action, namespace) {
8886
| Event Handler: Close Button
8987
\---------------------------------------------------------------------------------------------------------------------------*/
9088
$('#ModalCloseButton').on('click', function (e) {
91-
window.parent.closeModal('canceled', '');
92-
$('[id^="EditorModal"]').modal('hide');
89+
window.parent.closeModal();
9390
});
9491

9592
/*----------------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)