[refactor] improve link module

This commit is contained in:
Kuldeep M 2019-07-19 00:32:47 +01:00
parent ee1f0d4508
commit 2fa1fec109
7 changed files with 22 additions and 41 deletions

View File

@ -74,6 +74,7 @@ var control = (function() {
type: "color", type: "color",
func: function() { func: function() {
theme.accent(); theme.accent();
// link.items();
} }
}, { }, {
element: helper.e(".control-layout-width"), element: helper.e(".control-layout-width"),
@ -1920,18 +1921,14 @@ var control = (function() {
path: "link.item.order", path: "link.item.order",
type: "radio", type: "radio",
func: function() { func: function() {
link.render.clear(); link.items();
link.render.item.all();
sortable(".link-area");
} }
}, { }, {
element: helper.e(".control-link-item-order-namedisplay"), element: helper.e(".control-link-item-order-namedisplay"),
path: "link.item.order", path: "link.item.order",
type: "radio", type: "radio",
func: function() { func: function() {
link.render.clear(); link.items();
link.render.item.all();
sortable(".link-area");
} }
}, { }, {
element: helper.e(".control-link-item-url-show"), element: helper.e(".control-link-item-url-show"),
@ -1968,9 +1965,7 @@ var control = (function() {
path: "link.newTab", path: "link.newTab",
type: "checkbox", type: "checkbox",
func: function() { func: function() {
link.render.clear(); link.items();
link.render.item.all();
sortable(".link-area");
} }
}, { }, {
element: helper.e(".control-link-style-block"), element: helper.e(".control-link-style-block"),
@ -1991,45 +1986,35 @@ var control = (function() {
type: "button", type: "button",
func: function() { func: function() {
bookmarks.sort("letter"); bookmarks.sort("letter");
link.render.clear(); link.items();
link.render.item.all();
sortable(".link-area");
} }
}, { }, {
element: helper.e(".control-link-sort-icon"), element: helper.e(".control-link-sort-icon"),
type: "button", type: "button",
func: function() { func: function() {
bookmarks.sort("icon"); bookmarks.sort("icon");
link.render.clear(); link.items();
link.render.item.all();
sortable(".link-area");
} }
}, { }, {
element: helper.e(".control-link-sort-name"), element: helper.e(".control-link-sort-name"),
type: "button", type: "button",
func: function() { func: function() {
bookmarks.sort("name"); bookmarks.sort("name");
link.render.clear(); link.items();
link.render.item.all();
sortable(".link-area");
} }
}, { }, {
element: helper.e(".control-link-accent-clear"), element: helper.e(".control-link-accent-clear"),
type: "button", type: "button",
func: function() { func: function() {
link.mod.accent.clear(); link.mod.accent.clear();
link.render.clear(); link.items();
link.render.item.all();
sortable(".link-area");
} }
}, { }, {
element: helper.e(".control-link-accent-set"), element: helper.e(".control-link-accent-set"),
type: "button", type: "button",
func: function() { func: function() {
link.mod.accent.rainbow(); link.mod.accent.rainbow();
link.render.clear(); link.items();
link.render.item.all();
sortable(".link-area");
} }
}, { }, {
element: helper.e(".control-theme-style-dark"), element: helper.e(".control-theme-style-dark"),
@ -2110,9 +2095,7 @@ var control = (function() {
func: function() { func: function() {
theme.render.accent.random(); theme.render.accent.random();
theme.render.accent.color(); theme.render.accent.color();
link.render.clear(); link.items();
link.render.item.all();
sortable(".link-area");
} }
}, { }, {
element: helper.e(".control-background-image-show"), element: helper.e(".control-background-image-show"),

View File

@ -96,9 +96,7 @@ var keyboard = (function() {
if (state.get().theme.accent.random.active && event.ctrlKey && event.altKey && event.keyCode == 82) { if (state.get().theme.accent.random.active && event.ctrlKey && event.altKey && event.keyCode == 82) {
theme.render.accent.random(); theme.render.accent.random();
theme.render.accent.color(); theme.render.accent.color();
link.render.clear(); link.items();
link.render.item.all();
sortable(".link-area");
data.save(); data.save();
}; };
}, false); }, false);

View File

@ -784,6 +784,12 @@ var link = (function() {
render.item.tabindex(); render.item.tabindex();
}; };
var items = function() {
render.clear();
render.item.all();
sortable(".link-area");
};
var init = function() { var init = function() {
mod.add.close(); mod.add.close();
render.area.width(); render.area.width();
@ -803,6 +809,7 @@ var link = (function() {
render: render, render: render,
add: add, add: add,
edit: edit, edit: edit,
items: items,
tabindex: tabindex tabindex: tabindex
}; };

View File

@ -7,9 +7,7 @@ var search = (function() {
searchInput.addEventListener("input", function() { searchInput.addEventListener("input", function() {
mod.searching.set(); mod.searching.set();
render.clear.button(); render.clear.button();
link.render.clear(); link.items();
link.render.item.all();
sortable(".link-area");
}, false); }, false);
}; };
@ -19,9 +17,7 @@ var search = (function() {
render.clear.input(); render.clear.input();
mod.searching.set(); mod.searching.set();
render.clear.button(); render.clear.button();
link.render.clear(); link.items();
link.render.item.all();
sortable(".link-area");
}, false); }, false);
}; };

View File

@ -111,9 +111,6 @@ var theme = (function() {
var accent = function() { var accent = function() {
theme.render.accent.color(); theme.render.accent.color();
link.render.clear();
link.render.item.all();
sortable(".link-area");
}; };
var init = function() { var init = function() {

View File

@ -1,6 +1,6 @@
var version = (function() { var version = (function() {
var current = "3.53.0"; var current = "3.54.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.53.0", "version": "3.54.0",
"manifest_version": 2, "manifest_version": 2,
"chrome_url_overrides": { "chrome_url_overrides": {
"newtab": "index.html" "newtab": "index.html"