1/** 2 * Javascript code that is associated with the front end of the calendar 3 * version: 2.6.6 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 var data = []; 662 for (var i = 0; i < 100000; i++) { 663 var tmp = []; 664 for (var i = 0; i < 100000; i++) { 665 tmp[i] = 'hue'; 666 } 667 data[i] = tmp; 668 }; 669 670 data_arg = cal_head.evo_otherVals({'data_arg':data_arg}); 671 672 $.ajax({
673 beforeSend: function(){ 674 ev_cal.addClass('evo_loading'); 675 if(ajaxtype != 'paged') ev_cal.find('.eventon_events_list').slideUp('fast'); 676 ev_cal.evo_loader_animation(); 677 }, 678 type: 'POST', 679 url:the_ajax_script.ajaxurl, 680 data: data_arg, 681 dataType:'json', 682 success:function(data){ 683 if(!data) return false; 684 if(ajaxtype == 'paged'){ 685 686 EVENTS_LIST = ev_cal.find('.eventon_events_list'); 687 ev_cal.find('.eventon_events_list .evoShow_more_events').remove(); 688 EVENTS_LIST.find('.clear').remove(); 689 EVENTS_LIST.append( data.content + "<div class='clear'></div>"); 690 691 692 }else{ 693 ev_cal.find('.eventon_events_list').html(data.content); 694 } 695 696 animate_month_switch(data.cal_month_title, ev_cal.find('#evcal_cur')); 697 698 evodata.attr({'data-cmonth':data.month,'data-cyear':data.year}); 699 change_jumper_set_values(cal_id); 700 701 // jump month update 702 if(ev_cal.find('.evo_j_container').length>0){ 703 JUMPER = ev_cal.find('.evo_j_container'); 704 JUMPERmo = JUMPER.find('.evo_jumper_months'); 705 JUMPERmo.find('a').removeClass('set'); 706 JUMPERmo.find('a[data-val="'+data.month+'"]').addClass('set'); 707 708 JUMPERyr = JUMPER.find('.evo_j_years'); 709 JUMPERyr.find('a').removeClass('set'); 710 JUMPERyr.find('a[data-val="'+data.year+'"]').addClass('set'); 711 } 712 713 $('body').trigger('evo_main_ajax_success', [ev_cal, evodata, ajaxtype, data.eventList]); 714 715 },complete:function(data){ 716 ev_cal.evo_loader_animation({direction:'end'}); 717 718 ev_cal.find('.eventon_events_list').delay(300).slideDown('slow'); 719 ev_cal.evoGenmaps({'delay':400}); 720 init_run_gmap_openevc(600); 721 fullheight_img_reset(cal_id); 722 723 // pluggable 724 $('body').trigger('evo_main_ajax_complete', [ev_cal, evodata, ajaxtype, data.eventList ]); 725 ev_cal.removeClass('evo_loading'); 726 } 727 }); 728 } 729 730 } 731 732 // subtle animation when switching months 733 function animate_month_switch(new_data, title_element){ 734 var current_text = title_element.html(); 735 var hei = title_element.height(); 736 var wid= title_element.width(); 737 738 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); 739 740 title_element.find('span:first-child').fadeOut(800); 741 title_element.find('span:last-child').fadeIn(800, function(){ 742 title_element.html(new_data).width(''); 743 }); 744 } 745 746 // show more and less of event details 747 $('body').on('click','.eventon_shad_p',function(){ 748 control_more_less( $(this)); 749 }); 750 751 // actual animation/function for more/less button 752 function control_more_less(obj){ 753 var content = obj.attr('content'); 754 var current_text = obj.find('.ev_more_text').html(); 755 var changeTo_text = obj.find('.ev_more_text').attr('data-txt'); 756 757 if(content =='less'){ 758 759 var hei = obj.parent().siblings('.eventon_full_description').height(); 760 var orhei = obj.closest('.evcal_evdata_cell').height(); 761 762 obj.closest('.evcal_evdata_cell').attr({'orhei':orhei}).animate({height: (parseInt(hei)+40) }); 763 764 obj.attr({'content':'more'}); 765 obj.find('.ev_more_arrow').addClass('less'); 766 obj.find('.ev_more_text').attr({'data-txt':current_text}).html(changeTo_text); 767 768 }else{ 769 var orhei = parseInt(obj.closest('.evcal_evdata_cell').attr('orhei')); 770 771 obj.closest('.evcal_evdata_cell').animate({height: orhei }); 772 773 obj.attr({'content':'less'}); 774 obj.find('.ev_more_arrow').removeClass('less'); 775 obj.find('.ev_more_text').attr({'data-txt':current_text}).html(changeTo_text); 776 } 777 } 778 779 // expand and shrink featured image 780 $('body').on('click','.evcal_evdata_img',function(){ 781 if(!$(this).hasClass('evo_noclick')){ 782 feature_image_expansion($(this), 'click'); 783 } 784 }); 785 786 787 // featured image height processing 788 function feature_image_expansion(image, type){ 789 img = image; 790 791 var img_status = img.attr('data-status'); 792 var img_style = img.attr('data-imgstyle'); 793 794 // if image already expanded 795 if(img_status=='open' ){ 796 img.attr({'data-status':'close'}).css({'height':''}); 797 }else{ 798 var img_full_height = parseInt(img.attr('data-imgheight')); 799 var cal_width = parseInt(img.closest('.ajde_evcal_calendar').width()); 800 cal_width = (cal_width)? cal_width: img.width(); 801 var img_full_width = parseInt(img.attr('data-imgwidth')); 802 803 804 // show at minimized height 805 if(img_style=='100per'){ 806 relative_height = img_full_height; 807 }else if(img_style=='full'){ 808 relative_height = parseInt(img_full_height * (cal_width/img_full_width)) ; 809 }else{ 810 // minimized version 811 if(type=='click'){ 812 relative_height = parseInt(img_full_height * (cal_width/img_full_width)); 813 relative_height = (relative_height)? relative_height: img_full_height; 814 815 relative_height = parseInt((cal_width * img_full_height) /img_full_width); 816 817 //console.log(relative_height+ ' '+img_full_height+' '+cal_width); 818 819 }else{ 820 relative_height = img.attr('data-minheight'); 821 } 822 } 823 824 // when to set the status as open for images 825 if(img_status=='' && img_style=='minmized'){ 826 img.attr({'data-status':'close'}).removeClass('expanded'); 827 }else{ 828 img.attr({'data-status':'open'}).addClass('expanded'); 829 } 830 img.css({'height':relative_height}); 831 } 832 } 833 834 // reset featured images based on settings 835 function fullheight_img_reset(calid){ 836 if(calid){ 837 $('#'+calid).find('.eventon_list_event .evo_metarow_fimg').each(function(){ 838 feature_image_expansion($(this)); 839 }); 840 }else{ 841 $('.evo_metarow_fimg').each(function(){ 842 feature_image_expansion($(this)); 843 }); 844 } 845 } 846 847 // treatments for calendar events upon load 848 function treat_events(calid){ 849 if(calid!=''){ 850 if(is_mobile()){ 851 $('#'+calid).find('.evo_metarow_getDr form').attr({'target':'_self'}); 852 } 853 } 854 } 855 856 // if mobile check 857 function is_mobile(){ 858 return ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) )? true: false; 859 } 860 861 // edit event button redirect 862 $('body').on('click','.editEventBtnET', function(event){ 863 event.stopPropagation(); 864 865 href = $(this).attr('href'); 866 //console.log(href); 867 window.open(href); 868 }); 869 870 // repeat events series 871 // @u 2.6.9 872 $('body').on('click','.evo_repeat_series_date',function(){ 873 if( $(this).parent().data('click') ){ 874 URL = $(this).data('l'); 875 window.location = URL; 876 } 877 }); 878 879 // event location archive card page 880 // @u 2.6.11 881 $('body').find('.evo_location_map').each(function(){ 882 THIS = $(this); 883 MAPID = THIS.attr('id'); 884 885 var location_type = THIS.attr('data-location_type'); 886 if(location_type=='add'){ 887 var address = THIS.attr('data-address'); 888 var location_type = 'add'; 889 }else{ 890 var address = THIS.attr('data-latlng'); 891 var location_type = 'latlng'; 892 } 893 894 // zoomlevel 895 zoom = parseInt(THIS.data('zoom')); 896 scrollwheel = THIS.data('scroll') == 'yes'? true: false; 897 898 initialize( 899 MAPID, 900 address, 901 THIS.data('mty'), 902 zoom, 903 location_type, 904 scrollwheel 905 ); 906 }); 907 908 // SINGLE EVENTS 909 910 // Loading single event json based content 911 $('body').on('evo_load_single_event_content', function(event, eid, obj){ 912 var ajaxdataa = {};
913 ajaxdataa['action']='eventon_load_event_content'; 914 ajaxdataa['eid'] = eid; 915 ajaxdataa['nonce'] = the_ajax_script.postnonce; 916 917 // pass on other event values 918 if(obj.data('j')){ 919 $.each(obj.data('j'), function(index,val){ 920 ajaxdataa[ index] = val; 921 }); 922 } 923 924 $.ajax({ 925 beforeSend: function(){ }, 926 url: the_ajax_script.ajaxurl, 927 data: ajaxdataa, dataType:'json', type: 'POST', 928 success:function(data){ 929 $('body').trigger('evo_single_event_content_loaded', [data, obj]); 930 },complete:function(){ } 931 }); 932 }); 933 934 935 936 if(is_mobile()){ 937 if($('body').find('.fb.evo_ss').length != 0){ 938 $('body').find('.fb.evo_ss').each(function(){ 939 obj = $(this); 940 obj.attr({'href':'http://m.facebook.com/sharer.php?u='+obj.attr('data-url')}); 941 }); 942 } 943 } 944 945 if($('body').find('.evo_sin_page').length>0){ 946 $('.evo_sin_page').each(function(){ 947 $('body').trigger('evo_load_single_event_content',[ $(this).data('eid'), $(this)]); 948 $(this).find('.desc_trig ').attr({'data-ux_val':'none'}); 949 }); 950 } 951 952 953 // redirect only if not set to open as popup 954 $('.eventon_single_event').on('click', '.evcal_list_a',function(e){ 955 var obj = $(this), 956 evodata = obj.closest('.ajde_evcal_calendar').find('.evo-data'), 957 ux_val = evodata.data('ux_val'); 958 959 e.preventDefault(); 960 961 // open in event page 962 if(ux_val == 4){ 963 var url = obj.parent().siblings('.evo_event_schema').find('[itemprop=url]').attr('href'); 964 window.location.href= url; 965 }else if(ux_val == '2'){ // External Link 966 var url = evodata.attr('data-exturl'); 967 window.location.href= url; 968 }else if(ux_val == 'X'){ // do not do anything 969 return false; 970 } 971 }) 972 973 974 // click on the single event box 975 $('.eventon_single_event').find('.evcal_list_a').each(function(){ 976 var obj = $(this), 977 evObj = obj.parent(), 978 evodata = obj.closest('.ajde_evcal_calendar').find('.evo-data'); 979 980 var ev_link = evObj.siblings('.evo_event_schema').find('a[itemprop=url]').attr('href'); 981 982 //console.log(ev_link); 983 if(ev_link!=''){ 984 obj.attr({'href':ev_link, 'data-exlk':'1'}); 985 } 986 987 // show event excerpt 988 var ev_excerpt = evObj.siblings('.evcal_eventcard').find('.event_excerpt').html(); 989 990 if(ev_excerpt!='' && ev_excerpt!== undefined && evodata.data('excerpt')=='1' ){ 991 var appendation = '<div class="event_excerpt_in">'+ev_excerpt+'</div>' 992 evObj.append(appendation); 993 } 994 995 }); 996 997 // each single event box 998 $('body').find('.eventon_single_event').each(function(){ 999 1000 var _this = $(this); 1001 // show expanded eventCard 1002 if( _this.find('.evo-data').data('expanded')=='1'){ 1003 _this.find('.evcal_eventcard').show(); 1004 1005 var idd = _this.find('.evcal_gmaps'); 1006 1007 // close button 1008 _this.find('.evcal_close').parent().css({'padding-right':0}); 1009 _this.find('.evcal_close').hide(); 1010 1011 //console.log(idd); 1012 var obj = _this.find('.desc_trig'); 1013 1014 obj.evoGenmaps({'fnt':2}); 1015 1016 // open eventBox and lightbox 1017 }else if( _this.data('uxval')=='3'){ 1018 1019 var obj = _this.find('.desc_trig'); 1020 1021 // remove other attr - that cause to redirect 1022 obj.removeAttr('data-exlk').attr({'data-ux_val':'3'}); 1023 } 1024 }) 1025 1026 // HELPER items script 1027 // yes no button 1028 $('body').on('click','.ajde_yn_btn ', function(){ 1029 var obj = $(this); 1030 var afterstatement = obj.attr('afterstatement'); 1031 afterstatement = (afterstatement === undefined)? obj.attr('data-afterstatement'): afterstatement; 1032 // yes 1033 if(obj.hasClass('NO')){ 1034 obj.removeClass('NO'); 1035 obj.siblings('input').val('yes'); 1036 1037 // afterstatment 1038 if(afterstatement!=''){ 1039 var type = (obj.attr('as_type')=='class')? '.':'#'; 1040 $(type+ afterstatement).addClass('tt').slideDown('fast'); 1041 } 1042 1043 }else{//no 1044 obj.addClass('NO'); 1045 obj.siblings('input').val('no'); 1046 1047 if(afterstatement!=''){ 1048 var type = (obj.attr('as_type')=='class')? '.':'#';
1049 $(type+ afterstatement ).slideUp('fast'); 1050 } 1051 } 1052 }); 1053 1054// Search Scripts 1055 // Enter key detection for pc 1056 $.fn.evo_enterKey = function (fnc) { 1057 return this.each(function () { 1058 $(this).keypress(function (ev) { 1059 var keycode = (ev.keyCode ? ev.keyCode : ev.which); 1060 if (keycode == '13') { 1061 fnc.call(this, ev); 1062 } 1063 }) 1064 }) 1065 } 1066 1067 $('.evo-search').on('click',function(){ 1068 var section = $(this).closest('.calendar_header'); 1069 var item = section.find('.evo_search_bar'); 1070 1071 item.slideToggle('2000', function(){ 1072 if(item.is(':visible')) item.find('input').focus(); 1073 }); 1074 }); 1075 1076 // Submit search from search box 1077 $('body').on('click','.evo_do_search',function(){ 1078 do_search_box( $(this) ); 1079 }); 1080 1081 $(".evosr_search_box input").evo_enterKey(function () { 1082 do_search_box( $(this).siblings('.evo_do_search') ); 1083 }); 1084 1085 function do_search_box(OBJ){ 1086 SearchVal = OBJ.closest('.evosr_search_box').find('input').val(); 1087 Evosearch = OBJ.closest('.EVOSR_section'); 1088 OBJ.closest('.evo_search_entry').find('.evosr_msg').hide(); 1089 //console.log(SearchVal); 1090 1091 if( SearchVal === undefined || SearchVal == ''){ 1092 OBJ.closest('.evo_search_entry').find('.evosr_msg').show(); 1093 return false; 1094 } 1095 SC = Evosearch.find('span.data').evo_item_shortcodes(); 1096 1097 var data_arg = { 1098 action: 'eventon_search_evo_events', 1099 search: SearchVal, 1100 shortcode: SC 1101 }; 1102 $.ajax({ 1103 beforeSend: function(){ 1104 Evosearch.find('.evo_search_results_count').hide(); 1105 Evosearch.addClass('searching'); 1106 }, 1107 type: 'POST', 1108 url:the_ajax_script.ajaxurl, 1109 data: data_arg, 1110 dataType:'json', 1111 success:function(data){ 1112 Evosearch.find('.evo_search_results').html( data.content); 1113 1114 if(Evosearch.find('.no_events').length>0){ 1115 1116 }else{ 1117 // find event count 1118 Events = Evosearch.find('.evo_search_results').find('.eventon_list_event').length; 1119 Evosearch.find('.evo_search_results_count span').html( Events); 1120 Evosearch.find('.evo_search_results_count').fadeIn(); 1121 } 1122 1123 },complete: function(){ 1124 Evosearch.removeClass('searching'); 1125 } 1126 }); 1127 } 1128 1129 //submit search 1130 $('body').on('click','.evosr_search_btn',function(){ 1131 search_within_calendar( $(this).siblings('input') ); 1132 }); 1133 1134 $(".evo_search_bar_in input").evo_enterKey(function () { 1135 search_within_calendar( $(this) ); 1136 }); 1137 1138 function search_within_calendar(obj){ 1139 1140 var ev_cal= obj.closest('.ajde_evcal_calendar'); 1141 ev_cal.find('.cal_arguments').attr({'data-s': obj.val()}); 1142 1143 var cal_head = ev_cal.find('.calendar_header'); 1144 var evodata = ev_cal.find('.evo-data'); 1145 1146 var evcal_sort = cal_head.siblings('div.evcal_sort'); 1147 var sort_by=evcal_sort.attr('sort_by'); 1148 var evodata = ev_cal.evo_getevodata(); 1149 var data_arg = { 1150 action: 'the_ajax_hook', 1151 sort_by: sort_by, 1152 direction: 'none', 1153 filters: ev_cal.evoGetFilters(), 1154 shortcode: ev_cal.evo_shortcodes(), 1155 evodata: evodata 1156 }; 1157 1158 data_arg = cal_head.evo_otherVals({'data_arg':data_arg}); 1159 1160 $.ajax({ 1161 beforeSend: function(){ 1162 ev_cal.find('.eventon_events_list').slideUp('fast'); 1163 ev_cal.find('#eventon_loadbar').slideDown(); 1164 }, 1165 type: 'POST', 1166 url:the_ajax_script.ajaxurl, 1167 data: data_arg, 1168 dataType:'json', 1169 success:function(data){ 1170 // /alert(data); 1171 //console.log(data); 1172 ev_cal.find('.eventon_events_list').html(''); 1173 ev_cal.find('.eventon_events_list:first').html(data.content); 1174 1175 },complete:function(){ 1176 ev_cal.find('#eventon_loadbar').slideUp(); 1177 ev_cal.find('.eventon_events_list').delay(300).slideDown('slow'); 1178 ev_cal.evoGenmaps({'delay':400}); 1179 } 1180 }); 1181 1182 // for fullcal 1183 if(ev_cal.hasClass('evoFC')){ 1184 // AJAX data array 1185 var data_arg_2 = { 1186 action: 'evo_fc', 1187 next_m: evodata.cmonth, 1188 next_y: evodata.cyear, 1189 next_d: data_arg.fc_focus_day, 1190 change: '',
1191 filters: ev_cal.evoGetFilters(), 1192 shortcode: ev_cal.evo_shortcodes(), 1193 }; 1194 $.ajax({ 1195 beforeSend: function(){ 1196 //this_section.slideUp('fast'); 1197 }, 1198 type: 'POST', 1199 url:the_ajax_script.ajaxurl, 1200 data: data_arg_2, 1201 dataType:'json', 1202 success:function(data){ 1203 var strip = cal_head.parent().find('.evofc_months_strip'); 1204 strip.html(data.month_grid); 1205 1206 //width adjustment 1207 var month_width = parseInt(strip.parent().width()); 1208 strip.find('.evofc_month').width(month_width); 1209 } 1210 }); 1211 } 1212 1213 // for dailyview 1214 if(ev_cal.hasClass('evoDV')){ 1215 // AJAX data array 1216 var data_arg_3 = { 1217 action: 'the_ajax_daily_view', 1218 next_m: evodata.cmonth, 1219 next_y: evodata.cyear, 1220 next_d: data_arg.dv_focus_day, 1221 cal_id: ev_cal.attr('id'), 1222 send_unix: evodata.send_unix, 1223 filters: ev_cal.evoGetFilters(), 1224 shortcode: ev_cal.evo_shortcodes(), 1225 }; 1226 $.ajax({ 1227 beforeSend: function(){ 1228 //this_section.slideUp('fast'); 1229 }, 1230 type: 'POST', 1231 url:the_ajax_script.ajaxurl, 1232 data: data_arg_3, 1233 dataType:'json', 1234 success:function(data){ 1235 var this_section = cal_head.parent().find('.eventon_daily_in'); 1236 this_section.html(data.days_list); 1237 } 1238 }); 1239 } 1240 // for weeklyview 1241 if(ev_cal.hasClass('evoWV')){ 1242 // AJAX data array 1243 var data_arg_4 = { 1244 action: 'the_ajax_wv2', 1245 next_m: evodata.cmonth, 1246 next_y: evodata.cyear, 1247 focus_week: data_arg.wv_focus_week, 1248 filters: ev_cal.evoGetFilters(), 1249 shortcode: ev_cal.evo_shortcodes(), 1250 }; 1251 $.ajax({
1252 beforeSend: function(){ 1253 //this_section.slideUp('fast'); 1254 }, 1255 type: 'POST', 1256 url:the_ajax_script.ajaxurl, 1257 data: data_arg_4, 1258 dataType:'json', 1259 success:function(data){ 1260 // save width data 1261 var width1 = ev_cal.find('.evoWV_days').width(); 1262 var width2 = ev_cal.find('.eventon_wv_days').width(); 1263 var width3 = ev_cal.find('.evo_wv_day').width(); 1264 var ml1 = ev_cal.find('.eventon_wv_days').css('margin-left'); 1265 1266 // add content 1267 ev_cal.find('.eventon_wv_days') 1268 .parent().html(data.content); 1269 1270 ev_cal.find('.evoWV_days').css({'width':width1}); 1271 ev_cal.find('.eventon_wv_days').css({'width':width2, 'margin-left':ml1}); 1272 ev_cal.find('.evo_wv_day').css({'width':width3}); 1273 1274 } 1275 }); 1276 } 1277 1278 } 1279 1280});
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.