[refactor] improve link render

This commit is contained in:
zombieFox 2019-07-15 23:46:32 +01:00
parent 41ee9dee86
commit cffa73c1fa
9 changed files with 473 additions and 475 deletions

View File

@ -75,7 +75,7 @@
<div class="form-group nested-button mb-0"> <div class="form-group nested-button mb-0">
<div class="input-wrap input-button input-hide py-0"> <div class="input-wrap input-button input-hide py-0">
<input id="control-link-edit" class="control-link-edit" type="checkbox" tabindex="1"> <input id="control-link-edit" class="control-link-edit" type="checkbox" tabindex="1">
<label for="control-link-edit" class=" mb-0">Edit</label> <label for="control-link-edit" class="mb-0">Edit</label>
</div> </div>
<button class="control-link-add button" tabindex="1"> <button class="control-link-add button" tabindex="1">
<span class="button-text">Add</span> <span class="button-text">Add</span>

View File

@ -205,7 +205,7 @@ var autoSuggest = (function() {
helper.addClass(icon, "fab"); helper.addClass(icon, "fab");
}; };
anchor.addEventListener("click", function() { anchor.addEventListener("click", function() {
link.autoSuggestIconAction(arrayItem); link.render.autoSuggestIconAction(arrayItem);
}, false); }, false);
var text = helper.node("span:" + arrayItem.label + "|class:auto-suggest-icon-text"); var text = helper.node("span:" + arrayItem.label + "|class:auto-suggest-icon-text");
anchor.appendChild(icon); anchor.appendChild(icon);

View File

@ -11,7 +11,7 @@ var control = (function() {
element: helper.e(".control-link-add"), element: helper.e(".control-link-add"),
type: "button", type: "button",
func: function() { func: function() {
link.add(); link.render.add();
} }
}, { }, {
element: helper.e(".control-link-edit"), element: helper.e(".control-link-edit"),
@ -26,7 +26,7 @@ var control = (function() {
type: "color", type: "color",
func: function() { func: function() {
theme.render.accent.color(); theme.render.accent.color();
link.clear(); link.render.clear();
link.render.item.all(); link.render.item.all();
sortable(".link-area"); sortable(".link-area");
} }
@ -1875,7 +1875,7 @@ var control = (function() {
path: "link.item.order", path: "link.item.order",
type: "radio", type: "radio",
func: function() { func: function() {
link.clear(); link.render.clear();
link.render.item.all(); link.render.item.all();
sortable(".link-area"); sortable(".link-area");
} }
@ -1884,7 +1884,7 @@ var control = (function() {
path: "link.item.order", path: "link.item.order",
type: "radio", type: "radio",
func: function() { func: function() {
link.clear(); link.render.clear();
link.render.item.all(); link.render.item.all();
sortable(".link-area"); sortable(".link-area");
} }
@ -1923,7 +1923,7 @@ var control = (function() {
path: "link.newTab", path: "link.newTab",
type: "checkbox", type: "checkbox",
func: function() { func: function() {
link.clear(); link.render.clear();
link.render.item.all(); link.render.item.all();
sortable(".link-area"); sortable(".link-area");
} }
@ -1946,7 +1946,7 @@ var control = (function() {
type: "button", type: "button",
func: function() { func: function() {
bookmarks.sort("letter"); bookmarks.sort("letter");
link.clear(); link.render.clear();
link.render.item.all(); link.render.item.all();
sortable(".link-area"); sortable(".link-area");
} }
@ -1955,7 +1955,7 @@ var control = (function() {
type: "button", type: "button",
func: function() { func: function() {
bookmarks.sort("icon"); bookmarks.sort("icon");
link.clear(); link.render.clear();
link.render.item.all(); link.render.item.all();
sortable(".link-area"); sortable(".link-area");
} }
@ -1964,7 +1964,7 @@ var control = (function() {
type: "button", type: "button",
func: function() { func: function() {
bookmarks.sort("name"); bookmarks.sort("name");
link.clear(); link.render.clear();
link.render.item.all(); link.render.item.all();
sortable(".link-area"); sortable(".link-area");
} }
@ -1972,8 +1972,8 @@ var control = (function() {
element: helper.e(".control-link-accent-clear"), element: helper.e(".control-link-accent-clear"),
type: "button", type: "button",
func: function() { func: function() {
link.accent.clear(); link.mod.accent.clear();
link.clear(); link.render.clear();
link.render.item.all(); link.render.item.all();
sortable(".link-area"); sortable(".link-area");
} }
@ -1981,8 +1981,8 @@ var control = (function() {
element: helper.e(".control-link-accent-set"), element: helper.e(".control-link-accent-set"),
type: "button", type: "button",
func: function() { func: function() {
link.accent.set(); link.mod.accent.rainbow();
link.clear(); link.render.clear();
link.render.item.all(); link.render.item.all();
sortable(".link-area"); sortable(".link-area");
} }
@ -2065,7 +2065,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.clear(); link.render.clear();
link.render.item.all(); link.render.item.all();
sortable(".link-area"); sortable(".link-area");
} }
@ -2798,7 +2798,6 @@ var control = (function() {
if (bookmarks.get().length > 0) { if (bookmarks.get().length > 0) {
disable.input(".control-link-edit", false); disable.input(".control-link-edit", false);
} else { } else {
disable.input(".control-link-edit", true);
disable.input(".control-link-edit", false); disable.input(".control-link-edit", false);
}; };
}; };

View File

@ -147,6 +147,11 @@ var header = (function() {
} }
}; };
action[state.get().header.button.style](); action[state.get().header.button.style]();
},
edit: function() {
if (!state.get().link.edit) {
helper.e(".control-link-edit").checked = false;
};
} }
}; };

View File

@ -36,7 +36,7 @@ var keyboard = (function() {
if (event.ctrlKey && event.altKey && event.keyCode == 65) { if (event.ctrlKey && event.altKey && event.keyCode == 65) {
if (state.get().link.show) { if (state.get().link.show) {
menu.close(); menu.close();
link.add(); link.render.add();
}; };
}; };
}, false); }, false);
@ -97,7 +97,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.clear(); link.render.clear();
link.render.item.all(); link.render.item.all();
sortable(".link-area"); sortable(".link-area");
data.save(); data.save();

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +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.clear(); link.render.clear();
link.render.item.all(); link.render.item.all();
sortable(".link-area"); sortable(".link-area");
}, false); }, false);
@ -19,7 +19,7 @@ var search = (function() {
render.clear.input(); render.clear.input();
mod.searching.set(); mod.searching.set();
render.clear.button(); render.clear.button();
link.clear(); link.render.clear();
link.render.item.all(); link.render.item.all();
sortable(".link-area"); sortable(".link-area");
}, false); }, false);

View File

@ -1,6 +1,6 @@
var version = (function() { var version = (function() {
var current = "3.40.0"; var current = "3.41.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.40.0", "version": "3.41.0",
"manifest_version": 2, "manifest_version": 2,
"chrome_url_overrides": { "chrome_url_overrides": {
"newtab": "index.html" "newtab": "index.html"