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