Don't call getBetterUrl for the pageAction checks
getBetterUrl is rather expensive (especially for Pixiv URLs), and there is no real reason to call it before calling isCoolUrl if isCoolUrl is made to check if the URL is a Pixiv URL.
This commit is contained in:
parent
b6c39c0e6c
commit
e8d76fea7f
|
@ -229,14 +229,13 @@ function isCoolUrl(url, callback) {
|
||||||
console.log('blacklist disabled!');
|
console.log('blacklist disabled!');
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(validExtensions.indexOf(extension) != -1 || isInstagramUrl(url) || isSkypeUrl(url));
|
callback(validExtensions.indexOf(extension) != -1 || isInstagramUrl(url) || isPixivUrl(url) || isSkypeUrl(url));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
|
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
|
||||||
if(tab.active) {
|
if(tab.active) {
|
||||||
getBetterUrl(tab.url, function(betterUrl) {
|
isCoolUrl(tab.url, function (cool) {
|
||||||
isCoolUrl(betterUrl, function (cool) {
|
|
||||||
if(cool) {
|
if(cool) {
|
||||||
chrome.pageAction.show(tabId);
|
chrome.pageAction.show(tabId);
|
||||||
}
|
}
|
||||||
|
@ -247,8 +246,7 @@ chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
|
||||||
|
|
||||||
chrome.tabs.onActivated.addListener(function(activeInfo) {
|
chrome.tabs.onActivated.addListener(function(activeInfo) {
|
||||||
chrome.tabs.get(activeInfo.tabId, function(tab) {
|
chrome.tabs.get(activeInfo.tabId, function(tab) {
|
||||||
getBetterUrl(tab.url, function(betterUrl) {
|
isCoolUrl(tab.url, function(cool) {
|
||||||
isCoolUrl(betterUrl, function(cool) {
|
|
||||||
if (cool) {
|
if (cool) {
|
||||||
chrome.pageAction.show(activeInfo.tabId);
|
chrome.pageAction.show(activeInfo.tabId);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue