diff --git a/src/background.js b/src/background.js index f3f3e74..8499907 100644 --- a/src/background.js +++ b/src/background.js @@ -183,7 +183,7 @@ chrome.commands.onCommand.addListener((command) => { chrome.tabs.sendMessage(response.id, {request: "open-omni"}); } else { chrome.tabs.create({ - url: "./newtab.html" + url: "./newtab.html" }).then(() => { newtaburl = response.url; chrome.tabs.remove(response.id); @@ -243,7 +243,7 @@ const getTabs = () => { // Get bookmarks to populate in the actions const getBookmarks = () => { const process_bookmark = (bookmarks) => { - for (const bookmark of bookmarks) { + for (const bookmark of bookmarks) { if (bookmark.url) { actions.push({title:bookmark.title, desc:"Bookmark", id:bookmark.id, url:bookmark.url, type:"bookmark", action:"bookmark", emoji:true, emojiChar:"⭐️", keycheck:false}) } @@ -475,9 +475,11 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { } break; case "search": - chrome.search.query( - {text:message.query} - ) + if (message.openInNewTab) { + chrome.search.query({ text: message.query, disposition: 'NEW_TAB' }); + } else { + chrome.search.query({ text: message.query }); + } break; case "restore-new-tab": restoreNewTab(); diff --git a/src/content.js b/src/content.js index bca5555..67351ee 100644 --- a/src/content.js +++ b/src/content.js @@ -65,7 +65,7 @@ $(document).ready(() => { }); keys += ""; } - + // Check if the action has an emoji or a favicon if (!action.emoji) { var onload = 'if ("naturalHeight" in this) {if (this.naturalHeight + this.naturalWidth === 0) {this.onerror();return;}} else if (this.width + this.height == 0) {this.onerror();return;}'; @@ -279,7 +279,7 @@ $(document).ready(() => { } }); } - + $(".omni-extension #omni-results").html($("#omni-extension #omni-list .omni-item:visible").length+" results"); $(".omni-item-active").removeClass("omni-item-active"); $(".omni-extension #omni-list .omni-item:visible").first().addClass("omni-item-active"); @@ -304,7 +304,7 @@ $(document).ready(() => { window.open($(".omni-item-active").attr("data-url"), "_self"); } } else { - chrome.runtime.sendMessage({request:action.action, tab:action, query:$(".omni-extension input").val()}); + chrome.runtime.sendMessage({ request: action.action, tab: action, query: $(".omni-extension input").val(), openInNewTab: e.ctrlKey || e.metaKey }); switch (action.action) { case "bookmark": if (e.ctrlKey || e.metaKey) {