Checkers PromoAlerts Grid

Compact, common sense grid view

// ==UserScript==
// @name         Checkers PromoAlerts Grid
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @description  Compact, common sense grid view
// @author       spergNumber1
// @match        https://www.checkers.co.za/xtra-savings
// @match        https://www.checkers.co.za/all-xtra-savings*
// @match        https://www.checkers.co.za/my-account/promo-alerts
// @require      https://code.jquery.com/jquery-3.7.1.min.js
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    function fix_price(element) {
        var r = Math.round(parseFloat(element.innerText.slice(1)));
        if (r > 0) {
            element.innerText = "R" + r;
            var e = $(element);
            if (!e.hasClass('before')) {
                e.css('color', '#e51f34');
                e.css('font-weight', '800');
                e.css('font-size', '30px');
            }
        }
    }

    async function open_menu() {
        var i = 12; // retry for 12 seconds, because the web server is just that slow.
        let id;
        id = window.setInterval(function() {
            if (i --> 0) {
                if (document.location.href.endsWith("/xtra-savings")) {
                    $('.promo-alerts__menu').addClass('is-show');
                    $('.promo-alerts__submenu').css('width', '1600px');
                    $('.product').css('display', 'inline-block');
                    $('.product').css('vertical-align', 'top');
                    $('.product').css('width', '100px');
                    $('.product').css('height', '310px');
                    $('.product').css('padding', 'unset');
                    $('.product__image img').css('max-width', '100px')
                    $('.product__image img').css('max-height', '200px')
                    $('.item-product__message').css('width', '60px');
                }
                window.setTimeout(function() {
                    for (const element of $('.now')) {
                        fix_price(element);
                    }

                    for (const element of $('.before')) {
                        fix_price(element);
                    }
                }, 60);
            } else window.clearInterval(id);
        }, 1000);
    }
    open_menu();
    //window.addEventListener("load", function(){open_menu();}); // Nope
})();