PageSourceSearch

https://s.24.hu/app/plugins/central-eb2020-popup//assets/js/eb2020-popup.js?ver=1790073590

js 24.hu collected 2026-09-24 08:37:09 UTC 4,542 bytes, 166 lines download raw bytes

1/**
2 * Eb2020Popup
3 */
4var Eb2020Popup = new function () {
5	var self = this;
6
7	// Configuration
8	this.data = typeof window.ebFloatingWidgetData === 'object' ? window.ebFloatingWidgetData : null;
9	this.cssId = {
10		parent: 'content',
11		box: 'eb2020-popup-widget',
12	};
13	this.cookieName = {
14		closed: 'eb2020-popup-closed',
15		notInterested: 'eb2020-popup-not-interested',
16	};
17	this.allowedPages = ['home', 'single'];
18
19	/**
20	 * Initialization.
21	 */
22	this.init = function () {
23		// Do not show.
24		if (!this.data
25			|| window.getCookie(this.cookieName.notInterested) !== ''
26			|| !this.allowedPage()
27			|| this.keepClosedAsHidden()) {
28			return;
29		}
30
31		this.show();
32	};
33
34	/**
35	 * Check if allowed page.
36	 *
37	 * @return {boolean}
38	 */
39	this.allowedPage = function () {
40		let response = false;
41
42		jQuery.each(this.allowedPages, function (index, cssClass) {
43			if (jQuery('body').hasClass(cssClass)) {
44				response = true;
45				return;
46			}
47		});
48
49		return response;
50	};
51
52	/**
53	 * Keep closed widget as hidden.
54	 *
55	 * @return {boolean}
56	 */
57	this.keepClosedAsHidden = function () {
58		let closedCookieValue = getCookie(this.cookieName.closed);
59
60		if (closedCookieValue === '') {
61			return false;
62		}
63
64		let currentCookieValue = this.getCookieValue();
65
66		if (closedCookieValue === currentCookieValue) {
67			return true;
68		} else {
69			return false;
70		}
71	};
72
73	/**
74	 * Show the widget.
75	 */
76	this.show = function () {
77		let iconLive = '<span class="m-centralEb2020Popup__iconLive">Élő</span>';
78		let html = '<div id="' + this.cssId.box + '" class="m-centralEb2020Popup -hide _ce_measure_widget" data-ce-measure-widget="EB2020 felúszó cikkajánló">' + "\n" +
79			'<div class="m-centralEb2020Popup__mainWrap container">' + "\n" +
80			'<div class="m-centralEb2020Popup__btnRow">' + "\n" +
81			'<a class="m-centralEb2020Popup__btn -notInterested" onclick="Eb2020Popup.notInterested();" href="#"><i class="fas fa-ban"></i> Nem érdekel a Foci VB</a>' + "\n" +
82			'<a class="m-centralEb2020Popup__btn -close" onclick="Eb2020Popup.close();" href="#"><i class="fas fa-times"></i> Bezárom</a>' + "\n" +
83			'</div>' + "\n" +
84			'<div class="m-centralEb2020Popup__logo"><a href="https://focivb2022.24.hu"></a></div>' + "\n" +
85			'<div class="m-centralEb2020Popup__cntWrap">' + "\n" +
86			'<div class="m-centralEb2020Popup__cntLeftWrap">' + "\n" +
87			'<div class="m-centralEb2020Popup__post -first">' +
88			'<div class="m-centralEb2020Popup__postThumb" style="background-image: url(' + this.data.featured_image_1 + ');"><a href="' + this.data.url_1 + '"></a></div>' +
89			'<div class="m-centralEb2020Popup__postCntWrap">' + "\n" +
90			'<div class="m-centralEb2020Popup__postTitle"><a href="' + this.data.url_1 + '">';
91
92		if (this.data.post_format_1 === 'status') {
93			html += iconLive;
94		}
95
96		html += this.data.title_1 + '</a></div>' +
97			'<div class="m-centralEb2020Popup__postLead">' + this.data.lead_1 + '</div>' + "\n" +
98			'</div>' + "\n" +
99			'</div>' + "\n" +
100			'</div>' + "\n" +
101			'<div class="m-centralEb2020Popup__cntRightWrap">' + "\n" +
102			'<div class="m-centralEb2020Popup__post -second">' +
103			'<div class="m-centralEb2020Popup__postTitle"><a href="' + this.data.url_2 + '">';
104
105		if (this.data.post_format_2 === 'status') {
106			html += iconLive;
107		}
108
109		html += this.data.title_2 + '</a></div>' +
110			'</div>' +
111			'<div class="m-centralEb2020Popup__post">' +
112			'<div class="m-centralEb2020Popup__postTitle"><a href="' + this.data.url_3 + '">';
113
114		if (this.data.post_format_3 === 'status') {
115			html += iconLive;
116		}
117
118		html += this.data.title_3 + '</a></div>' +
119			'</div>' +
120			'</div>' + "\n" +
121			'</div>' + "\n" +
122			'</div>' + "\n" +
123			'</div>' + "\n";
124
125		jQuery('#' + this.cssId.parent).append(html);
126		jQuery('#' + this.cssId.box).removeClass('-hide');
127	}
128
129	/**
130	 * Get cookie value.
131	 *
132	 * @returns {string}
133	 */
134	this.getCookieValue = function () {
135		let fields = ['url_1', 'url_2', 'url_3'];
136		let value = '';
137
138		jQuery.each(fields, function (index, field) {
139			if (self.data[field] !== 'undefined') {
140				value += self.data[field];
141			}
142		});
143
144		return value;
145	};
146
147	/**
148	 * Close the widget.
149	 */
150	this.close = function () {
151		deleteCookie(this.cookieName.notInterested);
152		setCookie(this.cookieName.closed, this.getCookieValue(), 60);
153		jQuery('#' + this.cssId.box).addClass('-hide');
154	};
155
156	/**
157	 * Close, because not interested.
158	 */
159	this.notInterested = function () {
160		deleteCookie(this.cookieName.closed);
161		setCookie(this.cookieName.notInterested, '1', 60);
162		jQuery('#' + this.cssId.box).addClass('-hide');
163	};
164};
165
166Eb2020Popup.init();

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.