PageSourceSearch

https://uni-obuda.hu/wp-content/plugins/the-events-calendar/src/resources/js/views/ical-links.js?ver=6.0.1.1

js uni-obuda.hu collected 2026-09-24 08:50:33 UTC 3,620 bytes, 148 lines download raw bytes

1/**
2 * Makes sure we have all the required levels on the Tribe Object
3 *
4 * @since 5.12.0
5 *
6 * @type   {PlainObject}
7 */
8 tribe.events = tribe.events || {};
9 tribe.events.views = tribe.events.views || {};
10
11 /**
12  * Configures Views Object in the Global Tribe variable
13  *
14  * @since 5.12.0
15  *
16  * @type   {PlainObject}
17  */
18 tribe.events.views.icalLinks = {};
19
20 /**
21  * Initializes in a Strict env the code that manages the Event Views
22  *
23  * @since 5.12.0
24  *
25  * @param  {PlainObject} $   jQuery
26  * @param  {PlainObject} obj tribe.events.views.icalLinks
27  *
28  * @return {void}
29  */
30 ( function( $, obj ) {
31	'use strict';
32
33	/**
34	 * Selectors used for configuration and setup
35	 *
36	 * @since 5.12.0
37	 *
38	 * @type {PlainObject}
39	 */
40	obj.selectors = {
41		icalLinks: '.tribe-events-c-subscribe-dropdown',
42		icalLinksButton: '.tribe-events-c-subscribe-dropdown__button',
43		icalLinksButtonActiveClass: 'tribe-events-c-subscribe-dropdown__button--active',
44		icalLinksListContainer: 'tribe-events-c-subscribe-dropdown__content',
45	};
46
47	/**
48	 * Toggles active class on view selector button
49	 *
50	 * @since 5.12.0
51	 *
52	 * @param {Event} event event object for click event
53	 *
54	 * @return {void}
55	 */
56	obj.handleIcalLinksButtonClick = function( event ) {
57		$( event.target ).toggleClass( obj.selectors.icalLinksButtonActiveClass );
58	};
59
60	/**
61	 * Binds events for container
62	 *
63	 * @since 5.12.0
64	 *
65	 * @param  {jQuery} $container jQuery object of view container
66	 *
67	 * @return {void}
68	 */
69	obj.bindEvents = function( $container ) { // eslint-disable-line no-unused-vars
70		$( document ).on(
71			'click focus focus-within',
72			obj.selectors.icalLinksButton,
73			obj.handleIcalLinksButtonClick
74		);
75	};
76	/**
77	 * Unbinds events for container
78	 *
79	 * @since  4.9.7
80	 *
81	 * @param  {jQuery}  $container jQuery object of view container
82	 *
83	 * @return {void}
84	 */
85	obj.unbindEvents = function( $container ) {
86		$container
87			.find( obj.selectors.icalLinksButton )
88			.off( 'click', obj.handleIcalLinksButtonClick );
89	};
90
91	/**
92	 * Deinitialize ical links JS
93	 *
94	 * @since 5.12.0
95	 *
96	 * @param  {Event}       event    event object for 'beforeAjaxSuccess.tribeEvents' event
97	 * @param  {jqXHR}       jqXHR    Request object
98	 * @param  {PlainObject} settings Settings that this request was made with
99	 *
100	 * @return {void}
101	 */
102	obj.deinit = function( event, jqXHR, settings ) { // eslint-disable-line no-unused-vars
103		var $container = event.data.container;
104		obj.unbindEvents( $container );
105		$container.off( 'beforeAjaxSuccess.tribeEvents', obj.deinit );
106	};
107
108	/**
109	 * Initialize view selector JS
110	 *
111	 * @since 5.12.0
112	 *
113	 * @param  {Event}   event      event object for 'afterSetup.tribeEvents' event
114	 * @param  {integer} index      jQuery.each index param from 'afterSetup.tribeEvents' event
115	 * @param  {jQuery}  $container jQuery object of links container
116	 * @param  {object}  data       data object passed from 'afterSetup.tribeEvents' event
117	 *
118	 * @return {void}
119	 */
120	obj.init = function( event, index, $container, data ) { // eslint-disable-line no-unused-vars
121		var $icalLinks = $container.find( obj.selectors.icalLinks );
122
123		if ( ! $icalLinks.length ) {
124			return;
125		}
126
127		obj.bindEvents( $container );
128		$container.on( 'beforeAjaxSuccess.tribeEvents', { container: $container }, obj.deinit );
129	};
130
131	/**
132	 * Handles the initialization of the view selector when Document is ready
133	 *
134	 * @since 5.12.0
135	 *
136	 * @return {void}
137	 */
138	obj.ready = function() {
139		$( document ).on(
140			'afterSetup.tribeEvents',
141			obj.init
142		);
143	};
144
145	// Configure on document ready
146	$( obj.ready );
147
148} )( jQuery, tribe.events.views.icalLinks );

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.