Files
webextensions-examples/user-script/popup/user-script.js
T
2017-12-12 09:02:11 -06:00

18 lines
554 B
JavaScript

'use strict';
const hostsInput = document.querySelector("#hosts");
const codeInput = document.querySelector("#code");
const defaultHosts = "*://*.org/*";
const defaultCode = "document.body.innerHTML = '<h1>This page has been eaten<h1>'";
hostsInput.value = defaultHosts;
codeInput.value = defaultCode;
async function registerScript() {
let background = await browser.runtime.getBackgroundPage();
background.register(hostsInput.value.split(","), codeInput.value)
}
document.querySelector("#register").addEventListener('click', registerScript);