[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", "name": "nightTab",
"version": "5.27.0", "version": "5.27.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "nightTab", "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.", "description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -56,24 +56,18 @@ var keyboard = (function() {
if (state.get.current().menu) { if (state.get.current().menu) {
menu.close(); menu.close();
}; };
if (state.get.current().modal && !state.get.current().link.add) {
modal.close();
};
if (state.get.current().link.edit) { if (state.get.current().link.edit) {
link.edit.item.close(); link.edit.item.close();
modal.close();
shade.close(); shade.close();
data.save(); data.save();
}; };
if (state.get.current().group.edit) { if (state.get.current().group.edit) {
link.edit.group.close(); link.edit.group.close();
modal.close();
shade.close(); shade.close();
data.save(); data.save();
}; };
if (state.get.current().group.add) { if (state.get.current().group.add) {
link.add.group.close(); link.add.group.close();
modal.close();
shade.close(); shade.close();
data.save(); data.save();
}; };
@ -91,24 +85,18 @@ var keyboard = (function() {
if (state.get.current().menu) { if (state.get.current().menu) {
menu.close(); menu.close();
}; };
if (state.get.current().modal && !state.get.current().group.add) {
modal.close();
};
if (state.get.current().link.edit) { if (state.get.current().link.edit) {
link.edit.item.close(); link.edit.item.close();
modal.close();
shade.close(); shade.close();
data.save(); data.save();
}; };
if (state.get.current().link.add) { if (state.get.current().link.add) {
link.add.item.close(); link.add.item.close();
modal.close();
shade.close(); shade.close();
data.save(); data.save();
}; };
if (state.get.current().group.edit) { if (state.get.current().group.edit) {
link.edit.group.close(); link.edit.group.close();
modal.close();
shade.close(); shade.close();
data.save(); data.save();
}; };

View File

@ -64,6 +64,7 @@ var modal = (function() {
allModal[i].close(); allModal[i].close();
}; };
}; };
_previousModal = null;
}; };
render.open = function(override) { render.open = function(override) {
@ -80,7 +81,6 @@ var modal = (function() {
options = helper.applyOptions(options, override); options = helper.applyOptions(options, override);
}; };
var _makeModal = function() { var _makeModal = function() {
mod.open();
var body = helper.e("body"); var body = helper.e("body");
var modal = helper.node("div"); var modal = helper.node("div");
var modalWrapper = helper.node("div|class:modal-wrapper"); var modalWrapper = helper.node("div|class:modal-wrapper");
@ -88,7 +88,7 @@ var modal = (function() {
modal.setAttribute("class", "modal modal-large"); modal.setAttribute("class", "modal modal-large");
} else if (options.size == "small") { } else if (options.size == "small") {
modal.setAttribute("class", "modal modal-small"); modal.setAttribute("class", "modal modal-small");
} else if (options.size) { } else {
modal.setAttribute("class", "modal"); modal.setAttribute("class", "modal");
}; };
modal.close = function() { modal.close = function() {
@ -98,7 +98,6 @@ var modal = (function() {
} else { } else {
modal.remove(); modal.remove();
}; };
mod.close();
bind.focus.remove(); bind.focus.remove();
}; };
var modalBody = helper.node("div|class:modal-body"); var modalBody = helper.node("div|class:modal-body");
@ -139,7 +138,7 @@ var modal = (function() {
if (options.cancelAction) { if (options.cancelAction) {
options.cancelAction(); options.cancelAction();
}; };
this.close(); close();
}.bind(modal), false); }.bind(modal), false);
_previousModal = modal; _previousModal = modal;
body.appendChild(modal); body.appendChild(modal);

View File

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

View File

@ -2,7 +2,7 @@
"name": "nightTab", "name": "nightTab",
"short_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.", "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, "manifest_version": 2,
"chrome_url_overrides": { "chrome_url_overrides": {
"newtab": "index.html" "newtab": "index.html"