Browse Source

basic extension

master
Anton Linus 2 years ago
parent
commit
795173a45f
  1. BIN
      .DS_Store
  2. BIN
      bluepill/.DS_Store
  3. 25
      bluepill/background.js
  4. 1
      bluepill/content.js
  5. BIN
      bluepill/icon0.png
  6. BIN
      bluepill/icon1.png
  7. 22
      bluepill/manifest.json

BIN
.DS_Store

Binary file not shown.

BIN
bluepill/.DS_Store

Binary file not shown.

25
bluepill/background.js

@ -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

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

BIN
bluepill/icon0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

BIN
bluepill/icon1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

22
bluepill/manifest.json

@ -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
}
Loading…
Cancel
Save