Skip to content

Commit

Permalink
Added trim to title when adding bookmark
Browse files Browse the repository at this point in the history
Signed-off-by: Philipp <p.koenig@blockbyte.de>
  • Loading branch information
Philipp committed Jan 29, 2019
1 parent d455d95 commit f2ec762
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/js/helper/dragndrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
const bookmarkObj = {
index: entryPlaceholder.prevAll("li").length(),
parentId: entryPlaceholder.parent("ul").prev("a").attr($.attr.id),
title: title,
title: title.trim(),
url: url
};

Expand Down
8 changes: 5 additions & 3 deletions src/js/helper/overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,13 +440,15 @@
let urlValue = "";

if (type === "bookmark") { // default bookmark values -> current page information
titleValue = $(document).find("head > title").eq(0).text();
if ($(document).find("head > title").length() > 0) {
titleValue = $(document).find("head > title").eq(0).text().trim();
}
urlValue = location.href;
}

if (data && data.values) { // fill fields with given values
titleValue = data.values.title || "";
urlValue = data.values.url || "";
titleValue = (data.values.title || "").trim();
urlValue = (data.values.url || "").trim();
}

list.append("<li><h2>" + $(e.currentTarget).attr("title") + "</h2></li>");
Expand Down
12 changes: 8 additions & 4 deletions src/js/helper/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@
* @returns {boolean}
*/
this.isBackgroundConnected = () => {
const port = chrome.runtime.connect();
if (port) {
port.disconnect();
return true;
try {
const port = chrome.runtime.connect();
if (port) {
port.disconnect();
return true;
}
} catch (e) {
//
}
return false;
};
Expand Down

0 comments on commit f2ec762

Please sign in to comment.