This commit is contained in:
Fateh AK 2022-10-17 00:00:40 +05:30 committed by GitHub
commit bf7329ea41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View file

@ -183,7 +183,7 @@ chrome.commands.onCommand.addListener((command) => {
chrome.tabs.sendMessage(response.id, {request: "open-omni"}); chrome.tabs.sendMessage(response.id, {request: "open-omni"});
} else { } else {
chrome.tabs.create({ chrome.tabs.create({
url: "./newtab.html" url: "./newtab.html"
}).then(() => { }).then(() => {
newtaburl = response.url; newtaburl = response.url;
chrome.tabs.remove(response.id); chrome.tabs.remove(response.id);
@ -243,7 +243,7 @@ const getTabs = () => {
// Get bookmarks to populate in the actions // Get bookmarks to populate in the actions
const getBookmarks = () => { const getBookmarks = () => {
const process_bookmark = (bookmarks) => { const process_bookmark = (bookmarks) => {
for (const bookmark of bookmarks) { for (const bookmark of bookmarks) {
if (bookmark.url) { 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}) 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; break;
case "search": case "search":
chrome.search.query( if (message.openInNewTab) {
{text:message.query} chrome.search.query({ text: message.query, disposition: 'NEW_TAB' });
) } else {
chrome.search.query({ text: message.query });
}
break; break;
case "restore-new-tab": case "restore-new-tab":
restoreNewTab(); restoreNewTab();

View file

@ -65,7 +65,7 @@ $(document).ready(() => {
}); });
keys += "</div>"; keys += "</div>";
} }
// Check if the action has an emoji or a favicon // Check if the action has an emoji or a favicon
if (!action.emoji) { 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;}'; 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-extension #omni-results").html($("#omni-extension #omni-list .omni-item:visible").length+" results");
$(".omni-item-active").removeClass("omni-item-active"); $(".omni-item-active").removeClass("omni-item-active");
$(".omni-extension #omni-list .omni-item:visible").first().addClass("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"); window.open($(".omni-item-active").attr("data-url"), "_self");
} }
} else { } 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) { switch (action.action) {
case "bookmark": case "bookmark":
if (e.ctrlKey || e.metaKey) { if (e.ctrlKey || e.metaKey) {