Skip to content

Instantly share code, notes, and snippets.

@Ed1123
Last active March 7, 2024 22:01
Show Gist options
  • Save Ed1123/d72e0d3fbd89cdd00ac63d1d74d0debe to your computer and use it in GitHub Desktop.
Save Ed1123/d72e0d3fbd89cdd00ac63d1d74d0debe to your computer and use it in GitHub Desktop.
A script to auto-select the star emoji for all stickers when importing them to Signal
// Delay function
const delay = ms => new Promise(res => setTimeout(res, ms));
// Delay between clicks (seconds)
delayBetweenClicks = .1;
// Loop for all the stickers
stickers = document.getElementsByClassName('lCzvEVovrfFcZaKyf3ZOA');
for (i=0; i<stickers.length; i++){
// Clicking each emoji element for each sticker
stickers[i].getElementsByClassName('_2S1Fkez4JWbv9-1wbe5aeH')[0].click();
// Waiting
await delay(delayBetweenClicks * 1000);
// Scrolling to make the star visible
document.querySelector("body > div:nth-child(8) > div > div > div:nth-child(1) > div").scrollBy(0, 4500);
// Waiting
await delay(delayBetweenClicks * 1000);
// Clicking the star emoji
document.querySelector('[title="star"]').click();
// Waiting
await delay(delayBetweenClicks * 1000);
// logging
console.log(i);
}
@mothdotmonster
Copy link

mothdotmonster commented Mar 7, 2024

the version here didn't work for me so here's a version i ended up using

// Delay function
const delay = ms => new Promise(res => setTimeout(res, ms));
// Delay between clicks (seconds)
delayBetweenClicks = .1;

// Loop for all the stickers 
stickers = document.getElementsByClassName('_container_1k19t_1');
for (i=0; i<stickers.length; i++){
    // Clicking each emoji element for each sticker
    stickers[i].getElementsByClassName('_emoji-button_1k19t_125')[0].click();
    // Waiting
    await delay(delayBetweenClicks * 1000);
    // Clicking the star emoji
    document.querySelector('[aria-label="star"]').click();
    // Waiting
    await delay(delayBetweenClicks * 1000);
    // logging
    console.log(i);
}

@Ed1123
Copy link
Author

Ed1123 commented Mar 7, 2024

Oh, thanks! I wrote it a long time ago. Thanks for fixing it. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment