Skip to content

Commit f1c202c

Browse files
committed
[Firefox] Sort container list by name
1 parent a846a85 commit f1c202c

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "OnlyFans Cookie Helper",
4-
"version": "2.2.1",
4+
"version": "2.3.0",
55
"description": "Helper extension that makes it easier to copy config.json values for the DIGITALCRIMINALS/OnlyFans scraper",
66
"icons": {
77
"48": "icons/cookie.png"

manifest_v2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "OnlyFans Cookie Helper",
4-
"version": "2.2.1",
4+
"version": "2.3.0",
55
"description": "Helper extension that makes it easier to copy config.json values for the DIGITALCRIMINALS/OnlyFans scraper",
66
"icons": {
77
"48": "icons/cookie.png"

popup/cookies.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,34 @@ async function getContainers()
5353
/**
5454
* Non-Firefox browser or containers not enabled.
5555
*/
56-
if (browser.contextualIdentities === undefined) {
56+
if (!containersEnabled) {
5757
return;
5858
}
5959

6060
/**
6161
* Containers are enabled, but none found.
6262
*/
63-
const containers = await browser.contextualIdentities.query({});
63+
let containers = await browser.contextualIdentities.query({});
6464
if (containers.length < 1) {
6565
return;
6666
}
6767

68+
// Sort container list by name.
69+
containers.sort(function(a, b) {
70+
const nameA = a.name.toLowerCase();
71+
const nameB = b.name.toLowerCase();
72+
73+
if (nameA < nameB) {
74+
return -1;
75+
}
76+
77+
if (nameA > nameB) {
78+
return 1;
79+
}
80+
81+
return 0;
82+
});
83+
6884
const containerSection = document.querySelector('#container-list');
6985
containerSection.classList.remove('hidden');
7086

0 commit comments

Comments
 (0)