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';
|
'use strict';
|
||||||
|
|
||||||
const FIREFOX = /Firefox/.test(navigator.userAgent);
|
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("stylishUpdate", onUpdateClicked);
|
||||||
document.addEventListener("stylishInstall" + (FIREFOX ? "" : "Chrome"), onInstallClicked);
|
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) => {
|
chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
|
||||||
// orphaned content script check
|
// orphaned content script check
|
||||||
|
@ -57,6 +64,9 @@ function sendEvent(type, detail = null) {
|
||||||
if (FIREFOX) {
|
if (FIREFOX) {
|
||||||
type = type.replace('Chrome', '');
|
type = type.replace('Chrome', '');
|
||||||
}
|
}
|
||||||
|
else if (OPERA || VIVALDI) {
|
||||||
|
type = type.replace('Chrome', 'Opera');
|
||||||
|
}
|
||||||
detail = {detail};
|
detail = {detail};
|
||||||
if (typeof cloneInto != 'undefined') {
|
if (typeof cloneInto != 'undefined') {
|
||||||
// Firefox requires explicit cloning, however USO can't process our messages anyway
|
// Firefox requires explicit cloning, however USO can't process our messages anyway
|
||||||
|
|
Loading…
Reference in New Issue
Block a user