Revision b7e2870f
Added by koszko about 2 years ago
| content/page_actions.js | ||
|---|---|---|
| 9 | 9 |
* IMPORTS_START |
| 10 | 10 |
* IMPORT CONNECTION_TYPE |
| 11 | 11 |
* IMPORT browser |
| 12 |
* IMPORT report_script |
|
| 13 |
* IMPORT report_settings |
|
| 12 | 14 |
* IMPORTS_END |
| 13 | 15 |
*/ |
| 14 | 16 |
|
| ... | ... | |
| 19 | 21 |
|
| 20 | 22 |
function handle_message(message) |
| 21 | 23 |
{
|
| 22 |
if (message.inject === undefined) |
|
| 23 |
return; |
|
| 24 |
const [action, data] = message; |
|
| 24 | 25 |
|
| 25 |
for (let script_text of message.inject) {
|
|
| 26 |
if (loaded) |
|
| 27 |
add_script(script_text); |
|
| 28 |
else |
|
| 29 |
scripts_awaiting.push(script_text); |
|
| 26 |
if (action === "inject") {
|
|
| 27 |
for (let script_text of data) {
|
|
| 28 |
if (loaded) |
|
| 29 |
add_script(script_text); |
|
| 30 |
else |
|
| 31 |
scripts_awaiting.push(script_text); |
|
| 32 |
} |
|
| 30 | 33 |
} |
| 34 |
if (action === "settings") |
|
| 35 |
report_settings(data); |
|
| 31 | 36 |
} |
| 32 | 37 |
|
| 33 | 38 |
function document_loaded(event) |
| ... | ... | |
| 46 | 51 |
script.textContent = script_text; |
| 47 | 52 |
script.setAttribute("nonce", nonce);
|
| 48 | 53 |
document.body.appendChild(script); |
| 54 |
|
|
| 55 |
report_script(script_text); |
|
| 49 | 56 |
} |
| 50 | 57 |
|
| 51 | 58 |
function handle_page_actions(script_nonce) {
|
Also available in: Unified diff
show some settings of the current page in the popup