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