diff --git a/.gitignore b/.gitignore index 1795c8d..47f5367 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.history \ No newline at end of file +.history +.idea diff --git a/firefox/background.js b/firefox/background.js index 6a8f61e..7151be6 100644 --- a/firefox/background.js +++ b/firefox/background.js @@ -181,7 +181,7 @@ browser.commands.onCommand.addListener((command) => { browser.tabs.sendMessage(response.id, {request: "open-omni"}); } else { browser.tabs.create({ - url: "./newtab.html" + url: "./newtab.html" }).then(() => { newtaburl = response.url; browser.tabs.remove(response.id); @@ -241,7 +241,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}) } @@ -280,6 +280,9 @@ const duplicateTab = (tab) => { browser.tabs.duplicate(response.id); }) } +const createTab = (tab = {}) => { + browser.tabs.create(tab) +} const createBookmark = (tab) => { getCurrentTab().then((response) => { browser.bookmarks.create({ @@ -373,6 +376,9 @@ browser.runtime.onMessage.addListener((message, sender, sendResponse) => { case "duplicate-tab": duplicateTab(message.tab); break; + case "new-tab": + createTab(message.tab); + break; case "create-bookmark": createBookmark(message.tab); break; diff --git a/firefox/content.js b/firefox/content.js index cb0b1e6..991e327 100644 --- a/firefox/content.js +++ b/firefox/content.js @@ -66,7 +66,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;}'; @@ -280,7 +280,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"); @@ -333,8 +333,8 @@ $(document).ready(() => { elem.requestFullscreen(); break; case "new-tab": - window.open(""); - break; + browser.runtime.sendMessage({request:"new-tab"}) + break; case "email": window.open("mailto:"); break; diff --git a/src/background.js b/src/background.js index f3f3e74..a076f0b 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}) } @@ -282,6 +282,9 @@ const duplicateTab = (tab) => { chrome.tabs.duplicate(response.id); }) } +const createTab = (tab = {}) => { + chrome.tabs.create(tab) +} const createBookmark = (tab) => { getCurrentTab().then((response) => { chrome.bookmarks.create({ @@ -375,6 +378,9 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { case "duplicate-tab": duplicateTab(message.tab); break; + case "new-tab": + createTab(message.tab); + break; case "create-bookmark": createBookmark(message.tab); break; diff --git a/src/content.js b/src/content.js index bca5555..e122a53 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"); @@ -332,7 +332,7 @@ $(document).ready(() => { elem.requestFullscreen(); break; case "new-tab": - window.open(""); + chrome.runtime.sendMessage({request:"new-tab"}) break; case "email": window.open("mailto:");