/*jslint browser: true*/

if (navigator.serviceWorker && location.protocol === 'https://') {
    try {
        navigator.serviceWorker.register('/serviceworker.js', {
            scope: '/'
        });
        window.addEventListener('load', function () {
            if (navigator.serviceWorker.controller) {
                navigator.serviceWorker.controller.postMessage({'command': 'trimCaches'});
            }
        });
    } catch {}
}

(function () {
    var cookieMessage = document.getElementById('cookie-message');
    if (cookieMessage && document.cookie.indexOf('seen_cookie_message=yes') === -1) {
        cookieMessage.style.display = 'block';
        document.cookie = 'seen_cookie_message=yes; max-age=31536000; path=/';
    }
})();

/*jslint browser: true*/

if (navigator.serviceWorker && location.host !== 'localhost:8000') {
    navigator.serviceWorker.register('/serviceworker.js', {
        scope: '/'
    });
    window.addEventListener('load', function () {
        if (navigator.serviceWorker.controller) {
            navigator.serviceWorker.controller.postMessage({'command': 'trimCaches'});
        }
    });
}

(function () {
    var cookieMessage = document.getElementById('cookie-message');
    if (cookieMessage && document.cookie.indexOf('seen_cookie_message=yes') === -1) {
        cookieMessage.style.display = 'block';
        document.cookie = 'seen_cookie_message=yes; max-age=31536000; path=/';
    }
})();

Revert "catch service worker error?"
Revert "catch service worker error?"

This reverts commit c14cfe8917c1f1c23ccd4bbd25a7b40d6c5d6b2b.
