mirror of
https://github.com/zombieFox/nightTab.git
synced 2025-01-14 09:58:21 +01:00
[refactor] improve bookmark edit function
This commit is contained in:
parent
f96f3552ea
commit
e87a00453b
@ -188,10 +188,17 @@ var bookmarks = (function() {
|
|||||||
all.push(newBookmark);
|
all.push(newBookmark);
|
||||||
};
|
};
|
||||||
|
|
||||||
var edit = function(object, timeStamp) {
|
var edit = function(override) {
|
||||||
|
var options = {
|
||||||
|
bookmarkData: null,
|
||||||
|
timeStamp: null
|
||||||
|
};
|
||||||
|
if (override) {
|
||||||
|
options = helper.applyOptions(options, override);
|
||||||
|
};
|
||||||
for (var i = 0; i < all.length; i++) {
|
for (var i = 0; i < all.length; i++) {
|
||||||
if (all[i].timeStamp === timeStamp) {
|
if (all[i].timeStamp === options.timeStamp) {
|
||||||
all[i] = object;
|
all[i] = options.bookmarkData;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -90,7 +90,10 @@ var link = (function() {
|
|||||||
options.bookmarkData.letter = options.form.querySelector(".link-form-input-letter").value;
|
options.bookmarkData.letter = options.form.querySelector(".link-form-input-letter").value;
|
||||||
options.bookmarkData.name = options.form.querySelector(".link-form-input-name").value;
|
options.bookmarkData.name = options.form.querySelector(".link-form-input-name").value;
|
||||||
options.bookmarkData.url = options.form.querySelector(".link-form-input-url").value;
|
options.bookmarkData.url = options.form.querySelector(".link-form-input-url").value;
|
||||||
bookmarks.edit(options.bookmarkData, options.bookmarkData.timeStamp);
|
bookmarks.edit({
|
||||||
|
bookmarkData: options.bookmarkData,
|
||||||
|
timeStamp: options.bookmarkData.timeStamp
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
action[options.action]();
|
action[options.action]();
|
||||||
|
Loading…
Reference in New Issue
Block a user