mirror of
https://github.com/alyssaxuu/omni.git
synced 2026-03-11 08:54:35 +00:00
On install update
This commit is contained in:
parent
d866e1cd98
commit
75bd642df6
2 changed files with 29 additions and 29 deletions
|
|
@ -1,33 +1,5 @@
|
|||
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]]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Clear actions and append default ones
|
||||
function clearActions() {
|
||||
getCurrentTab().then((response) => {
|
||||
|
|
@ -134,6 +106,34 @@ function clearActions() {
|
|||
|
||||
// Open on install
|
||||
chrome.runtime.onInstalled.addListener(function (object) {
|
||||
// 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]]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 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.tabs.create({url: "https://alyssax.com/omni/"});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "Omni",
|
||||
"description": "Supercharge Chrome with commands, shortcuts, and more",
|
||||
"offline_enabled": true,
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"manifest_version": 3,
|
||||
"action": {
|
||||
"icons": {
|
||||
|
|
|
|||
Loading…
Reference in a new issue