[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(); modal.close();
}; };
link.add(); link.add();
shade.open({
action: function() {
modal.close();
pagelock.unlock();
}
});
}; };
}; };
}, false); }, 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 = {}; var bind = {};
bind.sort = function() { bind.sort = function() {
@ -711,6 +728,7 @@ var link = (function() {
}; };
var add = function() { var add = function() {
mod.add.open();
stagedLink.init(); stagedLink.init();
modal.open({ modal.open({
heading: "Add a new bookmark", heading: "Add a new bookmark",
@ -718,6 +736,7 @@ var link = (function() {
stagedLink.data.timeStamp = new Date().getTime(); stagedLink.data.timeStamp = new Date().getTime();
bookmarks.add(JSON.parse(JSON.stringify(stagedLink.data))); bookmarks.add(JSON.parse(JSON.stringify(stagedLink.data)));
data.save(); data.save();
mod.add.close();
render.clear(); render.clear();
render.item.all(); render.item.all();
render.item.tabindex(); render.item.tabindex();
@ -729,6 +748,7 @@ var link = (function() {
pagelock.unlock(); pagelock.unlock();
}, },
cancelAction: function() { cancelAction: function() {
mod.add.close();
stagedLink.reset(); stagedLink.reset();
autoSuggest.destroy(); autoSuggest.destroy();
shade.close(); shade.close();
@ -740,6 +760,7 @@ var link = (function() {
}); });
shade.open({ shade.open({
action: function() { action: function() {
mod.add.close();
modal.close(); modal.close();
pagelock.unlock(); pagelock.unlock();
} }
@ -756,6 +777,7 @@ var link = (function() {
}; };
var init = function() { var init = function() {
mod.add.close();
render.area.width(); render.area.width();
render.item.all(); render.item.all();
render.item.tabindex(); render.item.tabindex();

View File

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

View File

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

View File

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

View File

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

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