diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /browser/components/pocket/content/panels/js/saved/overlay.js | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/pocket/content/panels/js/saved/overlay.js')
-rw-r--r-- | browser/components/pocket/content/panels/js/saved/overlay.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/browser/components/pocket/content/panels/js/saved/overlay.js b/browser/components/pocket/content/panels/js/saved/overlay.js new file mode 100644 index 0000000000..defdf5217d --- /dev/null +++ b/browser/components/pocket/content/panels/js/saved/overlay.js @@ -0,0 +1,46 @@ +/* +SavedOverlay is the view itself and contains all of the methods to manipute the overlay and messaging. +It does not contain any logic for saving or communication with the extension or server. +*/ + +import React from "react"; +import ReactDOM from "react-dom"; +import Saved from "../components/Saved/Saved"; + +var SavedOverlay = function(options) { + this.inited = false; + this.active = false; +}; + +SavedOverlay.prototype = { + create({ pockethost }) { + if (this.active) { + return; + } + + this.active = true; + + const { searchParams } = new URL(window.location.href); + const locale = searchParams.get(`locale`) || ``; + const utmSource = searchParams.get(`utmSource`); + const utmCampaign = searchParams.get(`utmCampaign`); + const utmContent = searchParams.get(`utmContent`); + + ReactDOM.render( + <Saved + locale={locale} + pockethost={pockethost} + utmSource={utmSource} + utmCampaign={utmCampaign} + utmContent={utmContent} + />, + document.querySelector(`body`) + ); + + if (window?.matchMedia(`(prefers-color-scheme: dark)`).matches) { + document.querySelector(`body`).classList.add(`theme_dark`); + } + }, +}; + +export default SavedOverlay; |