[refactor] improve link add modal

This commit is contained in:
Kuldeep M 2019-07-17 23:46:51 +01:00
parent f473153609
commit 848f236d0d
7 changed files with 33 additions and 12 deletions

View File

@ -44,12 +44,6 @@ var keyboard = (function() {
modal.close();
};
link.add();
shade.open({
action: function() {
modal.close();
pagelock.unlock();
}
});
};
};
}, false);

View File

@ -63,6 +63,23 @@ var link = (function() {
}
};
mod.add = {
open: function() {
helper.setObject({
object: state.get(),
path: "link.add",
newValue: true
});
},
close: function() {
helper.setObject({
object: state.get(),
path: "link.add",
newValue: false
});
}
};
var bind = {};
bind.sort = function() {
@ -711,6 +728,7 @@ var link = (function() {
};
var add = function() {
mod.add.open();
stagedLink.init();
modal.open({
heading: "Add a new bookmark",
@ -718,6 +736,7 @@ var link = (function() {
stagedLink.data.timeStamp = new Date().getTime();
bookmarks.add(JSON.parse(JSON.stringify(stagedLink.data)));
data.save();
mod.add.close();
render.clear();
render.item.all();
render.item.tabindex();
@ -729,6 +748,7 @@ var link = (function() {
pagelock.unlock();
},
cancelAction: function() {
mod.add.close();
stagedLink.reset();
autoSuggest.destroy();
shade.close();
@ -740,6 +760,7 @@ var link = (function() {
});
shade.open({
action: function() {
mod.add.close();
modal.close();
pagelock.unlock();
}
@ -756,6 +777,7 @@ var link = (function() {
};
var init = function() {
mod.add.close();
render.area.width();
render.item.all();
render.item.tabindex();

View File

@ -64,14 +64,10 @@ var menu = (function() {
render.open = function() {
helper.addClass(helper.e("html"), "is-menu-open");
render.focus();
render.scrollToTop();
render.tabindex.toggle();
};
render.close = function() {
helper.removeClass(helper.e("html"), "is-menu-open");
render.tabindex.toggle();
};
var nav = function(button, area) {
@ -90,6 +86,9 @@ var menu = (function() {
var open = function() {
mod.open();
render.open();
render.focus();
render.scrollToTop();
render.tabindex.toggle();
shade.open({
action: function() {
mod.close();
@ -103,6 +102,7 @@ var menu = (function() {
var close = function() {
mod.close();
render.close();
render.tabindex.toggle();
shade.close();
pagelock.unlock();
};

View File

@ -165,6 +165,7 @@ var state = (function() {
newTab: false
},
show: true,
add: false,
edit: false,
style: "block"
},

View File

@ -586,6 +586,10 @@ var update = (function() {
data.state.pagelock = false;
data.state.shade = false;
return data;
},
"3.51.0": function(data) {
data.state.link.add = false;
return data;
}
};

View File

@ -1,6 +1,6 @@
var version = (function() {
var current = "3.50.1";
var current = "3.51.0";
var compare = function(a, b) {
var pa = a.split(".");

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": "3.50.1",
"version": "3.51.0",
"manifest_version": 2,
"chrome_url_overrides": {
"newtab": "index.html"