```NS.jQuery(function() { function check_alert...
# accounting
m
Copy code
NS.jQuery(function() {
    function check_alert(message) {
        var IGNORED_ALERTS = [
            /^Customer is \d+ days overdue\.$/,
            /^The following items are currently out of stock/,
        ];
        return IGNORED_ALERTS.some(function(regex){
            return regex.test(message);
        });
    }

    var nalert = window.alert;
    window.alert = function() {
        if (check_alert(arguments[0])) {
            console.log('Alert suppressed - ' + arguments[0]);
        } else {
            return nalert.apply(this, arguments);
        }
    };
});