mirror of
https://github.com/zombieFox/nightTab.git
synced 2024-12-26 08:38:59 +01:00
[refactor] Improve global, link and group edit states
This commit is contained in:
parent
73d2795018
commit
41d183ba66
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nighttab",
|
||||
"version": "4.1.3",
|
||||
"version": "4.2.1",
|
||||
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -847,6 +847,7 @@ input[type="range"]:disabled::-moz-range-progress {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* input button */
|
||||
.input-button input[type="checkbox"]+label,
|
||||
.input-button input[type="radio"]+label,
|
||||
.input-button input[type="color"]+label,
|
||||
@ -998,6 +999,7 @@ input[type="range"]:disabled::-moz-range-progress {
|
||||
background-color: rgb(var(--button-border-disabled));
|
||||
}
|
||||
|
||||
/* input button link */
|
||||
.input-button-link input[type="checkbox"]+label,
|
||||
.input-button-link input[type="radio"]+label,
|
||||
.input-button-link input[type="color"]+label,
|
||||
@ -1032,7 +1034,6 @@ input[type="range"]:disabled::-moz-range-progress {
|
||||
.input-button-link input:disabled[type="color"]+label,
|
||||
.input-button-link input:disabled[type="file"]+label {
|
||||
background-color: transparent;
|
||||
color: transparent;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
@ -55,12 +55,12 @@
|
||||
}
|
||||
|
||||
.is-group-order-headerbody.is-group-name-show .group-header,
|
||||
.is-group-order-headerbody.is-link-edit .group-header {
|
||||
.is-group-order-headerbody.is-edit .group-header {
|
||||
padding-bottom: calc(var(--layout-space) * var(--layout-gutter));
|
||||
}
|
||||
|
||||
.is-group-order-bodyheader.is-group-name-show .group-header,
|
||||
.is-group-order-bodyheader.is-link-edit .group-header {
|
||||
.is-group-order-bodyheader.is-edit .group-header {
|
||||
padding-top: calc(var(--layout-space) * var(--layout-gutter));
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@
|
||||
margin var(--layout-timing-extra-fast);
|
||||
}
|
||||
|
||||
.is-link-edit .group-control {
|
||||
.is-edit .group-control {
|
||||
height: 2.5em;
|
||||
width: 16em;
|
||||
transition:
|
||||
@ -110,12 +110,12 @@
|
||||
margin var(--layout-timing-extra-fast) var(--layout-duration-04);
|
||||
}
|
||||
|
||||
.is-link-edit.is-group-name-show.is-group-area-alignment-left .group-control,
|
||||
.is-link-edit.is-group-name-show.is-group-area-alignment-center .group-control {
|
||||
.is-edit.is-group-name-show.is-group-area-alignment-left .group-control,
|
||||
.is-edit.is-group-name-show.is-group-area-alignment-center .group-control {
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.is-link-edit.is-group-name-show.is-group-area-alignment-right .group-control {
|
||||
.is-edit.is-group-name-show.is-group-area-alignment-right .group-control {
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
|
@ -239,29 +239,29 @@
|
||||
border-bottom-right-radius: calc(var(--theme-radius) / 4);
|
||||
}
|
||||
|
||||
.is-link-edit .link-panel-front,
|
||||
.is-link-edit .link-item:hover .link-panel-front,
|
||||
.is-link-edit .link-item:focus .link-panel-front {
|
||||
.is-edit .link-panel-front,
|
||||
.is-edit .link-item:hover .link-panel-front,
|
||||
.is-edit .link-item:focus .link-panel-front {
|
||||
height: calc(100% - var(--link-item-edit-height));
|
||||
}
|
||||
|
||||
.is-theme-radius.is-link-edit.is-link-orientation-top .link-panel-front,
|
||||
.is-theme-radius.is-link-edit.is-link-orientation-top .link-item:hover .link-panel-front,
|
||||
.is-theme-radius.is-link-edit.is-link-orientation-top .link-item:focus .link-panel-front {
|
||||
.is-theme-radius.is-edit.is-link-orientation-top .link-panel-front,
|
||||
.is-theme-radius.is-edit.is-link-orientation-top .link-item:hover .link-panel-front,
|
||||
.is-theme-radius.is-edit.is-link-orientation-top .link-item:focus .link-panel-front {
|
||||
border-top-left-radius: calc(var(--theme-radius) / 4);
|
||||
border-top-right-radius: calc(var(--theme-radius) / 4);
|
||||
}
|
||||
|
||||
.is-theme-radius.is-link-edit.is-link-orientation-bottom .link-panel-front,
|
||||
.is-theme-radius.is-link-edit.is-link-orientation-bottom .link-item:hover .link-panel-front,
|
||||
.is-theme-radius.is-link-edit.is-link-orientation-bottom .link-item:focus .link-panel-front {
|
||||
.is-theme-radius.is-edit.is-link-orientation-bottom .link-panel-front,
|
||||
.is-theme-radius.is-edit.is-link-orientation-bottom .link-item:hover .link-panel-front,
|
||||
.is-theme-radius.is-edit.is-link-orientation-bottom .link-item:focus .link-panel-front {
|
||||
border-bottom-left-radius: calc(var(--theme-radius) / 4);
|
||||
border-bottom-right-radius: calc(var(--theme-radius) / 4);
|
||||
}
|
||||
|
||||
.is-link-item-shadow-show.is-link-edit .link-panel-front,
|
||||
.is-link-item-shadow-show.is-link-edit .link-item:hover .link-panel-front,
|
||||
.is-link-item-shadow-show.is-link-edit .link-item:focus .link-panel-front {
|
||||
.is-link-item-shadow-show.is-edit .link-panel-front,
|
||||
.is-link-item-shadow-show.is-edit .link-item:hover .link-panel-front,
|
||||
.is-link-item-shadow-show.is-edit .link-item:focus .link-panel-front {
|
||||
box-shadow: var(--layout-shadow-medium);
|
||||
}
|
||||
|
||||
@ -276,7 +276,7 @@
|
||||
transition: font-size var(--layout-timing-extra-fast), top var(--layout-timing-extra-fast), left var(--layout-timing-extra-fast);
|
||||
}
|
||||
|
||||
.is-link-edit .link-display {
|
||||
.is-edit .link-display {
|
||||
font-size: 0.6em;
|
||||
}
|
||||
|
||||
@ -683,23 +683,23 @@
|
||||
clip-path: polygon(0 calc(100% - calc(var(--link-item-url-height) + 10%)), 100% calc(100% - calc(var(--link-item-url-height) + 10%)), 100% 100%, 0 100%);
|
||||
}
|
||||
|
||||
.is-link-edit.is-link-orientation-top .link-panel-back,
|
||||
.is-link-edit.is-link-orientation-top .link-panel-back,
|
||||
.is-link-edit.is-link-orientation-top .link-panel-back,
|
||||
.is-link-edit.is-link-orientation-top .link-item:focus .link-panel-back,
|
||||
.is-link-edit.is-link-orientation-top .link-item:focus-within .link-panel-back,
|
||||
.is-link-edit.is-link-orientation-top .link-item:hover .link-panel-back {
|
||||
.is-edit.is-link-orientation-top .link-panel-back,
|
||||
.is-edit.is-link-orientation-top .link-panel-back,
|
||||
.is-edit.is-link-orientation-top .link-panel-back,
|
||||
.is-edit.is-link-orientation-top .link-item:focus .link-panel-back,
|
||||
.is-edit.is-link-orientation-top .link-item:focus-within .link-panel-back,
|
||||
.is-edit.is-link-orientation-top .link-item:hover .link-panel-back {
|
||||
height: 100%;
|
||||
top: 0;
|
||||
clip-path: polygon(0 0, 100% 0, 100% calc(100% - calc(var(--link-item-edit-height) - 10%)), 0 calc(100% - calc(var(--link-item-edit-height) - 10%)))
|
||||
}
|
||||
|
||||
.is-link-edit.is-link-orientation-bottom .link-panel-back,
|
||||
.is-link-edit.is-link-orientation-bottom .link-panel-back,
|
||||
.is-link-edit.is-link-orientation-bottom .link-panel-back,
|
||||
.is-link-edit.is-link-orientation-bottom .link-item:focus .link-panel-back,
|
||||
.is-link-edit.is-link-orientation-bottom .link-item:focus-within .link-panel-back,
|
||||
.is-link-edit.is-link-orientation-bottom .link-item:hover .link-panel-back {
|
||||
.is-edit.is-link-orientation-bottom .link-panel-back,
|
||||
.is-edit.is-link-orientation-bottom .link-panel-back,
|
||||
.is-edit.is-link-orientation-bottom .link-panel-back,
|
||||
.is-edit.is-link-orientation-bottom .link-item:focus .link-panel-back,
|
||||
.is-edit.is-link-orientation-bottom .link-item:focus-within .link-panel-back,
|
||||
.is-edit.is-link-orientation-bottom .link-item:hover .link-panel-back {
|
||||
height: 100%;
|
||||
top: 0;
|
||||
clip-path: polygon(0 calc(100% - calc(var(--link-item-edit-height) + 10%)), 100% calc(100% - calc(var(--link-item-edit-height) + 10%)), 100% 100%, 0 100%);
|
||||
@ -717,7 +717,7 @@
|
||||
transition: height var(--layout-timing-extra-fast);
|
||||
}
|
||||
|
||||
.is-link-edit .link-control {
|
||||
.is-edit .link-control {
|
||||
height: var(--link-item-edit-height);
|
||||
}
|
||||
|
||||
@ -850,9 +850,9 @@
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.is-link-item-url-show:not(.is-link-edit) .link-item:focus-within .link-url,
|
||||
.is-link-item-url-show:not(.is-link-edit) .link-item:focus .link-url,
|
||||
.is-link-item-url-show:not(.is-link-edit) .link-item:hover .link-url {
|
||||
.is-link-item-url-show:not(.is-edit) .link-item:focus-within .link-url,
|
||||
.is-link-item-url-show:not(.is-edit) .link-item:focus .link-url,
|
||||
.is-link-item-url-show:not(.is-edit) .link-item:hover .link-url {
|
||||
height: var(--link-item-url-height);
|
||||
}
|
||||
|
||||
@ -873,14 +873,14 @@
|
||||
color: rgb(var(--theme-white));
|
||||
}
|
||||
|
||||
.is-link-edit.is-link-item-url-show .link-item:focus .link-panel-front,
|
||||
.is-link-edit.is-link-item-url-show .link-item:focus-within .link-panel-front,
|
||||
.is-link-edit.is-link-item-url-show .link-item:hover .link-panel-front {
|
||||
.is-edit.is-link-item-url-show .link-item:focus .link-panel-front,
|
||||
.is-edit.is-link-item-url-show .link-item:focus-within .link-panel-front,
|
||||
.is-edit.is-link-item-url-show .link-item:hover .link-panel-front {
|
||||
height: calc(100% - var(--link-item-edit-height));
|
||||
}
|
||||
|
||||
.is-link-edit .link-item:hover .link-url,
|
||||
.is-link-edit .link-item:focus .link-url {
|
||||
.is-edit .link-item:hover .link-url,
|
||||
.is-edit .link-item:focus .link-url {
|
||||
height: 0;
|
||||
}
|
||||
|
||||
|
@ -88,8 +88,8 @@
|
||||
<div class="header-button-body">
|
||||
<div class="form-group nested-button mb-0">
|
||||
<div class="input-wrap input-button input-hide py-0">
|
||||
<input id="control-link-edit" class="control-link-edit" type="checkbox" tabindex="1">
|
||||
<label for="control-link-edit" class="mb-0"><span class="label-icon"></span> Edit</label>
|
||||
<input id="control-edit" class="control-edit" type="checkbox" tabindex="1">
|
||||
<label for="control-edit" class="mb-0"><span class="label-icon"></span> Edit</label>
|
||||
</div>
|
||||
<div class="input-wrap py-0">
|
||||
<div class="form-dropdown">
|
||||
|
@ -73,8 +73,8 @@ var control = (function() {
|
||||
link.add.group.open();
|
||||
}
|
||||
}, {
|
||||
element: helper.e(".control-link-edit"),
|
||||
path: "link.edit",
|
||||
element: helper.e(".control-edit"),
|
||||
path: "edit",
|
||||
type: "checkbox",
|
||||
func: function() {
|
||||
link.tabindex();
|
||||
@ -2876,6 +2876,12 @@ var control = (function() {
|
||||
|
||||
render.class = function() {
|
||||
var html = helper.e("html");
|
||||
var _edit = function() {
|
||||
helper.removeClass(html, "is-edit");
|
||||
if (state.get.current().edit) {
|
||||
helper.addClass(html, "is-edit");
|
||||
};
|
||||
};
|
||||
var _menu = function() {
|
||||
helper.addClass(html, "is-menu");
|
||||
};
|
||||
@ -3044,7 +3050,6 @@ var control = (function() {
|
||||
helper.removeClass(html, "is-link-style-block");
|
||||
helper.removeClass(html, "is-link-orientation-top");
|
||||
helper.removeClass(html, "is-link-orientation-bottom");
|
||||
helper.removeClass(html, "is-link-edit");
|
||||
if (state.get.current().link.show) {
|
||||
helper.addClass(html, "is-link-show");
|
||||
helper.addClass(html, "is-link-area-alignment-" + state.get.current().link.area.alignment);
|
||||
@ -3074,9 +3079,6 @@ var control = (function() {
|
||||
if (state.get.current().link.item.border > 0) {
|
||||
helper.addClass(html, "is-link-item-border");
|
||||
};
|
||||
if (state.get.current().link.edit) {
|
||||
helper.addClass(html, "is-link-edit");
|
||||
};
|
||||
};
|
||||
};
|
||||
var _theme = function() {
|
||||
@ -3115,6 +3117,7 @@ var control = (function() {
|
||||
helper.removeClass(html, "is-background-image-show");
|
||||
};
|
||||
};
|
||||
_edit();
|
||||
_menu();
|
||||
_header();
|
||||
_group();
|
||||
@ -3465,9 +3468,9 @@ var control = (function() {
|
||||
};
|
||||
var _edit = function() {
|
||||
if (bookmarks.get().length > 0) {
|
||||
_disable.input(".control-link-edit", false);
|
||||
_disable.input(".control-edit", false);
|
||||
} else {
|
||||
_disable.input(".control-link-edit", false);
|
||||
_disable.input(".control-edit", true);
|
||||
};
|
||||
};
|
||||
var _group = function() {
|
||||
|
@ -134,24 +134,19 @@ var header = (function() {
|
||||
style: function() {
|
||||
var action = {
|
||||
box: function() {
|
||||
helper.removeClass(helper.getClosest(helper.e(".control-link-edit"), ".input-wrap"), "input-button-link");
|
||||
helper.removeClass(helper.getClosest(helper.e(".control-edit"), ".input-wrap"), "input-button-link");
|
||||
helper.removeClass(helper.e(".control-add-toggle"), "button-link");
|
||||
helper.removeClass(helper.getClosest(helper.e(".control-theme-accent-current-quick"), ".input-wrap"), "input-button-link");
|
||||
helper.removeClass(helper.e(".control-menu-open"), "button-link");
|
||||
},
|
||||
clear: function() {
|
||||
helper.addClass(helper.getClosest(helper.e(".control-link-edit"), ".input-wrap"), "input-button-link");
|
||||
helper.addClass(helper.getClosest(helper.e(".control-edit"), ".input-wrap"), "input-button-link");
|
||||
helper.addClass(helper.e(".control-add-toggle"), "button-link");
|
||||
helper.addClass(helper.getClosest(helper.e(".control-theme-accent-current-quick"), ".input-wrap"), "input-button-link");
|
||||
helper.addClass(helper.e(".control-menu-open"), "button-link");
|
||||
}
|
||||
};
|
||||
action[state.get.current().header.button.style]();
|
||||
},
|
||||
edit: function() {
|
||||
if (!state.get.current().link.edit) {
|
||||
helper.e(".control-link-edit").checked = false;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -14,18 +14,28 @@ var keyboard = (function() {
|
||||
dropdown.close();
|
||||
} else if (state.get.current().autoSuggest) {
|
||||
autoSuggest.close();
|
||||
} else if (state.get.current().link.edit) {
|
||||
link.edit.item.close();
|
||||
shade.close();
|
||||
data.save();
|
||||
} else if (state.get.current().link.add) {
|
||||
link.add.item.close();
|
||||
shade.close();
|
||||
data.save();
|
||||
} else if (state.get.current().group.edit) {
|
||||
link.edit.group.close();
|
||||
shade.close();
|
||||
data.save();
|
||||
} else if (state.get.current().group.add) {
|
||||
link.add.group.close();
|
||||
} else if (state.get.current().link.edit && state.get.current().modal) {
|
||||
link.add.item.close();
|
||||
} else if (state.get.current().link.edit) {
|
||||
link.edit.close();
|
||||
shade.close();
|
||||
data.save();
|
||||
} else if (state.get.current().modal) {
|
||||
modal.close();
|
||||
shade.close();
|
||||
} else if (state.get.current().edit) {
|
||||
link.edit.mode.close();
|
||||
data.save();
|
||||
};
|
||||
data.save();
|
||||
};
|
||||
@ -103,7 +113,11 @@ var keyboard = (function() {
|
||||
window.addEventListener("keydown", function(event) {
|
||||
// ctrl+alt+e
|
||||
if (event.ctrlKey && event.altKey && event.keyCode == 69) {
|
||||
link.edit.toggle();
|
||||
if (bookmarks.get().length > 0) {
|
||||
link.edit.mode.toggle();
|
||||
} else {
|
||||
link.edit.mode.close();
|
||||
};
|
||||
data.save();
|
||||
};
|
||||
}, false);
|
||||
|
352
src/js/link.js
352
src/js/link.js
@ -125,35 +125,53 @@ var link = (function() {
|
||||
};
|
||||
|
||||
mod.edit = {
|
||||
toggle: function() {
|
||||
if (state.get.current().link.edit) {
|
||||
mod.edit.close();
|
||||
} else {
|
||||
mod.edit.open();
|
||||
};
|
||||
mode: {
|
||||
open: function() {
|
||||
helper.setObject({
|
||||
object: state.get.current(),
|
||||
path: "edit",
|
||||
newValue: true
|
||||
});
|
||||
},
|
||||
close: function() {
|
||||
helper.setObject({
|
||||
object: state.get.current(),
|
||||
path: "edit",
|
||||
newValue: false
|
||||
});
|
||||
}
|
||||
},
|
||||
open: function() {
|
||||
helper.setObject({
|
||||
object: state.get.current(),
|
||||
path: "link.edit",
|
||||
newValue: true
|
||||
});
|
||||
},
|
||||
close: function() {
|
||||
helper.setObject({
|
||||
object: state.get.current(),
|
||||
path: "link.edit",
|
||||
newValue: false
|
||||
});
|
||||
},
|
||||
check: function() {
|
||||
if (bookmarks.get().length <= 0) {
|
||||
item: {
|
||||
open: function() {
|
||||
helper.setObject({
|
||||
object: state.get.current(),
|
||||
path: "link.edit",
|
||||
newValue: true
|
||||
});
|
||||
},
|
||||
close: function() {
|
||||
helper.setObject({
|
||||
object: state.get.current(),
|
||||
path: "link.edit",
|
||||
newValue: false
|
||||
});
|
||||
};
|
||||
}
|
||||
},
|
||||
group: {
|
||||
open: function() {
|
||||
helper.setObject({
|
||||
object: state.get.current(),
|
||||
path: "group.edit",
|
||||
newValue: true
|
||||
});
|
||||
},
|
||||
close: function() {
|
||||
helper.setObject({
|
||||
object: state.get.current(),
|
||||
path: "group.edit",
|
||||
newValue: false
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -281,7 +299,7 @@ var link = (function() {
|
||||
render.focus.group.next.down(copyStagedGroup);
|
||||
}
|
||||
},
|
||||
link: {
|
||||
item: {
|
||||
left: function(copyStagedLink) {
|
||||
stagedLink.link = JSON.parse(JSON.stringify(copyStagedLink.link));
|
||||
stagedLink.position = JSON.parse(JSON.stringify(copyStagedLink.position));
|
||||
@ -390,7 +408,7 @@ var link = (function() {
|
||||
}, false);
|
||||
|
||||
itemGroupControlItemEdit.addEventListener("click", function() {
|
||||
render.edit.group(copyStagedGroup);
|
||||
edit.group.open(copyStagedGroup);
|
||||
}, false);
|
||||
|
||||
itemGroupControlItemRemove.addEventListener("click", function() {
|
||||
@ -492,7 +510,7 @@ var link = (function() {
|
||||
},
|
||||
tabindex: function() {
|
||||
var allGroupControlItem = helper.eA(".group-control-item");
|
||||
if (state.get.current().link.edit) {
|
||||
if (state.get.current().edit) {
|
||||
allGroupControlItem.forEach(function(arrayItem, index) {
|
||||
arrayItem.tabIndex = 1;
|
||||
});
|
||||
@ -629,15 +647,15 @@ var link = (function() {
|
||||
var copyStagedLink = JSON.parse(JSON.stringify(stagedLink));
|
||||
|
||||
linkLeft.addEventListener("click", function() {
|
||||
render.move.link.left(copyStagedLink);
|
||||
render.move.item.left(copyStagedLink);
|
||||
}, false);
|
||||
|
||||
linkRight.addEventListener("click", function() {
|
||||
render.move.link.right(copyStagedLink);
|
||||
render.move.item.right(copyStagedLink);
|
||||
}, false);
|
||||
|
||||
linkEdit.addEventListener("click", function() {
|
||||
render.edit.item(copyStagedLink);
|
||||
edit.item.open(copyStagedLink);
|
||||
}, false);
|
||||
|
||||
linkRemove.addEventListener("click", function() {
|
||||
@ -1053,7 +1071,7 @@ var link = (function() {
|
||||
},
|
||||
tabindex: function() {
|
||||
var allLinkControlItem = helper.eA(".link-control-item");
|
||||
if (state.get.current().link.edit) {
|
||||
if (state.get.current().edit) {
|
||||
allLinkControlItem.forEach(function(arrayItem, index) {
|
||||
arrayItem.tabIndex = 1;
|
||||
});
|
||||
@ -1361,13 +1379,12 @@ var link = (function() {
|
||||
render.add = {
|
||||
item: {
|
||||
open: function() {
|
||||
mod.add.item.open();
|
||||
stagedLink.init();
|
||||
var successAction = function() {
|
||||
stagedLink.link.timeStamp = new Date().getTime();
|
||||
bookmarks.mod.add.link(JSON.parse(JSON.stringify(stagedLink)));
|
||||
add.item.close();
|
||||
data.save();
|
||||
mod.add.item.close();
|
||||
groupAndItems();
|
||||
control.render.dependents();
|
||||
control.render.class();
|
||||
@ -1375,11 +1392,8 @@ var link = (function() {
|
||||
pagelock.unlock();
|
||||
};
|
||||
var cancelAction = function() {
|
||||
mod.add.item.close();
|
||||
stagedLink.reset();
|
||||
autoSuggest.close();
|
||||
add.item.close();
|
||||
shade.close();
|
||||
pagelock.unlock();
|
||||
};
|
||||
modal.open({
|
||||
heading: "Add a new Bookmark",
|
||||
@ -1391,21 +1405,16 @@ var link = (function() {
|
||||
});
|
||||
shade.open({
|
||||
action: function() {
|
||||
mod.add.item.close();
|
||||
stagedLink.reset();
|
||||
autoSuggest.close();
|
||||
modal.close();
|
||||
pagelock.unlock();
|
||||
add.item.close();
|
||||
}
|
||||
});
|
||||
pagelock.lock();
|
||||
stagedLink.position.destination.item = helper.e(".link-form-position").selectedIndex;
|
||||
},
|
||||
close: function() {
|
||||
mod.add.item.close();
|
||||
stagedLink.reset();
|
||||
autoSuggest.close();
|
||||
modal.close();
|
||||
shade.close();
|
||||
pagelock.unlock();
|
||||
},
|
||||
selectGroup: function(groupIndex) {
|
||||
@ -1421,22 +1430,20 @@ var link = (function() {
|
||||
},
|
||||
group: {
|
||||
open: function() {
|
||||
mod.add.group.open();
|
||||
stagedGroup.init();
|
||||
var successAction = function() {
|
||||
bookmarks.mod.add.group(JSON.parse(JSON.stringify(stagedGroup)));
|
||||
add.group.close();
|
||||
data.save();
|
||||
mod.add.group.close();
|
||||
groupAndItems();
|
||||
control.render.dependents();
|
||||
control.render.class();
|
||||
shade.close();
|
||||
pagelock.unlock();
|
||||
};
|
||||
var cancelAction = function() {
|
||||
mod.add.group.close();
|
||||
stagedGroup.reset();
|
||||
autoSuggest.close();
|
||||
add.group.close();
|
||||
shade.close();
|
||||
pagelock.unlock();
|
||||
};
|
||||
modal.open({
|
||||
heading: "Add a new Group",
|
||||
@ -1450,113 +1457,114 @@ var link = (function() {
|
||||
});
|
||||
shade.open({
|
||||
action: function() {
|
||||
mod.add.group.close();
|
||||
stagedGroup.reset();
|
||||
autoSuggest.close();
|
||||
modal.close();
|
||||
pagelock.unlock();
|
||||
add.group.close();
|
||||
}
|
||||
});
|
||||
pagelock.lock();
|
||||
stagedGroup.position.destination = helper.e(".group-form-position").selectedIndex;
|
||||
},
|
||||
close: function() {
|
||||
mod.add.group.close();
|
||||
stagedGroup.reset();
|
||||
autoSuggest.close();
|
||||
modal.close();
|
||||
shade.close();
|
||||
pagelock.unlock();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render.edit = {
|
||||
item: function(copyStagedLink) {
|
||||
stagedLink.link = JSON.parse(JSON.stringify(copyStagedLink.link));
|
||||
stagedLink.position = JSON.parse(JSON.stringify(copyStagedLink.position));
|
||||
var form = render.item.form({
|
||||
useStagedLink: true
|
||||
});
|
||||
var heading;
|
||||
if (stagedLink.link.name != null && stagedLink.link.name != "") {
|
||||
heading = "Edit " + stagedLink.link.name;
|
||||
} else {
|
||||
heading = "Edit unnamed bookmark";
|
||||
};
|
||||
var successAction = function() {
|
||||
var copyStagedLink = JSON.parse(JSON.stringify(stagedLink));
|
||||
bookmarks.mod.edit.link(copyStagedLink);
|
||||
data.save();
|
||||
groupAndItems();
|
||||
render.focus.item.current.edit(copyStagedLink);
|
||||
autoSuggest.close();
|
||||
shade.close();
|
||||
pagelock.unlock();
|
||||
};
|
||||
var cancelAction = function() {
|
||||
item: {
|
||||
open: function(copyStagedLink) {
|
||||
stagedLink.link = JSON.parse(JSON.stringify(copyStagedLink.link));
|
||||
stagedLink.position = JSON.parse(JSON.stringify(copyStagedLink.position));
|
||||
var form = render.item.form({
|
||||
useStagedLink: true
|
||||
});
|
||||
var heading;
|
||||
if (stagedLink.link.name != null && stagedLink.link.name != "") {
|
||||
heading = "Edit " + stagedLink.link.name;
|
||||
} else {
|
||||
heading = "Edit unnamed bookmark";
|
||||
};
|
||||
var successAction = function() {
|
||||
var copyStagedLink = JSON.parse(JSON.stringify(stagedLink));
|
||||
bookmarks.mod.edit.link(copyStagedLink);
|
||||
data.save();
|
||||
groupAndItems();
|
||||
render.focus.item.current.edit(copyStagedLink);
|
||||
autoSuggest.close();
|
||||
shade.close();
|
||||
pagelock.unlock();
|
||||
};
|
||||
var cancelAction = function() {
|
||||
edit.item.close();
|
||||
shade.close();
|
||||
};
|
||||
modal.open({
|
||||
heading: heading,
|
||||
successAction: successAction,
|
||||
cancelAction: cancelAction,
|
||||
actionText: "Save",
|
||||
size: "small",
|
||||
content: form
|
||||
});
|
||||
shade.open({
|
||||
action: function() {
|
||||
edit.item.close();
|
||||
}
|
||||
});
|
||||
pagelock.lock();
|
||||
},
|
||||
close: function() {
|
||||
stagedLink.reset();
|
||||
autoSuggest.close();
|
||||
modal.close();
|
||||
pagelock.unlock();
|
||||
shade.close();
|
||||
};
|
||||
modal.open({
|
||||
heading: heading,
|
||||
successAction: successAction,
|
||||
cancelAction: cancelAction,
|
||||
actionText: "Save",
|
||||
size: "small",
|
||||
content: form
|
||||
});
|
||||
shade.open({
|
||||
action: function() {
|
||||
stagedLink.reset();
|
||||
autoSuggest.close();
|
||||
pagelock.unlock();
|
||||
modal.close();
|
||||
}
|
||||
});
|
||||
pagelock.lock();
|
||||
}
|
||||
},
|
||||
group: function(copyStagedGroup) {
|
||||
stagedGroup.group = JSON.parse(JSON.stringify(copyStagedGroup.group));
|
||||
stagedGroup.position = JSON.parse(JSON.stringify(copyStagedGroup.position));
|
||||
var form = render.group.form({
|
||||
useStagedGroup: true
|
||||
});
|
||||
var heading = "Edit " + stagedGroup.group.name;
|
||||
var successAction = function() {
|
||||
var copyStagedGroup = JSON.parse(JSON.stringify(stagedGroup));
|
||||
bookmarks.mod.edit.group(copyStagedGroup);
|
||||
data.save();
|
||||
groupAndItems();
|
||||
render.focus.group.current.edit(copyStagedGroup);
|
||||
autoSuggest.close();
|
||||
shade.close();
|
||||
pagelock.unlock();
|
||||
};
|
||||
var cancelAction = function() {
|
||||
group: {
|
||||
open: function(copyStagedGroup) {
|
||||
stagedGroup.group = JSON.parse(JSON.stringify(copyStagedGroup.group));
|
||||
stagedGroup.position = JSON.parse(JSON.stringify(copyStagedGroup.position));
|
||||
var form = render.group.form({
|
||||
useStagedGroup: true
|
||||
});
|
||||
var heading = "Edit " + stagedGroup.group.name;
|
||||
var successAction = function() {
|
||||
var copyStagedGroup = JSON.parse(JSON.stringify(stagedGroup));
|
||||
bookmarks.mod.edit.group(copyStagedGroup);
|
||||
data.save();
|
||||
groupAndItems();
|
||||
render.focus.group.current.edit(copyStagedGroup);
|
||||
autoSuggest.close();
|
||||
shade.close();
|
||||
pagelock.unlock();
|
||||
};
|
||||
var cancelAction = function() {
|
||||
edit.group.close();
|
||||
shade.close();
|
||||
};
|
||||
modal.open({
|
||||
heading: heading,
|
||||
successAction: successAction,
|
||||
cancelAction: cancelAction,
|
||||
actionText: "Save",
|
||||
size: "small",
|
||||
content: form
|
||||
});
|
||||
shade.open({
|
||||
action: function() {
|
||||
edit.group.close();
|
||||
}
|
||||
});
|
||||
pagelock.lock();
|
||||
},
|
||||
close: function() {
|
||||
stagedGroup.reset();
|
||||
autoSuggest.close();
|
||||
modal.close();
|
||||
pagelock.unlock();
|
||||
shade.close();
|
||||
};
|
||||
modal.open({
|
||||
heading: heading,
|
||||
successAction: successAction,
|
||||
cancelAction: cancelAction,
|
||||
actionText: "Save",
|
||||
size: "small",
|
||||
content: form
|
||||
});
|
||||
shade.open({
|
||||
action: function() {
|
||||
stagedGroup.reset();
|
||||
autoSuggest.close();
|
||||
pagelock.unlock();
|
||||
modal.close();
|
||||
}
|
||||
});
|
||||
pagelock.lock();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -1573,13 +1581,12 @@ var link = (function() {
|
||||
var successAction = function() {
|
||||
var copyStagedLink = JSON.parse(JSON.stringify(stagedLink));
|
||||
bookmarks.remove.link(copyStagedLink);
|
||||
edit.mode.check();
|
||||
data.save();
|
||||
mod.edit.check();
|
||||
header.render.button.edit();
|
||||
groupAndItems();
|
||||
render.focus.item.previous.remove(copyStagedLink);
|
||||
control.render.dependents();
|
||||
control.render.class();
|
||||
render.focus.item.previous.remove(copyStagedLink);
|
||||
shade.close();
|
||||
pagelock.unlock();
|
||||
};
|
||||
@ -1618,13 +1625,12 @@ var link = (function() {
|
||||
var successAction = function() {
|
||||
var copyStagedGroup = JSON.parse(JSON.stringify(stagedGroup));
|
||||
bookmarks.remove.group(copyStagedGroup);
|
||||
edit.mode.check();
|
||||
data.save();
|
||||
mod.edit.check();
|
||||
header.render.button.edit();
|
||||
groupAndItems();
|
||||
render.focus.group.previous.remove(copyStagedGroup);
|
||||
control.render.dependents();
|
||||
control.render.class();
|
||||
render.focus.group.previous.remove(copyStagedGroup);
|
||||
shade.close();
|
||||
pagelock.unlock();
|
||||
};
|
||||
@ -1656,9 +1662,11 @@ var link = (function() {
|
||||
var add = {
|
||||
item: {
|
||||
open: function() {
|
||||
mod.add.item.open();
|
||||
render.add.item.open();
|
||||
},
|
||||
close: function() {
|
||||
mod.add.item.close();
|
||||
render.add.item.close();
|
||||
},
|
||||
selectGroup: function(groupIndex) {
|
||||
@ -1667,35 +1675,61 @@ var link = (function() {
|
||||
},
|
||||
group: {
|
||||
open: function() {
|
||||
mod.add.group.open();
|
||||
render.add.group.open();
|
||||
},
|
||||
close: function() {
|
||||
mod.add.group.close();
|
||||
render.add.group.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var edit = {
|
||||
toggle: function() {
|
||||
mod.edit.toggle();
|
||||
render.group.tabindex();
|
||||
render.item.tabindex();
|
||||
control.render.update();
|
||||
control.render.class();
|
||||
mode: {
|
||||
open: function() {
|
||||
mod.edit.mode.open();
|
||||
control.render.update();
|
||||
control.render.class();
|
||||
},
|
||||
close: function() {
|
||||
mod.edit.mode.close();
|
||||
control.render.update();
|
||||
control.render.class();
|
||||
},
|
||||
check: function() {
|
||||
if (bookmarks.get().length <= 0) {
|
||||
edit.mode.close();
|
||||
};
|
||||
},
|
||||
toggle: function() {
|
||||
if (state.get.current().edit) {
|
||||
edit.mode.close();
|
||||
} else {
|
||||
edit.mode.open();
|
||||
};
|
||||
render.item.tabindex();
|
||||
}
|
||||
},
|
||||
open: function() {
|
||||
mod.edit.open();
|
||||
render.group.tabindex();
|
||||
render.item.tabindex();
|
||||
control.render.update();
|
||||
control.render.class();
|
||||
item: {
|
||||
open: function(copyStagedLink) {
|
||||
mod.edit.item.open();
|
||||
render.edit.item.open(copyStagedLink);
|
||||
},
|
||||
close: function() {
|
||||
mod.edit.item.close();
|
||||
render.edit.item.close();
|
||||
}
|
||||
},
|
||||
close: function() {
|
||||
mod.edit.close();
|
||||
render.group.tabindex();
|
||||
render.item.tabindex();
|
||||
control.render.update();
|
||||
control.render.class();
|
||||
group: {
|
||||
open: function(copyStagedGroup) {
|
||||
mod.edit.group.open();
|
||||
render.edit.group.open(copyStagedGroup);
|
||||
},
|
||||
close: function() {
|
||||
mod.edit.group.close();
|
||||
render.edit.group.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -95,7 +95,10 @@ var menu = (function() {
|
||||
render.tabindex.toggle();
|
||||
shade.open({
|
||||
action: function() {
|
||||
close();
|
||||
mod.close();
|
||||
render.close();
|
||||
render.tabindex.toggle();
|
||||
pagelock.unlock();
|
||||
}
|
||||
});
|
||||
pagelock.lock();
|
||||
|
@ -75,6 +75,7 @@ var shade = (function() {
|
||||
shade.remove();
|
||||
};
|
||||
mod.close();
|
||||
_previousShade = null;
|
||||
};
|
||||
shade.addEventListener("transitionend", function(event, elapsed) {
|
||||
if (event.propertyName === "opacity" && getComputedStyle(this).opacity == 0) {
|
||||
|
@ -195,7 +195,8 @@ var state = (function() {
|
||||
},
|
||||
border: 0,
|
||||
order: "headerbody",
|
||||
add: false
|
||||
add: false,
|
||||
edit: true
|
||||
},
|
||||
layout: {
|
||||
alignment: "centercenter",
|
||||
@ -246,6 +247,7 @@ var state = (function() {
|
||||
accent: 0
|
||||
}
|
||||
},
|
||||
edit: false,
|
||||
pagelock: false,
|
||||
shade: false,
|
||||
edge: false,
|
||||
|
@ -685,6 +685,12 @@ var update = (function() {
|
||||
"4.1.0": function(data) {
|
||||
data.state.link.item.display.gutter = 2;
|
||||
return data;
|
||||
},
|
||||
"4.2.0": function(data) {
|
||||
data.state.edit = false;
|
||||
data.state.link.edit = false;
|
||||
data.state.group.edit = false;
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
var version = (function() {
|
||||
|
||||
var current = "4.1.3";
|
||||
var current = "4.2.1";
|
||||
|
||||
var name = "Enchanting Aardvark";
|
||||
|
||||
|
@ -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": "4.1.3",
|
||||
"version": "4.2.1",
|
||||
"manifest_version": 2,
|
||||
"chrome_url_overrides": {
|
||||
"newtab": "index.html"
|
||||
|
Loading…
Reference in New Issue
Block a user