From 65decc25b2d2fc8017b2c5759ff20edb75ea7c55 Mon Sep 17 00:00:00 2001
From: Julian Pustkuchen <Julian@Pustkuchen.com>
Date: Mon, 6 Apr 2020 16:20:39 +0200
Subject: [PATCH] Fixed IE / Edge bugs with ajaxStop.

---
 jquery_loadinganimation.js | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/jquery_loadinganimation.js b/jquery_loadinganimation.js
index 056864c..4c0561c 100644
--- a/jquery_loadinganimation.js
+++ b/jquery_loadinganimation.js
@@ -18,7 +18,6 @@
           .find("a[href]" + settings.subselector)
           .not('a[href*="javascript:"]')
           .not('a[href^="#"]')
-          .not('a[target="_blank"]')
           .not(".noLoadingAnimation")
           .each(
             function (i, element) {
@@ -42,9 +41,9 @@
       if (Drupal.settings.jquery_loadinganimation.show_on_form_submit) {
         // Only execute if no other js events are registered to prevent cases
         // where page is not being reloaded and layer does not close though.
-        $(context).find("form" + subselectorSuffix).not(".noLoadingAnimation").submit(function () {
+        $(context).find("form" + subselectorSuffix).submit(function () {
           Drupal.behaviors.jquery_loadinganimation.Loadinganimation.show();
-          $(context).ajaxStop(function () {
+          $(document).ajaxStop(function () {
             // Hide loading animation after ALL ajax events have finished
             Drupal.behaviors.jquery_loadinganimation.Loadinganimation.hide();
           });
@@ -56,12 +55,12 @@
         // Global context!
         if (Drupal.settings.jquery_loadinganimation.show_on_ajax) {
           // Register loading animations for ajax events!
-          $(context).ajaxStart(function () {
+          $(document).ajaxStart(function () {
             // Show loading animation on request.
             Drupal.behaviors.jquery_loadinganimation.Loadinganimation.show();
           });
 
-          $(context).ajaxStop(function () {
+          $(document).ajaxStop(function () {
             // Hide loading animation after finish.
             Drupal.behaviors.jquery_loadinganimation.Loadinganimation.hide();
           });
-- 
GitLab