1/** 2 * Javascript code that is associated with the front end of the calendar 3 * version: 2.6.16 4 * updated: 2.7.3 5 */ 6 7jQuery(document).ready(function($){ 8 9 init(); 10 BODY = $('body'); 11 12 /** 13 * run these on page load 14 * @return void 15 */ 16 function init(){ 17 init_run_gmap_openevc(); 18 fullheight_img_reset(); 19 } 20 21 // LIGHTBOX 22 // instant lightbox 23 BODY.on('click') 24 // close popup 25 BODY.on('click','.evolbclose', function(){ 26 LIGHTBOX = $(this).closest('.evo_lightbox'); 27 closing_lightbox( LIGHTBOX ); 28 }); 29 30 // close with click outside popup box when pop is shown 31 $(document).on('click', function(event) { 32 //event.stopPropagation(); 33 //console.log($(event.target)); 34 if( 35 $(event.target).hasClass('evo_content_inin') 36 ){ 37 closing_lightbox( $(event.target).closest('.evo_lightbox') ); 38 //console.log('5'); 39 } 40 }); 41 function closing_lightbox( lightboxELM){ 42 43 if(! lightboxELM.hasClass('show')) return false; 44 Close = (lightboxELM.parent().find('.evo_lightbox.show').length == 1)? true: false; 45 lightboxELM.removeClass('show'); 46 47 $('body').trigger('lightbox_before_event_closing', [lightboxELM]); 48 49 setTimeout( function(){ 50 lightboxELM.find('.evo_lightbox_body').html(''); 51 52 if(Close){ 53 $('body').removeClass('evo_overflow'); 54 $('html').removeClass('evo_overflow'); 55 } 56 57 // trigger action to hook in at this stage 58 $('body').trigger('lightbox_event_closing', [lightboxELM]); 59 }, 500); 60 } 61 62 // when lightbox open triggered 63 $('body').on('evolightbox_show',function(){ 64 $('.evo_lightboxes').show(); 65 $('body').addClass('evo_overflow'); 66 $('html').addClass('evo_overflow'); 67 68 $('body').trigger('evolightbox_opened'); 69 }); 70 71 // OPENING event card -- USER INTREACTION and loading google maps 72 //event full description\ 73 $('body').on('click','.eventon_events_list .desc_trig', function(event){ 74 75 var obj = $(this); 76 77 78 var attr = obj.closest('.evo_lightbox').attr('data-cal_id'); 79 if(typeof attr !== typeof undefined && attr !== false){ 80 var cal_id = attr; 81 var cal = $('#'+cal_id); 82 }else{ 83 var cal = obj.closest('.ajde_evcal_calendar'); 84 } 85 86 var evodata = cal.find('.evo-data'); 87 88 click_sinev_box = (obj.closest('.eventon_single_event').length>0 && evodata.data('exturl')) ? true: false; 89 event_id = obj.closest('.eventon_list_event').data('event_id'); 90 91 92 93 // whole calendar specific values 94 var cal_ux_val = evodata.data('ux_val'); 95 96 var accord__ = evodata.data('accord'); 97 98 // event specific values 99 var ux_val = obj.data('ux_val'); 100 var exlk = obj.data('exlk'); 101 102 // override overall calendar user intereaction OVER individual event UX 103 if(cal_ux_val!='' && cal_ux_val!== undefined && cal_ux_val!='0'){ 104 ux_val = cal_ux_val; 105 } 106 107 console.log(cal_ux_val+' '+ux_val); 108 // open as lightbox 109 if(ux_val=='3'){ 110 event.preventDefault(); 111 112 // set elements 113 EVO_LIGHTBOX = $('.evo_lightbox.eventcard'); 114 LIGHTBOX_body = EVO_LIGHTBOX.find('.evo_lightbox_body'); 115 116 repeat_interval = parseInt(obj.closest('.eventon_list_event').data('ri')); 117 repeat_interval = (repeat_interval)? repeat_interval: '0'; 118 119 // resets 120 EVO_LIGHTBOX.find('.evo_pop_body').show(); 121 fullheight_img_reset(); 122 LIGHTBOX_body.html(''); 123 124 var event_list = obj.closest('.eventon_events_list'); 125 var content = obj.closest('.eventon_list_event').find('.event_description').html(); 126 var content_front = obj.html(); 127 128 var _content = $(content).not('.evcal_close'); 129 130 // RTL 131 if(event_list.hasClass('evortl')){ 132 EVO_LIGHTBOX.find('.evo_popin').addClass('evortl'); 133 EVO_LIGHTBOX.addClass('evortl'); 134 } 135 136 LIGHTBOX_body.append('<div class="evopop_top">'+content_front+'</div>').append(_content); 137 LIGHTBOX_body.attr('class','evo_lightbox_body eventon_list_event evo_pop_body evcal_eventcard event_'+event_id +'_'+ repeat_interval); 138 139 var this_map = LIGHTBOX_body.find('.evcal_gmaps'); 140 var idd = this_map.attr('id'); 141 this_map.attr({'id':idd+'_evop'}); 142 143 EVO_LIGHTBOX.addClass('show'); 144 $('body').trigger('evolightbox_show'); 145 146 obj.evoGenmaps({ 147 '_action':'lightbox', 148 'cal':cal, 149 'mapSpotId':idd+'_evop' 150 }); 151 152 153 fullheight_img_reset(); // added second reset 154 155 // update border color 156 bgcolor = $('.evo_pop_body').find('.evcal_cblock').attr('data-bgcolor'); 157 $('.evo_pop_body').find('.evopop_top').css({'border-left':'3px solid '+bgcolor}); 158 159 // trigger 160 if( obj.data('runjs')){ 161 $('body').trigger('evo_load_single_event_content',[ event_id, obj]); 162 } 163 164 $('body').trigger('evolightbox_end'); 165 return false;
166 167 // open in single events page -- require single event addon 168 }else if(ux_val=='4'){ 169 170 if( obj.attr('href')!='' && obj.attr('href')!== undefined){ 171 return; 172 }else{ 173 var url = obj.parent().siblings('.evo_event_schema').find('a').attr('href'); 174 if(obj.attr('target') == '_blank'){ window.open(url);}else{ window.open(url, '_self');} 175 return false; 176 } 177 178 // open as external link 179 }else if(ux_val=='2'){ 180 var url = obj.parent().siblings('.evo_event_schema').find('a').attr('href'); 181 182 // if the click is coming from single event box 183 if( click_sinev_box ){ 184 event.preventDefault(); 185 return false; 186 } 187 188 //console.log(url); 189 if(url !== undefined && url != ''){ 190 if(obj.attr('target') == '_blank'){ 191 var win = window.open(url, '_blank'); 192 win.focus(); 193 }else{ 194 window.open(url, '_self'); 195 } 196 197 event.preventDefault(); 198 } 199 return true; 200 201 // do not do anything 202 }else if(ux_val=='X'){ 203 return false; 204 }else if(ux_val=='none'){ 205 return false; 206 }else{ 207 208 // redirecting to external link 209 if(exlk=='1' && ux_val!='1'){ 210 // if there is no href 211 if( obj.attr('href')!='' && obj.attr('href')!== undefined){ 212 return; 213 }else{ 214 var url = obj.siblings('.evo_event_schema').find('a').attr('href'); 215 if(obj.attr('target') == '_blank'){ window.open(url);}else{ window.open(url, '_self');} 216 217 event.preventDefault(); 218 return false; 219 } 220 // SLIDE DOWN eventcard 221 }else{ 222 223 var event_box = obj.closest('.eventon_list_event'); 224 var click_item = event_box.find('.event_description'); 225 226 227 if(click_item.hasClass('open')){ 228 event_box.removeClass('open'); 229 click_item.slideUp().removeClass('open'); 230 }else{ 231 // accordion 232 if(accord__=='1'){ 233 cal.find('.eventon_list_event').removeClass('open');
234 cal.find('.event_description').slideUp().removeClass('open'); 235 } 236 event_box.addClass('open'); 237 click_item.slideDown().addClass('open'); 238 } 239 240 // This will make sure markers and gmaps run once and not multiples 241 if( obj.attr('data-gmstat')!= '1'){ 242 obj.attr({'data-gmstat':'1'}); 243 obj.evoGenmaps({'fnt':2}); 244 } 245 246 // trigger 247 if( obj.data('runjs')){ 248 $('body').trigger('evo_load_single_event_content',[ event_id, obj]); 249 } 250 251 252 return false; 253 } 254 } 255 }); 256 257 // call to run google maps on load 258 function init_run_gmap_openevc(delay){ 259 $('.ajde_evcal_calendar').each(function(){ 260 if($(this).find('.evo-data').data('evc_open')=='1'){ 261 $(this).find('.desc_trig').each(function(){ 262 if(delay!='' && delay !== undefined){ 263 $(this).evoGenmaps({'fnt':2, 'delay':delay}); 264 }else{ 265 $(this).evoGenmaps({'fnt':2}); 266 } 267 }); 268 } 269 }); 270 } 271 272 // Calendar Interaction 273 // event bubbles 274 $('.ajde_evcal_calendar.bub').on('mouseover','.eventon_list_event', function(){ 275 O = $(this); 276 LIST = O.closest('.eventon_events_list'); 277 title = O.find('.evcal_event_title').html(); 278 279 p = O.position(); 280 281 LIST.append('<span class="evo_bub_box" style="">'+ title +"</span>"); 282 B = LIST.find('.evo_bub_box'); 283 284 l = p.left; 285 t = p.top- B.height() -30; 286 287 // adjust bubble to left if event on right edge 288 LM = LIST.width(); 289 tl = p.left + B.width() + O.width(); 290 if( tl > LM){ 291 l = l - B.width() +O.width()-20; 292 } 293 294 B.css({'top':t, 'left':l}); 295 296 LIST.find('.evo_bub_box').addClass('show'); 297 }).on('mouseout',function(){ 298 B = $(this).find('.evo_bub_box').remove(); 299 }); 300 301 // Click on event top items 302 $('body').on('click','.evocmd_button', function(event){ 303 event.preventDefault(); 304 event.stopPropagation(); 305 306 href = $(this).data('href'); 307 if( $(this).data('target')=='yes'){ 308 window.open(href,'_blank'); 309 }else{ 310 window.location = href; 311 } 312 313 }); 314 315 // GO TO TODAY 316 // @since 2.3 317 $('body').on('click','.evo-gototoday-btn', function(){ 318 var obj = $(this); 319 var calid = obj.closest('.ajde_evcal_calendar').attr('id'); 320 var evo_data = $('#'+calid).find('.evo-data'); 321 322 evo_data.attr({ 323 'data-cmonth':obj.data('mo'), 324 'data-cyear':obj.data('yr'), 325 }); 326 327 $('body').trigger('evo_goto_today',[calid, evo_data]); 328 329 ajax_post_content(evo_data.attr('data-sort_by'),calid,'none','today'); 330 obj.fadeOut(); 331 }); 332 333 $('body').on('evo_main_ajax', function(event, calendar, evodata, ajaxtype){ 334 335 if(ajaxtype != 'sorting' && ajaxtype != 'filering') 336 calendar.find('.evo-gototoday-btn').fadeIn(); 337 }); 338 $('body').on('evo_main_ajax_complete', function(event, calendar, evodata){ 339 var today = calendar.find('.evo-gototoday-btn'); 340 // if focused month and year are same as current month and year hide the current month button 341 if(evodata.attr('data-cmonth') == today.attr('data-mo') && evodata.attr('data-cyear') == today.attr('data-yr')){ 342 calendar.find('.evo-gototoday-btn').fadeOut(); 343 } 344 }); 345 346 // MONTH jumper
347 $('.ajde_evcal_calendar').on('click','.evo-jumper-btn', function(){ 348 $(this).parent().siblings().find('.evo_j_container').slideToggle(); 349 }); 350 351 // select a new time from jumper 352 $('.evo_j_dates').on('click','a',function(){ 353 var val = $(this).attr('data-val'), 354 type = $(this).parent().parent().attr('data-val'), 355 container = $(this).closest('.evo_j_container'), 356 calOBJ = $(this).closest('.ajde_evcal_calendar'); 357 358 // resets 359 cal_resets(calOBJ); 360 361 if(type=='m'){ 362 container.attr({'data-m':val}); 363 }else{ 364 container.attr({'data-y':$(this).html() }); 365 } 366 367 // update set class 368 $(this).parent().find('a').removeClass('set'); 369 $(this).addClass('set'); 370 371 if(container.attr('data-m')!==undefined && container.attr('data-y')!==undefined){ 372 373 var calid = calOBJ.attr('id'); 374 var evo_data = $('#'+calid).find('.evo-data'); 375 evo_data.attr({ 376 'data-cmonth':container.attr('data-m'), 377 'data-cyear':container.attr('data-y'), 378 }); 379 380 ajax_post_content(evo_data.attr('data-sort_by'),calid,'none','jumper'); 381 382 // hide month jumper if not set to leave expanded 383 if(container.data('expj')=='no') 384 container.delay(2000).slideUp(); 385 } 386 }); 387 388 // change jumper values 389 function change_jumper_set_values(cal_id){ 390 var evodata = $('#'+cal_id).find('.evo-data'); 391 var ej_container = $('#'+cal_id).find('.evo_j_container'); 392 var new_month = evodata.attr('data-cmonth'); 393 var new_year = evodata.attr('data-cyear'); 394 395 ej_container.attr({'data-m':new_month}); 396 397 // correct month 398 ej_container.find('.evo_j_months p.legend a').removeClass('set').parent().find('a[data-val='+new_month+']').addClass('set'); 399 ej_container.find('.evo_j_years p.legend a').removeClass('set').parent().find('a[data-val='+new_year+']').addClass('set'); 400 } 401 402 // RESET general calendar 403 function cal_resets(calOBJ){ 404 console.log('tt'); 405 calargs = $(calOBJ).find('.cal_arguments'); 406 calargs.attr('data-show_limit_paged', 1 ); 407 } 408 409 // close event card 410 $('.eventon_events_list').on('click','.evcal_close',function(){ 411 $(this).closest('.evcal_eventcard').slideUp().removeClass('open'); 412 }); 413 414 // change IDs for map section for eventon widgets 415 if( $('.ajde_evcal_calendar').hasClass('evcal_widget')){ 416 cal.find('.evcal_gmaps').each(function(){ 417 var gmap_id = obj.attr('id'); 418 var new_gmal_id =gmap_id+'_widget'; 419 obj.attr({'id':new_gmal_id}) 420 }); 421 } 422 423 // show more events on the list 424 $('body').on('click','.evoShow_more_events', function(){ 425 OBJ = $(this); 426 var ReDir = OBJ.data('dir'); 427 428 // redirect to an external link 429 if(ReDir != '0'){ 430 window.location = ReDir; 431 return false; 432 } 433 434 // Initials 435 var evCal = OBJ.closest('.ajde_evcal_calendar'); 436 var evoData = evCal.find('.evo-data'); 437 438 // ajax pagination 439 if(OBJ.data('ajax')=='yes'){ 440 calargs = evCal.find('.cal_arguments'); 441 CURRENT_PAGED = parseInt(calargs.attr('data-show_limit_paged')); 442 calargs.attr('data-show_limit_paged', CURRENT_PAGED+1 ); 443 444 var sort_by = evoData.attr('data-sort_by'); 445 cal_id = evCal.attr('id'); 446 447 ajax_post_content(sort_by, cal_id, 'none','paged'); 448 449 }else{ 450 var event_count = parseInt(evoData.data('ev_cnt')); 451 var show_limit = evoData.data('show_limit'); 452 453 var eventList = OBJ.parent(); 454 var allEvents = eventList.find('.eventon_list_event').length; 455 456 457 var currentShowing = eventList.find('.eventon_list_event:visible').length; 458 459 for(x=1; x<=event_count ; x++ ){ 460 var inde = currentShowing+x-1; 461 eventList.find('.eventon_list_event:eq('+ inde+')').slideDown(); 462 } 463 464 // hide view more button 465 if(allEvents > currentShowing && allEvents<= (currentShowing+event_count)){ 466 $(this).fadeOut(); 467 } 468 } 469 470 }); 471 472 // Tab view switcher 473 $('body').find('.evo_tab_container').each(function(){ 474 $(this).find('.evo_tab_section').each(function(){ 475 if(!$(this).hasClass('visible')){ 476 $(this).addClass('hidden'); 477 } 478 }); 479 }); 480 $('body').on('click','ul.evo_tabs li',function(){ 481 tab = $(this).data('tab'); 482 tabsection = $(this).closest('.evo_tab_view').find('.evo_tab_container'); 483 tabsection.find('.evo_tab_section').addClass('hidden').removeClass('visible'); 484 tabsection.find('.'+tab).addClass('visible').removeClass('hidden'); 485 486 $(this).parent().find('li').removeClass('selected'); 487 $(this).addClass('selected'); 488 }); 489 // layout view changer 490 if($('body').find('.evo_layout_changer').length>0){ 491 $('body').find('.evo_layout_changer').each(function(item){ 492 if($(this).parent().hasClass('boxy')){ 493 $(this).find('.fa-th-large').addClass('on'); 494 }else{ 495 $(this).find('.fa-reorder').addClass('on'); 496 } 497 }); 498 499 $('.evo_layout_changer').on('click','i',function(){ 500 501 TYPE = $(this).data('type'); 502 $(this).parent().find('i').removeClass('on'); 503 $(this).addClass('on'); 504 505 //console.log(TYPE); 506 507 if(TYPE=='row'){ 508 $(this).closest('.ajde_evcal_calendar').removeClass('boxy'); 509 }else{ 510 $(this).closest('.ajde_evcal_calendar').addClass('boxy'); 511 } 512 }); 513 } 514 515 //===============================
516 // SORT BAR SECTION 517 // ============================== 518 // display sort section 519 $('.evo-filter-btn').click(function(){ 520 CAL = $(this).closest('.ajde_evcal_calendar'); 521 line = CAL.find('.eventon_sorting_section'); 522 if(line.is(':visible')){ 523 line.hide(); 524 $(this).removeClass('show'); 525 }else{ 526 line.show(); 527 $(this).addClass('show'); 528 } 529 }); 530 531 // SORTing 532 $('.evo-sort-btn').click(function(){ 533 line = $(this).find('.eventon_sort_line'); 534 if(line.is(':visible')){ 535 line.hide(); 536 $(this).removeClass('show'); 537 }else{ 538 line.show(); 539 $(this).addClass('show'); 540 } 541 }); 542 543 // update calendar based on the sorting selection 544 $('.eventon_sort_line').on('click','p',function(){ 545 O = $(this); 546 var CAL = $(this).closest('.ajde_evcal_calendar'); 547 var evodata = CAL.find('.evo-data'); 548 var sort_by = $(this).attr('data-val'); 549 var cal_id = evodata.parent().attr('id'); 550 551 ajax_post_content(sort_by,cal_id,'none','sorting'); 552 553 // update new values everywhere 554 evodata.attr({'data-sort_by':sort_by}); 555 O.parent().find('p').removeClass('select'); 556 O.addClass('select'); 557 558 }); 559 560 // filtering section open and close menu 561 $('.filtering_set_val').click(function(){ 562 // close sorting 563 sortSelect = $(this).closest('.eventon_sorting_section').find('.evo_srt_options'); 564 if(sortSelect.is(':visible') == true) sortSelect.fadeToggle(); 565 566 var obj = $(this); 567 var current_Drop = obj.siblings('.eventon_filter_dropdown'); 568 var current_drop_pare = obj.closest('.eventon_filter'); 569 570 current_drop_pare.siblings('.eventon_filter').find('.eventon_filter_dropdown').each(function(){ 571 if($(this).is(':visible')== true ){ 572 $(this).hide(); 573 $(this).siblings('p').removeClass('show'); 574 } 575 }); 576 577 if(current_Drop.is(':visible')== true){ 578 obj.siblings('.eventon_filter_dropdown').fadeOut('fast'); 579 obj.removeClass('show'); 580 }else{ 581 obj.siblings('.eventon_filter_dropdown').fadeIn('fast'); 582 obj.addClass('show'); 583 } 584 }); 585 586 // selection on filter dropdown list 587 $('.eventon_filter_dropdown').on('click','p',function(){ 588 var new_filter_val = $(this).data('filter_val'), 589 O = $(this), 590 filter_section = $(this).closest('.eventon_filter_line'); 591 var filter = $(this).closest('.eventon_filter'); 592 var filter_current_set_val = filter.attr('data-filter_val'); 593 var select_filter_type = filter_section.hasClass('selecttype')? true:false; 594 FILTER_DROPDOWN = $(this).parent(); 595 CAL = $(this).closest('.ajde_evcal_calendar'); 596 597 // for filter values with checkboxes 598 if(select_filter_type){ 599 val = ''; 600 601 // NOT all 602 if( new_filter_val != 'all'){ 603 O.parent().find('p.all').removeClass('select'); 604 O.toggleClass('select'); 605 606 O.parent().find('p').each(function(){ 607 if( $(this).hasClass('select')){ 608 val += $(this).data('filter_val')+','; 609 } 610 }); 611 612 val = ( val.slice(-1) == ',')? val.slice(0,-1): val; 613 // == all 614 }else{ 615 if( O.hasClass('select')){ 616 O.parent().find('p').removeClass('select'); 617 }else{ 618 O.parent().find('p').addClass('select'); 619 val = 'all'; 620 } 621 } 622 623 filter.attr('data-filter_val',val); 624 // regular selecting 625 }else{ 626 627 if( new_filter_val == 'all'){ 628 O.parent().find('p').addClass('select'); 629 }else{ 630 O.parent().find('p').removeClass('select'); 631 O.addClass('select'); 632 } 633 } 634 if(filter_section.hasClass('selecttype')) return; 635 636 637 // For non checkbox select options 638 if(filter_current_set_val == new_filter_val){ 639 $(this).parent().fadeOut(); 640 }else{ 641 // set new filtering changes 642 var evodata = CAL.find('.evo-data'); 643 CAL_ARG = CAL.find('.cal_arguments'); 644 645 cal_resets( CAL ); 646 647 var cmonth = parseInt( evodata.attr('data-cmonth')); 648 var cyear = parseInt( evodata.attr('data-cyear')); 649 var sort_by = evodata.attr('data-sort_by'); 650 var cal_id = evodata.parent().attr('id'); 651 652 // make changes 653 filter.attr({'data-filter_val':new_filter_val});
654 evodata.attr({'data-filters_on':'true'}); 655 656 657 ajax_post_content(sort_by,cal_id,'none','filering'); 658 659 // reset the new values 660 var new_filter_name = $(this).html(); 661 //O.parent().find('p').removeClass('select'); 662 //O.addClass('select'); 663 O.parent().fadeOut(); 664 O.parent().siblings('.filtering_set_val').removeClass('show'); 665 666 } 667 }); 668 669 // apply filters via button to the calendar 670 $('.eventon_filter_dropdown').on('change','input',function(event){ 671 FILTER = $(this).closest('.eventon_filter'); 672 673 val = ''; 674 FILTER.find('input').each(function(){ 675 val = ($(this).is(':checked'))? val+$(this).attr('data-filter_val')+',': val; 676 }); 677 val = val==''? '':val; // v2.5.2 678 FILTER.attr('data-filter_val',val); 679 }); 680 // apply filters 681 $('body').on('click','.evo_filter_submit',function(){ 682 // fadeout any open filter dropdowns 683 $(this).closest('.eventon_filter_line').find('.eventon_filter_dropdown').fadeOut(); 684 $(this).closest('.eventon_filter_line').find('.filtering_set_val').removeClass('show'); 685 686 CAL = $(this).closest('.ajde_evcal_calendar'); 687 cal_resets( CAL); 688 689 // set new filtering changes 690 var evodata = $(this).closest('.eventon_sorting_section').siblings('.evo-data'); 691 var cmonth = parseInt( evodata.attr('data-cmonth')); 692 var cyear = parseInt( evodata.attr('data-cyear')); 693 var sort_by = evodata.attr('data-sort_by'); 694 var cal_id = evodata.parent().attr('id'); 695 evodata.attr({'data-filters_on':'true'}); 696 697 ajax_post_content(sort_by,cal_id,'none','filering'); 698 }); 699 700 701 // MONTH SWITCHING 702 // previous month 703 $('body').on('click','.evcal_btn_prev', function(){ 704 var evodata = $(this).parent().siblings('.evo-data'); 705 var sort_by=evodata.attr('data-sort_by'); 706 cal_id = $(this).closest('.ajde_evcal_calendar').attr('id'); 707 708 ajax_post_content(sort_by,cal_id,'prev','switchmonth'); 709 }); 710 711 // next month 712 $('body').on('click','.evcal_btn_next',function(){ 713 714 var evodata = $(this).parent().siblings('.evo-data'); 715 var sort_by=evodata.attr('data-sort_by'); 716 cal_id = $(this).closest('.ajde_evcal_calendar').attr('id'); 717 718 ajax_post_content(sort_by, cal_id,'next','switchmonth'); 719 }); 720 721 /* PRIMARY hook to get content */ 722 function ajax_post_content(sort_by, cal_id, direction, ajaxtype){ 723 724 // identify the calendar and its elements. 725 var ev_cal = $('#'+cal_id); 726 var cal_head = ev_cal.find('.calendar_header'); 727 var evodata = ev_cal.find('.evo-data'); 728 729 // check if ajax post content should run for this calendar or not 730 731 if(ev_cal.attr('data-runajax')!='0'){ 732 733 $('body').trigger('evo_main_ajax', [ev_cal, evodata, ajaxtype]); 734 735 // category filtering for the calendar 736 var cat = ev_cal.find('.evcal_sort').attr('cat'); 737 738 // reset paged values for switching months 739 if(ajaxtype=='switchmonth'){ 740 cal_head.find('.cal_arguments').attr('data-show_limit_paged',1); 741 } 742 743 var data_arg = { 744 action: 'the_ajax_hook', 745 direction: direction, 746 sort_by: sort_by, 747 filters: ev_cal.evoGetFilters(), 748 shortcode: ev_cal.evo_shortcodes(), 749 evodata: ev_cal.evo_getevodata(), 750 ajaxtype: ajaxtype 751 }; 752 753 data_arg = cal_head.evo_otherVals({'data_arg':data_arg}); 754 755 $.ajax({ 756 beforeSend: function(){ 757 ev_cal.addClass('evo_loading'); 758 if(ajaxtype != 'paged') ev_cal.find('.eventon_events_list').slideUp('fast'); 759 ev_cal.evo_loader_animation(); 760 }, 761 type: 'POST', 762 url:the_ajax_script.ajaxurl, 763 data: data_arg, 764 dataType:'json', 765 success:function(data){ 766 if(!data) return false; 767 if(ajaxtype == 'paged'){ 768 769 EVENTS_LIST = ev_cal.find('.eventon_events_list'); 770 ev_cal.find('.eventon_events_list .evoShow_more_events').remove(); 771 EVENTS_LIST.find('.clear').remove(); 772 EVENTS_LIST.append( data.content + "<div class='clear'></div>"); 773 774 775 }else{ 776 ev_cal.find('.eventon_events_list').html(data.content); 777 } 778 779 animate_month_switch(data.cal_month_title, ev_cal.find('#evcal_cur')); 780 781 evodata.attr({'data-cmonth':data.month,'data-cyear':data.year});
782 change_jumper_set_values(cal_id); 783 784 // jump month update 785 if(ev_cal.find('.evo_j_container').length>0){ 786 JUMPER = ev_cal.find('.evo_j_container'); 787 JUMPERmo = JUMPER.find('.evo_jumper_months'); 788 JUMPERmo.find('a').removeClass('set'); 789 JUMPERmo.find('a[data-val="'+data.month+'"]').addClass('set'); 790 791 JUMPERyr = JUMPER.find('.evo_j_years'); 792 JUMPERyr.find('a').removeClass('set'); 793 JUMPERyr.find('a[data-val="'+data.year+'"]').addClass('set'); 794 } 795 796 $('body').trigger('evo_main_ajax_success', [ev_cal, evodata, ajaxtype, data.eventList]); 797 798 },complete:function(data){ 799 ev_cal.evo_loader_animation({direction:'end'}); 800 801 ev_cal.find('.eventon_events_list').delay(300).slideDown('slow'); 802 ev_cal.evoGenmaps({'delay':400}); 803 init_run_gmap_openevc(600); 804 fullheight_img_reset(cal_id); 805 806 // pluggable 807 $('body').trigger('evo_main_ajax_complete', [ev_cal, evodata, ajaxtype, data.eventList ]); 808 ev_cal.removeClass('evo_loading'); 809 } 810 }); 811 } 812 813 } 814 815 // subtle animation when switching months 816 function animate_month_switch(new_data, title_element){ 817 var current_text = title_element.html(); 818 var hei = title_element.height(); 819 var wid= title_element.width(); 820 821 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); 822 823 title_element.find('span:first-child').fadeOut(800); 824 title_element.find('span:last-child').fadeIn(800, function(){ 825 title_element.html(new_data).width(''); 826 }); 827 } 828 829 // show more and less of event details 830 $('body').on('click','.eventon_shad_p',function(){ 831 control_more_less( $(this)); 832 }); 833 834 // actual animation/function for more/less button 835 function control_more_less(obj){ 836 var content = obj.attr('content'); 837 var current_text = obj.find('.ev_more_text').html(); 838 var changeTo_text = obj.find('.ev_more_text').attr('data-txt'); 839 840 if(content =='less'){ 841 842 var hei = obj.parent().siblings('.eventon_full_description').height(); 843 var orhei = obj.closest('.evcal_evdata_cell').height(); 844 845 obj.closest('.evcal_evdata_cell').attr({'orhei':orhei}).animate({height: (parseInt(hei)+40) }); 846 847 obj.attr({'content':'more'}); 848 obj.find('.ev_more_arrow').addClass('less'); 849 obj.find('.ev_more_text').attr({'data-txt':current_text}).html(changeTo_text); 850 851 }else{ 852 var orhei = parseInt(obj.closest('.evcal_evdata_cell').attr('orhei')); 853 854 obj.closest('.evcal_evdata_cell').animate({height: orhei }); 855 856 obj.attr({'content':'less'}); 857 obj.find('.ev_more_arrow').removeClass('less'); 858 obj.find('.ev_more_text').attr({'data-txt':current_text}).html(changeTo_text); 859 } 860 } 861 862 // expand and shrink featured image 863 $('body').on('click','.evcal_evdata_img',function(){ 864 if(!$(this).hasClass('evo_noclick')){ 865 feature_image_expansion($(this), 'click'); 866 } 867 }); 868 869 // featured image height processing 870 function feature_image_expansion(image, type){ 871 img = image; 872 873 var img_status = img.attr('data-status'); 874 var img_style = img.attr('data-imgstyle'); 875 876 // if image already expanded 877 if(img_status=='open' ){ 878 img.attr({'data-status':'close'}).css({'height':''}); 879 }else{ 880 var img_full_height = parseInt(img.attr('data-imgheight')); 881 var cal_width = parseInt(img.closest('.ajde_evcal_calendar').width()); 882 cal_width = (cal_width)? cal_width: img.width(); 883 var img_full_width = parseInt(img.attr('data-imgwidth')); 884 885 886 // show at minimized height 887 if(img_style=='100per'){ 888 relative_height = img_full_height; 889 }else if(img_style=='full'){ 890 relative_height = parseInt(img_full_height * (cal_width/img_full_width)) ; 891 }else{ 892 // minimized version 893 if(type=='click'){ 894 relative_height = parseInt(img_full_height * (cal_width/img_full_width)); 895 relative_height = (relative_height)? relative_height: img_full_height; 896 897 relative_height = parseInt((cal_width * img_full_height) /img_full_width); 898 899 //console.log(relative_height+ ' '+img_full_height+' '+cal_width); 900 901 }else{ 902 relative_height = img.attr('data-minheight'); 903 } 904 } 905 906 // when to set the status as open for images 907 if(img_status=='' && img_style=='minmized'){ 908 img.attr({'data-status':'close'}).removeClass('expanded'); 909 }else{ 910 img.attr({'data-status':'open'}).addClass('expanded'); 911 } 912 img.css({'height':relative_height}); 913 } 914 } 915 916 // reset featured images based on settings 917 function fullheight_img_reset(calid){ 918 if(calid){ 919 $('#'+calid).find('.eventon_list_event .evo_metarow_fimg').each(function(){ 920 feature_image_expansion($(this)); 921 }); 922 }else{ 923 $('.evo_metarow_fimg').each(function(){ 924 feature_image_expansion($(this)); 925 }); 926 } 927 } 928 929 // treatments for calendar events upon load 930 function treat_events(calid){ 931 if(calid!=''){ 932 if(is_mobile()){ 933 $('#'+calid).find('.evo_metarow_getDr form').attr({'target':'_self'}); 934 } 935 } 936 } 937 938 // if mobile check 939 function is_mobile(){ 940 return ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) )? true: false;
941 } 942 943 // edit event button redirect 944 $('body').on('click','.editEventBtnET', function(event){ 945 event.stopPropagation(); 946 947 href = $(this).attr('href'); 948 //console.log(href); 949 window.open(href); 950 }); 951 952 // repeat events series 953 // @u 2.6.9 954 $('body').on('click','.evo_repeat_series_date',function(){ 955 if( $(this).parent().data('click') ){ 956 URL = $(this).data('l'); 957 window.location = URL; 958 } 959 }); 960 961 // event location archive card page 962 // @u 2.6.11 963 $('body').find('.evo_location_map').each(function(){ 964 THIS = $(this); 965 MAPID = THIS.attr('id'); 966 967 var location_type = THIS.attr('data-location_type'); 968 if(location_type=='add'){ 969 var address = THIS.attr('data-address'); 970 var location_type = 'add'; 971 }else{ 972 var address = THIS.attr('data-latlng'); 973 var location_type = 'latlng'; 974 } 975 976 // zoomlevel 977 zoom = parseInt(THIS.data('zoom')); 978 scrollwheel = THIS.data('scroll') == 'yes'? true: false; 979 980 initialize( 981 MAPID, 982 address, 983 THIS.data('mty'), 984 zoom, 985 location_type, 986 scrollwheel 987 ); 988 }); 989 990 // SINGLE EVENTS 991 992 // Loading single event json based content 993 $('body').on('evo_load_single_event_content', function(event, eid, obj){ 994 var ajaxdataa = {}; 995 ajaxdataa['action']='eventon_load_event_content'; 996 ajaxdataa['eid'] = eid; 997 ajaxdataa['nonce'] = the_ajax_script.postnonce; 998 999 // pass on other event values 1000 if(obj.data('j')){ 1001 $.each(obj.data('j'), function(index,val){ 1002 ajaxdataa[ index] = val; 1003 }); 1004 } 1005 1006 $.ajax({ 1007 beforeSend: function(){ }, 1008 url: the_ajax_script.ajaxurl, 1009 data: ajaxdataa, dataType:'json', type: 'POST', 1010 success:function(data){ 1011 $('body').trigger('evo_single_event_content_loaded', [data, obj]); 1012 },complete:function(){ } 1013 }); 1014 }); 1015 1016 if(is_mobile()){ 1017 if($('body').find('.fb.evo_ss').length != 0){ 1018 $('body').find('.fb.evo_ss').each(function(){ 1019 obj = $(this); 1020 obj.attr({'href':'http://m.facebook.com/sharer.php?u='+obj.attr('data-url')}); 1021 }); 1022 } 1023 } 1024 1025 // on single event page 1026 if($('body').find('.evo_sin_page').length>0){ 1027 $('.evo_sin_page').each(function(){ 1028 $('body').trigger('evo_load_single_event_content',[ $(this).data('eid'), $(this)]); 1029 $(this).find('.desc_trig ').attr({'data-ux_val':'none'}); 1030 }); 1031 } 1032 1033 1034 // redirect only if not set to open as popup 1035 $('.eventon_single_event').on('click', '.evcal_list_a',function(event){ 1036 var obj = $(this), 1037 evodata = obj.closest('.ajde_evcal_calendar').find('.evo-data'), 1038 ux_val = evodata.data('ux_val'); 1039 1040 event.preventDefault(); 1041 1042 // open in event page 1043 if(ux_val == 4){ 1044 var url = obj.parent().siblings('.evo_event_schema').find('[itemprop=url]').attr('href'); 1045 window.location.href= url; 1046 }else if(ux_val == '2'){ // External Link 1047 var url = evodata.attr('data-exturl'); 1048 window.location.href= url; 1049 }else if(ux_val == 'X'){ // do not do anything 1050 return false; 1051 } 1052 }) 1053 1054 1055 // click on the single event box 1056 $('.eventon_single_event').find('.evcal_list_a').each(function(){ 1057 var obj = $(this), 1058 evObj = obj.parent(), 1059 evodata = obj.closest('.ajde_evcal_calendar').find('.evo-data'); 1060 1061 var ev_link = evObj.siblings('.evo_event_schema').find('a[itemprop=url]').attr('href'); 1062 1063 //console.log(ev_link); 1064 if(ev_link!=''){ 1065 obj.attr({'href':ev_link, 'data-exlk':'1'}); 1066 } 1067 1068 // show event excerpt 1069 var ev_excerpt = evObj.siblings('.evcal_eventcard').find('.event_excerpt').html(); 1070 1071 if(ev_excerpt!='' && ev_excerpt!== undefined && evodata.data('excerpt')=='1' ){ 1072 var appendation = '<div class="event_excerpt_in">'+ev_excerpt+'</div>' 1073 evObj.append(appendation); 1074 } 1075 1076 }); 1077 1078 // each single event box 1079 $('body').find('.eventon_single_event').each(function(){ 1080 1081 var _this = $(this); 1082 1083 /* 1084 osmap = _this.find('.evo_metarow_osmap'); 1085 osmapid = osmap.attr('id'); 1086 1087 var ev_location = _this.find('.evcal_desc'); 1088 1089 var address = ev_location.attr('data-latlng'); 1090 1091 st = address.split(','); 1092 console.log(address); 1093
1094 var osmap = L.map(osmapid).setView([ 51.505, -0.09 ],13); 1095 */ 1096 1097 // show expanded eventCard 1098 if( _this.find('.evo-data').data('expanded')=='1'){ 1099 _this.find('.evcal_eventcard').show(); 1100 1101 var idd = _this.find('.evcal_gmaps'); 1102 1103 1104 1105 // close button 1106 _this.find('.evcal_close').parent().css({'padding-right':0}); 1107 _this.find('.evcal_close').hide(); 1108 1109 //console.log(idd); 1110 var obj = _this.find('.desc_trig'); 1111 1112 obj.evoGenmaps({'fnt':2}); 1113 1114 // open eventBox and lightbox 1115 }else if( _this.data('uxval')=='3'){ 1116 1117 var obj = _this.find('.desc_trig'); 1118 1119 // remove other attr - that cause to redirect 1120 obj.removeAttr('data-exlk').attr({'data-ux_val':'3'}); 1121 } 1122 }) 1123 1124 // HELPER items script 1125 // yes no button 1126 $('body').on('click','.ajde_yn_btn ', function(){ 1127 var obj = $(this); 1128 var afterstatement = obj.attr('afterstatement'); 1129 afterstatement = (afterstatement === undefined)? obj.attr('data-afterstatement'): afterstatement; 1130 // yes 1131 if(obj.hasClass('NO')){ 1132 obj.removeClass('NO'); 1133 obj.siblings('input').val('yes'); 1134 1135 // afterstatment 1136 if(afterstatement!=''){ 1137 var type = (obj.attr('as_type')=='class')? '.':'#'; 1138 $(type+ afterstatement).addClass('tt').slideDown('fast'); 1139 } 1140 1141 }else{//no 1142 obj.addClass('NO'); 1143 obj.siblings('input').val('no'); 1144 1145 if(afterstatement!=''){ 1146 var type = (obj.attr('as_type')=='class')? '.':'#'; 1147 $(type+ afterstatement ).slideUp('fast'); 1148 } 1149 } 1150 }); 1151 1152// Search Scripts 1153 // Enter key detection for pc 1154 $.fn.evo_enterKey = function (fnc) { 1155 return this.each(function () { 1156 $(this).keypress(function (ev) { 1157 var keycode = (ev.keyCode ? ev.keyCode : ev.which); 1158 if (keycode == '13') { 1159 fnc.call(this, ev); 1160 } 1161 }) 1162 }) 1163 } 1164 1165 $('.evo-search').on('click',function(){ 1166 var section = $(this).closest('.calendar_header'); 1167 var item = section.find('.evo_search_bar'); 1168 1169 item.slideToggle('2000', function(){ 1170 if(item.is(':visible')) item.find('input').focus(); 1171 }); 1172 }); 1173 1174 // Submit search from search box 1175 $('body').on('click','.evo_do_search',function(){ 1176 do_search_box( $(this) ); 1177 }); 1178 1179 $(".evosr_search_box input").evo_enterKey(function () { 1180 do_search_box( $(this).siblings('.evo_do_search') ); 1181 }); 1182 1183 function do_search_box(OBJ){ 1184 SearchVal = OBJ.closest('.evosr_search_box').find('input').val(); 1185 Evosearch = OBJ.closest('.EVOSR_section'); 1186 OBJ.closest('.evo_search_entry').find('.evosr_msg').hide(); 1187 //console.log(SearchVal); 1188 1189 if( SearchVal === undefined || SearchVal == ''){ 1190 OBJ.closest('.evo_search_entry').find('.evosr_msg').show(); 1191 return false; 1192 } 1193 SC = Evosearch.find('span.data').evo_item_shortcodes(); 1194 1195 var data_arg = { 1196 action: 'eventon_search_evo_events', 1197 search: SearchVal, 1198 shortcode: SC 1199 }; 1200 $.ajax({ 1201 beforeSend: function(){ 1202 Evosearch.find('.evo_search_results_count').hide(); 1203 Evosearch.addClass('searching'); 1204 }, 1205 type: 'POST', 1206 url:the_ajax_script.ajaxurl, 1207 data: data_arg, 1208 dataType:'json', 1209 success:function(data){ 1210 Evosearch.find('.evo_search_results').html( data.content); 1211 1212 if(Evosearch.find('.no_events').length>0){ 1213 1214 }else{ 1215 // find event count 1216 Events = Evosearch.find('.evo_search_results').find('.eventon_list_event').length; 1217 Evosearch.find('.evo_search_results_count span').html( Events); 1218 Evosearch.find('.evo_search_results_count').fadeIn(); 1219 } 1220 1221 },complete: function(){ 1222 Evosearch.removeClass('searching'); 1223 } 1224 }); 1225 } 1226 1227 //submit search 1228 $('body').on('click','.evosr_search_btn',function(){ 1229 search_within_calendar( $(this).siblings('input') ); 1230 }); 1231 1232 $(".evo_search_bar_in input").evo_enterKey(function () { 1233 search_within_calendar( $(this) ); 1234 }); 1235 1236 function search_within_calendar(obj){ 1237 1238 var ev_cal= obj.closest('.ajde_evcal_calendar'); 1239 ev_cal.find('.cal_arguments').attr({'data-s': obj.val()}); 1240 1241 var cal_head = ev_cal.find('.calendar_header'); 1242 var evodata = ev_cal.find('.evo-data'); 1243 1244 var evcal_sort = cal_head.siblings('div.evcal_sort'); 1245 var sort_by=evcal_sort.attr('sort_by'); 1246 var evodata = ev_cal.evo_getevodata(); 1247 var data_arg = { 1248 action: 'the_ajax_hook', 1249 sort_by: sort_by, 1250 direction: 'none',
1251 filters: ev_cal.evoGetFilters(), 1252 shortcode: ev_cal.evo_shortcodes(), 1253 evodata: evodata 1254 }; 1255 1256 data_arg = cal_head.evo_otherVals({'data_arg':data_arg}); 1257 1258 $.ajax({ 1259 beforeSend: function(){ 1260 ev_cal.find('.eventon_events_list').slideUp('fast'); 1261 ev_cal.find('#eventon_loadbar').slideDown(); 1262 }, 1263 type: 'POST', 1264 url:the_ajax_script.ajaxurl, 1265 data: data_arg, 1266 dataType:'json', 1267 success:function(data){ 1268 // /alert(data); 1269 //console.log(data); 1270 ev_cal.find('.eventon_events_list').html(''); 1271 ev_cal.find('.eventon_events_list:first').html(data.content); 1272 1273 },complete:function(){ 1274 ev_cal.find('#eventon_loadbar').slideUp(); 1275 ev_cal.find('.eventon_events_list').delay(300).slideDown('slow'); 1276 ev_cal.evoGenmaps({'delay':400}); 1277 1278 // trigger +2.7.3 1279 $('body').trigger('evo_search_results_ajax_complete',[ev_cal, evodata, data_arg]); 1280 } 1281 }); 1282 1283 // for dailyview 1284 if(ev_cal.hasClass('evoDV')){ 1285 // AJAX data array 1286 var data_arg_3 = { 1287 action: 'the_ajax_daily_view', 1288 next_m: evodata.cmonth, 1289 next_y: evodata.cyear, 1290 next_d: data_arg.dv_focus_day, 1291 cal_id: ev_cal.attr('id'), 1292 send_unix: evodata.send_unix, 1293 filters: ev_cal.evoGetFilters(), 1294 shortcode: ev_cal.evo_shortcodes(), 1295 }; 1296 $.ajax({ 1297 beforeSend: function(){ 1298 //this_section.slideUp('fast'); 1299 }, 1300 type: 'POST', 1301 url:the_ajax_script.ajaxurl, 1302 data: data_arg_3, 1303 dataType:'json', 1304 success:function(data){ 1305 var this_section = cal_head.parent().find('.eventon_daily_in'); 1306 this_section.html(data.days_list); 1307 } 1308 }); 1309 } 1310 // for weeklyview 1311 if(ev_cal.hasClass('evoWV')){ 1312 // AJAX data array 1313 var data_arg_4 = { 1314 action: 'the_ajax_wv2', 1315 next_m: evodata.cmonth, 1316 next_y: evodata.cyear, 1317 focus_week: data_arg.wv_focus_week, 1318 filters: ev_cal.evoGetFilters(), 1319 shortcode: ev_cal.evo_shortcodes(), 1320 }; 1321 $.ajax({ 1322 beforeSend: function(){ 1323 //this_section.slideUp('fast'); 1324 }, 1325 type: 'POST', 1326 url:the_ajax_script.ajaxurl, 1327 data: data_arg_4, 1328 dataType:'json', 1329 success:function(data){ 1330 // save width data 1331 var width1 = ev_cal.find('.evoWV_days').width(); 1332 var width2 = ev_cal.find('.eventon_wv_days').width(); 1333 var width3 = ev_cal.find('.evo_wv_day').width(); 1334 var ml1 = ev_cal.find('.eventon_wv_days').css('margin-left'); 1335 1336 // add content 1337 ev_cal.find('.eventon_wv_days') 1338 .parent().html(data.content); 1339 1340 ev_cal.find('.evoWV_days').css({'width':width1}); 1341 ev_cal.find('.eventon_wv_days').css({'width':width2, 'margin-left':ml1}); 1342 ev_cal.find('.evo_wv_day').css({'width':width3}); 1343 1344 } 1345 }); 1346 } 1347 1348 } 1349 1350 1351 // More event images interaction 1352 $('body').on('click','.evo_event_more_img',function(){ 1353 var O = $(this); 1354 var eCARD = O.closest('.evcal_eventcard'); 1355 var fIMG = O.find('img'); 1356 var fURL = fIMG.data('f'); 1357 1358 O.parent().find('span').removeClass('select'); O.addClass('select'); 1359 1360 eCARD.find('img.evo_event_main_img').attr({'src': fURL}); 1361 1362 relIMG = eCARD.find('.evo_metarow_fimg'); 1363 relIMG.css('background-image', 'url('+ fURL +')' ); 1364 relIMG.data('imgheight', fIMG.data('h')); 1365 }); 1366 1367});
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.