PluginProbe
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder / 51.1.82
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder v51.1.82
51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 51.1.45 51.1.46 51.1.47 51.1.49 All 37 releases
king-addons / includes / widgets / Compare_Table / script.js

script.js in King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder 51.1.82, at includes/widgets/Compare_Table/script.js

58 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 "use strict";
2
3 (function ($) {
4 const rowsAreEqual = ($row) => {
5 const $cells = $row.find("td");
6 if ($cells.length < 2) {
7 return true;
8 }
9 const first = $($cells.get(0)).text().trim();
10 for (let i = 1; i < $cells.length; i += 1) {
11 if ($($cells.get(i)).text().trim() !== first) {
12 return false;
13 }
14 }
15 return true;
16 };
17
18 const applyDifferenceFilter = ($wrapper) => {
19 const hideEqual = $wrapper.data("hide-equal") === "yes";
20 if (!hideEqual) {
21 return;
22 }
23 const $rows = $wrapper.find(".king-addons-compare-table__body .king-addons-compare-table__row");
24 $rows.each(function () {
25 const $row = $(this);
26 if (rowsAreEqual($row)) {
27 $row.addClass("is-equal-hidden");
28 } else {
29 $row.addClass("is-different");
30 }
31 });
32 };
33
34 const initCompareTable = ($scope) => {
35 const $wrapper = $scope.find(".king-addons-compare-table");
36 if (!$wrapper.length) {
37 return;
38 }
39 applyDifferenceFilter($wrapper);
40 };
41
42 $(window).on("elementor/frontend/init", function () {
43 elementorFrontend.hooks.addAction(
44 "frontend/element_ready/king-addons-compare-table.default",
45 function ($scope) {
46 initCompareTable($scope);
47 }
48 );
49 });
50 })(jQuery);
51
52
53
54
55
56
57
58