PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 3.9.17
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v3.9.17
4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / assets / js / front.js
embedpress / assets / js Last commit date
vendor 7 years ago admin.js 2 years ago ads.js 2 years ago documents-viewer-script.js 3 years ago front.js 2 years ago gutneberg-script.js 2 years ago index.html 7 years ago initplyr.js 2 years ago license.js 2 years ago pdfobject.min.js 3 years ago plyr.polyfilled.js 3 years ago preview.js 3 years ago settings.js 6 years ago vimeo-player.js 2 years ago ytiframeapi.js 2 years ago
front.js
583 lines
1 /**
2 * @package EmbedPress
3 * @author EmbedPress <help@embedpress.com>
4 * @copyright Copyright (C) 2023 EmbedPress. All rights reserved.
5 * @license GPLv2 or later
6 * @since 1.7.0
7 */
8
9
10
11 let epGlobals = {};
12
13 (function ($) {
14 'use strict';
15 // function equivalent to jquery ready()
16 function ready(fn) {
17 if (document.readyState !== 'loading') {
18 fn();
19 } else {
20 document.addEventListener('DOMContentLoaded', fn);
21 }
22 }
23
24 ready(function () {
25 let option = {
26 forceObject: true,
27 };
28 let selector = document.querySelectorAll('.embedpress-embed-document-pdf');
29 if (selector.length) {
30 selector.forEach((function (value, index, thisArg) {
31 let id = value.dataset['emid'];
32 let src = value.dataset['emsrc'];
33 PDFObject.embed(src, "." + id, option);
34 }));
35 }
36 if (typeof epGlobals.youtubeChannelGallery === 'function') {
37 epGlobals.youtubeChannelGallery();
38 }
39 });
40
41 /**
42 *
43 * Make embeds responsive so they don't overflow their container.
44 */
45
46 /**
47 * Add max-width & max-height to <iframe> elements, depending on their width & height props.
48 *
49 *
50 * @return {void}
51 */
52 function embedPressResponsiveEmbeds() {
53 var proportion, parentWidth;
54
55 // Loop iframe elements.
56 document.querySelectorAll('iframe').forEach(function (iframe) {
57 // Only continue if the iframe has a width & height defined.
58 if (iframe.width && iframe.height) {
59 // Calculate the proportion/ratio based on the width & height.
60 proportion = parseFloat(iframe.width) / parseFloat(iframe.height);
61 // Get the parent element's width.
62 parentWidth = parseFloat(window.getComputedStyle(iframe.parentElement, null).width.replace('px', ''));
63 // Set the max-width & height.
64 iframe.style.maxWidth = '100%';
65 iframe.style.maxHeight = Math.round(parentWidth / proportion).toString() + 'px';
66 }
67 });
68 }
69
70 epGlobals.handlePosterImageLoad = function () {
71 var posterImages = document.querySelectorAll(".plyr__poster");
72 posterImages.forEach(function(posterImage) {
73 if (posterImage) {
74 var videoWrappers = document.querySelectorAll("[data-playerid]");
75 videoWrappers.forEach(function(videoWrapper) {
76 var observer = new MutationObserver(function (mutationsList, observer) {
77 var posterImageStyle = window.getComputedStyle(posterImage);
78 if (posterImageStyle.getPropertyValue('background-image') !== 'none') {
79 setTimeout(function () {
80 videoWrapper.style.opacity = "1";
81 }, 200);
82 observer.disconnect();
83 }
84 });
85
86 observer.observe(posterImage, { attributes: true, attributeFilter: ['style'] });
87 });
88 }
89 });
90 }
91
92
93
94 // Run on initial load.
95 embedPressResponsiveEmbeds();
96
97 // Run on resize.
98 window.onresize = embedPressResponsiveEmbeds;
99
100
101 function hasClass(ele, cls) {
102 return !!ele.className.match(new RegExp("(\\s|^)" + cls + "(\\s|$)"));
103 }
104
105 function addClass(ele, cls) {
106 if (!hasClass(ele, cls)) ele.className += " " + cls;
107 }
108
109 function removeClass(ele, cls) {
110 if (hasClass(ele, cls)) {
111 var reg = new RegExp("(\\s|^)" + cls + "(\\s|$)");
112 ele.className = ele.className.replace(reg, " ");
113 }
114 }
115 if (!Element.prototype.matches) {
116 Element.prototype.matches =
117 Element.prototype.matchesSelector ||
118 Element.prototype.webkitMatchesSelector ||
119 Element.prototype.mozMatchesSelector ||
120 Element.prototype.msMatchesSelector ||
121 Element.prototype.oMatchesSelector ||
122 function (s) {
123 var matches = (this.document || this.ownerDocument).querySelectorAll(s),
124 i = matches.length;
125 while (--i >= 0 && matches.item(i) !== this) { }
126 return i > -1;
127 };
128 }
129 var delegate = function (el, evt, sel, handler) {
130 el.addEventListener(evt, function (event) {
131 var t = event.target;
132 while (t && t !== this) {
133 if (t.matches(sel)) {
134 handler.call(t, event);
135 }
136 t = t.parentNode;
137 }
138 });
139 };
140
141 function sendRequest(url, postData, callback) {
142 var req = createXMLHTTPObject();
143 if (!req) return;
144 var method = postData ? "POST" : "GET";
145 req.open(method, url, true);
146 if (postData) {
147 req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
148 }
149 req.onreadystatechange = function () {
150 if (req.readyState != 4) return;
151 if (req.status != 200 && req.status != 304) {
152 return;
153 }
154 callback(req);
155 };
156 if (req.readyState == 4) return;
157 req.send(postData);
158 }
159
160 var XMLHttpFactories = [
161 function () {
162 return new XMLHttpRequest();
163 },
164 function () {
165 return new ActiveXObject("Msxml3.XMLHTTP");
166 },
167 function () {
168 return new ActiveXObject("Msxml2.XMLHTTP.6.0");
169 },
170 function () {
171 return new ActiveXObject("Msxml2.XMLHTTP.3.0");
172 },
173 function () {
174 return new ActiveXObject("Msxml2.XMLHTTP");
175 },
176 function () {
177 return new ActiveXObject("Microsoft.XMLHTTP");
178 },
179 ];
180
181 function createXMLHTTPObject() {
182 var xmlhttp = false;
183 for (var i = 0; i < XMLHttpFactories.length; i++) {
184 try {
185 xmlhttp = XMLHttpFactories[i]();
186 } catch (e) {
187 continue;
188 }
189 break;
190 }
191 return xmlhttp;
192 }
193
194 epGlobals.youtubeChannelGallery = function () {
195 var playerWraps = document.getElementsByClassName("ep-player-wrap");
196 if (playerWraps && playerWraps.length) {
197 for (var i = 0, im = playerWraps.length; im > i; i++) {
198 youtubeChannelEvents(playerWraps[i])
199 }
200 }
201 }
202
203 function youtubeChannelEvents(playerWrap) {
204
205 delegate(playerWrap, "click", ".item", function (event) {
206 var embed = "https://www.youtube.com/embed/";
207 var vid = this.getAttribute("data-vid");
208 var iframe = playerWrap.getElementsByTagName("iframe");
209 if (vid) {
210 if (iframe) {
211 var vidSrc = iframe[0].src.replace(/(.*\/embed\/)([^\?&"'>]+)(.+)?/, `\$1${vid}\$3`);
212 if (vidSrc.indexOf('autoplay') > 0) {
213 vidSrc = vidSrc.replace('autoplay=0', 'autoplay=1');
214 }
215 else {
216 vidSrc += '&autoplay=1';
217 }
218 iframe[0].src = vidSrc;
219 playerWrap.scrollIntoView();
220 }
221 }
222 });
223
224 var currentPage = 1;
225
226 let nearestEpContentId = playerWrap.querySelector('.ep-youtube__content__block').getAttribute('data-unique-id');
227
228 delegate(playerWrap, "click", ".ep-next, .ep-prev", function (event) {
229 const totalPages = event.target.closest('.ose-youtube').getAttribute('data-total-pages');
230 const closestClass = event.target.closest('.ose-youtube').classList;
231
232 const activePage = document.querySelector(`.${closestClass[1]} .embedpress-page-active`);
233 if (activePage) {
234 document.querySelector(`.${closestClass[1]} .embedpress-page-active`).classList.remove('embedpress-page-active');
235 }
236
237
238
239 var isNext = this.classList.contains("ep-next");
240
241 if (isNext) {
242 currentPage++;
243 } else {
244 currentPage--;
245 }
246
247 var data = {
248 action: "youtube_rest_api",
249 playlistid: this.getAttribute("data-playlistid"),
250 pagetoken: this.getAttribute("data-pagetoken"),
251 pagesize: this.getAttribute("data-pagesize"),
252 currentpage: currentPage
253 };
254
255 var formBody = [];
256 for (var property in data) {
257 var encodedKey = encodeURIComponent(property);
258 var encodedValue = encodeURIComponent(data[property]);
259 formBody.push(encodedKey + "=" + encodedValue);
260 }
261 formBody = formBody.join("&");
262
263 var galleryWrapper = playerWrap.getElementsByClassName(
264 "ep-youtube__content__block"
265 );
266
267 playerWrap.setAttribute('data-current-page', currentPage);
268
269
270 let x = 1;
271
272 sendRequest("/wp-admin/admin-ajax.php", formBody, function (request) {
273 if (galleryWrapper && galleryWrapper[0] && request.responseText) {
274 var response = JSON.parse(request.responseText);
275 galleryWrapper[0].outerHTML = response.html;
276
277 var currentPageNode =
278 galleryWrapper[0].getElementsByClassName("current-page");
279 if (currentPageNode && currentPageNode[0]) {
280 currentPageNode[0].textContent = currentPage;
281
282 }
283 }
284 });
285
286 const intervalID = setInterval(() => {
287 x++
288
289 if (playerWrap.querySelector('.ep-youtube__content__block')) {
290 const newNearestEpContentId = playerWrap
291 .querySelector('.ep-youtube__content__block')
292 .getAttribute('data-unique-id');
293
294 if (newNearestEpContentId !== nearestEpContentId && playerWrap.querySelector(`[data-page="${currentPage}"]`)) {
295 playerWrap.querySelector(`[data-page="${currentPage}"]`).classList.add('embedpress-page-active');
296 nearestEpContentId = newNearestEpContentId;
297 clearInterval(intervalID);
298 }
299 }
300
301 if (x > 100) {
302 clearInterval(intervalID);
303 }
304 }, 100);
305
306 });
307 }
308
309 //Load more for OpenaSea collection
310 const epLoadMore = () => {
311
312 $('.embedpress-gutenberg-wrapper .ep-nft-gallery-wrapper').each(function () {
313 let selctorEl = `[data-nftid='${$(this).data('nftid')}']`;
314
315 let loadmorelabel = $(selctorEl).data('loadmorelabel');
316 let iconcolor = $(selctorEl + " .nft-loadmore").data('iconcolor');
317
318 let spinicon = `<svg width="18" height="18" fill="${iconcolor || '#fff'}" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><style>.spinner_GuJz{transform-origin:center;animation:spinner_STY6 1.5s linear infinite}@keyframes spinner_STY6{100%{transform:rotate(360deg)}}</style><g class="spinner_GuJz"><circle cx="3" cy="12" r="2"/><circle cx="21" cy="12" r="2"/><circle cx="12" cy="21" r="2"/><circle cx="12" cy="3" r="2"/><circle cx="5.64" cy="5.64" r="2"/><circle cx="18.36" cy="18.36" r="2"/><circle cx="5.64" cy="18.36" r="2"/><circle cx="18.36" cy="5.64" r="2"/></g></svg>`;
319
320 $(selctorEl + ` .ep_nft_item`).slice(0, $(selctorEl).data('itemparpage')).show();
321 $('.embedpress-gutenberg-wrapper .ep-nft-gallery-wrapper .ep-loadmore-wrapper button').css('display', 'flex');
322
323 $(selctorEl + " .nft-loadmore").click(function (e) {
324 //change the text of the button
325 $(this).html(loadmorelabel + spinicon);
326 //disable the button
327 $(this).prop("disabled", true);
328 //wait for 1 seconds
329 setTimeout(function () {
330 //change the text back
331 $(selctorEl + " .nft-loadmore").text(loadmorelabel);
332 //enable the button
333 $(selctorEl + " .nft-loadmore").prop("disabled", false);
334 $(selctorEl + " .ep_nft_item:hidden").slice(0, $(selctorEl).data('itemparpage')).fadeIn("slow");
335 if ($(selctorEl + " .ep_nft_item:hidden").length == 0) {
336 $(selctorEl + " .nft-loadmore").fadeOut("slow");
337 }
338 }, 500);
339 });
340 });
341 };
342
343 if ($('.embedpress-gutenberg-wrapper .ep-nft-gallery-wrapper').length > 0) {
344 epLoadMore();
345 }
346
347 // Content protection system function
348 const unlockSubmitHander = (perentSel, that) => {
349 var ep_client_id = jQuery(that).closest('form').find('input[name="ep_client_id"]').val();
350 var password = jQuery(`input[name="pass_${ep_client_id}"]`).val();
351 var post_id = jQuery(`input[name="post_id"]`).val();
352 const buttonText = jQuery(that).closest('.password-form-container').find('input[type="submit"]').val();
353 const unlokingText = jQuery(that).data('unlocking-text');
354
355
356 var data = {
357 'action': 'lock_content_form_handler',
358 'client_id': ep_client_id,
359 'password': password,
360 'post_id': post_id,
361 };
362
363 jQuery('#' + perentSel + '-' + ep_client_id + ' .password-form input[type="submit"]').val(unlokingText);
364
365 jQuery.post(eplocalize.ajaxurl, data, function (response) {
366 if (response.success) {
367 if (!response.embedHtml) {
368
369 jQuery('#' + perentSel + '-' + ep_client_id + ' .password-form input[type="submit"]').val(buttonText);
370 jQuery('#' + perentSel + '-' + ep_client_id + ' .password-form input[type="password"]').val('');
371 jQuery(that).closest('.password-form-container').find('.error-message').removeClass('hidden');
372 }
373 else {
374 jQuery('#' + perentSel + '-' + ep_client_id + ' .ep-embed-content-wraper').html(response.embedHtml);
375
376 if (jQuery('#' + perentSel + '-' + ep_client_id + ' .ose-youtube').length > 0) {
377 epGlobals.youtubeChannelGallery();
378 }
379
380 if ($('.embedpress-gutenberg-wrapper .ep-nft-gallery-wrapper').length > 0) {
381 epLoadMore();
382 }
383
384 // Custom player initialization when content protection enabled
385 document.querySelector('#' + perentSel + '-' + ep_client_id + ' .ep-embed-content-wraper').classList.remove('plyr-initialized');
386
387 initPlayer(document.querySelector('#' + perentSel + '-' + ep_client_id + ' .ep-embed-content-wraper'));
388
389 if (eplocalize.is_pro_plugin_active) {
390 const adIdEl = document.querySelector('#' + perentSel + '-' + ep_client_id + ' [data-ad-id]');
391 adInitialization(adIdEl, adIdEl.getAttribute('data-ad-index'));
392 }
393
394 }
395 } else {
396 jQuery('#password-error_' + ep_client_id).html(response.form);
397 jQuery('#password-error_' + ep_client_id).show();
398 }
399 }, 'json');
400 }
401
402 // unlockSubmitHander called for gutentberg
403 jQuery('.ep-gutenberg-content .password-form').submit(function (e) {
404 e.preventDefault(); // Prevent the default form submission
405 unlockSubmitHander('ep-gutenberg-content', this);
406 });
407
408 window.addEventListener('load', function (e) {
409 const urlParams = new URLSearchParams(window.location.search);
410 const hash = urlParams.get('hash');
411
412 // find the element with the matching id
413 const element = document.getElementById(hash);
414
415 if (element) {
416 element.scrollIntoView({ behavior: 'smooth' });
417 }
418
419 });
420
421
422 })(jQuery);
423
424
425 jQuery(window).on("elementor/frontend/init", function () {
426
427 var filterableGalleryHandler = function ($scope, $) {
428
429 // Get the Elementor unique selector for this widget
430 let classes = $scope[0].className;
431 let selectorEl = '.' + classes.split(' ').join('.');
432
433 const epElLoadMore = () => {
434
435 const spinicon = '<svg width="18" height="18" fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><style>.spinner_GuJz{transform-origin:center;animation:spinner_STY6 1.5s linear infinite}@keyframes spinner_STY6{100%{transform:rotate(360deg)}}</style><g class="spinner_GuJz"><circle cx="3" cy="12" r="2"/><circle cx="21" cy="12" r="2"/><circle cx="12" cy="21" r="2"/><circle cx="12" cy="3" r="2"/><circle cx="5.64" cy="5.64" r="2"/><circle cx="18.36" cy="18.36" r="2"/><circle cx="5.64" cy="18.36" r="2"/><circle cx="18.36" cy="5.64" r="2"/></g></svg>';
436
437 $('.elementor-widget-container .ep-nft-gallery-wrapper').each(function () {
438 let selctorEl = `.elementor-widget-container [data-nftid='${$(this).data('nftid')}']`;
439 let loadmorelabel = $(selctorEl).data('loadmorelabel');
440 $(selctorEl + ` .ep_nft_item`).slice(0, $(selctorEl).data('itemparpage')).show();
441 $('.elementor-widget-container .ep-nft-gallery-wrapper .ep-loadmore-wrapper button').css('display', 'flex');
442
443 $(selctorEl + " .nft-loadmore").click(function (e) {
444 //change the text of the button
445 $(this).html(loadmorelabel + spinicon);
446
447 //disable the button
448 $(this).prop("disabled", true);
449 //wait for 1 seconds
450 setTimeout(function () {
451 //change the text back
452 $(selctorEl + " .nft-loadmore").text(loadmorelabel);
453 //enable the button
454 $(selctorEl + " .nft-loadmore").prop("disabled", false);
455 $(selctorEl + " .ep_nft_item:hidden").slice(0, $(selctorEl).data('itemparpage')).fadeIn("slow");
456 if ($(selctorEl + " .ep_nft_item:hidden").length == 0) {
457 $(selctorEl + " .nft-loadmore").fadeOut("slow");
458 }
459 }, 500);
460 });
461 });
462 };
463
464 if ($('.elementor-widget-container .ep-nft-gallery-wrapper').length > 0) {
465 epElLoadMore();
466 }
467
468 // Content protection system function
469 const unlockElSubmitHander = (perentSel, that) => {
470 var ep_client_id = jQuery(that).closest('form').find('input[name="ep_client_id"]').val();
471 var password = jQuery(`input[name="pass_${ep_client_id}"]`).val();
472 var post_id = jQuery(`input[name="post_id"]`).val();
473 const buttonText = jQuery(that).closest('.password-form-container').find('input[type="submit"]').val();
474 const unlokingText = jQuery(that).data('unlocking-text');
475
476 var data = {
477 'action': 'lock_content_form_handler',
478 'client_id': ep_client_id,
479 'password': password,
480 'post_id': post_id,
481 };
482
483 jQuery('#' + perentSel + '-' + ep_client_id + ' .password-form input[type="submit"]').val(unlokingText);
484
485 jQuery.post(eplocalize.ajaxurl, data, function (response) {
486 if (response.success) {
487 if (!response.embedHtml) {
488 jQuery('#' + perentSel + '-' + ep_client_id + ' .password-form input[type="submit"]').val(buttonText);
489 jQuery('#' + perentSel + '-' + ep_client_id + ' .password-form input[type="password"]').val('');
490 jQuery(that).closest('.password-form-container').find('.error-message').removeClass('hidden');
491 }
492 else {
493 if ($('.ep-content-locked').has('#' + perentSel + '-' + ep_client_id).length) {
494 $('.ep-content-locked').removeClass('ep-content-locked');
495 }
496
497 jQuery('#' + perentSel + '-' + ep_client_id + ' .ep-embed-content-wraper').html(response.embedHtml);
498
499 $('#' + perentSel + '-' + ep_client_id).removeClass('ep-content-protection-enabled');
500
501 if (jQuery('#' + perentSel + '-' + ep_client_id + ' .ose-youtube').length > 0) {
502 epGlobals.youtubeChannelGallery();
503 }
504
505 if ($('.elementor-widget-container .ep-nft-gallery-wrapper').length > 0) {
506 epElLoadMore();
507 }
508 }
509 } else {
510 jQuery('#password-error_' + ep_client_id).html(response.form);
511 jQuery('#password-error_' + ep_client_id).show();
512 }
513 }, 'json');
514 }
515
516 // unlockElSubmitHander called for Elementor
517 jQuery('.ep-elementor-content .password-form').submit(function (e) {
518 e.preventDefault(); // Prevent the default form submission
519 unlockElSubmitHander('ep-elementor-content', this);
520 });
521 };
522
523 const adsHandler = function ($scope, $) {
524 window.epAdIndex = typeof (window.epAdIndex) === 'undefined' ? 0 : window.epAdIndex + 1;
525 console.log(window.epAdIndex);
526 let classes = $scope[0].className;
527 let classJoint = '.' + classes.split(' ').join('.');
528 const selectorEl = document.querySelector(classJoint + ' [data-ad-id]');
529
530
531 console.log(classJoint);
532 if (jQuery('body').hasClass('elementor-editor-active') && eplocalize.is_pro_plugin_active) {
533 adInitialization(selectorEl, window.epAdIndex);
534 }
535
536 }
537
538 elementorFrontend.hooks.addAction("frontend/element_ready/embedpres_elementor.default", filterableGalleryHandler);
539 elementorFrontend.hooks.addAction("frontend/element_ready/embedpress_pdf.default", filterableGalleryHandler);
540 elementorFrontend.hooks.addAction("frontend/element_ready/embedpres_document.default", filterableGalleryHandler);
541 elementorFrontend.hooks.addAction("frontend/element_ready/embedpres_elementor.default", adsHandler);
542 elementorFrontend.hooks.addAction("frontend/element_ready/embedpres_elementor.default", epGlobals.handlePosterImageLoad);
543 });
544
545
546 // document.addEventListener('DOMContentLoaded', function () {
547 // testHellowWorld();
548 // });
549
550 // testHellowWorld();
551
552
553
554 function presentationModeForIOS(iframes) {
555 iframes?.forEach(function (iframe) {
556 iframe.onload = function () {
557 var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
558 var button = iframeDoc?.querySelector('#presentationMode');
559 button?.addEventListener('click', function () {
560 iframe.classList.toggle('presentationModeEnabledIosDevice');
561 });
562 iframeDoc?.addEventListener('keydown', function (event) {
563 if (event.keyCode === 27) {
564 iframe.classList.remove('presentationModeEnabledIosDevice');
565 }
566 });
567 };
568 });
569 }
570
571 function isIOSDevice() {
572 return /iPhone|iPad|iPod/i.test(navigator.userAgent);
573 }
574
575 if (isIOSDevice()) {
576 var iframes = document.querySelectorAll('.embedpress-embed-document-pdf');
577 presentationModeForIOS(iframes)
578 }
579
580
581
582 document.addEventListener("DOMContentLoaded", epGlobals.handlePosterImageLoad);
583