Starting from today we run all logins through the Shivering-Isles Authentication System (SI-Auth)!

Commit bcfbe1a4 authored by Sheogorath's avatar Sheogorath 🌪

Remove jquery dependency from main.js

In order reduce the amount of downloaded JS over all pages, this patch
removed jquery from the main.js.
parent fc63eb7f
Pipeline #302 failed with stages
in 7 minutes and 39 seconds
......@@ -4,6 +4,8 @@ sitemap:
exclude: 'yes'
---
{% include jquery3.3.1.min.js %}
$(document).ready(function () {
// Setup button animation for blog slider
$('a.blog-button').click(function (e) {
......
......@@ -3,26 +3,48 @@ layout: null
sitemap:
exclude: 'yes'
---
{% include jquery3.3.1.min.js %}
$(document).ready(function () {
document.addEventListener("DOMContentLoaded", function() {
// Replace elements for JS-less design to full-JS usage
$('a.blog-button').attr('href', '{{ site.baseurl }}/#blog')
$('.noscript').each(function() {
this.outerHTML = this.innerHTML
document.querySelectorAll('a.blog-button').forEach(function(element) {
element.setAttribute('href', '{{ site.baseurl }}/#blog')
})
document.querySelectorAll('.noscript').forEach(function(element) {
element.outerHTML = element.innerHTML
})
if ($('.pagination a.newer').attr('href') === '{{ site.baseurl }}/page1/') {
$('.pagination a.newer').attr('href', '{{ site.baseurl }}/#blog')
document.querySelectorAll('.pagination a.newer').forEach(function(element) {
if (element.getAttribute("href") === '{{ site.baseurl }}/page1/') {
element.setAttribute('href', '{{ site.baseurl }}/#blog')
}
})
function toggleClass(element, classes) {
classes.split(" ").forEach(function(cssClass) {
element.classList.toggle(cssClass)
})
}
// Make mobile navigation usable
$('.btn-mobile-menu').click(function () {
$('.navigation-wrapper').toggleClass('visible animated bounceInDown')
$('.btn-mobile-menu__icon').toggleClass('fa-bars fa-times-circle-o animated fadeIn')
document.querySelectorAll('.btn-mobile-menu').forEach(function(item) {
item.addEventListener('click', function () {
document.querySelectorAll('.navigation-wrapper').forEach(function(selected) {
toggleClass(selected, 'visible animated bounceInDown')
})
document.querySelectorAll('.btn-mobile-menu__icon').forEach(function(selected) {
toggleClass(selected, 'fa-bars fa-times-circle-o animated fadeIn')
})
})
})
$('.navigation-wrapper .blog-button').click(function () {
$('.navigation-wrapper').toggleClass('visible')
$('.btn-mobile-menu__icon').toggleClass('fa-bars fa-times-circle-o animated fadeIn')
document.querySelectorAll('.navigation-wrapper .blog-button').forEach(function(item) {
item.addEventListener('click', function () {
document.querySelectorAll('.navigation-wrapper').forEach(function(selected) {
toggleClass(selected, 'visible')
})
document.querySelectorAll('.btn-mobile-menu__icon').forEach(function(selected) {
toggleClass(selected, 'fa-bars fa-times-circle-o animated fadeIn')
})
})
})
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment