basic extension

This commit is contained in:
Anton Linus 2020-09-01 18:25:50 +02:00
parent 8ad6035255
commit 795173a45f
7 changed files with 48 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

BIN
bluepill/.DS_Store vendored Normal file

Binary file not shown.

25
bluepill/background.js Normal file
View File

@ -0,0 +1,25 @@
'use strict';
var browser = browser || chrome
browser.runtime.onInstalled.addListener(function() {
browser.storage.sync.set({number: 0}, function() {
console.log('The number is set to 0.');
});
});
function updateIcon() {
browser.storage.sync.get('number', function(data) {
var current = data.number;
browser.browserAction.setIcon({path: 'icon' + current + '.png'});
current++;
if (current > 1)
current = 0;
browser.storage.sync.set({number: current}, function() {
console.log('The number is set to ' + current);
});
});
};
browser.browserAction.onClicked.addListener(updateIcon);
//updateIcon();

1
bluepill/content.js Normal file
View File

@ -0,0 +1 @@
console.log("Extension is running");

BIN
bluepill/icon0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

BIN
bluepill/icon1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

22
bluepill/manifest.json Normal file
View File

@ -0,0 +1,22 @@
{
"homepage_url": "https://1000scores.com",
"name": "bluepill",
"browser_specific_settings": {
"gecko": {
"id": "addon@example.com",
"strict_min_version": "42.0"
}
},
"description": "changes your perspective on the web",
"version": "0.3",
"background": {
"scripts": ["background.js"],
"persistent": false
},
"permissions": ["storage"],
"browser_action": {
"name": "Click to change your browsers perspective",
"default_icon": "icon0.png"
},
"manifest_version": 2
}