1jQuery(document).ready(function ($) { 2 var component = { 3 initiated: false, 4 breakpoints: [ 5 { 6 name: "desktop", 7 min: 1367, 8 max: null, 9 }, 10 { 11 name: "laptop", 12 min: 1025, 13 max: 1366, 14 }, 15 { 16 name: "tablet", 17 min: 768, 18 max: 1024, 19 }, 20 { 21 name: "mobile", 22 min: 0, 23 max: 767, 24 }, 25 ], 26 create: function (values) { 27 var instance = Object.create(this); 28 Object.keys(values).forEach(function (key) { 29 instance[key] = values[key]; 30 }); 31 return instance; 32 }, 33 get_breakpoint: function () { 34 var window_width = $(document).width() + 17; 35 for (var bp of this.breakpoints) { 36 var max = bp.max || 100000; 37 if (window_width >= bp.min && window_width <= max) { 38 return bp.name; 39 } 40 } 41 return null; // shouldn't ever return null if breakpoints are set up properly 42 }, 43 }; 44 45 var post_list = component.create({ 46 cntr_selector: null, // REQUIRED: override at child level - the jquery selector of the post loop container 47 cntr: null, // define at child level 48 has_filters: true, // whether or not post list has filters 49 active_filter_classes: [], 50 num_active_posts: 0, // gets changed each time render() runs 51 is_filter_active: false, 52 filter_taxonomy_slug: "tags", // override at child level 53 done_jquery_binding: false, 54 // filter_btns: { 55 // see_all: $('.all-posts') // override at child level 56 // }, 57 convert_tag_to_class: function (tag) { 58 return ( 59 "." + 60 this.filter_taxonomy_slug + 61 "-" + 62 tag.replace(/\s+/g, "-").toLowerCase() 63 ); 64 }, 65 activate_filter: function (tag) { 66 if (tag) { 67 tag = this.convert_tag_to_class(tag); 68 this.is_filter_active = true; 69 this.active_filter_classes.push(tag); 70 // this.cntr.find('.all-posts').removeClass('active'); 71 } else { 72 // this means "See All" is being activated.. all other filters get wiped 73 this.is_filter_active = false; 74 this.active_filter_classes = []; 75 // this.filter_btns.see_all.addClass('active'); 76 } 77 this.render(); 78 }, 79 deactivate_filter: function (tag, activate_see_all) { 80 if (!tag) return; 81 tag = this.convert_tag_to_class(tag); 82 var index = this.active_filter_classes.indexOf(tag); 83 if (index > -1) { 84 this.active_filter_classes.splice(index, 1); 85 if (activate_see_all) this.activate_filter(""); 86 // if no active filters remain, activate "See All" (this will initiate this.render() ) 87 else this.render(); 88 } 89 }, 90 init: function () { 91 console.log("init post_list"); 92 this.cntr = $(this.cntr_selector); 93 if (this.cntr.length) { 94 // components only render if they exist on the page 95 this.initiated = true; 96 this.render(true); 97 } 98 return this; 99 }, 100 render: function (initial_page_load = false) {
101 if (!initial_page_load) { 102 if (this.has_filters) { 103 var post_list = this; 104 console.log( 105 "active filters: " + JSON.stringify(this.active_filter_classes) 106 ); 107 var matches = 0; 108 this.cntr.find('.ecs-posts').children("article").each(function () { 109 var post = $(this); 110 if (!post_list.is_filter_active) { 111 matches++; 112 post.show(); 113 } else if (post_list.is_filter_active) { 114 var match = false; 115 for (var filter_class of post_list.active_filter_classes) { 116 if (post.hasClass(filter_class.replace(".", ""))) { 117 match = true; 118 break; // post only has to match AT LEAST 1 active filter, not ALL 119 } 120 } 121 if (match) { 122 post.show(); 123 matches++; 124 } else { 125 post.hide(); 126 } 127 } else { 128 post.hide(); 129 } 130 }); 131 this.num_active_posts = matches; 132 console.log(matches + " events match the filters"); 133 } 134 } else { 135 this.num_active_posts = this.cntr.find('.ecs-posts').children("article").length; 136 console.log("found " + this.num_active_posts + " posts"); 137 } 138 this.post_render(); 139 }, 140 post_render: function () { 141 // override at child level 142 }, 143 }); 144 145 var horizontal_post_list = post_list.create({ 146 // a modified post_list object for posts with "horizontal-post-list" class -- a list of posts spanning infinitely horizontally that are scrollable 147 active_breakpoint: "desktop", 148 post_width: {}, 149 post_widths_set: false, 150 post_margin: {}, 151 post_margins_set: false, 152 // post_margin: 0, // override at child level: enter the number of pixels between posts; this makes sure the container width gets set correctly 153 filter_taxonomy_slug: null, // override at child level: only needed if post_list has filters -- it's a string that prepends the category/taxonomy classes added to each post (eg. "event_tags" is the prepend of the class "event_tags-online") 154 cntr_selector: ".horizontal-post-slider", // override at child level: a string selector of cntr element for posts 155 cntr: null, 156 full_width_cntr: null, 157 overflow_cntr: null, 158 no_results_el: null, // override at child level: jQuery element - the "No posts found" block/heading to show/hide 159 nav: { 160 left: null, // override at child level: jQuery element - the left navigation arrow 161 right: null, // override at child level: jQuery element - the right navigation arrow 162 arrow_col_shadow: false, // if true, the columns containing the arrow icons will cast a shadow onto the posts when the right slider position conditions are met 163 }, 164 set_post_widths: function () { 165 if (this.post_widths_set) return; 166 for (var bp of this.breakpoints) { 167 var breakpoint = bp.name; 168 var post_width_prop = "--post-width-" + breakpoint; 169 var post_width = get_css_var(this.cntr_selector, post_width_prop); 170 if (!post_width) continue; 171 console.log( 172 "post width for " + breakpoint + " breakpoint : " + post_width 173 ); 174 this.post_width[breakpoint] = parseFloat(post_width); // parseFloat converts px value to integer 175 } 176 this.post_widths_set = true; 177 }, 178 set_post_margins: function () { 179 if (this.post_margins_set) return; 180 for (var bp of this.breakpoints) { 181 var breakpoint = bp.name; 182 var post_margin_prop = "--space-between-" + breakpoint; 183 var post_margin = get_css_var(this.cntr_selector, post_margin_prop); 184 if (!post_margin) continue; 185 console.log( 186 "post margin for " + breakpoint + " breakpoint : " + post_margin 187 ); 188 this.post_margin[breakpoint] = parseFloat(post_margin); // parseFloat converts px value to integer 189 } 190 this.post_margins_set = true; 191 }, 192 get_post_width: function () { 193 this.set_post_widths(); 194 if (this.post_width == "fullwidth") return $(document).width(); 195 var breakpoint = this.get_breakpoint(); 196 this.active_breakpoint = breakpoint; 197 console.log( 198 "in get_post_width.. breakpoint: " + 199 breakpoint + 200 " .. " + 201 JSON.stringify(this.post_width[breakpoint]) 202 ); 203 var x = this.post_width[breakpoint]; 204 return x; 205 }, 206 get_post_margin: function () { 207 this.set_post_margins(); 208 var breakpoint = this.get_breakpoint(); 209 this.active_breakpoint = breakpoint; 210 if (!this.post_margin.hasOwnProperty(breakpoint)) return 50; 211 return this.post_margin[breakpoint]; 212 }, 213 adjust_cntr_width: function () { 214 var num_posts = this.num_active_posts; 215 if (num_posts) { 216 var margin = this.get_post_margin(); 217 var cntr_width = 218 (this.get_post_width() + margin) * num_posts; 219 this.full_width_cntr.css("width", cntr_width); 220 this.full_width_cntr.show(); 221 if (this.no_results_el) this.no_results_el.addClass("disabled"); 222 } else { 223 this.full_width_cntr.hide(); 224 if (this.no_results_el) this.no_results_el.removeClass("disabled"); // show "No posts found" message 225 } 226 }, 227 reset_scroll_pos: function () { 228 this.overflow_cntr.animate({ scrollLeft: 0 }, 500); 229 this.adjust_navigation(); 230 }, 231 move: function (right = true) { 232 var curr_pos = this.overflow_cntr.scrollLeft(); 233 if (right) this.scroll_pos = curr_pos + this.get_post_width(); 234 else this.scroll_pos = curr_pos - this.get_post_width(); 235 this.overflow_cntr.animate({ scrollLeft: this.scroll_pos }, 500); 236 this.adjust_navigation(); 237 }, 238 check_breakpoint_update: function () { 239 // gets called every time the window is resized 240 // if the window size has changed to be a different breakpoint, we have to re-adjust the post cntr width 241 var bp = this.get_breakpoint(); 242 if (bp != this.active_breakpoint) this.adjust_cntr_width(); 243 }, 244 adjust_navigation: function () { 245 var pos = this.overflow_cntr.scrollLeft(); 246 if ( 247 pos == 248 this.full_width_cntr.width() - this.overflow_cntr.width() - 20 249 ) { 250 this.nav.right.addClass("faint"); 251 if (this.nav.arrow_col_shadow) 252 this.nav.right 253 .closest(".scroll-posts-col-shadow-left") 254 .removeClass("active"); 255 } else { 256 this.nav.right.removeClass("faint"); 257 if (this.nav.arrow_col_shadow) 258 this.nav.right 259 .closest(".scroll-posts-col-shadow-left") 260 .addClass("active"); 261 } 262 263 if (pos == 0) { 264 this.nav.left.addClass("faint"); 265 if (this.nav.arrow_col_shadow) 266 this.nav.left 267 .closest(".scroll-posts-col-shadow-right") 268 .removeClass("active"); 269 } else { 270 this.nav.left.removeClass("faint"); 271 if (this.nav.arrow_col_shadow) 272 this.nav.left 273 .closest(".scroll-posts-col-shadow-right") 274 .addClass("active"); 275 } 276 }, 277 setup_jquery_binding: function () { 278 if (this.done_jquery_binding) return; 279 var post_list = this; 280 this.overflow_cntr.scroll(function () { 281 post_list.adjust_navigation(); 282 }); 283 this.nav.right.on("click", function () { 284 post_list.move(); 285 }); 286 this.nav.left.on("click", function () { 287 post_list.move(false); 288 }); 289 this.done_jquery_binding = true; 290 }, 291 setup_cntrs: function () { 292 if (!this.full_width_cntr) 293 this.full_width_cntr = this.cntr.find(".elementor-posts-container").first(); 294 if (!this.overflow_cntr) 295 this.overflow_cntr = this.cntr 296 .find(".elementor-widget-container") 297 .first(); 298 }, 299 post_render: function () { 300 this.setup_cntrs(); 301 this.adjust_cntr_width(); 302 this.reset_scroll_pos(); 303 this.setup_jquery_binding(); 304 }, 305 }); 306 307 var testimonials_horizontal = horizontal_post_list 308 .create({ 309 has_filters: false, 310 cntr_selector: ".horizontal-testimonials", 311 // no_results_el: $('#no-events-msg'), 312 nav: { 313 left: $(".navigate-testimonials-left"), 314 right: $(".navigate-testimonials-right"), 315 arrow_col_shadow: true, 316 }, 317 })
318 .init(); 319 320 var speakers_horizontal = horizontal_post_list 321 .create({ 322 has_filters: false, 323 cntr_selector: ".horizontal-speakers", 324 // no_results_el: $('#no-events-msg'), 325 nav: { 326 left: $(".navigate-speakers-left"), 327 right: $(".navigate-speakers-right"), 328 arrow_col_shadow: true, 329 }, 330 }) 331 .init(); 332 333 var exhibitors_horizontal = horizontal_post_list 334 .create({ 335 has_filters: false, 336 cntr_selector: ".horizontal-exhibitors", 337 // no_results_el: $('#no-events-msg'), 338 nav: { 339 left: $(".navigate-exhibitors-left"), 340 right: $(".navigate-exhibitors-right"), 341 arrow_col_shadow: true, 342 }, 343 }) 344 .init(); 345 346 function get_css_var(selector, custom_property_name) { 347 // given string selector and a CSS custom property name, we'll return the value of that CSS custom property within the scope of the DOM element 348 var element = document.querySelector(selector); 349 if (!element) return false; // Exit if element doesn't exist 350 351 var value = 352 getComputedStyle(element).getPropertyValue(custom_property_name); 353 if (!value) return false; // Exit if variable is not defined 354 return value; 355 } 356 357 // ###################################### 358 // When window gets resized, make sure things don't break: 359 360 $(window).resize(function () { 361 // var new_width = $( document ).width() + 17; 362 363 var post_lists_to_adjust = [speakers_horizontal, testimonials_horizontal]; 364 for (var list of post_lists_to_adjust) { 365 if (list.initiated) { 366 list.check_breakpoint_update(); 367 } 368 } 369 }); 370 371 // ###################################### 372 // Post loop popups: 373 374 $(".open-post-loop-popup").on("click", function () { 375 var el = $(this); 376 var cntr; 377 if(el.hasClass('session')) { 378 cntr = el; 379 cntr.parent().find(".popup").addClass("active"); 380 return; 381 } else { 382 cntr = el.closest("article"); 383 } 384 if(!cntr) return; 385 cntr.find(".popup").addClass("active"); 386 }); 387 388 $(".close-popup").on("click", function () { 389 $(this).closest(".popup").removeClass("active"); 390 }); 391 392 $(".popup").on("click", function(event){ 393 if (event.target === this) { 394 $(this).removeClass("active"); 395 } 396 }) 397 398 // ###################################### 399 // Insert hyperlinks into Piotnet repeater section buttons: 400 $(".repeater-button").each(function () { 401 var btn = $(this); 402 var url = btn.siblings(".repeater-button-url"); 403 if (!url.length) return; 404 console.log("inserting url into repeater button"); 405 btn.html( 406 '<a target="_blank" href="' + url.text() + '">' + btn.text() + "</a>" 407 ); 408 }); 409 410 // ###################################### 411 // Event Pass filters -- on click show relevant Member Rates blocks: 412 413 $(".event-passes article .filter-member-rates").on("click", function () { 414 var btn = $(this); 415 var pass = btn.closest("article"); 416 var post_id = pass.attr("id"); 417 console.log("Selected pass, id: " + post_id); 418 419 var selecting = true; 420 if (pass.hasClass("active")) selecting = false; // we are deselecting 421 422 var member_rates = btn 423 .closest(".event-passes-section") 424 .find(".event-pass-member-rates"); 425 426 if (selecting) { 427 pass.addClass("active"); 428 btn.find(".elementor-button-text").text("Deselect"); 429 var prev_selected = pass.siblings("article.active"); 430 if (prev_selected.length) { 431 prev_selected.removeClass("active"); 432 prev_selected 433 .find(".filter-member-rates .elementor-button-text") 434 .text("Select"); 435 } 436 $("html, body").animate( 437 { 438 scrollTop: member_rates.offset().top - 120, 439 }, 440 1000 441 ); 442 member_rates.find("article.active").removeClass("active"); 443 member_rates.find("article." + post_id).addClass("active"); 444 } else { 445 pass.removeClass("active"); 446 btn.find(".elementor-button-text").text("Select"); 447 member_rates.find("article.active").removeClass("active"); 448 } 449 }); 450 451 $(".group-rate-enabled").each(function () { 452 var el = $(this); 453 var val = el.find(".pafe-acf-repeater-sub-field").text(); 454 if (val == 0) el.closest(".group-rate-cntr").addClass("disabled"); 455 }); 456 457 // ###################################### 458 // On /sponsors/ page, hide any sponsor level blocks if no sponsors exist 459 $(".sponsor-level-heading").each(function () { 460 var h = $(this); 461 var posts = h.next(".elementor-widget-posts"); 462 if (posts.find("article").length) return; 463 posts.addClass("disabled"); 464 h.addClass("disabled"); 465 }); 466 467 468 // ###################################### 469 // Agenda page JS: 470 471 // Handle right scroll 472 // $('.scroll-sessions').on('click', function() { 473 // const el = $(this); 474 // const go_right = el.hasClass('right-arrow'); 475 // const time_window = el.closest('.time-window'); 476 // const scroll_left = time_window.find('.left-arrow'); 477 // const scroll_right = time_window.find('.right-arrow'); 478 // const session_container = time_window.find('.session-container'); 479 480 // const total_width = session_container.width(); 481 // const num_sessions = session_container.find('.session').length; 482 // const scroll_width = total_width / num_sessions; 483 484 // const curr_scroll_pos = session_container.scrollLeft(); 485 // const animation = go_right ? (curr_scroll_pos + scroll_width) : (curr_scroll_pos - scroll_width); 486 487 // session_container.animate({ 488 // scrollLeft: animation 489 // }, complete = function() { 490 // let new_scroll_pos = session_container.scrollLeft(); 491 // let is_fully_scrolled_right = new_scroll_pos > ((num_sessions - 3) * scroll_width) - 10; 492 // let is_fully_scrolled_left = new_scroll_pos === 0; 493 494 // if (is_fully_scrolled_right) scroll_right.animate({ opacity: 0 }) 495 // else scroll_right.animate({ opacity: 100 }) 496 497 // if (is_fully_scrolled_left) scroll_left.animate({ opacity: 0 }) 498 // else scroll_left.animate({ opacity: 100 }) 499 // }); 500 501 // }); 502 503 // Handle filtering by day 504 $('.agenda-day-button').on('click', function() { 505 if (this.id !== "full-agenda-button") { 506 const buttonId = `#${this.id}`; 507 const scheduleId = buttonId.replace( 508 "agenda-button", "day-schedule"); 509 $(".agenda-day-button").removeClass('selected'); 510 $(buttonId).addClass('selected'); 511 $(scheduleId).show(); 512 $(".day-schedule").not(scheduleId).hide(); 513 } else { 514 $(".agenda-day-button").removeClass('selected'); 515 $("#full-agenda-button").addClass('selected'); 516 $(".day-schedule").show(); 517 } 518 }) 519 520 // Handle filtering by track 521 const tracks = $('[id^="track-"]'); 522 $('.tracks-item').on("click", function() { 523 const currentTrack = this.id; 524 const currentTrackClass = `.${this.id}`; 525 const trackId = `#${this.id}`; 526 $('.tracks-item').css("filter", ""); 527 $(".session-track").parent().parent().hide(); 528 $('.session-container').parent().show(); 529 if (currentTrack === "all-tracks") { 530 $(".session-track").parent().parent().show(); 531 } 532 for (track of tracks) { 533 if (track.id === currentTrack) { 534 $(currentTrackClass).parent().parent() 535 .show(); 536 } 537 } 538 for (const sessionContainer of $( 539 '.session-container')) { 540 let sessionCount = 0; 541 for (const session of $(sessionContainer) 542 .children()) { 543 if ($(session).css("display") !== 544 "none") { 545 sessionCount++; 546 } 547 } 548 if (sessionCount === 0 && currentTrack !== 549 "all-tracks") { 550 $(sessionContainer).parent().hide(); 551 } 552 if (sessionCount <= 3) { 553 $(sessionContainer).parent().find( 554 '.right-arrow').hide(); 555 $(sessionContainer).parent().find( 556 '.left-arrow').css("opacity", 557 "0") 558 } else { 559 $(sessionContainer).parent().find( 560 '.right-arrow').show(); 561 $(sessionContainer).parent().find( 562 '.left-arrow').show(); 563 if (!$(sessionContainer).scrollLeft() === 564 0) { 565 $(sessionContainer).parent().find( 566 '.left-arrow').css( 567 "opacity", "0") 568 } 569 } 570 } 571 }) 572 573 574 // ##### Register tracking analytics for LinkedIn ##### 575 576 // for STORE only: 577 578});
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.