PageSourceSearch

https://asia.healy.shop/wp-content/themes/healy-shop/js/healy-sponsor.js?ver=59c69b417b59474d50b1f980cbc028fe

js healy.shop collected 2026-09-24 08:59:26 UTC 2,972 bytes, 115 lines download raw bytes

1jQuery( function( $ ) {
2	'use strict';
3
4	var sponsorHeaderEl = $('.sponsor-header');
5
6	if ( typeof woocommerce_params !== 'undefined' && sponsorHeaderEl.length) {
7		var wc_healy_sponsor = {
8			init: function() {
9				$.post( woocommerce_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'get_current_sponsor' ), function( response ) {
10					sponsorHeaderEl.html( response );
11				});
12			}
13		};
14
15		wc_healy_sponsor.init();
16	}
17
18	// Bind custom events for India popup integration (always available)
19	if (typeof healyAjaxObj !== 'undefined' && healyAjaxObj.ajaxurl) {
20		window.addEventListener('indiaPopupVerified', function(event) {
21			// Since we're keeping the original logic, trigger page reload to show popup
22			// The session variables are already set by the India verification
23			setTimeout(function() {
24				window.location.reload();
25			}, 100);
26		});
27	}
28
29	if(
30		typeof healyAjaxObj !== 'undefined' &&
31		healyAjaxObj.ajaxurl &&
32		$('.c-sponsor-popup').length
33	) {
34		/**
35		 * Sponsor popup
36		 * This module is showing a sponsor popup in case the user access the page with a affiliate link
37		 * and gives the user the option to decide whether to go with the sponsor or not
38		 *
39		 */
40		var healySponsorPopup = (function() {
41			var hiddenClass = 'is-hidden';
42			var noticeClass = 'has-notice';
43
44			var sponsorPopupEl = $('.c-sponsor-popup');
45			var btnEl = $('.js-sponsor-popup-btn', sponsorPopupEl);
46			var closeEl = $('.js-sponsor-popup-close', sponsorPopupEl);
47			var backEl = $('.js-sponsor-popup-back', sponsorPopupEl);
48
49			var sponsorName = '';
50
51
52			// initialization
53			_bindEventHandlers();
54
55
56			// implementation
57			function _bindEventHandlers() {
58				btnEl.on('click', _handlePopupClick);
59
60				closeEl.on('click', function() {
61					sponsorPopupEl.addClass(hiddenClass);
62
63					_updateSponsorSession({
64						resetSponsor: true,
65						resetPopupAppearing: true,
66					});
67				});
68
69				backEl.on('click', function() {
70					sponsorPopupEl.removeClass(noticeClass);
71				});
72			}
73
74			function _handlePopupClick(e) {
75				e.preventDefault();
76
77				var clickedBtnEl = $(e.currentTarget);
78				var clickedBtnAction = clickedBtnEl.data('action');
79
80				if(clickedBtnAction !== 'continue') {
81					_displayNoSponsorNotice();
82				} else {
83					_updateSponsorSession({
84						resetSponsor: false,
85						resetPopupAppearing: true,
86					});
87
88					sponsorPopupEl.addClass(hiddenClass);
89
90					$(document.body).trigger('sponsorSaved', {sponsorName: sponsorName})
91				}
92			}
93
94			function _updateSponsorSession(additionalData) {
95				$.ajax({
96					type: 'POST',
97					url: healyAjaxObj.ajaxurl,
98					data: {
99						action: 'update_sponsor_session',
100						resetSponsor: additionalData.resetSponsor,
101						resetPopupAppearing: additionalData.resetPopupAppearing,
102					},
103					error: function (XMLHttpRequest, textStatus, errorThrown) {
104						console.error(errorThrown);
105					}
106				});
107			}
108
109
110			function _displayNoSponsorNotice() {
111				sponsorPopupEl.addClass(noticeClass);
112			}
113		})();
114	}
115});

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.