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