Fixes communication issue with US.o on Vivaldi browser
This commit is contained in:
parent
1706f380f2
commit
c5081a0747
14
install.js
14
install.js
|
@ -1,9 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
const FIREFOX = /Firefox/.test(navigator.userAgent);
|
||||
const VIVALDI = /Vivaldi/.test(navigator.userAgent);
|
||||
const OPERA = /OPR/.test(navigator.userAgent);
|
||||
|
||||
document.addEventListener("stylishUpdate" + (FIREFOX ? "" : "Chrome"), onUpdateClicked);
|
||||
document.addEventListener("stylishInstall" + (FIREFOX ? "" : "Chrome"), onInstallClicked);
|
||||
document.addEventListener("stylishUpdate", onUpdateClicked);
|
||||
document.addEventListener("stylishUpdateChrome", onUpdateClicked);
|
||||
document.addEventListener("stylishUpdateOpera", onUpdateClicked);
|
||||
|
||||
document.addEventListener("stylishInstall", onInstallClicked);
|
||||
document.addEventListener("stylishInstallChrome", onInstallClicked);
|
||||
document.addEventListener("stylishInstallOpera", onInstallClicked);
|
||||
|
||||
chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
|
||||
// orphaned content script check
|
||||
|
@ -57,6 +64,9 @@ function sendEvent(type, detail = null) {
|
|||
if (FIREFOX) {
|
||||
type = type.replace('Chrome', '');
|
||||
}
|
||||
else if (OPERA || VIVALDI) {
|
||||
type = type.replace('Chrome', 'Opera');
|
||||
}
|
||||
detail = {detail};
|
||||
if (typeof cloneInto != 'undefined') {
|
||||
// Firefox requires explicit cloning, however USO can't process our messages anyway
|
||||
|
|
Loading…
Reference in New Issue
Block a user