diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a03eeaabc06..1f8d4155c7dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Unreleased version - BREAKING CHANGE: Allow changing the order of the social network links that appear in the footer (#1152) - BREAKING CHANGE: `google-scholar` social network link no longer requires the prefix `citations?user=`; if you previously set this parameter, it needs to be updated (#1189) +- BREAKING CHANGE: `jQuery` is no longer included by default; if you use jQuery, you need to include it yourself (#1375) - Added `mathjax` YAML parameter to allow support for MathJax, used to write LaTeX expressions (#195) - Added explicit support for favicons, you only need to add a `favicon.ico` file to the root directory - The footer of a page always sticks to the bottom, even on short pages (#576) @@ -16,6 +17,7 @@ - Added `title-on-all-pages` config setting, that adds the website title to all page titles (#1272) - Change Twitter icon to X (#1193) - Upgraded font-awesome to 6.5.2 (#1330) +- Upgraded bootstrap to 5.5.3 (#1375) ## v6.0.1 (2023-06-08) diff --git a/_includes/footer-scripts.html b/_includes/footer-scripts.html index bca6aede133f..8a0b86c015f8 100644 --- a/_includes/footer-scripts.html +++ b/_includes/footer-scripts.html @@ -6,16 +6,7 @@ {% if layout.common-js %} {% for js in layout.common-js %} - - {% if js contains 'jquery' %} - - {% else %} - - {% endif %} + {% endfor %} {% endif %} diff --git a/_includes/nav.html b/_includes/nav.html index 8293ca2e0962..bdc642d8b947 100644 --- a/_includes/nav.html +++ b/_includes/nav.html @@ -1,62 +1,64 @@ {% include search.html %} diff --git a/_includes/staticman-comments.html b/_includes/staticman-comments.html index ee3c2eef36de..51ef2106f9fb 100644 --- a/_includes/staticman-comments.html +++ b/_includes/staticman-comments.html @@ -72,12 +72,6 @@

{{ site.data.ui-text[site.locale].comments_labe - - {% endif %} diff --git a/_layouts/base.html b/_layouts/base.html index df2c16fd7d8a..01e088fa9363 100644 --- a/_layouts/base.html +++ b/_layouts/base.html @@ -3,18 +3,14 @@ - "/assets/css/bootstrap-social.css" - "/assets/css/beautifuljekyll.css" common-ext-css: - - href: "https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" - sri: "sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" + - href: "https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" + sri: "sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" - "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" - "https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" - "https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" common-ext-js: - - href: "https://code.jquery.com/jquery-3.5.1.slim.min.js" - sri: "sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs=" - - href: "https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" - sri: "sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" - - href: "https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" - sri: "sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" + - href: "https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" + sri: "sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" common-js: - "/assets/js/beautifuljekyll.js" --- diff --git a/_layouts/minimal.html b/_layouts/minimal.html index f81f29c82c84..08bd3ccedbfa 100644 --- a/_layouts/minimal.html +++ b/_layouts/minimal.html @@ -2,15 +2,11 @@ common-css: - "/assets/css/beautifuljekyll-minimal.css" common-ext-css: - - href: "https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" - sri: "sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" + - href: "https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" + sri: "sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" common-ext-js: - - href: "https://code.jquery.com/jquery-3.5.1.slim.min.js" - sri: "sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs=" - - href: "https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" - sri: "sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" - - href: "https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" - sri: "sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" + - href: "https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" + sri: "sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" --- diff --git a/assets/css/beautifuljekyll-minimal.css b/assets/css/beautifuljekyll-minimal.css index 17589f5581e9..1a73867dba8e 100644 --- a/assets/css/beautifuljekyll-minimal.css +++ b/assets/css/beautifuljekyll-minimal.css @@ -11,3 +11,18 @@ footer.footer-min { border-top: 1px solid #eeeeee; text-align: center; } + +a { + text-decoration: none; /* no underline */ +} +a:hover, +a:focus { + text-decoration: underline; /* underline when hovering */ +} + +.navbar-custom .navbar-nav .dropdown-menu .dropdown-item:focus, +.pagination .page-item .page-link:hover, +.pagination .page-item .page-link:focus, +.tag-btn:hover { + text-decoration: none; +} diff --git a/assets/css/beautifuljekyll.css b/assets/css/beautifuljekyll.css index 5e2abcde9b57..81fbff0d1454 100644 --- a/assets/css/beautifuljekyll.css +++ b/assets/css/beautifuljekyll.css @@ -74,10 +74,12 @@ h1, h2, h3, h4 { } a { color: var(--link-col); + text-decoration: none; /* no underline */ } a:hover, a:focus { color: var(--hover-col); + text-decoration: underline; /* underline when hovering */ } blockquote { color: var(--mid-col); @@ -95,6 +97,7 @@ hr.small { border-width: 0.25rem; border-color: inherit; border-radius: 0.1875rem; + opacity: 0.65; } /* fix in-page anchors to not be behind fixed header */ @@ -264,12 +267,12 @@ img { } @media (min-width: 1200px) { - .navbar-custom .nav-item.dropdown:hover { + .navbar-custom .nav-link.dropdown-toggle:hover { background: rgba(0, 0, 0, 0.1); } } -.navbar-custom .nav-item.dropdown.show { +.navbar-custom .nav-link.dropdown-toggle.show { background: rgba(0, 0, 0, 0.2); } @@ -328,7 +331,7 @@ img { padding: 0.675rem 0 0.675rem 1rem; } - .navbar-custom .nav-item.dropdown.show { + .navbar-custom .nav-link.dropdown-toggle.show { background: rgba(0, 0, 0, 0.2); } @@ -343,6 +346,7 @@ img { .navbar-custom .navbar-nav .dropdown-menu .dropdown-item:hover, .navbar-custom .navbar-nav .dropdown-menu .dropdown-item:focus { color: var(--hover-col); + text-decoration: none; } .navbar-custom .avatar-container { @@ -644,6 +648,9 @@ footer .footer-custom-content { .tag-btn { margin: 0.3125rem; } +.tag-btn:hover { + text-decoration: none; +} #full-tags-list { font-family: var(--header-font); @@ -825,6 +832,7 @@ nav.top-nav-short-permanent ~ header > .intro-header.big-img { color: var(--page-col); border: 1px solid var(--hover-col); background-color: var(--hover-col); + text-decoration: none; } /* --- Tables --- */ diff --git a/assets/js/beautifuljekyll.js b/assets/js/beautifuljekyll.js index c871dd76b0cd..d05e2b89b52f 100644 --- a/assets/js/beautifuljekyll.js +++ b/assets/js/beautifuljekyll.js @@ -2,27 +2,29 @@ let BeautifulJekyllJS = { - bigImgEl : null, - numImgs : null, + bigImgEl: null, + numImgs: null, - init : function() { + init: function() { setTimeout(BeautifulJekyllJS.initNavbar, 10); + let navbar = document.querySelector(".navbar"); + // Shorten the navbar after scrolling a little bit down - $(window).scroll(function() { - if ($(".navbar").offset().top > 50) { - $(".navbar").addClass("top-nav-short"); - } else { - $(".navbar").removeClass("top-nav-short"); - } + window.addEventListener('scroll', function() { + if (window.scrollY > 50) { + navbar.classList.add("top-nav-short"); + } else { + navbar.classList.remove("top-nav-short"); + } }); // On mobile, hide the avatar when expanding the navbar menu - $('#main-navbar').on('show.bs.collapse', function () { - $(".navbar").addClass("top-nav-expanded"); + document.getElementById('main-navbar').addEventListener('show.bs.collapse', function() { + navbar.classList.add("top-nav-expanded"); }); - $('#main-navbar').on('hidden.bs.collapse', function () { - $(".navbar").removeClass("top-nav-expanded"); + document.getElementById('main-navbar').addEventListener('hidden.bs.collapse', function() { + navbar.classList.remove("top-nav-expanded"); }); // show the big header image @@ -31,26 +33,30 @@ let BeautifulJekyllJS = { BeautifulJekyllJS.initSearch(); }, - initNavbar : function() { + initNavbar: function() { // Set the navbar-dark/light class based on its background color - const rgb = $('.navbar').css("background-color").replace(/[^\d,]/g,'').split(","); + const rgb = getComputedStyle(document.querySelector('.navbar')).backgroundColor.replace(/[^\d,]/g, '').split(","); const brightness = Math.round(( // http://www.w3.org/TR/AERT#color-contrast parseInt(rgb[0]) * 299 + parseInt(rgb[1]) * 587 + parseInt(rgb[2]) * 114 ) / 1000); + + let navbar = document.querySelector(".navbar"); if (brightness <= 125) { - $(".navbar").removeClass("navbar-light").addClass("navbar-dark"); + navbar.classList.remove("navbar-light"); + navbar.classList.add("navbar-dark"); } else { - $(".navbar").removeClass("navbar-dark").addClass("navbar-light"); + navbar.classList.remove("navbar-dark"); + navbar.classList.add("navbar-light"); } }, - initImgs : function() { - // If the page was large images to randomly select from, choose an image - if ($("#header-big-imgs").length > 0) { - BeautifulJekyllJS.bigImgEl = $("#header-big-imgs"); - BeautifulJekyllJS.numImgs = BeautifulJekyllJS.bigImgEl.attr("data-num-img"); + initImgs: function() { + // If the page has large images to randomly select from, choose an image + if (document.getElementById("header-big-imgs")) { + BeautifulJekyllJS.bigImgEl = document.getElementById("header-big-imgs"); + BeautifulJekyllJS.numImgs = BeautifulJekyllJS.bigImgEl.getAttribute("data-num-img"); // 2fc73a3a967e97599c9763d05e564189 // set an initial image @@ -69,19 +75,19 @@ let BeautifulJekyllJS = { prefetchImg.src = src; // if I want to do something once the image is ready: `prefetchImg.onload = function(){}` - setTimeout(function(){ - const img = $("
").addClass("big-img-transition").css("background-image", 'url(' + src + ')'); - $(".intro-header.big-img").prepend(img); - setTimeout(function(){ img.css("opacity", "1"); }, 50); + setTimeout(function() { + const img = document.createElement("div"); + img.className = "big-img-transition"; + img.style.backgroundImage = 'url(' + src + ')'; + document.querySelector(".intro-header.big-img").prepend(img); + setTimeout(function() { img.style.opacity = "1"; }, 50); // after the animation of fading in the new image is done, prefetch the next one - //img.one("transitioned webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(){ setTimeout(function() { BeautifulJekyllJS.setImg(src, desc); img.remove(); getNextImg(); }, 1000); - //}); }, 6000); }; @@ -92,46 +98,51 @@ let BeautifulJekyllJS = { } }, - getImgInfo : function() { + getImgInfo: function() { const randNum = Math.floor((Math.random() * BeautifulJekyllJS.numImgs) + 1); - const src = BeautifulJekyllJS.bigImgEl.attr("data-img-src-" + randNum); - const desc = BeautifulJekyllJS.bigImgEl.attr("data-img-desc-" + randNum); + const src = BeautifulJekyllJS.bigImgEl.getAttribute("data-img-src-" + randNum); + const desc = BeautifulJekyllJS.bigImgEl.getAttribute("data-img-desc-" + randNum); return { - src : src, - desc : desc + src: src, + desc: desc } }, - setImg : function(src, desc) { - $(".intro-header.big-img").css("background-image", 'url(' + src + ')'); - if (typeof desc !== typeof undefined && desc !== false) { - $(".img-desc").text(desc).show(); + setImg: function(src, desc) { + document.querySelector(".intro-header.big-img").style.backgroundImage = 'url(' + src + ')'; + + let imgDesc = document.querySelector(".img-desc"); + if (typeof desc !== typeof undefined && desc !== false && desc !== null) { + imgDesc.textContent = desc; + imgDesc.style.display = "block"; } else { - $(".img-desc").hide(); + imgDesc.style.display = "none"; } }, - initSearch : function() { + initSearch: function() { if (!document.getElementById("beautifuljekyll-search-overlay")) { return; } - $("#nav-search-link").click(function(e) { + document.getElementById("nav-search-link").addEventListener('click', function(e) { e.preventDefault(); - $("#beautifuljekyll-search-overlay").show(); - $("#nav-search-input").focus().select(); - $("body").addClass("overflow-hidden"); + document.getElementById("beautifuljekyll-search-overlay").style.display = "block"; + const searchInput = document.getElementById("nav-search-input"); + searchInput.focus(); + searchInput.select(); + document.body.classList.add("overflow-hidden"); }); - $("#nav-search-exit").click(function(e) { + document.getElementById("nav-search-exit").addEventListener('click', function(e) { e.preventDefault(); - $("#beautifuljekyll-search-overlay").hide(); - $("body").removeClass("overflow-hidden"); + document.getElementById("beautifuljekyll-search-overlay").style.display = "none"; + document.body.classList.remove("overflow-hidden"); }); - $(document).on('keyup', function(e) { - if (e.key == "Escape") { - $("#beautifuljekyll-search-overlay").hide(); - $("body").removeClass("overflow-hidden"); + document.addEventListener('keyup', function(e) { + if (e.key === "Escape") { + document.getElementById("beautifuljekyll-search-overlay").style.display = "none"; + document.body.classList.remove("overflow-hidden"); } }); } diff --git a/assets/js/staticman.js b/assets/js/staticman.js index 9ecf188661f9..0a786e396c3f 100644 --- a/assets/js/staticman.js +++ b/assets/js/staticman.js @@ -2,18 +2,19 @@ layout: null --- -(function ($) { - $('#new_comment').submit(function () { +document.addEventListener('DOMContentLoaded', function() { + document.getElementById('new_comment').addEventListener('submit', function(event) { + event.preventDefault(); const form = this; - $(form).addClass('disabled'); + form.classList.add('disabled'); {% assign sm = site.staticman -%} const endpoint = '{{ sm.endpoint }}'; const repository = '{{ sm.repository }}'; const branch = '{{ sm.branch }}'; const url = endpoint + repository + '/' + branch + '/comments'; - const data = $(this).serialize(); + const data = new URLSearchParams(new FormData(form)).toString(); const xhr = new XMLHttpRequest(); xhr.open("POST", url); @@ -31,35 +32,36 @@ layout: null }; function formSubmitted() { - $('#comment-form-submit').addClass('d-none'); - $('#comment-form-submitted').removeClass('d-none'); - $('.page__comments-form .js-notice').removeClass('alert-danger'); - $('.page__comments-form .js-notice').addClass('alert-success'); + document.getElementById('comment-form-submit').classList.add('d-none'); + document.getElementById('comment-form-submitted').classList.remove('d-none'); + const notice = document.querySelector('.page__comments-form .js-notice'); + notice.classList.remove('alert-danger'); + notice.classList.add('alert-success'); showAlert('success'); } function formError() { - $('#comment-form-submitted').addClass('d-none'); - $('#comment-form-submit').removeClass('d-none'); - $('.page__comments-form .js-notice').removeClass('alert-success'); - $('.page__comments-form .js-notice').addClass('alert-danger'); + document.getElementById('comment-form-submitted').classList.add('d-none'); + document.getElementById('comment-form-submit').classList.remove('d-none'); + const notice = document.querySelector('.page__comments-form .js-notice'); + notice.classList.remove('alert-success'); + notice.classList.add('alert-danger'); showAlert('failure'); - $(form).removeClass('disabled'); + form.classList.remove('disabled'); } xhr.send(data); - - return false; }); function showAlert(message) { - $('.page__comments-form .js-notice').removeClass('d-none'); - if (message == 'success') { - $('.page__comments-form .js-notice-text-success').removeClass('d-none'); - $('.page__comments-form .js-notice-text-failure').addClass('d-none'); + const notice = document.querySelector('.page__comments-form .js-notice'); + notice.classList.remove('d-none'); + if (message === 'success') { + document.querySelector('.page__comments-form .js-notice-text-success').classList.remove('d-none'); + document.querySelector('.page__comments-form .js-notice-text-failure').classList.add('d-none'); } else { - $('.page__comments-form .js-notice-text-success').addClass('d-none'); - $('.page__comments-form .js-notice-text-failure').removeClass('d-none'); + document.querySelector('.page__comments-form .js-notice-text-success').classList.add('d-none'); + document.querySelector('.page__comments-form .js-notice-text-failure').classList.remove('d-none'); } } -})(jQuery); +});