From 93b9009fa3428f4278d9b4a6533b74afaa20e08f Mon Sep 17 00:00:00 2001 From: zombieFox Date: Mon, 27 Apr 2020 09:31:30 +0100 Subject: [PATCH] [bug] prevent modal close fireing more than once when a modal is already open --- package-lock.json | 2 +- package.json | 2 +- src/js/keyboard.js | 12 ------------ src/js/modal.js | 7 +++---- src/js/version.js | 2 +- src/manifest.json | 2 +- 6 files changed, 7 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2f8678eb..66b3f090 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "nightTab", - "version": "5.27.0", + "version": "5.27.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8aaf45cd..b09cb478 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nightTab", - "version": "5.27.0", + "version": "5.27.1", "description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.", "main": "index.js", "scripts": { diff --git a/src/js/keyboard.js b/src/js/keyboard.js index c115c102..65c96eb8 100644 --- a/src/js/keyboard.js +++ b/src/js/keyboard.js @@ -56,24 +56,18 @@ var keyboard = (function() { if (state.get.current().menu) { menu.close(); }; - if (state.get.current().modal && !state.get.current().link.add) { - modal.close(); - }; if (state.get.current().link.edit) { link.edit.item.close(); - modal.close(); shade.close(); data.save(); }; if (state.get.current().group.edit) { link.edit.group.close(); - modal.close(); shade.close(); data.save(); }; if (state.get.current().group.add) { link.add.group.close(); - modal.close(); shade.close(); data.save(); }; @@ -91,24 +85,18 @@ var keyboard = (function() { if (state.get.current().menu) { menu.close(); }; - if (state.get.current().modal && !state.get.current().group.add) { - modal.close(); - }; if (state.get.current().link.edit) { link.edit.item.close(); - modal.close(); shade.close(); data.save(); }; if (state.get.current().link.add) { link.add.item.close(); - modal.close(); shade.close(); data.save(); }; if (state.get.current().group.edit) { link.edit.group.close(); - modal.close(); shade.close(); data.save(); }; diff --git a/src/js/modal.js b/src/js/modal.js index 6ed83380..42cdaec5 100644 --- a/src/js/modal.js +++ b/src/js/modal.js @@ -64,6 +64,7 @@ var modal = (function() { allModal[i].close(); }; }; + _previousModal = null; }; render.open = function(override) { @@ -80,7 +81,6 @@ var modal = (function() { options = helper.applyOptions(options, override); }; var _makeModal = function() { - mod.open(); var body = helper.e("body"); var modal = helper.node("div"); var modalWrapper = helper.node("div|class:modal-wrapper"); @@ -88,7 +88,7 @@ var modal = (function() { modal.setAttribute("class", "modal modal-large"); } else if (options.size == "small") { modal.setAttribute("class", "modal modal-small"); - } else if (options.size) { + } else { modal.setAttribute("class", "modal"); }; modal.close = function() { @@ -98,7 +98,6 @@ var modal = (function() { } else { modal.remove(); }; - mod.close(); bind.focus.remove(); }; var modalBody = helper.node("div|class:modal-body"); @@ -139,7 +138,7 @@ var modal = (function() { if (options.cancelAction) { options.cancelAction(); }; - this.close(); + close(); }.bind(modal), false); _previousModal = modal; body.appendChild(modal); diff --git a/src/js/version.js b/src/js/version.js index 079b97d3..e37e7b1b 100644 --- a/src/js/version.js +++ b/src/js/version.js @@ -1,6 +1,6 @@ var version = (function() { - var current = "5.27.0"; + var current = "5.27.1"; var name = "Zonked Tarsier"; diff --git a/src/manifest.json b/src/manifest.json index 881039e4..51bcb16d 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,7 +2,7 @@ "name": "nightTab", "short_name": "nightTab", "description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.", - "version": "5.27.0", + "version": "5.27.1", "manifest_version": 2, "chrome_url_overrides": { "newtab": "index.html"