PageSourceSearch

https://maximwesele.pl/wp-content/plugins/rometheme-for-elementor/…/Elements/assets/js/accordion.js?ver=2.0.8

js maximwesele.pl collected 2026-09-24 08:27:23 UTC 5,148 bytes, 175 lines download raw bytes

1jQuery(window).on("elementor/frontend/init", function () {
2  const elementor = window.elementor;
3  elementorFrontend.hooks.addAction(
4    "frontend/element_ready/rkit-accordion.default",
5    function ($scope, $) {
6      const DURATION = 100;
7      const EASING = "swing";
8
9      const $items = $scope.find(".rkit-accordion-item");
10
11      $items.each(function () {
12        const $item = jQuery(this);
13        let $content = $item.find(".rkit-accordion-content");
14
15        if ($content.children(".rkit-accordion-content-inner").length === 0) {
16          $content.wrapInner(
17            '<div class="rkit-accordion-content-inner"></div>',
18          );
19        }
20
21        $content.css({
22          overflow: "hidden",
23        });
24
25        const $inner = $content.find(".rkit-accordion-content-inner");
26
27        if ($item.hasClass("open")) {
28          $content.css("height", $inner[0].scrollHeight + "px");
29          window.setTimeout(function () {
30            $content.css("height", "auto");
31          }, 20);
32        } else {
33          $content.css("height", "0px");
34        }
35      });
36
37      $scope.find(".rkit-accordion-header").on("click", function (e) {
38        e.preventDefault();
39        const $header = jQuery(this);
40        const $item = $header.closest(".rkit-accordion-item");
41        const $content = $item.find(".rkit-accordion-content");
42        const $inner = $content.find(".rkit-accordion-content-inner");
43
44        const $openItem = $items.filter(".open").not($item);
45        const $openContent = $openItem.find(".rkit-accordion-content");
46        const $openInner = $openContent.find(".rkit-accordion-content-inner");
47
48        const targetOpenHeight = $openInner.length
49          ? $openInner[0].scrollHeight
50          : 0;
51        const targetThisHeight = $inner.length ? $inner[0].scrollHeight : 0;
52
53        $openContent.stop(true, true);
54        $content.stop(true, true);
55
56        if ($item.hasClass("open")) {
57          $content.css("height", $content.height() + "px");
58          $content[0].offsetHeight;
59          $content.animate({ height: 0 }, DURATION, EASING, function () {
60            $item.removeClass("open");
61            $content.css("height", "0px");
62          });
63        } else {
64          $content.css("height", $content.height() + "px");
65          $content[0].offsetHeight;
66
67          if ($openItem.length) {
68            $openContent.css("height", $openContent.height() + "px");
69            $openContent[0].offsetHeight;
70          }
71
72          if ($openItem.length) {
73            $openContent.animate({ height: 0 }, DURATION, EASING, function () {
74              $openItem.removeClass("open");
75              $openContent.css("height", "0px");
76            });
77          }
78
79          $content.animate(
80            { height: targetThisHeight },
81            DURATION,
82            EASING,
83            function () {
84              $item.addClass("open");
85              $content.css("height", "auto");
86            },
87          );
88        }
89      });
90
91      jQuery(document).on(
92        "click",
93        ".accordion-edit-template-btn",
94        function (e) {
95          e.preventDefault();
96
97          const targetUrl =
98            jQuery(this).attr("href") || jQuery(this).data("href");
99          if (!targetUrl) return console.warn("No target URL found.");
100
101          window.parent.postMessage(
102            {
103              action: "open-saved-template-editor",
104              url: targetUrl,
105            },
106            "*",
107          );
108        },
109      );
110    },
111  );
112
113  elementorFrontend.hooks.addAction(
114    "panel/open_editor/widget",
115    function (panel, model, view) {
116      const settings = model.get("settings");
117      const showHeading = settings.get("show_subheading");
118      hideRepeaterField(showHeading);
119
120      const showIconHeading = settings.get("show_heading_icons");
121      hideRepeaterIconField(showIconHeading);
122    },
123  );
124
125  if (!window.elementor || !elementor.channels || !elementor.channels.editor) {
126    // console.warn("Elementor editor not ready");
127    return;
128  }
129
130  elementor.channels.editor.on("change", function (panel, model) {
131    const currentWidget = elementor
132      .getPanelView()
133      .getCurrentPageView()
134      .getOption("editedElementView");
135    if (
136      !currentWidget ||
137      currentWidget.model.get("widgetType") !== "rkit-accordion"
138    )
139      return;
140
141    const showHeading = currentWidget.model
142      .get("settings")
143      .get("show_subheading");
144    hideRepeaterField(showHeading);
145
146    const showIconHeading = currentWidget.model
147      .get("settings")
148      .get("show_heading_icons");
149    hideRepeaterIconField(showIconHeading);
150  });
151
152  function hideRepeaterField(showHeading) {
153    const repeaterFields = parent.jQuery(
154      ".elementor-control-accordion_sub_title",
155    );
156
157    if (showHeading === "yes") {
158      repeaterFields.show();
159    } else {
160      repeaterFields.hide();
161    }
162  }
163
164  function hideRepeaterIconField(showIconHeading) {
165    const repeaterFields = parent.jQuery(
166      ".elementor-control-accordion_header_icon",
167    );
168
169    if (showIconHeading === "yes") {
170      repeaterFields.show();
171    } else {
172      repeaterFields.hide();
173    }
174  }
175});

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.