document.addEventListener("DOMContentLoaded", () => {
    let isPushEnabled = false;

    const pushButton = document.querySelector('#push-subscription-button');
    if (!pushButton) {
        return;
    }

    pushButton.addEventListener('click', function() {
        if (isPushEnabled) {
            push_unsubscribe();
        } else {
            push_subscribe();
        }
    });

    if (!('serviceWorker' in navigator)) {
        console.warn("Service workers aren't supported on this browser");
        changePushButtonState('incompatible');
        return;
    }

    navigator.serviceWorker.register("serviceWorker.js")
    .then(() => {
        console.log('[SW] Service worker has been registered');
    }, e => {
        console.error('[SW] Service worker registration failed', e);
        changePushButtonState('incompatible');
    });

    function changePushButtonState (state) {
        switch (state) {
            case 'enabled':
                pushButton.disabled = false;
                pushButton.title = "Push notifications enabled";
                isPushEnabled = true;
                break;
            case 'disabled':
                pushButton.disabled = false;
                pushButton.title = "Push notifications disabled";
                isPushEnabled = false;
                break;
            case 'computing':
                pushButton.disabled = true;
                pushButton.title = "Loading...";
                break;
            case 'incompatible':
                pushButton.disabled = true;
                pushButton.title = "Push notifications are not compatible with this browser";
                break;
            default:
                console.error('Unhandled push button state', state);
                break;
        }
    }

    function push_subscribe() {
        changePushButtonState('computing');
    }

    function push_unsubscribe() {
        changePushButtonState('computing');
    }
});
@@ -470,24 +470,426 @@
  are
-n't supported on
+ not supported by this browser%22);%0A        changePushButtonState('incompatible');%0A        return;%0A    %7D%0A%0A    if (!('PushManager' in window)) %7B%0A        console.warn('Push notifications are not supported by this browser');%0A        changePushButtonState('incompatible');%0A        return;%0A    %7D%0A%0A    if (!('showNotification' in ServiceWorkerRegistration.prototype)) %7B%0A        console.warn('Notifications are not supported by
  thi
@@ -889,33 +889,33 @@
  by this browser
-%22
+'
 );%0A        chang

Add more compatibility checks