Skip to content

Commit

Permalink
history: remove jQuery matcornic#452
Browse files Browse the repository at this point in the history
  • Loading branch information
McShelby committed Jan 29, 2023
1 parent 302ea92 commit 1491e66
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions static/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ){
Expand All @@ -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' );
});
}
}
}
Expand Down

0 comments on commit 1491e66

Please sign in to comment.