https://www.institutomapvitoria.com/wp-content/plugins/eventON/assets/js/eventon_script.js?ver=4.5.9
1/** 2 * Javascript code that is associated with the front end of the calendar 3 * @version 4.5.8 4 */ 5 6jQuery(document).ready(function($){ 7 8 9 var BODY = $('body'); 10 var BUS = ''; // initial eventon calendar data 11 var ajax_url = evo_general_params.ajaxurl; 12 13 init(); 14 15 16// EventON calendar main function 17// 2.8.6 18 $.fn.evo_calendar = function (options) { 19 20 el = this; 21 var cal = {}; 22 var defaults = { 23 'SC': {}, 24 'json':{} 25 }; 26 var calO = {}; 27 28 var init = function(){ 29 calO = el.O = $.extend({},defaults, options); 30 31 // load shortcodes to calendar 32 if( calO.SC !== undefined){ 33 el.evo_cal_functions({action:'update_shortcodes',SC: calO.SC}); 34 } 35 36 // load events json to calednar 37 if( calO.json !== undefined){ 38 el.find('.evo_cal_events').data('events', calO.json); 39 } 40 41 load_maps(); 42 interactions(); 43 }; 44 45 var load_maps = function(){ 46 if(calO.SC.evc_open == 'yes'){ 47 el.find('.desc_trig').each(function(index){ 48 var self = this; 49 setTimeout(function(){ 50 $(self).evoGenmaps({'fnt':2,'cal': el}); 51 },index*600); 52 }); 53 } 54 }; 55 56 var interactions = function(){ 57 close_eventcard(); 58 counters(); 59 live_now_cal(); 60 } 61 62 63 var live_now_cal = function(){ 64 $(el).find('.evo_img_time').each(function(){ 65 if( $(this).closest('a.desc_trig').find('em.evcal_time').length ){ 66 _html = $(this).closest('a.desc_trig').find('em.evcal_time')[0].outerHTML; 67 $(this).html( _html ); 68 } 69 }); 70 } 71 72 var counters = function(){ 73 $(el).find('.evo_countdowner').each(function(){ 74 $(this).evo_countdown(); 75 }); 76 } 77 78 var close_eventcard = function(){ 79 $(el).on('click','.evcal_close',function(){ 80 $(this).closest('.evcal_eventcard').slideUp().removeClass('open'); 81 }); 82 } 83 84 init(); 85 }; 86 87 /* 88 $('body').bind('touchend',function(event){ 89 console.log(event); 90 if( $(event.target).hasClass('evcal_arrows') ){ 91 $(event.target).hover(); 92 } 93 }); 94 */ 95 96// localize event time function @ 4.5.5 97 $.fn.evo_local_time = function( options){ 98 el = this; 99 100 $(el).find('.evo_mytime').each(function(){ 101 const obj = $(this); 102 const event_obj = obj.closest('.eventon_list_event'); 103 var time = obj.data('times'); 104 var time_format = obj.data('__f'); 105 106 new_time = time.split('-'); 107 108 utc_offset = $(this).data('tzo'); 109 utc_offset = 0; 110 111 start = parseInt(new_time[0]); 112 end = parseInt(new_time[1]); 113 offset_start = start + utc_offset; 114 115 116 // end 117 var Me = moment.unix( end ).utc().local(); 118 var M1 = moment.unix( start ).utc().local(); 119 120 var _html = ''; 121 122 // same month 123 if( Me.format('YYYY/M') == M1.format('YYYY/M')){ 124 125 // same date 126 if( Me.format('DD') == M1.format('DD')){ 127 _html = M1.format( time_format ) + ' - ' + Me.format( obj.data('__tf') ) ; 128 // dif date 129 }else{ 130 _html = M1.format( time_format ) +' - '+ Me.format( time_format ); 131 } 132 // dif month 133 }else{ 134 _html = M1.format( time_format ) +' - '+ Me.format( time_format ); 135 } 136 137 138 event_obj.find('.evo_mytime').find('b').html( _html ); 139 event_obj.find('.evo_mytime').removeClass('tzo_trig'); 140 141 }); 142 }; 143 // user local time 144 BODY.on('click','.tzo_trig',function(event){ 145 event.preventDefault(); 146 event.stopPropagation(); 147 $(this).parent().evo_local_time(); 148 return; 149 }); 150 151// RUN on Page load 152 function init(){ 153 154 init_run_gmap_openevc(); 155 fullheight_img_reset(); 156 157 158 init_load_cal_data(); 159 160 handlebar_additional_arguments(); 161 162 // run basic countdown timers 163 BODY.find('.evo_countdowner').each(function(){ 164 $(this).evo_countdown(); 165 }); 166 167 168 jitsi(); 169 } 170 171// GENERALIZED functions 172// General AJAX trigger - added 3.1 173 $(document).on('click','.evo_trig_ajax',function(event ){ 174 var ajax_data = {}; 175 const obj = $(this); 176 177 ajax_data = obj.data(); 178 $(document).data( 'evo_data', ajax_data ); 179 180 $(document).trigger('evo_before_trig_ajax', [obj]); 181 182 var new_ajax_data = $(document).data( 'evo_data'); 183 new_ajax_data['nn'] = the_ajax_script.postnonce; 184 185 $.ajax({
186 beforeSend: function(){ 187 $(document).trigger('evo_beforesend_trig_ajax', [obj, new_ajax_data]); 188 }, 189 type: 'POST',url: get_ajax_url('eventon_gen_trig_ajax') ,data: new_ajax_data,dataType:'json', 190 success:function(return_data){ 191 $(document).trigger('evo_success_trig_ajax', [obj, new_ajax_data, return_data]); 192 },complete:function(){ 193 $(document).trigger('evo_complete_trig_ajax', [obj, new_ajax_data]); 194 } 195 }); 196 197 }); 198 199// Virtual Events & jitsi 200 function jitsi(mod_refresh){ 201 202 const domain = 'meet.jit.si'; 203 const api = []; 204 205 jQuery('.evo-jitsi-wrapper').each(function(index, element) { 206 const O = $(this); 207 const eventO = O.closest('.eventon_list_event'); 208 209 // check if mod refresh is set or no 210 if( mod_refresh != '' && mod_refresh == 'mod_refresh_no' && O.hasClass('mod')) return; 211 212 var roomName = jQuery(element).data('n'), 213 width = jQuery(element).data('width'), 214 height = jQuery(element).data('height'), 215 audioMuted = jQuery(element).data('audiomute'), 216 videoMuted = jQuery(element).data('videomute'), 217 screenSharing = jQuery(element).data('screen'); 218 219 220 const myOverwrite = 221 { 222 'TOOLBAR_BUTTONS': $(element).data('d'), 223 "DEFAULT_BACKGROUND": '#494a4e', 224 'MOBILE_APP_PROMO': false, 225 'SETTINGS_SECTIONS':['devices', 'language', 'profile', 'calendar'], 226 }; 227 228 229 const options = { 230 roomName, 231 width, 232 height, 233 parentNode: element, 234 configOverwrite: { 235 startWithAudioMuted: audioMuted, 236 startWithVideoMuted: videoMuted, 237 startScreenSharing: false, 238 disableInviteFunctions: false, 239 }, 240 interfaceConfigOverwrite: myOverwrite, 241 }; 242 243 244 const api = new JitsiMeetExternalAPI(domain, options); 245 246 api.addEventListener('participantRoleChanged', function(event){ 247 248 // record moderator joined 249 if (event.role === "moderator"){ 250 _record_moderator_join( 'yes', eventO.data('event_id'), eventO.data('ri')); 251 } 252 253 const pp = jQuery(element).data('p'); 254 if (event.role === "moderator" && pp != '__') { 255 ppp = pp.replace('_',''); 256 api.executeCommand('password', ppp); 257 } 258 }); 259 260 // moderator leave 261 api.addEventListener('videoConferenceLeft', function(event){ 262 if( eventO.find('.evo_vir_data').data('ismod') =='y'){ 263 _record_moderator_join( 'no', eventO.data('event_id'), eventO.data('ri')); 264 O.siblings('.evo_vir_mod_left').show(); 265 O.hide(); 266 } 267 }); 268 }); 269 } 270 // record moderator logins for jitsi 271 function _record_moderator_join(joined, eid, ri){ 272 var data_arg = { 273 'action': 'eventon_record_mod_joined', 274 'eid': eid, 275 'ri': ri, 276 'joined': joined, 277 'nonce': evo_general_params.n, 278 }; 279 280 $.ajax({ 281 beforeSend: function(){}, 282 type: 'POST',url: ajax_url,data: data_arg,dataType:'json', 283 success:function(data){ } 284 }); 285 } 286 287 288 // refresh event card elements - evo_reload_virtual_events 289 // @+ 3.1 290 $('body').on('evo_refresh_elements',function(event, send_data ){ 291 292 if( send_data.length <= 0 || !send_data) return; 293 294 send_data['nonce'] = evo_general_params.n; 295 296 $.ajax({ 297 beforeSend: function(){ 298 if( 'evo_data' in send_data){ 299 $.each(send_data.evo_data, function(ekey, eclasses){ 300 $.each(eclasses, function(classnm, val){ 301 if(val && 'loader' in val && val['loader'] && 'loader_class' in val){ 302 $('#event_'+ekey).find('.'+val['loader_class']).addClass('evoloading'); 303 } 304 }); 305 }); 306 } 307 }, 308 type: 'POST',url: get_ajax_url('eventon_refresh_elm'),data: send_data,dataType:'json', 309 success:function(data){ 310 if( data.status == 'good' ){ 311 evo_apply_refresh_content( data ); 312 } 313 },complete: function(){ 314 if( 'evo_data' in send_data){ 315 $.each(send_data.evo_data, function(ekey, eclasses){ 316 $.each(eclasses, function(classnm, val){ 317 if(val && 'loader' in val && val['loader'] && 'loader_class' in val){
318 $('#event_'+ekey).find('.'+val['loader_class']).removeClass('evoloading'); 319 } 320 }); 321 }); 322 } 323 } 324 }); 325 }); 326 327 // refresh the closest hearbeat run parent 328 $('body').on('evo_refresh_designated_elm', function(ee, elm, elm_class, extra_data){ 329 330 //get closest event object 331 const event = $(elm).closest('.eventon_list_event'); 332 333 if( !event ) return; 334 if( event.find('.'+elm_class).length == 0 ) return; 335 336 const refresh_elm = event.find('.'+elm_class); 337 338 var send_data = {}; 339 340 send_data['evo_data'] = build_elm_refresh_data( refresh_elm , extra_data); 341 342 $('body').trigger('evo_refresh_elements',[ send_data ]); 343 }); 344 345 // record sign in - virtual plus 346 // @+3.1 347 $('body').on('click','.evo_vir_signin_btn',function(){ 348 349 extra_data = {}; 350 extra_data['signin'] = 'y'; 351 extra_data['refresh_main'] = 'y'; 352 extra_data['loader'] = true; 353 extra_data['loader_class'] = 'evo_vir_main_content'; 354 355 $('body').trigger('evo_refresh_designated_elm',[ $(this) , 'evo_vir_data',extra_data]); 356 }); 357 358 359 // apply refresh event element content with matching data that is sent 360 function evo_apply_refresh_content(data){ 361 362 if( 'evo_data' in data ){ 363 364 $.each(data.evo_data, function(eclass, boxes){ 365 // if event exists in the page 366 367 var vir_data_vals = false; 368 if( 'evo_vir_data' in boxes) vir_data_vals = boxes.evo_vir_data.data; 369 370 $('body').find('.'+eclass).each(function(){ 371 const event_elm = $(this); 372 373 // set html 374 $.each(boxes, function(boxclass, boxdata){ 375 if( !('html' in boxdata) ) return; 376 if( boxdata.html == '' ) return; 377 if( event_elm.find('.'+boxclass).legnth <= 0 ) return; 378 379 event_elm.find( '.'+boxclass ).html( boxdata.html ); 380 }); 381 382 // only for virtual event update 383 if( vir_data_vals ){ 384 385 // reload jitsi for main content - if main content html is sent it will refresh 386 if( vir_data_vals && ('vir_type' in vir_data_vals) 387 && vir_data_vals.vir_type == 'jitsi' 388 && ('evo_vir_main_content' in boxes) 389 && ('html' in boxes.evo_vir_main_content) 390 && boxes.evo_vir_main_content.html != '' 391 ){ 392 jitsi('mod_refresh_no'); 393 } 394 395 // update data for sent object 396 $.each(boxes, function(boxclass, boxdata){ 397 if( boxdata.data == '' || boxdata.data === undefined) return; 398 399 // for jitsi if mod left --> force refresh main 400 if( boxdata !== undefined && vir_data_vals.vir_type == 'jitsi' && vir_data_vals.mod_joined =='left'){ 401 402 // force refresh main 403 boxdata.data['refresh_main'] = 'yy'; 404 } 405 406 event_elm.find( '.'+boxclass ).data( boxdata.data ); 407 });
408 } 409 410 }); 411 }); 412 } 413 } 414 // get refresh data for specified elem 415 function build_elm_refresh_data( elm , extra_data){ 416 417 dataObj = {}; 418 419 // get closest event element and event id/ri from it 420 const event = $(elm).closest('.eventon_list_event'); 421 422 dataObj = {} 423 const ekey = event.data('event_id')+'_'+ parseInt(event.data('ri')); 424 dataObj[ ekey ] = {}; 425 426 const key2 = elm.data('key'); 427 428 // append new data to the element 429 dataObj[ ekey ][ key2 ] = elm.data(); 430 431 // check if awaitmod need checked 432 if( elm.data('check_awaitmod')){ 433 434 // if waiting for mod element is on page -> set as user awaiting mod 435 if( ( event.find('.evo_vir_jitsi_waitmod').length>0) ) 436 dataObj[ ekey ][ key2 ]['refresh_main'] = 'yy'; 437 438 // if jitsi is loaded on page & mod is still in --> stop refreshing main 439 if( event.find('.evo-jitsi-wrapper').length>0 && dataObj[ ekey ][ key2 ]['mod_joined'] !='left') 440 dataObj[ ekey ][ key2 ]['refresh_main'] = ''; 441 } 442 443 // append extra data 444 if( extra_data && extra_data !== undefined){ 445 $.each( extra_data, function (index,val){ 446 dataObj[ ekey ][ key2 ][index] = val; 447 }); 448 } 449 450 return dataObj; 451 } 452 453 // mark as virtual event ended 454 $(document) 455 .on('evo_before_trig_ajax',function(event, obj){ 456 if(!obj.hasClass('evo_trig_vir_end')) return; 457 458 var new_ajax_data = $(document).data( 'evo_data'); 459 new_ajax_data['fnct'] = 'mark_event_ended'; 460 $(document).data( 'evo_data', new_ajax_data ); 461 462 }) 463 .on('evo_beforesend_trig_ajax',function( event, obj, new_ajax_data){ 464 if(!obj.hasClass('evo_trig_vir_end')) return; 465 466 obj.closest('.evo_vir_mod_box').addClass('evoloading'); 467 }) 468 .on('evo_success_trig_ajax',function( event, obj, new_ajax_data, return_data){ 469 if(!obj.hasClass('evo_trig_vir_end')) return; 470 471 // if virtual events were marked as ended 472 if(!('_vir_ended' in return_data)) return; 473 474 // refresh the virtual main content 475 extra_data = {}; 476 extra_data['refresh_main'] = 'yy'; 477 extra_data['loader'] = true; 478 extra_data['loader_class'] = 'evo_vir_main_content'; 479 480 //console.log(extra_data); 481 482 $('body').trigger('evo_refresh_designated_elm',[ obj , 'evo_vir_data',extra_data]); 483 }) 484 .on('evo_complete_trig_ajax',function( event, obj, new_ajax_data){ 485 486 if(!obj.hasClass('evo_trig_vir_end')) return; 487 obj.closest('.evo_vir_mod_box').removeClass('evoloading'); 488 }) 489 ; 490 491// Heartbeat - added 3.1 492 //hook into heartbeat-send 493 jQuery(document).on('heartbeat-send', function(e, data) { 494 495 // if there is run heartbeat items 496 if( $('body').find('.evo_refresh_on_heartbeat').length>0 ){ 497 498 $('body').find('.evo_refresh_on_heartbeat').each(function(){ 499 if( $(this).closest('.eventon_list_event').length <= 0) return; 500 if( $(this).data('refresh')!== undefined && !$(this).data('refresh') ) return; 501 502 data['evo_data'] = build_elm_refresh_data( $(this) ); 503 }); 504 } 505 }); 506 507 //hook into heartbeat-tick 508 jQuery(document).on('heartbeat-tick', function(e, data) { 509 evo_apply_refresh_content( data ); 510 }); 511 512// Schedule View - 4.0 / u 4.5.6 513 $('body') 514 .on('evo_init_ajax_success_each_cal',function(event, data, i, v, CAL){ 515 $('body').find('.ajde_evcal_calendar.evoSV').each(function(){ 516 evosv_populate( $(this) ); 517 }); 518 }) 519 .on('evo_main_ajax_complete', function(event, CAL, ajaxtype, data , data_arg){ 520 SC = data_arg.shortcode; 521 if( SC.calendar_type == 'schedule'){ 522 evosv_populate( CAL ); 523 } 524 }) 525 // view switching 526 .on('evo_vSW_clicked_before_ajax',function(event, O, CAL, DD, reload_cal_data){ 527 if(!(O.hasClass('evosv'))) return; 528 var SC = CAL.evo_shortcode_data(); 529 530 CAL.evo_update_cal_sc({F:'calendar_type', V: 'schedule'}); 531 CAL.evo_update_cal_sc({F:'fixed_day', V: SC.fixed_day }); 532 533 }) 534 .on('evo_vSW_clicked',function(event, OBJ, CAL, DD, reload_cal_data){ 535 if(!(OBJ.hasClass('evosv'))) return; 536 537 //if( reload_cal_data) return; 538 539 var _reload_cal_data = false; 540 var SC = CAL.evo_shortcode_data(); 541 542 DD.setUTCDate( 1 ); 543 544 if( SC.focus_start_date_range != Math.floor(DD.getTime()/1000) ) 545 _reload_cal_data = true; 546 547 CAL.evo_update_cal_sc({F:'focus_start_date_range',V: Math.floor(DD.getTime()/1000) }); 548 549 DD.setUTCMonth( DD.getUTCMonth() + 1); 550 DD.setUTCDate( -1); 551 552 CAL.evo_update_cal_sc({F:'focus_end_date_range', 553 V: Math.floor(DD.getTime()/1000) }); 554 555 556 DD.setUTCDate( SC.fixed_day ); // adjust date to fixed date 557 558 CAL.evo_update_cal_sc({F:'calendar_type', V: 'schedule'}); 559 CAL.evo_update_cal_sc({F:'fixed_day', V: SC.fixed_day }); 560 561 if( _reload_cal_data ){
562 $('body').trigger('evo_run_cal_ajax',[CAL.attr('id'),'none','filering']); 563 }else{ 564 evosv_populate( CAL ); 565 } 566 567 568 }) 569 // open events from schedule view 570 .on('click','.evosv_items',function(event, elm){ 571 O = $(this); 572 CAL = O.closest('.ajde_evcal_calendar'); 573 var e_cl = 'event_'+O.data('id'); 574 575 const clicked_event_uxval = O.data('uxval'); 576 577 // if event is set to slide down .. switch to lightbox 578 if( clicked_event_uxval == '1' ){ 579 CAL.find('.'+e_cl).find('.desc_trig').data('ux_val', 3); 580 } 581 582 CAL.find('.'+e_cl).find('.desc_trig').trigger('click'); 583 }); 584 585 // populate the schedule view data @4.5.8 586 function evosv_populate(CAL){ 587 var SC = CAL.evo_shortcode_data(); 588 OD = CAL.evo_get_OD(); // calendar other data 589 590 var cal_events = CAL.find('.eventon_list_event'); 591 days_in_month = CAL.evo_day_in_month({M: SC.fixed_month, Y: SC.fixed_year}); 592 time_format = CAL.evo_get_global({S1:'cal_def',S2:'wp_time_format'}); 593 594 // text strings 595 _txt = CAL.evo_get_txt({V:'no_events'}); 596 _txt2 = CAL.evo_get_txt({V:'until'}); 597 _txt3 = CAL.evo_get_txt({V:'from'}); 598 _txt4 = CAL.evo_get_txt({V:'all_day'}); 599 600 CAL.find('#evcal_list').addClass('evo_hide'); 601 602 var has_events = false; 603 var html = ''; 604 var template_data = {}; 605 var processed_ids = {}; 606 607 // Set initial date - date values 608 var SU = parseInt( SC.focus_start_date_range); var EU = ''; 609 var M = moment.unix( SU ).tz( OD.cal_tz ); 610 611 // go through each day in month 612 for(var x=1; x<= days_in_month; x++){ 613 614 var month_name = CAL.evo_get_dms_vals({ V: (M.get('month') +1), type:'m3'}); 615 var day_name = CAL.evo_get_dms_vals({ V: M.day(), type:'d3'}); 616 617 // set event unix into moment 618 SU = M.unix(); M.endOf('day'); 619 EU = M.unix(); M.startOf('day'); 620 621 // run through each event and get events in this date 622 var events = {}; 623 624 cal_events.each(function(index, elm){ 625 ED = $(elm).evo_cal_get_basic_eventdata(); 626 if( !ED) return; 627 628 processed_ids[ED.uID] = ED.uID; 629 ESU = ED.unix_start; EEU = ED.unix_end; 630 631 // check for date range 632 var inrange = CAL.evo_is_in_range({ 633 'S': SU, 'E': EU, 'start': ESU, 'end':EEU 634 }); 635 if(!inrange) return; // skip if no in range 636 637 has_events = true; 638 639 // event time relative to calendar tz 640 m = moment.unix( ESU ).tz( OD.cal_tz ); 641 me = moment.unix( end ).tz( OD.cal_tz ); 642 643 var all_day = $(elm).find('a.desc_trig').hasClass('allday') ? true: false; 644 645 // get event time correct for all day 646 if( all_day ){
647 ED['t'] = _txt4; 648 }else{ 649 if( ESU <= SU ){ 650 if( EEU >= EU) ED['t'] = _txt4; 651 if( EEU < EU ) ED['t'] = _txt2+' ' + me.format( time_format); 652 }else if(ESU > SU){ 653 if( EEU >= EU) ED['t'] = _txt3+' '+ m.format( time_format); 654 if( EEU < EU ) ED['t'] = m.format( time_format) +' - '+ me.format( time_format); 655 } 656 } 657 658 // hide end time 659 if( ED.hide_et == 'y') ED['t'] = m.format( time_format); 660 661 events[index] = ED; 662 }); 663 664 // if there are events in this date 665 if( events && Object.keys(events).length > 0){ 666 667 template_data[ x ] = {}; 668 template_data[ x ]['date'] = '<b>' + M.get('date')+'</b> '+ month_name+' '+ day_name; 669 template_data[ x ]['d'] = M.format('YYYY-M-D'); 670 template_data[ x ]['SU'] = SU; 671 template_data[ x ]['events'] = {} 672 673 $.each(events, function(index, item){ 674 675 location_data = organizer_data = event_tags = ''; 676 677 // location 678 if( SC.show_location == 'yes' && 'location' in item){ 679 location_data = "<div class='evosv_subdata evosv_location'><i class='fa fa-location-pin marr5'></i>" +item.location+"</div>"; 680 } 681 682 // organizer 683 if( SC.show_organizer == 'yes' && 'organizer' in item){ 684 organizer_data = "<div class='evosv_subdata evosv_org'>" +item.organizer+"</div>"; 685 } 686 687 // event tags 688 if( SC.show_tags == 'yes' && 'event_tags' in item){ 689 event_tags = "<div class='evosv_subdata evosv_tags'>"; 690 $.each( item.event_tags, function(index, val){ 691 event_tags += "<span class='evosv_tag " + index +"'>" + val+"</span>"; 692 }); 693 event_tags += "</div>"; 694 } 695 696 template_data[ x ]['events'][ item.uID ] = { 697 'time': item.t, 698 'ux_val': item.ux_val, 699 'title': item.event_title, 700 'color':item.hex_color, 701 'tag': event_tags, 702 'loc': location_data, 703 'org': organizer_data, 704 'i': item 705 } 706 707 }); 708 } 709 710 // next date 711 M.add(1, 'd'); 712 } 713 714 var html_ = "<div class='evosv_grid evoADDS'>"; 715 716 // if no events 717 if( !has_events){ 718 no_event_content = CAL.evo_get_global({S1: 'html', S2:'no_events'}); 719 html_ += "<div class='date_row'><div class='row no_events evosv'>"+no_event_content+"</div></div>"; 720 }else{ 721 html_ += CAL.evo_HB_process_template({ 722 TD:template_data, part:'evosv_grid' 723 }); 724 } 725 726 html_ += '</div>'; 727 728 if( CAL.find('.evosv_grid').length > 0){ 729 CAL.find('.evosv_grid').replaceWith( html_ ); 730 }else{ 731 ELM = CAL.find('#eventon_loadbar_section'); 732 ELM.after( html_ ); 733 } 734 735 } 736 737// Initial load data via ajax 738 function init_load_cal_data(){ 739 740 // check if calendars are present in the page 741 var run_initload = false; 742 743 if( $('body').find('.ajde_evcal_calendar').length > 0 ) run_initload = true; 744 if( $('body').find('.ajax_loading_cal').length > 0 ) run_initload = true; 745 if( $('body').find('.eventon_single_event').length > 0 ) run_initload = true; 746 747 if(run_initload == false) return false; 748 749 var data_arg = {}; 750 751 BODY = $('body'); 752 BODY.trigger('evo_global_page_run'); 753 754 data_arg['global'] = $('#evo_global_data').data('d'); 755 data_arg['cals'] ={}; 756 757 // pass ajax loading calendar shortcodes 758 $('body').find('.ajax_loading_cal').each(function(){ 759 CAL = $(this); 760 SC = CAL.find('.evo_cal_data').data('sc'); 761 762 data_arg['cals'][ CAL.attr('id')] = {}; 763 data_arg['cals'][ CAL.attr('id')]['sc'] = SC; 764 }); 765 766 $.ajax({ 767 beforeSend: function(){}, 768 type: 'POST', 769 url: get_ajax_url('eventon_init_load'), 770 data: data_arg,dataType:'json', 771 success:function(data){ 772 $('#evo_global_data').data('d', data); 773 774 BUS = data; 775 776 // append html to calendars if present 777 if('cals' in data){ 778 var time = 300; 779 $.each(data.cals, function(i,v){ 780 781 setTimeout( function(){ 782 783 CAL = BODY.find('#'+ i); 784 if(CAL.length === 0) return; 785 786 if('html' in v){ 787 CAL.find('#evcal_list').html( v.html ); 788 CAL.removeClass('ajax_loading_cal'); 789 CAL.find('.evo_ajax_load_events').remove(); 790 791 //CAL.evo_local_time(); 792 } 793 794 CAL.evo_calendar({ 795 SC:v.sc, json: v.json 796 });
797 798 $('body').trigger('evo_init_ajax_success_each_cal', [data, i, v, CAL]); 799 800 }, time); 801 time += 300; 802 }); 803 } 804 805 $('body').trigger('evo_init_ajax_success', [data]); 806 807 },complete:function(data){ 808 // process all calendars in the page 809 $('body').find('.ajde_evcal_calendar').each(function(){ 810 if($(this).hasClass('.ajax_loading_cal')) return; 811 $(this).evo_calendar(); 812 }); 813 814 $('body').trigger('evo_init_ajax_completed', [data]); 815 } 816 }); 817 818 } 819 820// ELEMENTS 821// tooltips 822 $('body').on('mouseover','.ajdeToolTip',function(event){ 823 event.stopPropagation(); 824 if($(this).hasClass('show')) return; 825 826 const t = $(this).data('d'); 827 var p = $(this).position(); 828 829 var cor = getCoords(event.target); 830 831 $('.evo_tooltip_box').removeClass('show').removeClass('L').html(t); 832 var box_height = $('.evo_tooltip_box').height(); 833 var box_width = $('.evo_tooltip_box').width(); 834 835 $('.evo_tooltip_box').css({'top': (cor.top - 55 - box_height), 'left': ( cor.left + 5 ) }) 836 .addClass('show'); 837 838 // left align 839 if( $(this).hasClass('L')){ 840 $('.evo_tooltip_box').css({'left': (cor.left - box_width - 15) }).addClass('L'); 841 } 842 }) 843 .on('mouseout','.ajdeToolTip',function(){ 844 $('.evo_tooltip_box').removeClass('show'); 845 }); 846 847 function getCoords(elem) { // crossbrowser version 848 var box = elem.getBoundingClientRect(); 849 //console.log(box); 850 851 var body = document.body; 852 var docEl = document.documentElement; 853 854 var scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop; 855 var scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft; 856 857 var clientTop = docEl.clientTop || body.clientTop || 0; 858 var clientLeft = docEl.clientLeft || body.clientLeft || 0; 859 860 var top = box.top + scrollTop - clientTop; 861 var left = box.left + scrollLeft - clientLeft; 862 863 return { top: Math.round(top), left: Math.round(left) }; 864 } 865 866// Other 867 // LIGHTBOX 868 // since 4.2 moving to functions 869 // open lightbox @2.9 870 $('body').on('evo_open_lightbox',function(event, lb_class, content){ 871 const LIGHTBOX = $('.evo_lightbox.'+lb_class).eq(0); 872 873 // if already open 874 if(LIGHTBOX.is("visible")===true) return false; 875 876 if( content != ''){ 877 LIGHTBOX.find('.evo_lightbox_body').html( content ); 878 } 879 $('body').trigger('evolightbox_show', [ lb_class ]); 880 }); 881 // close popup 882 BODY.on('click','.evolbclose', function(){ 883 if( $(this).hasClass('evolb_close_btn')) return; 884 LIGHTBOX = $(this).closest('.evo_lightbox'); 885 closing_lightbox( LIGHTBOX ); 886 }); 887 888 // close with click outside popup box when pop is shown 889 $(document).on('click', function(event) { 890 //event.stopPropagation(); 891 //console.log($(event.target)); 892 if( 893 $(event.target).hasClass('evo_content_inin') 894 ){ 895 closing_lightbox( $(event.target).closest('.evo_lightbox') ); 896 //console.log('5'); 897 } 898 }); 899 function closing_lightbox( lightboxELM){ 900 901 if(! lightboxELM.hasClass('show')) return false; 902 Close = (lightboxELM.parent().find('.evo_lightbox.show').length == 1)? true: false; 903 lightboxELM.removeClass('show'); 904 905 $('body').trigger('lightbox_before_event_closing', [lightboxELM]); 906 907 setTimeout( function(){ 908 lightboxELM.find('.evo_lightbox_body').html(''); 909 910 if(Close){ 911 $('body').removeClass('evo_overflow'); 912 $('html').removeClass('evo_overflow'); 913 } 914 915 // trigger action to hook in at this stage 916 $('body').trigger('lightbox_event_closing', [lightboxELM]); 917 }, 100); 918 } 919 920 // when lightbox open triggered 921 $('body').on('evolightbox_show',function(event, lb_class){ 922 $('.evo_lightboxes').show(); 923 $('body').addClass('evo_overflow'); 924 $('html').addClass('evo_overflow'); 925 926 $('body').trigger('evolightbox_opened',[ lb_class ]); 927 }); 928 929 // OPENING event card -- USER INTREACTION and loading google maps 930 //event full description\ 931 $('body').on('click','.eventon_events_list .desc_trig', function(event){ 932 933 var obj = $(this); 934 935 var attr = obj.closest('.evo_lightbox').attr('data-cal_id'); 936 if(typeof attr !== typeof undefined && attr !== false){ 937 var cal_id = attr; 938 var CAL = cal = $('#'+cal_id); 939 }else{ 940 var CAL = cal = obj.closest('.ajde_evcal_calendar'); 941 } 942 943 SC = CAL.evo_shortcode_data(); 944 945 var evodata = cal.find('.evo-data'); 946 947 click_sinev_box = (obj.closest('.eventon_single_event').length>0 && evodata.data('exturl')) ? true: false; 948 const event_id = obj.closest('.eventon_list_event').data('event_id'); 949 var event_list = obj.closest('.eventon_events_list'); 950 951 // event specific values 952 var ux_val = obj.data('ux_val'); 953 var exlk = obj.data('exlk'); 954 955 // override overall calendar user intereaction OVER individual event UX 956 if(SC.ux_val!='' && SC.ux_val!== undefined && SC.ux_val!='0'){ 957 ux_val = SC.ux_val; 958 } 959 960 // special mobile only user interaction 961 if( SC.ux_val_mob !== undefined && SC.ux_val_mob != '' && 962 SC.ux_val_mob != '-' && SC.ux_val_mob != ux_val){
963 if( is_mobile() ) ux_val = SC.ux_val_mob; 964 } 965 966 967 968 // open as lightbox 969 if(ux_val=='3' || ux_val == '3a'){ 970 event.preventDefault(); 971 972 repeat_interval = parseInt(obj.closest('.eventon_list_event').data('ri')); 973 repeat_interval = (repeat_interval)? repeat_interval: '0'; 974 975 var alt_SC_data = {}; 976 977 978 alt_SC_data['repeat_interval'] = repeat_interval; 979 alt_SC_data['ux_val'] = ux_val; 980 alt_SC_data['evortl'] = event_list.hasClass('evortl')? 'yes':'no'; 981 alt_SC_data['event_id'] = parseInt(event_id); 982 alt_SC_data['ajax_eventtop_show_content'] = true; 983 984 var new_SC_data = $.extend( {}, SC , alt_SC_data ); 985 986 // since 4.2 987 eventon_open_event_lightbox( new_SC_data, obj, CAL); 988 989 return false; 990 991 // open in single events page 992 }else if(ux_val=='4'){ 993 994 var url = obj.attr('href'); 995 996 if( url =='' || url === undefined){ 997 998 url = obj.parent().siblings('.evo_event_schema').find('a').attr('href'); 999 window.open(url, '_self'); 1000 } 1001 1002 if(obj.attr('target') != '_blank') window.open(url, '_self'); 1003 1004 return; 1005 1006 // open in single events page in new window 1007 }else if(ux_val=='4a'){ 1008 1009 if( obj.attr('href')!='' && obj.attr('href')!== undefined){ 1010 return; 1011 }else{ 1012 var url = obj.parent().siblings('.evo_event_schema').find('a').attr('href'); 1013 window.open(url); 1014 return false; 1015 } 1016 1017 // open as external link 1018 }else if(ux_val=='2'){ 1019 //var url = obj.parent().siblings('.evo_event_schema').find('a').attr('href'); 1020 var url = obj.attr('href'); 1021 1022 // if the click is coming from single event box 1023 if( click_sinev_box ){ 1024 event.preventDefault(); 1025 return false; 1026 } 1027 1028 //console.log(url); 1029 if(url !== undefined && url != ''){ 1030 if(obj.attr('target') == '_blank'){ 1031 var win = window.open(url, '_blank'); 1032 win.focus(); 1033 }else{ 1034 window.open(url, '_self'); 1035 } 1036 1037 event.preventDefault(); 1038 } 1039 return true; 1040 1041 // do not do anything 1042 }else if(ux_val=='X'){ 1043 return false; 1044 }else if(ux_val=='none'){ 1045 return false; 1046 }else{ 1047 1048 // redirecting to external link 1049 if(exlk=='1' && ux_val!='1'){ 1050 // if there is no href 1051 if( obj.attr('href')!='' && obj.attr('href')!== undefined){ 1052 return; 1053 }else{ 1054 var url = obj.siblings('.evo_event_schema').find('a').attr('href'); 1055 if(obj.attr('target') == '_blank'){ window.open(url);}else{ window.open(url, '_self');} 1056 1057 event.preventDefault(); 1058 return false; 1059 } 1060 // SLIDE DOWN eventcard 1061 }else{ 1062 1063 var event_box = obj.closest('.eventon_list_event'); 1064 var click_item = event_box.find('.event_description'); 1065 1066 if(click_item.hasClass('open')){ 1067 event_box.removeClass('open'); 1068 click_item.slideUp().removeClass('open'); 1069 }else{ 1070 // accordion 1071 if( SC.accord == 'yes'){ 1072 cal.find('.eventon_list_event').removeClass('open');
1073 cal.find('.event_description').slideUp().removeClass('open'); 1074 } 1075 event_box.addClass('open'); 1076 click_item.slideDown().addClass('open'); 1077 } 1078 1079 // This will make sure markers and gmaps run once and not multiples 1080 if( obj.attr('data-gmstat')!= '1'){ 1081 1082 obj.attr({'data-gmstat':'1'}); 1083 obj.evoGenmaps({ 1084 'fnt':2 , 1085 'cal':cal, 1086 }); 1087 } 1088 1089 // trigger 1090 if( obj.data('runjs')){ 1091 $('body').trigger('evo_load_single_event_content',[ event_id, obj]); 1092 } 1093 1094 $('body').trigger('evo_slidedown_eventcard_complete',[ event_id, obj]); 1095 1096 return false; 1097 } 1098 } 1099 }); 1100 1101 1102 // process various lightbox types 1103 $('body') 1104 .on('evo_lightbox_processed', function(event, OO, LIGHTBOX){ 1105 if( OO.uid != 'evo_open_eventcard_lightbox') return false; 1106 1107 var CAL = OO.other_data.CAL; 1108 1109 LIGHTBOX.addClass('eventcard eventon_events_list'); 1110 LIGHTBOX_content = LIGHTBOX.find('.evolb_content'); 1111 LIGHTBOX_content.attr('class', 'evolb_content '+ OO.other_data.extra_classes ); 1112 LIGHTBOX_content.find('.evopop_top') 1113 .evoGenmaps({ 'fnt':2 ,'cal':OO.other_data.CAL }); 1114 1115 var SC = OO.other_data.SC; 1116 var obj = OO.other_data.obj; 1117 1118 fullheight_img_reset(); 1119 1120 // update border color and eventtop color 1121 const evoet_data = OO.other_data.et_data; 1122 1123 bgcolor = evoet_data.bgc; 1124 bggrad = evoet_data.bggrad; 1125 1126 // if tiles and eventtop style set to clean 1127 var show_lightbox_color = SC.tiles == 'yes' && ( SC.eventtop_style == '0' || SC.eventtop_style == '4') ? false: true; 1128 1129 if( (CAL && CAL.hasClass('color') && show_lightbox_color) || 1130 (!CAL && show_lightbox_color) 1131 1132 ){ 1133 LIGHTBOX_content.addClass('color'); 1134 LIGHTBOX_content.find('.evopop_top').css({ 1135 'background-color':bgcolor, 1136 'background-image': bggrad, 1137 }); 1138 }else{ 1139 LIGHTBOX_content.find('.evopop_top').css({'border-left':'3px solid '+bgcolor}); 1140 } 1141 1142 // trigger 1143 if( obj.data('runjs')){ 1144 $('body').trigger('evo_load_single_event_content',[ SC.event_id, OO.other_data.obj]); 1145 } 1146 1147 // countdown 1148 LIGHTBOX_content.find('.evo_countdowner').each(function(){ 1149 obj.removeClass('evo_cd_on'); 1150 obj.evo_countdown(); 1151 }); 1152 1153 1154 1155 // RTL 1156 if( SC.evortl =='yes') LIGHTBOX.addClass('evortl'); 1157 1158 $('body').trigger('evolightbox_end'); 1159 1160 }) 1161 1162 // after eventcard content is loaded to lightbox via 3a - @since 4.2.3 1163 .on('evo_ajax_success_evo_open_eventcard_lightbox', function (event, OO, data){ 1164 1165 if( OO.ajaxdata.uid != "load_single_eventcard_content_3a") return false; 1166 1167 LIGHTBOX = $('.evo_lightbox.'+ OO.lightbox_key); 1168 LIGHTBOX_content = LIGHTBOX.find('.evolb_content'); 1169 1170 CAL = $('body').find('#'+ OO.ajaxdata.calid); 1171 1172 // generate map 1173 LIGHTBOX_content.evoGenmaps({ 'fnt':2 ,'cal': CAL }); 1174 1175 1176 // countdown 1177 LIGHTBOX_content.find('.evo_countdowner').each(function(){ 1178 var obj = $(this); 1179 obj.removeClass('evo_cd_on'); 1180 obj.evo_countdown(); 1181 }); 1182 1183 $('body').trigger('evolightbox_end'); 1184 }) 1185 ; 1186 1187 // open event as lightbox / U 4.3.3 1188 function eventon_open_event_lightbox( SC_data, obj, CAL){ 1189 1190 //console.log(SC_data); 1191 1192 1193 const cancel_class = ( obj.hasClass('cancel_event')) ? ' cancel_event':''; 1194 1195 var other_data = { 1196 extra_classes: 'evo_lightbox_body eventon_list_event evo_pop_body evcal_eventcard event_'+SC_data.event_id +'_'+ SC_data.repeat_interval + cancel_class, 1197 CAL:CAL, 1198 obj: obj, 1199 et_data: obj.find('.evoet_data').data(),// @4.5.5 1200 SC: SC_data 1201 }; 1202 1203 // generate a random ID for this 1204 maximum = 99; 1205 minimum = 10; 1206 var randomnumber = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; 1207 1208 // AJAX via lightbox 1209 if(SC_data.ux_val == '3a'){ 1210 1211 var new_content = ''; 1212 new_content += '<div class="evo_cardlb" style="padding:10px 10px 0 10px">'; 1213 new_content += '<div style="margin-bottom:20px; width:100%; height:200px" class="evo_preloading"></div>'; 1214 const box = '<div style="display:flex;justify-content: space-between;margin-bottom:10px"><div style="width:40px;height:40px; margin-right:20px" class="evo_preloading"></div> <div style="flex:1 0 auto"> <div class="evo_preloading" style="width:70%; height:20px; margin-bottom:10px"></div><div class="evo_preloading" style="width:100%; height:80px; margin-bottom:10px"></div> </div> </div>'; 1215 new_content += box + box + box; 1216 new_content += '</div>'; 1217 1218 1219 var data_arg = {}; 1220 data_arg['event_id'] = SC_data.event_id; 1221 data_arg['ri'] = SC_data.repeat_interval; 1222 data_arg['SC'] = SC_data; 1223 data_arg['load_lbcontent'] = true; 1224 data_arg['action'] = 'eventon_load_single_eventcard_content'; 1225 data_arg['uid'] = 'load_single_eventcard_content_3a'; 1226 data_arg['calid'] = CAL.attr('id'); 1227 1228 1229 //reset view to match 1230 if( data_arg.SC.tile_style == '2') data_arg.SC.eventtop_style = '0'; 1231 data_arg.SC.tile_style = '0'; 1232 data_arg.SC.tile_bg = '0'; 1233 data_arg.SC.tiles = 'no'; 1234 1235 CAL.evo_lightbox_open({ 1236 uid:'evo_open_eventcard_lightbox', 1237 //uid:'load_single_eventcard_content_3a', 1238 lbc:'evo_eventcard_'+ randomnumber, 1239 end:'client', 1240 content: new_content, 1241 ajax:'yes', 1242 ajax_type: 'endpoint', 1243 ajax_action: 'eventon_load_single_eventcard_content', 1244 d: data_arg, 1245 other_data: other_data 1246 }); 1247 1248 1249 }else{ 1250 1251 var content = obj.closest('.eventon_list_event').find('.event_description').html(); 1252 var _content = $(content).not('.evcal_close'); 1253 1254 CAL.evo_lightbox_open({ 1255 uid:'evo_open_eventcard_lightbox', 1256 lbc:'evo_eventcard_'+ randomnumber, 1257 end:'client', 1258 content: '<div class="evopop_top">'+ obj.html() +'</div>' + content, 1259 other_data: other_data 1260 }); 1261 1262 return; 1263 } 1264 } 1265 1266 // load eventon event anywhere via lightbox ajax 1267 $('body').on('click','.eventon_anywhere.evoajax', function(event){ 1268 var obj = $(this); 1269 var data = obj.data('sc'); 1270 1271 if( data.ev_uxval == '4') return; 1272 1273 event.preventDefault(); 1274 1275 data['evortl'] = 'no'; 1276 data['event_id'] = data.id; 1277 data['ux_val'] = '3a'; 1278 data['ajax_eventtop_show_content'] = false; 1279 1280 1281 1282 //console.log(data); 1283 eventon_open_event_lightbox( data, obj, false); 1284 }); 1285 1286 // copy event link 1287 var evo_card_socialshare_html = ''; 1288 $('body').on('click','.copy.evo_ss', function(event){ 1289 const OBJ = $(this); 1290 const ROW = OBJ.closest('.evcal_evdata_row'); 1291 var link = decodeURIComponent( OBJ.data('l') ); 1292 navigator.clipboard.writeText( link ); 1293 1294 1295 1296 evo_card_socialshare_html = ROW.html(); 1297 ROW.html( "<p style='display:flex'><i class='fa fa-check marr10'></i> " + $(this).data("t") + "</p>"); 1298 1299 setTimeout(function(){ 1300 ROW.html( evo_card_socialshare_html); 1301 },3000); 1302 }); 1303 1304 // call to run google maps on load 1305 function init_run_gmap_openevc(delay){ 1306 $('.ajde_evcal_calendar').each(function(){ 1307 1308 var CAL = $(this); 1309 var SC = CAL.evo_shortcode_data(); 1310 1311 if( SC === undefined || SC === null) return; 1312 1313 if( typeof SC !== 'object' ){ 1314 SC = JSON.parse(SC); 1315 } 1316 1317 if( 'evc_open' in SC && SC.evc_open =='yes'){ 1318 1319 $(this).find('.desc_trig').each(function(){ 1320 if(delay!='' && delay !== undefined){ 1321 $(this).evoGenmaps({'fnt':2, 'cal': CAL, 'delay':delay}); 1322 }else{
1323 $(this).evoGenmaps({'fnt':2,'cal': CAL }); 1324 } 1325 }); 1326 } 1327 }); 1328 } 1329 1330 // Calendar Interaction 1331 // event bubbles 1332 $('.ajde_evcal_calendar.bub').on('mouseover','.eventon_list_event', function(){ 1333 O = $(this); 1334 LIST = O.closest('.eventon_events_list'); 1335 title = O.find('.evoet_dayblock').data('bub'); 1336 1337 p = O.position(); 1338 1339 LIST.append('<span class="evo_bub_box" style="">'+ title +"</span>"); 1340 B = LIST.find('.evo_bub_box'); 1341 1342 l = p.left; 1343 t = p.top- B.height() -30; 1344 1345 // adjust bubble to left if event on right edge 1346 LM = LIST.width(); 1347 tl = p.left + B.width() + O.width(); 1348 if( tl > LM){ 1349 l = l - B.width() +O.width()-20; 1350 } 1351 1352 B.css({'top':t, 'left':l}); 1353 1354 LIST.find('.evo_bub_box').addClass('show'); 1355 }).on('mouseout',function(){ 1356 B = $(this).find('.evo_bub_box').remove(); 1357 }); 1358 1359 // Click on eventtop items 1360 $('body').on('click','.evocmd_button', function(event){ 1361 event.preventDefault(); 1362 event.stopPropagation(); 1363 1364 href = $(this).data('href'); 1365 if( $(this).data('target')=='yes'){ 1366 window.open(href,'_blank'); 1367 }else{ 1368 window.location = href; 1369 } 1370 1371 }); 1372 1373 // GO TO TODAY 1374 // @+ 2.3 @up 2.8 1375 $('body').on('click','.evo-gototoday-btn', function(){ 1376 var obj = $(this); 1377 CAL = obj.closest('.ajde_evcal_calendar'); 1378 var calid = CAL.attr('id'); 1379 1380 CAL.evo_update_cal_sc({F:'fixed_month', V: obj.data('mo')}); 1381 CAL.evo_update_cal_sc({F:'fixed_year', V: obj.data('yr')}); 1382 1383 run_cal_ajax( calid,'none','today'); 1384 obj.fadeOut(); 1385 }); 1386 1387 $('body').on('evo_main_ajax_before', function(event, CAL, ajaxtype){ 1388 if(ajaxtype == 'switchmonth') CAL.find('.evo-gototoday-btn').fadeIn(); 1389 }); 1390 $('body').on('evo_main_ajax_complete', function(event, CAL,ajaxtype, D , data_arg){ 1391 // if focused month and year are same as current month and year hide the current month button 1392 var N = moment().utc(); 1393 SC = CAL.evo_shortcode_data(); 1394 1395 var SU = parseInt( SC.focus_start_date_range); 1396 var M = moment.unix(SU).utc(); 1397 1398 if( N.format('YYYY M') == M.format('YYYY M')){ 1399 CAL.find('.evo-gototoday-btn').fadeOut(); 1400 } 1401 1402 // load countdown timers 1403 BODY.find('.evo_countdowner').each(function(){ 1404 $(this).evo_countdown(); 1405 }); 1406 1407 }); 1408 1409 // MONTH jumper
1410 $('.ajde_evcal_calendar').on('click','.evo-jumper-btn', function(){ 1411 $(this).parent().siblings().find('.evo_j_container').slideToggle(); 1412 }); 1413 1414 // select a new time from jumper 1415 $('.evo_j_dates').on('click','a',function(){ 1416 var val = $(this).attr('data-val'), 1417 type = $(this).parent().parent().attr('data-val'), 1418 CAL = $(this).closest('.ajde_evcal_calendar'); 1419 SC = CAL.evo_shortcode_data(); 1420 1421 if(type=='m'){ // change month 1422 CAL.evo_update_cal_sc({F:'fixed_month', V: val }); 1423 }else{ 1424 CAL.evo_update_cal_sc({F:'fixed_year', V: val }); 1425 } 1426 1427 run_cal_ajax( CAL.attr('id') ,'none','jumper'); 1428 1429 // hide month jumper if not set to leave expanded 1430 if(SC.expj =='no') container.delay(2000).slideUp(); 1431 }); 1432 1433 // RESET general calendar 1434 // @U 2.8.9 1435 function cal_resets(calOBJ){ 1436 calargs = $(calOBJ).find('.cal_arguments'); 1437 calargs.attr('data-show_limit_paged', 1 ); 1438 1439 calOBJ.evo_update_cal_sc({ 1440 F:'show_limit_paged',V:'1' 1441 }); 1442 } 1443 1444 // change IDs for map section for eventon widgets 1445 if( $('.ajde_evcal_calendar').hasClass('evcal_widget')){ 1446 cal.find('.evcal_gmaps').each(function(){ 1447 var gmap_id = obj.attr('id'); 1448 var new_gmal_id =gmap_id+'_widget'; 1449 obj.attr({'id':new_gmal_id}) 1450 }); 1451 } 1452 1453 // Tab view switcher 1454 $('body').find('.evo_tab_container').each(function(){ 1455 $(this).find('.evo_tab_section').each(function(){ 1456 if(!$(this).hasClass('visible')){ 1457 $(this).addClass('hidden'); 1458 } 1459 }); 1460 }); 1461 $('body').on('click','.evo_tab',function(){ 1462 tab = $(this).data('tab'); 1463 tabsection = $(this).closest('.evo_tab_view').find('.evo_tab_container'); 1464 tabsection.find('.evo_tab_section').addClass('hidden').removeClass('visible'); 1465 tabsection.find('.'+tab).addClass('visible').removeClass('hidden'); 1466 1467 $(this).parent().find('.evo_tab').removeClass('selected'); 1468 $(this).addClass('selected'); 1469 1470 $('body').trigger('evo_tabs_newtab_selected',[ $(this)]); 1471 }); 1472 1473 // layout view changer - legacy 1474 if($('body').find('.evo_layout_changer').length>0){ 1475 // menu button focus adjust 1476 $('body').find('.evo_layout_changer').each(function(item){ 1477 if($(this).parent().hasClass('boxy')){ 1478 $(this).find('.fa-th-large').addClass('on'); 1479 }else{ 1480 $(this).find('.fa-reorder').addClass('on'); 1481 } 1482 }); 1483 1484 // interaction 1485 $('.evo_layout_changer').on('click','i',function(){ 1486 const CAL = $(this).closest('.ajde_evcal_calendar'); 1487 TYPE = $(this).data('type'); 1488 $(this).parent().find('i').removeClass('on'); 1489 $(this).addClass('on'); 1490 1491 //console.log(TYPE); 1492 1493 if(TYPE=='row'){ 1494 CAL.attr('class','ajde_evcal_calendar'); 1495 // set tile colors 1496 CAL.find('.eventon_list_event').each(function(){ 1497 $(this).find('.desc_trig').css('background-color', ''); 1498 $(this).find('.desc_trig_outter').css('background-color', ''); 1499 }); 1500 }else if(TYPE =='bar'){ 1501 CAL.attr('class','ajde_evcal_calendar box_2 sev cev'); 1502 1503 // set tile colors 1504 CAL.find('.eventon_list_event').each(function(){ 1505 const color = $(this).data('colr'); 1506 $(this).find('.desc_trig').css('background-color', color); 1507 }); 1508 }else{ 1509 1510 // set tile colors 1511 CAL.find('.eventon_list_event').each(function(){ 1512 const color = $(this).data('colr'); 1513 $(this).find('.desc_trig_outter').css('background-color', color); 1514 }); 1515 1516 CAL.attr('class','ajde_evcal_calendar boxy boxstyle0 box_2'); 1517 } 1518 }); 1519 } 1520 1521 // v4.0 view switcher 1522 $('body').on('click', '.evo_cal_view_switcher_cur',function(){ 1523 $(this).parent().toggleClass('SH'); 1524 }) 1525 .on('click', '.evo_vSW',function(){ 1526 O = $(this); 1527 var DATA = O.data('d'); 1528 if(O.hasClass('focusX')) return; 1529 1530 CAL = O.closest('.ajde_evcal_calendar'); 1531 1532 // remove other additions from other views 1533 CAL.find('.evoADDS').fadeOut().delay(200).queue(function(){ 1534 $(this).remove(); 1535 }); 1536 1537 var SC = CAL.evo_shortcode_data(); 1538 var reload_cal_data = false; 1539 1540 // Create date object 1541 var DD = new Date(SC.fixed_year,SC.fixed_month -1 , SC.fixed_day, 0,0,0 ); 1542 DD.setUTCHours(0); 1543 DD.setUTCFullYear( SC.fixed_year ); 1544 DD.setUTCMonth( SC.fixed_month -1 ); 1545 DD.setUTCDate( SC.fixed_day ); 1546 1547 // switch to normal 1548 O.siblings('.evo_vSW').removeClass('focusX'); 1549 O.addClass('focusX'); 1550 CAL.find('.evo_cal_view_switcher_cur').html( O.html() ); 1551 O.closest('.evo_cal_view_switcher').removeClass('SH'); 1552 1553 // calendar class toggling 1554 O.siblings('.evo_vSW').each(function(){ 1555 var _d = $(this).data('d'); 1556 if( _d && 'c' in _d ) CAL.removeClass( _d['c'] ); // remove other cls 1557 });
1558 if( DATA && 'c' in DATA) CAL.addClass( DATA.c ); 1559 1560 $('body').trigger('evo_vSW_clicked_before_ajax', [ O, CAL, DD, reload_cal_data]); 1561 1562 // switching to calendars that need 1 month of events 1563 if( !(O.hasClass('evowv')) ){ 1564 1565 DD.setUTCDate( 1 ); 1566 1567 if( SC.focus_start_date_range != Math.floor(DD.getTime()/1000) ) 1568 reload_cal_data = true; 1569 1570 CAL.evo_update_cal_sc({F:'focus_start_date_range',V: Math.floor(DD.getTime()/1000) }); 1571 1572 DD.setUTCMonth( DD.getUTCMonth() + 1); 1573 DD.setUTCDate( -1); 1574 1575 CAL.evo_update_cal_sc({F:'focus_end_date_range', 1576 V: Math.floor(DD.getTime()/1000) }); 1577 1578 CAL.evo_update_cal_sc({F:'calendar_type', V: 'default'}); 1579 1580 // treating events list based on dif preferences 1581 // vals el_visibility = hide_events, show_events 1582 if( 'el_visibility' in DATA){ 1583 el_visibility = DATA.el_visibility; 1584 1585 if( el_visibility =='show_events') CAL.find('.eventon_list_event').show(); 1586 if( el_visibility =='hide_events') CAL.find('.eventon_list_event').hide(); 1587 if( el_visibility =='hide_list') CAL.find('#evcal_list').addClass('evo_hide'); 1588 if( el_visibility =='show_all'){ 1589 CAL.find('#evcal_list').removeClass('evo_hide'); 1590 CAL.find('.eventon_list_event').show(); 1591 } 1592 } 1593 1594 1595 //CAL.find('.eventon_list_event').show(); 1596 1597 // run ajax to load new events in the range 1598 if( reload_cal_data ){ 1599 $('body').trigger('evo_run_cal_ajax',[CAL.attr('id'),'none','filering']); 1600 } 1601 } 1602 1603 1604 $('body').trigger('evo_vSW_clicked', [ O, CAL, DD, reload_cal_data]); 1605 1606 }); 1607 1608 // SORTING & FILTERING 1609 // display sort section 1610 $('body').on('click','.evo-filter-btn', function(){ 1611 CAL = $(this).closest('.ajde_evcal_calendar'); 1612 line = CAL.find('.eventon_sorting_section'); 1613 if(line.is(':visible')){ 1614 line.hide(); 1615 $(this).removeClass('show'); 1616 }else{ 1617 line.show(); 1618 $(this).addClass('show'); 1619 } 1620 // hide sort menu 1621 CAL.find('.eventon_sort_line').hide(); 1622 }); 1623 1624 // SORTing 1625 $('body').on('click','.evo-sort-btn',function(){ 1626 line = $(this).find('.eventon_sort_line'); 1627 if(line.is(':visible')){ 1628 line.hide(); 1629 $(this).removeClass('show'); 1630 }else{ 1631 line.show(); 1632 $(this).addClass('show'); 1633 } 1634 }); 1635 1636 // update calendar based on the sorting selection 1637 $('body').on('click', '.evo_sort_option',function(){ 1638 O = $(this); 1639 var CAL = O.closest('.ajde_evcal_calendar'); 1640 var sort_by = O.data('val'); 1641 1642 // update new values everywhere 1643 CAL.evo_update_cal_sc({F:'sort_by',V:sort_by}); 1644 1645 O.parent().find('p').removeClass('select'); 1646 O.addClass('select'); 1647 1648 run_cal_ajax(CAL.attr('id'),'none','sorting'); 1649 }); 1650 1651 // filtering section open and close menu 1652 $('body').on('click','.filtering_set_val',function(){ 1653 // close sorting 1654 sortSelect = $(this).closest('.eventon_sorting_section').find('.evo_srt_options'); 1655 if(sortSelect.is(':visible') == true) sortSelect.fadeToggle(); 1656 1657 var obj = $(this); 1658 var current_Drop = obj.siblings('.eventon_filter_dropdown'); 1659 var current_drop_pare = obj.closest('.eventon_filter'); 1660 1661 current_drop_pare.siblings('.eventon_filter').find('.eventon_filter_dropdown').each(function(){ 1662 if($(this).is(':visible')== true ){ 1663 $(this).hide(); 1664 $(this).siblings('p').removeClass('show'); 1665 } 1666 }); 1667 1668 if(current_Drop.is(':visible')== true){ 1669 obj.siblings('.eventon_filter_dropdown').fadeOut('fast'); 1670 obj.removeClass('show'); 1671 }else{ 1672 obj.siblings('.eventon_filter_dropdown').fadeIn('fast'); 1673 obj.addClass('show'); 1674 } 1675 }); 1676 1677 // selection on filter dropdown list 1678 $('body').on('click','p.evo_filter_val',function (){ 1679 1680 CAL = $(this).closest('.ajde_evcal_calendar'); 1681 var new_filter_val = $(this).data('filter_val'), 1682 O = $(this), 1683 filter_section = $(this).closest('.eventon_filter_line'), 1684 filter = $(this).closest('.eventon_filter'),
1685 filter_current_set_val = filter.data('filter_val'); 1686 filter_def_val = filter.data('fldef'); 1687 1688 const filter_set_val = filter.find('.filtering_set_val'); 1689 const filter_btn = CAL.find('.evo-filter-btn'); 1690 1691 const arg_filter_type = filter_section.data('filter_type'); 1692 1693 FILTER_DROPDOWN = $(this).parent(); 1694 CAL = $(this).closest('.ajde_evcal_calendar'); 1695 1696 1697 // for filter values with checkboxes 1698 if(arg_filter_type == 'select'){ 1699 val = ''; 1700 1701 1702 // NOT all 1703 if( new_filter_val != 'all'){ 1704 O.parent().find('p.all').removeClass('select'); 1705 O.toggleClass('select'); 1706 1707 var unselect_count = 0; 1708 O.parent().find('p').each(function(){ 1709 if( $(this).hasClass('select')){ 1710 val += $(this).data('filter_val')+','; 1711 }else{ 1712 if(!$(this).hasClass('all')) unselect_count++; 1713 } 1714 }); 1715 1716 // all selected 1717 if(unselect_count == 0){ 1718 O.parent().find('p.all').addClass('select'); 1719 val = 'all'; 1720 } 1721 1722 // remove comma at the end 1723 val = ( val.slice(-1) == ',')? val.slice(0,-1): val; 1724 1725 // if all field is not visible; nothing selected = all 1726 if(val == '' && O.parent().find('p.all').length == 0) val='all'; 1727 1728 // == all 1729 }else{ 1730 if( O.hasClass('select')){ 1731 O.parent().find('p').removeClass('select'); 1732 }else{ 1733 O.parent().find('p').addClass('select'); 1734 val = 'all'; 1735 } 1736 } 1737 1738 filter.data('filter_val',val); // v 2.7.4 1739 1740 // filter_type = default 1741 }else{ 1742 if( new_filter_val == 'all'){ 1743 // if all is already selected 1744 if( O.hasClass('select')){ 1745 new_filter_val = 'NOT-all'; 1746 O.parent().find('p').removeClass('select'); 1747 }else{ 1748 O.parent().find('p').addClass('select'); 1749 } 1750 }else{ 1751 O.parent().find('p').removeClass('select'); 1752 O.addClass('select'); 1753 } 1754 1755 filter.data('filter_val',new_filter_val); 1756 } 1757 1758 var set_new_filter_val = filter.data('filter_val'); 1759 1760 1761 // display filter informer 1762 if( !( CAL.hasClass('flhi') ) ){ 1763 //console.log( CAL.attr('class')); 1764 //console.log(set_new_filter_val+' '+ filter_def_val); 1765 if( set_new_filter_val == filter_def_val){ 1766 filter_set_val.removeClass('set'); 1767 }else{ 1768 filter_set_val.addClass('set'); 1769 } 1770 1771 var count_filters = filter_section.find('.filtering_set_val.set').length; 1772 1773 if( count_filters > 0){ 1774 filter_btn.find('em').html( count_filters ).addClass('o'); 1775 CAL.find('.evo_filter_clear').addClass('show'); 1776 }else{ 1777 filter_btn.find('em').removeClass('o'); 1778 CAL.find('.evo_filter_clear').removeClass('show'); 1779 } 1780 } 1781 1782 1783 1784 // if select filter type 1785 if(arg_filter_type == 'select') return; 1786 1787 1788 // For non checkbox select options 1789 if(filter_current_set_val == new_filter_val){ 1790 $(this).parent().fadeOut(); 1791 }else{ 1792 cal_resets( CAL ); 1793 1794 // make changes 1795 filter.data('filter_val', new_filter_val); 1796 1797 CAL.evo_update_sc_from_filters(); 1798 1799 run_cal_ajax( CAL.attr('id') ,'none','filering'); 1800 1801 // reset the new values 1802 var new_filter_name = $(this).html(); 1803 1804 O.parent().fadeOut(); 1805 filter_set_val.removeClass('show'); 1806 } 1807 }); 1808 1809 // apply filters via button to the calendar 1810 $('.eventon_filter_dropdown').on('change','input',function(event){ 1811 FILTER = $(this).closest('.eventon_filter'); 1812 1813 val = ''; 1814 FILTER.find('input').each(function(){ 1815 val = ($(this).is(':checked'))? val + $(this).data('filter_val') +',': val; 1816 }); 1817 val = (val=='')? '':val; // v2.5.2 1818 FILTER.data('filter_val',val); // v 2.7.4 1819 }); 1820 // apply filters 1821 $('body').on('click','.evo_filter_submit',function(){ 1822 // fadeout any open filter dropdowns 1823 $(this).closest('.eventon_filter_line').find('.eventon_filter_dropdown').fadeOut(); 1824 $(this).closest('.eventon_filter_line').find('.filtering_set_val').removeClass('show'); 1825 1826 CAL = $(this).closest('.ajde_evcal_calendar'); 1827 cal_resets( CAL); 1828 1829 CAL.evo_update_sc_from_filters(); // update shortcode from filters 1830 1831 run_cal_ajax(CAL.attr('id'),'none','filering'); 1832 }); 1833 1834 // CLEAR filters - @4.2 u @4.4 1835 // reset back to default on page load values 1836 $('body').on('click','.evo_filter_clear',function(){ 1837 CAL = $(this).closest('.ajde_evcal_calendar'); 1838 1839 CAL.find('.eventon_filter').each(function(){ 1840 const filter = $(this); 1841 const NOT_values = filter.data('notvals'); 1842 const IN_values = filter.data('invals'); 1843 1844 $(this).find('.filtering_set_val').removeClass('set'); 1845 CAL.find('.evo-filter-btn em').removeClass('o'); 1846 1847 1848 if( IN_values == ''){ 1849 1850 }else if(IN_values == 'all'){ 1851 filter.find('.evo_filter_val').addClass('select'); 1852 }else if( IN_values != ''){ 1853 filter.find('.evo_filter_val').removeClass('select'); 1854 $.each( IN_values, function( index, value){ 1855 filter.find('.evo_filter_val[data-filter_val="'+ value +'"]') 1856 .addClass('select'); 1857 });
1858 } 1859 1860 // set the default filter value 1861 var default_value = ''; 1862 $.each(NOT_values, function(index, value){ 1863 default_value += 'NOT-'+ value + ','; 1864 }); 1865 $.each(IN_values, function(index, value){ 1866 default_value += value + ','; 1867 }); 1868 1869 // remove last comma from the string @since 4.4 1870 default_value = default_value.replace(/,\s*$/, ""); 1871 1872 filter.data('filter_val', default_value); 1873 1874 }); 1875 1876 $(this).removeClass('show'); 1877 1878 // update shortcode and run new ajax for events 1879 CAL.evo_update_sc_from_filters(); 1880 run_cal_ajax(CAL.attr('id'),'none','filering'); 1881 }); 1882 1883 // CAL BODY Listeners 1884 $('body') 1885 // Show more events on list 1886 .on('click','.evoShow_more_events', function(){ 1887 CAL = $(this).closest('.ajde_evcal_calendar'); 1888 SC = CAL.evo_shortcode_data(); 1889 1890 OBJ = $(this); 1891 1892 // redirect to an external link 1893 if(SC.show_limit_redir !== ''){ 1894 window.location = SC.show_limit_redir; return false; 1895 } 1896 1897 // ajax pagination 1898 if( SC.show_limit_ajax =='yes'){ 1899 CURRENT_PAGED = parseInt(SC.show_limit_paged); 1900 CAL.evo_update_cal_sc({F:'show_limit_paged', V: CURRENT_PAGED+1}); 1901 run_cal_ajax( CAL.attr('id'), 'none','paged'); 1902 1903 }else{ 1904 var event_count = parseInt( SC.event_count ); 1905 1906 var eventList = OBJ.parent(); 1907 var allEvents = eventList.find('.eventon_list_event').length; 1908 1909 var currentShowing = eventList.find('.eventon_list_event:visible').length; 1910 1911 for(x=1; x<=event_count ; x++ ){ 1912 var inde = currentShowing+x-1; 1913 eventList.find('.eventon_list_event:eq('+ inde+')').slideDown(); 1914 } 1915 1916 // hide view more button 1917 if(allEvents > currentShowing && allEvents<= (currentShowing+event_count)){ 1918 $(this).fadeOut(); 1919 } 1920 } 1921 1922 }) 1923 // MONTH switch 1924 .on('click','.evcal_btn_prev', function(){ 1925 var cal_id = $(this).closest('.ajde_evcal_calendar').attr('id'); 1926 var direction = $(this).closest('.ajde_evcal_calendar').hasClass('evortl')? 'next': 'prev'; 1927 run_cal_ajax(cal_id, direction ,'switchmonth'); 1928 }) 1929 .on('click','.evcal_btn_next',function(){ 1930 var cal_id = $(this).closest('.ajde_evcal_calendar').attr('id'); 1931 var direction = $(this).closest('.ajde_evcal_calendar').hasClass('evortl')? 'prev': 'next'; 1932 run_cal_ajax(cal_id, direction ,'switchmonth'); 1933 }) 1934 1935 // JUMPER switch 1936 .on('calendar_month_changed',function(event, CAL){ 1937 SC = CAL.evo_shortcode_data(); 1938 1939 var O = CAL.find('.evo_j_container'); 1940 O.find('.evo_j_months a').removeClass('set'); 1941 O.find('.evo_j_months a[data-val="'+ SC.fixed_month +'"]').addClass('set'); 1942 1943 O.find('.evo_j_years a').removeClass('set'); 1944 O.find('.evo_j_years a[data-val="'+ SC.fixed_year +'"]').addClass('set'); 1945 1946 // show go to today 1947 B = CAL.find('.evo-gototoday-btn'); 1948 if( SC.fixed_month != B.data('mo') || SC.fixed_year != B.data('yr')){ 1949 B.show(); 1950 } 1951 }) 1952 1953 // show more/less event details 1954 .on('click','.evobtn_details_show_more',function(){ 1955 control_more_less( $(this)); 1956 }) 1957 // refresh now calendar 1958 .on('runajax_refresh_now_cal',function(e, OBJ, nonce){ 1959 1960 const section = OBJ.closest('.evo_eventon_live_now_section'); 1961 const CAL = section.find('.ajde_evcal_calendar').eq(0); 1962 1963 var dataA = { 1964 nonce: nonce, 1965 other: OBJ.data(), 1966 SC: CAL.evo_shortcode_data() 1967 }; 1968 1969 1970 1971 $.ajax({
1972 beforeSend: function(){ 1973 section.addClass('evoloading'); 1974 }, 1975 type: 'POST',url: get_ajax_url('eventon_refresh_now_cal'), data: dataA,dataType:'json', 1976 success:function(data){ 1977 if( data.status == 'good'){ 1978 section.html( data.html); 1979 1980 $('body').trigger('evo_refresh_designated_elm',[ OBJ, 'evo_vir_data']); 1981 } 1982 1983 },complete:function(data){ 1984 section.removeClass('evoloading'); 1985 1986 BODY.find('.evo_countdowner').each(function(){ 1987 $(this).evo_countdown(); 1988 }); 1989 } 1990 }); 1991 }) 1992 1993 // refresh event top 1994 .on('runajax_refresh_eventtop',function(e, OBJ, nonce){ 1995 1996 }) 1997 1998 // click on no events - @v 4.2 1999 .on('click','.evo_no_events_btn', function (e){ 2000 BODY.trigger('click_on_no_event_btn', [$(this) ] ); 2001 }) 2002 ; 2003 2004 2005 // PRIMARY hook to get content 2006 // MAIN AJAC for calendar events v2.8 2007 function run_cal_ajax( cal_id, direction, ajaxtype){ 2008 2009 // identify the calendar and its elements. 2010 var CAL = ev_cal = $('#'+cal_id); 2011 2012 // check if ajax post content should run for this calendar or not 2013 if(CAL.attr('data-runajax')!='0'){ 2014 2015 // category filtering for the calendar 2016 var cat = CAL.find('.evcal_sort').attr('cat'); 2017 2018 // reset paged values for switching months 2019 if(ajaxtype=='switchmonth'){ 2020 CAL.find('.cal_arguments').attr('data-show_limit_paged',1); 2021 CAL.evo_update_cal_sc({F:'show_limit_paged', V: '1'}); 2022 } 2023 2024 SC = CAL.evo_shortcode_data(); 2025 2026 $('body').trigger('evo_main_ajax_before', [CAL, ajaxtype, direction, SC]); 2027 2028 var data_arg = { 2029 //action: 'eventon_get_events', 2030 direction: direction, 2031 shortcode: SC, 2032 ajaxtype: ajaxtype, 2033 nonce: evo_general_params.n 2034 }; 2035 2036 EVENTS_LIST = ev_cal.find('.eventon_events_list'); 2037 2038 $.ajax({
2039 beforeSend: function(){ 2040 ev_cal.addClass('evo_loading'); 2041 if(ajaxtype != 'paged') EVENTS_LIST.slideUp('fast'); 2042 2043 if(ajaxtype == 'paged'){ 2044 txt = EVENTS_LIST.find('.evoShow_more_events').html(); 2045 EVENTS_LIST.find('.evoShow_more_events').html('. . .').data('txt',txt); 2046 } 2047 ev_cal.evo_loader_animation(); 2048 }, 2049 type: 'POST', url: get_ajax_url('eventon_get_events'),data: data_arg,dataType:'json', 2050 success:function(data){ 2051 if(!data) return false; 2052 if(ajaxtype == 'paged'){ 2053 EVENTS_LIST.find('.evoShow_more_events').remove(); 2054 EVENTS_LIST.find('.clear').remove(); 2055 2056 2057 EVENTS_LIST.append( data.html + "<div class='clear'></div>"); 2058 2059 // hide show more events if all events loaded 2060 var events_in_list = EVENTS_LIST.find('.eventon_list_event').length; 2061 if( 'total_events' in data && data.total_events == events_in_list){ 2062 EVENTS_LIST.find('.evoShow_more_events').hide(); 2063 } 2064 2065 // for month lists duplicate headers // @+2.8.1 2066 var T = {}; 2067 EVENTS_LIST.find('.evcal_month_line').each(function(){ 2068 d = $(this).data('d'); 2069 if( T[d]) 2070 $(this).remove(); 2071 else 2072 T[d] = true; 2073 }); 2074 2075 var T = {}; 2076 EVENTS_LIST.find('.sep_month_events').each(function(){ 2077 d = $(this).data('d'); 2078 if( T[d]){ 2079 var H = $(this).html(); 2080 EVENTS_LIST.find('.sep_month_events[data-d="'+d+'"]').append( H ); 2081 $(this).remove(); 2082 }else{T[d] = true;} 2083 }); 2084 2085 }else{ 2086 EVENTS_LIST.html(data.html); 2087 } 2088 2089 // update calednar month title 2090 animate_month_switch(data.cal_month_title, ev_cal.find('.evo_month_title')); 2091 2092 // update calendar shortcode values after ajax 2093 ev_cal.evo_update_all_cal_sc({SC: data.SC}); 2094 2095 // update events list to calendar footer data 2096 ev_cal.find('.evo_cal_events').data('events', data.json); 2097 2098 $('body').trigger('calendar_month_changed',[CAL]); 2099 2100 $('body').trigger('evo_main_ajax_success', [CAL, ajaxtype, data, data_arg]); 2101 2102 },complete:function(data){ 2103 ev_cal.evo_loader_animation({direction:'end'}); 2104 2105 // show events list events if not set to hide on load 2106 if(! EVENTS_LIST.hasClass('evo_hide')) EVENTS_LIST.delay(300).slideDown('slow'); 2107 2108 ev_cal.evoGenmaps({'delay':400}); 2109 init_run_gmap_openevc(600); 2110 fullheight_img_reset(cal_id); 2111 2112 // scroll to top of calendar 2113 $('html, body').animate({ 2114 //scrollTop: ev_cal.offset().top - 20 2115 }, 500); 2116 2117 // pluggable 2118 $('body').trigger('evo_main_ajax_complete', [CAL, ajaxtype, data.responseJSON , data_arg]); 2119 ev_cal.removeClass('evo_loading'); 2120 } 2121 }); 2122 } 2123 } 2124 2125 $('body').on('evo_run_cal_ajax',function(event,cal_id, direction, ajaxtype){ 2126 run_cal_ajax( cal_id, direction, ajaxtype); 2127 }); 2128 2129 // deprecated bridge function for sortby value 2130 function ajax_post_content(sortby, cal_id, direction, ajaxtype){ 2131 run_cal_ajax( cal_id, direction, ajaxtype); 2132 } 2133 2134 // subtle animation when switching months 2135 function animate_month_switch(new_data, title_element){ 2136 var current_text = title_element.html(); 2137 var CAL = title_element.closest('.ajde_evcal_calendar'); 2138 2139 2140 title_element.html(new_data); 2141 return; 2142 2143 /* - @v 4.2 2144 var hei = title_element.height(); 2145 var wid= title_element.width(); 2146 2147 2148 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); 2149 2150 var LC_w = title_element.find('span:last-child').width()+5; 2151 2152 console.log(title_element); 2153 2154 title_element.animate({width: LC_w},2000); 2155 title_element.find('span:first-child').fadeOut(800); 2156 title_element.find('span:last-child').fadeIn(800, function(){ 2157 title_element.html(new_data); 2158 }); 2159 */ 2160 2161 } 2162 2163 // actual animation/function for more/less button 2164 function control_more_less(obj){ 2165 var content = obj.attr('content'); 2166 var current_text = obj.find('.ev_more_text').html(); 2167 var changeTo_text = obj.find('.ev_more_text').attr('data-txt');
2168 const cell = obj.closest('.evcal_evdata_cell'); 2169 2170 2171 // show more 2172 if(content =='less'){ 2173 2174 obj.closest('.evcal_evdata_cell').removeClass('shorter_desc'); 2175 2176 2177 obj.attr({'content':'more'}); 2178 obj.find('.ev_more_arrow').removeClass('ard'); 2179 obj.find('.ev_more_text').attr({'data-txt':current_text}).html(changeTo_text); 2180 2181 }else{ 2182 obj.closest('.evcal_evdata_cell').addClass('shorter_desc'); 2183 2184 obj.attr({'content':'less'}); 2185 obj.find('.ev_more_arrow').addClass('ard'); 2186 obj.find('.ev_more_text').attr({'data-txt':current_text}).html(changeTo_text); 2187 } 2188 } 2189 2190 // expand and shrink featured image 2191 $('body').on('click','.evcal_evdata_img',function(){ 2192 if(!$(this).hasClass('evo_noclick')){ 2193 feature_image_expansion($(this), 'click'); 2194 } 2195 }); 2196 2197 // featured image height processing 2198 function feature_image_expansion(image, type){ 2199 img = image; 2200 2201 var img_status = img.attr('data-status'); 2202 var img_style = img.attr('data-imgstyle'); 2203 2204 // if image already expanded 2205 if(img_status=='open' ){ 2206 img.attr({'data-status':'close'}).css({'height':''}); 2207 }else{ 2208 var img_full_height = parseInt(img.attr('data-imgheight')); 2209 var cal_width = parseInt(img.closest('.ajde_evcal_calendar').width()); 2210 cal_width = (cal_width)? cal_width: img.width(); 2211 var img_full_width = parseInt(img.attr('data-imgwidth')); 2212 2213 2214 // show at minimized height 2215 if(img_style=='100per'){ 2216 relative_height = img_full_height; 2217 }else if(img_style=='full'){ 2218 relative_height = parseInt(img_full_height * (cal_width/img_full_width)) ; 2219 }else{ 2220 // minimized version 2221 if(type=='click'){ 2222 relative_height = parseInt(img_full_height * (cal_width/img_full_width)); 2223 relative_height = (relative_height)? relative_height: img_full_height; 2224 2225 relative_height = parseInt((cal_width * img_full_height) /img_full_width); 2226 2227 //console.log(relative_height+ ' '+img_full_height+' '+cal_width); 2228 2229 }else{ 2230 relative_height = img.attr('data-minheight'); 2231 } 2232 } 2233 2234 // when to set the status as open for images 2235 if(img_status=='' && img_style=='minmized'){ 2236 img.attr({'data-status':'close'}).removeClass('expanded'); 2237 }else{ 2238 img.attr({'data-status':'open'}).addClass('expanded'); 2239 } 2240 img.css({'height':relative_height}); 2241 } 2242 } 2243 2244 // reset featured images based on settings 2245 function fullheight_img_reset(calid){ 2246 if(calid){ 2247 $('#'+calid).find('.eventon_list_event .evo_metarow_fimg').each(function(){ 2248 feature_image_expansion($(this)); 2249 }); 2250 }else{ 2251 $('.evo_metarow_fimg').each(function(){ 2252 feature_image_expansion($(this)); 2253 }); 2254 } 2255 } 2256 2257 // treatments for calendar events upon load 2258 function treat_events(calid){ 2259 if(calid!=''){ 2260 if(is_mobile()){ 2261 $('#'+calid).find('.evo_metarow_getDr form').attr({'target':'_self'}); 2262 } 2263 } 2264 } 2265 2266 // if mobile check 2267 function is_mobile(){ 2268 return ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) )? true: false; 2269 } 2270 2271 // edit event button redirect 2272 $('body').on('click','.editEventBtnET', function(event){ 2273 event.stopPropagation(); 2274 href = $(this).attr('href'); 2275 window.open(href); 2276 }); 2277 2278 // repeat events series 2279 // @u 2.6.9 2280 $('body').on('click','.evo_repeat_series_date',function(){ 2281 if( $(this).parent().data('click') ){ 2282 URL = $(this).data('l'); 2283 window.location = URL; 2284 } 2285 }); 2286 2287 // Tax Archive Content 2288 // organizer links from eventtop @4.5 2289 $('body').on('click','.evo_org_clk_link',function(){ 2290 window.open( $(this).data('link') , "_blank"); 2291 }); 2292 2293 // event location archive card page 2294 // @u 2.8.6 2295 $('body').find('.evo_location_map').each(function(){ 2296 $(this).evo_load_gmap(); 2297 }); 2298 2299 // on event card lightbox load -> organizer details @since 4.2 2300 $('body').on('evo_ajax_complete_eventon_get_tax_card_content', function(event, OO){ 2301 2302 LB = $('body').find('.'+ OO.lightbox_key); 2303 2304 if( LB.find('.evo_trigger_map').length == 0 ) return; 2305 map_id_elm = LB.find('.evo_trigger_map'); 2306 2307 map_id_elm.evo_load_gmap(); 2308 2309 // run countdown timers 2310 LB.find('.evo_countdowner').each(function(){ 2311 $(this).evo_countdown(); 2312 }); 2313 2314 }); 2315 2316 // SINGLE EVENTS 2317 // Loading single event json based content 2318 $('body').on('evo_load_single_event_content', function(event, eid, obj){ 2319 var ajaxdataa = {}; 2320 ajaxdataa['eid'] = eid; 2321 ajaxdataa['nonce'] = the_ajax_script.postnonce; 2322 2323 // pass on other event values 2324 if(obj.data('j')){ 2325 $.each(obj.data('j'), function(index,val){ 2326 ajaxdataa[ index] = val; 2327 });
2328 } 2329 2330 $.ajax({ 2331 beforeSend: function(){ }, 2332 url: get_ajax_url('eventon_load_event_content'), 2333 data: ajaxdataa, dataType:'json', type: 'POST', 2334 success:function(data){ 2335 $('body').trigger('evo_single_event_content_loaded', [data, obj]); 2336 },complete:function(){ } 2337 }); 2338 }); 2339 2340 if(is_mobile()){ 2341 if($('body').find('.fb.evo_ss').length != 0){ 2342 $('body').find('.fb.evo_ss').each(function(){ 2343 obj = $(this); 2344 obj.attr({'href':'http://m.facebook.com/sharer.php?u='+obj.attr('data-url')}); 2345 }); 2346 } 2347 } 2348 2349 // on single event page 2350 if($('body').find('.evo_sin_page').length>0){ 2351 $('.evo_sin_page').each(function(){ 2352 $('body').trigger('evo_load_single_event_content',[ $(this).data('eid'), $(this)]); 2353 $(this).find('.desc_trig ').attr({'data-ux_val':'none'}); 2354 }); 2355 } 2356 2357 // Single events box 2358 // Click on single event box 2359 $('.eventon_single_event').on('click', '.evcal_list_a',function(event){ 2360 var obj = $(this); 2361 var CAL = obj.closest('.ajde_evcal_calendar'); 2362 var SC = CAL.evo_shortcode_data(); 2363 2364 event.preventDefault(); 2365 2366 // open in event page 2367 if(SC.ux_val == 4){ 2368 var url = obj.parent().siblings('.evo_event_schema').find('[itemprop=url]').attr('href'); 2369 window.location.href= url; 2370 }else if(SC.ux_val == '2'){ // External Link 2371 var url = SC.exturl; 2372 window.location.href= url; 2373 }else if(SC.ux_val == 'X'){ // do not do anything 2374 return false; 2375 } 2376 }); 2377 // each single event box 2378 $('body').find('.eventon_single_event').each(function(){ 2379 var _this = $(this); 2380 2381 var CAL = _this.closest('.ajde_evcal_calendar'); 2382 var SC = CAL.evo_shortcode_data(); 2383 var evObj = CAL.find('.eventon_list_event'); 2384 2385 // show expanded eventCard 2386 if( SC.expanded =='yes'){ 2387 _this.find('.evcal_eventcard').show(); 2388 var idd = _this.find('.evcal_gmaps'); 2389 2390 // close button 2391 _this.find('.evcal_close').parent().css({'padding-right':0}); 2392 _this.find('.evcal_close').hide(); 2393 2394 //console.log(idd); 2395 var obj = _this.find('.desc_trig'); 2396 2397 // Google Map 2398 obj.evoGenmaps({ 2399 'fnt':2, 2400 'cal':CAL, 2401 }); 2402 2403 // mark as eventcard open @since 4.4 2404 evObj.find('.event_description').addClass('open'); 2405 2406 // open eventBox and lightbox 2407 }else if(SC.uxval =='3'){ 2408 2409 var obj = _this.find('.desc_trig'); 2410 // remove other attr - that cause to redirect 2411 obj.removeAttr('data-exlk').attr({'data-ux_val':'3'}); 2412 } 2413 2414 // show event excerpt 2415 var ev_excerpt = CAL.find('.event_excerpt').html(); 2416 2417 if(ev_excerpt!='' && ev_excerpt!== undefined && SC.excerpt =='yes' ){ 2418 var appendation = '<div class="event_excerpt_in">'+ev_excerpt+'</div>' 2419 evObj.append(appendation); 2420 } 2421 2422 // trigger support @since 4.4 2423 var obj = evObj.find('.desc_trig'); 2424 var event_id = evObj.data('event_id'); 2425 2426 2427 $('body').trigger('evo_slidedown_eventcard_complete',[ event_id, obj]); 2428 }); 2429 2430 // HELPER items script 2431 // yes no button 2432 $('body').on('click','.ajde_yn_btn ', function(event){ 2433 2434 // stop this code from working on wp-admin 2435 if($('body').hasClass('wp-admin')) return false; 2436 2437 var obj = $(this); 2438 var afterstatement = obj.attr('afterstatement'); 2439 afterstatement = (afterstatement === undefined)? obj.attr('data-afterstatement'): afterstatement; 2440 var uid = ''; 2441 2442 // yes 2443 if(obj.hasClass('NO')){ 2444 obj.removeClass('NO'); 2445 obj.siblings('input').val('yes'); 2446 2447 // afterstatment 2448 if(afterstatement!=''){ 2449 var type = (obj.attr('as_type')=='class')? '.':'#'; 2450 if( obj.data('uid') !== undefined) uid = obj.data('uid'); 2451 $(type+ afterstatement).slideDown('fast'); 2452 } 2453 2454 }else{//no 2455 obj.addClass('NO'); 2456 obj.siblings('input').val('no'); 2457 2458 if(afterstatement!=''){ 2459 var type = (obj.attr('as_type')=='class')? '.':'#';
2460 $(type+ afterstatement ).slideUp('fast'); 2461 } 2462 } 2463 }); 2464 2465// Search Scripts 2466 // Enter key detection for pc 2467 $.fn.evo_enterKey = function (fnc) { 2468 return this.each(function () { 2469 $(this).keypress(function (ev) { 2470 var keycode = (ev.keyCode ? ev.keyCode : ev.which); 2471 if (keycode == '13') { 2472 fnc.call(this, ev); 2473 } 2474 }) 2475 }) 2476 } 2477 2478 $('body').on('click','.evo-search',function(){ 2479 var section = $(this).closest('.calendar_header'); 2480 var item = section.find('.evo_search_bar'); 2481 2482 item.slideToggle('fast', function(){ 2483 if(item.is(':visible')) item.find('input').focus(); 2484 }); 2485 }); 2486 2487 // Submit search from search box u 4.5.8 2488 $('body').on('click','.evo_do_search',function(){ 2489 do_search_box( $(this) ); 2490 }); 2491 2492 // dynamic enter key press on the search input field @4.2 2493 $(".evo_search_field").evo_enterKey(function () { 2494 do_search_box( $(this).siblings('.evo_do_search') ); 2495 }); 2496 2497 2498 // primary search function 2499 function do_search_box(OBJ){ 2500 SearchVal = OBJ.closest('.evosr_search_box').find('input').val(); 2501 Evosearch = OBJ.closest('.EVOSR_section'); 2502 OBJ.closest('.evo_search_entry').find('.evosr_msg').hide(); 2503 2504 //console.log(SearchVal); 2505 2506 if( SearchVal === undefined || SearchVal == ''){ 2507 OBJ.closest('.evo_search_entry').find('.evosr_msg').show(); 2508 return false; 2509 } 2510 2511 $('body') 2512 .on('evo_ajax_beforesend_evo_get_search_results', function (event, uid){ 2513 Evosearch.find('.evo_search_results_count').hide(); 2514 Evosearch.addClass('searching'); 2515 }).on('evo_ajax_complete_evo_get_search_results', function (event, uid){ 2516 Evosearch.removeClass('searching'); 2517 }).on('evo_ajax_success_evo_get_search_results', function (event, uid, data){ 2518 Evosearch.find('.evo_search_results').html( data.content); 2519 2520 if(Evosearch.find('.no_events').length==0){ 2521 // find event count 2522 Events = Evosearch.find('.evo_search_results').find('.eventon_list_event').length; 2523 Evosearch.find('.evo_search_results_count span').html( Events); 2524 Evosearch.find('.evo_search_results_count').fadeIn(); 2525 } 2526 }); 2527 2528 var ajax_results = OBJ.evo_admin_get_ajax({ 2529 'ajaxdata': { 2530 //action: 'eventon_search_evo_events', 2531 search: SearchVal, 2532 shortcode: Evosearch.find('span.data').data('sc'), 2533 nonce: evo_general_params.n 2534 }, 2535 ajax_type:'endpoint', 2536 ajax_action:'eventon_search_evo_events', 2537 'uid':'evo_get_search_results', 2538 end: 'client' 2539 }); 2540 2541 } 2542 2543 // submit search from calendar 2544 $('body').on('click','.evosr_search_btn',function(){ 2545 search_within_calendar( $(this).siblings('input') ); }); 2546 $(".evo_search_bar_in input").evo_enterKey(function () { 2547 search_within_calendar( $(this) ); }); 2548 2549 function search_within_calendar(obj){ 2550 2551 var ev_cal = obj.closest('.ajde_evcal_calendar'); 2552 2553 ev_cal.evo_update_cal_sc({F:'show_limit_paged',V: '1' }); 2554 ev_cal.evo_update_cal_sc({F:'s',V: obj.val() }); 2555 2556 run_cal_ajax( ev_cal.attr('id'),'none','search'); 2557 2558 return false; 2559 } 2560
2561 // reset search field @since 4.5 2562 $('body').on('evo_main_ajax_complete',function(event,CAL, ajaxtype, responseJSON , data_arg ){ 2563 2564 if(ajaxtype == 'search' ){ 2565 if( data_arg.shortcode['s'] != '' ){ 2566 CAL.find('.evosr_search_clear_btn').addClass('show'); 2567 } 2568 } 2569 }).on('click','.evosr_search_clear_btn',function(event){ 2570 event.preventDefault(); 2571 const obj = $(this); 2572 var ev_cal = obj.closest('.ajde_evcal_calendar'); 2573 ev_cal.evo_update_cal_sc({F:'s',V: '' }); 2574 run_cal_ajax( ev_cal.attr('id'),'none','search'); 2575 2576 obj.removeClass('show'); 2577 obj.siblings('input').val(''); 2578 }); 2579 2580 2581 // More event images interaction 2582 $('body').on('click','.evo_event_more_img',function(){ 2583 var O = $(this); 2584 var eCARD = O.closest('.evcal_eventcard'); 2585 var fIMG = O.find('img'); 2586 var fURL = fIMG.data('f'); 2587 2588 O.parent().find('span').removeClass('select'); O.addClass('select'); 2589 2590 eCARD.find('img.evo_event_main_img').attr({'src': fURL}); 2591 2592 relIMG = eCARD.find('.evo_metarow_fimg'); 2593 relIMG.css('background-image', 'url('+ fURL +')' ); 2594 relIMG.data('imgheight', fIMG.data('h')); 2595 }); 2596 2597// supportive 2598 // ajax url function @u 4.5.5 2599 function get_ajax_url(action){ 2600 var ajax_type = 'endpoint'; 2601 if('ajax_method' in evo_general_params ) ajax_type = evo_general_params.ajax_method; 2602 return $('body').evo_get_ajax_url({a:action, type: ajax_type }); 2603 } 2604 // handlebar additions 2605 function handlebar_additional_arguments(){ 2606 Handlebars.registerHelper('ifE',function(v1, options){ 2607 return (v1 !== undefined && v1 != '' && v1) 2608 ? options.fn(this) 2609 : options.inverse(this); 2610 }); 2611 2612 Handlebars.registerHelper('ifEQ',function(v1, v2, options){ 2613 return ( v1 == v2)? options.fn(this): options.inverse(this); 2614 }); 2615 Handlebars.registerHelper('ifNEQ',function(v1, v2, options){ 2616 return ( v1 != v2)? options.fn(this): options.inverse(this); 2617 }); 2618 Handlebars.registerHelper('BUStxt',function(V, options){ 2619 if( !( V in BUS.txt) ) return V; 2620 return BUS.txt[V]; 2621 }); 2622 Handlebars.registerHelper('GetDMnames',function(V, U, options){ 2623 return BUS.dms[U][ V ]; 2624 }); 2625 // get total of increments 2626 Handlebars.registerHelper('forAdds',function(count, add_val, options){ 2627 O = ''; 2628 for(x=1; x<= count; x++){ O += add_val; } 2629 return O; 2630 }); 2631 Handlebars.registerHelper('GetEvProp',function(EID, PROP, CALID){ 2632 EID = EID.split('-'); 2633 EV = $('#'+ CALID).find('.evo_cal_events').data('events'); 2634 2635 var O = ''; 2636 $.each(EV, function(i,d){ 2637 if( d.ID == EID[0] && d.ri == EID[1]){ 2638 if( !(PROP in d.event_pmv)) return; 2639 O = d.event_pmv[PROP][0]; 2640 } 2641 }); 2642 return O; 2643 }); 2644 Handlebars.registerHelper('GetEvV',function(EID, PROP, CALID){ 2645 EID = EID.split('-'); 2646 EV = $('#'+ CALID).find('.evo_cal_events').data('events'); 2647 2648 var O = ''; 2649 $.each(EV, function(i,d){ 2650 if( d.ID == EID[0] && d.ri == EID[1]){ 2651 O = d[PROP]; 2652 } 2653 }); 2654 return O; 2655 }); 2656 Handlebars.registerHelper('COUNT',function( V){ 2657 return Object.keys(V).length; 2658 }); 2659 Handlebars.registerHelper('CountlimitLess',function( AR, C,options){ 2660 var L= Object.keys(AR).length; 2661 return ( L < C)? options.inverse(this): options.fn(this); 2662 }); 2663 Handlebars.registerHelper('ifCOND',function(v1, operator, v2, options){ 2664 return checkCondition(v1, operator, v2) 2665 ? options.fn(this) 2666 : options.inverse(this); 2667 }); 2668 Handlebars.registerHelper('toJSON', function(obj) { 2669 return new Handlebars.SafeString(JSON.stringify(obj)); 2670 }); 2671 Handlebars.registerHelper('Cal_def_check',function(V, options){ 2672 if( BUS.cal_def && BUS.cal_def[V] ) return options.fn(this); 2673 return options.inverse(this); 2674 }); 2675 Handlebars.registerHelper('TypeCheck',function(V, options){ 2676 if( options.type == V ) return options.fn(this); 2677 return options.inverse(this); 2678 }); 2679 } 2680 function checkCondition(v1, operator, v2) { 2681 switch(operator) { 2682 case '==': 2683 return (v1 == v2); 2684 case '===': 2685 return (v1 === v2); 2686 case '!==': 2687 return (v1 !== v2); 2688 case '<': 2689 return (v1 < v2); 2690 case '<=': 2691 return (v1 <= v2); 2692 case '>': 2693 return (v1 > v2); 2694 case '>=': 2695 return (v1 >= v2); 2696 case '&&': 2697 return (v1 && v2); 2698 case '||': 2699 return (v1 || v2); 2700 default: 2701 return false; 2702 } 2703 } 2704 // @2.9.1 2705 // increase and reduce quantity 2706 $('body').on('click','.evo_qty_change', function(event){ 2707 var OBJ = $(this); 2708 var QTY = oQTY = parseInt(OBJ.siblings('em').html()); 2709 var MAX = OBJ.siblings('input').attr('max'); 2710 var BOX = OBJ.closest('.evo_purchase_box'); 2711 2712 var pfd = BOX.find('.evo_purchase_box_data').data('pfd'); 2713 2714 2715 (OBJ.hasClass('plu'))? QTY++: QTY--; 2716 2717 QTY =(QTY==0)? 1: QTY; 2718 QTY = (MAX!='' && QTY > MAX)? MAX: QTY; 2719 2720 // new total price 2721 var sin_price = OBJ.parent().data('p'); 2722 new_price = sin_price * QTY; 2723 2724 new_price = get_format_price( new_price, pfd); 2725 2726 BOX.find('.total .value').html( new_price); 2727 2728 OBJ.siblings('em').html(QTY); 2729 OBJ.siblings('input').val(QTY); 2730 2731 $('body').trigger('evo_qty_changed',[QTY,oQTY, new_price,OBJ ]); 2732 }); 2733 2734 // Total formating 2735 function get_format_price(price, data){ 2736 2737 // price format data 2738 PF = data; 2739 2740 totalPrice = price.toFixed(PF.numDec); // number of decimals 2741 htmlPrice = totalPrice.toString().replace('.', PF.decSep); 2742 2743 if(PF.thoSep.length > 0) { 2744 htmlPrice = _addThousandSep(htmlPrice, PF.thoSep); 2745 } 2746 if(PF.curPos == 'right') { 2747 htmlPrice = htmlPrice + PF.currencySymbol; 2748 } 2749 else if(PF.curPos == 'right_space') { 2750 htmlPrice = htmlPrice + ' ' + PF.currencySymbol; 2751 } 2752 else if(PF.curPos == 'left_space') { 2753 htmlPrice = PF.currencySymbol + ' ' + htmlPrice; 2754 } 2755 else { 2756 htmlPrice = PF.currencySymbol + htmlPrice; 2757 } 2758 return htmlPrice; 2759 } 2760 function _addThousandSep(n, thoSep){ 2761 var rx= /(\d+)(\d{3})/; 2762 return String(n).replace(/^\d+/, function(w){ 2763 while(rx.test(w)){ 2764 w= w.replace(rx, '$1'+thoSep+'$2'); 2765 } 2766 return w; 2767 }); 2768 }; 2769 2770 2771 2772});
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.