mirror of
https://github.com/alyssaxuu/omni.git
synced 2026-03-11 08:54:35 +00:00
Merge 507bdab9d9 into 8bd26168ec
This commit is contained in:
commit
51e20bb611
5 changed files with 23 additions and 10 deletions
|
|
@ -8,10 +8,10 @@ const clearActions = () => {
|
|||
const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
||||
let muteaction = {title:"Mute tab", desc:"Mute the current tab", type:"action", action:"mute", emoji:true, emojiChar:"🔇", keycheck:true, keys:['⌥','⇧', 'M']};
|
||||
let pinaction = {title:"Pin tab", desc:"Pin the current tab", type:"action", action:"pin", emoji:true, emojiChar:"📌", keycheck:true, keys:['⌥','⇧', 'P']};
|
||||
if (response.mutedInfo.muted) {
|
||||
if (response?.mutedInfo?.muted) {
|
||||
muteaction = {title:"Unmute tab", desc:"Unmute the current tab", type:"action", action:"unmute", emoji:true, emojiChar:"🔈", keycheck:true, keys:['⌥','⇧', 'M']};
|
||||
}
|
||||
if (response.pinned) {
|
||||
if (response?.pinned) {
|
||||
pinaction = {title:"Unpin tab", desc:"Unpin the current tab", type:"action", action:"unpin", emoji:true, emojiChar:"📌", keycheck:true, keys:['⌥','⇧', 'P']};
|
||||
}
|
||||
actions = [
|
||||
|
|
@ -475,10 +475,17 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
|||
}
|
||||
break;
|
||||
case "search":
|
||||
chrome.search.query(
|
||||
{text:message.query}
|
||||
)
|
||||
break;
|
||||
var query = () =>
|
||||
chrome.search.query({
|
||||
text: message.query,
|
||||
disposition: message.disposition,
|
||||
});
|
||||
if (message.__inNewTab__) {
|
||||
setTimeout(query, 125);
|
||||
} else {
|
||||
query();
|
||||
}
|
||||
break;
|
||||
case "restore-new-tab":
|
||||
restoreNewTab();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
.omni-extension {
|
||||
text-align: left;
|
||||
}
|
||||
/* Scrollbar size */
|
||||
.omni-extension ::-webkit-scrollbar {
|
||||
width: 10px;
|
||||
|
|
|
|||
|
|
@ -20,10 +20,11 @@ $(document).ready(() => {
|
|||
// Request actions from the background
|
||||
chrome.runtime.sendMessage({request:"get-actions"}, (response) => {
|
||||
actions = response.actions;
|
||||
populateOmni()
|
||||
});
|
||||
|
||||
// New tab page workaround
|
||||
if (window.location.href == "chrome-extension://mpanekjjajcabgnlbabmopeenljeoggm/newtab.html") {
|
||||
if (window.__inNewTab__) {
|
||||
isOpen = true;
|
||||
$("#omni-extension").removeClass("omni-closing");
|
||||
window.setTimeout(() => {
|
||||
|
|
@ -131,7 +132,7 @@ $(document).ready(() => {
|
|||
|
||||
// Close the omni
|
||||
function closeOmni() {
|
||||
if (window.location.href == "chrome-extension://mpanekjjajcabgnlbabmopeenljeoggm/newtab.html") {
|
||||
if (window.__inNewTab__) {
|
||||
chrome.runtime.sendMessage({request:"restore-new-tab"});
|
||||
} else {
|
||||
isOpen = false;
|
||||
|
|
@ -304,7 +305,8 @@ $(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()});
|
||||
var disposition = window.__inNewTab__ ? "CURRENT_TAB" : e.altKey || e.metaKey ? "NEW_TAB" : "CURRENT_TAB";
|
||||
chrome.runtime.sendMessage({request:action.action,__inNewTab__:window.__inNewTab__, disposition:disposition, tab:action, query:$(".omni-extension input").val()});
|
||||
switch (action.action) {
|
||||
case "bookmark":
|
||||
if (e.ctrlKey || e.metaKey) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script src="newtab.js"></script>
|
||||
<script src="jquery.js"></script>
|
||||
<script src="content.js"></script>
|
||||
<script src="virtualized-list.min.js"></script>
|
||||
|
|
|
|||
1
src/newtab.js
Normal file
1
src/newtab.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.__inNewTab__ = true;
|
||||
Loading…
Reference in a new issue