It has been a while since I was able to program a Firefox extension. Now that I can find some time, I try to write an extension that can read the content of a page.
I started with the tutorial from Mozilla, with the manifest.json like this:
{
"browser_action": {
"browser_style": true,
"default_icon": {
"16": "button/bot-16.png",
"32": "button/bot-32.png"
},
"default_title": "Whereami?",
"default_popup": "popup/config.html"
},
"manifest_version": 2,
"name": "domain",
"version": "1.0",
"description": "Adds a red border to all webpages matching mozilla.org.",
"icons": {
"48": "icons/bot-48.png"
},
"background": {
"scripts": ["background.js"]
},
"content_scripts": [
{
"matches": [
"*://*.domain.nl/*"
],
"js": [
"javascript.js"
]
}
]
}
In this extension I have a popup/config.html file (like this)
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<div class="menu">
<h4>Current name</h4>
<p id="current-name">{{ current name }} </p>
<button>aaa</button>
</div>
</body>
</html>
I am fairly new to writing javascript for firefox extensions, but is it easy to read an element on a page (which is updated every x seconds) and show it in a popup?