mirror of
https://github.com/alyssaxuu/omni.git
synced 2026-03-11 08:54:35 +00:00
Cmd / Ctrl key to open links in a new tab
This commit is contained in:
parent
55fb4c0b75
commit
a0023c1d26
1 changed files with 21 additions and 5 deletions
|
|
@ -149,18 +149,26 @@ $(document).ready(function(){
|
|||
}
|
||||
|
||||
// Handle actions from the omni
|
||||
function handleAction() {
|
||||
function handleAction(e) {
|
||||
var action = actions.find(x => x.title == $(".omni-item-active .omni-item-name").text());
|
||||
closeOmni();
|
||||
if ($(".omni-extension input").val().toLowerCase().startsWith("/remove")) {
|
||||
chrome.runtime.sendMessage({request:"remove", type:action.type, action:action});
|
||||
} else if ($(".omni-extension input").val().toLowerCase().startsWith("/history")) {
|
||||
window.open($(".omni-item-active").attr("data-url"), "_self");
|
||||
if (e.ctrlKey || e.metaKey) {
|
||||
window.open($(".omni-item-active").attr("data-url"), "_self");
|
||||
} else {
|
||||
window.open($(".omni-item-active").attr("data-url"));
|
||||
}
|
||||
} else {
|
||||
chrome.runtime.sendMessage({request:action.action, tab:action});
|
||||
switch (action.action) {
|
||||
case "bookmark":
|
||||
window.open(action.url, "_self");
|
||||
if (e.ctrlKey || e.metaKey) {
|
||||
window.open(action.url);
|
||||
} else {
|
||||
window.open(action.url, "_self");
|
||||
}
|
||||
break;
|
||||
case "scroll-bottom":
|
||||
window.scrollTo(0,document.body.scrollHeight);
|
||||
|
|
@ -172,7 +180,11 @@ $(document).ready(function(){
|
|||
window.close();
|
||||
break;
|
||||
case "navigation":
|
||||
window.open(action.url, "_self");
|
||||
if (e.ctrlKey) {
|
||||
window.open(action.url);
|
||||
} else {
|
||||
window.open(action.url, "_self");
|
||||
}
|
||||
break;
|
||||
case "fullscreen":
|
||||
var elem = document.documentElement;
|
||||
|
|
@ -185,7 +197,11 @@ $(document).ready(function(){
|
|||
window.open("mailto:");
|
||||
break;
|
||||
case "url":
|
||||
window.open(action.url, "_self");
|
||||
if (e.ctrlKey || e.metaKey) {
|
||||
window.open(action.url);
|
||||
} else {
|
||||
window.open(action.url, "_self");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue