1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-06-05 21:49:31 +02:00

Improved: Popup, Options and Statistics page

This commit is contained in:
nobody
2021-03-21 08:07:30 +01:00
parent a92ad9b4d3
commit df00b7ba77
7 changed files with 142 additions and 169 deletions

View File

@ -187,6 +187,28 @@ helpers.determineScriptDirection = function (language) {
return scriptDirection;
};
helpers.determineActiveTab = function () {
return new Promise((resolve) => {
let opt = {
'active': true,
'currentWindow': true
};
chrome.tabs.query(opt, function (tabs) {
if (tabs[0]) {
resolve(tabs[0]);
} else {
opt = {'active': true};
chrome.tabs.query(opt, function (tabs) {
resolve(tabs[0]);
});
}
});
});
};
helpers.formatNumber = function (number) {
if (typeof number === 'number') {
return number.toLocaleString();