2018-12-26 07:45:53 +00:00
|
|
|
var bookmarks = (function() {
|
|
|
|
|
|
|
|
var all = [{
|
2018-12-28 13:21:16 +00:00
|
|
|
letter: "CM",
|
2018-12-26 07:45:53 +00:00
|
|
|
name: "Citymapper",
|
2019-01-03 22:30:27 +00:00
|
|
|
url: "https://citymapper.com/london/superrouter",
|
|
|
|
timeStamp: 1546453100455
|
2018-12-26 07:45:53 +00:00
|
|
|
}, {
|
2018-12-28 13:21:16 +00:00
|
|
|
letter: "DEV",
|
2018-12-26 07:45:53 +00:00
|
|
|
name: "Devdocs",
|
2019-01-03 22:30:27 +00:00
|
|
|
url: "http://devdocs.io/",
|
|
|
|
timeStamp: 1546453101749
|
2018-12-26 07:45:53 +00:00
|
|
|
}, {
|
2019-01-03 22:30:27 +00:00
|
|
|
letter: "OD",
|
|
|
|
name: "r/opendirectories/",
|
|
|
|
url: "https://www.reddit.com/r/opendirectories/",
|
|
|
|
timeStamp: 1546453102199
|
2018-12-26 07:45:53 +00:00
|
|
|
}, {
|
2018-12-28 13:21:16 +00:00
|
|
|
letter: "KP",
|
2018-12-26 07:45:53 +00:00
|
|
|
name: "Keep",
|
2019-01-03 22:30:27 +00:00
|
|
|
url: "https://keep.google.com/",
|
|
|
|
timeStamp: 1546453102671
|
|
|
|
}, {
|
|
|
|
letter: "MHW",
|
|
|
|
name: "r/monsterhunter/",
|
|
|
|
url: "https://www.reddit.com/r/monsterhunter/",
|
|
|
|
timeStamp: 1546453103110
|
2018-12-26 07:45:53 +00:00
|
|
|
}, {
|
2018-12-28 13:21:16 +00:00
|
|
|
letter: "M",
|
2018-12-26 07:45:53 +00:00
|
|
|
name: "Maps",
|
2019-01-03 22:30:27 +00:00
|
|
|
url: "https://www.google.co.uk/maps",
|
|
|
|
timeStamp: 1546453103560
|
2018-12-26 07:45:53 +00:00
|
|
|
}, {
|
2019-01-03 22:30:27 +00:00
|
|
|
letter: "AS",
|
|
|
|
name: "awesomeSheet",
|
|
|
|
url: "https://zombiefox.github.io/awesomeSheet/",
|
|
|
|
timeStamp: 1546453104010
|
2018-12-26 07:45:53 +00:00
|
|
|
}, {
|
2018-12-28 13:21:16 +00:00
|
|
|
letter: "N",
|
2018-12-26 07:45:53 +00:00
|
|
|
name: "Netflix",
|
2019-01-03 22:30:27 +00:00
|
|
|
url: "https://www.netflix.com/",
|
|
|
|
timeStamp: 1546453104460
|
2018-12-26 07:45:53 +00:00
|
|
|
}, {
|
2018-12-28 13:21:16 +00:00
|
|
|
letter: "P",
|
2018-12-26 07:45:53 +00:00
|
|
|
name: "Photos",
|
2019-01-03 22:30:27 +00:00
|
|
|
url: "https://photos.google.com/",
|
|
|
|
timeStamp: 1546453104910
|
2018-12-26 07:45:53 +00:00
|
|
|
}, {
|
2019-01-03 22:30:27 +00:00
|
|
|
letter: "FB",
|
|
|
|
name: "Facebook",
|
|
|
|
url: "https://www.facebook.com/",
|
|
|
|
timeStamp: 1546453105349
|
2018-12-26 07:45:53 +00:00
|
|
|
}, {
|
2019-01-03 22:30:27 +00:00
|
|
|
letter: "GOT",
|
|
|
|
name: "r/gameofthrones/",
|
|
|
|
url: "https://www.reddit.com/r/gameofthrones/",
|
|
|
|
timeStamp: 1546453105844
|
|
|
|
}, {
|
|
|
|
letter: "BX",
|
|
|
|
name: "Box",
|
|
|
|
url: "https://app.box.com/login/",
|
|
|
|
timeStamp: 1546453106272
|
2018-12-26 07:45:53 +00:00
|
|
|
}, {
|
2018-12-28 13:21:16 +00:00
|
|
|
letter: "TFL",
|
2018-12-26 07:45:53 +00:00
|
|
|
name: "TFL Map",
|
2019-01-03 22:30:27 +00:00
|
|
|
url: "http://content.tfl.gov.uk/standard-tube-map.pdf",
|
|
|
|
timeStamp: 1546453106734
|
2018-12-26 07:45:53 +00:00
|
|
|
}, {
|
2019-01-03 22:30:27 +00:00
|
|
|
letter: "PRG",
|
|
|
|
name: "r/Pathfinder_RPG/",
|
|
|
|
url: "https://www.reddit.com/r/Pathfinder_RPG/",
|
|
|
|
timeStamp: 1546453107194
|
|
|
|
}, {
|
|
|
|
letter: "AZ",
|
|
|
|
name: "Amazon",
|
|
|
|
url: "https://www.amazon.co.uk/",
|
|
|
|
timeStamp: 1546453107633
|
2018-12-26 07:45:53 +00:00
|
|
|
}, {
|
2018-12-28 13:21:16 +00:00
|
|
|
letter: "YT",
|
2018-12-26 07:45:53 +00:00
|
|
|
name: "Youtube",
|
2019-01-03 22:30:27 +00:00
|
|
|
url: "https://www.youtube.com/",
|
|
|
|
timeStamp: 1546453108071
|
|
|
|
}, {
|
|
|
|
letter: "CO",
|
|
|
|
name: "Contacts",
|
|
|
|
url: "https://contacts.google.com/",
|
|
|
|
timeStamp: 1546453108501
|
|
|
|
}, {
|
|
|
|
letter: "GIT",
|
|
|
|
name: "Github",
|
2019-01-05 22:38:54 +00:00
|
|
|
url: "https://github.com/",
|
2019-01-03 22:30:27 +00:00
|
|
|
timeStamp: 1546453108926
|
|
|
|
}, {
|
|
|
|
letter: "AN",
|
|
|
|
name: "r/Android/",
|
|
|
|
url: "https://www.reddit.com/r/Android/",
|
|
|
|
timeStamp: 1546453109355
|
|
|
|
}, {
|
|
|
|
letter: "V",
|
|
|
|
name: "r/videos/",
|
|
|
|
url: "https://www.reddit.com/r/videos/",
|
|
|
|
timeStamp: 1546453109840
|
|
|
|
}, {
|
|
|
|
letter: "GM",
|
|
|
|
name: "Gmail",
|
|
|
|
url: "https://mail.google.com/",
|
|
|
|
timeStamp: 1546453110265
|
|
|
|
}, {
|
|
|
|
letter: "CAL",
|
|
|
|
name: "Calendar",
|
|
|
|
url: "https://www.google.com/calendar/",
|
|
|
|
timeStamp: 1546453110885
|
|
|
|
}, {
|
|
|
|
letter: "R",
|
|
|
|
name: "Reddit",
|
|
|
|
url: "https://www.reddit.com/",
|
|
|
|
timeStamp: 1546453111491
|
|
|
|
}, {
|
|
|
|
letter: "DR",
|
|
|
|
name: "Drive",
|
|
|
|
url: "https://drive.google.com/drive/",
|
|
|
|
timeStamp: 1546453111953
|
|
|
|
}, {
|
|
|
|
letter: "ANA",
|
|
|
|
name: "Analytics",
|
|
|
|
url: "https://analytics.google.com/",
|
|
|
|
timeStamp: 1546453112357
|
|
|
|
}, {
|
|
|
|
letter: "COS",
|
|
|
|
name: "r/chromeos/",
|
|
|
|
url: "https://www.reddit.com/r/chromeos/",
|
|
|
|
timeStamp: 1546453112797
|
2018-12-26 07:45:53 +00:00
|
|
|
}];
|
|
|
|
|
2019-01-03 22:30:27 +00:00
|
|
|
var get = function(timeStamp) {
|
|
|
|
var _singleBookmark = function() {
|
|
|
|
for (var i = 0; i < all.length; i++) {
|
|
|
|
if (all[i].timeStamp === timeStamp) {
|
|
|
|
return all[i];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var _allBookmarks = function() {
|
|
|
|
var by = {
|
|
|
|
none: function(array) {
|
|
|
|
return helper.sortObject(array, "timeStamp");
|
|
|
|
},
|
|
|
|
name: function(array) {
|
|
|
|
return helper.sortObject(array, "name");
|
|
|
|
},
|
|
|
|
letter: function(array) {
|
|
|
|
return helper.sortObject(array, "letter");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
return by[state.get().link.sort](all);
|
|
|
|
};
|
|
|
|
if (timeStamp) {
|
|
|
|
return _singleBookmark(timeStamp);
|
|
|
|
} else {
|
|
|
|
return _allBookmarks();
|
|
|
|
};
|
2018-12-26 07:45:53 +00:00
|
|
|
};
|
|
|
|
|
2019-01-03 22:30:27 +00:00
|
|
|
var restore = function(data) {
|
|
|
|
if ("bookmarks" in data) {
|
|
|
|
all = data.bookmarks;
|
|
|
|
};
|
2018-12-26 07:45:53 +00:00
|
|
|
};
|
|
|
|
|
2019-01-03 22:30:27 +00:00
|
|
|
var add = function(override) {
|
|
|
|
var options = {
|
|
|
|
letter: null,
|
|
|
|
name: null,
|
|
|
|
url: null,
|
|
|
|
timeStamp: null
|
|
|
|
};
|
|
|
|
if (override) {
|
|
|
|
options = helper.applyOptions(options, override);
|
|
|
|
};
|
|
|
|
var newBookmark = {
|
|
|
|
letter: options.letter,
|
|
|
|
name: options.name,
|
|
|
|
url: options.url,
|
|
|
|
timeStamp: options.timeStamp
|
|
|
|
};
|
|
|
|
all.push(newBookmark);
|
2018-12-26 07:45:53 +00:00
|
|
|
};
|
|
|
|
|
2019-01-03 22:30:27 +00:00
|
|
|
var edit = function(object, timeStamp) {
|
|
|
|
for (var i = 0; i < all.length; i++) {
|
|
|
|
if (all[i].timeStamp === timeStamp) {
|
|
|
|
all[i] = object;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
var remove = function(timeStamp) {
|
|
|
|
for (var i = 0; i < all.length; i++) {
|
|
|
|
if (all[i].timeStamp === timeStamp) {
|
|
|
|
all.splice(all.indexOf(all[i]), 1);
|
|
|
|
};
|
|
|
|
};
|
2018-12-26 07:45:53 +00:00
|
|
|
};
|
|
|
|
|
2019-01-03 22:30:27 +00:00
|
|
|
var init = function() {
|
|
|
|
if (data.load()) {
|
|
|
|
restore(data.load());
|
2018-12-26 23:46:53 +00:00
|
|
|
};
|
2018-12-26 07:45:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// exposed methods
|
|
|
|
return {
|
2019-01-03 22:30:27 +00:00
|
|
|
all: all,
|
|
|
|
init: init,
|
2018-12-26 07:45:53 +00:00
|
|
|
get: get,
|
|
|
|
add: add,
|
|
|
|
edit: edit,
|
2019-01-06 15:47:08 +00:00
|
|
|
remove: remove
|
2018-12-26 07:45:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
})();
|