From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../pocket/content/panels/js/home/overlay.js | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 browser/components/pocket/content/panels/js/home/overlay.js (limited to 'browser/components/pocket/content/panels/js/home/overlay.js') diff --git a/browser/components/pocket/content/panels/js/home/overlay.js b/browser/components/pocket/content/panels/js/home/overlay.js new file mode 100644 index 0000000000..89c881ecee --- /dev/null +++ b/browser/components/pocket/content/panels/js/home/overlay.js @@ -0,0 +1,62 @@ +/* global Handlebars:false */ + +/* +HomeOverlay 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 Home from "../components/Home/Home"; + +var HomeOverlay = function (options) { + this.inited = false; + this.active = false; +}; + +HomeOverlay.prototype = { + create({ pockethost }) { + const { searchParams } = new URL(window.location.href); + const locale = searchParams.get(`locale`) || ``; + const hideRecentSaves = searchParams.get(`hiderecentsaves`) === `true`; + const utmSource = searchParams.get(`utmSource`); + const utmCampaign = searchParams.get(`utmCampaign`); + const utmContent = searchParams.get(`utmContent`); + + if (this.active) { + return; + } + + this.active = true; + + ReactDOM.render( + , + document.querySelector(`body`) + ); + + if (window?.matchMedia(`(prefers-color-scheme: dark)`).matches) { + document.querySelector(`body`).classList.add(`theme_dark`); + } + }, +}; + +export default HomeOverlay; -- cgit v1.2.3