Skip to content

Commit

Permalink
[Firefox] Sort container list by name
Browse files Browse the repository at this point in the history
  • Loading branch information
M-rcus committed Mar 25, 2023
1 parent a846a85 commit f1c202c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "OnlyFans Cookie Helper",
"version": "2.2.1",
"version": "2.3.0",
"description": "Helper extension that makes it easier to copy config.json values for the DIGITALCRIMINALS/OnlyFans scraper",
"icons": {
"48": "icons/cookie.png"
Expand Down
2 changes: 1 addition & 1 deletion manifest_v2.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "OnlyFans Cookie Helper",
"version": "2.2.1",
"version": "2.3.0",
"description": "Helper extension that makes it easier to copy config.json values for the DIGITALCRIMINALS/OnlyFans scraper",
"icons": {
"48": "icons/cookie.png"
Expand Down
20 changes: 18 additions & 2 deletions popup/cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,34 @@ async function getContainers()
/**
* Non-Firefox browser or containers not enabled.
*/
if (browser.contextualIdentities === undefined) {
if (!containersEnabled) {
return;
}

/**
* Containers are enabled, but none found.
*/
const containers = await browser.contextualIdentities.query({});
let containers = await browser.contextualIdentities.query({});
if (containers.length < 1) {
return;
}

// Sort container list by name.
containers.sort(function(a, b) {
const nameA = a.name.toLowerCase();
const nameB = b.name.toLowerCase();

if (nameA < nameB) {
return -1;
}

if (nameA > nameB) {
return 1;
}

return 0;
});

const containerSection = document.querySelector('#container-list');
containerSection.classList.remove('hidden');

Expand Down

0 comments on commit f1c202c

Please sign in to comment.