1jQuery( function( $ ) { 2 $( document ).ready( function() { 3 $('.thumbnail').on('click', function () { 4 var clicked = $(this); 5 var newSelection = clicked.data('image_url'); 6 //var $img = $('.primary').css("background-image", "url(" + newSelection + ")"); 7 var $img = $('.primary').attr('src', "" + newSelection + ""); 8 clicked.parent().find('.thumbnail').removeClass('selected'); 9 clicked.addClass('selected'); 10 $('.primary').empty().append($img.hide().fadeIn('slow')); 11 }); 12 13 /*-- Theme Color Global--*/ 14 // set dominent color for nice theme 15 16 $(".emagic").prepend("<a>"); 17 var epColorRgbValue = $('.emagic, #primary.content-area .entry-content, .entry-content .emagic').find('a').css('color'); 18 19 /*-- Theme Color Global--*/ 20 var epColorRgb = epColorRgbValue; 21 var avoid = "rgb"; 22 if( epColorRgb ) { 23 var eprgbRemover = epColorRgb.replace(avoid, ''); 24 var emColor = eprgbRemover.substring(eprgbRemover.indexOf('(') + 1, eprgbRemover.indexOf(')')); 25 $(':root').css('--themeColor', emColor ); 26 } 27 28 let ep_font_size = eventprime_obj.global_settings.ep_frontend_font_size; 29 if( !ep_font_size ) { 30 ep_font_size = 14; 31 } 32 $(':root').css('--themefontsize', ep_font_size + 'px' ); 33 34 //Adding class on body in case EP content 35 if ($('.emagic').length) { 36 $('html').addClass('ep-embed-responsive'); 37 } 38 39 //Adding class incase event list right col is small 40 var epEventListwidth = $(".ep-box-list-right-col").width(); 41 42 if(epEventListwidth < 210){ 43 $(".ep-box-list-right-col .ep-event-list-view-action").addClass("ep-column-small"); 44 } 45 46 // set dark mode 47 if( eventprime_obj.global_settings.enable_dark_mode == 1 ) { 48 $( 'body' ).addClass( 'ep-dark-mode-enabled' ); 49 } 50 51 }); 52 53 $(function() { 54 //----- OPEN 55 $('[ep-modal-open]').on('click', function(e) { 56 var targeted_popup_class = jQuery(this).attr('ep-modal-open'); 57 $('[ep-modal="' + targeted_popup_class + '"]').fadeIn(100); 58 $('body').addClass('ep-modal-open-body'); 59 e.preventDefault(); 60 }); 61 62 //----- CLOSE 63 $('[ep-modal-close]').on('click', function(e) { 64 var targeted_popup_class = jQuery(this).attr('ep-modal-close'); 65 $('[ep-modal="' + targeted_popup_class + '"]').fadeOut(200); 66 $('body').removeClass('ep-modal-open-body'); 67 e.preventDefault(); 68 }); 69 }); 70 71 // add event to wishlist 72 $( document ).on( 'click', '.ep_event_wishlist_action', function() { 73 if( $( '.ep-event-loader' ).length > 0 ) { 74 $( '.ep-event-loader' ).show(); 75 } 76 let event_id = $( this ).data( 'event_id' ); 77 var remove_row_id = $( this ).attr( 'data-remove_row' ); 78 if( event_id ) { 79 let data = { 80 action : 'ep_event_wishlist_action', 81 security : eventprime_obj.event_wishlist_nonce, 82 event_id : event_id 83 }; 84 $.ajax({
85 type : "POST", 86 url : eventprime_obj.ajaxurl, 87 data : data, 88 success : function( response ) { 89 if( $( '.ep-event-loader' ).length > 0 ) { 90 $( '.ep-event-loader' ).hide(); 91 } 92 if( response.success == true ) { 93 show_toast( 'success', response.data.message ); 94 // add, remove color 95 if( response.data.action == 'add' ) { 96 $( '#ep_event_wishlist_action_' + event_id + ' .ep-handle-fav' ).text( 'favorite' ); 97 $( '#ep_event_wishlist_action_' + event_id + ' .ep-handle-fav' ).addClass( 'ep-text-danger' ); 98 } else{ 99 $( '#ep_event_wishlist_action_' + event_id + ' .ep-handle-fav' ).text( 'favorite_border' ); 100 $( '#ep_event_wishlist_action_' + event_id + ' .ep-handle-fav' ).removeClass( 'ep-text-danger' ); 101 } 102 $( '#ep_event_wishlist_action_' + event_id ).attr( 'title', response.data.title ); 103 104 // remove block of user profile 105 if( remove_row_id ) { 106 $( '#' + remove_row_id ).remove(); 107 } 108 // update count 109 if( $( '#ep_wishlist_event_count' ).length > 0 ) { 110 let eve_count = $( '#ep_wishlist_event_count' ).text(); 111 --eve_count; 112 $( '#ep_wishlist_event_count' ).text( eve_count ); 113 } 114 } else{ 115 show_toast( 'error', response.data.error ); 116 } 117 } 118 }); 119 } 120 }); 121 122 // ical export 123 $( document ).on( 'click', '#ep_event_ical_export', function(event) { 124 event.preventDefault(); // Prevents the link from navigating 125 let event_id = $( this ).attr( 'data-event_id' ); 126 //console.log(event_id); 127 if( event_id ) { 128 if( window.location.search ) { 129 window.location = window.location.href + '&event='+event_id+'&download=ical'; 130 } else{ 131 window.location = window.location.href + '?event='+event_id+'&download=ical'; 132 } 133 } 134 }); 135 136 // image scaling 137 $( document ).on( 'mouseover', '.ep-upcoming-box-card-item', function() { 138 $( this ).addClass( 'ep-shadow' ); 139 $( this ).find( '.ep-upcoming-box-card-thumb img' ).css( 'transform', 'scale(1.1,1.1)' ); 140 }); 141 142 $( document ).on( 'mouseout', '.ep-upcoming-box-card-item', function() { 143 $( this ).removeClass( 'ep-shadow' ); 144 $( this ).find( '.ep-upcoming-box-card-thumb img' ).css("transform", "scale(1,1)"); 145 }); 146 147 // Tabmenu 148 $( document ).on( 'click', '.ep-tab-item a', function(){ 149 $( '.ep-tab-item a' ).removeClass( 'ep-tab-active' ); 150 $(this).addClass('ep-tab-active'); 151 var tagid = $(this).data('tag'); 152 $( '.ep-tab-content' ).removeClass( 'active' ).addClass( 'ep-item-hide' ); 153 $( '#'+tagid ).addClass( 'active' ).removeClass( 'ep-item-hide' ); 154 }); 155 // Tabmenu End 156 157 //Sub Tab Menu 158 // Tabmenu 159 $( document ).on( 'click', '.ep-profile-events-tabs a', function(){ 160 $( '.ep-profile-events-tabs a' ).removeClass( 'ep-tab-active' ); 161 $(this).addClass('ep-tab-active'); 162 var tagid = $(this).data('tag'); 163 $( '.ep-profile-event-tabs-content' ).addClass( 'ep-item-hide' ); 164 $( '#'+tagid).removeClass( 'ep-item-hide' ); 165 }); 166 167 // Tab click handler 168 $(document).on('click', '.ep-global-tab-link', function () { 169 var $tabWrapper = $(this).closest('.ep-global-tab-wrapper'); 170 171 // Remove active class from all tabs in this wrapper 172 $tabWrapper.find('.ep-global-tab-link').removeClass('ep-global-tab-active'); 173 $(this).addClass('ep-global-tab-active'); 174 175 // Get the target class name from data-tag 176 var tagClass = $(this).data('tag'); 177 178 // Hide all tab contents in this wrapper 179 $tabWrapper.find('.ep-global-tab-content').addClass('ep-item-hide'); 180 181 // Show the targeted content in this wrapper 182 $tabWrapper.find('.' + tagClass).removeClass('ep-item-hide'); 183 });
184 185 function ep_init_global_tabs($root) { 186 var $ctx = ($root && $root.length) ? $root : $(document); 187 188 $ctx.find('.ep-global-tab-wrapper').each(function () { 189 var $tabWrapper = $(this); 190 var $firstTab = $tabWrapper.find('.ep-global-tab-item .ep-global-tab-link').first(); 191 var firstTagClass = $firstTab.data('tag'); 192 193 if ($firstTab.length) { 194 $tabWrapper.find('.ep-global-tab-link').removeClass('ep-global-tab-active'); 195 $firstTab.addClass('ep-global-tab-active'); 196 197 $tabWrapper.find('.ep-global-tab-content').addClass('ep-item-hide'); 198 $tabWrapper.find('.' + firstTagClass).removeClass('ep-item-hide'); 199 } 200 }); 201 } 202 203 // Activate first tab on page load. 204 ep_init_global_tabs($(document)); 205 206 // Re-init tabs when single event content is reloaded (recurring date switch). 207 $(document).on('ajaxSuccess.epGlobalTabs', function (event, xhr, settings) { 208 if (!settings || !settings.data) { 209 return; 210 } 211 212 var data = settings.data; 213 var isSingleEventReload = false; 214 215 if (typeof data === 'string') { 216 isSingleEventReload = (data.indexOf('action=ep_load_event_single_page') !== -1); 217 } else if (typeof data === 'object' && data.action) { 218 isSingleEventReload = (data.action === 'ep_load_event_single_page'); 219 } 220 221 if (!isSingleEventReload) { 222 return; 223 } 224 225 ep_init_global_tabs($('#ep_single_event_detail_page_content')); 226 }); 227 228 // Tabmenu End 229 230}); 231 232/** 233 * Format price with currency position. 234 * @param {int|float} price 235 * @param {string} currency 236 * @returns Formatted Price. 237 */ 238function ep_format_price_with_position( price, currency = null ) { 239 price = parseFloat( price ).toFixed( 2 ); 240 if( !currency ) { 241 currency = eventprime_obj.currency_symbol; 242 } 243 position = eventprime_obj.global_settings.currency_position; 244 if( position == 'before' ) { 245 price = currency + price; 246 } else if( position == 'before_space' ) { 247 price = currency + ' ' + price; 248 } else if( position == 'after' ) { 249 price = price + currency; 250 } else if( position == 'after_space' ) { 251 price = price + ' ' + currency; 252 } 253 return price; 254} 255 256/** 257 * Return the translation of errors 258 * 259 * @param {string} key 260 */ 261function get_translation_string( key ) { 262 let transObj = eventprime_obj.trans_obj; 263 if ( transObj.hasOwnProperty( key ) ) { 264 return eventprime_obj.trans_obj[key]; 265 } 266} 267 268/** 269 * Validate the website url 270 * 271 * @param {string} url Website URL 272 * 273 * @return {bool} URL is valid or invalid 274 */ 275function is_valid_url_old( url ) { 276 var urlPattern = new RegExp('^(https?:\\/\\/)?' + // validate protocol 277 '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // validate domain name 278 '((\\d{1,3}\\.){3}\\d{1,3}))' + // validate OR ip (v4) address 279 '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // validate port and path 280 '(\\?[;&a-z\\d%_.~+=-]*)?' + // validate query string 281 '(\\#[-a-z\\d_]*)?$', 'i'); // validate fragment locator 282 return !!urlPattern.test( url ); 283} 284 285function is_valid_url( url ) { 286 if (typeof url !== 'string') return false; 287 var v = url.trim(); 288 if (!v) return false; 289 290 // Accept URLs without protocol (like your old regex): add http:// to parse 291 var hasProtocol = /^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(v); 292 var candidate = hasProtocol ? v : 'http://' + v; 293 294 try { 295 var u = new URL(candidate); 296 297 // If protocol was provided, only accept http/https (old regex did http/https only) 298 if (hasProtocol && u.protocol !== 'http:' && u.protocol !== 'https:') return false; 299 300 // Host must be either IPv4 or domain with a dot + TLD >= 2 chars (like old regex) 301 var host = u.hostname; 302 var isIPv4 = /^(25[0-5]|2[0-4]\d|[01]?\d?\d)(\.(25[0-5]|2[0-4]\d|[01]?\d?\d)){3}$/.test(host); 303 var isDomain = /^[a-z0-9-]+(\.[a-z0-9-]+)+$/i.test(host) && /\.[a-z]{2,}$/i.test(host); 304 305 if (!isIPv4 && !isDomain) return false; 306 307 // Optional port/path/query/hash are already handled by URL parsing 308 // If we reach here, treat as valid (same boolean return style as before) 309 return true; 310 } catch (e) { 311 return false; 312 } 313} 314 315/** 316 * Validate the phone number 317 * 318 * @param {string} phone_number Phone Number 319 * 320 * @return {bool} Phone Number is valid or invalid 321 */ 322function is_valid_phone( phone_number ) { 323 var phonePattern = new RegExp('^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$'); 324 return !!phonePattern.test( phone_number ); 325} 326/** 327 * Validate the email 328 * 329 * @param {string} email Email 330 * 331 * @return {bool} Email is valid or invalid 332 */ 333function is_valid_email( email ) { 334 //var emailPattern = new RegExp('[^@ \t\r\n]+@[^@ \t\r\n]+\.[^@ \t\r\n]+'); 335 var emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; 336 return emailPattern.test(email); 337} 338 339jQuery(document).ready(function($) { 340 $('#ep-gdpr-badge, #ep_gdpr_modal .ep-modal-overlay, #ep_gdpr_modal .ep-modal-close').on('click', function() { 341 //$('#ep-gdpr-modal').show(100); 342 $('#ep_gdpr_modal').toggleClass("ep_gdpr_modal_active").fadeToggle(100); 343 });
344 345 $('.ep-gdpr-modal-close, #ep-gdpr-modal').on('click', function(e) { 346 // Close modal only if clicking background or close button 347 if ($(e.target).is('#ep-gdpr-modal') || $(e.target).hasClass('ep-gdpr-modal-close')) { 348 $('#ep-gdpr-modal').fadeOut(); 349 } 350 }); 351}); 352 353/*--- 354 355 $(function() { 356 //----- OPEN 357 $('[ep-modal-open]').on('click', function(e) { 358 var targeted_popup_class = jQuery(this).attr('ep-modal-open'); 359 $('[ep-modal="' + targeted_popup_class + '"]').fadeIn(100); 360 $('body').addClass('ep-modal-open-body'); 361 e.preventDefault(); 362 }); 363 364 //----- CLOSE 365 $('[ep-modal-close]').on('click', function(e) { 366 var targeted_popup_class = jQuery(this).attr('ep-modal-close'); 367 $('[ep-modal="' + targeted_popup_class + '"]').fadeOut(200); 368 $('body').removeClass('ep-modal-open-body'); 369 e.preventDefault(); 370 }); 371 }); 372 * 373 * 374 */
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.