From c5081a0747f33de947c2a27bb9a196177f1d294f Mon Sep 17 00:00:00 2001 From: Jeremy Schomery Date: Mon, 15 May 2017 17:16:09 +0430 Subject: [PATCH] Fixes communication issue with US.o on Vivaldi browser --- install.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/install.js b/install.js index bdccb6cd..76626cba 100644 --- a/install.js +++ b/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