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