1/** 2 * Javascript code that is associated with the front end of the calendar 3 * version: 2.6.16 4 * updated: 3.0.5 5 */ 6 7jQuery(document).ready(function($){ 8 9 var BODY = $('body'); 10 var BUS = ''; // initial eventon calendar data 11 var ajax_url = ''; 12 13 init(); 14 15// EventON calendar main function 16// 2.8.6 17 $.fn.evo_calendar = function (options) { 18 19 el = this; 20 var cal = {}; 21 var defaults = { 22 'SC': {}, 23 'json':{} 24 }; 25 var calO = {}; 26 27 var init = function(){ 28 calO = el.O = $.extend({},defaults, options); 29 30 // load shortcodes to calendar 31 if( calO.SC !== undefined){ 32 el.evo_cal_functions({action:'update_shortcodes',SC: calO.SC}); 33 } 34 35 // load events json to calednar 36 if( calO.json !== undefined){ 37 el.find('.evo_cal_events').data('events', calO.json); 38 } 39 40 load_maps(); 41 interactions(); 42 }; 43 44 var load_maps = function(){ 45 if(calO.SC.evc_open == 'yes'){ 46 el.find('.desc_trig').each(function(index){ 47 var self = this; 48 setTimeout(function(){ 49 $(self).evoGenmaps({'fnt':2,'cal': el}); 50 },index*600); 51 }); 52 } 53 }; 54 55 var interactions = function(){ 56 close_eventcard(); 57 58 counters(); 59 } 60 61 62 var counters = function(){ 63 $(el).find('.evo_countdowner').each(function(){ 64 $(this).evo_countdown(); 65 }); 66 } 67 68 var close_eventcard = function(){ 69 $(el).on('click','.evcal_close',function(){ 70 $(this).closest('.evcal_eventcard').slideUp().removeClass('open'); 71 }); 72 } 73 74 75 init(); 76 }; 77 78// localize event time function 79 $.fn.evo_local_time = function( options){ 80 el = this; 81 82 $(el).find('.evo_mytime').each(function(){ 83 const obj = $(this); 84 const event_obj = obj.closest('.eventon_list_event'); 85 var time = obj.data('times'); 86 var tformat = obj.data('tform'); 87 88 new_time = time.split('-'); 89 90 utc_offset = $(this).data('tzo'); 91 92 start = parseInt(new_time[0]); 93 end = parseInt(new_time[1]); 94 offset_start = start + utc_offset; 95 96 // end 97 var Me = moment.unix( end + utc_offset ).utc().local(); 98 var M1 = moment.unix( offset_start ).utc().local(); 99 100 var _html = ''; 101 102 if( Me.format('YYYY/M') != M1.format('YYYY/M')){ 103 _html = M1.format( tformat ) +' - '+ Me.format( tformat ); 104 }else{ 105 _html = M1.format( tformat ); 106 } 107 108 event_obj.find('.evo_mytime').find('b').html( _html ); 109 110 111 event_obj.find('.evo_mytime').removeClass('tzo_trig'); 112 113 }); 114 115 }; 116 // user local time 117 BODY.on('click','.tzo_trig',function(event){ 118 event.preventDefault(); 119 event.stopPropagation(); 120 $(this).parent().evo_local_time(); 121 return; 122 }); 123 124 BODY.on('calendar_month_changed',function(event, CAL){ 125 //CAL.evo_local_time(); 126 }); 127 128// RUN on Page load 129 function init(){ 130 131 ajax_url = the_ajax_script.ajax_method=='ajax' ?
132 the_ajax_script.ajaxurl: the_ajax_script.rurl + 'eventon/v1/data?action=init'; 133 134 init_run_gmap_openevc(); 135 fullheight_img_reset(); 136 137 init_load_cal_data(); 138 handlebar_additional_arguments(); 139 140 // run basic countdown timers 141 BODY.find('.evo_countdowner').each(function(){ 142 $(this).evo_countdown(); 143 }); 144 } 145 146// Initial load data via ajax 147 function init_load_cal_data(){ 148 149 // check if calendars are present in the page 150 if( $('body').find('.ajde_evcal_calendar').length == 0 ) return false; 151 152 var data_arg = {action: 'eventon_init_load'}; 153 154 BODY = $('body'); 155 BODY.trigger('evo_global_page_run'); 156 157 data_arg['global'] = $('#evo_global_data').data('d'); 158 data_arg['cals'] ={}; 159 160 // pass ajax loading calendar shortcodes 161 $('body').find('.ajax_loading_cal').each(function(){ 162 CAL = $(this); 163 SC = CAL.find('.evo_cal_data').data('sc'); 164 165 data_arg['cals'][ CAL.attr('id')] = {}; 166 data_arg['cals'][ CAL.attr('id')]['sc'] = SC; 167 }); 168 169 $.ajax({ 170 beforeSend: function(){}, 171 type: 'POST', 172 url: ajax_url, 173 data: data_arg, 174 dataType:'json', 175 success:function(data){ 176 $('#evo_global_data').data('d', data); 177 178 BUS = data; 179 180 // append html to calendars if present 181 if('cals' in data){ 182 var time = 300; 183 $.each(data.cals, function(i,v){ 184 setTimeout( function(){ 185 186 CAL = BODY.find('#'+ i); 187 188 if(CAL.length === 0) return; 189 190 if('html' in v){ 191 CAL.find('#evcal_list').html( v.html ); 192 CAL.removeClass('ajax_loading_cal'); 193 CAL.find('.evo_ajax_load_events').remove(); 194 195 //CAL.evo_local_time(); 196 } 197 198 CAL.evo_calendar({ 199 SC:v.sc, 200 json: v.json 201 }); 202 203 $('body').trigger('evo_init_ajax_success_each_cal', [data, i, v]); 204 205 }, time); 206 time += 300; 207 }); 208 } 209 210 $('body').trigger('evo_init_ajax_success', [data]); 211 212 },complete:function(data){ 213 // process all calendars in the page 214 $('body').find('.ajde_evcal_calendar').each(function(){ 215 if($(this).hasClass('.ajax_loading_cal')) return; 216 $(this).evo_calendar(); 217 }); 218 } 219 }); 220 221 } 222 223 224// Other 225 226 // LIGHTBOX 227 // open lightbox @2.9 228 $('body').on('evo_open_lightbox',function(event, lb_class, content){ 229 const LIGHTBOX = $('.evo_lightbox.'+lb_class).eq(0); 230 231 // if already open 232 if(LIGHTBOX.is("visible")===true) return false; 233 234 if( content != ''){ 235 LIGHTBOX.find('.evo_lightbox_body').html( content ); 236 } 237 $('body').trigger('evolightbox_show', [ lb_class ]); 238 }); 239 // close popup 240 BODY.on('click','.evolbclose', function(){ 241 LIGHTBOX = $(this).closest('.evo_lightbox'); 242 closing_lightbox( LIGHTBOX ); 243 }); 244 245 // close with click outside popup box when pop is shown 246 $(document).on('click', function(event) { 247 //event.stopPropagation(); 248 //console.log($(event.target)); 249 if( 250 $(event.target).hasClass('evo_content_inin') 251 ){ 252 closing_lightbox( $(event.target).closest('.evo_lightbox') ); 253 //console.log('5'); 254 } 255 }); 256 function closing_lightbox( lightboxELM){ 257 258 if(! lightboxELM.hasClass('show')) return false; 259 Close = (lightboxELM.parent().find('.evo_lightbox.show').length == 1)? true: false; 260 lightboxELM.removeClass('show'); 261 262 $('body').trigger('lightbox_before_event_closing', [lightboxELM]); 263 264 setTimeout( function(){ 265 lightboxELM.find('.evo_lightbox_body').html(''); 266 267 if(Close){ 268 $('body').removeClass('evo_overflow'); 269 $('html').removeClass('evo_overflow'); 270 } 271 272 // trigger action to hook in at this stage 273 $('body').trigger('lightbox_event_closing', [lightboxELM]); 274 }, 500); 275 } 276 277 // when lightbox open triggered 278 $('body').on('evolightbox_show',function(event, lb_class){ 279 $('.evo_lightboxes').show(); 280 $('body').addClass('evo_overflow'); 281 $('html').addClass('evo_overflow'); 282 283 $('body').trigger('evolightbox_opened',[ lb_class ]); 284 }); 285 286 // OPENING event card -- USER INTREACTION and loading google maps 287 //event full description\ 288 $('body').on('click','.eventon_events_list .desc_trig', function(event){ 289 290 var obj = $(this); 291 292 var attr = obj.closest('.evo_lightbox').attr('data-cal_id'); 293 if(typeof attr !== typeof undefined && attr !== false){ 294 var cal_id = attr; 295 var CAL = cal = $('#'+cal_id); 296 }else{ 297 var CAL = cal = obj.closest('.ajde_evcal_calendar'); 298 } 299 300 SC = CAL.evo_shortcode_data(); 301 302 var evodata = cal.find('.evo-data'); 303 304 click_sinev_box = (obj.closest('.eventon_single_event').length>0 && evodata.data('exturl')) ? true: false;
305 const event_id = obj.closest('.eventon_list_event').data('event_id'); 306 var event_list = obj.closest('.eventon_events_list'); 307 308 309 // whole calendar specific values 310 var cal_ux_val = SC.ux_val; 311 312 // event specific values 313 var ux_val = obj.data('ux_val'); 314 var exlk = obj.data('exlk'); 315 316 // override overall calendar user intereaction OVER individual event UX 317 if(cal_ux_val!='' && cal_ux_val!== undefined && cal_ux_val!='0'){ 318 ux_val = cal_ux_val; 319 } 320 321 //console.log(ux_val); 322 323 // open as lightbox 324 if(ux_val=='3' || ux_val == '3a'){ 325 event.preventDefault(); 326 327 // set elements 328 EVO_LIGHTBOX = $('.evo_lightbox.eventcard'); 329 LIGHTBOX_body = EVO_LIGHTBOX.find('.evo_lightbox_body'); 330 331 332 repeat_interval = parseInt(obj.closest('.eventon_list_event').data('ri')); 333 repeat_interval = (repeat_interval)? repeat_interval: '0'; 334 335 // resets 336 EVO_LIGHTBOX.find('.evo_pop_body').show(); 337 fullheight_img_reset(); 338 LIGHTBOX_body.html(''); 339 340 // RTL 341 if(event_list.hasClass('evortl')){ 342 EVO_LIGHTBOX.find('.evo_popin').addClass('evortl'); 343 EVO_LIGHTBOX.addClass('evortl'); 344 } 345 346 347 // AJAX via lightbox 348 if(ux_val == '3a'){ 349 350 var new_content = ''; 351 new_content += '<div class="evo_cardlb" style="padding:10px 10px 0 10px">'; 352 new_content += '<div style="margin-bottom:20px; width:100%; height:200px" class="evo_preloading"></div>'; 353 const box = '<div style="display:flex;justify-content: space-between;margin-bottom:10px"><div style="width:40px;height:40px; margin-right:20px" class="evo_preloading"></div> <div style="flex:1 0 auto"> <div class="evo_preloading" style="width:70%; height:20px; margin-bottom:10px"></div><div class="evo_preloading" style="width:100%; height:80px; margin-bottom:10px"></div> </div> </div>'; 354 new_content += box + box + box; 355 new_content += '</div>'; 356 357 LIGHTBOX_body.append('<div class="evopop_top">'+ obj.html() +'</div>') 358 LIGHTBOX_body.append( new_content ); 359 360 LIGHTBOX_body.attr('class','evo_lightbox_body eventon_list_event evo_pop_body evcal_eventcard event_'+event_id +'_'+ repeat_interval); 361 362 363 var data_arg = {}; 364 data_arg['event_id'] = parseInt( event_id); 365 data_arg['ri'] = repeat_interval; 366 data_arg['lang'] = SC.lang; 367 data_arg['action'] = 'eventon_load_single_eventcard_content'; 368 369 var ra = true; 370 371 // load event content via ajax 372 if(ra){ 373 $.ajax({ 374 beforeSend: function(){}, 375 type: 'POST', 376 url:the_ajax_script.ajaxurl, 377 data: data_arg, 378 dataType:'json', 379 success:function(data){ 380 381 if(data. status == 'good'){ 382 LIGHTBOX_body.html( data.html ); 383 384 LIGHTBOX_body.find('.evo_eventtop') 385 .evoGenmaps({ 386 'fnt':2 , 387 'cal':cal, 388 }); 389 390 fullheight_img_reset(); 391 392 // trigger 393 if( obj.data('runjs')) $('body').trigger('evo_load_single_event_content',[ event_id, obj]); 394 395 LIGHTBOX_body.evo_local_time(); 396 397 } 398 399 },complete:function(){ 400 $('body').trigger('evo_single_event_load_end'); 401 } 402 }); 403 } 404 405 }else{ 406 407 var content = obj.closest('.eventon_list_event').find('.event_description').html(); 408 var _content = $(content).not('.evcal_close'); 409 410 LIGHTBOX_body.append('<div class="evopop_top">'+ obj.html() +'</div>').append(_content); 411 LIGHTBOX_body.attr('class','evo_lightbox_body eventon_list_event evo_pop_body evcal_eventcard event_'+event_id +'_'+ repeat_interval); 412 413 LIGHTBOX_body.find('.evopop_top').evoGenmaps({ 'fnt':2 ,'cal':cal }); 414 } 415 416 417 418 EVO_LIGHTBOX.addClass('show'); 419 $('body').trigger('evolightbox_show'); 420 421 fullheight_img_reset(); // added second reset 422 423 // update border color 424 bgcolor = $('.evo_pop_body').find('.evcal_cblock').attr('data-bgcolor'); 425 $('.evo_pop_body').find('.evopop_top').css({'border-left':'3px solid '+bgcolor}); 426 427 // trigger 428 if( obj.data('runjs')){ 429 $('body').trigger('evo_load_single_event_content',[ event_id, obj]); 430 } 431 432 $('body').trigger('evolightbox_end'); 433 return false;
434 435 // open in single events page 436 }else if(ux_val=='4'){ 437 438 var url = obj.attr('href'); 439 440 if( url =='' || url === undefined){ 441 442 url = obj.parent().siblings('.evo_event_schema').find('a').attr('href'); 443 window.open(url, '_self'); 444 } 445 446 //if(obj.attr('target') != '_blank') window.open(url, '_self'); 447 448 return; 449 450 // open in single events page in new window 451 }else if(ux_val=='4a'){ 452 453 if( obj.attr('href')!='' && obj.attr('href')!== undefined){ 454 return; 455 }else{ 456 var url = obj.parent().siblings('.evo_event_schema').find('a').attr('href'); 457 window.open(url); 458 return false; 459 } 460 461 // open as external link 462 }else if(ux_val=='2'){ 463 //var url = obj.parent().siblings('.evo_event_schema').find('a').attr('href'); 464 var url = obj.attr('href'); 465 466 // if the click is coming from single event box 467 if( click_sinev_box ){ 468 event.preventDefault(); 469 return false; 470 } 471 472 //console.log(url); 473 if(url !== undefined && url != ''){ 474 if(obj.attr('target') == '_blank'){ 475 var win = window.open(url, '_blank'); 476 win.focus(); 477 }else{ 478 window.open(url, '_self'); 479 } 480 481 event.preventDefault(); 482 } 483 return true; 484 485 // do not do anything 486 }else if(ux_val=='X'){ 487 return false; 488 }else if(ux_val=='none'){ 489 return false; 490 }else{ 491 492 // redirecting to external link 493 if(exlk=='1' && ux_val!='1'){ 494 // if there is no href 495 if( obj.attr('href')!='' && obj.attr('href')!== undefined){ 496 return; 497 }else{ 498 var url = obj.siblings('.evo_event_schema').find('a').attr('href'); 499 if(obj.attr('target') == '_blank'){ window.open(url);}else{ window.open(url, '_self');} 500 501 event.preventDefault(); 502 return false; 503 } 504 // SLIDE DOWN eventcard 505 }else{ 506 507 var event_box = obj.closest('.eventon_list_event'); 508 var click_item = event_box.find('.event_description'); 509 510 if(click_item.hasClass('open')){ 511 event_box.removeClass('open'); 512 click_item.slideUp().removeClass('open'); 513 }else{ 514 // accordion 515 if( SC.accord == 'yes'){ 516 cal.find('.eventon_list_event').removeClass('open');
517 cal.find('.event_description').slideUp().removeClass('open'); 518 } 519 event_box.addClass('open'); 520 click_item.slideDown().addClass('open'); 521 } 522 523 // This will make sure markers and gmaps run once and not multiples 524 if( obj.attr('data-gmstat')!= '1'){ 525 526 obj.attr({'data-gmstat':'1'}); 527 obj.evoGenmaps({ 528 'fnt':2 , 529 'cal':cal, 530 }); 531 } 532 533 // trigger 534 if( obj.data('runjs')){ 535 $('body').trigger('evo_load_single_event_content',[ event_id, obj]); 536 } 537 538 $('body').trigger('evo_slidedown_eventcard_complete',[ event_id, obj]); 539 540 return false; 541 } 542 } 543 }); 544 545 // call to run google maps on load 546 function init_run_gmap_openevc(delay){ 547 $('.ajde_evcal_calendar').each(function(){ 548 549 var CAL = $(this); 550 var SC = CAL.evo_shortcode_data(); 551 552 if( SC === undefined || SC === null) return; 553 554 if( typeof SC !== 'object' ){ 555 SC = JSON.parse(SC); 556 } 557 558 if( 'evc_open' in SC && SC.evc_open =='yes'){ 559 560 $(this).find('.desc_trig').each(function(){ 561 if(delay!='' && delay !== undefined){ 562 $(this).evoGenmaps({'fnt':2, 'cal': CAL, 'delay':delay}); 563 }else{ 564 $(this).evoGenmaps({'fnt':2,'cal': CAL }); 565 } 566 }); 567 } 568 }); 569 } 570 571 572 // Calendar Interaction 573 // event bubbles 574 $('.ajde_evcal_calendar.bub').on('mouseover','.eventon_list_event', function(){ 575 O = $(this); 576 LIST = O.closest('.eventon_events_list'); 577 title = O.find('.evcal_event_title').html(); 578 579 p = O.position(); 580 581 LIST.append('<span class="evo_bub_box" style="">'+ title +"</span>"); 582 B = LIST.find('.evo_bub_box'); 583 584 l = p.left; 585 t = p.top- B.height() -30; 586 587 // adjust bubble to left if event on right edge 588 LM = LIST.width(); 589 tl = p.left + B.width() + O.width(); 590 if( tl > LM){ 591 l = l - B.width() +O.width()-20; 592 } 593 594 B.css({'top':t, 'left':l}); 595 596 LIST.find('.evo_bub_box').addClass('show'); 597 }).on('mouseout',function(){ 598 B = $(this).find('.evo_bub_box').remove(); 599 }); 600 601 // Click on eventtop items 602 $('body').on('click','.evocmd_button', function(event){ 603 event.preventDefault(); 604 event.stopPropagation(); 605 606 href = $(this).data('href'); 607 if( $(this).data('target')=='yes'){ 608 window.open(href,'_blank'); 609 }else{ 610 window.location = href; 611 } 612 613 }); 614 615 // GO TO TODAY 616 // @+ 2.3 @up 2.8 617 $('body').on('click','.evo-gototoday-btn', function(){ 618 var obj = $(this); 619 CAL = obj.closest('.ajde_evcal_calendar'); 620 var calid = CAL.attr('id'); 621 622 CAL.evo_update_cal_sc({F:'fixed_month', V: obj.data('mo')}); 623 CAL.evo_update_cal_sc({F:'fixed_year', V: obj.data('yr')}); 624 625 run_cal_ajax( calid,'none','today'); 626 obj.fadeOut(); 627 }); 628 629 $('body').on('evo_main_ajax_before', function(event, CAL, ajaxtype){ 630 if(ajaxtype == 'switchmonth') CAL.find('.evo-gototoday-btn').fadeIn(); 631 }); 632 $('body').on('evo_main_ajax_complete', function(event, CAL,ajaxtype, D , data_arg){ 633 // if focused month and year are same as current month and year hide the current month button 634 var N = moment().utc(); 635 SC = CAL.evo_shortcode_data(); 636 637 var SU = parseInt( SC.focus_start_date_range); 638 var M = moment.unix(SU).utc(); 639 640 if( N.format('YYYY M') == M.format('YYYY M')){ 641 CAL.find('.evo-gototoday-btn').fadeOut(); 642 } 643 644 // load countdown timers 645 BODY.find('.evo_countdowner').each(function(){ 646 $(this).evo_countdown(); 647 }); 648 649 }); 650 651 // MONTH jumper
652 $('.ajde_evcal_calendar').on('click','.evo-jumper-btn', function(){ 653 $(this).parent().siblings().find('.evo_j_container').slideToggle(); 654 }); 655 656 // select a new time from jumper 657 $('.evo_j_dates').on('click','a',function(){ 658 var val = $(this).attr('data-val'), 659 type = $(this).parent().parent().attr('data-val'), 660 CAL = $(this).closest('.ajde_evcal_calendar'); 661 SC = CAL.evo_shortcode_data(); 662 663 if(type=='m'){ // change month 664 CAL.evo_update_cal_sc({F:'fixed_month', V: val }); 665 }else{ 666 CAL.evo_update_cal_sc({F:'fixed_year', V: val }); 667 } 668 669 run_cal_ajax( CAL.attr('id') ,'none','jumper'); 670 671 // hide month jumper if not set to leave expanded 672 if(SC.expj =='no') container.delay(2000).slideUp(); 673 }); 674 675 // RESET general calendar 676 // @U 2.8.9 677 function cal_resets(calOBJ){ 678 calargs = $(calOBJ).find('.cal_arguments'); 679 calargs.attr('data-show_limit_paged', 1 ); 680 681 calOBJ.evo_update_cal_sc({ 682 F:'show_limit_paged',V:'1' 683 }); 684 } 685 686 // change IDs for map section for eventon widgets 687 if( $('.ajde_evcal_calendar').hasClass('evcal_widget')){ 688 cal.find('.evcal_gmaps').each(function(){ 689 var gmap_id = obj.attr('id'); 690 var new_gmal_id =gmap_id+'_widget'; 691 obj.attr({'id':new_gmal_id}) 692 }); 693 } 694 695 // Tab view switcher 696 $('body').find('.evo_tab_container').each(function(){ 697 $(this).find('.evo_tab_section').each(function(){ 698 if(!$(this).hasClass('visible')){ 699 $(this).addClass('hidden'); 700 } 701 }); 702 }); 703 $('body').on('click','.evo_tab',function(){ 704 tab = $(this).data('tab'); 705 tabsection = $(this).closest('.evo_tab_view').find('.evo_tab_container'); 706 tabsection.find('.evo_tab_section').addClass('hidden').removeClass('visible'); 707 tabsection.find('.'+tab).addClass('visible').removeClass('hidden'); 708 709 $(this).parent().find('.evo_tab').removeClass('selected'); 710 $(this).addClass('selected'); 711 }); 712 // layout view changer 713 if($('body').find('.evo_layout_changer').length>0){ 714 // menu button focus adjust 715 $('body').find('.evo_layout_changer').each(function(item){ 716 if($(this).parent().hasClass('boxy')){ 717 $(this).find('.fa-th-large').addClass('on'); 718 }else{ 719 $(this).find('.fa-reorder').addClass('on'); 720 } 721 }); 722 723 // interaction 724 $('.evo_layout_changer').on('click','i',function(){ 725 const CAL = $(this).closest('.ajde_evcal_calendar'); 726 TYPE = $(this).data('type'); 727 $(this).parent().find('i').removeClass('on'); 728 $(this).addClass('on'); 729 730 //console.log(TYPE); 731 732 if(TYPE=='row'){ 733 CAL.attr('class','ajde_evcal_calendar'); 734 // set tile colors 735 CAL.find('.eventon_list_event').each(function(){ 736 $(this).find('.desc_trig').css('background-color', ''); 737 $(this).find('.desc_trig_outter').css('background-color', ''); 738 }); 739 }else if(TYPE =='bar'){ 740 CAL.attr('class','ajde_evcal_calendar box_2 sev cev'); 741 742 // set tile colors 743 CAL.find('.eventon_list_event').each(function(){ 744 const color = $(this).data('colr'); 745 $(this).find('.desc_trig').css('background-color', color); 746 }); 747 }else{ 748 749 // set tile colors 750 CAL.find('.eventon_list_event').each(function(){ 751 const color = $(this).data('colr'); 752 $(this).find('.desc_trig_outter').css('background-color', color); 753 }); 754 755 CAL.attr('class','ajde_evcal_calendar boxy boxstyle0 box_2'); 756 } 757 }); 758 } 759 760 // SORTING & FILTERING 761 // display sort section 762 $('.evo-filter-btn').click(function(){ 763 CAL = $(this).closest('.ajde_evcal_calendar'); 764 line = CAL.find('.eventon_sorting_section'); 765 if(line.is(':visible')){ 766 line.hide(); 767 $(this).removeClass('show'); 768 }else{ 769 line.show(); 770 $(this).addClass('show'); 771 } 772 // hide sort menu 773 CAL.find('.eventon_sort_line').hide(); 774 }); 775 776 // SORTing 777 $('.evo-sort-btn').click(function(){ 778 line = $(this).find('.eventon_sort_line'); 779 if(line.is(':visible')){ 780 line.hide(); 781 $(this).removeClass('show'); 782 }else{ 783 line.show(); 784 $(this).addClass('show'); 785 } 786 }); 787 788 // update calendar based on the sorting selection 789 $('.eventon_sort_line').on('click','p',function(){ 790 O = $(this); 791 var CAL = O.closest('.ajde_evcal_calendar'); 792 var sort_by = O.data('val'); 793 794 // update new values everywhere 795 CAL.evo_update_cal_sc({F:'sort_by',V:sort_by}); 796 797 O.parent().find('p').removeClass('select'); 798 O.addClass('select'); 799 800 run_cal_ajax(CAL.attr('id'),'none','sorting'); 801 }); 802 803 // filtering section open and close menu 804 $('.filtering_set_val').click(function(){ 805 // close sorting 806 sortSelect = $(this).closest('.eventon_sorting_section').find('.evo_srt_options'); 807 if(sortSelect.is(':visible') == true) sortSelect.fadeToggle(); 808 809 var obj = $(this); 810 var current_Drop = obj.siblings('.eventon_filter_dropdown'); 811 var current_drop_pare = obj.closest('.eventon_filter'); 812 813 current_drop_pare.siblings('.eventon_filter').find('.eventon_filter_dropdown').each(function(){ 814 if($(this).is(':visible')== true ){ 815 $(this).hide(); 816 $(this).siblings('p').removeClass('show'); 817 } 818 }); 819 820 if(current_Drop.is(':visible')== true){ 821 obj.siblings('.eventon_filter_dropdown').fadeOut('fast'); 822 obj.removeClass('show'); 823 }else{ 824 obj.siblings('.eventon_filter_dropdown').fadeIn('fast'); 825 obj.addClass('show'); 826 } 827 }); 828 829 // selection on filter dropdown list 830 $('.eventon_filter_dropdown').on('click','p',function(){ 831 var new_filter_val = $(this).data('filter_val'), 832 O = $(this), 833 filter_section = $(this).closest('.eventon_filter_line'); 834 var filter = $(this).closest('.eventon_filter');
835 var filter_current_set_val = filter.data('filter_val'); 836 var select_filter_type = filter_section.hasClass('selecttype')? true:false; 837 FILTER_DROPDOWN = $(this).parent(); 838 CAL = $(this).closest('.ajde_evcal_calendar'); 839 840 //console.log(new_filter_val); 841 842 843 // for filter values with checkboxes 844 if(select_filter_type){ 845 val = ''; 846 847 // NOT all 848 if( new_filter_val != 'all'){ 849 O.parent().find('p.all').removeClass('select'); 850 O.toggleClass('select'); 851 852 var unselect_count = 0; 853 O.parent().find('p').each(function(){ 854 if( $(this).hasClass('select')){ 855 val += $(this).data('filter_val')+','; 856 }else{ 857 if(!$(this).hasClass('all')) unselect_count++; 858 } 859 }); 860 861 // all selected 862 if(unselect_count == 0){ 863 O.parent().find('p.all').addClass('select'); 864 val = 'all'; 865 } 866 867 // remove comma at the end 868 val = ( val.slice(-1) == ',')? val.slice(0,-1): val; 869 870 // if all field is not visible; nothing selected = all 871 if(val == '' && O.parent().find('p.all').length == 0) val='all'; 872 873 // == all 874 }else{ 875 if( O.hasClass('select')){ 876 O.parent().find('p').removeClass('select'); 877 }else{ 878 O.parent().find('p').addClass('select'); 879 val = 'all'; 880 } 881 } 882 883 filter.data('filter_val',val); // v 2.7.4 884 885 // regular selecting 886 }else{ 887 if( new_filter_val == 'all'){ 888 O.parent().find('p').addClass('select'); 889 }else{ 890 O.parent().find('p').removeClass('select'); 891 O.addClass('select'); 892 } 893 } 894 895 // if select filter type 896 if(select_filter_type) return; 897 898 899 // For non checkbox select options 900 if(filter_current_set_val == new_filter_val){ 901 $(this).parent().fadeOut(); 902 }else{ 903 cal_resets( CAL ); 904 905 // make changes 906 filter.data('filter_val', new_filter_val); 907 908 CAL.evo_update_sc_from_filters(); 909 910 run_cal_ajax( CAL.attr('id') ,'none','filering'); 911 912 // reset the new values 913 var new_filter_name = $(this).html(); 914 915 O.parent().fadeOut(); 916 O.parent().siblings('.filtering_set_val').removeClass('show'); 917 } 918 }); 919 920 // apply filters via button to the calendar 921 $('.eventon_filter_dropdown').on('change','input',function(event){ 922 FILTER = $(this).closest('.eventon_filter'); 923 924 val = ''; 925 FILTER.find('input').each(function(){ 926 val = ($(this).is(':checked'))? val + $(this).data('filter_val') +',': val; 927 }); 928 val = (val=='')? '':val; // v2.5.2 929 FILTER.data('filter_val',val); // v 2.7.4 930 }); 931 // apply filters 932 $('body').on('click','.evo_filter_submit',function(){ 933 // fadeout any open filter dropdowns 934 $(this).closest('.eventon_filter_line').find('.eventon_filter_dropdown').fadeOut(); 935 $(this).closest('.eventon_filter_line').find('.filtering_set_val').removeClass('show'); 936 937 CAL = $(this).closest('.ajde_evcal_calendar'); 938 cal_resets( CAL); 939 940 CAL.evo_update_sc_from_filters(); // update shortcode from filters 941 942 run_cal_ajax(CAL.attr('id'),'none','filering'); 943 }); 944 945 // CAL BODY Listeners 946 $('body') 947 // Show more events on list 948 .on('click','.evoShow_more_events', function(){ 949 CAL = $(this).closest('.ajde_evcal_calendar'); 950 SC = CAL.evo_shortcode_data(); 951 952 OBJ = $(this); 953 954 // redirect to an external link 955 if(SC.show_limit_redir !== ''){ 956 window.location = SC.show_limit_redir; return false; 957 } 958 959 // ajax pagination 960 if( SC.show_limit_ajax =='yes'){ 961 CURRENT_PAGED = parseInt(SC.show_limit_paged); 962 CAL.evo_update_cal_sc({F:'show_limit_paged', V: CURRENT_PAGED+1}); 963 run_cal_ajax( CAL.attr('id'), 'none','paged'); 964 965 }else{ 966 var event_count = parseInt( SC.event_count ); 967 968 var eventList = OBJ.parent(); 969 var allEvents = eventList.find('.eventon_list_event').length; 970 971 var currentShowing = eventList.find('.eventon_list_event:visible').length; 972 973 for(x=1; x<=event_count ; x++ ){ 974 var inde = currentShowing+x-1; 975 eventList.find('.eventon_list_event:eq('+ inde+')').slideDown(); 976 } 977 978 // hide view more button 979 if(allEvents > currentShowing && allEvents<= (currentShowing+event_count)){ 980 $(this).fadeOut(); 981 } 982 } 983 984 }) 985 // MONTH switch 986 .on('click','.evcal_btn_prev', function(){ 987 var cal_id = $(this).closest('.ajde_evcal_calendar').attr('id'); 988 var direction = $(this).closest('.ajde_evcal_calendar').hasClass('evortl')? 'next': 'prev'; 989 run_cal_ajax(cal_id, direction ,'switchmonth'); 990 }) 991 .on('click','.evcal_btn_next',function(){ 992 var cal_id = $(this).closest('.ajde_evcal_calendar').attr('id'); 993 var direction = $(this).closest('.ajde_evcal_calendar').hasClass('evortl')? 'prev': 'next'; 994 run_cal_ajax(cal_id, direction ,'switchmonth'); 995 }) 996 997 // JUMPER switch 998 .on('calendar_month_changed',function(event, CAL){ 999 SC = CAL.evo_shortcode_data(); 1000 1001 var O = CAL.find('.evo_j_container'); 1002 O.find('.evo_j_months a').removeClass('set'); 1003 O.find('.evo_j_months a[data-val="'+ SC.fixed_month +'"]').addClass('set'); 1004 1005 O.find('.evo_j_years a').removeClass('set'); 1006 O.find('.evo_j_years a[data-val="'+ SC.fixed_year +'"]').addClass('set'); 1007 1008 // show go to today 1009 B = CAL.find('.evo-gototoday-btn'); 1010 if( SC.fixed_month != B.data('mo') || SC.fixed_year != B.data('yr')){ 1011 B.show(); 1012 } 1013 }) 1014 1015 // View Switcher 1016 .on('click', '.evo_vSW',function(){ 1017 O = $(this); 1018 if(O.hasClass('focus')) return; 1019 O.siblings('.evo_vSW').removeClass('focus'); 1020 O.addClass('focus'); 1021 CAL = O.closest('.ajde_evcal_calendar'); 1022 CAL.find('.evoADDS').fadeOut().delay(200).queue(function(){ 1023 $(this).remove(); 1024 }); 1025 1026 if(O.hasClass('evoD')){ 1027 CAL.evo_update_cal_sc({F:'calendar_type', V: 'default'}); 1028 //SC = CAL.evo_shortcode_data(); 1029 CAL.find('#evcal_list').removeClass('evo_hide'); 1030 CAL.find('.eventon_list_event').show(); 1031 } 1032 1033 $('body').trigger('evo_vSW_clicked', [ O, CAL]); 1034 }) 1035 // show more/less event details 1036 .on('click','.evobtn_details_show_more',function(){ 1037 control_more_less( $(this)); 1038 }) 1039 // refresh now calendar 1040 .on('runajax_refresh_now_cal',function(e, OBJ, nonce){ 1041 var dataA = { 1042 action: 'eventon_refresh_now_cal', 1043 nonce: nonce, 1044 other: OBJ.data() 1045 }; 1046 1047 const section = OBJ.closest('.evo_eventon_live_now_section'); 1048 1049 $.ajax({ 1050 beforeSend: function(){ 1051 section.addClass('evoloading'); 1052 }, 1053 type: 'POST',url:the_ajax_script.ajaxurl,data: dataA,dataType:'json', 1054 success:function(data){ 1055 1056 if( data.status == 'good'){ 1057 section.html( data.html); 1058 } 1059 1060 },complete:function(data){ 1061 section.removeClass('evoloading'); 1062 1063 BODY.find('.evo_countdowner').each(function(){ 1064 $(this).evo_countdown(); 1065 }); 1066 } 1067 1068 }); 1069 }); 1070 ; 1071 1072 // PRIMARY hook to get content 1073 // MAIN AJAC for calendar events v2.8 1074 function run_cal_ajax( cal_id, direction, ajaxtype){ 1075 1076 // identify the calendar and its elements. 1077 var CAL = ev_cal = $('#'+cal_id); 1078 1079 // check if ajax post content should run for this calendar or not 1080 if(CAL.attr('data-runajax')!='0'){ 1081 1082 // category filtering for the calendar 1083 var cat = CAL.find('.evcal_sort').attr('cat'); 1084 1085 // reset paged values for switching months 1086 if(ajaxtype=='switchmonth'){ 1087 CAL.find('.cal_arguments').attr('data-show_limit_paged',1); 1088 CAL.evo_update_cal_sc({F:'show_limit_paged', V: '1'}); 1089 } 1090 1091 SC = CAL.evo_shortcode_data(); 1092 1093 $('body').trigger('evo_main_ajax_before', [CAL, ajaxtype, direction, SC]); 1094 1095 var data_arg = { 1096 action: 'the_ajax_hook', 1097 direction: direction, 1098 shortcode: SC, 1099 ajaxtype: ajaxtype, 1100 }; 1101 1102 EVENTS_LIST = ev_cal.find('.eventon_events_list'); 1103 1104 $.ajax({ 1105 beforeSend: function(){ 1106 ev_cal.addClass('evo_loading'); 1107 if(ajaxtype != 'paged') EVENTS_LIST.slideUp('fast'); 1108 1109 if(ajaxtype == 'paged'){ 1110 txt = EVENTS_LIST.find('.evoShow_more_events').html(); 1111 EVENTS_LIST.find('.evoShow_more_events').html('. . .').data('txt',txt); 1112 } 1113 ev_cal.evo_loader_animation(); 1114 }, 1115 type: 'POST',url:the_ajax_script.ajaxurl,data: data_arg,dataType:'json', 1116 success:function(data){ 1117 if(!data) return false;
1118 if(ajaxtype == 'paged'){ 1119 EVENTS_LIST.find('.evoShow_more_events').remove(); 1120 EVENTS_LIST.find('.clear').remove(); 1121 1122 1123 EVENTS_LIST.append( data.html + "<div class='clear'></div>"); 1124 1125 // hide show more events if all events loaded 1126 var events_in_list = EVENTS_LIST.find('.eventon_list_event').length; 1127 if( 'total_events' in data && data.total_events == events_in_list){ 1128 EVENTS_LIST.find('.evoShow_more_events').hide(); 1129 } 1130 1131 // for month lists duplicate headers // @+2.8.1 1132 var T = {}; 1133 EVENTS_LIST.find('.evcal_month_line').each(function(){ 1134 d = $(this).data('d'); 1135 if( T[d]) 1136 $(this).remove(); 1137 else 1138 T[d] = true; 1139 }); 1140 1141 var T = {}; 1142 EVENTS_LIST.find('.sep_month_events').each(function(){ 1143 d = $(this).data('d'); 1144 if( T[d]){ 1145 var H = $(this).html(); 1146 EVENTS_LIST.find('.sep_month_events[data-d="'+d+'"]').append( H ); 1147 $(this).remove(); 1148 }else{T[d] = true;} 1149 }); 1150 1151 }else{ 1152 EVENTS_LIST.html(data.html); 1153 } 1154 1155 // update calednar month title 1156 animate_month_switch(data.cal_month_title, ev_cal.find('.evo_month_title')); 1157 1158 // update calendar shortcode values after ajax 1159 ev_cal.evo_update_all_cal_sc({SC: data.SC}); 1160 1161 // update events list to calendar footer data 1162 ev_cal.find('.evo_cal_events').data('events', data.json); 1163 1164 $('body').trigger('calendar_month_changed',[CAL]); 1165 1166 $('body').trigger('evo_main_ajax_success', [CAL, ajaxtype, data, data_arg]); 1167 1168 },complete:function(data){ 1169 ev_cal.evo_loader_animation({direction:'end'}); 1170 1171 // show events list events if not set to hide on load 1172 if(! EVENTS_LIST.hasClass('evo_hide')) EVENTS_LIST.delay(300).slideDown('slow'); 1173 1174 ev_cal.evoGenmaps({'delay':400}); 1175 init_run_gmap_openevc(600); 1176 fullheight_img_reset(cal_id); 1177 1178 // pluggable 1179 $('body').trigger('evo_main_ajax_complete', [CAL, ajaxtype, data.responseJSON , data_arg]); 1180 ev_cal.removeClass('evo_loading'); 1181 } 1182 }); 1183 } 1184 } 1185 1186 $('body').on('evo_run_cal_ajax',function(event,cal_id, direction, ajaxtype){ 1187 run_cal_ajax( cal_id, direction, ajaxtype); 1188 }); 1189 1190 // deprecated bridge function for sortby value 1191 function ajax_post_content(sortby, cal_id, direction, ajaxtype){ 1192 run_cal_ajax( cal_id, direction, ajaxtype); 1193 } 1194 1195 // subtle animation when switching months 1196 function animate_month_switch(new_data, title_element){ 1197 var current_text = title_element.html(); 1198 var CAL = title_element.closest('.ajde_evcal_calendar'); 1199 1200 // for RTL not do the animation 1201 if(CAL.hasClass('evortl')){ 1202 title_element.html(new_data); 1203 return; 1204 } 1205 1206 var hei = title_element.height(); 1207 var wid= title_element.width(); 1208 1209 1210 title_element.html("<span style='position:absolute; width:"+wid+"; height:"+hei+" ;'>"+current_text+"</span><span style='position:absolute; display:none;'>"+new_data+"</span>").width(wid); 1211 1212 var LC_w = title_element.find('span:last-child').width()+5; 1213 1214 title_element.find('span:first-child').fadeOut(800); 1215 title_element.find('span:last-child').fadeIn(800, function(){ 1216 title_element.html(new_data); 1217 }); 1218 title_element.animate({width: LC_w},800); 1219 } 1220 1221 // actual animation/function for more/less button 1222 function control_more_less(obj){ 1223 var content = obj.attr('content'); 1224 var current_text = obj.find('.ev_more_text').html(); 1225 var changeTo_text = obj.find('.ev_more_text').attr('data-txt'); 1226 const cell = obj.closest('.evcal_evdata_cell'); 1227 1228 // show more 1229 if(content =='less'){ 1230 1231 obj.closest('.evcal_evdata_cell').removeClass('shorter_desc'); 1232 1233 1234 obj.attr({'content':'more'}); 1235 obj.find('.ev_more_arrow').removeClass('ard'); 1236 obj.find('.ev_more_text').attr({'data-txt':current_text}).html(changeTo_text); 1237 1238 }else{ 1239 obj.closest('.evcal_evdata_cell').addClass('shorter_desc'); 1240 1241 obj.attr({'content':'less'}); 1242 obj.find('.ev_more_arrow').addClass('ard'); 1243 obj.find('.ev_more_text').attr({'data-txt':current_text}).html(changeTo_text); 1244 } 1245 } 1246 1247 // expand and shrink featured image 1248 $('body').on('click','.evcal_evdata_img',function(){ 1249 if(!$(this).hasClass('evo_noclick')){ 1250 feature_image_expansion($(this), 'click'); 1251 } 1252 }); 1253 1254 // featured image height processing 1255 function feature_image_expansion(image, type){ 1256 img = image; 1257 1258 var img_status = img.attr('data-status'); 1259 var img_style = img.attr('data-imgstyle'); 1260 1261 // if image already expanded 1262 if(img_status=='open' ){ 1263 img.attr({'data-status':'close'}).css({'height':''}); 1264 }else{ 1265 var img_full_height = parseInt(img.attr('data-imgheight')); 1266 var cal_width = parseInt(img.closest('.ajde_evcal_calendar').width()); 1267 cal_width = (cal_width)? cal_width: img.width(); 1268 var img_full_width = parseInt(img.attr('data-imgwidth')); 1269 1270 1271 // show at minimized height 1272 if(img_style=='100per'){ 1273 relative_height = img_full_height; 1274 }else if(img_style=='full'){ 1275 relative_height = parseInt(img_full_height * (cal_width/img_full_width)) ; 1276 }else{ 1277 // minimized version 1278 if(type=='click'){ 1279 relative_height = parseInt(img_full_height * (cal_width/img_full_width)); 1280 relative_height = (relative_height)? relative_height: img_full_height; 1281 1282 relative_height = parseInt((cal_width * img_full_height) /img_full_width); 1283 1284 //console.log(relative_height+ ' '+img_full_height+' '+cal_width); 1285 1286 }else{ 1287 relative_height = img.attr('data-minheight'); 1288 } 1289 } 1290 1291 // when to set the status as open for images 1292 if(img_status=='' && img_style=='minmized'){ 1293 img.attr({'data-status':'close'}).removeClass('expanded'); 1294 }else{ 1295 img.attr({'data-status':'open'}).addClass('expanded'); 1296 } 1297 img.css({'height':relative_height}); 1298 } 1299 } 1300 1301 // reset featured images based on settings 1302 function fullheight_img_reset(calid){ 1303 if(calid){ 1304 $('#'+calid).find('.eventon_list_event .evo_metarow_fimg').each(function(){ 1305 feature_image_expansion($(this)); 1306 }); 1307 }else{ 1308 $('.evo_metarow_fimg').each(function(){ 1309 feature_image_expansion($(this)); 1310 }); 1311 } 1312 } 1313 1314 // treatments for calendar events upon load 1315 function treat_events(calid){ 1316 if(calid!=''){ 1317 if(is_mobile()){ 1318 $('#'+calid).find('.evo_metarow_getDr form').attr({'target':'_self'}); 1319 } 1320 } 1321 } 1322 1323 // if mobile check 1324 function is_mobile(){ 1325 return ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) )? true: false;
1326 } 1327 1328 // edit event button redirect 1329 $('body').on('click','.editEventBtnET', function(event){ 1330 event.stopPropagation(); 1331 1332 href = $(this).attr('href'); 1333 //console.log(href); 1334 window.open(href); 1335 }); 1336 1337 // repeat events series 1338 // @u 2.6.9 1339 $('body').on('click','.evo_repeat_series_date',function(){ 1340 if( $(this).parent().data('click') ){ 1341 URL = $(this).data('l'); 1342 window.location = URL; 1343 } 1344 }); 1345 1346 // event location archive card page 1347 // @u 2.8.6 1348 $('body').find('.evo_location_map').each(function(){ 1349 THIS = $(this); 1350 MAPID = THIS.attr('id'); 1351 1352 var location_type = THIS.attr('data-location_type'); 1353 if(location_type=='add'){ 1354 var address = THIS.attr('data-address'); 1355 var location_type = 'add'; 1356 }else{ 1357 var address = THIS.attr('data-latlng'); 1358 var location_type = 'latlng'; 1359 } 1360 1361 // zoomlevel 1362 zoom = parseInt(THIS.data('zoom')); 1363 scrollwheel = THIS.data('scroll') == 'yes'? true: false; 1364 1365 THIS.evoGenmaps({ 1366 'fnt':5, 1367 map_canvas_id: MAPID, 1368 location_type: location_type, 1369 address:address, 1370 zoomlevel: zoom, 1371 mapformat: THIS.data('mty'), 1372 scroll: scrollwheel, 1373 }); 1374 }); 1375 1376 // SINGLE EVENTS 1377 // Loading single event json based content 1378 $('body').on('evo_load_single_event_content', function(event, eid, obj){ 1379 var ajaxdataa = {}; 1380 ajaxdataa['action']='eventon_load_event_content'; 1381 ajaxdataa['eid'] = eid; 1382 ajaxdataa['nonce'] = the_ajax_script.postnonce; 1383 1384 // pass on other event values 1385 if(obj.data('j')){ 1386 $.each(obj.data('j'), function(index,val){ 1387 ajaxdataa[ index] = val; 1388 }); 1389 } 1390 1391 $.ajax({ 1392 beforeSend: function(){ }, 1393 url: the_ajax_script.ajaxurl, 1394 data: ajaxdataa, dataType:'json', type: 'POST', 1395 success:function(data){ 1396 $('body').trigger('evo_single_event_content_loaded', [data, obj]); 1397 },complete:function(){ } 1398 }); 1399 }); 1400 1401 if(is_mobile()){ 1402 if($('body').find('.fb.evo_ss').length != 0){ 1403 $('body').find('.fb.evo_ss').each(function(){ 1404 obj = $(this); 1405 obj.attr({'href':'http://m.facebook.com/sharer.php?u='+obj.attr('data-url')}); 1406 }); 1407 } 1408 } 1409 1410 // on single event page 1411 if($('body').find('.evo_sin_page').length>0){ 1412 $('.evo_sin_page').each(function(){ 1413 $('body').trigger('evo_load_single_event_content',[ $(this).data('eid'), $(this)]); 1414 $(this).find('.desc_trig ').attr({'data-ux_val':'none'}); 1415 }); 1416 } 1417 1418 // Single events box 1419 // Click on single event box 1420 $('.eventon_single_event').on('click', '.evcal_list_a',function(event){ 1421 var obj = $(this); 1422 var CAL = obj.closest('.ajde_evcal_calendar'); 1423 var SC = CAL.evo_shortcode_data(); 1424 1425 event.preventDefault(); 1426 1427 // open in event page 1428 if(SC.ux_val == 4){ 1429 var url = obj.parent().siblings('.evo_event_schema').find('[itemprop=url]').attr('href'); 1430 window.location.href= url; 1431 }else if(SC.ux_val == '2'){ // External Link 1432 var url = SC.exturl; 1433 window.location.href= url; 1434 }else if(SC.ux_val == 'X'){ // do not do anything 1435 return false; 1436 } 1437 }); 1438 // each single event box 1439 $('body').find('.eventon_single_event').each(function(){ 1440 var _this = $(this); 1441 1442 var CAL = _this.closest('.ajde_evcal_calendar'); 1443 var SC = CAL.evo_shortcode_data(); 1444 var evObj = CAL.find('.eventon_list_event'); 1445 1446 // show expanded eventCard 1447 if( SC.expanded =='yes'){ 1448 _this.find('.evcal_eventcard').show(); 1449 var idd = _this.find('.evcal_gmaps'); 1450 1451 // close button 1452 _this.find('.evcal_close').parent().css({'padding-right':0}); 1453 _this.find('.evcal_close').hide(); 1454 1455 //console.log(idd); 1456 var obj = _this.find('.desc_trig'); 1457 1458 // Google Map 1459 obj.evoGenmaps({ 1460 'fnt':2, 1461 'cal':CAL, 1462 }); 1463 1464 // open eventBox and lightbox 1465 }else if(SC.uxval =='3'){ 1466 1467 var obj = _this.find('.desc_trig'); 1468 // remove other attr - that cause to redirect 1469 obj.removeAttr('data-exlk').attr({'data-ux_val':'3'}); 1470 } 1471 1472 // show event excerpt 1473 var ev_excerpt = CAL.find('.event_excerpt').html(); 1474 1475 if(ev_excerpt!='' && ev_excerpt!== undefined && SC.excerpt =='yes' ){ 1476 var appendation = '<div class="event_excerpt_in">'+ev_excerpt+'</div>' 1477 evObj.append(appendation); 1478 } 1479 }); 1480 1481 1482 // HELPER items script 1483 // yes no button 1484 $('body').on('click','.ajde_yn_btn ', function(event){ 1485 1486 // stop this code from working on wp-admin 1487 if($('body').hasClass('wp-admin')) return false; 1488 1489 var obj = $(this); 1490 var afterstatement = obj.attr('afterstatement'); 1491 afterstatement = (afterstatement === undefined)? obj.attr('data-afterstatement'): afterstatement; 1492 var uid = ''; 1493 1494 // yes 1495 if(obj.hasClass('NO')){ 1496 obj.removeClass('NO'); 1497 obj.siblings('input').val('yes'); 1498 1499 // afterstatment 1500 if(afterstatement!=''){ 1501 var type = (obj.attr('as_type')=='class')? '.':'#'; 1502 if( obj.data('uid') !== undefined) uid = obj.data('uid'); 1503 $(type+ afterstatement).slideDown('fast'); 1504 } 1505 1506 }else{//no 1507 obj.addClass('NO'); 1508 obj.siblings('input').val('no'); 1509 1510 if(afterstatement!=''){ 1511 var type = (obj.attr('as_type')=='class')? '.':'#';
1512 $(type+ afterstatement ).slideUp('fast'); 1513 } 1514 } 1515 }); 1516 1517// Search Scripts 1518 // Enter key detection for pc 1519 $.fn.evo_enterKey = function (fnc) { 1520 return this.each(function () { 1521 $(this).keypress(function (ev) { 1522 var keycode = (ev.keyCode ? ev.keyCode : ev.which); 1523 if (keycode == '13') { 1524 fnc.call(this, ev); 1525 } 1526 }) 1527 }) 1528 } 1529 1530 $('.evo-search').on('click',function(){ 1531 var section = $(this).closest('.calendar_header'); 1532 var item = section.find('.evo_search_bar'); 1533 1534 item.slideToggle('2000', function(){ 1535 if(item.is(':visible')) item.find('input').focus(); 1536 }); 1537 }); 1538 1539 // Submit search from search box 1540 $('body').on('click','.evo_do_search',function(){ 1541 do_search_box( $(this) ); 1542 }); 1543 1544 $(".evosr_search_box input").evo_enterKey(function () { 1545 do_search_box( $(this).siblings('.evo_do_search') ); 1546 }); 1547 1548 function do_search_box(OBJ){ 1549 SearchVal = OBJ.closest('.evosr_search_box').find('input').val(); 1550 Evosearch = OBJ.closest('.EVOSR_section'); 1551 OBJ.closest('.evo_search_entry').find('.evosr_msg').hide(); 1552 //console.log(SearchVal); 1553 1554 if( SearchVal === undefined || SearchVal == ''){ 1555 OBJ.closest('.evo_search_entry').find('.evosr_msg').show(); 1556 return false; 1557 } 1558 1559 1560 SC = Evosearch.find('span.data').evo_item_shortcodes(); 1561 1562 1563 var data_arg = { 1564 action: 'eventon_search_evo_events', 1565 search: SearchVal, 1566 shortcode: SC 1567 }; 1568 $.ajax({ 1569 beforeSend: function(){ 1570 Evosearch.find('.evo_search_results_count').hide(); 1571 Evosearch.addClass('searching'); 1572 }, 1573 type: 'POST', 1574 url:the_ajax_script.ajaxurl, 1575 data: data_arg, 1576 dataType:'json', 1577 success:function(data){ 1578 Evosearch.find('.evo_search_results').html( data.content); 1579 1580 if(Evosearch.find('.no_events').length>0){ 1581 1582 }else{ 1583 // find event count 1584 Events = Evosearch.find('.evo_search_results').find('.eventon_list_event').length; 1585 Evosearch.find('.evo_search_results_count span').html( Events); 1586 Evosearch.find('.evo_search_results_count').fadeIn(); 1587 } 1588 1589 },complete: function(){ 1590 Evosearch.removeClass('searching'); 1591 } 1592 }); 1593 } 1594 1595 // submit search from calendar 1596 $('body').on('click','.evosr_search_btn',function(){ search_within_calendar( $(this).siblings('input') ); }); 1597 $(".evo_search_bar_in input").evo_enterKey(function () { search_within_calendar( $(this) ); }); 1598 1599 function search_within_calendar(obj){ 1600 1601 var ev_cal = obj.closest('.ajde_evcal_calendar'); 1602 1603 1604 ev_cal.evo_update_cal_sc({F:'show_limit_paged',V: '1' }); 1605 ev_cal.evo_update_cal_sc({F:'s',V: obj.val() }); 1606 1607 run_cal_ajax( ev_cal.attr('id'),'none','search'); 1608 1609 return false; 1610 } 1611 1612 1613 // More event images interaction 1614 $('body').on('click','.evo_event_more_img',function(){ 1615 var O = $(this); 1616 var eCARD = O.closest('.evcal_eventcard'); 1617 var fIMG = O.find('img'); 1618 var fURL = fIMG.data('f'); 1619 1620 O.parent().find('span').removeClass('select'); O.addClass('select'); 1621 1622 eCARD.find('img.evo_event_main_img').attr({'src': fURL}); 1623 1624 relIMG = eCARD.find('.evo_metarow_fimg'); 1625 relIMG.css('background-image', 'url('+ fURL +')' ); 1626 relIMG.data('imgheight', fIMG.data('h')); 1627 }); 1628 1629// supportive 1630 // handlebar additions 1631 function handlebar_additional_arguments(){ 1632 Handlebars.registerHelper('ifE',function(v1, options){ 1633 return (v1 !== undefined && v1 != '' && v1) 1634 ? options.fn(this) 1635 : options.inverse(this); 1636 }); 1637 1638 Handlebars.registerHelper('ifEQ',function(v1, v2, options){ 1639 return ( v1 == v2)? options.fn(this): options.inverse(this); 1640 }); 1641 Handlebars.registerHelper('ifNEQ',function(v1, v2, options){ 1642 return ( v1 != v2)? options.fn(this): options.inverse(this); 1643 }); 1644 Handlebars.registerHelper('BUStxt',function(V, options){ 1645 if( !( V in BUS.txt) ) return V; 1646 return BUS.txt[V]; 1647 }); 1648 Handlebars.registerHelper('GetDMnames',function(V, U, options){ 1649 return BUS.dms[U][ V ]; 1650 }); 1651 // get total of increments 1652 Handlebars.registerHelper('forAdds',function(count, add_val, options){ 1653 O = ''; 1654 for(x=1; x<= count; x++){ O += add_val; } 1655 return O; 1656 }); 1657 Handlebars.registerHelper('GetEvProp',function(EID, PROP, CALID){ 1658 EID = EID.split('-'); 1659 EV = $('#'+ CALID).find('.evo_cal_events').data('events'); 1660 1661 var O = ''; 1662 $.each(EV, function(i,d){ 1663 if( d.ID == EID[0] && d.ri == EID[1]){ 1664 if( !(PROP in d.event_pmv)) return; 1665 O = d.event_pmv[PROP][0]; 1666 } 1667 }); 1668 return O; 1669 }); 1670 Handlebars.registerHelper('GetEvV',function(EID, PROP, CALID){ 1671 EID = EID.split('-'); 1672 EV = $('#'+ CALID).find('.evo_cal_events').data('events'); 1673 1674 var O = ''; 1675 $.each(EV, function(i,d){ 1676 if( d.ID == EID[0] && d.ri == EID[1]){ 1677 O = d[PROP]; 1678 } 1679 }); 1680 return O; 1681 }); 1682 Handlebars.registerHelper('COUNT',function( V){ 1683 return Object.keys(V).length; 1684 }); 1685 Handlebars.registerHelper('CountlimitLess',function( AR, C,options){ 1686 var L= Object.keys(AR).length; 1687 return ( L < C)? options.inverse(this): options.fn(this); 1688 }); 1689 Handlebars.registerHelper('ifCOND',function(v1, operator, v2, options){ 1690 return checkCondition(v1, operator, v2) 1691 ? options.fn(this) 1692 : options.inverse(this); 1693 }); 1694 Handlebars.registerHelper('toJSON', function(obj) { 1695 return new Handlebars.SafeString(JSON.stringify(obj)); 1696 }); 1697 Handlebars.registerHelper('Cal_def_check',function(V, options){ 1698 if( BUS.cal_def && BUS.cal_def[V] ) return options.fn(this); 1699 return options.inverse(this); 1700 }); 1701 Handlebars.registerHelper('TypeCheck',function(V, options){ 1702 if( options.type == V ) return options.fn(this); 1703 return options.inverse(this); 1704 }); 1705 } 1706 function checkCondition(v1, operator, v2) { 1707 switch(operator) { 1708 case '==': 1709 return (v1 == v2); 1710 case '===': 1711 return (v1 === v2); 1712 case '!==': 1713 return (v1 !== v2); 1714 case '<': 1715 return (v1 < v2); 1716 case '<=': 1717 return (v1 <= v2); 1718 case '>': 1719 return (v1 > v2); 1720 case '>=': 1721 return (v1 >= v2); 1722 case '&&': 1723 return (v1 && v2); 1724 case '||': 1725 return (v1 || v2); 1726 default: 1727 return false;
1728 } 1729 } 1730 // @2.9.1 1731 // increase and reduce quantity 1732 $('body').on('click','.evo_qty_change', function(event){ 1733 var OBJ = $(this); 1734 var QTY = oQTY = parseInt(OBJ.siblings('em').html()); 1735 var MAX = OBJ.siblings('input').attr('max'); 1736 var BOX = OBJ.closest('.evo_purchase_box'); 1737 1738 var pfd = BOX.find('.evo_purchase_box_data').data('pfd'); 1739 1740 1741 (OBJ.hasClass('plu'))? QTY++: QTY--; 1742 1743 QTY =(QTY==0)? 1: QTY; 1744 QTY = (MAX!='' && QTY > MAX)? MAX: QTY; 1745 1746 // new total price 1747 var sin_price = OBJ.parent().data('p'); 1748 new_price = sin_price * QTY; 1749 1750 new_price = get_format_price( new_price, pfd); 1751 1752 BOX.find('.total .value').html( new_price); 1753 1754 OBJ.siblings('em').html(QTY); 1755 OBJ.siblings('input').val(QTY); 1756 1757 $('body').trigger('evo_qty_changed',[QTY,oQTY, new_price,OBJ ]); 1758 }); 1759 1760 // Total formating 1761 function get_format_price(price, data){ 1762 1763 // price format data 1764 PF = data; 1765 1766 totalPrice = price.toFixed(PF.numDec); // number of decimals 1767 htmlPrice = totalPrice.toString().replace('.', PF.decSep); 1768 1769 if(PF.thoSep.length > 0) { 1770 htmlPrice = _addThousandSep(htmlPrice, PF.thoSep); 1771 } 1772 if(PF.curPos == 'right') { 1773 htmlPrice = htmlPrice + PF.currencySymbol; 1774 } 1775 else if(PF.curPos == 'right_space') { 1776 htmlPrice = htmlPrice + ' ' + PF.currencySymbol; 1777 } 1778 else if(PF.curPos == 'left_space') { 1779 htmlPrice = PF.currencySymbol + ' ' + htmlPrice; 1780 } 1781 else { 1782 htmlPrice = PF.currencySymbol + htmlPrice; 1783 } 1784 return htmlPrice; 1785 } 1786 function _addThousandSep(n, thoSep){ 1787 var rx= /(\d+)(\d{3})/; 1788 return String(n).replace(/^\d+/, function(w){ 1789 while(rx.test(w)){ 1790 w= w.replace(rx, '$1'+thoSep+'$2'); 1791 } 1792 return w; 1793 }); 1794 }; 1795 1796 1797 1798});
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.