From c7e3be4b079d7945721dd2db293ed172918b69eb Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 25 May 2020 09:41:13 +0300 Subject: [PATCH] footer.js: remove duplicate function. There's already a function checking for cookies in the previous document.ready function. Signed-off-by: XhmikosR --- scripts/pi-hole/js/footer.js | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/scripts/pi-hole/js/footer.js b/scripts/pi-hole/js/footer.js index b2528e6b..3b706117 100644 --- a/scripts/pi-hole/js/footer.js +++ b/scripts/pi-hole/js/footer.js @@ -110,6 +110,21 @@ function checkMessages() { }); } +function testCookies() { + if (navigator.cookieEnabled) { + return true; + } + + // set and read cookie + document.cookie = "cookietest=1"; + var ret = document.cookie.indexOf("cookietest=") !== -1; + + // delete cookie + document.cookie = "cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT"; + + return ret; +} + $(document).ready(function () { var enaT = $("#enableTimer"); var target = new Date(parseInt(enaT.html())); @@ -207,24 +222,3 @@ $(document).keypress(function (e) { $("#loginform").submit(); } }); - -function testCookies() { - if (navigator.cookieEnabled) { - return true; - } - - // set and read cookie - document.cookie = "cookietest=1"; - var ret = document.cookie.indexOf("cookietest=") !== -1; - - // delete cookie - document.cookie = "cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT"; - - return ret; -} - -$(function () { - if (!testCookies() && $("#cookieInfo").length > 0) { - $("#cookieInfo").show(); - } -});