From f4082ab84b30a03c8f067f215f853af62f1cc429 Mon Sep 17 00:00:00 2001 From: Hangzhi Yu <hangzhi@protonmail.com> Date: Fri, 30 Dec 2022 15:19:14 +0100 Subject: [PATCH] Remove unused parts of legacy main.js --- aleksis/core/static/js/main.js | 39 ---------------------------------- 1 file changed, 39 deletions(-) diff --git a/aleksis/core/static/js/main.js b/aleksis/core/static/js/main.js index d68e55614..87f9660e2 100644 --- a/aleksis/core/static/js/main.js +++ b/aleksis/core/static/js/main.js @@ -162,13 +162,6 @@ $(document).ready(function () { $("#" + $(this).data("preview")).css("color", $(this).val()); }); - // Initialise auto-completion for search bar - window.autocomplete = new Autocomplete({ - minimum_length: 2, - url: JSON.parse($("#search-snippet-url").text()), - }); - window.autocomplete.setup(); - // Initialize text collapsibles [MAT, own work] $(".text-collapsible").addClass("closed").removeClass("opened"); @@ -180,37 +173,5 @@ $(document).ready(function () { var el = $(e.target).parent(); el.addClass("closed").removeClass("opened"); }); - - // Initialize the service worker - if ("serviceWorker" in navigator) { - console.debug("Start registration of service worker."); - navigator.serviceWorker - .register("/serviceworker.js", { - scope: "/", - }) - .then(function () { - console.debug("Service worker has been registered."); - }) - .catch(function () { - console.debug("Service worker registration has failed."); - }); - } }); -// Show notice if serviceworker broadcasts that the current page comes from its cache -const channel = new BroadcastChannel("cache-or-not"); -channel.addEventListener("message", (event) => { - if ( - $("main").attr("id") !== "mainReduced" && - event.data && - !$("#cache-alert").length - ) { - $("main").prepend( - '<div id="cache-alert" class="alert warning"><p><i class="material-icons iconify left" data-icon="mdi:alert-outline"></i>' + - gettext( - "This page may contain outdated information since there is no internet connection." - ) + - "</p> </div>" - ); - } -}); -- GitLab