1/** 2 * Javascript code that is associated with the front end of the calendar 3 * @version 4.6.6 4 */ 5 6jQuery(document).ready(function($){ 7 8 //return; 9 var BODY = $('body'); 10 var BUS = ''; // initial eventon calendar data 11 var ajax_url = evo_general_params.ajaxurl; 12 13 14// EventON calendar main function 15 16 // to run before cal ajax is performed @4.6 17 $.fn.evo_pre_cal = function(options){ 18 var el = this; 19 var cal = {}; 20 var OO = $.extend({}, options); 21 22 var run = function(){ 23 cal_width_assoc(); 24 cal_load_nav_html(); 25 } 26 var cal_width_assoc = function(){ 27 cal_w = el.width(); 28 29 if( cal_w <300) el.addClass('szS'); 30 if( cal_w >300 && cal_w <600) el.addClass('szM'); 31 if( cal_w >600 && cal_w <900) el.addClass('szL'); 32 if( cal_w >900) el.addClass('szX'); 33 } 34 35 // load nav html into cal 36 var cal_load_nav_html = function(){ 37 nav_data = el.evo_cal_get_footer_data('nav_data'); 38 39 if( nav_data && 'month_title' in nav_data){ 40 41 __html = nav_data.month_title; 42 if( 'arrows' in nav_data ) __html += nav_data.arrows; 43 44 el.find('.evo_header_mo').html( __html ); 45 el.find('.evo_footer_nav').html( __html ); 46 } 47 } 48 run(); 49 } 50 51 // Calendar processing 2.8.6 u 4.6 52 $.fn.evo_calendar = function (options) { 53 54 var el = this; 55 var cal = this; 56 var cal = {}; 57 var calO = $.extend({ 58 'SC': {}, 59 'json':{}, 60 'type':'init' , 61 map_delay:0 62 }, options); 63 var SC = el.evo_shortcode_data(); 64 65 66 // load calendar eventcard and eventtop interactions 67 this.find('.eventon_list_event').each(function(){ 68 evo_cal_eventcard_interactions( $(this) ); 69 }); 70 71 var init = function(){ 72 73 // change IDs for map section for eventon widgets 74 if( $(el).hasClass('evcal_widget')){ 75 $(el).find('.evcal_gmaps').each(function(){ 76 var gmap_id = obj.attr('id'); 77 var new_gmal_id =gmap_id+'_widget'; 78 obj.attr({'id':new_gmal_id}) 79 }); 80 } 81 82 // load maps on calendar 83 _evo_run_eventcard_map_load(); 84 85 // initial actions on calendar 86 $(el).evo_cal_filtering(); 87 88 el.evo_cal_hide_data(); 89 90 live_now_cal(); 91 counters(); 92 }; 93 94 // support 95 var live_now_cal = function(){ 96 $(el).find('.evo_img_time').each(function(){ 97 if( $(this).closest('a.desc_trig').find('em.evcal_time').length ){ 98 _html = $(this).closest('a.desc_trig').find('em.evcal_time')[0].outerHTML; 99 $(this).html( _html ); 100 } 101 }); 102 } 103 104 var counters = function(){ 105 $(el).find('.evo_countdowner').each(function(){ 106 $(this).evo_countdown(); 107 }); 108 } 109 110 init(); 111 }; 112 113 114// Event Card handling v4.6.1 115 var evo_eventcard_listeners = function(){ 116 117 BODY 118 // localize time 119 .on('click','.tzo_trig',function(event){ 120 event.preventDefault(); 121 event.stopPropagation(); 122 123 localize_time( $(this) ); 124 //return; 125 }) 126 // event images 127 .on('click','.evo_event_more_img',function(){ 128 var O = $(this); 129 var box = O.closest('.evcal_eventcard'); 130 const gal = O.closest('.evocard_fti_in'); 131 132 if( box.length == 0 ) return; 133 134 O.siblings('span').removeClass('select'); 135 O.addClass('select'); 136 137 mainIMG = box.find('.evocard_main_image'); 138 mainIMG.data({ 139 'h': O.data('h'), 140 w: O.data('w'), 141 f: O.data('f') 142 }); 143 144 if( mainIMG.hasClass('def')){ 145 mainIMG.css('background-image', 'url('+ O.data('f') +')' ); 146 }else{ 147 mainIMG.html('<span style="background-image:url('+ O.data('f') +')"></span>' ); 148 mainIMG.eventon_process_main_ft_img( ); 149 } 150 }) 151 // open lightbox from main image click 152 .on('click','.evocard_main_image',function(){ 153 O = $(this); 154 155 // if already in lightbox 4.6.4 156 if( O.hasClass('inlb') ) return; 157 158 __ac = parseInt(O.data('w')) >= parseInt( O.data('h') ) ? 'iW':'iH'; 159 O.evo_lightbox_open({ 160 uid:'evocard_ft_img', 161 lbc:'evolb_ft_img',lbac:'within evocard_img '+ __ac, 162 content: "<img class='evocard_main_image inlb' src='" + O.data('f') +"' data-w='"+O.data('w')+"' data-h='"+O.data('h')+"' class=''/>", 163 end:'client', 164 lb_padding:'', 165 d: {event_id: O.data('event_id'), ri: O.data('ri')}
165 166 }); 167 }) 168 // repeat series 169 .on('click','.evo_repeat_series_date',function(){ 170 171 if( !($(this).parent().hasClass('clickable')) ) return; 172 173 ux = $(this).data('ux'); 174 URL = $(this).data('l'); 175 if( ux == 'def' ) window.location = URL; 176 if( ux == 'defA' )window.open( URL, '_blank'); 177 }) 178 179 // copy event link 180 .on('click','.copy.evo_ss', function(event){ 181 const OBJ = $(this); 182 const ROW = OBJ.closest('.evcal_evdata_row'); 183 var link = decodeURIComponent( OBJ.data('l') ); 184 navigator.clipboard.writeText( link ); 185 186 evo_card_socialshare_html = ROW.html(); 187 ROW.html( "<p style='display:flex'><i class='fa fa-check marr10'></i> " + $(this).data("t") + "</p>"); 188 189 setTimeout(function(){ 190 ROW.html( evo_card_socialshare_html); 191 },3000); 192 }) 193 194 // location image more 195 .on('click','.evo_locimg_more',function(){ 196 $(this).closest('.evo_metarow_locImg').toggleClass('vis'); 197 }) 198 199 // general gallery image changing 4.6 200 .on('click','.evo_gal_icon',function(){ 201 const O = $(this); 202 if( O.hasClass('on') ) return; 203 O.siblings('div').removeClass('on'); 204 O.addClass('on'); 205 206 O.closest('.evo_gal_box').find('.evo_gal_main_img').css('background-image', 'url('+ O.data('u') +')'); 207 }) 208 // show more/less event details 209 .on('click','.evobtn_details_show_more',function(){ 210 control_more_less( $(this)); 211 }) 212 213 // close eventcard 4.6.1 214 .on('click','.evcal_close',function(){ 215 $(this).closest('.evcal_eventcard').slideUp().removeClass('open'); 216 }) 217 218 // when light box is processed 219 .on('evo_lightbox_processed',function(event, OO, LIGHTBOX){ 220 if( !(LIGHTBOX.hasClass('evolb_ft_img'))) return; 221 LIGHTBOX.eventon_check_img_size_on_lb( ); 222 }) 223 224 // event top buttons 225 .on('click','.evocmd_button', function(event){ 226 event.preventDefault(); 227 event.stopPropagation(); 228 229 href = $(this).data('href'); 230 if( $(this).data('target')=='yes'){ 231 window.open(href,'_blank'); 232 }else{ 233 window.location = href; 234 } 235 }) 236 // organizer links from eventtop @4.5 237 .on('click','.evo_org_clk_link',function(){ 238 window.open( $(this).data('link') , "_blank"); 239 }) 240 241 // edit event button redirect 242 .on('click','.editEventBtnET', function(event){ 243 event.stopPropagation(); 244 href = $(this).attr('href'); 245 window.open(href); 246 }) 247 248 ; 249 250 // localize time 251 var localize_time = function( OBJ ){ 252 eventcard = OBJ.closest('.eventon_list_event'); 253 eventcard.find('.evo_mytime').each(function(){ 254 const obj = $(this); 255 var time = obj.data('times'); 256 var time_format = obj.data('__f'); 257 258 new_time = time.split('-'); 259 260 utc_offset = $(this).data('tzo'); 261 utc_offset = 0; 262 263 start = parseInt(new_time[0]); 264 end = parseInt(new_time[1]); 265 offset_start = start + utc_offset; 266 267 // end 268 var Me = moment.unix( end ).utc().local(); 269 var M1 = moment.unix( start ).utc().local(); 270 271 var _html = ''; 272 273 // same month 274 if( Me.format('YYYY/M') == M1.format('YYYY/M')){ 275 276 // same date 277 if( Me.format('DD') == M1.format('DD')){ 278 _html = M1.format( time_format ) + ' - ' + Me.format( obj.data('__tf') ) ; 279 // dif date 280 }else{ 281 _html = M1.format( time_format ) +' - '+ Me.format( time_format ); 282 } 283 // dif month 284 }else{ 285 _html = M1.format( time_format ) +' - '+ Me.format( time_format ); 286 } 287 288 new_html = "<span class='evo_newmytime'>" +_html + "</span>"; 289 290 obj.replaceWith( new_html ); 291 }); 292 } 293 294 // actual animation/function for more/less button 295 var control_more_less = function(obj){ 296 var content = obj.attr('content'); 297 var current_text = obj.find('.ev_more_text').html(); 298 var changeTo_text = obj.find('.ev_more_text').attr('data-txt'); 299 const cell = obj.closest('.evcal_evdata_cell'); 300 301 // show more 302 if(content =='less'){ 303 304 obj.closest('.evcal_evdata_cell').removeClass('shorter_desc'); 305 obj.attr({'content':'more'}); 306 obj.find('.ev_more_arrow').removeClass('ard'); 307 obj.find('.ev_more_text').attr({'data-txt':current_text}).html(changeTo_text); 308 309 }else{ 310 obj.closest('.evcal_evdata_cell').addClass('shorter_desc'); 311 obj.attr({'content':'less'});
312 obj.find('.ev_more_arrow').addClass('ard'); 313 obj.find('.ev_more_text').attr({'data-txt':current_text}).html(changeTo_text); 314 } 315 } 316 317 } 318 var evo_cal_eventcard_interactions = function( EC , load_maps ){ 319 320 // process featured image sizes 321 EC.find(".evocard_main_image").eventon_process_main_ft_img( ); 322 323 // process content sliders 324 EC.find('.evo_elm_HCS').each(function(){ 325 $(this).evo_process_content_slider(); 326 }); 327 328 // countdown 329 EC.find('.evo_countdowner').each(function(){ 330 var obj = $(this); 331 obj.removeClass('evo_cd_on'); 332 obj.evo_countdown(); 333 }); 334 335 $(window).on('resize',function(){ 336 EC.find(".evocard_main_image").eventon_process_main_ft_img( ); 337 }); 338 } 339 $.fn._evo_cal_eventcard_interactions = function( EC, load_maps){ 340 evo_cal_eventcard_interactions( EC , load_maps); 341 } 342 343 // run all map waiting map @4.6.1 344 function _evo_run_eventcard_map_load(){ 345 BODY.evo_run_eventcard_map_load(); 346 } 347 $.fn.evo_run_eventcard_map_load = function(){ 348 349 time = 600; 350 351 BODY.find('.evo_metarow_gmap').each(function(index){ 352 O = $(this); 353 if( !(O.is(":visible")) ) return; 354 O.evo_load_gmap({ 355 map_canvas_id: O.attr('id'), 356 trigger_point:'evo_calendar', 357 delay: time 358 }); 359 time += 600; 360 }); 361 } 362 363// EventTop Interactions v4.6 364 var evo_cal_eventtop_interactions = function( ET ){ } 365 366// RUN on Page load 367 init(); 368 function init(){ 369 370 init_load_cal_data(); 371 372 handlebar_additional_arguments(); 373 374 evo_cal_body_listeners(); 375 376 jitsi(); 377 378 // run basic countdown timers 379 BODY.find('.evo_countdowner').each(function(){ 380 $(this).evo_countdown(); 381 }); 382 } 383 384// Initial load data via ajax u4.6 385 function init_load_cal_data(){ 386 387 evo_eventcard_listeners(); 388 389 // check if calendars are present in the page 390 var run_initload = false; 391 392 if( $('body').find('.ajde_evcal_calendar').length > 0 ) run_initload = true; 393 if( $('body').find('.ajax_loading_cal').length > 0 ) run_initload = true; 394 if( $('body').find('.eventon_single_event').length > 0 ) run_initload = true; 395 396 if(run_initload == false) return false; 397 398 var data_arg = {}; 399 400 BODY.trigger('evo_global_page_run'); 401 402 data_arg['global'] = $('#evo_global_data').data('d'); 403 data_arg['cals'] ={}; 404 405 // run through all the calendars on page 406 BODY.find('.ajde_evcal_calendar').each(function(){ 407 const CAL = $(this); 408 var SC = CAL.evo_shortcode_data(); 409 410 CAL.evo_pre_cal(); 411 412 if( CAL.hasClass('ajax_loading_cal')){ 413 data_arg['cals'][ CAL.attr('id')] = {}; 414 data_arg['cals'][ CAL.attr('id')]['sc'] = SC; 415 416 BODY.trigger('evo_global_page_run_after', CAL , SC );// @4.6.1 417 } 418 }); 419 420 421 $.ajax({ 422 beforeSend: function(){}, 423 type: 'POST', 424 url: get_ajax_url('eventon_init_load'), 425 data: data_arg,dataType:'json', 426 success:function(data){ 427 $('#evo_global_data').data('d', data); 428 429 BUS = data; 430 431 // append html to calendars if present 432 if('cals' in data){ 433 var time = 300; 434 $.each(data.cals, function(i,v){ 435 436 setTimeout( function(){ 437 438 CAL = BODY.find('#'+ i); 439 if(CAL.length === 0) return; 440 441 if('html' in v){ 442 CAL.find('#evcal_list').html( v.html ); 443 CAL.removeClass('ajax_loading_cal'); 444 CAL.find('.evo_ajax_load_events').remove(); 445 } 446 447 // load SC and JSON to calendar 448 CAL.evo_cal_functions({action:'update_shortcodes',SC: v.sc}); 449 CAL.evo_cal_functions({action:'update_json',json: v.json}); 450 451 $('body').trigger('evo_init_ajax_success_each_cal', [data, i, v, CAL]); 452 453 }, time); 454 time += 300; 455 }); 456 } 457 458 $('body').trigger('evo_init_ajax_success', [data]); 459 460 // after timeout based cal loading, process all cals 461 setTimeout( function(){ 462 BODY.find('.ajde_evcal_calendar').each(function(){ 463 if( $(this).hasClass('.ajax_loading_cal') ) return; 464 $(this).evo_calendar({'type':'complete'}); 465 }); 466 }, time ); 467 468 },complete:function(data){ 469 $('body').trigger('evo_init_ajax_completed', [data]); 470 } 471 }); 472 } 473 474 475// GENERALIZED functions 476// General AJAX trigger - added 3.1 477 $(document).on('click','.evo_trig_ajax',function(event ){ 478 var ajax_data = {}; 479 const obj = $(this); 480 481 ajax_data = obj.data(); 482 $(document).data( 'evo_data', ajax_data ); 483 484 $(document).trigger('evo_before_trig_ajax', [obj]); 485 486 var new_ajax_data = $(document).data( 'evo_data'); 487 new_ajax_data['nn'] = the_ajax_script.postnonce; 488 489 $.ajax({
490 beforeSend: function(){ 491 $(document).trigger('evo_beforesend_trig_ajax', [obj, new_ajax_data]); 492 }, 493 type: 'POST',url: get_ajax_url('eventon_gen_trig_ajax') ,data: new_ajax_data,dataType:'json', 494 success:function(return_data){ 495 $(document).trigger('evo_success_trig_ajax', [obj, new_ajax_data, return_data]); 496 },complete:function(){ 497 $(document).trigger('evo_complete_trig_ajax', [obj, new_ajax_data]); 498 } 499 }); 500 501 }); 502 503// Virtual Events & jitsi 504 function jitsi(mod_refresh){ 505 506 const domain = 'meet.jit.si'; 507 const api = []; 508 509 jQuery('.evo-jitsi-wrapper').each(function(index, element) { 510 const O = $(this); 511 const eventO = O.closest('.eventon_list_event'); 512 513 // check if mod refresh is set or no 514 if( mod_refresh != '' && mod_refresh == 'mod_refresh_no' && O.hasClass('mod')) return; 515 516 var roomName = jQuery(element).data('n'), 517 width = jQuery(element).data('width'), 518 height = jQuery(element).data('height'), 519 audioMuted = jQuery(element).data('audiomute'), 520 videoMuted = jQuery(element).data('videomute'), 521 screenSharing = jQuery(element).data('screen'); 522 523 524 const myOverwrite = 525 { 526 'TOOLBAR_BUTTONS': $(element).data('d'), 527 "DEFAULT_BACKGROUND": '#494a4e', 528 'MOBILE_APP_PROMO': false, 529 'SETTINGS_SECTIONS':['devices', 'language', 'profile', 'calendar'], 530 }; 531 532 533 const options = { 534 roomName, 535 width, 536 height, 537 parentNode: element, 538 configOverwrite: { 539 startWithAudioMuted: audioMuted, 540 startWithVideoMuted: videoMuted, 541 startScreenSharing: false, 542 disableInviteFunctions: false, 543 }, 544 interfaceConfigOverwrite: myOverwrite, 545 }; 546 547 548 const api = new JitsiMeetExternalAPI(domain, options); 549 550 api.addEventListener('participantRoleChanged', function(event){ 551 552 // record moderator joined 553 if (event.role === "moderator"){ 554 _record_moderator_join( 'yes', eventO.data('event_id'), eventO.data('ri')); 555 } 556 557 const pp = jQuery(element).data('p'); 558 if (event.role === "moderator" && pp != '__') { 559 ppp = pp.replace('_',''); 560 api.executeCommand('password', ppp); 561 } 562 }); 563 564 // moderator leave 565 api.addEventListener('videoConferenceLeft', function(event){ 566 if( eventO.find('.evo_vir_data').data('ismod') =='y'){ 567 _record_moderator_join( 'no', eventO.data('event_id'), eventO.data('ri')); 568 O.siblings('.evo_vir_mod_left').show(); 569 O.hide(); 570 } 571 }); 572 }); 573 } 574 // record moderator logins for jitsi 575 function _record_moderator_join(joined, eid, ri){ 576 var data_arg = { 577 'action': 'eventon_record_mod_joined', 578 'eid': eid, 579 'ri': ri, 580 'joined': joined, 581 'nonce': evo_general_params.n, 582 }; 583 584 $.ajax({ 585 beforeSend: function(){}, 586 type: 'POST',url: ajax_url,data: data_arg,dataType:'json', 587 success:function(data){ } 588 }); 589 } 590 591 592 // refresh event card elements - evo_reload_virtual_events 593 // @+ 3.1 594 $('body').on('evo_refresh_elements',function(event, send_data ){ 595 596 if( send_data.length <= 0 || !send_data) return; 597 598 send_data['nonce'] = evo_general_params.n; 599 600 $.ajax({ 601 beforeSend: function(){ 602 if( 'evo_data' in send_data){ 603 $.each(send_data.evo_data, function(ekey, eclasses){ 604 $.each(eclasses, function(classnm, val){ 605 if(val && 'loader' in val && val['loader'] && 'loader_class' in val){ 606 $('#event_'+ekey).find('.'+val['loader_class']).addClass('evoloading'); 607 } 608 }); 609 }); 610 } 611 }, 612 type: 'POST',url: get_ajax_url('eventon_refresh_elm'),data: send_data,dataType:'json', 613 success:function(data){ 614 if( data.status == 'good' ){ 615 evo_apply_refresh_content( data ); 616 } 617 },complete: function(){ 618 if( 'evo_data' in send_data){ 619 $.each(send_data.evo_data, function(ekey, eclasses){ 620 $.each(eclasses, function(classnm, val){ 621 if(val && 'loader' in val && val['loader'] && 'loader_class' in val){
622 $('#event_'+ekey).find('.'+val['loader_class']).removeClass('evoloading'); 623 } 624 }); 625 }); 626 } 627 } 628 }); 629 }); 630 631 // refresh the closest hearbeat run parent 632 $('body').on('evo_refresh_designated_elm', function(ee, elm, elm_class, extra_data){ 633 634 //get closest event object 635 const event = $(elm).closest('.eventon_list_event'); 636 637 if( !event ) return; 638 if( event.find('.'+elm_class).length == 0 ) return; 639 640 const refresh_elm = event.find('.'+elm_class); 641 642 var send_data = {}; 643 644 send_data['evo_data'] = build_elm_refresh_data( refresh_elm , extra_data); 645 646 $('body').trigger('evo_refresh_elements',[ send_data ]); 647 }); 648 649 // record sign in - virtual plus 650 // @+3.1 651 $('body').on('click','.evo_vir_signin_btn',function(){ 652 653 extra_data = {}; 654 extra_data['signin'] = 'y'; 655 extra_data['refresh_main'] = 'y'; 656 extra_data['loader'] = true; 657 extra_data['loader_class'] = 'evo_vir_main_content'; 658 659 $('body').trigger('evo_refresh_designated_elm',[ $(this) , 'evo_vir_data',extra_data]); 660 }); 661 662 663 // apply refresh event element content with matching data that is sent 664 function evo_apply_refresh_content(data){ 665 666 if( 'evo_data' in data ){ 667 668 $.each(data.evo_data, function(eclass, boxes){ 669 // if event exists in the page 670 671 var vir_data_vals = false; 672 if( 'evo_vir_data' in boxes) vir_data_vals = boxes.evo_vir_data.data; 673 674 $('body').find('.'+eclass).each(function(){ 675 const event_elm = $(this); 676 677 // set html 678 $.each(boxes, function(boxclass, boxdata){ 679 if( !('html' in boxdata) ) return; 680 if( boxdata.html == '' ) return; 681 if( event_elm.find('.'+boxclass).legnth <= 0 ) return; 682 683 event_elm.find( '.'+boxclass ).html( boxdata.html ); 684 }); 685 686 // only for virtual event update 687 if( vir_data_vals ){ 688 689 // reload jitsi for main content - if main content html is sent it will refresh 690 if( vir_data_vals && ('vir_type' in vir_data_vals) 691 && vir_data_vals.vir_type == 'jitsi' 692 && ('evo_vir_main_content' in boxes) 693 && ('html' in boxes.evo_vir_main_content) 694 && boxes.evo_vir_main_content.html != '' 695 ){ 696 jitsi('mod_refresh_no'); 697 } 698 699 // update data for sent object 700 $.each(boxes, function(boxclass, boxdata){ 701 if( boxdata.data == '' || boxdata.data === undefined) return; 702 703 // for jitsi if mod left --> force refresh main 704 if( boxdata !== undefined && vir_data_vals.vir_type == 'jitsi' && vir_data_vals.mod_joined =='left'){ 705 706 // force refresh main 707 boxdata.data['refresh_main'] = 'yy'; 708 } 709 710 event_elm.find( '.'+boxclass ).data( boxdata.data ); 711 });
712 } 713 714 }); 715 }); 716 } 717 } 718 // get refresh data for specified elem 719 function build_elm_refresh_data( elm , extra_data){ 720 721 dataObj = {}; 722 723 // get closest event element and event id/ri from it 724 const event = $(elm).closest('.eventon_list_event'); 725 726 dataObj = {} 727 const ekey = event.data('event_id')+'_'+ parseInt(event.data('ri')); 728 dataObj[ ekey ] = {}; 729 730 const key2 = elm.data('key'); 731 732 // append new data to the element 733 dataObj[ ekey ][ key2 ] = elm.data(); 734 735 // check if awaitmod need checked 736 if( elm.data('check_awaitmod')){ 737 738 // if waiting for mod element is on page -> set as user awaiting mod 739 if( ( event.find('.evo_vir_jitsi_waitmod').length>0) ) 740 dataObj[ ekey ][ key2 ]['refresh_main'] = 'yy'; 741 742 // if jitsi is loaded on page & mod is still in --> stop refreshing main 743 if( event.find('.evo-jitsi-wrapper').length>0 && dataObj[ ekey ][ key2 ]['mod_joined'] !='left') 744 dataObj[ ekey ][ key2 ]['refresh_main'] = ''; 745 } 746 747 // append extra data 748 if( extra_data && extra_data !== undefined){ 749 $.each( extra_data, function (index,val){ 750 dataObj[ ekey ][ key2 ][index] = val; 751 }); 752 } 753 754 return dataObj; 755 } 756 757 // mark as virtual event ended 758 $(document) 759 .on('evo_before_trig_ajax',function(event, obj){ 760 if(!obj.hasClass('evo_trig_vir_end')) return; 761 762 var new_ajax_data = $(document).data( 'evo_data'); 763 new_ajax_data['fnct'] = 'mark_event_ended'; 764 $(document).data( 'evo_data', new_ajax_data ); 765 766 }) 767 .on('evo_beforesend_trig_ajax',function( event, obj, new_ajax_data){ 768 if(!obj.hasClass('evo_trig_vir_end')) return; 769 770 obj.closest('.evo_vir_mod_box').addClass('evoloading'); 771 }) 772 .on('evo_success_trig_ajax',function( event, obj, new_ajax_data, return_data){ 773 if(!obj.hasClass('evo_trig_vir_end')) return; 774 775 // if virtual events were marked as ended 776 if(!('_vir_ended' in return_data)) return; 777 778 // refresh the virtual main content 779 extra_data = {}; 780 extra_data['refresh_main'] = 'yy'; 781 extra_data['loader'] = true; 782 extra_data['loader_class'] = 'evo_vir_main_content'; 783 784 //console.log(extra_data); 785 786 $('body').trigger('evo_refresh_designated_elm',[ obj , 'evo_vir_data',extra_data]); 787 }) 788 .on('evo_complete_trig_ajax',function( event, obj, new_ajax_data){ 789 790 if(!obj.hasClass('evo_trig_vir_end')) return; 791 obj.closest('.evo_vir_mod_box').removeClass('evoloading'); 792 }) 793 ; 794 795// Heartbeat - added 3.1 796 //hook into heartbeat-send 797 jQuery(document).on('heartbeat-send', function(e, data) { 798 799 // if there is run heartbeat items 800 if( $('body').find('.evo_refresh_on_heartbeat').length>0 ){ 801 802 $('body').find('.evo_refresh_on_heartbeat').each(function(){ 803 if( $(this).closest('.eventon_list_event').length <= 0) return; 804 if( $(this).data('refresh')!== undefined && !$(this).data('refresh') ) return; 805 806 data['evo_data'] = build_elm_refresh_data( $(this) ); 807 }); 808 } 809 }); 810 811 //hook into heartbeat-tick 812 jQuery(document).on('heartbeat-tick', function(e, data) { 813 evo_apply_refresh_content( data ); 814 }); 815 816// Schedule View - 4.0 / u 4.6 817 $('body') 818 .on('evo_init_ajax_success_each_cal',function(event, data, i, v, CAL){ 819 $('body').find('.ajde_evcal_calendar.evoSV').each(function(){ 820 evosv_populate( $(this) ); 821 }); 822 }) 823 .on('evo_main_ajax_before_fnc', function(event, CAL, ajaxtype, data_arg){ 824 SC = data_arg.shortcode; 825 if( SC.calendar_type == 'schedule'){ 826 CAL.find('#evcal_list').removeClass('evo_hide').show(); 827 } 828 }).on('evo_main_ajax_success', function(event, CAL, ajaxtype, data , data_arg){ 829 SC = data_arg.shortcode; 830 if( SC.calendar_type == 'schedule'){ 831 CAL.find('#evcal_list').addClass('evo_hide').hide(); 832 } 833 }).on('evo_main_ajax_complete', function(event, CAL, ajaxtype, data , data_arg){ 834 SC = data_arg.shortcode; 835 if( SC.calendar_type == 'schedule'){ 836 evosv_populate( CAL ); 837 } 838 }) 839 // view switching 840 .on('evo_vSW_clicked_before_ajax',function(event, O, CAL, DD, reload_cal_data){ 841 if(!(O.hasClass('evosv'))) return; 842 var SC = CAL.evo_shortcode_data(); 843 844 CAL.evo_update_cal_sc({F:'calendar_type', V: 'schedule'}); 845 CAL.evo_update_cal_sc({F:'fixed_day', V: SC.fixed_day }); 846 847 }) 848 .on('evo_vSW_clicked',function(event, OBJ, CAL, DD, reload_cal_data){ 849 if(!(OBJ.hasClass('evosv'))) return; 850 851 CAL.evo_update_cal_sc({F:'calendar_type', V: 'schedule'}); 852 853 }) 854 .on('evo_vSW_clicked_noajax',function(event, OBJ, CAL, DD, reload_cal_data){ 855 if(!(OBJ.hasClass('evosv'))) return; 856 857 evosv_populate( CAL ); 858 }) 859 // open events from schedule view 860 .on('click','.evosv_items',function(event, elm){ 861 O = $(this); 862 CAL = O.closest('.ajde_evcal_calendar'); 863 var e_cl = 'event_'+O.data('id'); 864 865 const clicked_event_uxval = O.data('uxval'); 866 867 // if event is set to slide down .. switch to lightbox 868 if( clicked_event_uxval == '1' ){ 869 CAL.find('.'+e_cl).find('.desc_trig').data('ux_val', 3); 870 } 871 872 CAL.find('.'+e_cl).find('.desc_trig').trigger('click'); 873 }); 874 875 // populate the schedule view data @4.5.8 876 function evosv_populate(CAL){ 877 //console.log('s'); 878 var SC = CAL.evo_shortcode_data(); 879 OD = CAL.evo_get_OD(); // calendar other data 880 881 var cal_events = CAL.find('.eventon_list_event'); 882 days_in_month = CAL.evo_day_in_month({M: SC.fixed_month, Y: SC.fixed_year}); 883 time_format = CAL.evo_get_global({S1:'cal_def',S2:'wp_time_format'}); 884
885 // text strings 886 _txt = CAL.evo_get_txt({V:'no_events'}); 887 _txt2 = CAL.evo_get_txt({V:'until'}); 888 _txt3 = CAL.evo_get_txt({V:'from'}); 889 _txt4 = CAL.evo_get_txt({V:'all_day'}); 890 891 CAL.find('#evcal_list').addClass('evo_hide'); 892 893 var has_events = false; 894 var html = ''; 895 var template_data = {}; 896 var processed_ids = {}; 897 898 // Set initial date - date values 899 var SU = parseInt( SC.focus_start_date_range); var EU = ''; 900 var M = moment.unix( SU ).tz( OD.cal_tz ); 901 902 // go through each day in month 903 for(var x=1; x<= days_in_month; x++){ 904 905 var month_name = CAL.evo_get_dms_vals({ V: (M.get('month') +1), type:'m3'}); 906 var day_name = CAL.evo_get_dms_vals({ V: M.day(), type:'d3'}); 907 908 // set event unix into moment 909 SU = M.unix(); M.endOf('day'); 910 EU = M.unix(); M.startOf('day'); 911 912 // run through each event and get events in this date 913 var events = {}; 914 915 cal_events.each(function(index, elm){ 916 ED = $(elm).evo_cal_get_basic_eventdata(); 917 if( !ED) return; 918 919 processed_ids[ED.uID] = ED.uID; 920 ESU = ED.unix_start; EEU = ED.unix_end; 921 922 // check for date range 923 var inrange = CAL.evo_is_in_range({ 924 'S': SU, 'E': EU, 'start': ESU, 'end':EEU 925 }); 926 if(!inrange) return; // skip if no in range 927 928 has_events = true; 929 930 // event time relative to calendar tz 931 m = moment.unix( ESU ).tz( OD.cal_tz ); 932 me = moment.unix( end ).tz( OD.cal_tz ); 933 934 var all_day = $(elm).find('a.desc_trig').hasClass('allday') ? true: false; 935 936 // get event time correct for all day 937 if( all_day ){
938 ED['t'] = _txt4; 939 }else{ 940 if( ESU <= SU ){ 941 if( EEU >= EU) ED['t'] = _txt4; 942 if( EEU < EU ) ED['t'] = _txt2+' ' + me.format( time_format); 943 }else if(ESU > SU){ 944 if( EEU >= EU) ED['t'] = _txt3+' '+ m.format( time_format); 945 if( EEU < EU ) ED['t'] = m.format( time_format) +' - '+ me.format( time_format); 946 } 947 } 948 949 // hide end time 950 if( ED.hide_et == 'y') ED['t'] = m.format( time_format); 951 952 events[index] = ED; 953 }); 954 955 // if there are events in this date 956 if( events && Object.keys(events).length > 0){ 957 958 template_data[ x ] = {}; 959 template_data[ x ]['date'] = '<b>' + M.get('date')+'</b> '+ month_name+' '+ day_name; 960 template_data[ x ]['d'] = M.format('YYYY-M-D'); 961 template_data[ x ]['SU'] = SU; 962 template_data[ x ]['events'] = {} 963 964 $.each(events, function(index, item){ 965 966 location_data = organizer_data = event_tags = ''; 967 968 // location 969 if( SC.show_location == 'yes' && 'location' in item){ 970 location_data = "<div class='evosv_subdata evosv_location'><i class='fa fa-location-pin marr5'></i>" +item.location+"</div>"; 971 } 972 973 // organizer 974 if( SC.show_organizer == 'yes' && 'organizer' in item){ 975 organizer_data = "<div class='evosv_subdata evosv_org'>" +item.organizer+"</div>"; 976 } 977 978 // event tags 979 if( SC.show_tags == 'yes' && 'event_tags' in item){ 980 event_tags = "<div class='evosv_subdata evosv_tags'>"; 981 $.each( item.event_tags, function(index, val){ 982 event_tags += "<span class='evosv_tag " + index +"'>" + val+"</span>"; 983 }); 984 event_tags += "</div>"; 985 } 986 987 template_data[ x ]['events'][ item.uID ] = { 988 'time': item.t, 989 'ux_val': item.ux_val, 990 'title': item.event_title, 991 'color':item.hex_color, 992 'tag': event_tags, 993 'loc': location_data, 994 'org': organizer_data, 995 'i': item 996 } 997 998 }); 999 } 1000 1001 // next date 1002 M.add(1, 'd'); 1003 } 1004 1005 var html_ = "<div class='evosv_grid evoADDS'>"; 1006 1007 // if no events 1008 if( !has_events){ 1009 no_event_content = CAL.evo_get_global({S1: 'html', S2:'no_events'}); 1010 html_ += "<div class='date_row'><div class='row no_events evosv'>"+no_event_content+"</div></div>"; 1011 }else{ 1012 html_ += CAL.evo_HB_process_template({ 1013 TD:template_data, part:'evosv_grid' 1014 }); 1015 } 1016 1017 html_ += '</div>'; 1018 1019 if( CAL.find('.evosv_grid').length > 0){ 1020 CAL.find('.evosv_grid').replaceWith( html_ ); 1021 }else{ 1022 ELM = CAL.find('#eventon_loadbar_section'); 1023 ELM.after( html_ ); 1024 } 1025 1026 } 1027 1028// ELEMENTS u4.6 1029 // tooltips 1030 $('body').on('mouseover','.ajdeToolTip',function(event){ 1031 event.stopPropagation(); 1032 if($(this).hasClass('show')) return; 1033 1034 const t = $(this).data('d'); 1035 var p = $(this).position(); 1036 1037 var cor = getCoords(event.target); 1038 1039 $('.evo_tooltip_box').removeClass('show').removeClass('L').html(t); 1040 var box_height = $('.evo_tooltip_box').height(); 1041 var box_width = $('.evo_tooltip_box').width(); 1042 1043 $('.evo_tooltip_box').css({'top': (cor.top - 55 - box_height), 'left': ( cor.left + 5 ) }) 1044 .addClass('show'); 1045 1046 // left align 1047 if( $(this).hasClass('L')){ 1048 $('.evo_tooltip_box').css({'left': (cor.left - box_width - 15) }).addClass('L'); 1049 } 1050 }) 1051 .on('mouseout','.ajdeToolTip',function(){ 1052 $('.evo_tooltip_box').removeClass('show'); 1053 }); 1054 1055 function getCoords(elem) { // crossbrowser version 1056 var box = elem.getBoundingClientRect(); 1057 //console.log(box); 1058 1059 var body = document.body; 1060 var docEl = document.documentElement; 1061 1062 var scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop; 1063 var scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft; 1064 1065 var clientTop = docEl.clientTop || body.clientTop || 0; 1066 var clientLeft = docEl.clientLeft || body.clientLeft || 0; 1067 1068 var top = box.top + scrollTop - clientTop; 1069 var left = box.left + scrollLeft - clientLeft; 1070 1071 return { top: Math.round(top), left: Math.round(left) }; 1072 } 1073 // yes no button 1074 $('body').on('click','.ajde_yn_btn ', function(event){ 1075 1076 // stop this code from working on wp-admin 1077 if($('body').hasClass('wp-admin')) return false; 1078 1079 var obj = $(this); 1080 var afterstatement = obj.attr('afterstatement'); 1081 afterstatement = (afterstatement === undefined)? obj.attr('data-afterstatement'): afterstatement; 1082 var uid = ''; 1083 1084 // yes 1085 if(obj.hasClass('NO')){ 1086 obj.removeClass('NO'); 1087 obj.siblings('input').val('yes'); 1088 1089 // afterstatment 1090 if(afterstatement!=''){ 1091 var type = (obj.attr('as_type')=='class')? '.':'#'; 1092 if( obj.data('uid') !== undefined) uid = obj.data('uid'); 1093 $(type+ afterstatement).slideDown('fast'); 1094 } 1095 1096 }else{//no 1097 obj.addClass('NO'); 1098 obj.siblings('input').val('no'); 1099 1100 if(afterstatement!=''){ 1101 var type = (obj.attr('as_type')=='class')? '.':'#';
1102 $(type+ afterstatement ).slideUp('fast'); 1103 } 1104 } 1105 }); 1106 1107 // content slider v4.6 1108 BODY.on('click','.evo_elmHCS_nav.content_slide_trig',function(){ 1109 O = $(this); 1110 1111 var _HCS = O.closest('.evo_elm_HCS'), 1112 _HCS_in = _HCS.find('.evo_elm_HCS_in'); 1113 _line_width = _HCS_in[0].scrollWidth; 1114 _container_width = parseInt( _HCS.width() ) + 0; 1115 _leftPos = _HCS_in.scrollLeft(); 1116 _scrollable_legth = _line_width - _container_width; 1117 1118 //console.log(_line_width+' '+_container_width+' '+_leftPos+' '+_scrollable_legth); 1119 //return; 1120 1121 const scroll_length = _container_width /2; 1122 1123 // move right 1124 if( O.hasClass('HCSnavR') ){ 1125 1126 _HCS_in.animate({scrollLeft:_leftPos + scroll_length},200); 1127 _HCS.find('.HCSnavL').addClass('vis'); 1128 // move left 1129 }else{ 1130 sleft = (_leftPos - scroll_length < scroll_length) ? 0 : _leftPos - scroll_length; 1131 _HCS_in.animate({scrollLeft: sleft },200); 1132 } 1133 1134 setTimeout(function(){ 1135 var _leftPos = _HCS_in.scrollLeft(); 1136 //console.log(_leftPos); 1137 if( _leftPos < 10){ 1138 _HCS.find('.HCSnavL').removeClass('vis'); 1139 _HCS.find('.HCSnavR').addClass('vis'); 1140 } 1141 1142 if( _leftPos > ( _scrollable_legth - 5 ) ){ 1143 _HCS.find('.HCSnavR').removeClass('vis'); 1144 } 1145 },200); 1146 1147 }); 1148 $.fn.evo_process_content_slider = function(){ 1149 1150 _HCS = this; 1151 _HCS_in = _HCS.find('.evo_elm_HCS_in'); 1152 _line_width = _HCS_in[0].scrollWidth; 1153 _container_width = parseInt( _HCS.width() ) + 3; 1154 var leftPos = _HCS_in.scrollLeft(); 1155 1156 // console.log(_container_width+' '+_line_width); 1157 1158 // content is not showing full 1159 if( _line_width > _container_width ){ 1160 1161 // if some of content is hidden on right 1162 if( ( _container_width + leftPos ) < _line_width ) 1163 _HCS.find('.HCSnavR').addClass('vis'); 1164 1165 // if content has been scrolled 1166 if( leftPos > 0 ){ 1167 _HCS.find('.HCSnavL').addClass('vis'); 1168 }else{ 1169 _HCS.find('.HCSnavR').addClass('vis'); 1170 } 1171 }else{ 1172 _HCS.find('.HCSnavL').removeClass('vis'); 1173 _HCS.find('.HCSnavR').removeClass('vis'); 1174 } 1175 } 1176 1177 1178 $(window).on('resize',function(){ 1179 BODY.find('.evo_elm_HCS').each( function(event){ 1180 $(this).evo_process_content_slider(); 1181 }); 1182 }); 1183 1184// CAL BODY Listeners 1185 function evo_cal_body_listeners(){ 1186 BODY.evo_cal_lb_listeners(); 1187 1188 BODY 1189 // after both eventcard lightbox content is loaded 1190 .on('evolightbox_end',function(event, LB, CAL){ 1191 setTimeout(function(){ 1192 //console.log('e'); 1193 LB.find('.eventon_list_event').each(function(){ 1194 evo_cal_eventcard_interactions( $(this) , true ); 1195 }); 1196 1197 // load maps 1198 _evo_run_eventcard_map_load(); 1199 1200 }, 1000); 1201 }) 1202 1203 // load eventon event anywhere via lightbox ajax u4.6 1204 .on('click','.eventon_anywhere.evoajax', function(event){ 1205 event.preventDefault(); 1206 1207 var obj = $(this); 1208 var data = obj.data('sc'); 1209 1210 if( data.ev_uxval == '4') return; 1211 1212 // NOTE: repeat_interval is already in SC 1213 data['evortl'] = 'no'; 1214 if( 'id' in data ) data['event_id'] = data.id; 1215 data['ux_val'] = '3a'; 1216 data['ajax_eventtop_show_content'] = false; 1217 1218 obj.evo_cal_lightbox_trigger( data, obj, false); 1219 }) 1220 1221 // click on no events - @v 4.2 1222 .on('click','.evo_no_events_btn', function (e){ 1223 BODY.trigger('click_on_no_event_btn', [$(this) ] ); 1224 }) 1225 // MONTH switch 1226 .on('click','.evcal_arrows', function(){ 1227 1228 const CAL = $(this).closest('.ajde_evcal_calendar'); 1229 1230 dir = $(this).hasClass('evcal_btn_prev') ? 'prev': 'next'; 1231 var cal_id = CAL.attr('id'); 1232 1233 if( $(this).closest('.ajde_evcal_calendar').hasClass('evortl') ){ 1234 dir = ( dir == 'next') ? 'prev': 'next'; 1235 } 1236 1237 // if its from footer or header 4.6 1238 if( $(this).closest('.evo_footer_nav').length > 0){ 1239 1240 BOX = $(this).closest('.evo_footer_nav'); 1241 1242 offset = BOX.offset(); 1243 scrolltop = $(window).scrollTop(); 1244 viewport_top = offset.top - scrolltop; 1245 1246 1247 1248 CAL.addClass('nav_from_foot').data('viewport_top', viewport_top ); 1249 } 1250 1251 // run the cal action 1252 run_cal_ajax( cal_id, dir ,'switchmonth'); 1253 }) 1254 1255 // Show more events on list 1256 .on('click','.evoShow_more_events', function(){ 1257 CAL = $(this).closest('.ajde_evcal_calendar'); 1258 SC = CAL.evo_shortcode_data(); 1259 1260 OBJ = $(this); 1261 1262 // redirect to an external link 1263 if(SC.show_limit_redir !== ''){
1264 window.location = SC.show_limit_redir; return false; 1265 } 1266 1267 // ajax pagination 1268 if( SC.show_limit_ajax =='yes'){ 1269 CURRENT_PAGED = parseInt(SC.show_limit_paged); 1270 CAL.evo_update_cal_sc({F:'show_limit_paged', V: CURRENT_PAGED+1}); 1271 run_cal_ajax( CAL.attr('id'), 'none','paged'); 1272 1273 }else{ 1274 var event_count = parseInt( SC.event_count ); 1275 1276 var eventList = OBJ.parent(); 1277 var allEvents = eventList.find('.eventon_list_event').length; 1278 1279 var currentShowing = eventList.find('.eventon_list_event:visible').length; 1280 1281 for(x=1; x<=event_count ; x++ ){ 1282 var inde = currentShowing+x-1; 1283 eventList.find('.eventon_list_event:eq('+ inde+')').slideDown(); 1284 } 1285 1286 // hide view more button 1287 if(allEvents > currentShowing && allEvents<= (currentShowing+event_count)){ 1288 $(this).fadeOut(); 1289 } 1290 } 1291 }) 1292 1293 // refresh event top 1294 .on('runajax_refresh_eventtop',function(e, OBJ, nonce){}) 1295 1296 // when event card is slided done @4.6.1 1297 .on('evo_slidedown_eventcard_complete',function(event, event_id, obj, __is_slide_down){ 1298 1299 if( !__is_slide_down ) return; 1300 1301 setTimeout(function(){ 1302 1303 OO = obj.closest('.eventon_list_event'); 1304 evo_cal_eventcard_interactions( OO , true ); 1305 },300); 1306 }) 1307 // JUMPER switch v4.6 1308 .on('calendar_month_changed',function(event, CAL){ 1309 SC = CAL.evo_shortcode_data(); 1310 B = CAL.find('.evo-gototoday-btn'); 1311 1312 var O = CAL.find('.evo_j_container'); 1313 O.find('.evo_j_months a').removeClass('set'); 1314 O.find('.evo_j_months a[data-val="'+ SC.fixed_month +'"]').addClass('set'); 1315 1316 O.find('.evo_j_years a').removeClass('set'); 1317 O.find('.evo_j_years a[data-val="'+ SC.fixed_year +'"]').addClass('set'); 1318 1319 // show go to today 1320 if( SC.fixed_month != B.data('mo') || SC.fixed_year != B.data('yr')){ 1321 //B.show(); 1322 BODY.trigger('show_cal_head_btn', [B]); 1323 }else{ 1324 //B.hide(); 1325 BODY.trigger('hide_cal_head_btn', [B]); 1326 } 1327 }) 1328 // click on go to today 1329 .on('click','.evo-gototoday-btn', function(){ 1330 var obj = $(this); 1331 CAL = obj.closest('.ajde_evcal_calendar'); 1332 var calid = CAL.attr('id'); 1333 1334 CAL.evo_update_cal_sc({F:'fixed_month', V: obj.data('mo')}); 1335 CAL.evo_update_cal_sc({F:'fixed_year', V: obj.data('yr')}); 1336 1337 run_cal_ajax( calid,'none','today'); 1338 BODY.trigger('hide_cal_head_btn', [obj]); 1339 }) 1340 1341 // refresh now calendar 1342 .on('runajax_refresh_now_cal',function(e, OBJ, nonce){ 1343 1344 const section = OBJ.closest('.evo_eventon_live_now_section'); 1345 const CAL = section.find('.ajde_evcal_calendar').eq(0); 1346 1347 var dataA = { 1348 nonce: nonce, 1349 other: OBJ.data(), 1350 SC: CAL.evo_shortcode_data() 1351 }; 1352 1353 1354 1355 $.ajax({
1356 beforeSend: function(){ 1357 section.addClass('evoloading'); 1358 }, 1359 type: 'POST',url: get_ajax_url('eventon_refresh_now_cal'), data: dataA,dataType:'json', 1360 success:function(data){ 1361 if( data.status == 'good'){ 1362 section.html( data.html); 1363 1364 $('body').trigger('evo_refresh_designated_elm',[ OBJ, 'evo_vir_data']); 1365 } 1366 1367 },complete:function(data){ 1368 section.removeClass('evoloading'); 1369 1370 BODY.find('.evo_countdowner').each(function(){ 1371 $(this).evo_countdown(); 1372 }); 1373 } 1374 }); 1375 }) 1376 1377 // cal header buttons 1378 .on('click','.cal_head_btn',function(){ 1379 1380 if( $(this).hasClass('vis')){ 1381 BODY.trigger('hide_cal_head_btn',[ $(this)]); 1382 }else{ 1383 BODY.trigger('show_cal_head_btn',[ $(this)]); 1384 } 1385 1386 }) 1387 1388 .on('show_cal_head_btn',function(event, obj, hide_sib){ 1389 //CAL = obj.closest('.ajde_evcal_calendar'); 1390 if( obj.hasClass('evo-gototoday-btn') ){ }else{ 1391 obj.siblings(':not(.evo-gototoday-btn)').removeClass('show vis'); 1392 } 1393 obj.addClass('show vis'); 1394 1395 }) 1396 .on('hide_cal_head_btn',function(event , obj){ 1397 1398 CAL = obj.closest('.ajde_evcal_calendar'); 1399 //obj.siblings().removeClass('show vis'); 1400 obj.removeClass('show vis'); 1401 1402 BODY.trigger('evo_cal_header_btn_clicked', [ obj , CAL ]); 1403 1404 }) 1405 1406 // OPENING event card -- USER INTREACTION and loading google maps 1407 .on('click','.eventon_list_event .desc_trig', function(event){ 1408 1409 var obj = $(this); 1410 1411 var attr = obj.closest('.evo_lightbox').attr('data-cal_id'); 1412 if(typeof attr !== typeof undefined && attr !== false){ 1413 var cal_id = attr; 1414 var CAL = cal = $('#'+cal_id); 1415 }else{ 1416 var CAL = cal = obj.closest('.ajde_evcal_calendar'); 1417 } 1418 1419 SC = CAL.evo_shortcode_data(); 1420 1421 var evodata = cal.find('.evo-data'); 1422 1423 click_sinev_box = (obj.closest('.eventon_single_event').length>0 && evodata.data('exturl')) ? true: false; 1424 const event_id = obj.closest('.eventon_list_event').data('event_id'); 1425 var event_list = obj.closest('.eventon_events_list'); 1426 const event_box = obj.closest('.eventon_list_event'); 1427 1428 // event specific values 1429 var ux_val = obj.data('ux_val'); 1430 var exlk = obj.data('exlk'); 1431 1432 // override overall calendar user intereaction OVER individual event UX 1433 if('ux_val' in SC && SC.ux_val!='' && SC.ux_val!== undefined && SC.ux_val!='0'){ 1434 ux_val = SC.ux_val; 1435 } 1436 1437 // special mobile only user interaction 1438 if( SC.ux_val_mob !== undefined && SC.ux_val_mob != '' && 1439 SC.ux_val_mob != '-' && SC.ux_val_mob != ux_val){
1440 if( CAL.evo_is_mobile() ) ux_val = SC.ux_val_mob; 1441 } 1442 1443 1444 // open as lightbox 1445 if(ux_val=='3' || ux_val == '3a'){ 1446 event.preventDefault(); 1447 1448 repeat_interval = parseInt(obj.closest('.eventon_list_event').data('ri')); 1449 repeat_interval = (repeat_interval)? repeat_interval: '0'; 1450 1451 var alt_SC_data = {}; 1452 1453 1454 alt_SC_data['repeat_interval'] = repeat_interval; 1455 alt_SC_data['ux_val'] = ux_val; 1456 alt_SC_data['evortl'] = event_list.hasClass('evortl')? 'yes':'no'; 1457 alt_SC_data['event_id'] = parseInt(event_id); 1458 alt_SC_data['ajax_eventtop_show_content'] = true; 1459 1460 var new_SC_data = $.extend( {}, SC , alt_SC_data ); 1461 1462 // since 4.6 1463 CAL.evo_cal_lightbox_trigger( new_SC_data, obj, CAL); 1464 1465 return false; 1466 1467 // open in single events page 1468 }else if(ux_val=='4'){ 1469 1470 var url = obj.attr('href'); 1471 1472 if( url =='' || url === undefined){ 1473 1474 url = obj.parent().siblings('.evo_event_schema').find('a').attr('href'); 1475 window.open(url, '_self'); 1476 } 1477 1478 if(obj.attr('target') != '_blank') window.open(url, '_self'); 1479 1480 return; 1481 1482 // open in single events page in new window 1483 }else if(ux_val=='4a'){ 1484 1485 if( obj.attr('href')!='' && obj.attr('href')!== undefined){ 1486 return; 1487 }else{ 1488 var url = obj.parent().siblings('.evo_event_schema').find('a').attr('href'); 1489 window.open(url); 1490 return false; 1491 } 1492 1493 // open as external link 1494 }else if(ux_val=='2'){ 1495 //var url = obj.parent().siblings('.evo_event_schema').find('a').attr('href'); 1496 var url = obj.attr('href'); 1497 1498 // if the click is coming from single event box 1499 if( click_sinev_box ){ 1500 event.preventDefault(); 1501 return false; 1502 } 1503 1504 //console.log(url); 1505 if(url !== undefined && url != ''){ 1506 if(obj.attr('target') == '_blank'){ 1507 var win = window.open(url, '_blank'); 1508 win.focus(); 1509 }else{ 1510 window.open(url, '_self'); 1511 } 1512 1513 event.preventDefault(); 1514 } 1515 return true; 1516 1517 // do not do anything 1518 }else if(ux_val=='X'){ 1519 return false; 1520 }else if(ux_val=='none'){ 1521 return false; 1522 }else{ 1523 1524 // redirecting to external link 1525 if(exlk=='1' && ux_val!='1'){ 1526 // if there is no href 1527 if( obj.attr('href')!='' && obj.attr('href')!== undefined){ 1528 return; 1529 }else{ 1530 var url = obj.siblings('.evo_event_schema').find('a').attr('href'); 1531 if(obj.attr('target') == '_blank'){ window.open(url);}else{ window.open(url, '_self');} 1532 1533 event.preventDefault(); 1534 return false; 1535 } 1536 // SLIDE DOWN eventcard 1537 }else{ 1538 1539 const click_item = event_box.find('.event_description'); 1540 var __is_slide_down = false; 1541 1542 if(click_item.hasClass('open')){ 1543 event_box.removeClass('open'); 1544 click_item.slideUp().removeClass('open'); 1545 }else{ 1546 // accordion 1547 if( SC.accord == 'yes'){ 1548 cal.find('.eventon_list_event').removeClass('open');
1549 cal.find('.event_description').slideUp().removeClass('open'); 1550 } 1551 event_box.addClass('open'); 1552 click_item.slideDown().addClass('open'); 1553 __is_slide_down = true; 1554 } 1555 1556 // load google maps 1557 if( event_box.find('.evo_metarow_gmap').length > 0){ 1558 event_box.find('.evo_metarow_gmap').evo_load_gmap({trigger_point:'slideDownCard'}); 1559 } 1560 1561 1562 // trigger 1563 if( obj.data('runjs')){ 1564 $('body').trigger('evo_load_single_event_content',[ event_id, obj]); 1565 } 1566 1567 $('body').trigger('evo_slidedown_eventcard_complete',[ event_id, obj, __is_slide_down ]); 1568 1569 return false; 1570 } 1571 } 1572 }) 1573 1574 ; 1575 } 1576 1577 1578// Other 1579 1580 // Calendar Interaction 1581 // event bubbles 1582 $('.ajde_evcal_calendar.bub').on('mouseover','.eventon_list_event', function(){ 1583 O = $(this); 1584 LIST = O.closest('.eventon_events_list'); 1585 title = O.find('.evoet_dayblock').data('bub'); 1586 1587 p = O.position(); 1588 1589 LIST.append('<span class="evo_bub_box" style="">'+ title +"</span>"); 1590 B = LIST.find('.evo_bub_box'); 1591 1592 l = p.left; 1593 t = p.top- B.height() -30; 1594 1595 // adjust bubble to left if event on right edge 1596 LM = LIST.width(); 1597 tl = p.left + B.width() + O.width(); 1598 if( tl > LM){ 1599 l = l - B.width() +O.width()-20; 1600 } 1601 1602 B.css({'top':t, 'left':l}); 1603 1604 LIST.find('.evo_bub_box').addClass('show'); 1605 }).on('mouseout',function(){ 1606 B = $(this).find('.evo_bub_box').remove(); 1607 }); 1608 1609 // MONTH jumper
1610 $('.ajde_evcal_calendar').on('click','.evo-jumper-btn', function(){ 1611 $(this).closest('.calendar_header').find('.evo_j_container').toggle(); 1612 $(this).toggleClass('vis'); 1613 }); 1614 1615 // select a new time from jumper 1616 $('.evo_j_dates').on('click','a',function(){ 1617 var val = $(this).attr('data-val'), 1618 type = $(this).parent().parent().attr('data-val'), 1619 CAL = $(this).closest('.ajde_evcal_calendar'); 1620 SC = CAL.evo_shortcode_data(); 1621 1622 if(type=='m'){ // change month 1623 CAL.evo_update_cal_sc({F:'fixed_month', V: val }); 1624 }else{ 1625 CAL.evo_update_cal_sc({F:'fixed_year', V: val }); 1626 } 1627 1628 run_cal_ajax( CAL.attr('id') ,'none','jumper'); 1629 1630 // hide month jumper if not set to leave expanded 1631 if(SC.expj =='no') container.delay(2000).slideUp(); 1632 }); 1633 1634 // RESET general calendar 1635 // @U 2.8.9 1636 BODY.on('evo_trigger_cal_reset', function(event, cal){ 1637 cal_resets( cal ); 1638 }); 1639 function cal_resets(calOBJ){ 1640 calargs = $(calOBJ).find('.cal_arguments'); 1641 calargs.attr('data-show_limit_paged', 1 ); 1642 1643 calOBJ.evo_update_cal_sc({ 1644 F:'show_limit_paged',V:'1' 1645 }); 1646 } 1647 1648 // Tab view switcher 1649 $('body').find('.evo_tab_container').each(function(){ 1650 $(this).find('.evo_tab_section').each(function(){ 1651 if(!$(this).hasClass('visible')){ 1652 $(this).addClass('hidden'); 1653 } 1654 }); 1655 }); 1656 $('body').on('click','.evo_tab',function(){ 1657 tab = $(this).data('tab'); 1658 tabsection = $(this).closest('.evo_tab_view').find('.evo_tab_container'); 1659 tabsection.find('.evo_tab_section').addClass('hidden').removeClass('visible'); 1660 tabsection.find('.'+tab).addClass('visible').removeClass('hidden'); 1661 1662 $(this).parent().find('.evo_tab').removeClass('selected'); 1663 $(this).addClass('selected'); 1664 1665 $('body').trigger('evo_tabs_newtab_selected',[ $(this)]); 1666 }); 1667 1668 // layout view changer - legacy 1669 if($('body').find('.evo_layout_changer').length>0){ 1670 // menu button focus adjust 1671 $('body').find('.evo_layout_changer').each(function(item){ 1672 if($(this).parent().hasClass('boxy')){ 1673 $(this).find('.fa-th-large').addClass('on'); 1674 }else{ 1675 $(this).find('.fa-reorder').addClass('on'); 1676 } 1677 }); 1678 1679 // interaction 1680 $('.evo_layout_changer').on('click','i',function(){ 1681 const CAL = $(this).closest('.ajde_evcal_calendar'); 1682 TYPE = $(this).data('type'); 1683 $(this).parent().find('i').removeClass('on'); 1684 $(this).addClass('on'); 1685 1686 //console.log(TYPE); 1687 1688 if(TYPE=='row'){ 1689 CAL.attr('class','ajde_evcal_calendar'); 1690 // set tile colors 1691 CAL.find('.eventon_list_event').each(function(){ 1692 $(this).find('.desc_trig').css('background-color', ''); 1693 $(this).find('.desc_trig_outter').css('background-color', ''); 1694 }); 1695 }else if(TYPE =='bar'){ 1696 CAL.attr('class','ajde_evcal_calendar box_2 sev cev'); 1697 1698 // set tile colors 1699 CAL.find('.eventon_list_event').each(function(){ 1700 const color = $(this).data('colr'); 1701 $(this).find('.desc_trig').css('background-color', color); 1702 }); 1703 }else{ 1704 1705 // set tile colors 1706 CAL.find('.eventon_list_event').each(function(){ 1707 const color = $(this).data('colr'); 1708 $(this).find('.desc_trig_outter').css('background-color', color); 1709 }); 1710 1711 CAL.attr('class','ajde_evcal_calendar boxy boxstyle0 box_2'); 1712 } 1713 }); 1714 } 1715 1716 1717 // v4.0 view switcher 1718 BODY.on('click', '.evo_vSW',function(){ 1719 O = $(this); 1720 var DATA = O.data('d'); 1721 if(O.hasClass('focusX')) return; 1722 1723 //console.log(DATA); 1724 CAL = O.closest('.ajde_evcal_calendar'); 1725 1726 // remove other additions from other views 1727 CAL.find('.evoADDS').hide().delay(200).queue(function(){ 1728 $(this).remove(); 1729 }); 1730 1731 var SC = CAL.evo_shortcode_data(); 1732 const cal_tz = CAL.evo_get_global({S1:'cal_def',S2:'cal_tz'}); 1733 var reload_cal_data = false; 1734 1735 // Create date object 1736 _M1 = moment().set({'year': SC.fixed_year, 'month': ( SC.fixed_month -1 ), 'date':SC.fixed_day}).tz( cal_tz ); 1737 _M1.set('date',1).startOf('date'); 1738 _start = _M1.unix(); 1739 _M1.endOf('month').endOf('date'); // move to end of month 1740 _end = _M1.unix(); 1741 1742 // DEP 1743 var DD = new Date(SC.fixed_year,SC.fixed_month -1 , SC.fixed_day, 0,0,0 ); 1744 DD.setUTCHours(0); 1745 DD.setUTCFullYear( SC.fixed_year ); 1746 DD.setUTCMonth( SC.fixed_month -1 ); 1747 DD.setUTCDate( SC.fixed_day ); 1748 1749 // switch to normal 1750 O.siblings('.evo_vSW').removeClass('focusX select'); 1751 O.addClass('focusX select'); 1752 CAL.find('.evo-viewswitcher-btn em').html( O.html() ); 1753 O.closest('.evo_cal_view_switcher').removeClass('show'); 1754 1755 // ux_val for specific cal 1756 if( DATA && 'ux_val' in DATA) CAL.evo_update_cal_sc({F:'ux_val', V: DATA.ux_val }); 1757 1758 // calendar class toggling 1759 O.siblings('.evo_vSW').each(function(){ 1760 var _d = $(this).data('d'); 1761 if( _d && 'c' in _d ) CAL.removeClass( _d['c'] ); // remove other cls 1762 }); 1763 if( DATA && 'c' in DATA) CAL.addClass( DATA.c ); 1764 1765 1766 // process date times block 1767 CAL.find('.evoet_dayblock span').hide(); 1768 CAL.find('.evoet_dayblock span.evo_start').show(); 1769 CAL.find('.evoet_dayblock span.evo_end').show(); 1770 CAL.find('.evoet_dayblock span.evo_end.only_time').hide(); 1771 1772 // if current date range is not a month load those unix 1773 if( SC.focus_start_date_range != _start && SC.focus_end_date_range != _end ){ 1774 reload_cal_data = true; 1775 CAL.evo_update_cal_sc({F:'focus_start_date_range',V: _start }); 1776 CAL.evo_update_cal_sc({F:'focus_end_date_range', V: _end }); 1777 } 1778 1779 // treating events list based on dif preferences-- vals el_visibility = hide_events, show_events 1780 if( 'el_visibility' in DATA){ 1781 el_visibility = DATA.el_visibility; 1782 1783 if( el_visibility =='show_events') CAL.find('.eventon_list_event').show(); 1784 if( el_visibility =='hide_events') CAL.find('.eventon_list_event').hide(); 1785 if( el_visibility =='hide_list') CAL.find('#evcal_list').addClass('evo_hide').hide(); 1786 if( el_visibility =='show_all'){ 1787 CAL.find('#evcal_list').removeClass('evo_hide').show(); 1788 CAL.find('.eventon_list_event').show(); 1789 } 1790 } 1791 1792 CAL.evo_update_cal_sc({F:'calendar_type', V: 'default'}); 1793 1794 $('body').trigger('evo_vSW_clicked_before_ajax', [ O, CAL, DD, reload_cal_data ]); 1795 1796 // run ajax to load new events in the range 1797 if( reload_cal_data ){
1798 $('body').trigger('evo_run_cal_ajax',[CAL.attr('id'),'none','filering']); 1799 }else{ 1800 $('body').trigger('evo_vSW_clicked_noajax', [ O, CAL ]); // @s4.6 1801 } 1802 1803 $('body').trigger('evo_vSW_clicked', [ O, CAL, DD, reload_cal_data]); 1804 1805 // switching to and from tiles view 1806 if( O.hasClass('evoti')){ 1807 CAL.find('.eventon_list_event').each(function(){ 1808 color = $(this).data('colr'); 1809 $(this).find('a.desc_trig').css({'background-color': color}); 1810 }); 1811 CAL.addClass('color').removeClass('sev').data('oC', 'sev'); 1812 }else{ 1813 if( CAL.hasClass('esty_0') || CAL.hasClass('esty_4') ){ 1814 CAL.removeClass('color'); 1815 CAL.find('.eventon_list_event').each(function(){ 1816 $(this).find('a.desc_trig').css({'background-color': ''}); 1817 }); 1818 if( CAL.data('oC') !== undefined) CAL.addClass( CAL.data('oC')); 1819 } 1820 } 1821 1822 }); 1823 1824 // SORTING & FILTERING 1825 // Sorting 1826 // update calendar based on the sorting selection 1827 $('body').on('click', '.evo_sort_option',function(){ 1828 O = $(this); 1829 var CAL = O.closest('.ajde_evcal_calendar'); 1830 var sort_by = O.data('val'); 1831 1832 // update new values everywhere 1833 CAL.evo_update_cal_sc({F:'sort_by',V:sort_by}); 1834 1835 O.parent().find('p').removeClass('select'); 1836 O.addClass('select'); 1837 1838 run_cal_ajax(CAL.attr('id'),'none','sorting'); 1839 }); 1840 1841 // close filter menus on click outside 1842 BODY.on('clicked_on_page',function( ev, obj, ee){ 1843 1844 // hide filter menu when clicked outside 4.6.2 1845 if( !(obj.hasClass('eventon_filter')) && 1846 !(obj.hasClass('filtering_set_val')) && 1847 !(obj.hasClass('evo_filter_val')) && 1848 !(obj.hasClass('evofp_filter_search_i')) && 1849 obj.parents('.filtering_set_val').length == 0 1850 ){ 1851 //console.log(obj); 1852 BODY.find('.evo_filter_menu').html(''); 1853 BODY.find('.evo_filter_tax_box.vis').removeClass('vis'); 1854 } 1855 }); 1856 1857 // Filtering 1858 $.fn.evo_cal_filtering = function(O){ 1859 1860 var opt = $.extend({}, O); 1861 1862 var el = this; // cal 1863 const sortbox = el.find('.eventon_sorting_section'), 1864 filter_container = sortbox.find('.evo_filter_container_in'), 1865 filter_line = sortbox.find('.eventon_filter_line'), 1866 fmenu = sortbox.find('.evo_filter_menu'), 1867 all_cal_filter_data = el.evo_get_filter_data(), 1868 SC = el.evo_shortcode_data(); 1869 var tterms = []; 1870 1871 1872 var init = function(){ 1873 1874 if( el.hasClass('filters_go')) return; 1875 1876 el.addClass('filters_go'); 1877 1878 draw_filter_bar(); 1879 filter_actions(); 1880 run_filter_nav_check(); 1881 } 1882 1883 // draw the filter bar 1884 var draw_filter_bar = function(){ 1885 //console.log(all_cal_filter_data); 1886 1887 BODY.trigger('evo_filter_before_draw', [ el ]); 1888 1889 html = ''; 1890 $.each( all_cal_filter_data , function( index, value){ 1891 1892 // skip fast filter items 1893 if( SC.fast_filter == 'yes' && SC.ff_tax != '' && SC.ff_tax !== undefined ){ 1894 __t = SC.ff_tax.split(','); 1895 if( __t.includes( index ) ) return; 1896 } 1897 1898 html += "<div class='eventon_filter evo_filter_tax_box evo_hideshow_st "+index+"' data-tax='"+ value.__tax +"' data-filter_type='"+ value.__filter_type +"'>"; 1899 html += "<div class='eventon_filter_selection'>"; 1900 html += "<p class='filtering_set_val'><i class='fa fa-check'></i> "+ value.__name +"<em class='fa fa-caret-down'></em></p>"; 1901 html += "</div>"; 1902 html += "</div>"; 1903 }); 1904 1905 filter_line.html( html ); 1906 1907 BODY.trigger('evo_filter_drawn', [ el ]); 1908 } 1909 1910 1911 // filter all actions 1912 var filter_actions = function(){ 1913 1914 // show/hide filter bar 1915 el.on('click','.evo-filter-btn',function(){ 1916 1917 BODY.trigger('evo_filter_btn_trig', [ el , O ]); 1918 1919 if( el.hasClass('fp_lb')) return; // PLUG 4.6.4 1920 1921 if( !( $(this).hasClass('vis') ) ){ 1922 sortbox.addClass('vis'); 1923 run_filter_nav_check(); 1924 }else{ 1925 sortbox.removeClass('vis'); 1926 } 1927 1928 }); 1929 1930 // close filter when other sibling buttons clicked 4.6.4 1931 BODY.on('evo_cal_header_btn_clicked',function(event, O){ 1932 if( O.hasClass('evo-sort-btn') || O.hasClass('evo-search') ){ 1933 const CAL = O.closest('.ajde_evcal_calendar'); 1934 CAL.find('.eventon_sorting_section').removeClass('vis'); 1935 } 1936 });
1937 1938 1939 // show hide menu 1940 el.on('click','.filtering_set_val',function(){ 1941 1942 O = $(this); 1943 const filterbox = O.closest('.evo_filter_tax_box'), 1944 filter_tax = filterbox.data('tax'); 1945 selected_terms = el.evo_cal_get_filter_sub_data( filter_tax , 'tterms' ); 1946 1947 // close sort menu 1948 el.find('.eventon_sort_line').hide(); 1949 1950 // hide already opened menus 1951 if( filterbox.hasClass('vis')){ 1952 filterbox.removeClass('vis'); 1953 close_filter_menu(); 1954 return; 1955 } 1956 if( fmenu.data('tax') == filter_tax ){ 1957 filterbox.removeClass('vis'); 1958 close_filter_menu(); 1959 return; 1960 }else{ 1961 sortbox.find('.filtering_set_val').removeClass('show'); 1962 sortbox.find('.evo_filter_tax_box').removeClass('vis'); 1963 filterbox.addClass('vis'); 1964 } 1965 1966 // build the filter menu from data 1967 var filter_item_data = all_cal_filter_data[ filter_tax ].__list; 1968 1969 //console.log(all_cal_filter_data); 1970 //console.log(selected_terms); 1971 1972 var __menu_html = '<div class="evo_filter_inside evo_filter_menu_in" data-tax="'+filter_tax+'"><div class="eventon_filter_dropdown">'; 1973 1974 // each term 1975 $.each(filter_item_data, function (index, val){ 1976 1977 var icon_html = ''; 1978 var _class = filter_tax+'_'+ val[0] + ' '+ val[0]; 1979 1980 // parent or child term 1981 if( val[3] !== undefined && val[3] != '' && val[3] == 'n') _class += ' np'; 1982 1983 //console.log(selected_terms); 1984 // select or not 1985 if( selected_terms == 'all' ) _class += ' select'; 1986 if( selected_terms.includes( val[0] ) ) _class += ' select'; 1987 1988 // icon 1989 if( val[2] != '' && val[2] !== undefined ){ 1990 _class += ' has_icon'; icon_html = val[2]; 1991 } 1992 1993 __menu_html += '<p class="evo_filter_val '+ _class +'" data-id="'+ val[0] +'">'+ icon_html + val[1]+'</p>' 1994 }); 1995 __menu_html += "</div></div>"; 1996 1997 // 4.6.4 1998 BODY.trigger('evo_filter_menu_html_ready', [ el , __menu_html , O , filterbox, filter_tax]); 1999 2000 2001 if( el.hasClass('fp_side')) return; // PLUG 2002 2003 2004 2005 // set new menu with correct location 2006 const scrolled_width = filter_container.scrollLeft(); 2007 fmenu.html( __menu_html ); 2008 2009 // pluggable 2010 BODY.trigger('evo_filter_menu_built', [ el , fmenu , filter_tax ]); 2011 2012 2013 __left_margin = filterbox.position().left + 10 - scrolled_width; 2014 __menu_width = fmenu.find('.evo_filter_inside').width(); 2015 2016 __cal_left_margin = el.position().left; 2017 2018 //console.log(__cal_left_margin + ' '+ __left_margin +' '+ __menu_width + ' '+ $(window).width()); 2019 2020 if( __left_margin + __menu_width + __cal_left_margin > $(window).width() ){ 2021 2022 if( ( __left_margin + __menu_width ) > el.width() ){ 2023 new_left = el.width() - __menu_width - 10; 2024 }else{ 2025 new_left = ( el.width() - __menu_width ) / 2; 2026 } 2027 fmenu.css('left', new_left ); 2028 }else{ 2029 fmenu.css('left', __left_margin); 2030 } 2031 }); 2032 2033 // select a static filter menu item 2034 el.on('click','p.filtering_static_val',function(){ 2035 2036 BODY.trigger('evo_filter_static_clicked', [ el , $(this) ]); 2037 2038 }); 2039 2040 // select terms in filter menu 2041 el.on('click','p.evo_filter_val',function (){ 2042 2043 var O = $(this); 2044 const filter_menuIN = O.closest('.evo_filter_inside'), 2045 filter_tax = filter_menuIN.data('tax'), 2046 filterbox = sortbox.find('.evo_filter_tax_box.'+ filter_tax), 2047 all_terms_obj = filter_menuIN.find('p'), 2048 new_term_id = O.data('id'), 2049 old_terms = el.evo_cal_get_filter_sub_data( filter_tax , 'terms' ) 2050 ; 2051 var tterms = el.evo_cal_get_filter_sub_data( filter_tax , 'nterms' ); 2052 2053 var new_terms = []; 2054 2055 2056 // select filter type 2057 if( SC.filter_type == 'select' ){ 2058 2059 // all value 2060 if( new_term_id == 'all' ){ 2061 if( O.hasClass('select') ){ 2062 all_terms_obj.removeClass('select'); 2063 }else{ 2064 all_terms_obj.addClass('select'); 2065 new_terms.push('all'); 2066 } 2067 }else{ 2068 // unselect all value 2069 filter_menuIN.find('p.all').removeClass('select'); 2070 O.toggleClass('select'); 2071 2072 var unselect_count = 0; 2073 all_terms_obj.each(function(){ 2074 if( $(this).hasClass('select')){ 2075 new_terms.push( $(this).data('id') ) 2076 }else{ 2077 // not select 2078 if(!$(this).hasClass('all')) unselect_count++; 2079 } 2080 }); 2081 2082 // all selected 2083 if(unselect_count == 0){ 2084 filter_menuIN.find('p.all').addClass('select'); 2085 new_terms.push('all'); 2086 } 2087 2088 // if all field is not visible; nothing selected = all 2089 if( new_terms.length == 0 && O.parent().find('p.all').length == 0) 2090 new_terms.push('all'); 2091 } 2092 2093 // non select type 2094 }else{ 2095 // all value 2096 if( new_term_id == 'all' ){ 2097 // if all is already selected 2098 if( O.hasClass('select')){ 2099 new_terms.push('NOT-all'); 2100 all_terms_obj.removeClass('select'); 2101 }else{ 2102 all_terms_obj.addClass('select'); 2103 new_terms.push( new_term_id ); 2104 } 2105 }else{ 2106 all_terms_obj.removeClass('select'); 2107 O.addClass('select'); 2108 new_terms.push( new_term_id ); 2109 } 2110 2111 update_filter_data( filter_tax, new_terms ); 2112 2113 // process selection @4.6.6 2114 if( tterms == new_terms ){ 2115 close_filter_menu(); 2116 }else{ 2117 cal_resets( el ); 2118 2119 el.evo_update_sc_from_filters(); 2120
2121 run_cal_ajax( el.attr('id') ,'none','filering'); 2122 2123 close_filter_menu(); 2124 O.removeClass('show'); 2125 } 2126 2127 close_filter_menu(); 2128 // mark hide of menu 2129 filterbox.removeClass('vis'); 2130 } 2131 2132 // show and hide apply filter button 2133 // if new terms = temp terms 2134 if( compare_terms( new_terms, tterms) ){ 2135 filterbox.removeClass('chg'); 2136 }else{ 2137 filterbox.addClass('chg'); 2138 } 2139 if( compare_terms( old_terms, new_terms) ){ 2140 filterbox.removeClass('set'); 2141 }else{ 2142 filterbox.addClass('set'); 2143 } 2144 2145 2146 // changed filters 2147 var chg_filters = sortbox.find('.evo_filter_tax_box.chg').length; 2148 var set_count = sortbox.find('.evo_filter_tax_box.set').length; 2149 if( SC.filter_type == 'select' ) 2150 ( chg_filters > 0 ) ? show_apply_btns() : hide_apply_btns(); 2151 2152 2153 // Filter highlighted indicator 2154 if( !( el.hasClass('flhi') ) ){ 2155 2156 const filter_btn = el.find('.evo-filter-btn'); 2157 2158 if( set_count > 0){ 2159 filter_btn.find('em').html( set_count ).addClass('o'); 2160 }else{ 2161 filter_btn.find('em').removeClass('o'); 2162 } 2163 } 2164 2165 2166 2167 update_filter_data( filter_tax, new_terms , 'tterms'); 2168 2169 run_filter_nav_check(); 2170 2171 }); 2172 2173 // apply filters button 2174 el.on('click','.evo_filter_submit',function(){ 2175 2176 el.evo_filters_update_from_temp( filter_line, el ); 2177 2178 cal_resets( el); 2179 2180 close_filter_menu(); // hide filter menu 2181 2182 // update filter item button 2183 sortbox.find('.filtering_set_val').removeClass('show'); 2184 2185 el.evo_update_sc_from_filters(); // update shortcode from filters 2186 2187 run_cal_ajax( el.attr('id'),'none','filering'); 2188 2189 run_filter_nav_check(); 2190 }); 2191 2192 // clear filters 2193 el.on('click','.evo_filter_clear',function(){ 2194 2195 el.find('.evo_filter_tax_box').each(function(){ 2196 const O = $(this), 2197 tax = O.data('tax'), 2198 terms = O.data('terms'); 2199 2200 O.removeClass('set'); 2201 O.find('.filtering_set_val').removeClass('set show'); 2202 el.find('.evo-filter-btn em').removeClass('o'); 2203 2204 close_filter_menu(); 2205 }); 2206 2207 // update all filters with default/ onload values @4.6.1 2208 $.each( all_cal_filter_data, function( tax, tdata){ 2209 update_filter_data( tax, tdata.terms ); 2210 } ); 2211 2212 2213 hide_apply_btns(); // hide filter action buttons 2214 2215 // update shortcode and run new ajax for events 2216 el.evo_update_sc_from_filters(); 2217 run_cal_ajax( el.attr('id'),'none','filering'); 2218 2219 run_filter_nav_check(); 2220 }); 2221 2222 // click on filter navs 2223 el.on('click','.evo_filter_nav',function(){ 2224 O = $(this); 2225 2226 _filter_bar = O.closest('.evo_filter_bar'); 2227 _filter_container = _filter_bar.find('.evo_filter_container_in'); 2228 _filter_line_width = _filter_bar.find('.eventon_filter_line')[0].scrollWidth; 2229 _filter_container_width = parseInt( _filter_container.width() ) + 0; 2230 _leftPos = _filter_container.scrollLeft(); 2231 _scrollable_legth = _filter_line_width - _filter_container_width; 2232 2233 const scroll_length = _filter_container_width /2; 2234 2235 // move right 2236 if( O.hasClass('evo_filter_r') ){ 2237 2238 _filter_container.animate({scrollLeft:_leftPos + scroll_length},200); 2239 _filter_bar.find('.evo_filter_l').addClass('vis'); 2240 // move left 2241 }else{ 2242 sleft = (_leftPos - scroll_length < scroll_length) ? 0 : _leftPos - scroll_length; 2243 _filter_container.animate({scrollLeft: sleft },200); 2244 } 2245 2246 close_filter_menu(); 2247 2248 setTimeout(function(){ 2249 var _leftPos = _filter_container.scrollLeft(); 2250 //console.log(_leftPos); 2251 if( _leftPos < 10){ 2252 _filter_bar.find('.evo_filter_l').removeClass('vis'); 2253 _filter_bar.find('.evo_filter_r').addClass('vis'); 2254 } 2255 2256 if( _leftPos > ( _scrollable_legth - 5 ) ){ 2257 _filter_bar.find('.evo_filter_r').removeClass('vis'); 2258 } 2259 },200);
2260 2261 }); 2262 2263 // on window size change 2264 $(window).on('resize',function(){ 2265 run_filter_nav_check(); 2266 }); 2267 } 2268 2269 var compare_terms = function(a, b){ 2270 if (a === b) return true; 2271 if (a == null || b == null) return false; 2272 if (a.length !== b.length) return false; 2273 2274 for (var i = 0; i < a.length; ++i) { 2275 if (a[i] !== b[i]) return false; 2276 } 2277 return true; 2278 } 2279 var close_filter_menu = function(){ 2280 fmenu.html('').data('tax',''); 2281 } 2282 2283 var show_apply_btns = function(){ 2284 sortbox.find('.evo_filter_aply_btns').addClass('vis'); 2285 } 2286 var hide_apply_btns = function(){ 2287 sortbox.find('.evo_filter_aply_btns').removeClass('vis'); 2288 } 2289 2290 var update_filter_data = function(tax, new_val, key){ 2291 2292 el.evo_cal_update_filter_data( tax , new_val , key ); 2293 } 2294 2295 2296 // adjust and position filter nav buttons 2297 var run_filter_nav_check = function(){ 2298 2299 $.each( el.find('.evo_filter_bar') , function(event){ 2300 _filter_bar = $(this); 2301 _filter_container = _filter_bar.find('.evo_filter_container_in'); 2302 _filter_line_width = _filter_bar.find('.eventon_filter_line')[0].scrollWidth; 2303 _filter_container_width = parseInt( _filter_container.width() ) + 3; 2304 var leftPos = _filter_container.scrollLeft(); 2305 2306 //console.log(_filter_line_width +' '+ _filter_container_width +' '+leftPos); 2307 2308 // filter line is not showing full 2309 if( _filter_line_width > _filter_container_width ){ 2310 2311 // if some of filter line is hidden on right 2312 if( ( _filter_container_width + leftPos ) < _filter_line_width ) 2313 _filter_bar.find('.evo_filter_r').addClass('vis'); 2314 2315 // if filter has been scrolled 2316 if( leftPos > 0 ){ 2317 _filter_bar.find('.evo_filter_l').addClass('vis'); 2318 }else{ 2319 _filter_bar.find('.evo_filter_r').addClass('vis'); 2320 } 2321 }else{ 2322 _filter_bar.find('.evo_filter_l').removeClass('vis'); 2323 _filter_bar.find('.evo_filter_r').removeClass('vis'); 2324 } 2325 2326 }); 2327 2328 //console.log(filter_line_width +' '+ filter_container_width +' '+leftPos); 2329 } 2330 2331 init(); 2332 } 2333 2334 // for each tax move tterms value to nterms / before sending ajax 2335 $.fn.evo_filters_update_from_temp = function(filter_line, cal){ 2336 // move temp term values into new terms 2337 filter_line.find('.evo_filter_tax_box').each(function(){ 2338 var taxonomy = $(this).data('tax'); 2339 const tterms = cal.evo_cal_get_filter_sub_data( taxonomy , 'tterms'); 2340 2341 cal.evo_cal_update_filter_data( taxonomy , tterms, 'nterms'); 2342 2343 $(this).removeClass('chg'); 2344 }); 2345 } 2346 2347 2348 // PRIMARY hook to get content 2349 // MAIN AJAX for calendar events v2.8 2350 function run_cal_ajax( cal_id, direction, ajaxtype){ 2351 2352 // identify the calendar and its elements. 2353 var CAL = ev_cal = $('#'+cal_id); 2354 2355 // check if ajax post content should run for this calendar or not 2356 if(CAL.attr('data-runajax')!='0'){ 2357 2358 // category filtering for the calendar 2359 var cat = CAL.find('.evcal_sort').attr('cat'); 2360 2361 // reset paged values for switching months 2362 if(ajaxtype=='switchmonth'){ 2363 CAL.find('.cal_arguments').attr('data-show_limit_paged',1); 2364 CAL.evo_update_cal_sc({F:'show_limit_paged', V: '1'}); 2365 } 2366 2367 SC = CAL.evo_cal_functions({action:'load_shortcodes'}); 2368 2369 $('body').trigger('evo_main_ajax_before', [CAL, ajaxtype, direction, SC]); 2370 2371 var data_arg = { 2372 //action: 'eventon_get_events', 2373 direction: direction, 2374 shortcode: SC, 2375 ajaxtype: ajaxtype, 2376 nonce: evo_general_params.n 2377 }; 2378 2379 EVENTS_LIST = CAL.find('.eventon_events_list'); 2380 2381 $.ajax({
2382 // preload actions 2383 beforeSend: function(){ 2384 CAL.addClass('evo_loading'); 2385 2386 // paged -- adding events to end 2387 if(ajaxtype == 'paged'){ 2388 txt = EVENTS_LIST.find('.evoShow_more_events').html(); 2389 EVENTS_LIST.find('.evoShow_more_events').html('. . .').data('txt',txt); 2390 }else{ 2391 2392 html = evo_general_params.html.preload_events; 2393 if( SC.tiles == 'yes') html = evo_general_params.html.preload_event_tiles; 2394 2395 EVENTS_LIST.html( html ); 2396 //EVENTS_LIST.slideUp('fast'); 2397 } 2398 2399 // maintain scrolltop location 4.6 2400 if( CAL.hasClass('nav_from_foot')){ 2401 2402 scrolltop = (CAL.find('.evo_footer_nav').offset().top) - CAL.data('viewport_top'); 2403 $('html, body').animate({ scrollTop: scrolltop },20); 2404 } 2405 2406 $('body').trigger('evo_main_ajax_before_fnc',[CAL, ajaxtype, data_arg ]); //s4.6 2407 }, 2408 type: 'POST', url: get_ajax_url('eventon_get_events'),data: data_arg,dataType:'json', 2409 success:function(data){ 2410 if(!data) return false; 2411 2412 // paged calendar 2413 if(ajaxtype == 'paged'){ 2414 EVENTS_LIST.find('.evoShow_more_events').remove(); 2415 EVENTS_LIST.find('.clear').remove(); 2416 2417 2418 EVENTS_LIST.append( data.html + "<div class='clear'></div>"); 2419 2420 // hide show more events if all events loaded 2421 var events_in_list = EVENTS_LIST.find('.eventon_list_event').length; 2422 if( 'total_events' in data && data.total_events == events_in_list){ 2423 EVENTS_LIST.find('.evoShow_more_events').hide(); 2424 } 2425 2426 // for month lists duplicate headers // @+2.8.1 2427 var T = {}; 2428 EVENTS_LIST.find('.evcal_month_line').each(function(){ 2429 d = $(this).data('d'); 2430 if( T[d]) 2431 $(this).remove(); 2432 else 2433 T[d] = true; 2434 }); 2435 2436 var T = {}; 2437 EVENTS_LIST.find('.sep_month_events').each(function(){ 2438 d = $(this).data('d'); 2439 if( T[d]){ 2440 var H = $(this).html(); 2441 EVENTS_LIST.find('.sep_month_events[data-d="'+d+'"]').append( H ); 2442 $(this).remove(); 2443 }else{T[d] = true;} 2444 }); 2445 2446 }else{ 2447 EVENTS_LIST.html(data.html); 2448 } 2449 2450 2451 // update calendar data 2452 animate_month_switch(data.cal_month_title, CAL.find('.evo_month_title')); 2453 CAL.evo_cal_functions({action:'update_shortcodes',SC: data.SC}); 2454 CAL.evo_cal_functions({action:'update_json',json: data.json}); 2455 2456 // run cal process code 2457 CAL.evo_calendar({ 2458 SC: data.SC, 2459 json: data.json 2460 }); 2461 2462 2463 $('body').trigger('calendar_month_changed',[CAL, data]); 2464 2465 $('body').trigger('evo_main_ajax_success', [CAL, ajaxtype, data, data_arg]); 2466 2467 },complete:function(data){ 2468 2469 // show events list events if not set to hide on load 2470 if(! EVENTS_LIST.hasClass('evo_hide')) EVENTS_LIST.delay(300).slideDown('slow'); 2471 2472 // maintain scrolltop location 4.6 2473 if( CAL.hasClass('nav_from_foot')){ 2474 2475 setTimeout(function(){ 2476 scrolltop = (CAL.find('.evo_footer_nav').offset().top) - CAL.data('viewport_top'); 2477 $('html, body').animate({ scrollTop: scrolltop },20); 2478 CAL.removeClass('nav_from_foot'); 2479 },302); 2480 } 2481 2482 // pluggable 2483 $('body').trigger('evo_main_ajax_complete', [CAL, ajaxtype, data.responseJSON , data_arg]); 2484 CAL.removeClass('evo_loading'); 2485 } 2486 }); 2487 } 2488 } 2489 2490 $('body').on('evo_run_cal_ajax',function(event,cal_id, direction, ajaxtype){ 2491 run_cal_ajax( cal_id, direction, ajaxtype); 2492 }); 2493 2494 // deprecated bridge function for sortby value 2495 function ajax_post_content(sortby, cal_id, direction, ajaxtype){ 2496 run_cal_ajax( cal_id, direction, ajaxtype); 2497 } 2498 2499 // Click events listener - 4.6 2500 $(document).on('click', function(event) { 2501 //event.stopPropagation(); 2502 //console.log($(event.target)); 2503 BODY.trigger('clicked_on_page', [ $(event.target) , event ]); 2504 2505 //console.log(event); 2506 }); 2507 2508 // subtle animation when switching months 2509 function animate_month_switch(new_data, title_element){ 2510 var current_text = title_element.html(); 2511 var CAL = title_element.closest('.ajde_evcal_calendar'); 2512 2513 title_element.html(new_data); 2514 return; 2515 } 2516 2517 // event location archive card page 2518 // @u 2.8.6 2519 $('body').find('.evo_location_map').each(function(){ 2520 $(this).evo_load_gmap(); 2521 }); 2522 2523 // on event card lightbox load -> taxonomy details @since 4.2 u4.6 2524 $('body').on('evo_ajax_complete_eventon_get_tax_card_content', function(event, OO){ 2525 2526 LB = $('body').find('.'+ OO.lightbox_key); 2527 2528 // run map load 2529 if( LB.find('.evo_trigger_map').length > 0 ){ 2530 map_id_elm = LB.find('.evo_trigger_map'); 2531 map_id_elm.evo_load_gmap(); 2532 } 2533 2534 // run countdown timers 2535 LB.find('.evo_countdowner').each(function(){ 2536 $(this).evo_countdown(); 2537 }); 2538 2539 2540 // run calendar filtering function 2541 CAL = LB.find('.ajde_evcal_calendar'); 2542 CAL.evo_cal_filtering(); 2543 2544 }); 2545 2546 // SINGLE EVENTS 2547 // Loading single event json based content 2548 $('body').on('evo_load_single_event_content', function(event, eid, obj){ 2549 var ajaxdataa = {}; 2550 ajaxdataa['eid'] = eid; 2551 ajaxdataa['nonce'] = the_ajax_script.postnonce; 2552 2553 // pass on other event values 2554 if(obj.data('j')){ 2555 $.each(obj.data('j'), function(index,val){ 2556 ajaxdataa[ index] = val; 2557 });
2558 } 2559 2560 $.ajax({ 2561 beforeSend: function(){ }, 2562 url: get_ajax_url('eventon_load_event_content'), 2563 data: ajaxdataa, dataType:'json', type: 'POST', 2564 success:function(data){ 2565 $('body').trigger('evo_single_event_content_loaded', [data, obj]); 2566 },complete:function(){ } 2567 }); 2568 }); 2569 2570 if(BODY.evo_is_mobile()){ 2571 if($('body').find('.fb.evo_ss').length != 0){ 2572 $('body').find('.fb.evo_ss').each(function(){ 2573 obj = $(this); 2574 obj.attr({'href':'http://m.facebook.com/sharer.php?u='+obj.attr('data-url')}); 2575 }); 2576 } 2577 } 2578 2579 // on single event page 2580 if($('body').find('.evo_sin_page').length>0){ 2581 $('.evo_sin_page').each(function(){ 2582 $('body').trigger('evo_load_single_event_content',[ $(this).data('eid'), $(this)]); 2583 $(this).find('.desc_trig ').attr({'data-ux_val':'none'}); 2584 }); 2585 } 2586 2587 // Single events box 2588 // Click on single event box 2589 $('.eventon_single_event').on('click', '.evcal_list_a',function(event){ 2590 var obj = $(this); 2591 var CAL = obj.closest('.ajde_evcal_calendar'); 2592 var SC = CAL.evo_shortcode_data(); 2593 2594 event.preventDefault(); 2595 2596 // open in event page 2597 if(SC.ux_val == 4){ 2598 var url = obj.parent().siblings('.evo_event_schema').find('[itemprop=url]').attr('href'); 2599 window.location.href= url; 2600 }else if(SC.ux_val == '2'){ // External Link 2601 var url = SC.exturl; 2602 window.location.href= url; 2603 }else if(SC.ux_val == 'X'){ // do not do anything 2604 return false; 2605 } 2606 }); 2607 // each single event box 2608 $('body').find('.eventon_single_event').each(function(){ 2609 var _this = $(this); 2610 2611 var CAL = _this.closest('.ajde_evcal_calendar'); 2612 var SC = CAL.evo_shortcode_data(); 2613 var evObj = CAL.find('.eventon_list_event'); 2614 2615 // show expanded eventCard 2616 if( SC.expanded =='yes'){ 2617 _this.find('.evcal_eventcard').show(); 2618 var idd = _this.find('.evcal_gmaps'); 2619 2620 // close button 2621 _this.find('.evcal_close').parent().css({'padding-right':0}); 2622 _this.find('.evcal_close').hide(); 2623 2624 //console.log(idd); 2625 var obj = _this.find('.desc_trig'); 2626 2627 // Google Map 2628 _this.find('.evo_metarow_gmap').evo_load_gmap(); 2629 2630 // mark as eventcard open @since 4.4 2631 evObj.find('.event_description').addClass('open'); 2632 2633 // open eventBox and lightbox 2634 }else if(SC.uxval =='3'){ 2635 2636 var obj = _this.find('.desc_trig'); 2637 // remove other attr - that cause to redirect 2638 obj.removeAttr('data-exlk').attr({'data-ux_val':'3'}); 2639 } 2640 2641 // show event excerpt 2642 var ev_excerpt = CAL.find('.event_excerpt').html(); 2643 2644 if(ev_excerpt!='' && ev_excerpt!== undefined && SC.excerpt =='yes' ){ 2645 var appendation = '<div class="event_excerpt_in">'+ev_excerpt+'</div>' 2646 evObj.append(appendation); 2647 } 2648 2649 // trigger support @since 4.4 2650 var obj = evObj.find('.desc_trig'); 2651 var event_id = evObj.data('event_id'); 2652 2653 2654 $('body').trigger('evo_slidedown_eventcard_complete',[ event_id, obj]); 2655 }); 2656 2657 2658// Search Scripts 2659 // Enter key detection for pc 2660 $.fn.evo_enterKey = function (fnc) { 2661 return this.each(function () { 2662 $(this).keypress(function (ev) { 2663 var keycode = (ev.keyCode ? ev.keyCode : ev.which); 2664 if (keycode == '13') { 2665 fnc.call(this, ev); 2666 } 2667 }) 2668 }) 2669 } 2670 2671 BODY.on('evo_cal_header_btn_clicked',function(event, O, CAL){ 2672 if( O.hasClass('evo-search')){ 2673 if( O.hasClass('vis')){ 2674 CAL.find('.evo_search_bar').show(1, function(){ 2675 $(this).find('input').focus(); 2676 }); 2677 }else{ 2678 CAL.find('.evo_search_bar').hide(); 2679 } 2680 } 2681 2682 if( O.hasClass('evo-sort-btn') || O.hasClass('evo-filter-btn')){ 2683 CAL.find('.evo_search_bar').hide(); 2684 } 2685 2686 }); 2687 2688 2689 2690 // Submit search from search box u 4.5.8 2691 $('body').on('click','.evo_do_search',function(){ 2692 do_search_box( $(this) ); 2693 }); 2694 2695 // dynamic enter key press on the search input field @4.2 2696 $(".evo_search_field").evo_enterKey(function () { 2697 do_search_box( $(this).siblings('.evo_do_search') ); 2698 }); 2699 2700 2701 // primary search function 2702 function do_search_box(OBJ){ 2703 SearchVal = OBJ.closest('.evosr_search_box').find('input').val(); 2704 Evosearch = OBJ.closest('.EVOSR_section'); 2705 OBJ.closest('.evo_search_entry').find('.evosr_msg').hide(); 2706 2707 //console.log(SearchVal); 2708 2709 if( SearchVal === undefined || SearchVal == ''){ 2710 OBJ.closest('.evo_search_entry').find('.evosr_msg').show(); 2711 return false; 2712 } 2713 2714 $('body') 2715 .on('evo_ajax_beforesend_evo_get_search_results', function (event, uid){ 2716 Evosearch.find('.evo_search_results_count').hide(); 2717 Evosearch.addClass('searching'); 2718 }).on('evo_ajax_complete_evo_get_search_results', function (event, uid){ 2719 Evosearch.removeClass('searching'); 2720 }).on('evo_ajax_success_evo_get_search_results', function (event, uid, data){ 2721 Evosearch.find('.evo_search_results').html( data.content); 2722 2723 if(Evosearch.find('.no_events').length==0){ 2724 // find event count 2725 Events = Evosearch.find('.evo_search_results').find('.eventon_list_event').length; 2726 Evosearch.find('.evo_search_results_count span').html( Events); 2727 Evosearch.find('.evo_search_results_count').fadeIn(); 2728 } 2729 }); 2730 2731 var ajax_results = OBJ.evo_admin_get_ajax({ 2732 'ajaxdata': { 2733 //action: 'eventon_search_evo_events', 2734 search: SearchVal, 2735 shortcode: Evosearch.find('span.data').data('sc'), 2736 nonce: evo_general_params.n 2737 }, 2738 ajax_type:'endpoint', 2739 ajax_action:'eventon_search_evo_events', 2740 'uid':'evo_get_search_results', 2741 end: 'client' 2742 }); 2743 2744 } 2745 2746 // submit search from calendar 2747 $('body').on('click','.evosr_search_btn',function(){ 2748 search_within_calendar( $(this).siblings('input') ); }); 2749 $(".evo_search_bar_in input").evo_enterKey(function () { 2750 search_within_calendar( $(this) ); }); 2751 2752 function search_within_calendar(obj){ 2753
2754 var ev_cal = obj.closest('.ajde_evcal_calendar'); 2755 2756 ev_cal.evo_update_cal_sc({F:'show_limit_paged',V: '1' }); 2757 ev_cal.evo_update_cal_sc({F:'s',V: obj.val() }); 2758 2759 run_cal_ajax( ev_cal.attr('id'),'none','search'); 2760 2761 return false; 2762 } 2763 2764 // reset search field @since 4.5 2765 $('body').on('evo_main_ajax_complete',function(event,CAL, ajaxtype, responseJSON , data_arg ){ 2766 2767 if(ajaxtype == 'search' ){ 2768 if( data_arg.shortcode['s'] != '' ){ 2769 CAL.find('.evosr_search_clear_btn').addClass('show'); 2770 } 2771 } 2772 }).on('click','.evosr_search_clear_btn',function(event){ 2773 event.preventDefault(); 2774 const obj = $(this); 2775 var ev_cal = obj.closest('.ajde_evcal_calendar'); 2776 ev_cal.evo_update_cal_sc({F:'s',V: '' }); 2777 run_cal_ajax( ev_cal.attr('id'),'none','search'); 2778 2779 obj.removeClass('show'); 2780 obj.siblings('input').val(''); 2781 }); 2782 2783 2784// supportive 2785 // ajax url function @u 4.5.5 2786 function get_ajax_url(action){ 2787 var ajax_type = 'endpoint'; 2788 if('ajax_method' in evo_general_params ) ajax_type = evo_general_params.ajax_method; 2789 return $('body').evo_get_ajax_url({a:action, type: ajax_type }); 2790 } 2791 // handlebar additions 2792 function handlebar_additional_arguments(){ 2793 Handlebars.registerHelper('ifE',function(v1, options){ 2794 return (v1 !== undefined && v1 != '' && v1) 2795 ? options.fn(this) 2796 : options.inverse(this); 2797 }); 2798 2799 Handlebars.registerHelper('ifEQ',function(v1, v2, options){ 2800 return ( v1 == v2)? options.fn(this): options.inverse(this); 2801 }); 2802 Handlebars.registerHelper('ifNEQ',function(v1, v2, options){ 2803 return ( v1 != v2)? options.fn(this): options.inverse(this); 2804 }); 2805 Handlebars.registerHelper('BUStxt',function(V, options){ 2806 if( !( V in BUS.txt) ) return V; 2807 return BUS.txt[V]; 2808 }); 2809 Handlebars.registerHelper('GetDMnames',function(V, U, options){ 2810 return BUS.dms[U][ V ]; 2811 }); 2812 // get total of increments 2813 Handlebars.registerHelper('forAdds',function(count, add_val, options){ 2814 O = ''; 2815 for(x=1; x<= count; x++){ O += add_val; } 2816 return O; 2817 }); 2818 Handlebars.registerHelper('GetEvProp',function(EID, PROP, CALID){ 2819 EID = EID.split('-'); 2820 EV = $('#'+ CALID).find('.evo_cal_events').data('events'); 2821 2822 var O = ''; 2823 $.each(EV, function(i,d){ 2824 if( d.ID == EID[0] && d.ri == EID[1]){ 2825 if( !(PROP in d.event_pmv)) return; 2826 O = d.event_pmv[PROP][0]; 2827 } 2828 }); 2829 return O; 2830 }); 2831 Handlebars.registerHelper('GetEvV',function(EID, PROP, CALID){ 2832 EID = EID.split('-'); 2833 EV = $('#'+ CALID).find('.evo_cal_events').data('events'); 2834 2835 var O = ''; 2836 $.each(EV, function(i,d){ 2837 if( d.ID == EID[0] && d.ri == EID[1]){ 2838 O = d[PROP]; 2839 } 2840 }); 2841 return O; 2842 }); 2843 Handlebars.registerHelper('COUNT',function( V){ 2844 return Object.keys(V).length; 2845 }); 2846 Handlebars.registerHelper('CountlimitLess',function( AR, C,options){ 2847 var L= Object.keys(AR).length; 2848 return ( L < C)? options.inverse(this): options.fn(this); 2849 }); 2850 Handlebars.registerHelper('ifCOND',function(v1, operator, v2, options){ 2851 return checkCondition(v1, operator, v2) 2852 ? options.fn(this) 2853 : options.inverse(this); 2854 }); 2855 Handlebars.registerHelper('toJSON', function(obj) { 2856 return new Handlebars.SafeString(JSON.stringify(obj)); 2857 }); 2858 Handlebars.registerHelper('Cal_def_check',function(V, options){ 2859 if( BUS.cal_def && BUS.cal_def[V] ) return options.fn(this); 2860 return options.inverse(this); 2861 }); 2862 Handlebars.registerHelper('TypeCheck',function(V, options){ 2863 if( options.type == V ) return options.fn(this); 2864 return options.inverse(this); 2865 }); 2866 } 2867 function checkCondition(v1, operator, v2) { 2868 switch(operator) { 2869 case '==': 2870 return (v1 == v2); 2871 case '===': 2872 return (v1 === v2); 2873 case '!==': 2874 return (v1 !== v2); 2875 case '<': 2876 return (v1 < v2); 2877 case '<=': 2878 return (v1 <= v2); 2879 case '>': 2880 return (v1 > v2); 2881 case '>=': 2882 return (v1 >= v2); 2883 case '&&': 2884 return (v1 && v2); 2885 case '||': 2886 return (v1 || v2); 2887 default: 2888 return false; 2889 } 2890 } 2891 // @2.9.1 2892 // increase and reduce quantity 2893 $('body').on('click','.evo_qty_change', function(event){ 2894 var OBJ = $(this); 2895 var QTY = oQTY = parseInt(OBJ.siblings('em').html()); 2896 var MAX = OBJ.siblings('input').attr('max'); 2897 var BOX = OBJ.closest('.evo_purchase_box'); 2898 2899 var pfd = BOX.find('.evo_purchase_box_data').data('pfd'); 2900 2901 2902 (OBJ.hasClass('plu'))? QTY++: QTY--; 2903 2904 QTY =(QTY==0)? 1: QTY; 2905 QTY = (MAX!='' && QTY > MAX)? MAX: QTY; 2906 2907 // new total price 2908 var sin_price = OBJ.parent().data('p'); 2909 new_price = sin_price * QTY; 2910 2911 new_price = get_format_price( new_price, pfd); 2912 2913 BOX.find('.total .value').html( new_price); 2914 2915 OBJ.siblings('em').html(QTY); 2916 OBJ.siblings('input').val(QTY); 2917 2918 $('body').trigger('evo_qty_changed',[QTY,oQTY, new_price,OBJ ]); 2919 }); 2920 2921 // Total formating 2922 function get_format_price(price, data){ 2923 2924 // price format data 2925 PF = data; 2926 2927 totalPrice = price.toFixed(PF.numDec); // number of decimals 2928 htmlPrice = totalPrice.toString().replace('.', PF.decSep); 2929 2930 if(PF.thoSep.length > 0) { 2931 htmlPrice = _addThousandSep(htmlPrice, PF.thoSep); 2932 } 2933 if(PF.curPos == 'right') { 2934 htmlPrice = htmlPrice + PF.currencySymbol; 2935 } 2936 else if(PF.curPos == 'right_space') { 2937 htmlPrice = htmlPrice + ' ' + PF.currencySymbol; 2938 } 2939 else if(PF.curPos == 'left_space') { 2940 htmlPrice = PF.currencySymbol + ' ' + htmlPrice; 2941 } 2942 else { 2943 htmlPrice = PF.currencySymbol + htmlPrice; 2944 } 2945 return htmlPrice; 2946 } 2947 function _addThousandSep(n, thoSep){ 2948 var rx= /(\d+)(\d{3})/; 2949 return String(n).replace(/^\d+/, function(w){ 2950 while(rx.test(w)){ 2951 w= w.replace(rx, '$1'+thoSep+'$2'); 2952 } 2953 return w; 2954 }); 2955 }; 2956 2957// DEPRECATING 2958 // LIGHTBOX 2959 // since 4.2 moving to functions 2960 // open lightbox @2.9 2961 BODY.on('evo_open_lightbox',function(event, lb_class, content){ 2962 const LIGHTBOX = $('.evo_lightbox.'+lb_class).eq(0); 2963 2964 // if already open 2965 if(LIGHTBOX.is("visible")===true) return false; 2966 2967 if( content != ''){ 2968 LIGHTBOX.find('.evo_lightbox_body').html( content ); 2969 } 2970 BODY.trigger('evolightbox_show', [ lb_class ]); 2971 }); 2972 2973 // click outside close LB 2974 BODY.on('clicked_on_page', function(event, obj, ev ){ 2975 if( obj.hasClass('evo_content_inin')){ 2976 closing_lightbox( obj.closest('.evo_lightbox') ); 2977 } 2978 }); 2979 2980 // close popup 2981 BODY.on('click','.evolbclose', function(){ 2982 if( $(this).hasClass('evolb_close_btn')) return; 2983 LIGHTBOX = $(this).closest('.evo_lightbox'); 2984 closing_lightbox( LIGHTBOX ); 2985 }); 2986 2987 // close with click outside popup box when pop is shown 2988 function closing_lightbox( lightboxELM){ 2989 2990 if(! lightboxELM.hasClass('show')) return false; 2991 Close = (lightboxELM.parent().find('.evo_lightbox.show').length == 1)? true: false; 2992 lightboxELM.removeClass('show'); 2993 2994 $('body').trigger('lightbox_before_event_closing', [lightboxELM]); 2995 2996 setTimeout( function(){ 2997 lightboxELM.find('.evo_lightbox_body').html(''); 2998 2999 if(Close){ 3000 $('body').removeClass('evo_overflow'); 3001 $('html').removeClass('evo_overflow'); 3002 } 3003 3004 // trigger action to hook in at this stage 3005 $('body').trigger('lightbox_event_closing', [lightboxELM]); 3006 }, 100); 3007 } 3008 3009 // when lightbox open triggered 3010 $('body').on('evolightbox_show',function(event, lb_class){ 3011 $('.evo_lightboxes').show(); 3012 $('body').addClass('evo_overflow'); 3013 $('html').addClass('evo_overflow'); 3014 3015 $('body').trigger('evolightbox_opened',[ lb_class ]); 3016 }); 3017 3018 3019});
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.