basic extension
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								bluepill/.DS_Store
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bluepill/.DS_Store
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										25
									
								
								bluepill/background.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								bluepill/background.js
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										1
									
								
								bluepill/content.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
console.log("Extension is running");
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								bluepill/icon0.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bluepill/icon0.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 573 B  | 
							
								
								
									
										
											BIN
										
									
								
								bluepill/icon1.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bluepill/icon1.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 1.6 KiB  | 
							
								
								
									
										22
									
								
								bluepill/manifest.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								bluepill/manifest.json
									
									
									
									
									
										Normal 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
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user