2021年5月2日星期日

Why this part of javascript code is executed?

From my index.php file , when this line is executed :

<script src="javascript/GlobalQuran.js"></script>  

then , GlobalQuran.js file is loaded . When that js file is loaded then all the time the output shows me

"Oopss!!!, Something went wrong. please refresh your browser or try again."  

I think this error message is produce from the below code which is the part of GlobalQuran.js file . Also I think , something wrong with $.ajaxSetup

$.ajaxSetup({      error: function() {          layout.message("error", "Oopss!!!, Something went wrong. please refresh your browser or try again.");          gq._gaqPush(["_trackEvent", "Error", "Oopss!!!, Something went wrong."])      }  });  

Can anyone please tell me why this portion of js code is executed ? I am pretty new in javascript

some part of GlobalQuran.js file code :

.  .  .  notCachedQuranID ? ($jsonp = $.support.cors ? "" : ".jsonp?callback=?", $.ajaxSetup({              cache: !0,              jsonpCallback: "quranData"          }), $.getJSON(c + $jsonp, function(a) {              gq._loadResponse(a, firstLoad)          })) : (gq.layout.display(!0),              gq.player.load("play"));          return !1      },      _loadResponse: function(a, b) {          if ("object" == typeof a) gq.data = $.extend(!0, gq.data, a), gq.data.loaded = !0;          if (gq.search.isActive() && (gq.search.init(), gq.search.loading(!1), 0 < gq.search.totalRows()))              for (var c in a.search.quran) {                  gq.search._positionStartVerse = c;                  break              }          if (a.languageSelected) gq.settings.selectedLanguage = a.languageSelected;          b ? (gq.player.init(), !gq.quran.length() && "object" == typeof a && a.quran && ($.each(a.quran, function(a) {              gq.quran.add(a)          }), this.url.save()), gq.layout.displayStartup("object" ==              typeof a)) : (gq.layout.display("object" == typeof a), gq.player.load("play"))      },      url: {          load: function() {              var a = window.location.hash,                  a = a.split("/"),                  b = a.length;              if (2 < b && "search" == a["1"]) {                  if (gq.search.keyword() == a["2"] && 0 == gq.search.position()) return !1;                  gq.search._keyword = a["2"];                  gq.search._position = 0;                  return !0              }              if (2 < b && gq.settings.page != a["2"]) return gq.quran.reset(), selectedBy = a["1"].split("|"), $.each(selectedBy, function(a, b) {                  gq.quran.add(b)              }), verse = a["2"].split(":"), 1 < verse.length ? (gq.settings.surah = Quran._fixSurahNum(parseInt(verse["0"])),                  gq.settings.ayah = Quran._fixAyahNum(gq.settings.surah, parseInt(verse["1"]))) : (verse = Quran.ayah.fromPage(a["2"]), gq.settings.surah = verse.surah, gq.settings.ayah = verse.ayah), gq.player.reset(), !0;              return /^[0-9]+:?[0-9]*$/.test(a["1"]) ? (verse = a["1"].split(":"), 1 < verse.length ? (gq.settings.surah = Quran._fixSurahNum(parseInt(verse["0"])), gq.settings.ayah = Quran._fixAyahNum(gq.settings.surah, parseInt(verse["1"]))) : (verse = Quran.ayah.fromPage(a["1"]), gq.settings.surah = verse.surah, gq.settings.ayah = verse.ayah), gq.player.reset(),                  !0) : !1          },          save: function() {              window.location.hash = "#!" + this.page()          },          hashless: function() {              var a = window.location.href,                  b = a.indexOf(window.location.hash) || a.length;              return a.substr(0, b)          },          page: function(a) {              if (gq.search.isActive()) return "/search/" + gq.search.keyword();              url = "/";              (by = gq.quran.selectedString()) && (url += by + "/");              return url += a || gq.settings.page          },          ayah: function(a, b) {              if (gq.search.isActive()) return "/" + gq.settings.surah + ":" + gq.settings.ayah;              url = "/";              (by = gq.quran.selectedString()) && (url += by + "/");              return url = a ? url +                  (gq.settings.surah + ":" + gq.settings.ayah) : url + (a + ":" + b)          }      },      _cookieRead: function() {          for (var a = "", b = document.cookie.split(";"), c = 0; c < b.length; c++) {              for (var d = b[c];                  " " == d.charAt(0);) d = d.substring(1, d.length);              0 == d.indexOf("settings=") && (a = d.substring(9, d.length))          }          a = $.parseJSON(a);          $.extend(!0, this.settings, a);          this.quran.init();          this.recitor.init()      },      _cookieSave: function(a) {          var b = "undefined" == typeof a,              c = "",              a = b ? this.settings : a;          if (!b && null == a) return "{}";          $.each(a, function(a, b) {              c = "object" == typeof b || "array" == typeof b ?                  c + ('"' + a + '":' + gq._cookieSave(b) + ",") : "string" != typeof b ? c + ('"' + a + '":' + b + ",") : c + ('"' + a + '":"' + b + '",')          });          c = c.slice(0, -1);          c = "{" + c + "}";          if (b) a = new Date, a.setTime(a.getTime() + 31536E6), a = "; expires=" + a.toGMTString(), document.cookie = "settings=" + c + a + "; path=/";          return c      },      googleAnalytics: function() {          var a = document.createElement("script");          a.type = "text/javascript";          a.async = !0;          a.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";          var b = document.getElementsByTagName("script")[0];          b.parentNode.insertBefore(a, b);          "undefined" == typeof _gaq && (_gaq = []);          window._gaq = _gaq || [];          this.googleAnalyticsID && _gaq.push(["b._setAccount", this.googleAnalyticsID]);          _gaq.push(["_setAccount", this._gaID]);          this._gaqPush(["_setSessionCookieTimeout", 36E7]);          this._gaqPush(["_trackPageview"])      },      _gaqPush: function(a) {          _gaq.push(a);          this.googleAnalyticsID && (a[0] = "b." + a[0], _gaq.push(a))      }  };  .  .  .  jQuery.fn.extend({      scrollTo: function(a, b, c) {          b = b || 0;          return this.each(function() {              var d = $(this).offset().top + b;              $("html,body").animate({                  scrollTop: d              }, a, c)          })      }  });  $.ajaxSetup({      error: function() {          layout.message("error", "Oopss!!!, Something went wrong. please refresh your browser or try again.");          gq._gaqPush(["_trackEvent", "Error", "Oopss!!!, Something went wrong."])      }  });  
https://stackoverflow.com/questions/67362880/why-this-part-of-javascript-code-is-executed May 03, 2021 at 10:36AM

没有评论:

发表评论