[bug] prevent modal close fireing more than once when a modal is already open

This commit is contained in:
zombieFox 2020-04-27 09:31:30 +01:00
parent df4ce23486
commit 93b9009fa3
6 changed files with 7 additions and 20 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "nightTab",
"version": "5.27.0",
"version": "5.27.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -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": {

View File

@ -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();
};

View File

@ -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);

View File

@ -1,6 +1,6 @@
var version = (function() {
var current = "5.27.0";
var current = "5.27.1";
var name = "Zonked Tarsier";

View File

@ -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"