Code improvements
This commit is contained in:
parent
945063ef4e
commit
7678a54b1b
|
@ -49,9 +49,9 @@ messenger._handleMessageReceived = function (message, sender, sendResponse) {
|
|||
'code': `window.addEventListener('load', () => {
|
||||
document.getElementById('domain').value = '${message.url}';
|
||||
});`,
|
||||
'runAt': 'document_start'
|
||||
'runAt': 'document_idle'
|
||||
});
|
||||
break;
|
||||
return MessageResponse.SYNCHRONOUS;
|
||||
|
||||
case 'domain:fetch-is-allowlisted':
|
||||
sendResponse({'value': Boolean(helpers.checkAllowlisted(value))});
|
||||
|
|
|
@ -204,7 +204,7 @@ helpers.determineActiveTab = function () {
|
|||
} else {
|
||||
opt = {'active': true};
|
||||
|
||||
chrome.tabs.query(opt, function (tabs) {
|
||||
chrome.tabs.query(opt, function () {
|
||||
resolve(tabs[0]);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -146,8 +146,6 @@ targets.setLastVersion = function (type, version) {
|
|||
return '0.1.1';
|
||||
} else if (type.startsWith('/angular-ui-select/0.')) {
|
||||
return '0.20.0';
|
||||
} else if (type.startsWith('/angular-sanitize/1.')) {
|
||||
return '1.7.9';
|
||||
} else if (type.startsWith('/angucomplete-alt/3.')) {
|
||||
return '3.0.0';
|
||||
} else if (type.startsWith('/animate.css/3.')) {
|
||||
|
|
|
@ -395,15 +395,13 @@ popup._filterDuplicates = function (array, key) {
|
|||
* Ignore empty values of the 'key'
|
||||
*
|
||||
*/
|
||||
let filtered = array
|
||||
return array
|
||||
.map((e) => e[key])
|
||||
.map(function (value, index, newArray) {
|
||||
return value !== '' ? newArray.indexOf(value) === index && index : index;
|
||||
})
|
||||
.filter((e) => array[e])
|
||||
.map((e) => array[e]);
|
||||
|
||||
return filtered;
|
||||
};
|
||||
|
||||
popup._renderLocaleNotice = function () {
|
||||
|
@ -445,10 +443,6 @@ popup._onTestingUtilityLinkClicked = function (event) {
|
|||
popup._injectDomain(tab.id);
|
||||
});
|
||||
}
|
||||
|
||||
if (event.button === 0) {
|
||||
window.close();
|
||||
}
|
||||
};
|
||||
|
||||
popup._onDonationButtonClicked = function () {
|
||||
|
@ -510,6 +504,9 @@ popup._injectDomain = function (tabId) {
|
|||
};
|
||||
|
||||
chrome.runtime.sendMessage(message);
|
||||
setTimeout(function () {
|
||||
popup._close();
|
||||
}, 200);
|
||||
};
|
||||
|
||||
popup._onOptionsButtonClicked = function () {
|
||||
|
|
|
@ -54,8 +54,8 @@ updates._onDocumentLoaded = function () {
|
|||
['copyRuleSet']: document.getElementById('button-copy-rule-set'),
|
||||
};
|
||||
|
||||
for (let i = 0; i < updateElements.ruleSets.length; i++) {
|
||||
updateElements.ruleSets[i].addEventListener('change', ruleGenerator.openRuleSet);
|
||||
for (let ruleSets of updateElements.ruleSets) {
|
||||
ruleSets.addEventListener('change', ruleGenerator.openRuleSet);
|
||||
}
|
||||
|
||||
updateElements.copyRuleSet.addEventListener('click', ruleGenerator.copyRuleSet);
|
||||
|
|
Loading…
Reference in New Issue