From b7e2870ff58ef85370781aa04e9e0126988e39fd Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 6 Jul 2021 18:25:34 +0200 Subject: show some settings of the current page in the popup --- content/page_actions.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'content/page_actions.js') diff --git a/content/page_actions.js b/content/page_actions.js index bc65449..fd405fe 100644 --- a/content/page_actions.js +++ b/content/page_actions.js @@ -9,6 +9,8 @@ * IMPORTS_START * IMPORT CONNECTION_TYPE * IMPORT browser + * IMPORT report_script + * IMPORT report_settings * IMPORTS_END */ @@ -19,15 +21,18 @@ var nonce; function handle_message(message) { - if (message.inject === undefined) - return; + const [action, data] = message; - for (let script_text of message.inject) { - if (loaded) - add_script(script_text); - else - scripts_awaiting.push(script_text); + if (action === "inject") { + for (let script_text of data) { + if (loaded) + add_script(script_text); + else + scripts_awaiting.push(script_text); + } } + if (action === "settings") + report_settings(data); } function document_loaded(event) @@ -46,6 +51,8 @@ function add_script(script_text) script.textContent = script_text; script.setAttribute("nonce", nonce); document.body.appendChild(script); + + report_script(script_text); } function handle_page_actions(script_nonce) { -- cgit v1.2.3