From 7f368d46ea06164da025c1ac4ed9a65ad23b25ef Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Wed, 12 May 2021 16:00:09 +0200 Subject: stop using js modules --- common/browser.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 common/browser.js (limited to 'common/browser.js') diff --git a/common/browser.js b/common/browser.js new file mode 100644 index 0000000..1d9edda --- /dev/null +++ b/common/browser.js @@ -0,0 +1,27 @@ +/** +* Myext WebExtension API access normalization +* +* Copyright (C) 2021 Wojtek Kosior +* +* Dual-licensed under: +* - 0BSD license +* - GPLv3 or (at your option) any later version +*/ + +"use strict"; + +/* + * This module normalizes access to WebExtension apis between + * chrome-based and firefox-based browsers. + */ + +(() => { + if (window.browser === undefined) { + window.browser = window.chrome; + window.is_chrome = true; + window.is_mozilla = false; + } else { + window.is_chrome = false; + window.is_mozilla = true; + } +})(); -- cgit v1.2.3