From 47a1e07a0738f75f3e2a8c64f113156f671cf450 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sat, 14 Sep 2024 17:46:04 -0400 Subject: [PATCH] build(deps): bump bootstrap from 4.4.1 to 5.5.3 --- _includes/footer-scripts.html | 11 +-- _includes/nav.html | 98 ++++++++++++++------------- _includes/staticman-comments.html | 6 -- _layouts/base.html | 12 ++-- _layouts/minimal.html | 12 ++-- assets/css/beautifuljekyll.css | 6 +- assets/js/beautifuljekyll.js | 109 ++++++++++++++++-------------- assets/js/staticman.js | 46 +++++++------ 8 files changed, 148 insertions(+), 152 deletions(-) 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.css b/assets/css/beautifuljekyll.css index 5e2abcde9b57..4733d4a0018c 100644 --- a/assets/css/beautifuljekyll.css +++ b/assets/css/beautifuljekyll.css @@ -48,6 +48,9 @@ body { body > main { flex: 1; } +a { + text-decoration: none; /* no underline */ +} p { line-height: 1.5; margin: 1.875rem 0; @@ -95,6 +98,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 */ @@ -269,7 +273,7 @@ img { } } -.navbar-custom .nav-item.dropdown.show { +.navbar-custom .dropdown-toggle.show { background: rgba(0, 0, 0, 0.2); } diff --git a/assets/js/beautifuljekyll.js b/assets/js/beautifuljekyll.js index c871dd76b0cd..20923778821a 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 + ')'); + 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) { - $(".img-desc").text(desc).show(); + 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); +});