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