From dcd3f0839099818e75567e3bed903c02d02941af Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson Date: Wed, 25 Jan 2023 16:49:03 +0100 Subject: [PATCH] Remove obsolete jquery versions of theme js. --- assets/js/jq_versions/contact.js | 61 -------------------------------- assets/js/jq_versions/mobile.js | 27 -------------- assets/js/jq_versions/script.js | 13 ------- assets/js/lozadinit.js | 1 - 4 files changed, 102 deletions(-) delete mode 100644 assets/js/jq_versions/contact.js delete mode 100644 assets/js/jq_versions/mobile.js delete mode 100644 assets/js/jq_versions/script.js diff --git a/assets/js/jq_versions/contact.js b/assets/js/jq_versions/contact.js deleted file mode 100644 index b243ace..0000000 --- a/assets/js/jq_versions/contact.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @file - * A JavaScript file for the contact form. - */ - -(function ($) { - - 'use strict'; - - // Contact form. - $('.contact-form').each(function () { - var $contact_form = $(this); - var $contact_button = $contact_form.find('.form-submit'); - var contact_action = '/php/contact.php'; - - // Display the hidden form. - $contact_form.removeClass('hidden'); - - // Wait for a mouse to move, indicating they are human. - $('body').mousemove(function () { - // Unlock the form. - $contact_form.attr('action', contact_action); - $contact_button.attr('disabled', false); - }); - - // Wait for a touch move event, indicating that they are human. - $('body').on('touchmove', function () { - // Unlock the form. - $contact_form.attr('action', contact_action); - $contact_button.attr('disabled', false); - }); - - // A tab or enter key pressed can also indicate they are human. - $('body').keydown(function (e) { - if ((e.keyCode === 9) || (e.keyCode === 13)) { - // Unlock the form. - $contact_form.attr('action', contact_action); - $contact_button.attr('disabled', false); - } - }); - - // Mark the form as submitted. - $contact_button.click(function () { - $contact_form.addClass('js-submitted'); - }); - - // Display messages. - if (location.search.substring(1) !== '') { - switch (location.search.substring(1)) { - case 'submitted': - $('.contact-submitted').removeClass('hidden'); - break; - - case 'error': - $('.contact-error').removeClass('hidden'); - break; - } - } - }); - -})(jQuery); diff --git a/assets/js/jq_versions/mobile.js b/assets/js/jq_versions/mobile.js deleted file mode 100644 index 774b50c..0000000 --- a/assets/js/jq_versions/mobile.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @file - * A JavaScript file for the mobile menu. - */ - -(function ($) { - - 'use strict'; - - // Activate the mobil menu for small screens. - if (window.matchMedia && $('.mobile-nav').length) { - var mq = window.matchMedia('(max-width: 999px)'); - if (mq.matches) { - // Toggle the mobile nav sheet. - $('.mobile-nav__cover, .mobile-nav__toggle').click(function (e) { - e.preventDefault(); - $('body').scrollTop(0).toggleClass('js-nav-open'); - }); - - // Close the nav sheet after click (needed for anchor links). - $('.mobile-nav__sheet').find('a').click(function () { - $('body').removeClass('js-nav-open'); - }); - } - } - -})(jQuery); diff --git a/assets/js/jq_versions/script.js b/assets/js/jq_versions/script.js deleted file mode 100644 index 1a4aec7..0000000 --- a/assets/js/jq_versions/script.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @file - * A JavaScript file for the theme. - */ - -(function ($) { - - 'use strict'; - - // Add a js class to the html-tag when JavsScript is active. - $('html').removeClass('nojs').addClass('js'); - -})(jQuery); diff --git a/assets/js/lozadinit.js b/assets/js/lozadinit.js index d8c97ea..725d61d 100644 --- a/assets/js/lozadinit.js +++ b/assets/js/lozadinit.js @@ -6,5 +6,4 @@ const observer = window.lozad(); observer.observe(); - })();