PageSourceSearch

https://spinalcordinjuryzone.com/wp-content/plugins/defend-wp-firewall/hooks/js/nonce.js?ver=1790281044

js spinalcordinjuryzone.com collected 2026-09-24 20:17:47 UTC 3,095 bytes, 95 lines download raw bytes

1(function ($) {
2  "use strict";
3
4  /**
5   * All of the code for your public-facing JavaScript source
6   * should reside in this file.
7   *
8   * Note: It has been assumed you will write jQuery code here, so the
9   * $ function reference has been prepared for usage within the scope
10   * of this function.
11   *
12   * This enables you to define handlers, for when the DOM is ready:
13   *
14   * $(function() {
15   *
16   * });
17   *
18   * When the window is loaded:
19   *
20   * $( window ).load(function() {
21   *
22   * });
23   *
24   * ...and/or other possibilities.
25   *
26   * Ideally, it is not considered best practise to attach more than a
27   * single DOM-ready or window-load handler for a particular page.
28   * Although scripts in the WordPress core, Plugins and Themes may be
29   * practising this, we should strive to set a better example in our own work.
30   */
31
32  $.ajaxPrefilter(function (settings, options, jqXHR) {
33    if (settings.type.toLowerCase() == "post") {
34      if (
35        typeof defend_wp_firewall_nonce_obj !== "undefined" &&
36        defend_wp_firewall_nonce_obj.defend_wp_firewall_nonce
37      ) {
38        var nonce = defend_wp_firewall_nonce_obj.defend_wp_firewall_nonce;
39        if (
40          typeof settings.data === "object" &&
41          settings.data instanceof FormData
42        ) {
43          settings.data.append("defend_wp_firewall_nonce", nonce);
44        } else if (typeof settings.data === "string") {
45          var isObject = false;
46          try {
47            var obj = JSON.parse(settings.data);
48            if (typeof obj === "object") {
49              isObject = true;
50            }
51          } catch (error) {
52            isObject = false;
53          }
54          if (isObject === false) {
55            var nonceParam = "&defend_wp_firewall_nonce=" + nonce;
56            settings.data += nonceParam;
57          }
58        } else if (typeof settings.data === "object") {
59          var additionalData = {
60            defend_wp_firewall_nonce: nonce,
61          };
62          settings.data = $.extend(settings.data, additionalData);
63        }
64      }
65    } else if (settings.type.toLowerCase() == "get") {
66      if (
67        typeof defend_wp_firewall_nonce_obj !== "undefined" &&
68        defend_wp_firewall_nonce_obj.defend_wp_firewall_nonce
69      ) {
70        var nonce = defend_wp_firewall_nonce_obj.defend_wp_firewall_nonce;
71        var separator = settings.url.includes("?") ? "&" : "?";
72        settings.url +=
73          separator + "defend_wp_firewall_nonce=" + encodeURIComponent(nonce);
74      }
75    }
76  });
77
78  $(window).load(function () {
79    if (
80      typeof defend_wp_firewall_nonce_obj !== "undefined" &&
81      defend_wp_firewall_nonce_obj.defend_wp_firewall_nonce
82    ) {
83      var nonce = defend_wp_firewall_nonce_obj.defend_wp_firewall_nonce;
84      $("form").each(function () {
85        if (!$(this).hasClass("defend_wp_firewall_nonce")) {
86          $(this).append(
87            '<input class="defend_wp_firewall_nonce" type="hidden" name="defend_wp_firewall_nonce" value="' +
88              nonce +
89              '">'
90          );
91        }
92      });
93    }
94  });
95})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.