Last active
July 23, 2022 18:07
-
-
Save kevinlekiller/0497971224d46122487d98c11b53c49c to your computer and use it in GitHub Desktop.
Mass enable all mailboxes for aliases on the current page on simplelogin.io ; use with an addon like Violentmonkey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name simplelogin.io mass enable mailboxes | |
// @namespace kevinlekiller/simplelogin.io | |
// @include https://app.simplelogin.io/* | |
// @version 1.1 | |
// @description Mass enable all mailboxes for aliases on the current page on simplelogin.io | |
// @licence gpl-3.0 https://www.gnu.org/licenses/gpl-3.0.html | |
// @author kevinlekiller | |
// ==/UserScript== | |
async function mass_enable() { | |
let aliases = document.getElementsByClassName('col-12 col-lg-6'); | |
//console.log(aliases); | |
let aliasesTotal = aliases.length | 0; | |
for (let i = 0; i < aliasesTotal; i++) { | |
// Sleep 250ms to not overload the server. | |
await new Promise(r => setTimeout(r, 250)); | |
// Sets curNode to the "More" button to the bottom right of an alias. | |
let curNode = aliases[i].children[0].children[4].children[1].children[0]; | |
if (!curNode) { | |
continue; | |
} | |
// Clicks the "More" button. | |
curNode.click(); | |
// Sets curNode to the mailbox dropdown button. | |
curNode = aliases[i].children[0].children[5].getElementsByClassName('ms-parent mailbox-select'); | |
// Skip if alias already has all mailboxes enabled. | |
if (curNode[0].textContent.match('All selected')) { | |
continue; | |
} | |
// Clicks the mailbox dropdown selection. | |
curNode[0].children[0].click(); | |
// Clicks the "[Select all]" button to enable all the mailboxes. | |
aliases[i].children[0].children[5].getElementsByClassName('ms-drop bottom')[0].children[0].children[0].children[0].children[0].click(); | |
// Clicks the "Update" button to save the change. | |
aliases[i].children[0].children[5].getElementsByClassName('save-mailbox btn btn-sm btn-outline-info w-100')[0].click(); | |
} | |
} | |
mass_enable(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment