history: remove jQuery #452

This commit is contained in:
Sören Weber 2023-01-29 16:47:01 +01:00
parent 302ea923ed
commit 1491e66580
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

@ -714,14 +714,16 @@ function clearHistory() {
// in case we have `relativeURLs=true` we have to strip the // in case we have `relativeURLs=true` we have to strip the
// relative path to root // relative path to root
url = url.replace( /\.\.\//g, '/' ).replace( /^\/+\//, '/' ); 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() { function initHistory() {
var visitedItem = baseUriFull + 'visited-url/' 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 // loop through the sessionStorage and see if something should be marked as visited
for( var item in sessionStorage ){ for( var item in sessionStorage ){
@ -730,7 +732,9 @@ function initHistory() {
// in case we have `relativeURLs=true` we have to strip the // in case we have `relativeURLs=true` we have to strip the
// relative path to root // relative path to root
url = url.replace( /\.\.\//g, '/' ).replace( /^\/+\//, '/' ); 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' );
});
} }
} }
} }