From 1491e665802ad4b4f952fa4fb9720d50a26c0e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sun, 29 Jan 2023 16:47:01 +0100 Subject: [PATCH] history: remove jQuery #452 --- static/js/theme.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/static/js/theme.js b/static/js/theme.js index aa6c78e84b..acfbcab711 100644 --- a/static/js/theme.js +++ b/static/js/theme.js @@ -714,14 +714,16 @@ function clearHistory() { // in case we have `relativeURLs=true` we have to strip the // relative path to root url = url.replace( /\.\.\//g, '/' ).replace( /^\/+\//, '/' ); - jQuery('[data-nav-id="' + url + '"]').removeClass('visited'); + document.querySelectorAll( '[data-nav-id="'+url+'"]' ).forEach( function( e ){ + e.classList.remove( 'visited' ); + }); } } } function initHistory() { var visitedItem = baseUriFull + 'visited-url/' - sessionStorage.setItem(visitedItem+jQuery('body').data('url'), 1); + sessionStorage.setItem( visitedItem+document.querySelector( 'body' ).dataset.url, 1); // loop through the sessionStorage and see if something should be marked as visited for( var item in sessionStorage ){ @@ -730,7 +732,9 @@ function initHistory() { // in case we have `relativeURLs=true` we have to strip the // relative path to root url = url.replace( /\.\.\//g, '/' ).replace( /^\/+\//, '/' ); - jQuery('[data-nav-id="' + url + '"]').addClass('visited'); + document.querySelectorAll( '[data-nav-id="'+url+'"]' ).forEach( function( e ){ + e.classList.add( 'visited' ); + }); } } }