PageSourceSearch

https://adeleadamsassociates.co.uk/wp-content/plugins/make-plus/js/panels/frontend.js?ver=1.9.16

js adeleadamsassociates.co.uk collected 2026-10-08 00:00:16 UTC 4,000 bytes, 145 lines download raw bytes

1/*!
2 * Front end script for the Panels section.
3 */
4
5/* global jQuery, MakeFrontEnd, MakePlusPanels */
6
7(function($, MakeFrontEnd, MakePlusPanels){
8
9	if ( ! MakeFrontEnd || ! MakePlusPanels ) { return; }
10
11	var MakePlus = $.extend(MakeFrontEnd, MakePlusPanels);
12
13	MakePlus = $.extend(MakePlus, {
14		/**
15		 * Add elements to the cache for later use.
16		 *
17		 * @since 1.6.0.
18		 */
19		panelsCache: function() {
20			this.cache.$document    = $(document);
21			this.cache.$accordion   = $('.ttfmp-accordion-container');
22			this.cache.$tabs        = $('.ttfmp-tabs-container');
23			this.cache.isCustomizer = $(parent.document).find('body').hasClass('wp-customizer');
24		},
25
26		/**
27		 * Initialize the Panels functionality.
28		 *
29		 * @since 1.6.0.
30		 */
31		panelsInit: function() {
32			var self = this;
33
34			self.cache.$document.ready(function() {
35				self.panelsCache();
36				if (self.cache.$accordion.length > 0) {
37					self.accordionInit(self.cache.$accordion);
38				}
39				if (self.cache.$tabs.length > 0 && false == self.cache.isCustomizer) {
40					self.tabsInit(self.cache.$tabs);
41				}
42				// Add the Tabs placeholder if this is in the Customizer
43				if (true == self.cache.isCustomizer) {
44					self.tabsPlaceholderInit(self.cache.$tabs);
45				}
46			});
47		},
48
49		/**
50		 * Initialize Panels sections in Accordion mode.
51		 *
52		 * @since 1.6.0.
53		 *
54		 * @param $el    jQuery collection of Accordion containers.
55		 */
56		accordionInit: function($el) {
57			if (! $.fn.accordion) {
58				return;
59			}
60
61			var self = this;
62
63			var startCollapsed = ( this.cache.$accordion.attr('data-start-collapsed') === 'true' ) ? true : false;
64
65			$el.each(function() {
66				var $this = $(this);
67
68				var	arg = {
69					animate: 200,
70					icons: false,
71					active: startCollapsed,
72					collapsible: startCollapsed,
73					// Scroll to top of panel when it opens, if it is above the viewport.
74					// @link http://www.stampede-design.com/blog/2013/04/improving-navigation-on-large-accordion-content-panels/
75					activate: function(event, ui) {
76						var h = ui.newHeader,
77							ws = $(window).scrollTop();
78						if (! $.isEmptyObject(h.offset()) && h.offset().top < ws) {
79							$('html:not(:animated), body:not(:animated)').animate({
80								scrollTop: h.offset().top - h.height()
81							}, 'slow');
82						}
83					}
84				};
85
86				var data = $this.data();
87
88				$.extend(true, arg, data);
89
90				$this.accordion(arg);
91			});
92		},
93
94		/**
95		 * Initialize Panels sections in Tabs mode.
96		 *
97		 * @since 1.6.0.
98		 *
99		 * @param $el    jQuery collection of Tabs containers.
100		 */
101		tabsInit: function($el) {
102			if (! $.fn.tabs) {
103				return;
104			}
105
106			$el.each(function() {
107				var $this = $(this),
108					arg = $el.data();
109				$this.tabs(arg);
110			});
111		},
112
113		/**
114		 * Set up a non-functional Tabs placeholder that can still be styled in the Customizer.
115		 *
116		 * As of May 2015, the preview pane in the Customizer is not compatible with the jQuery UI Tabs widget.
117		 * @link https://core.trac.wordpress.org/ticket/23225
118		 *
119		 * @since 1.6.0.
120		 *
121		 * @param $el    jQuery collection of Tabs containers.
122		 */
123		tabsPlaceholderInit: function($el) {
124			if ('undefined' == typeof MakePlus.tabsPlaceholder) {
125				return;
126			}
127
128			$el.each(function() {
129				var $this = $(this),
130					$tabs = $this.find('.ttfmp-panels-item-titles'),
131					$content = $this.find('.ttfmp-panels-item-content'),
132					$placeholder = $('<div>').addClass('ttfmp-panels-item-content ui-tabs-panel ui-widget-content ui-corner-bottom').html(MakePlus.tabsPlaceholder);
133				$this.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all');
134				$tabs.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all')
135					.find('li').addClass('ui-state-default ui-corner-top')
136					.find('a').addClass('ui-tabs-anchor').click(function() { return false; });
137				$tabs.find('li').first().addClass('ui-tabs-active ui-state-active');
138				$content.hide();
139				$this.append($placeholder);
140			});
141		}
142	});
143
144	MakePlus.panelsInit();
145}(jQuery, MakeFrontEnd, MakePlusPanels));

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.