Add current url detection
This commit is contained in:
parent
949106ce50
commit
c5a6d8fc53
@ -9,18 +9,15 @@
|
||||
"strict_min_version": "45.0"
|
||||
}
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": [
|
||||
"*://*.mozilla.org/*"
|
||||
],
|
||||
"js": [
|
||||
"postify.js"
|
||||
]
|
||||
}
|
||||
"permissions": [
|
||||
"activeTab",
|
||||
"tabs"
|
||||
],
|
||||
"background": {
|
||||
"scripts": ["postify.js"]
|
||||
},
|
||||
"browser_action": {
|
||||
"default_icon": "icons/postify-32.png",
|
||||
"default_title": "Beastify"
|
||||
"default_title": "Postify"
|
||||
}
|
||||
}
|
18
postify.js
18
postify.js
@ -1 +1,17 @@
|
||||
console.log('Yeah!')
|
||||
console.log('Load!');
|
||||
|
||||
function onGot(tabInfo) {
|
||||
var tab = tabInfo[0];
|
||||
var url = tab.url;
|
||||
console.log(url);
|
||||
}
|
||||
|
||||
function onError(error) {
|
||||
console.log(`Error: ${error}`);
|
||||
}
|
||||
|
||||
function sendCurrentUrl() {
|
||||
browser.tabs.query({currentWindow: true, active: true}).then(onGot, onError);
|
||||
}
|
||||
|
||||
browser.browserAction.onClicked.addListener(sendCurrentUrl);
|
||||
|
Loading…
Reference in New Issue
Block a user