PageSourceSearch

https://planable.io/wp-content/themes/Wptiff/_assets/js/wptiff-components.js?ver=1790142598

js planable.io collected 2026-09-24 17:09:24 UTC 7,001 bytes, 233 lines download raw bytes

1/* * 9. Self Switching Accordions */
2
3jQuery(document).ready(function () {
4if (jQuery(window).width() > 1024) {
5    function isInView($element) {
6        var elementTop = $element.offset().top;
7        var elementBottom = elementTop + $element.outerHeight();
8        var viewportTop = jQuery(window).scrollTop();
9        var viewportBottom = viewportTop + jQuery(window).height();
10        return elementBottom > viewportTop && elementTop < viewportBottom;
11    }
12
13    var intervalIds = {};
14
15    function toggleDescription($item) {
16        var $description = $item.find(".accordion-content");
17        var isOpen = $item.hasClass("open");
18
19        if (isOpen) {
20            $description.stop(true, true).slideDown(300); 
21        } else {
22            $description.stop(true, true).slideUp(300); 
23        }
24    }
25
26    function updateImage($item) {
27        var imageSource = $item.find(".image-source img").attr("src");
28        var $imageContainer = $item
29            .closest(".self-switching-tabs-section")
30            .find(".right-column-image-container .image-container img");
31
32        if (imageSource) {
33            $imageContainer.addClass("fade-out"); 
34
35            setTimeout(function () {
36                $imageContainer.attr("src", imageSource);
37                $imageContainer.removeClass("fade-out"); 
38            }, 500); 
39        }
40    }
41
42    function startInterval($section) {
43        var $accordion = $section.find(".custom-accordion");
44        var $items = $accordion.find(".accordion-item");
45
46
47        var sectionIndex = $section.index();
48        if (intervalIds[sectionIndex]) {
49            clearInterval(intervalIds[sectionIndex]);
50        }
51
52        intervalIds[sectionIndex] = setInterval(function () {
53            var $currentItem = $items.filter(".open");
54            var currentIndex = $items.index($currentItem);
55            var nextIndex = (currentIndex + 1) % $items.length; 
56
57            var $nextItem = $items.eq(nextIndex);
58
59            $currentItem.removeClass("open").addClass("closed");
60            toggleDescription($currentItem); 
61
62
63            $nextItem.removeClass("closed").addClass("open");
64            toggleDescription($nextItem); 
65            updateImage($nextItem); 
66        }, 5000); 
67    }
68
69    jQuery(window).on("scroll load", function () {
70        jQuery(".self-switching-tabs-section").each(function () {
71            var $section = jQuery(this);
72
73
74            if (isInView($section) && !intervalIds[$section.index()]) {
75                var $accordion = $section.find(".custom-accordion");
76                var $items = $accordion.find(".accordion-item");
77
78				if(jQuery('body.page-id-977394').length || jQuery('body.page-id-949057').length || jQuery('body.page-id-982946').length) {
79					 var $defaultItem = $items.eq(5);
80				} else {
81					 var $defaultItem = $items.eq(2);
82				}
83               
84                var $defaultTitle = $defaultItem.find(".accordion-title");
85
86                $defaultTitle.trigger("click").on("focus", function (e) {
87                    e.preventDefault();
88                });
89
90                $items.removeClass("open closed");
91                $defaultItem.addClass("open");
92                toggleDescription($defaultItem);
93                updateImage($defaultItem);
94
95                startInterval($section);
96            }
97        });
98    });
99
100    jQuery(document).on("click", ".self-switching-tabs-section .accordion-title", function () {
101        var $clickedItem = jQuery(this).closest(".accordion-item");
102        var $section = $clickedItem.closest(".self-switching-tabs-section");
103
104        var sectionIndex = $section.index();
105        if (intervalIds[sectionIndex]) {
106            clearInterval(intervalIds[sectionIndex]);
107            delete intervalIds[sectionIndex];
108        }
109
110        $clickedItem
111            .siblings(".accordion-item")
112            .removeClass("open")
113            .addClass("closed")
114            .find(".accordion-content")
115            .stop(true, true).slideUp(300);
116
117        $clickedItem.removeClass("closed").addClass("open");
118        toggleDescription($clickedItem);
119        updateImage($clickedItem);
120    });
121}
122
123
124	
125});
126/* END 9. Self Switching Accordions */
127jQuery(function() {
128	handleModals();
129})
130
131/* Planable modals */
132function handleModals() {
133	const modalSelector = ".plnb-modal";
134	const modalContentsSelector = ".et_pb_row";
135	const modalOpenerAttr = "data-plnb-modal";
136	const teleportDestination = "#page-container";
137	const activeClass = "active";
138	
139	if (jQuery(modalSelector).length === 0) {
140		return
141	}
142	jQuery(modalSelector).each(function() {
143		// teleport the modal
144		jQuery(teleportDestination).append(this);
145		
146		// close the modal when clicking outside its contents
147		jQuery(this).on('click', function(e) {
148			const dimensions = jQuery(this).find(modalContentsSelector).get(0).getBoundingClientRect();
149			if (
150				e.clientX < dimensions.left ||
151				e.clientX > dimensions.right ||
152				e.clientY < dimensions.top ||
153				e.clientY > dimensions.bottom
154			  ) {
155				jQuery(this).removeClass(activeClass)
156			  }
157		})
158		
159		// add the close modal button and its functionality
160		const modalButtonClose = jQuery(`<button class="plnb-modal-close"></button>`);
161		jQuery(this).find(modalContentsSelector).append(modalButtonClose);
162		modalButtonClose.on('click', () => jQuery(this).removeClass(activeClass));
163	})
164	
165	// open the modals
166	jQuery(`[${modalOpenerAttr}]`).each(function() {
167		const modalToOpen = "#" + jQuery(this).attr(modalOpenerAttr);
168		if (jQuery(modalToOpen).length === 0) {
169			return
170		}
171		jQuery(this).on('click', function(e) {
172			e.preventDefault();
173			jQuery(modalToOpen).addClass(activeClass);
174		})
175	})
176	
177}
178/* End Planable modals */
179
180
181
182
183/* 11. New tab sections */
184jQuery(function ($) {
185  function loadLottie($player) {
186    const player = $player[0];
187    const src = $player.data('src');
188
189    if (!player || !src) return;
190
191    if (!$player.data('loaded')) {
192      player.load(src);
193      $player.data('loaded', true);
194    }
195
196    player.play();
197  }
198
199  function stopOtherLotties($tabs, activePanel) {
200    $tabs.find('.plnb-tabs-panel').not(activePanel).find('.tab-lottie-player').each(function () {
201      if (typeof this.stop === 'function') {
202        this.stop();
203      }
204    });
205  }
206
207  $('.new-plnb-tabs').each(function () {
208    const $tabs = $(this);
209
210    const $initialPanel = $tabs.find('.plnb-tabs-panel-active');
211    loadLottie($initialPanel.find('.tab-lottie-player'));
212
213    $tabs.find('.plnb-tabs-btn').on('click', function () {
214      const target = $(this).data('tab');
215
216      $tabs.find('.plnb-tabs-btn').removeClass('plnb-tabs-btn-active');
217      $(this).addClass('plnb-tabs-btn-active');
218
219      $tabs.find('.plnb-tabs-panel').removeClass('plnb-tabs-panel-active');
220
221      const $activePanel = $tabs.find('.plnb-tabs-panel[data-panel="' + target + '"]');
222
223      $activePanel.addClass('plnb-tabs-panel-active');
224
225      stopOtherLotties($tabs, $activePanel);
226      loadLottie($activePanel.find('.tab-lottie-player'));
227    });
228  });
229});
230/* 11. END New tab sections */
231
232
233

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.