Compare commits
3 Commits
0a00b1c1f1
...
v0.0.3
Author | SHA1 | Date | |
---|---|---|---|
b393e4f859 | |||
ffa5b59615 | |||
e73e806dca |
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
## What it does
|
## What it does
|
||||||
|
|
||||||
|
**Please install [Tree Style Tab](https://addons.mozilla.org/firefox/addon/tree-style-tab/) before installing this extension, because this extension depends on it!**
|
||||||
|
|
||||||
This addon would like to color tabs based on the parent tab that opened the tab.
|
This addon would like to color tabs based on the parent tab that opened the tab.
|
||||||
So say I am at work searching for a solution to a javascript problem on stackoverflow, so I open a bunch of tabs with possible solutions. Then I get distracted, and I start looking for honey badger images on google images, I open a bunch of tabs with honey badger images.
|
So say I am at work searching for a solution to a javascript problem on stackoverflow, so I open a bunch of tabs with possible solutions. Then I get distracted, and I start looking for honey badger images on google images, I open a bunch of tabs with honey badger images.
|
||||||
Now all my tabs are mixed up with javascript snippets and honey badgers.
|
Now all my tabs are mixed up with javascript snippets and honey badgers.
|
||||||
@@ -12,4 +14,7 @@ At the moment this is not possible because of Firefox bug [1320585](https://bugz
|
|||||||
|
|
||||||
So this extension **tries** to get the favicon of the newly opened tab, and changes the color of the favicon to match that of the parent.
|
So this extension **tries** to get the favicon of the newly opened tab, and changes the color of the favicon to match that of the parent.
|
||||||
|
|
||||||
**Please install [Tree Style Tab](https://addons.mozilla.org/firefox/addon/tree-style-tab/) before installing this extension, because this extension depends on it!**
|
But it will not work
|
||||||
|
- on pages that don't allow content scripts (amo for example)
|
||||||
|
- on pages that dynamically change the favicon
|
||||||
|
- a lot of other cases
|
||||||
|
11
src/bg.js
11
src/bg.js
@@ -7,7 +7,15 @@ var changeIcon = function(color, currentIcon) {
|
|||||||
canvas.height = 16;
|
canvas.height = 16;
|
||||||
var ctx = canvas.getContext('2d');
|
var ctx = canvas.getContext('2d');
|
||||||
var img = new Image();
|
var img = new Image();
|
||||||
img.src = currentIcon;
|
|
||||||
|
if (currentIcon && typeof(currentIcon) !== 'undefined' && currentIcon !== null && currentIcon !== 'undefined') {
|
||||||
|
console.log(currentIcon);
|
||||||
|
img.src = currentIcon;
|
||||||
|
} else {
|
||||||
|
img.src = 'data:image/x-icon;base64,AAABAAEAEBACAAEAAQCwAAAAFgAAACgAAAAQAAAAIAAAAAEAAQAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA';
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(img.src);
|
||||||
img.onload = function() {
|
img.onload = function() {
|
||||||
ctx.drawImage(img, 0, 0);
|
ctx.drawImage(img, 0, 0);
|
||||||
ctx.fillStyle = color;
|
ctx.fillStyle = color;
|
||||||
@@ -85,6 +93,7 @@ var updateAllColorsOnAllTabs = async () => {
|
|||||||
|
|
||||||
if (tabs[i].status === 'complete') {
|
if (tabs[i].status === 'complete') {
|
||||||
let t = getTabParent(tstTabs, tabs[i].id);
|
let t = getTabParent(tstTabs, tabs[i].id);
|
||||||
|
|
||||||
browser.tabs.executeScript(tabs[i].id, {
|
browser.tabs.executeScript(tabs[i].id, {
|
||||||
code: '(' + changeIcon.toString() + ')' +
|
code: '(' + changeIcon.toString() + ')' +
|
||||||
'("' + generateRandomColor(t.parentIndex) + '", "' + t.faviconUrl + '")'
|
'("' + generateRandomColor(t.parentIndex) + '", "' + t.faviconUrl + '")'
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"description": "Color tabs based on their parent.",
|
"description": "Color tabs based on their parent.",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Color Tab Group",
|
"name": "Color Tab Group",
|
||||||
"version": "0.0.2",
|
"version": "0.0.3",
|
||||||
"homepage_url": "https://git.e.tern.al/s2/tab-groupcolor",
|
"homepage_url": "https://git.e.tern.al/s2/tab-groupcolor",
|
||||||
"icons": {
|
"icons": {
|
||||||
"48": "img/icon-48.png"
|
"48": "img/icon-48.png"
|
||||||
|
Reference in New Issue
Block a user