Comparing version
@@ -244,2 +244,8 @@ /******/ (function(modules) { // webpackBootstrap | ||
function getAllTabs() { | ||
return new Promise(function (resolve, reject) { | ||
chrome.tabs.query({}, resolve); | ||
}); | ||
} | ||
function tabChangeListener(tabId, changeInfo, tab, scriptUrl) { | ||
@@ -314,5 +320,12 @@ if (changeInfo.status === 'complete' && !internalChromeUrl.test(tab.url)) { | ||
function runtimeInstallListener(scriptUrl) { | ||
getAllTabs().then(tabs => tabs.filter(tab => !internalChromeUrl.test(tab.url))).then(tabs => Promise.all(tabs.map(tab => hasPermissions(tab.url).then(has => { | ||
return has ? tab : null; | ||
})))).then(tabs => tabs.filter(tab => !!tab)).then(tabs => tabs.forEach(tab => injectContentScript(tab, scriptUrl))); | ||
} | ||
/* harmony default export */ __webpack_exports__["default"] = (function (contentScriptScriptUrl) { | ||
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => tabChangeListener(tabId, changeInfo, tab, contentScriptScriptUrl)); | ||
chrome.runtime.onInstalled.addListener(() => runtimeInstallListener(contentScriptScriptUrl)); | ||
chrome.runtime.onConnect.addListener(runtimeConnectListener); | ||
@@ -319,0 +332,0 @@ |
@@ -23,2 +23,8 @@ /* global chrome */ | ||
function getAllTabs() { | ||
return new Promise(function (resolve, reject) { | ||
chrome.tabs.query({}, resolve); | ||
}); | ||
} | ||
function tabChangeListener(tabId, changeInfo, tab, scriptUrl) { | ||
@@ -93,5 +99,12 @@ if (changeInfo.status === 'complete' && !internalChromeUrl.test(tab.url)) { | ||
function runtimeInstallListener(scriptUrl) { | ||
getAllTabs().then(tabs => tabs.filter(tab => !internalChromeUrl.test(tab.url))).then(tabs => Promise.all(tabs.map(tab => hasPermissions(tab.url).then(has => { | ||
return has ? tab : null; | ||
})))).then(tabs => tabs.filter(tab => !!tab)).then(tabs => tabs.forEach(tab => injectContentScript(tab, scriptUrl))); | ||
} | ||
export default function (contentScriptScriptUrl) { | ||
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => tabChangeListener(tabId, changeInfo, tab, contentScriptScriptUrl)); | ||
chrome.runtime.onInstalled.addListener(() => runtimeInstallListener(contentScriptScriptUrl)); | ||
chrome.runtime.onConnect.addListener(runtimeConnectListener); | ||
@@ -98,0 +111,0 @@ |
@@ -484,2 +484,8 @@ /******/ (function(modules) { // webpackBootstrap | ||
function getAllTabs() { | ||
return new Promise(function (resolve, reject) { | ||
chrome.tabs.query({}, resolve); | ||
}); | ||
} | ||
function tabChangeListener(tabId, changeInfo, tab, scriptUrl) { | ||
@@ -554,5 +560,12 @@ if (changeInfo.status === 'complete' && !internalChromeUrl.test(tab.url)) { | ||
function runtimeInstallListener(scriptUrl) { | ||
getAllTabs().then(tabs => tabs.filter(tab => !internalChromeUrl.test(tab.url))).then(tabs => Promise.all(tabs.map(tab => hasPermissions(tab.url).then(has => { | ||
return has ? tab : null; | ||
})))).then(tabs => tabs.filter(tab => !!tab)).then(tabs => tabs.forEach(tab => injectContentScript(tab, scriptUrl))); | ||
} | ||
/* harmony default export */ __webpack_exports__["default"] = (function (contentScriptScriptUrl) { | ||
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => tabChangeListener(tabId, changeInfo, tab, contentScriptScriptUrl)); | ||
chrome.runtime.onInstalled.addListener(() => runtimeInstallListener(contentScriptScriptUrl)); | ||
chrome.runtime.onConnect.addListener(runtimeConnectListener); | ||
@@ -559,0 +572,0 @@ |
{ | ||
"name": "ceci", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Google Chrome Extension Code Injector", | ||
@@ -5,0 +5,0 @@ "module": "./index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
220748
2.78%2407
1.39%2
-33.33%