this post was submitted on 03 Dec 2023
252 points (97.4% liked)

Firefox

17958 readers
626 users here now

A place to discuss the news and latest developments on the open-source browser Firefox

founded 4 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] CosmicTurtle 1 points 1 year ago (1 children)

This is the second time I've seen this referenced but with no source code.

I'd like to do the same with Kroger coupons.

[–] [email protected] 3 points 1 year ago
// ==UserScript==
// @name         Safeway Clip All Coupons Button
// @version      0.1
// @description  Add convenient button to automatically load and clip all coupons on Safeway's ForU page
// @match        https://www.safeway.com/foru/coupons-deals.html*
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAh1BMVEX///8AAAD6+vrn5+fp6eltbW3k5OTQ0ND39/fy8vL19fV5eXnr6+tzc3Pv7+/T09MdHR19fX2mpqYoKCguLi62trbb29tpaWnExMRUVFQ/Pz+Dg4NFRUXKysqurq7d3d0TExM1NTVOTk6np6dbW1ucnJy1tbUsLCwYGBiUlJSMjIxiYmI6OjqwN+dPAAAKdUlEQVR4nO2d6VrjOgyGk7B0A7qwlFJK2Yc5zP1f32laShNJliUviZnJ95Pqif2ieJeVLCM1HD8sF1eTPJ9cLZYP4yFt9WM1eLnPge5f/iLI8Rzi7XQybrtmYXSD3HfQYt127fw1PDHzlRr1266hp255vlKrtuvopaUdMM9/t11LdxXPEsA8fw1fdP92NruN3gCKKxngZuQIXfR099xl6OfWJQfM87ugJR8fHnwc9MFAzCCBFfJFPao897EI+GCgkQYwz/8LVvBx7bnTYM+FutYB5nkvUMFH4LmxnDjQAoaqyjF87G2Qx2J96gmDvE/Qg3k+C/FYrBXJML8+GhTF4PSa5g8wR0UejEb4hwB4q7yGxRth4N+fYg/GmhT2cEFT0MwKoq899SyW8GCsnmaByrnGRg/I6NyvVMqDkaY1Z6gcskPD6w6v/zfpwUgjPmpkhAdLvQjtRCIBvV98g+5AMSOTIVwdz93LJF/RWIBotDe+KX1o6Vxmox5EgyEzIsH3+caxyEY9iKv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tiL+b8L9Nnukwl6ivtn8gSAJoep7dHQIgA+hIeykJubCoojQ4EVS0nhXBSH5ncOqRtyWuIxQ7kXxPERDuOm+mNZo+Xq8kFDsRfHZhY7QfBvhhI3qVBAKEen1QAjCTcf+gEJsFu/2LPpiQlHCerRDFpKw1Hg2vft43EwzJvfLmc17WkKJFxWTLDdCBykI7YiaK99JEtq+SqdasaZJmN8xp819XdR5ooTMN7gFE4+fQZi/ksexF+o9lXQJN3MkFK596hDYljLhpjnOKhOl9YvTtY+0CUs9z5dvs98j5w3u1gjrC1PFHEUrS+RePEI+oC6gLJF78Qj5gLqAskTuxSPkN/lCio/ci0h4yQXUhRQfuReRML/cRzquqbtLAcVG7sUk3AzpvYviYtVADoxtQXTkXlzCBNQRdoQdYfvqCDvCjrB9dYQdYUfYvjrCjtBC+B25F1uWyL1YhNXIvaiyR+7FIaxH7sUErFSi0X0aELkXT6LIvQiEfEBdQMki9yIQ8gF1ASWM3AtPWP812I1JLGnkXmTCiKNl+qdrHWFH2BF2hB1hRwitBmNTdPNyPIBXizXGqRCWOnsiqnxnSFihMlZVQy3Foz2TkDPGqRASFw2YXJoq41QI/ZKQu2TZDSHVo2FcD5ssVGWcCmGgJOS+1dBJ9WhVEvIwGcv9xUfuAcH4unjGLigG8ZF7QKok5F7GLigG8ZF7QHDvNp6xC4pBbOQekCoJuZ+xOxASF7kHRATyRTP2xaqIidwDIpOQxzIOA7eVIXIPWtHxdfGMIxMmoI6wI+wI21dH2BH+U4Qw2WsamtjrLZc2928jUmSpsMvpi0OxZbyL66SntnGw/gQFDJU1NqREnzRSaOB0yzWemM1/Z61GTp+oi6GPz20b/B/O6qES6KEGJgAAAABJRU5ErkJggg==
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const couponGridContainer = document.getElementsByClassName('coupon-grid-container')[0];

    let clipButton = document.createElement('button');
    clipButton.addEventListener('click', clipCoupons);
    clipButton.innerHTML = '<span>Clip All Coupons</span>';
    clipButton.classList.add('btn');
    clipButton.classList.add('btn-secondary');
    clipButton.style.width = '175px';

    couponGridContainer.insertBefore(clipButton, couponGridContainer.firstChild);
})();

async function clipCoupons() {
    console.log('Clipping coupons...');
    let load_more = document.getElementsByClassName('load-more')[0];
    while (load_more != undefined) {
        load_more.click()
        await new Promise(r => setTimeout(r, 1000));
        window.scrollTo(0, document.body.scrollHeight);
        load_more = document.getElementsByClassName('load-more')[0];
    }
    let coupons = document.getElementsByClassName("grid-coupon-btn");
    for (let coupon of coupons) coupon.click();
    console.log('Finished clipping coupons!');
}