-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First pass at migrating to manifest v3 for #86.
- Loading branch information
1 parent
2a03390
commit 430cd68
Showing
4 changed files
with
82 additions
and
54 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,50 @@ | ||
{ | ||
"name": "Sample Ratio Mismatch (SRM) Checker", | ||
"short_name": "SRM Check", | ||
"version": "0.0.8", | ||
"version": "0.1.0", | ||
"description": "Automatically performs Sample Ratio Mismatch (SRM) test and flags potential issues on supported experimentation platforms.", | ||
"permissions": [ | ||
"tabs" | ||
"activeTab", | ||
"scripting" | ||
], | ||
"host_permissions": [ | ||
"https://*.lukasvermeer.nl/srm/*", | ||
"https://app.optimizely.com/*", | ||
"https://app.vwo.com/*", | ||
"https://*.sitegainer.com/*", | ||
"https://conversion.symplify.com/*", | ||
"https://app.convert.com/*", | ||
"https://web.omniconvert.com/*", | ||
"https://pagesense.zoho.eu/*", | ||
"https://pagesense.zoho.com/*" | ||
], | ||
"content_scripts": [ | ||
{ | ||
"matches": ["https://lukasvermeer.nl/srm/*", | ||
"https://app.optimizely.com/*", | ||
"https://app.vwo.com/*", | ||
"https://sitegainer.com/*", | ||
"https://conversion.symplify.com/*", | ||
"https://app.convert.com/*", | ||
"https://web.omniconvert.com/*", | ||
"https://pagesense.zoho.eu/*", | ||
"https://pagesense.zoho.com/*"], | ||
"js": ["lib/statistics-distributions.js", "srm.js", "content.js"] | ||
} | ||
], | ||
{ | ||
"matches": [ | ||
"https://*.lukasvermeer.nl/srm/*", | ||
"https://app.optimizely.com/*", | ||
"https://app.vwo.com/*", | ||
"https://*.sitegainer.com/*", | ||
"https://conversion.symplify.com/*", | ||
"https://app.convert.com/*", | ||
"https://web.omniconvert.com/*", | ||
"https://pagesense.zoho.eu/*", | ||
"https://pagesense.zoho.com/*" | ||
], | ||
"js": [ | ||
"lib/statistics-distributions.js", | ||
"srm.js", | ||
"content.js" | ||
] | ||
} | ||
], | ||
"background": { | ||
"scripts": [ "background.js" ] | ||
}, | ||
"page_action": { | ||
"service_worker": "service_worker.js" | ||
}, | ||
"icons": { | ||
"128": "icon128.png" | ||
}, | ||
"manifest_version": 2 | ||
"manifest_version": 3, | ||
"action": {}, | ||
"content_security_policy": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Send message to content.js when URL changes | ||
chrome.tabs.onActivated.addListener(function (tab) { | ||
console.log("TAB CHANGED") | ||
// TODO only do this on pages where we have permission | ||
chrome.scripting.executeScript({ | ||
target: { tabId: tab.tabId }, | ||
files: ["content.js"] | ||
}); | ||
}) | ||
|
||
// Fired when a tab is updated. | ||
chrome.tabs.onUpdated.addListener(async function (tab) { | ||
console.log("TAB UPDATED") | ||
// TODO only do this on pages where we have permission | ||
chrome.scripting.executeScript({ | ||
target: { tabId: tab }, | ||
files: ["content.js"] | ||
}); | ||
}) | ||
|
||
chrome.runtime.onInstalled.addListener(function(details) { | ||
if (details.reason == "install") { | ||
if (chrome.runtime.setUninstallURL) { | ||
chrome.runtime.setUninstallURL('https://forms.gle/Cgv34WVhgms9MChv7'); | ||
} | ||
} | ||
}); | ||
|
||
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) { | ||
console.log(message); | ||
if (message.srmStatus === 'ON') { | ||
chrome.action.setIcon({tabId: sender.tab.id, path: 'icon128.png'}); | ||
} | ||
if (message.srmStatus === 'OK') { | ||
chrome.action.setIcon({tabId: sender.tab.id, path: 'icon128green.png'}); | ||
} | ||
if (message.srmStatus === 'SRM') { | ||
chrome.action.setIcon({tabId: sender.tab.id, path: 'icon128red.png'}); | ||
} | ||
}); |