diff --git a/.prettierrc.json b/.prettierrc.json
new file mode 100644
index 0000000..0967ef4
--- /dev/null
+++ b/.prettierrc.json
@@ -0,0 +1 @@
+{}
diff --git a/README.md b/README.md
index b105f64..409496a 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
# Omni
+

@@ -11,30 +12,34 @@ With Omni you can use Chrome like a pro. Manage tabs, bookmarks, your browser hi
Made by [Alyssa X](https://alyssax.com)
## Table of contents
+
- [Features](#features)
- [Controlling the interface](#controlling-the-interface)
- - [Opening Omni](#opening-omni)
- - [Closing Omni](#closing-omni)
- - [Switching between dark and light mode](#switching-between-dark-and-light-mode)
+ - [Opening Omni](#opening-omni)
+ - [Closing Omni](#closing-omni)
+ - [Switching between dark and light mode](#switching-between-dark-and-light-mode)
- [List of commands](#list-of-commands)
- [Libraries used](#libraries-used)
## Features
+
๐ Switch, open, close, and search your tabs
๐ Browse and manage your bookmarks
๐ Search your browsing history
โก๏ธ 50+ actions to improve your productivity
๐ฎ Special commands to filter and perform more actions
๐งฉ Integrations with Notion, Figma, Docs, Asana...
โจ๏ธ Shortcuts for actions such as muting, pinning, bookmarking...
โ๏ธ Advanced settings to help troubleshoot browsing issues
๐ Dark mode
...and much more - all for free & no sign in needed!
## Controlling the interface
### Opening Omni
-To open Omni, simply press `โ+K` on Mac or `Ctrl+K` on Windows. You can change the shortcut by going to chrome://extensions/shortcuts.
+To open Omni, simply press `โ+K` on Mac or `Ctrl+K` on Windows. You can change the shortcut by going to chrome://extensions/shortcuts.
Alternatively you can click on the extension icon in the toolbar to toggle it.
### Closing Omni
+
To close Omni you can press `Esc`, click on the background, or press the extension icon.
### Switching between dark and light mode
-The dark and light theme in Omni is tied to your system's theme.
+
+The dark and light theme in Omni is tied to your system's theme.
On Mac you can change the theme by clicking on the Apple menu (on the top left), opening the System preferences, going into the General section, and then choosing between dark, light, or auto.
@@ -43,6 +48,7 @@ On Windows it depends on the OS version. [Here is a guide for Windows 11 and 10.
After switching the theme you might need to restart Chrome.
## List of commands
+
You can use a variety of commands with Omni to perform actions or filter your results.
- **/tabs**: Search your tabs
@@ -53,6 +59,8 @@ You can use a variety of commands with Omni to perform actions or filter your re
## Libraries used
-- [jQuery](https://jquery.com/) - for better event handling and DOM manipulation
+- [jQuery](https://jquery.com/) - for better event handling and DOM manipulation
+
#
- Feel free to reach out to me through email at hi@alyssax.com or [on Twitter](https://twitter.com/alyssaxuu) if you have any questions or feedback! Hope you find this useful ๐
+
+Feel free to reach out to me through email at hi@alyssax.com or [on Twitter](https://twitter.com/alyssaxuu) if you have any questions or feedback! Hope you find this useful ๐
diff --git a/src/assets/jquery.nice-select.min.js b/src/assets/jquery.nice-select.min.js
index 88eb2d6..fcf983f 100644
--- a/src/assets/jquery.nice-select.min.js
+++ b/src/assets/jquery.nice-select.min.js
@@ -1,4 +1,119 @@
/* jQuery Nice Select - v1.0
https://github.com/hernansartorio/jquery-nice-select
Made by Hernรกn Sartorio */
-!function(e){e.fn.niceSelect=function(t){function s(t){t.after(e("
").addClass("nice-select").addClass(t.attr("class")||"").addClass(t.attr("disabled")?"disabled":"").attr("tabindex",t.attr("disabled")?null:"0").html(''));var s=t.next(),n=t.find("option"),i=t.find("option:selected");s.find(".current").html(i.data("display")||i.text()),n.each(function(t){var n=e(this),i=n.data("display");s.find("ul").append(e("").attr("data-value",n.val()).attr("data-display",i||null).addClass("option"+(n.is(":selected")?" selected":"")+(n.is(":disabled")?" disabled":"")).html(n.text()))})}if("string"==typeof t)return"update"==t?this.each(function(){var t=e(this),n=e(this).next(".nice-select"),i=n.hasClass("open");n.length&&(n.remove(),s(t),i&&t.next().trigger("click"))}):"destroy"==t?(this.each(function(){var t=e(this),s=e(this).next(".nice-select");s.length&&(s.remove(),t.css("display",""))}),0==e(".nice-select").length&&e(document).off(".nice_select")):console.log('Method "'+t+'" does not exist.'),this;this.hide(),this.each(function(){var t=e(this);t.next().hasClass("nice-select")||s(t)}),e(document).off(".nice_select"),e(document).on("click.nice_select",".nice-select",function(t){var s=e(this);e(".nice-select").not(s).removeClass("open"),s.toggleClass("open"),s.hasClass("open")?(s.find(".option"),s.find(".focus").removeClass("focus"),s.find(".selected").addClass("focus")):s.focus()}),e(document).on("click.nice_select",function(t){0===e(t.target).closest(".nice-select").length&&e(".nice-select").removeClass("open").find(".option")}),e(document).on("click.nice_select",".nice-select .option:not(.disabled)",function(t){var s=e(this),n=s.closest(".nice-select");n.find(".selected").removeClass("selected"),s.addClass("selected");var i=s.data("display")||s.text();n.find(".current").text(i),n.prev("select").val(s.data("value")).trigger("change")}),e(document).on("keydown.nice_select",".nice-select",function(t){var s=e(this),n=e(s.find(".focus")||s.find(".list .option.selected"));if(32==t.keyCode||13==t.keyCode)return s.hasClass("open")?n.trigger("click"):s.trigger("click"),!1;if(40==t.keyCode){if(s.hasClass("open")){var i=n.nextAll(".option:not(.disabled)").first();i.length>0&&(s.find(".focus").removeClass("focus"),i.addClass("focus"))}else s.trigger("click");return!1}if(38==t.keyCode){if(s.hasClass("open")){var l=n.prevAll(".option:not(.disabled)").first();l.length>0&&(s.find(".focus").removeClass("focus"),l.addClass("focus"))}else s.trigger("click");return!1}if(27==t.keyCode)s.hasClass("open")&&s.trigger("click");else if(9==t.keyCode&&s.hasClass("open"))return!1});var n=document.createElement("a").style;return n.cssText="pointer-events:auto","auto"!==n.pointerEvents&&e("html").addClass("no-csspointerevents"),this}}(jQuery);
\ No newline at end of file
+!(function (e) {
+ e.fn.niceSelect = function (t) {
+ function s(t) {
+ t.after(
+ e("")
+ .addClass("nice-select")
+ .addClass(t.attr("class") || "")
+ .addClass(t.attr("disabled") ? "disabled" : "")
+ .attr("tabindex", t.attr("disabled") ? null : "0")
+ .html('')
+ );
+ var s = t.next(),
+ n = t.find("option"),
+ i = t.find("option:selected");
+ s.find(".current").html(i.data("display") || i.text()),
+ n.each(function (t) {
+ var n = e(this),
+ i = n.data("display");
+ s.find("ul").append(
+ e("")
+ .attr("data-value", n.val())
+ .attr("data-display", i || null)
+ .addClass(
+ "option" +
+ (n.is(":selected") ? " selected" : "") +
+ (n.is(":disabled") ? " disabled" : "")
+ )
+ .html(n.text())
+ );
+ });
+ }
+ if ("string" == typeof t)
+ return (
+ "update" == t
+ ? this.each(function () {
+ var t = e(this),
+ n = e(this).next(".nice-select"),
+ i = n.hasClass("open");
+ n.length && (n.remove(), s(t), i && t.next().trigger("click"));
+ })
+ : "destroy" == t
+ ? (this.each(function () {
+ var t = e(this),
+ s = e(this).next(".nice-select");
+ s.length && (s.remove(), t.css("display", ""));
+ }),
+ 0 == e(".nice-select").length && e(document).off(".nice_select"))
+ : console.log('Method "' + t + '" does not exist.'),
+ this
+ );
+ this.hide(),
+ this.each(function () {
+ var t = e(this);
+ t.next().hasClass("nice-select") || s(t);
+ }),
+ e(document).off(".nice_select"),
+ e(document).on("click.nice_select", ".nice-select", function (t) {
+ var s = e(this);
+ e(".nice-select").not(s).removeClass("open"),
+ s.toggleClass("open"),
+ s.hasClass("open")
+ ? (s.find(".option"),
+ s.find(".focus").removeClass("focus"),
+ s.find(".selected").addClass("focus"))
+ : s.focus();
+ }),
+ e(document).on("click.nice_select", function (t) {
+ 0 === e(t.target).closest(".nice-select").length &&
+ e(".nice-select").removeClass("open").find(".option");
+ }),
+ e(document).on(
+ "click.nice_select",
+ ".nice-select .option:not(.disabled)",
+ function (t) {
+ var s = e(this),
+ n = s.closest(".nice-select");
+ n.find(".selected").removeClass("selected"), s.addClass("selected");
+ var i = s.data("display") || s.text();
+ n.find(".current").text(i),
+ n.prev("select").val(s.data("value")).trigger("change");
+ }
+ ),
+ e(document).on("keydown.nice_select", ".nice-select", function (t) {
+ var s = e(this),
+ n = e(s.find(".focus") || s.find(".list .option.selected"));
+ if (32 == t.keyCode || 13 == t.keyCode)
+ return (
+ s.hasClass("open") ? n.trigger("click") : s.trigger("click"), !1
+ );
+ if (40 == t.keyCode) {
+ if (s.hasClass("open")) {
+ var i = n.nextAll(".option:not(.disabled)").first();
+ i.length > 0 &&
+ (s.find(".focus").removeClass("focus"), i.addClass("focus"));
+ } else s.trigger("click");
+ return !1;
+ }
+ if (38 == t.keyCode) {
+ if (s.hasClass("open")) {
+ var l = n.prevAll(".option:not(.disabled)").first();
+ l.length > 0 &&
+ (s.find(".focus").removeClass("focus"), l.addClass("focus"));
+ } else s.trigger("click");
+ return !1;
+ }
+ if (27 == t.keyCode) s.hasClass("open") && s.trigger("click");
+ else if (9 == t.keyCode && s.hasClass("open")) return !1;
+ });
+ var n = document.createElement("a").style;
+ return (
+ (n.cssText = "pointer-events:auto"),
+ "auto" !== n.pointerEvents && e("html").addClass("no-csspointerevents"),
+ this
+ );
+ };
+})(jQuery);
diff --git a/src/assets/nice-select.css b/src/assets/nice-select.css
index d72a7cb..0ef3c39 100644
--- a/src/assets/nice-select.css
+++ b/src/assets/nice-select.css
@@ -21,118 +21,146 @@
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
-webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
white-space: nowrap;
- width: auto; }
- .nice-select:hover {
- border-color: #dbdbdb; }
- .nice-select:active, .nice-select.open, .nice-select:focus {
- border-color: #999; }
- .nice-select:after {
- border-bottom: 2px solid #999;
- border-right: 2px solid #999;
- content: '';
- display: block;
- height: 5px;
- margin-top: -4px;
- pointer-events: none;
- position: absolute;
- right: 12px;
- top: 50%;
- -webkit-transform-origin: 66% 66%;
- -ms-transform-origin: 66% 66%;
- transform-origin: 66% 66%;
- -webkit-transform: rotate(45deg);
- -ms-transform: rotate(45deg);
- transform: rotate(45deg);
- -webkit-transition: all 0.15s ease-in-out;
- transition: all 0.15s ease-in-out;
- width: 5px; }
- .nice-select.open:after {
- -webkit-transform: rotate(-135deg);
- -ms-transform: rotate(-135deg);
- transform: rotate(-135deg); }
- .nice-select.open .list {
- opacity: 1;
- pointer-events: auto;
- -webkit-transform: scale(1) translateY(0);
- -ms-transform: scale(1) translateY(0);
- transform: scale(1) translateY(0); }
- .nice-select.disabled {
- border-color: #ededed;
- color: #999;
- pointer-events: none; }
- .nice-select.disabled:after {
- border-color: #cccccc; }
- .nice-select.wide {
- width: 100%; }
- .nice-select.wide .list {
- left: 0 !important;
- right: 0 !important; }
- .nice-select.right {
- float: right; }
- .nice-select.right .list {
- left: auto;
- right: 0; }
- .nice-select.small {
- font-size: 12px;
- height: 36px;
- line-height: 34px; }
- .nice-select.small:after {
- height: 4px;
- width: 4px; }
- .nice-select.small .option {
- line-height: 34px;
- min-height: 34px; }
- .nice-select .list {
- background-color: #fff;
- border-radius: 5px;
- box-shadow: 0 0 0 1px rgba(68, 68, 68, 0.11);
- box-sizing: border-box;
- margin-top: 4px;
- opacity: 0;
- overflow: hidden;
- padding: 0;
- pointer-events: none;
- position: absolute;
- top: 100%;
- left: 0;
- -webkit-transform-origin: 50% 0;
- -ms-transform-origin: 50% 0;
- transform-origin: 50% 0;
- -webkit-transform: scale(0.75) translateY(-21px);
- -ms-transform: scale(0.75) translateY(-21px);
- transform: scale(0.75) translateY(-21px);
- -webkit-transition: all 0.2s cubic-bezier(0.5, 0, 0, 1.25), opacity 0.15s ease-out;
- transition: all 0.2s cubic-bezier(0.5, 0, 0, 1.25), opacity 0.15s ease-out;
- z-index: 9; }
- .nice-select .list:hover .option:not(:hover) {
- background-color: transparent !important; }
- .nice-select .option {
- cursor: pointer;
- font-weight: 400;
- line-height: 40px;
- list-style: none;
- min-height: 40px;
- outline: none;
- padding-left: 18px;
- padding-right: 29px;
- text-align: left;
- -webkit-transition: all 0.2s;
- transition: all 0.2s; }
- .nice-select .option:hover, .nice-select .option.focus, .nice-select .option.selected.focus {
- background-color: #f6f6f6; }
- .nice-select .option.selected {
- font-weight: bold; }
- .nice-select .option.disabled {
- background-color: transparent;
- color: #999;
- cursor: default; }
+ width: auto;
+}
+.nice-select:hover {
+ border-color: #dbdbdb;
+}
+.nice-select:active,
+.nice-select.open,
+.nice-select:focus {
+ border-color: #999;
+}
+.nice-select:after {
+ border-bottom: 2px solid #999;
+ border-right: 2px solid #999;
+ content: "";
+ display: block;
+ height: 5px;
+ margin-top: -4px;
+ pointer-events: none;
+ position: absolute;
+ right: 12px;
+ top: 50%;
+ -webkit-transform-origin: 66% 66%;
+ -ms-transform-origin: 66% 66%;
+ transform-origin: 66% 66%;
+ -webkit-transform: rotate(45deg);
+ -ms-transform: rotate(45deg);
+ transform: rotate(45deg);
+ -webkit-transition: all 0.15s ease-in-out;
+ transition: all 0.15s ease-in-out;
+ width: 5px;
+}
+.nice-select.open:after {
+ -webkit-transform: rotate(-135deg);
+ -ms-transform: rotate(-135deg);
+ transform: rotate(-135deg);
+}
+.nice-select.open .list {
+ opacity: 1;
+ pointer-events: auto;
+ -webkit-transform: scale(1) translateY(0);
+ -ms-transform: scale(1) translateY(0);
+ transform: scale(1) translateY(0);
+}
+.nice-select.disabled {
+ border-color: #ededed;
+ color: #999;
+ pointer-events: none;
+}
+.nice-select.disabled:after {
+ border-color: #cccccc;
+}
+.nice-select.wide {
+ width: 100%;
+}
+.nice-select.wide .list {
+ left: 0 !important;
+ right: 0 !important;
+}
+.nice-select.right {
+ float: right;
+}
+.nice-select.right .list {
+ left: auto;
+ right: 0;
+}
+.nice-select.small {
+ font-size: 12px;
+ height: 36px;
+ line-height: 34px;
+}
+.nice-select.small:after {
+ height: 4px;
+ width: 4px;
+}
+.nice-select.small .option {
+ line-height: 34px;
+ min-height: 34px;
+}
+.nice-select .list {
+ background-color: #fff;
+ border-radius: 5px;
+ box-shadow: 0 0 0 1px rgba(68, 68, 68, 0.11);
+ box-sizing: border-box;
+ margin-top: 4px;
+ opacity: 0;
+ overflow: hidden;
+ padding: 0;
+ pointer-events: none;
+ position: absolute;
+ top: 100%;
+ left: 0;
+ -webkit-transform-origin: 50% 0;
+ -ms-transform-origin: 50% 0;
+ transform-origin: 50% 0;
+ -webkit-transform: scale(0.75) translateY(-21px);
+ -ms-transform: scale(0.75) translateY(-21px);
+ transform: scale(0.75) translateY(-21px);
+ -webkit-transition: all 0.2s cubic-bezier(0.5, 0, 0, 1.25),
+ opacity 0.15s ease-out;
+ transition: all 0.2s cubic-bezier(0.5, 0, 0, 1.25), opacity 0.15s ease-out;
+ z-index: 9;
+}
+.nice-select .list:hover .option:not(:hover) {
+ background-color: transparent !important;
+}
+.nice-select .option {
+ cursor: pointer;
+ font-weight: 400;
+ line-height: 40px;
+ list-style: none;
+ min-height: 40px;
+ outline: none;
+ padding-left: 18px;
+ padding-right: 29px;
+ text-align: left;
+ -webkit-transition: all 0.2s;
+ transition: all 0.2s;
+}
+.nice-select .option:hover,
+.nice-select .option.focus,
+.nice-select .option.selected.focus {
+ background-color: #f6f6f6;
+}
+.nice-select .option.selected {
+ font-weight: bold;
+}
+.nice-select .option.disabled {
+ background-color: transparent;
+ color: #999;
+ cursor: default;
+}
.no-csspointerevents .nice-select .list {
- display: none; }
+ display: none;
+}
.no-csspointerevents .nice-select.open .list {
- display: block; }
+ display: block;
+}
diff --git a/src/background.js b/src/background.js
index cf62644..8506a08 100644
--- a/src/background.js
+++ b/src/background.js
@@ -3,169 +3,708 @@ var actions = [];
// Inject Omni on install
chrome.manifest = chrome.runtime.getManifest();
var injectIntoTab = function (tab) {
- var scripts = chrome.manifest.content_scripts[0].js;
- var i = 0, s = scripts.length;
- for( ; i < s; i++ ) {
- chrome.scripting.executeScript({
- target: {tabId: tab.id},
- files: [scripts[i]]
- });
- }
-}
+ var scripts = chrome.manifest.content_scripts[0].js;
+ var i = 0,
+ s = scripts.length;
+ for (; i < s; i++) {
+ chrome.scripting.executeScript({
+ target: { tabId: tab.id },
+ files: [scripts[i]],
+ });
+ }
+};
// Get all windows
-chrome.windows.getAll({
- populate: true
-}, function (windows) {
- var i = 0, w = windows.length, currentWindow;
- for( ; i < w; i++ ) {
- currentWindow = windows[i];
- var j = 0, t = currentWindow.tabs.length, currentTab;
- for( ; j < t; j++ ) {
- currentTab = currentWindow.tabs[j];
- injectIntoTab(currentTab);
- }
+chrome.windows.getAll(
+ {
+ populate: true,
+ },
+ function (windows) {
+ var i = 0,
+ w = windows.length,
+ currentWindow;
+ for (; i < w; i++) {
+ currentWindow = windows[i];
+ var j = 0,
+ t = currentWindow.tabs.length,
+ currentTab;
+ for (; j < t; j++) {
+ currentTab = currentWindow.tabs[j];
+ injectIntoTab(currentTab);
+ }
}
-});
+ }
+);
// Clear actions and append default ones
function clearActions() {
- getCurrentTab().then((response) => {
- var isMac = navigator.platform.toUpperCase().indexOf('MAC')>=0;
- var muteaction = {title:"Mute tab", desc:"Mute the current tab", type:"action", action:"mute", emoji:true, emojiChar:"๐", keycheck:true, keys:['โฅ','โง', 'M']};
- var pinaction = {title:"Pin tab", desc:"Pin the current tab", type:"action", action:"pin", emoji:true, emojiChar:"๐", keycheck:true, keys:['โฅ','โง', 'P']};
- 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) {
- pinaction = {title:"Unpin tab", desc:"Unpin the current tab", type:"action", action:"unpin", emoji:true, emojiChar:"๐", keycheck:true, keys:['โฅ','โง', 'P']};
- }
- actions = [
- {title:"New tab", desc:"Open a new tab", type:"action", action:"new-tab", emoji:true, emojiChar:"โจ", keycheck:true, keys:['โ','T']},
- {title:"Bookmark", desc:"Create a bookmark", type:"action", action:"create-bookmark", emoji:true, emojiChar:"๐", keycheck:true, keys:['โ','D']},
- pinaction,
- {title:"Fullscreen", desc:"Make the page fullscreen", type:"action", action:"fullscreen", emoji:true, emojiChar:"๐ฅ", keycheck:true, keys:['โ', 'Ctrl', 'F']},
- muteaction,
- {title:"Reload", desc:"Reload the page", type:"action", action:"reload", emoji:true, emojiChar:"โป๏ธ", keycheck:true, keys:['โ','โง', 'R']},
- {title:"Help", desc:"Get help with Omni on GitHub", type:"action", action:"url", url:"https://github.com/alyssaxuu/omni", emoji:true, emojiChar:"๐ค", keycheck:false},
- {title:"Compose email", desc:"Compose a new email", type:"action", action:"email", emoji:true, emojiChar:"โ๏ธ", keycheck:true, keys:['โฅ','โง', 'C']},
- {title:"New Notion page", desc:"Create a new Notion page", type:"action", action:"url", url:"https://notion.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-notion.png"), keycheck:false},
- {title:"New Sheets spreadsheet", desc:"Create a new Google Sheets spreadsheet", type:"action", action:"url", url:"https://sheets.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-sheets.png"), keycheck:false},
- {title:"New Docs document", desc:"Create a new Google Docs document", type:"action", action:"url", emoji:false, url:"https://docs.new", favIconUrl:chrome.runtime.getURL("assets/logo-docs.png"), keycheck:false},
- {title:"New Slides presentation", desc:"Create a new Google Slides presentation", type:"action", action:"url", url:"https://slides.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-slides.png"), keycheck:false},
- {title:"New form", desc:"Create a new Google Forms form", type:"action", action:"url", url:"https://forms.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-forms.png"), keycheck:false},
- {title:"New Medium story", desc:"Create a new Medium story", type:"action", action:"url", url:"https://story.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-medium.png"), keycheck:false},
- {title:"New GitHub repository", desc:"Create a new GitHub repository", type:"action", action:"url", url:"https://github.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-github.png"), keycheck:false},
- {title:"New GitHub gist", desc:"Create a new GitHub gist", type:"action", action:"url", url:"https://gist.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-github.png"), keycheck:false},
- {title:"New CodePen pen", desc:"Create a new CodePen pen", type:"action", action:"url", url:"https://pen.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-codepen.png"), keycheck:false},
- {title:"New Excel spreadsheet", desc:"Create a new Excel spreadsheet", type:"action", action:"url", url:"https://excel.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-excel.png"), keycheck:false},
- {title:"New PowerPoint presentation", desc:"Create a new PowerPoint presentation", type:"action", url:"https://powerpoint.new", action:"url", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-powerpoint.png"), keycheck:false},
- {title:"New Word document", desc:"Create a new Word document", type:"action", action:"url", url:"https://word.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-word.png"), keycheck:false},
- {title:"Create a whiteboard", desc:"Create a collaborative whiteboard", type:"action", action:"url", url:"https://whiteboard.new", emoji:true, emojiChar:"๐งโ๐ซ", keycheck:false},
- {title:"Record a video", desc:"Record and edit a video", type:"action", action:"url", url:"https://recording.new", emoji:true, emojiChar:"๐น", keycheck:false},
- {title:"Create a Figma file", desc:"Create a new Figma file", type:"action", action:"url", url:"https://figma.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-figma.png"), keycheck:false},
- {title:"Create a FigJam file", desc:"Create a new FigJam file", type:"action", action:"url", url:"https://figjam.new", emoji:true, emojiChar:"๐", keycheck:false},
- {title:"Hunt a product", desc:"Submit a product to Product Hunt", type:"action", action:"url", url:"https://www.producthunt.com/posts/new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-producthunt.png"), keycheck:false},
- {title:"Make a tweet", desc:"Make a tweet on Twitter", type:"action", action:"url", url:"https://twitter.com/intent/tweet", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-twitter.png"), keycheck:false},
- {title:"Create a playlist", desc:"Create a Spotify playlist", type:"action", action:"url", url:"https://playlist.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-spotify.png"), keycheck:false},
- {title:"Create a Canva design", desc:"Create a new design with Canva", type:"action", action:"url", url:"https://design.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-canva.png"), keycheck:false},
- {title:"Create a new podcast episode", desc:"Create a new podcast episode with Anchor", type:"action", action:"url", url:"https://episode.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-anchor.png"), keycheck:false},
- {title:"Edit an image", desc:"Edit an image with Adobe Photoshop", type:"action", action:"url", url:"https://photo.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-photoshop.png"), keycheck:false},
- {title:"Convert to PDF", desc:"Convert a file to PDF", type:"action", action:"url", url:"https://pdf.new", emoji:true, emojiChar:"๐", keycheck:false},
- {title:"Scan a QR code", desc:"Scan a QR code with your camera", type:"action", action:"url", url:"https://scan.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-qr.png"), keycheck:false},
- {title:"Add a task to Asana", desc:"Create a new task in Asana", type:"action", action:"url", url:"https://task.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-asana.png"), keycheck:false},
- {title:"Add an issue to Linear", desc:"Create a new issue in Linear", type:"action", action:"url", url:"https://linear.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-linear.png"), keycheck:false},
- {title:"Add a task to WIP", desc:"Create a new task in WIP", type:"action", action:"url", url:"https://todo.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-wip.png"), keycheck:false},
- {title:"Create an event", desc:"Add an event to Google Calendar", type:"action", action:"url", url:"https://cal.new", emoji:false, favIconUrl:chrome.runtime.getURL("assets/logo-calendar.png"), keycheck:false},
- {title:"Add a note", desc:"Add a note to Google Keep", type:"action", action:"url", emoji:false, url:"https://note.new", favIconUrl:chrome.runtime.getURL("assets/logo-keep.png"), keycheck:false},
- {title:"New meeting", desc:"Start a Google Meet meeting", type:"action", action:"url", emoji:false, url:"https://meet.new", favIconUrl:chrome.runtime.getURL("assets/logo-meet.png"), keycheck:false},
- {title:"Browsing history", desc:"Browse through your browsing history", type:"action", action:"history", emoji:true, emojiChar:"๐", keycheck:true, keys:['โ','Y']},
- {title:"Incognito mode", desc:"Open an incognito window", type:"action", action:"incognito", emoji:true, emojiChar:"๐ต๏ธ", keycheck:true, keys:['โ','โง', 'N']},
- {title:"Downloads", desc:"Browse through your downloads", type:"action", action:"downloads", emoji:true, emojiChar:"๐ฆ", keycheck:true, keys:['โ','โง', 'J']},
- {title:"Extensions", desc:"Manage your Chrome Extensions", type:"action", action:"extensions", emoji:true, emojiChar:"๐งฉ", keycheck:false, keys:['โ','D']},
- {title:"Chrome settings", desc:"Open the Chrome settings", type:"action", action:"settings", emoji:true, emojiChar:"โ๏ธ", keycheck:true, keys:['โ',',']},
- {title:"Scroll to bottom", desc:"Scroll to the bottom of the page", type:"action", action:"scroll-bottom", emoji:true, emojiChar:"๐", keycheck:true, keys:['โ','โ']},
- {title:"Scroll to top", desc:"Scroll to the top of the page", type:"action", action:"scroll-top", emoji:true, emojiChar:"๐", keycheck:true, keys:['โ','โ']},
- {title:"Go back", desc:"Go back in history for the current tab", type:"action", action:"go-back", emoji:true, emojiChar:"๐", keycheck:true, keys:['โ','โ']},
- {title:"Go forward", desc:"Go forward in history for the current tab", type:"action", action:"go-forward", emoji:true, emojiChar:"๐", keycheck:true, keys:['โ','โ']},
- {title:"Duplicate tab", desc:"Make a copy of the current tab", type:"action", action:"duplicate-tab", emoji:true, emojiChar:"๐", keycheck:true, keys:['โฅ','โง', 'D']},
- {title:"Close tab", desc:"Close the current tab", type:"action", action:"close-tab", emoji:true, emojiChar:"๐", keycheck:true, keys:['โ','W']},
- {title:"Close window", desc:"Close the current window", type:"action", action:"close-window", emoji:true, emojiChar:"๐ฅ", keycheck:true, keys:['โ','โง', 'W']},
- {title:"Manage browsing data", desc:"Manage your browsing data", type:"action", action:"manage-data", emoji:true, emojiChar:"๐ฌ", keycheck:true, keys:['โ','โง', 'Delete']},
- {title:"Clear all browsing data", desc:"Clear all of your browsing data", type:"action", action:"remove-all", emoji:true, emojiChar:"๐งน", keycheck:false, keys:['โ','D']},
- {title:"Clear browsing history", desc:"Clear all of your browsing history", type:"action", action:"remove-history", emoji:true, emojiChar:"๐", keycheck:false, keys:['โ','D']},
- {title:"Clear cookies", desc:"Clear all cookies", type:"action", action:"remove-cookies", emoji:true, emojiChar:"๐ช", keycheck:false, keys:['โ','D']},
- {title:"Clear cache", desc:"Clear the cache", type:"action", action:"remove-cache", emoji:true, emojiChar:"๐", keycheck:false, keys:['โ','D']},
- {title:"Clear local storage", desc:"Clear the local storage", type:"action", action:"remove-local-storage", emoji:true, emojiChar:"๐ฆ", keycheck:false, keys:['โ','D']},
- {title:"Clear passwords", desc:"Clear all saved passwords", type:"action", action:"remove-passwords", emoji:true, emojiChar:"๐", keycheck:false, keys:['โ','D']},
- ];
- if (!isMac) {
- actions.forEach(function(action){
- if (action.action == "reload") {
- action.keys = ['F5'];
- } else if (action.action == "fullscreen") {
- action.keys = ['F11'];
- } else if (action.action == "downloads") {
- action.keys = ['Ctrl', 'J'];
- } else if (action.action == "settings") {
- action.keycheck = false;
- } else if (action.action = "history") {
- action.keys = ['Ctrl', 'H'];
- } else if (action.action == "go-back") {
- action.keys = ['Alt','โ'];
- } else if (action.action == "go-forward") {
- action.keys = ['Alt','โ']
- } else if (action.action == "scroll-top") {
- action.keys = ['Home'];
- } else if (action.action == "scroll-bottom") {
- action.keys = ['End'];
- }
- actions.keys.forEach(function(key){
- if (key == "โ") {
- key = "Ctrl";
- } else if (key == "โฅ") {
- key = "Alt";
- }
- });
- });
- }
- });
+ getCurrentTab().then((response) => {
+ var isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0;
+ var muteaction = {
+ title: "Mute tab",
+ desc: "Mute the current tab",
+ type: "action",
+ action: "mute",
+ emoji: true,
+ emojiChar: "๐",
+ keycheck: true,
+ keys: ["โฅ", "โง", "M"],
+ };
+ var pinaction = {
+ title: "Pin tab",
+ desc: "Pin the current tab",
+ type: "action",
+ action: "pin",
+ emoji: true,
+ emojiChar: "๐",
+ keycheck: true,
+ keys: ["โฅ", "โง", "P"],
+ };
+ 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) {
+ pinaction = {
+ title: "Unpin tab",
+ desc: "Unpin the current tab",
+ type: "action",
+ action: "unpin",
+ emoji: true,
+ emojiChar: "๐",
+ keycheck: true,
+ keys: ["โฅ", "โง", "P"],
+ };
+ }
+ actions = [
+ {
+ title: "New tab",
+ desc: "Open a new tab",
+ type: "action",
+ action: "new-tab",
+ emoji: true,
+ emojiChar: "โจ",
+ keycheck: true,
+ keys: ["โ", "T"],
+ },
+ {
+ title: "Bookmark",
+ desc: "Create a bookmark",
+ type: "action",
+ action: "create-bookmark",
+ emoji: true,
+ emojiChar: "๐",
+ keycheck: true,
+ keys: ["โ", "D"],
+ },
+ pinaction,
+ {
+ title: "Fullscreen",
+ desc: "Make the page fullscreen",
+ type: "action",
+ action: "fullscreen",
+ emoji: true,
+ emojiChar: "๐ฅ",
+ keycheck: true,
+ keys: ["โ", "Ctrl", "F"],
+ },
+ muteaction,
+ {
+ title: "Reload",
+ desc: "Reload the page",
+ type: "action",
+ action: "reload",
+ emoji: true,
+ emojiChar: "โป๏ธ",
+ keycheck: true,
+ keys: ["โ", "โง", "R"],
+ },
+ {
+ title: "Help",
+ desc: "Get help with Omni on GitHub",
+ type: "action",
+ action: "url",
+ url: "https://github.com/alyssaxuu/omni",
+ emoji: true,
+ emojiChar: "๐ค",
+ keycheck: false,
+ },
+ {
+ title: "Compose email",
+ desc: "Compose a new email",
+ type: "action",
+ action: "email",
+ emoji: true,
+ emojiChar: "โ๏ธ",
+ keycheck: true,
+ keys: ["โฅ", "โง", "C"],
+ },
+ {
+ title: "New Notion page",
+ desc: "Create a new Notion page",
+ type: "action",
+ action: "url",
+ url: "https://notion.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-notion.png"),
+ keycheck: false,
+ },
+ {
+ title: "New Sheets spreadsheet",
+ desc: "Create a new Google Sheets spreadsheet",
+ type: "action",
+ action: "url",
+ url: "https://sheets.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-sheets.png"),
+ keycheck: false,
+ },
+ {
+ title: "New Docs document",
+ desc: "Create a new Google Docs document",
+ type: "action",
+ action: "url",
+ emoji: false,
+ url: "https://docs.new",
+ favIconUrl: chrome.runtime.getURL("assets/logo-docs.png"),
+ keycheck: false,
+ },
+ {
+ title: "New Slides presentation",
+ desc: "Create a new Google Slides presentation",
+ type: "action",
+ action: "url",
+ url: "https://slides.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-slides.png"),
+ keycheck: false,
+ },
+ {
+ title: "New form",
+ desc: "Create a new Google Forms form",
+ type: "action",
+ action: "url",
+ url: "https://forms.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-forms.png"),
+ keycheck: false,
+ },
+ {
+ title: "New Medium story",
+ desc: "Create a new Medium story",
+ type: "action",
+ action: "url",
+ url: "https://story.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-medium.png"),
+ keycheck: false,
+ },
+ {
+ title: "New GitHub repository",
+ desc: "Create a new GitHub repository",
+ type: "action",
+ action: "url",
+ url: "https://github.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-github.png"),
+ keycheck: false,
+ },
+ {
+ title: "New GitHub gist",
+ desc: "Create a new GitHub gist",
+ type: "action",
+ action: "url",
+ url: "https://gist.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-github.png"),
+ keycheck: false,
+ },
+ {
+ title: "New CodePen pen",
+ desc: "Create a new CodePen pen",
+ type: "action",
+ action: "url",
+ url: "https://pen.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-codepen.png"),
+ keycheck: false,
+ },
+ {
+ title: "New Excel spreadsheet",
+ desc: "Create a new Excel spreadsheet",
+ type: "action",
+ action: "url",
+ url: "https://excel.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-excel.png"),
+ keycheck: false,
+ },
+ {
+ title: "New PowerPoint presentation",
+ desc: "Create a new PowerPoint presentation",
+ type: "action",
+ url: "https://powerpoint.new",
+ action: "url",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-powerpoint.png"),
+ keycheck: false,
+ },
+ {
+ title: "New Word document",
+ desc: "Create a new Word document",
+ type: "action",
+ action: "url",
+ url: "https://word.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-word.png"),
+ keycheck: false,
+ },
+ {
+ title: "Create a whiteboard",
+ desc: "Create a collaborative whiteboard",
+ type: "action",
+ action: "url",
+ url: "https://whiteboard.new",
+ emoji: true,
+ emojiChar: "๐งโ๐ซ",
+ keycheck: false,
+ },
+ {
+ title: "Record a video",
+ desc: "Record and edit a video",
+ type: "action",
+ action: "url",
+ url: "https://recording.new",
+ emoji: true,
+ emojiChar: "๐น",
+ keycheck: false,
+ },
+ {
+ title: "Create a Figma file",
+ desc: "Create a new Figma file",
+ type: "action",
+ action: "url",
+ url: "https://figma.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-figma.png"),
+ keycheck: false,
+ },
+ {
+ title: "Create a FigJam file",
+ desc: "Create a new FigJam file",
+ type: "action",
+ action: "url",
+ url: "https://figjam.new",
+ emoji: true,
+ emojiChar: "๐",
+ keycheck: false,
+ },
+ {
+ title: "Hunt a product",
+ desc: "Submit a product to Product Hunt",
+ type: "action",
+ action: "url",
+ url: "https://www.producthunt.com/posts/new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-producthunt.png"),
+ keycheck: false,
+ },
+ {
+ title: "Make a tweet",
+ desc: "Make a tweet on Twitter",
+ type: "action",
+ action: "url",
+ url: "https://twitter.com/intent/tweet",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-twitter.png"),
+ keycheck: false,
+ },
+ {
+ title: "Create a playlist",
+ desc: "Create a Spotify playlist",
+ type: "action",
+ action: "url",
+ url: "https://playlist.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-spotify.png"),
+ keycheck: false,
+ },
+ {
+ title: "Create a Canva design",
+ desc: "Create a new design with Canva",
+ type: "action",
+ action: "url",
+ url: "https://design.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-canva.png"),
+ keycheck: false,
+ },
+ {
+ title: "Create a new podcast episode",
+ desc: "Create a new podcast episode with Anchor",
+ type: "action",
+ action: "url",
+ url: "https://episode.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-anchor.png"),
+ keycheck: false,
+ },
+ {
+ title: "Edit an image",
+ desc: "Edit an image with Adobe Photoshop",
+ type: "action",
+ action: "url",
+ url: "https://photo.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-photoshop.png"),
+ keycheck: false,
+ },
+ {
+ title: "Convert to PDF",
+ desc: "Convert a file to PDF",
+ type: "action",
+ action: "url",
+ url: "https://pdf.new",
+ emoji: true,
+ emojiChar: "๐",
+ keycheck: false,
+ },
+ {
+ title: "Scan a QR code",
+ desc: "Scan a QR code with your camera",
+ type: "action",
+ action: "url",
+ url: "https://scan.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-qr.png"),
+ keycheck: false,
+ },
+ {
+ title: "Add a task to Asana",
+ desc: "Create a new task in Asana",
+ type: "action",
+ action: "url",
+ url: "https://task.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-asana.png"),
+ keycheck: false,
+ },
+ {
+ title: "Add an issue to Linear",
+ desc: "Create a new issue in Linear",
+ type: "action",
+ action: "url",
+ url: "https://linear.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-linear.png"),
+ keycheck: false,
+ },
+ {
+ title: "Add a task to WIP",
+ desc: "Create a new task in WIP",
+ type: "action",
+ action: "url",
+ url: "https://todo.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-wip.png"),
+ keycheck: false,
+ },
+ {
+ title: "Create an event",
+ desc: "Add an event to Google Calendar",
+ type: "action",
+ action: "url",
+ url: "https://cal.new",
+ emoji: false,
+ favIconUrl: chrome.runtime.getURL("assets/logo-calendar.png"),
+ keycheck: false,
+ },
+ {
+ title: "Add a note",
+ desc: "Add a note to Google Keep",
+ type: "action",
+ action: "url",
+ emoji: false,
+ url: "https://note.new",
+ favIconUrl: chrome.runtime.getURL("assets/logo-keep.png"),
+ keycheck: false,
+ },
+ {
+ title: "New meeting",
+ desc: "Start a Google Meet meeting",
+ type: "action",
+ action: "url",
+ emoji: false,
+ url: "https://meet.new",
+ favIconUrl: chrome.runtime.getURL("assets/logo-meet.png"),
+ keycheck: false,
+ },
+ {
+ title: "Browsing history",
+ desc: "Browse through your browsing history",
+ type: "action",
+ action: "history",
+ emoji: true,
+ emojiChar: "๐",
+ keycheck: true,
+ keys: ["โ", "Y"],
+ },
+ {
+ title: "Incognito mode",
+ desc: "Open an incognito window",
+ type: "action",
+ action: "incognito",
+ emoji: true,
+ emojiChar: "๐ต๏ธ",
+ keycheck: true,
+ keys: ["โ", "โง", "N"],
+ },
+ {
+ title: "Downloads",
+ desc: "Browse through your downloads",
+ type: "action",
+ action: "downloads",
+ emoji: true,
+ emojiChar: "๐ฆ",
+ keycheck: true,
+ keys: ["โ", "โง", "J"],
+ },
+ {
+ title: "Extensions",
+ desc: "Manage your Chrome Extensions",
+ type: "action",
+ action: "extensions",
+ emoji: true,
+ emojiChar: "๐งฉ",
+ keycheck: false,
+ keys: ["โ", "D"],
+ },
+ {
+ title: "Chrome settings",
+ desc: "Open the Chrome settings",
+ type: "action",
+ action: "settings",
+ emoji: true,
+ emojiChar: "โ๏ธ",
+ keycheck: true,
+ keys: ["โ", ","],
+ },
+ {
+ title: "Scroll to bottom",
+ desc: "Scroll to the bottom of the page",
+ type: "action",
+ action: "scroll-bottom",
+ emoji: true,
+ emojiChar: "๐",
+ keycheck: true,
+ keys: ["โ", "โ"],
+ },
+ {
+ title: "Scroll to top",
+ desc: "Scroll to the top of the page",
+ type: "action",
+ action: "scroll-top",
+ emoji: true,
+ emojiChar: "๐",
+ keycheck: true,
+ keys: ["โ", "โ"],
+ },
+ {
+ title: "Go back",
+ desc: "Go back in history for the current tab",
+ type: "action",
+ action: "go-back",
+ emoji: true,
+ emojiChar: "๐",
+ keycheck: true,
+ keys: ["โ", "โ"],
+ },
+ {
+ title: "Go forward",
+ desc: "Go forward in history for the current tab",
+ type: "action",
+ action: "go-forward",
+ emoji: true,
+ emojiChar: "๐",
+ keycheck: true,
+ keys: ["โ", "โ"],
+ },
+ {
+ title: "Duplicate tab",
+ desc: "Make a copy of the current tab",
+ type: "action",
+ action: "duplicate-tab",
+ emoji: true,
+ emojiChar: "๐",
+ keycheck: true,
+ keys: ["โฅ", "โง", "D"],
+ },
+ {
+ title: "Close tab",
+ desc: "Close the current tab",
+ type: "action",
+ action: "close-tab",
+ emoji: true,
+ emojiChar: "๐",
+ keycheck: true,
+ keys: ["โ", "W"],
+ },
+ {
+ title: "Close window",
+ desc: "Close the current window",
+ type: "action",
+ action: "close-window",
+ emoji: true,
+ emojiChar: "๐ฅ",
+ keycheck: true,
+ keys: ["โ", "โง", "W"],
+ },
+ {
+ title: "Manage browsing data",
+ desc: "Manage your browsing data",
+ type: "action",
+ action: "manage-data",
+ emoji: true,
+ emojiChar: "๐ฌ",
+ keycheck: true,
+ keys: ["โ", "โง", "Delete"],
+ },
+ {
+ title: "Clear all browsing data",
+ desc: "Clear all of your browsing data",
+ type: "action",
+ action: "remove-all",
+ emoji: true,
+ emojiChar: "๐งน",
+ keycheck: false,
+ keys: ["โ", "D"],
+ },
+ {
+ title: "Clear browsing history",
+ desc: "Clear all of your browsing history",
+ type: "action",
+ action: "remove-history",
+ emoji: true,
+ emojiChar: "๐",
+ keycheck: false,
+ keys: ["โ", "D"],
+ },
+ {
+ title: "Clear cookies",
+ desc: "Clear all cookies",
+ type: "action",
+ action: "remove-cookies",
+ emoji: true,
+ emojiChar: "๐ช",
+ keycheck: false,
+ keys: ["โ", "D"],
+ },
+ {
+ title: "Clear cache",
+ desc: "Clear the cache",
+ type: "action",
+ action: "remove-cache",
+ emoji: true,
+ emojiChar: "๐",
+ keycheck: false,
+ keys: ["โ", "D"],
+ },
+ {
+ title: "Clear local storage",
+ desc: "Clear the local storage",
+ type: "action",
+ action: "remove-local-storage",
+ emoji: true,
+ emojiChar: "๐ฆ",
+ keycheck: false,
+ keys: ["โ", "D"],
+ },
+ {
+ title: "Clear passwords",
+ desc: "Clear all saved passwords",
+ type: "action",
+ action: "remove-passwords",
+ emoji: true,
+ emojiChar: "๐",
+ keycheck: false,
+ keys: ["โ", "D"],
+ },
+ ];
+ if (!isMac) {
+ actions.forEach(function (action) {
+ if (action.action == "reload") {
+ action.keys = ["F5"];
+ } else if (action.action == "fullscreen") {
+ action.keys = ["F11"];
+ } else if (action.action == "downloads") {
+ action.keys = ["Ctrl", "J"];
+ } else if (action.action == "settings") {
+ action.keycheck = false;
+ } else if ((action.action = "history")) {
+ action.keys = ["Ctrl", "H"];
+ } else if (action.action == "go-back") {
+ action.keys = ["Alt", "โ"];
+ } else if (action.action == "go-forward") {
+ action.keys = ["Alt", "โ"];
+ } else if (action.action == "scroll-top") {
+ action.keys = ["Home"];
+ } else if (action.action == "scroll-bottom") {
+ action.keys = ["End"];
+ }
+ actions.keys.forEach(function (key) {
+ if (key == "โ") {
+ key = "Ctrl";
+ } else if (key == "โฅ") {
+ key = "Alt";
+ }
+ });
+ });
+ }
+ });
}
// Open on install
chrome.runtime.onInstalled.addListener(function (object) {
- chrome.tabs.create({url: "https://alyssax.com/omni/"});
+ chrome.tabs.create({ url: "https://alyssax.com/omni/" });
});
// Check when the extension button is clicked
chrome.action.onClicked.addListener((tab) => {
- chrome.tabs.sendMessage(tab.id, {request: "open-omni"});
+ chrome.tabs.sendMessage(tab.id, { request: "open-omni" });
});
// Listen for the open omni shortcut
chrome.commands.onCommand.addListener((command) => {
- if (command = "open-omni") {
- chrome.tabs.query({active: true, currentWindow: true}, function(tabs){
- chrome.tabs.sendMessage(tabs[0].id, {request: "open-omni"});
- });
- }
+ if ((command = "open-omni")) {
+ chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
+ chrome.tabs.sendMessage(tabs[0].id, { request: "open-omni" });
+ });
+ }
});
// Check if tabs have changed and actions need to be fetched again
-chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
- clearActions();
- getTabs();
- getBookmarks();
+chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
+ clearActions();
+ getTabs();
+ getBookmarks();
});
-chrome.tabs.onCreated.addListener(function(tabId, changeInfo, tab) {
- clearActions();
- getTabs();
- getBookmarks();
+chrome.tabs.onCreated.addListener(function (tabId, changeInfo, tab) {
+ clearActions();
+ getTabs();
+ getBookmarks();
});
-chrome.tabs.onRemoved.addListener(function(tabId, changeInfo, tab) {
- clearActions();
- getTabs();
- getBookmarks();
+chrome.tabs.onRemoved.addListener(function (tabId, changeInfo, tab) {
+ clearActions();
+ getTabs();
+ getBookmarks();
});
// Get the current tab
@@ -177,191 +716,215 @@ async function getCurrentTab() {
// Get tabs to populate in the actions
function getTabs() {
- chrome.tabs.query({}, function(tabs) {
- tabs.forEach(function(tab){
+ chrome.tabs.query({}, function (tabs) {
+ tabs.forEach(function (tab) {
tab.desc = "Chrome tab";
tab.keycheck = false;
- tab.action = "switch-tab";
- tab.type = "tab";
- })
- actions = tabs.concat(actions);
+ tab.action = "switch-tab";
+ tab.type = "tab";
+ });
+ actions = tabs.concat(actions);
});
}
// Get bookmarks to populate in the actions
function getBookmarks() {
- function process_bookmark(bookmarks) {
- for (var i = 0; i < bookmarks.length; i++) {
- var bookmark = bookmarks[i];
- if (bookmark.url) {
- actions.push({title:bookmark.title, desc:"Bookmark", id:bookmark.id, type:"bookmark", action:"bookmark", emoji:true, emojiChar:"โญ๏ธ", keycheck:false})
- }
- if (bookmark.children) {
- process_bookmark(bookmark.children);
- }
- }
- }
- chrome.bookmarks.getTree(process_bookmark);
+ function process_bookmark(bookmarks) {
+ for (var i = 0; i < bookmarks.length; i++) {
+ var bookmark = bookmarks[i];
+ if (bookmark.url) {
+ actions.push({
+ title: bookmark.title,
+ desc: "Bookmark",
+ id: bookmark.id,
+ type: "bookmark",
+ action: "bookmark",
+ emoji: true,
+ emojiChar: "โญ๏ธ",
+ keycheck: false,
+ });
+ }
+ if (bookmark.children) {
+ process_bookmark(bookmark.children);
+ }
+ }
+ }
+ chrome.bookmarks.getTree(process_bookmark);
}
// Lots of different actions
function switchTab(tab) {
- chrome.tabs.highlight({
- tabs: tab.index
- })
+ chrome.tabs.highlight({
+ tabs: tab.index,
+ });
}
function goBack(tab) {
- chrome.tabs.goBack({
- tabs: tab.index
- })
+ chrome.tabs.goBack({
+ tabs: tab.index,
+ });
}
-function goForward(tab){
- chrome.tabs.goForward({
- tabs: tab.index
- })
+function goForward(tab) {
+ chrome.tabs.goForward({
+ tabs: tab.index,
+ });
}
function duplicateTab(tab) {
- getCurrentTab().then((response) => {
- chrome.tabs.duplicate(response.id);
- })
+ getCurrentTab().then((response) => {
+ chrome.tabs.duplicate(response.id);
+ });
}
function createBookmark(tab) {
- getCurrentTab().then((response) => {
- chrome.bookmarks.create({
- title: response.title,
- url: response.url
- });
- })
+ getCurrentTab().then((response) => {
+ chrome.bookmarks.create({
+ title: response.title,
+ url: response.url,
+ });
+ });
}
function muteTab(mute) {
- getCurrentTab().then((response) => {
- chrome.tabs.update(response.id, {"muted": mute})
- });
+ getCurrentTab().then((response) => {
+ chrome.tabs.update(response.id, { muted: mute });
+ });
}
function reloadTab() {
- chrome.tabs.reload();
+ chrome.tabs.reload();
}
function pinTab(pin) {
- getCurrentTab().then((response) => {
- chrome.tabs.update(response.id, {"pinned": pin})
- });
+ getCurrentTab().then((response) => {
+ chrome.tabs.update(response.id, { pinned: pin });
+ });
}
function clearAllData() {
- chrome.browsingData.remove({
- "since": (new Date()).getTime()
- }, {
- "appcache": true,
- "cache": true,
- "cacheStorage": true,
- "cookies": true,
- "downloads": true,
- "fileSystems": true,
- "formData": true,
- "history": true,
- "indexedDB": true,
- "localStorage": true,
- "passwords": true,
- "serviceWorkers": true,
- "webSQL": true
- });
+ chrome.browsingData.remove(
+ {
+ since: new Date().getTime(),
+ },
+ {
+ appcache: true,
+ cache: true,
+ cacheStorage: true,
+ cookies: true,
+ downloads: true,
+ fileSystems: true,
+ formData: true,
+ history: true,
+ indexedDB: true,
+ localStorage: true,
+ passwords: true,
+ serviceWorkers: true,
+ webSQL: true,
+ }
+ );
}
function clearBrowsingData() {
- chrome.browsingData.removeHistory({"since": 0});
+ chrome.browsingData.removeHistory({ since: 0 });
}
function clearCookies() {
- chrome.browsingData.removeCookies({"since": 0});
+ chrome.browsingData.removeCookies({ since: 0 });
}
function clearCache() {
- chrome.browsingData.removeCache({"since": 0});
+ chrome.browsingData.removeCache({ since: 0 });
}
function clearLocalStorage() {
- chrome.browsingData.removeLocalStorage({"since": 0});
+ chrome.browsingData.removeLocalStorage({ since: 0 });
}
function clearPasswords() {
- chrome.browsingData.removePasswords({"since": 0});
+ chrome.browsingData.removePasswords({ since: 0 });
}
function openChromeUrl(url) {
- chrome.tabs.create({url: 'chrome://'+url+'/'});
+ chrome.tabs.create({ url: "chrome://" + url + "/" });
}
function openIncognito() {
- chrome.windows.create({"incognito": true});
+ chrome.windows.create({ incognito: true });
}
function closeWindow(id) {
- chrome.windows.remove(id);
+ chrome.windows.remove(id);
}
function closeTab(tab) {
- chrome.tabs.remove(tab.id);
+ chrome.tabs.remove(tab.id);
}
function removeBookmark(bookmark) {
- chrome.bookmarks.remove(bookmark.id);
+ chrome.bookmarks.remove(bookmark.id);
}
// Recieve messages from any tab
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.request == "get-actions") {
- clearActions();
- getTabs();
- getBookmarks();
- sendResponse({actions:actions});
+ clearActions();
+ getTabs();
+ getBookmarks();
+ sendResponse({ actions: actions });
} else if (message.request == "switch-tab") {
- switchTab(message.tab);
- } else if (message.request == "go-back") {
- goBack(message.tab);
- } else if (message.request == "go-forward") {
- goForward(message.tab);
- } else if (message.request == "duplicate-tab") {
- duplicateTab(message.tab);
- } else if (message.request == "create-bookmark") {
- createBookmark(message.tab);
- } else if (message.request == "mute") {
- muteTab(true);
- } else if (message.request == "unmute") {
- muteTab(false);
- } else if (message.request == "reload") {
- reloadTab();
- } else if (message.request == "pin") {
- pinTab(true);
- } else if (message.request == "unpin") {
- pinTab(false);
- } else if (message.request == "remove-all") {
- clearAllData();
- } else if (message.request == "remove-history") {
- clearBrowsingData();
- } else if (message.request == "remove-cookies") {
- clearCookies();
- } else if (message.request == "remove-cache") {
- clearCache();
- } else if (message.request == "remove-local-storage") {
- clearLocalStorage();
- } else if (message.request == "remove-passwords") {
- clearPasswords();
- } else if (message.request == "history" || message.request == "downloads" || message.request == "extensions" || message.request == "settings" || message.request == "extensions/shortcuts") {
- openChromeUrl(message.request);
- } else if (message.request == "manage-data") {
- openChromeUrl("settings/clearBrowserData");
- } else if (message.request == "incognito") {
- openIncognito();
- } else if (message.request == "close-window") {
- closeWindow(sender.tab.windowId);
- } else if (message.request == "search-history") {
- chrome.history.search({text:message.query, maxResults:1000, startTime:31536000000*5}).then(function(data){
- data.forEach(function(action){
- action.type = "history";
- action.emoji = true;
- action.emojiChar = "๐";
- action.action = "history";
- action.desc = "Browsing history";
- });
- sendResponse({history:data});
- })
- return true;
- } else if (message.request == "remove") {
- if (message.type == "bookmark") {
- removeBookmark(message.action);
- } else {
- closeTab(message.action);
- }
- }
+ switchTab(message.tab);
+ } else if (message.request == "go-back") {
+ goBack(message.tab);
+ } else if (message.request == "go-forward") {
+ goForward(message.tab);
+ } else if (message.request == "duplicate-tab") {
+ duplicateTab(message.tab);
+ } else if (message.request == "create-bookmark") {
+ createBookmark(message.tab);
+ } else if (message.request == "mute") {
+ muteTab(true);
+ } else if (message.request == "unmute") {
+ muteTab(false);
+ } else if (message.request == "reload") {
+ reloadTab();
+ } else if (message.request == "pin") {
+ pinTab(true);
+ } else if (message.request == "unpin") {
+ pinTab(false);
+ } else if (message.request == "remove-all") {
+ clearAllData();
+ } else if (message.request == "remove-history") {
+ clearBrowsingData();
+ } else if (message.request == "remove-cookies") {
+ clearCookies();
+ } else if (message.request == "remove-cache") {
+ clearCache();
+ } else if (message.request == "remove-local-storage") {
+ clearLocalStorage();
+ } else if (message.request == "remove-passwords") {
+ clearPasswords();
+ } else if (
+ message.request == "history" ||
+ message.request == "downloads" ||
+ message.request == "extensions" ||
+ message.request == "settings" ||
+ message.request == "extensions/shortcuts"
+ ) {
+ openChromeUrl(message.request);
+ } else if (message.request == "manage-data") {
+ openChromeUrl("settings/clearBrowserData");
+ } else if (message.request == "incognito") {
+ openIncognito();
+ } else if (message.request == "close-window") {
+ closeWindow(sender.tab.windowId);
+ } else if (message.request == "search-history") {
+ chrome.history
+ .search({
+ text: message.query,
+ maxResults: 1000,
+ startTime: 31536000000 * 5,
+ })
+ .then(function (data) {
+ data.forEach(function (action) {
+ action.type = "history";
+ action.emoji = true;
+ action.emojiChar = "๐";
+ action.action = "history";
+ action.desc = "Browsing history";
+ });
+ sendResponse({ history: data });
+ });
+ return true;
+ } else if (message.request == "remove") {
+ if (message.type == "bookmark") {
+ removeBookmark(message.action);
+ } else {
+ closeTab(message.action);
+ }
+ }
});
// Get actions
diff --git a/src/content.css b/src/content.css
index 400bf4f..d3aae3a 100644
--- a/src/content.css
+++ b/src/content.css
@@ -1,67 +1,67 @@
@media (prefers-color-scheme: dark) {
- :root {
- --background: #1E2128;
- --border: #35373E;
- --text: #F1F1F1;
- --text-2: #C5C6CA;
- --text-3: #A5A5AE;
- --select: #17191E;
- --accent: #6068D2;
- --accent-hover: #484FAC;
- --shortcut: #383E4A;
- --placeholder: #63687B;
- --background-2: #292D36;
- }
+ :root {
+ --background: #1e2128;
+ --border: #35373e;
+ --text: #f1f1f1;
+ --text-2: #c5c6ca;
+ --text-3: #a5a5ae;
+ --select: #17191e;
+ --accent: #6068d2;
+ --accent-hover: #484fac;
+ --shortcut: #383e4a;
+ --placeholder: #63687b;
+ --background-2: #292d36;
+ }
}
@media (prefers-color-scheme: light) {
- :root {
- --background: #FAFCFF;
- --border: #F2F3FB;
- --text: #2B2D41;
- --text-2: #2B2D41;
- --text-3: #929DB2;
- --select: #EFF3F9;
- --accent: #6068D2;
- --accent-hover: #484FAC;
- --shortcut: #DADEEA;
- --placeholder: #BAC2D1;
- --background-2: #292D36;
- }
+ :root {
+ --background: #fafcff;
+ --border: #f2f3fb;
+ --text: #2b2d41;
+ --text-2: #2b2d41;
+ --text-3: #929db2;
+ --select: #eff3f9;
+ --accent: #6068d2;
+ --accent-hover: #484fac;
+ --shortcut: #dadeea;
+ --placeholder: #bac2d1;
+ --background-2: #292d36;
+ }
}
@font-face {
- font-family: 'Inter';
- font-style: normal;
- font-weight: 400;
- src: url('chrome-extension://__MSG_@@extension_id__/assets/Inter-Regular.ttf');
+ font-family: "Inter";
+ font-style: normal;
+ font-weight: 400;
+ src: url("chrome-extension://__MSG_@@extension_id__/assets/Inter-Regular.ttf");
}
@font-face {
- font-family: 'Inter';
- font-style: normal;
- font-weight: 500;
- src: url('chrome-extension://__MSG_@@extension_id__/assets/Inter-Medium.ttf');
+ font-family: "Inter";
+ font-style: normal;
+ font-weight: 500;
+ src: url("chrome-extension://__MSG_@@extension_id__/assets/Inter-Medium.ttf");
}
@font-face {
- font-family: 'Inter';
- font-style: normal;
- font-weight: 600;
- src: url('chrome-extension://__MSG_@@extension_id__/assets/Inter-SemiBold.ttf');
+ font-family: "Inter";
+ font-style: normal;
+ font-weight: 600;
+ src: url("chrome-extension://__MSG_@@extension_id__/assets/Inter-SemiBold.ttf");
}
@font-face {
- font-family: 'Inter';
- font-style: normal;
- font-weight: 700;
- src: url('chrome-extension://__MSG_@@extension_id__/assets/Inter-Bold.ttf');
+ font-family: "Inter";
+ font-style: normal;
+ font-weight: 700;
+ src: url("chrome-extension://__MSG_@@extension_id__/assets/Inter-Bold.ttf");
}
.omni-extension .omni-item-details * {
- line-height: normal;
+ line-height: normal;
}
.omni-extension {
- font-family: Inter!important;
- z-index: 99999999999;
+ font-family: Inter !important;
+ z-index: 99999999999;
}
.omni-extension #omni-wrap {
- position: fixed;
+ position: fixed;
width: 700px;
border: 1px solid transparent;
border-radius: 5px;
@@ -72,7 +72,7 @@
left: 0px;
z-index: 9999999999;
height: 540px;
- transition: all .2s cubic-bezier(.05,.03,.35,1);
+ transition: all 0.2s cubic-bezier(0.05, 0.03, 0.35, 1);
}
.omni-extension #omni {
position: absolute;
@@ -84,16 +84,16 @@
left: 0px;
z-index: 9999999998;
height: fit-content;
- transition: all .2s cubic-bezier(.05,.03,.35,1);
- display: block;
+ transition: all 0.2s cubic-bezier(0.05, 0.03, 0.35, 1);
+ display: block;
}
.omni-closing #omni {
- transform: scale(.9);
+ transform: scale(0.9);
opacity: 0;
- display: none!important;
+ display: none !important;
}
.omni-closing {
- pointer-events: none;
+ pointer-events: none;
}
.omni-extension #omni-overlay {
height: 100%;
@@ -103,11 +103,11 @@
left: 0px;
background-color: #000;
z-index: 9999;
- opacity: .6;
- transition: all .1s cubic-bezier(.05,.03,.35,1);
+ opacity: 0.6;
+ transition: all 0.1s cubic-bezier(0.05, 0.03, 0.35, 1);
}
.omni-closing #omni-overlay {
- opacity: 0!important;
+ opacity: 0 !important;
}
.omni-extension #omni-head {
height: 50px;
@@ -134,7 +134,7 @@
}
.omni-extension .omni-shortcut {
display: inline-block;
- font-size: 13px;
+ font-size: 13px;
border-radius: 5px;
background-color: var(--shortcut);
color: var(--text);
@@ -158,7 +158,7 @@
display: block;
color: var(--text);
caret-color: var(--accent);
- font-family: Inter!important;
+ font-family: Inter !important;
margin-top: 5px;
margin-bottom: 5px;
box-sizing: border-box;
@@ -214,7 +214,7 @@
margin-left: 3px;
}
.omni-extension .omni-item-active .omni-select {
- display: block!important;
+ display: block !important;
}
.omni-extension .omni-icon {
width: 20px;
@@ -225,14 +225,14 @@
margin-top: -12px;
}
.omni-extension .omni-emoji-action {
- display: inline-block;
- vertical-align: middle;
- margin-top: -12px;
- width: 20px;
- height: 20px;
- text-align: center;
- margin-left: 5%;
- font-size: 18px;
+ display: inline-block;
+ vertical-align: middle;
+ margin-top: -12px;
+ width: 20px;
+ height: 20px;
+ text-align: center;
+ margin-left: 5%;
+ font-size: 18px;
}
.omni-extension .omni-item-details {
display: inline-block;
@@ -250,12 +250,12 @@
width: 450px;
}
.omni-extension .omni-item-active .omni-item-name {
- color: var(--text)!important;
+ color: var(--text) !important;
}
.omni-extension .omni-item-desc {
color: var(--text-3);
margin-top: 5px;
- font-size: 14px;
+ font-size: 14px;
}
.omni-extension #omni-footer {
height: 45px;
@@ -289,7 +289,7 @@
margin-right: 5%;
}
.omni-extension .omni-item-active .omni-keys {
- display: none!important;
+ display: none !important;
}
.omni-extension .omni-keys span {
margin-left: 3px;
@@ -300,4 +300,4 @@
position: absolute;
top: 0px;
left: 0px;
-}
\ No newline at end of file
+}
diff --git a/src/content.html b/src/content.html
index 4b27cec..7812035 100644
--- a/src/content.html
+++ b/src/content.html
@@ -1,21 +1,22 @@
-
-
+
diff --git a/src/content.js b/src/content.js
index 4c7d55b..1751c03 100644
--- a/src/content.js
+++ b/src/content.js
@@ -1,268 +1,425 @@
-$(document).ready(function(){
- var isOpen = false;
+$(document).ready(function () {
+ var isOpen = false;
var actions = [];
- // Append the omni into the current page
- $.get(chrome.runtime.getURL('/content.html'), function(data) {
- $(data).appendTo('body');
+ // Append the omni into the current page
+ $.get(chrome.runtime.getURL("/content.html"), function (data) {
+ $(data).appendTo("body");
});
- // Request actions from the background
- chrome.runtime.sendMessage({request:"get-actions"}, function(response) {
+ // Request actions from the background
+ chrome.runtime.sendMessage({ request: "get-actions" }, function (response) {
actions = response.actions;
- populateOmni();
+ populateOmni();
});
- // Add actions to the omni
- function populateOmni() {
- $("#omni-extension #list").html("");
- actions.forEach(function(action, index){
- var keys = "";
- if (action.keycheck) {
- keys = "";
- action.keys.forEach(function(key){
- keys += ""+key+"";
- });
- keys += "
";
- }
- var img = "
";
- if (action.emoji) {
- img = ""+action.emojiChar+""
- }
- if (index != 0) {
- $("#omni-extension #omni-list").append(""+img+"
"+action.title+"
"+action.desc+"
"+keys+"
Select โ
");
- } else {
- $("#omni-extension #omni-list").append(""+img+"
"+action.title+"
"+action.desc+"
"+keys+"
Select โ
");
- }
- })
- $(".omni-extension #omni-results").html(actions.length+" results");
- }
-
- // Add actions to the omni
- function populateOmniHistory(actions) {
- $("#omni-extension #omni-list").html("");
- actions.forEach(function(action, index){
- var keys = "";
- if (action.keycheck) {
- keys = "";
- action.keys.forEach(function(key){
- keys += ""+key+"";
- });
- keys += "
";
- }
- var img = "
";
- if (action.emoji) {
- img = ""+action.emojiChar+""
- }
- if (index != 0) {
- $("#omni-extension #omni-list").append(""+img+"
"+action.title+"
"+action.desc+"
"+keys+"
Select โ
");
- } else {
- $("#omni-extension #omni-list").append(""+img+"
"+action.title+"
"+action.desc+"
"+keys+"
Select โ
");
- }
- })
- $(".omni-extension #omni-results").html(actions.length+" results");
- }
-
- // Open the omni
- function openOmni() {
- chrome.runtime.sendMessage({request:"get-actions"}, function(response) {
- isOpen = true;
- actions = response.actions;
- populateOmni();
- $("#omni-extension input").val("");
- $("html, body").stop();
- $("#omni-extension").removeClass("omni-closing");
- window.setTimeout(function(){
- $("#omni-extension input").focus();
- }, 100);
- });
+ // Add actions to the omni
+ function populateOmni() {
+ $("#omni-extension #list").html("");
+ actions.forEach(function (action, index) {
+ var keys = "";
+ if (action.keycheck) {
+ keys = "";
+ action.keys.forEach(function (key) {
+ keys += "" + key + "";
+ });
+ keys += "
";
+ }
+ var img =
+ "
";
+ if (action.emoji) {
+ img = "" + action.emojiChar + "";
+ }
+ if (index != 0) {
+ $("#omni-extension #omni-list").append(
+ "" +
+ img +
+ "
" +
+ action.title +
+ "
" +
+ action.desc +
+ "
" +
+ keys +
+ "
Select โ
"
+ );
+ } else {
+ $("#omni-extension #omni-list").append(
+ "" +
+ img +
+ "
" +
+ action.title +
+ "
" +
+ action.desc +
+ "
" +
+ keys +
+ "
Select โ
"
+ );
+ }
+ });
+ $(".omni-extension #omni-results").html(actions.length + " results");
}
- // Close the omni
+ // Add actions to the omni
+ function populateOmniHistory(actions) {
+ $("#omni-extension #omni-list").html("");
+ actions.forEach(function (action, index) {
+ var keys = "";
+ if (action.keycheck) {
+ keys = "";
+ action.keys.forEach(function (key) {
+ keys += "" + key + "";
+ });
+ keys += "
";
+ }
+ var img =
+ "
";
+ if (action.emoji) {
+ img = "" + action.emojiChar + "";
+ }
+ if (index != 0) {
+ $("#omni-extension #omni-list").append(
+ "" +
+ img +
+ "
" +
+ action.title +
+ "
" +
+ action.desc +
+ "
" +
+ keys +
+ "
Select โ
"
+ );
+ } else {
+ $("#omni-extension #omni-list").append(
+ "" +
+ img +
+ "
" +
+ action.title +
+ "
" +
+ action.desc +
+ "
" +
+ keys +
+ "
Select โ
"
+ );
+ }
+ });
+ $(".omni-extension #omni-results").html(actions.length + " results");
+ }
+
+ // Open the omni
+ function openOmni() {
+ chrome.runtime.sendMessage({ request: "get-actions" }, function (response) {
+ isOpen = true;
+ actions = response.actions;
+ populateOmni();
+ $("#omni-extension input").val("");
+ $("html, body").stop();
+ $("#omni-extension").removeClass("omni-closing");
+ window.setTimeout(function () {
+ $("#omni-extension input").focus();
+ }, 100);
+ });
+ }
+
+ // Close the omni
function closeOmni() {
- isOpen = false;
+ isOpen = false;
$("#omni-extension").addClass("omni-closing");
}
- // Hover over an action in the omni
+ // Hover over an action in the omni
function hoverItem() {
$(".omni-item-active").removeClass("omni-item-active");
$(this).addClass("omni-item-active");
}
- // Search for an action in the omni
+ // Search for an action in the omni
function search() {
var value = $(this).val().toLowerCase();
- if (value.startsWith("/history")) {
- var tempvalue = value.replace("/tabs ", "");
- var query = "";
- if (tempvalue != "/history") {
- query = value.replace("/history ", "");
- }
- chrome.runtime.sendMessage({request:"search-history", query:query}, function(response){
- populateOmniHistory(response.history);
- });
- } else {
- populateOmni();
- $("#omni-extension #omni-list .omni-item").filter(function(){
- if (value.startsWith("/tabs")) {
- var tempvalue = value.replace("/tabs ", "");
- if (tempvalue == "/tabs") {
- $(this).toggle($(this).attr("data-type") == "tab");
- } else {
- tempvalue = value.replace("/tabs ", "");
- $(this).toggle(($(this).find(".omni-item-name").text().toLowerCase().indexOf(tempvalue) > -1 || $(this).find(".omni-item-desc").text().toLowerCase().indexOf(tempvalue) > -1) && $(this).attr("data-type") == "tab");
- }
- } else if (value.startsWith("/bookmarks")) {
- var tempvalue = value.replace("/bookmarks ", "");
- if (tempvalue == "/bookmarks") {
- $(this).toggle($(this).attr("data-type") == "bookmark");
- } else {
- tempvalue = value.replace("/bookmarks ", "");
- $(this).toggle(($(this).find(".omni-item-name").text().toLowerCase().indexOf(tempvalue) > -1 || $(this).find(".omni-item-desc").text().toLowerCase().indexOf(tempvalue) > -1) && $(this).attr("data-type") == "bookmark");
- }
- } else if (value.startsWith("/remove")) {
- var tempvalue = value.replace("/remove ", "");
- if (tempvalue == "/remove") {
- $(this).toggle($(this).attr("data-type") == "bookmark" || $(this).attr("data-type") == "tab");
- } else {
- tempvalue = value.replace("/remove ", "");
- $(this).toggle(($(this).find(".omni-item-name").text().toLowerCase().indexOf(tempvalue) > -1 || $(this).find(".omni-item-desc").text().toLowerCase().indexOf(tempvalue) > -1) && ($(this).attr("data-type") == "bookmark" || $(this).attr("data-type") == "tab"));
- }
- } else if (value.startsWith("/actions")) {
- var tempvalue = value.replace("/actions ", "");
- if (tempvalue == "/actions") {
- $(this).toggle($(this).attr("data-type") == "action");
- } else {
- tempvalue = value.replace("/actions ", "");
- $(this).toggle(($(this).find(".omni-item-name").text().toLowerCase().indexOf(tempvalue) > -1 || $(this).find(".omni-item-desc").text().toLowerCase().indexOf(tempvalue) > -1) && $(this).attr("data-type") == "action");
- }
- } else {
- $(this).toggle($(this).find(".omni-item-name").text().toLowerCase().indexOf(value) > -1 || $(this).find(".omni-item-desc").text().toLowerCase().indexOf(value) > -1);
- }
- });
- }
- $(".omni-extension #omni-results").html($("#omni-extension #omni-list .omni-item:visible").length+" results");
+ if (value.startsWith("/history")) {
+ var tempvalue = value.replace("/tabs ", "");
+ var query = "";
+ if (tempvalue != "/history") {
+ query = value.replace("/history ", "");
+ }
+ chrome.runtime.sendMessage(
+ { request: "search-history", query: query },
+ function (response) {
+ populateOmniHistory(response.history);
+ }
+ );
+ } else {
+ populateOmni();
+ $("#omni-extension #omni-list .omni-item").filter(function () {
+ if (value.startsWith("/tabs")) {
+ var tempvalue = value.replace("/tabs ", "");
+ if (tempvalue == "/tabs") {
+ $(this).toggle($(this).attr("data-type") == "tab");
+ } else {
+ tempvalue = value.replace("/tabs ", "");
+ $(this).toggle(
+ ($(this)
+ .find(".omni-item-name")
+ .text()
+ .toLowerCase()
+ .indexOf(tempvalue) > -1 ||
+ $(this)
+ .find(".omni-item-desc")
+ .text()
+ .toLowerCase()
+ .indexOf(tempvalue) > -1) &&
+ $(this).attr("data-type") == "tab"
+ );
+ }
+ } else if (value.startsWith("/bookmarks")) {
+ var tempvalue = value.replace("/bookmarks ", "");
+ if (tempvalue == "/bookmarks") {
+ $(this).toggle($(this).attr("data-type") == "bookmark");
+ } else {
+ tempvalue = value.replace("/bookmarks ", "");
+ $(this).toggle(
+ ($(this)
+ .find(".omni-item-name")
+ .text()
+ .toLowerCase()
+ .indexOf(tempvalue) > -1 ||
+ $(this)
+ .find(".omni-item-desc")
+ .text()
+ .toLowerCase()
+ .indexOf(tempvalue) > -1) &&
+ $(this).attr("data-type") == "bookmark"
+ );
+ }
+ } else if (value.startsWith("/remove")) {
+ var tempvalue = value.replace("/remove ", "");
+ if (tempvalue == "/remove") {
+ $(this).toggle(
+ $(this).attr("data-type") == "bookmark" ||
+ $(this).attr("data-type") == "tab"
+ );
+ } else {
+ tempvalue = value.replace("/remove ", "");
+ $(this).toggle(
+ ($(this)
+ .find(".omni-item-name")
+ .text()
+ .toLowerCase()
+ .indexOf(tempvalue) > -1 ||
+ $(this)
+ .find(".omni-item-desc")
+ .text()
+ .toLowerCase()
+ .indexOf(tempvalue) > -1) &&
+ ($(this).attr("data-type") == "bookmark" ||
+ $(this).attr("data-type") == "tab")
+ );
+ }
+ } else if (value.startsWith("/actions")) {
+ var tempvalue = value.replace("/actions ", "");
+ if (tempvalue == "/actions") {
+ $(this).toggle($(this).attr("data-type") == "action");
+ } else {
+ tempvalue = value.replace("/actions ", "");
+ $(this).toggle(
+ ($(this)
+ .find(".omni-item-name")
+ .text()
+ .toLowerCase()
+ .indexOf(tempvalue) > -1 ||
+ $(this)
+ .find(".omni-item-desc")
+ .text()
+ .toLowerCase()
+ .indexOf(tempvalue) > -1) &&
+ $(this).attr("data-type") == "action"
+ );
+ }
+ } else {
+ $(this).toggle(
+ $(this)
+ .find(".omni-item-name")
+ .text()
+ .toLowerCase()
+ .indexOf(value) > -1 ||
+ $(this)
+ .find(".omni-item-desc")
+ .text()
+ .toLowerCase()
+ .indexOf(value) > -1
+ );
+ }
+ });
+ }
+ $(".omni-extension #omni-results").html(
+ $("#omni-extension #omni-list .omni-item:visible").length + " results"
+ );
}
- // Handle actions from the omni
- function handleAction() {
- 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($(".item-active").attr("data-url"), "_self");
- } else {
- chrome.runtime.sendMessage({request:action.action, tab:action});
- if (action.action == "bookmark") {
- window.open(action.url, "_self");
- } else if (action.action == "scroll-bottom") {
- window.scrollTo(0,document.body.scrollHeight);
- } else if (action.action == "scroll-top") {
- window.scrollTo(0,0);
- } else if (action.action == "close-tab") {
- window.close();
- } else if (action.action == "navigation") {
- window.open(action.url, "_self");
- } else if (action.action == "fullscreen") {
- var elem = document.documentElement;
- elem.requestFullscreen();
- } else if (action.action == "new-tab") {
- window.open("");
- } else if (action.action == "email") {
- window.open("mailto:");
- } else if (action.action == "url") {
- window.open(action.url, "_self");
- }
- }
+ // Handle actions from the omni
+ function handleAction() {
+ 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($(".item-active").attr("data-url"), "_self");
+ } else {
+ chrome.runtime.sendMessage({ request: action.action, tab: action });
+ if (action.action == "bookmark") {
+ window.open(action.url, "_self");
+ } else if (action.action == "scroll-bottom") {
+ window.scrollTo(0, document.body.scrollHeight);
+ } else if (action.action == "scroll-top") {
+ window.scrollTo(0, 0);
+ } else if (action.action == "close-tab") {
+ window.close();
+ } else if (action.action == "navigation") {
+ window.open(action.url, "_self");
+ } else if (action.action == "fullscreen") {
+ var elem = document.documentElement;
+ elem.requestFullscreen();
+ } else if (action.action == "new-tab") {
+ window.open("");
+ } else if (action.action == "email") {
+ window.open("mailto:");
+ } else if (action.action == "url") {
+ window.open(action.url, "_self");
+ }
+ }
- // Fetch actions again
- chrome.runtime.sendMessage({request:"get-actions"}, function(response) {
- actions = response.actions;
- populateOmni();
- });
- }
+ // Fetch actions again
+ chrome.runtime.sendMessage({ request: "get-actions" }, function (response) {
+ actions = response.actions;
+ populateOmni();
+ });
+ }
- // Customize the shortcut to open the Omni box
- function openShortcuts() {
- chrome.runtime.sendMessage({request:"extensions/shortcuts"});
- }
+ // Customize the shortcut to open the Omni box
+ function openShortcuts() {
+ chrome.runtime.sendMessage({ request: "extensions/shortcuts" });
+ }
-
- // Check which keys are down
- var down = [];
- $(document).keydown(function(e) {
- down[e.keyCode] = true;
- }).keyup(function(e) {
- if (down[18] && down[16] && down[80]) {
- if (actions.find(x => x.action == "pin") != undefined) {
- chrome.runtime.sendMessage({request:"pin-tab"});
- } else {
- chrome.runtime.sendMessage({request:"unpin-tab"});
- }
- chrome.runtime.sendMessage({request:"get-actions"}, function(response) {
- actions = response.actions;
- populateOmni();
- });
- } else if (down[18] && down[16] && down[77]) {
- if (actions.find(x => x.action == "mute") != undefined) {
- chrome.runtime.sendMessage({request:"mute-tab"});
- } else {
- chrome.runtime.sendMessage({request:"unmute-tab"});
- }
- chrome.runtime.sendMessage({request:"get-actions"}, function(response) {
- actions = response.actions;
- populateOmni();
- });
- } else if (down[18] && down[16] && down[67]) {
- window.open("mailto:");
- }
-
- if (down[38]) {
- // Up key
- if ($(".omni-item-active").prevAll("div").not(":hidden").first().length) {
- var previous = $(".omni-item-active").prevAll("div").not(":hidden").first();
- $(".omni-item-active").removeClass("item-active");
- previous.addClass("omni-item-active");
- previous[0].scrollIntoView({block:"nearest", inline:"nearest"});
+ // Check which keys are down
+ var down = [];
+ $(document)
+ .keydown(function (e) {
+ down[e.keyCode] = true;
+ })
+ .keyup(function (e) {
+ if (down[18] && down[16] && down[80]) {
+ if (actions.find((x) => x.action == "pin") != undefined) {
+ chrome.runtime.sendMessage({ request: "pin-tab" });
+ } else {
+ chrome.runtime.sendMessage({ request: "unpin-tab" });
+ }
+ chrome.runtime.sendMessage(
+ { request: "get-actions" },
+ function (response) {
+ actions = response.actions;
+ populateOmni();
+ }
+ );
+ } else if (down[18] && down[16] && down[77]) {
+ if (actions.find((x) => x.action == "mute") != undefined) {
+ chrome.runtime.sendMessage({ request: "mute-tab" });
+ } else {
+ chrome.runtime.sendMessage({ request: "unmute-tab" });
+ }
+ chrome.runtime.sendMessage(
+ { request: "get-actions" },
+ function (response) {
+ actions = response.actions;
+ populateOmni();
+ }
+ );
+ } else if (down[18] && down[16] && down[67]) {
+ window.open("mailto:");
}
- } else if (down[40]) {
- // Down key
- if ($(".omni-item-active").nextAll("div").not(":hidden").first().length) {
- var next = $(".omni-item-active").nextAll("div").not(":hidden").first();
- $(".omni-item-active").removeClass("omni-item-active");
- next.addClass("omni-item-active");
- next[0].scrollIntoView({block:"nearest", inline:"nearest"});
+ if (down[38]) {
+ // Up key
+ if (
+ $(".omni-item-active").prevAll("div").not(":hidden").first().length
+ ) {
+ var previous = $(".omni-item-active")
+ .prevAll("div")
+ .not(":hidden")
+ .first();
+ $(".omni-item-active").removeClass("item-active");
+ previous.addClass("omni-item-active");
+ previous[0].scrollIntoView({ block: "nearest", inline: "nearest" });
+ }
+ } else if (down[40]) {
+ // Down key
+ if (
+ $(".omni-item-active").nextAll("div").not(":hidden").first().length
+ ) {
+ var next = $(".omni-item-active")
+ .nextAll("div")
+ .not(":hidden")
+ .first();
+ $(".omni-item-active").removeClass("omni-item-active");
+ next.addClass("omni-item-active");
+ next[0].scrollIntoView({ block: "nearest", inline: "nearest" });
+ }
+ } else if (down[27] && isOpen) {
+ // Esc key
+ closeOmni();
+ } else if (down[13] && isOpen) {
+ // Enter key
+ handleAction();
}
- } else if (down[27] && isOpen) {
- // Esc key
- closeOmni();
- } else if (down[13] && isOpen) {
- // Enter key
- handleAction();
- }
- down = [];
- });
-
- // Recieve messages from background
- chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
- if (message.request == "open-omni") {
- if (isOpen) {
- closeOmni();
- } else {
- openOmni();
- }
- }
- });
+ down = [];
+ });
+ // Recieve messages from background
+ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
+ if (message.request == "open-omni") {
+ if (isOpen) {
+ closeOmni();
+ } else {
+ openOmni();
+ }
+ }
+ });
// Events
- $(document).on("click", "#open-page-omni-extension-thing", openShortcuts);
- $(document).on("mouseover", ".omni-extension .omni-item:not(.omni-item-active)", hoverItem);
+ $(document).on("click", "#open-page-omni-extension-thing", openShortcuts);
+ $(document).on(
+ "mouseover",
+ ".omni-extension .omni-item:not(.omni-item-active)",
+ hoverItem
+ );
$(document).on("input", ".omni-extension input", search);
- $(document).on("click", ".omni-item-active", handleAction);
- $(document).on("click", ".omni-extension #omni-overlay", closeOmni);
+ $(document).on("click", ".omni-item-active", handleAction);
+ $(document).on("click", ".omni-extension #omni-overlay", closeOmni);
});
diff --git a/src/manifest.json b/src/manifest.json
index 20f6706..ccb8be2 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -5,49 +5,54 @@
"version": "1.0.3",
"manifest_version": 3,
"action": {
- "icons": {
- "16": "assets/logo-16.png",
- "48": "assets/logo-48.png",
- "128": "assets/logo-128.png"
- }
+ "icons": {
+ "16": "assets/logo-16.png",
+ "48": "assets/logo-48.png",
+ "128": "assets/logo-128.png"
+ }
},
- "icons": {
- "16": "assets/logo-16.png",
- "48": "assets/logo-48.png",
- "128": "assets/logo-128.png"
- },
- "commands": {
- "open-omni": {
- "suggested_key": {
+ "icons": {
+ "16": "assets/logo-16.png",
+ "48": "assets/logo-48.png",
+ "128": "assets/logo-128.png"
+ },
+ "commands": {
+ "open-omni": {
+ "suggested_key": {
"default": "Ctrl+K",
"mac": "Command+K"
},
- "description": "Open command menu"
- }
- },
+ "description": "Open command menu"
+ }
+ },
"background": {
"service_worker": "background.js"
},
"content_scripts": [
- {
- "matches": [
- ""
- ],
- "run_at": "document_end",
- "js": ["jquery.js", "assets/jquery.nice-select.min.js", "content.js"],
- "css": ["assets/nice-select.css", "content.css"]
- }
+ {
+ "matches": [""],
+ "run_at": "document_end",
+ "js": ["jquery.js", "assets/jquery.nice-select.min.js", "content.js"],
+ "css": ["assets/nice-select.css", "content.css"]
+ }
],
"web_accessible_resources": [
{
- "resources": ["content.html", "assets/*", "popup.css", "popup.js"],
+ "resources": ["content.html", "assets/*", "popup.css", "popup.js"],
"matches": [""]
}
],
"permissions": [
- "tabs", "activeTab", "bookmarks", "browsingData", "history", "scripting"
+ "tabs",
+ "activeTab",
+ "bookmarks",
+ "browsingData",
+ "history",
+ "scripting"
],
"host_permissions": [
- "https://www.googleapis.com/*", "https://gstatic.com/*", "*://*/*"
+ "https://www.googleapis.com/*",
+ "https://gstatic.com/*",
+ "*://*/*"
]
}