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