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