PageSourceSearch

https://automation.agency/wp-content/plugins/leadconnector/public/js/lc-public.js?ver=3.0.10.1

js automation.agency collected 2026-10-04 07:50:09 UTC 3,650 bytes, 115 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  window.addEventListener("load", function () {
32    function camelCaseToDash(myStr) {
33      return myStr.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
34    }
35
36    if (
37      !lc_public_js ||
38      !lc_public_js.text_widget_location_id ||
39      lc_public_js.text_widget_error == "1"
40    ) {
41      console.error(
42        "invalid API key or location ID, please provide correct API key and resave it under LeadConnector setting menu"
43      );
44      return;
45    }
46
47    var textWidget = document.createElement("chat-widget");
48    textWidget.setAttribute(
49      "location-id",
50      lc_public_js.text_widget_location_id
51    );
52    if (
53      !!lc_public_js.text_widget_settings &&
54      !!(lc_public_js.text_widget_settings instanceof Object)
55    ) {
56      var textWidgetSettings = lc_public_js.text_widget_settings;
57      var allAttrs = Object.keys(textWidgetSettings);
58      for (var attrIndex = allAttrs.length - 1; attrIndex >= 0; attrIndex--) {
59        try {
60          var attributeName = allAttrs[attrIndex];
61          attributeName = camelCaseToDash(attributeName);
62          var attributeValue = textWidgetSettings[allAttrs[attrIndex]];
63          if ("widget-primary-color" === attributeName) {
64            attributeName = "style";
65            attributeValue =
66              "--chat-widget-primary-color:" +
67              attributeValue +
68              "; --chat-widget-active-color:" +
69              attributeValue +
70              " ;--chat-widget-bubble-color: " +
71              attributeValue;
72          }
73        } catch (e) {
74          continue;
75        }
76
77        textWidget.setAttribute(attributeName, attributeValue);
78      }
79    } else {
80      if (!!lc_public_js.text_widget_heading) {
81        textWidget.setAttribute("heading", lc_public_js.text_widget_heading);
82      }
83      if (!!lc_public_js.text_widget_sub_heading) {
84        textWidget.setAttribute(
85          "sub-heading",
86          lc_public_js.text_widget_sub_heading
87        );
88      }
89      textWidget.setAttribute(
90        "use-email-field",
91        lc_public_js.text_widget_use_email_field == "1" ? "true" : "false"
92      );
93    }
94    
95    document.body.appendChild(textWidget);
96    if (!!lc_public_js.text_widget_cdn_base_url) {
97      setTimeout(() => {
98        if (!window.leadConnector || !window.leadConnector.chatWidget) {
99          try {
100            var moduleScript = document.createElement("script");
101            var cdnURL = lc_public_js.text_widget_cdn_base_url;
102            moduleScript.src = cdnURL + "loader.js";
103            moduleScript.setAttribute(
104              "data-cdn-url",
105              cdnURL.replace(/\/$/, "")
106            );
107            document.body.appendChild(moduleScript);
108          } catch (err) {
109            console.warn(err);
110          }
111        }
112      }, 10 * 1000);
113    }
114  });
115})();

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.