PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 4.5.3
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v4.5.3
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 / meetup-timezone.js
embedpress / assets / js Last commit date
chunks 1 month ago vendor 9 months ago admin.build.js 1 month ago admin.js 3 months ago analytics-tracker.js 9 months ago analytics.build.js 1 month ago blocks.build.js 1 month ago carousel.js 1 year ago custom-player.build.js 1 month ago documents-viewer-script.js 3 months ago ep-pdf-lightbox.js 3 months ago feature-notices.js 7 months ago front.js 3 months ago frontend.build.js 3 months ago gallery-justify.js 9 months ago gutneberg-script.js 2 months ago index.html 7 years ago initCarousel.js 2 years ago initplyr.js 2 months ago instafeed.js 1 month ago instagram-shortcode-generator.js 1 month ago lazy-load.js 6 months ago license.js 3 months ago meetup-timezone.js 3 months ago onboarding.build.js 1 month ago pdf-gallery-elementor-editor.js 3 months ago pdf-gallery.js 3 months ago preview.js 9 months ago settings.js 3 months ago sponsored.js 9 months ago
meetup-timezone.js
133 lines
1 /**
2 * EmbedPress Meetup Timezone Converter
3 *
4 * Converts UTC timestamps to visitor's local timezone for Meetup embeds
5 */
6 (function () {
7 'use strict';
8
9 /**
10 * Format date according to the specified format string
11 */
12 function formatDate(date, format) {
13 const months = ['January', 'February', 'March', 'April', 'May', 'June',
14 'July', 'August', 'September', 'October', 'November', 'December'];
15 const monthsShort = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
16 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
17 const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
18 const daysShort = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
19
20 const replacements = {
21 // Year
22 'Y': date.getFullYear(),
23 'y': String(date.getFullYear()).slice(-2),
24
25 // Month
26 'F': months[date.getMonth()],
27 'M': monthsShort[date.getMonth()],
28 'm': String(date.getMonth() + 1).padStart(2, '0'),
29 'n': date.getMonth() + 1,
30
31 // Day
32 'd': String(date.getDate()).padStart(2, '0'),
33 'j': date.getDate(),
34 'D': daysShort[date.getDay()],
35 'l': days[date.getDay()],
36
37 // Time
38 'H': String(date.getHours()).padStart(2, '0'),
39 'h': String(date.getHours() % 12 || 12).padStart(2, '0'),
40 'G': date.getHours(),
41 'g': date.getHours() % 12 || 12,
42 'i': String(date.getMinutes()).padStart(2, '0'),
43 's': String(date.getSeconds()).padStart(2, '0'),
44 'A': date.getHours() >= 12 ? 'PM' : 'AM',
45 'a': date.getHours() >= 12 ? 'pm' : 'am',
46 };
47
48 let formatted = format;
49
50 // Use a unique placeholder pattern that won't conflict with date format characters
51 // Using Unicode characters that are unlikely to appear in format strings
52 const placeholderPrefix = '\u{1F4C5}'; // Calendar emoji as unique marker
53 const placeholders = {};
54
55 // First pass: replace format characters with unique placeholders
56 for (const key in replacements) {
57 const placeholder = placeholderPrefix + key + placeholderPrefix;
58 placeholders[placeholder] = replacements[key];
59 formatted = formatted.split(key).join(placeholder);
60 }
61
62 // Second pass: replace placeholders with actual values
63 for (const placeholder in placeholders) {
64 formatted = formatted.split(placeholder).join(placeholders[placeholder]);
65 }
66
67 return formatted;
68 }
69
70 /**
71 * Format time according to the specified format string
72 */
73 function formatTime(date, format) {
74 return formatDate(date, format);
75 }
76
77 /**
78 * Convert UTC timestamps to visitor's local timezone
79 */
80 function convertTimezones() {
81 // Find all elements with visitor timezone data attribute
82 const elements = document.querySelectorAll('[data-visitor-timezone="true"]');
83
84 elements.forEach(function (element) {
85 const utcTimestamp = parseInt(element.getAttribute('data-utc-timestamp'), 10);
86
87 if (!utcTimestamp || isNaN(utcTimestamp)) {
88 return;
89 }
90
91 // Create date object from UTC timestamp
92 const date = new Date(utcTimestamp * 1000);
93
94 // Check if this is a date element or time element
95 const isDateElement = element.classList.contains('ep-event-date');
96 const isTimeElement = element.classList.contains('ep-event-end-time');
97
98 // Get timezone abbreviation
99 const timezoneAbbr = date.toLocaleTimeString('en-US', {
100 timeZoneName: 'short'
101 }).split(' ').pop();
102
103 if (isDateElement) {
104 // Format date and time
105 const dateFormat = element.getAttribute('data-date-format') || 'F j, Y';
106 const timeFormat = element.getAttribute('data-time-format') || 'g:i A';
107
108 // Combine date and time format
109 const formattedDate = formatDate(date, dateFormat);
110 const formattedTime = formatTime(date, timeFormat);
111
112 const newText = formattedDate + ', ' + formattedTime + ' ' + timezoneAbbr;
113 element.textContent = newText;
114 } else if (isTimeElement) {
115 // Format time only (for end time)
116 const timeFormat = element.getAttribute('data-time-format') || 'g:i A';
117 element.textContent = formatTime(date, timeFormat) + ' ' + timezoneAbbr;
118 }
119 });
120 }
121
122 // Convert on page load
123 if (document.readyState === 'loading') {
124 document.addEventListener('DOMContentLoaded', convertTimezones);
125 } else {
126 convertTimezones();
127 }
128
129 // Convert after AJAX load more
130 document.addEventListener('embedpress:meetup:loaded', convertTimezones);
131 })();
132
133