diff --git a/js/bookmarks.js b/js/bookmarks.js index 9cd87566..6f11e55f 100644 --- a/js/bookmarks.js +++ b/js/bookmarks.js @@ -188,10 +188,17 @@ var bookmarks = (function() { 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++) { - if (all[i].timeStamp === timeStamp) { - all[i] = object; + if (all[i].timeStamp === options.timeStamp) { + all[i] = options.bookmarkData; }; }; }; diff --git a/js/link.js b/js/link.js index 186ff6d7..f4fdb7fa 100644 --- a/js/link.js +++ b/js/link.js @@ -90,7 +90,10 @@ var link = (function() { options.bookmarkData.letter = options.form.querySelector(".link-form-input-letter").value; options.bookmarkData.name = options.form.querySelector(".link-form-input-name").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]();