fix missing badge text after style install
This commit is contained in:
parent
ecc3bf18a9
commit
90ae3b8d88
10
messaging.js
10
messaging.js
|
@ -11,11 +11,17 @@ function notifyAllTabs(request) {
|
||||||
|
|
||||||
function updateBadgeText(tab) {
|
function updateBadgeText(tab) {
|
||||||
if (localStorage["show-badge"] == "true") {
|
if (localStorage["show-badge"] == "true") {
|
||||||
chrome.extension.sendMessage({method: "getStyles", matchUrl: tab.url, enabled: true}, function(styles) {
|
function stylesReceived(styles) {
|
||||||
var t = getBadgeText(styles);
|
var t = getBadgeText(styles);
|
||||||
console.log("Tab " + tab.id + " (" + tab.url + ") badge text set to '" + t + "'.");
|
console.log("Tab " + tab.id + " (" + tab.url + ") badge text set to '" + t + "'.");
|
||||||
chrome.browserAction.setBadgeText({text: t, tabId: tab.id});
|
chrome.browserAction.setBadgeText({text: t, tabId: tab.id});
|
||||||
});
|
}
|
||||||
|
// if we have access to this, call directly. a page sending a message to itself doesn't seem to work right.
|
||||||
|
if (typeof getStyles != "undefined") {
|
||||||
|
getStyles({matchUrl: tab.url, enabled: true}, stylesReceived);
|
||||||
|
} else {
|
||||||
|
chrome.extension.sendMessage({method: "getStyles", matchUrl: tab.url, enabled: true}, stylesReceived);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
chrome.browserAction.setBadgeText({text: "", tabId: tab.id});
|
chrome.browserAction.setBadgeText({text: "", tabId: tab.id});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
var stylishDb = null;
|
var stylishDb = null;
|
||||||
function getDatabase(ready, error) {
|
function getDatabase(ready, error) {
|
||||||
console.log("getting tha db");
|
|
||||||
if (stylishDb != null && stylishDb.version == "1.5") {
|
if (stylishDb != null && stylishDb.version == "1.5") {
|
||||||
ready(stylishDb);
|
ready(stylishDb);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user