1/** 2 * Main JavaScript 3 */ 4 5// DOM is fully loaded 6jQuery(document).ready(function ($) { 7 8 /****************************************** 9 * LAYOUT 10 ******************************************/ 11 12 /*************** TOP BAR ******************/ 13 14 // Search Open 15 $('#exodus-top-bar-search-icon').on('click', function (e) { 16 17 // Open 18 if (!$('#exodus-top-bar-search-form').is(':visible')) { 19 20 // Stop regular click action 21 e.preventDefault(); 22 23 // Hide menu to make room for search 24 $('#exodus-top-bar-menu').hide(); 25 26 // Show search form 27 $('#exodus-top-bar-search-form').show(); 28 29 // Focus on search input 30 $('#exodus-top-bar-search-form input').focus(); 31 32 // Change searh icon into close icon 33 $(this).removeClass().addClass('el-icon-remove'); 34 35 } 36 37 // Close 38 else { 39 40 // Hide search form 41 $('#exodus-top-bar-search-form').hide(); 42 43 // Show menu 44 $('#exodus-top-bar-menu').show(); 45 46 // Change close icon into search icon 47 $(this).removeClass().addClass('el-icon-search'); 48 49 } 50 51 }); 52 53 /***************** LOGO *******************/ 54 55 // Retina Logo 56 // Set dimensions from normal image on retina logo element for proper sizing 57 // CSS handles switching between two images with media queries 58 // This method works best for Opera Mobile 59 if ($('#exodus-logo-hidpi').length) { // Retina version provided 60 $('<img>').attr('src', $('#exodus-logo-regular').attr('src')).on('load', function () { 61 $('#exodus-logo-hidpi').attr('width', this.width).attr('height', this.height); 62 }); 63 } 64 65 /************* HEADER MENU ****************/ 66 67 exodus_activate_menu(); 68 69 /************* HEADER ICONS ***************/ 70 71 var icons_inverval; 72 73 // Hide menu icons if they will cause a second line after resize 74 icons_inverval = setInterval(function () { // first page load (wait a moment for fonts to load) 75 exodus_show_hide_menu_icons(); // in case menu changed size because of font 76 }, 200); // keep trying to hide icons (font must be rendered for it to work) 77 78 // Stop trying to hide icons after a few seconds 79 setTimeout(function () { 80 clearInterval(icons_inverval); 81 }, 3000); 82 83 // Check after resize 84 $(window).on('resize', function () { 85 exodus_show_hide_menu_icons(); 86 }); 87 88 /*********** RESPONSIVE TOGGLE ************/ 89 90 // These things are done client-side so that it works with caching plugins 91 // See more immediately executed code in <head> (better speed with caching and mobile) 92 93 // "View Full Site" / "View Mobile Site" footer link clicked 94 $('#exodus-footer-responsive-toggle a').on('click', function (e) { 95 96 e.preventDefault(); 97 98 // Switch to full site 99 if (!$.cookie('exodus_responsive_off')) { 100 $.cookie('exodus_responsive_off', 1, { 101 path: exodus_main.site_path, // work on any page 102 secure: exodus_main.is_ssl 103 }); 104 } 105 106 // Switch to mobile site 107 else { 108 $.removeCookie('exodus_responsive_off', { 109 path: exodus_main.site_path, // work on any page 110 secure: exodus_main.is_ssl 111 }); 112 } 113 114 // Reload the current page without re-posting 115 window.location = window.location.href; 116 117 }); 118 119 /****************************************** 120 * SEARCH FORM 121 ******************************************/ 122 123 // Submit on link button click 124 $('.exodus-search-button').on('click', function (event) { 125 event.preventDefault(); 126 $(this).parent('form').trigger('submit'); 127 }); 128 129 // Trim search query and stop of empty 130 $('.exodus-search-form form').on('submit', function (event) { 131 132 var s; 133 134 s = $('input[name=s]', this).val().trim(); 135 136 if (s.length) { // submit trimmed value 137 $('input[name=s]', this).val(s); 138 } else { // empty, stop 139 event.preventDefault(); 140 } 141 142 }); 143 144 /****************************************** 145 * HOMEPAGE 146 ******************************************/ 147 148 // Homepage Slider 149 if ($('.flexslider').length) { 150 151 var enable_slideshow, single_slide; 152 153 // Enable or disable automatic slideshow based on theme options 154 enable_slideshow = exodus_main.slider_slideshow; 155 156 // Show first slide immediately for faster loading on mobile 157 setTimeout(function () { 158 $('.flexslider .slides > li:first-child').show(); 159 exodus_resize_slider_content(); // helps with issue on Safari/FF w/ title/desc not showing on first load after reload 160 }, 500); // after slight delay while image resizes, to avoid flicker 161 162 // If only one slide, add a second slide; otherwise slider will not initialize and video will not work properly (control
162s will be hidden after initialization) 163 single_slide = false; 164 if ($('.flexslider ul li').length == 1) { 165 single_slide = true; 166 enable_slideshow = false; // disable because only one slide (don't show hidden slide) 167 $('.flexslider ul').append('<li></li>'); 168 } 169 170 // Initialize slider 171 $('#exodus-slider .flexslider').flexslider({ 172 animation: 'fade', // 'slide' always has one issue or another 173 animationDuration: 250, 174 slideshow: enable_slideshow, // Boolean: Animate slider slideshow 175 slideshowSpeed: exodus_main.slider_speed, // Integer: Set the speed of the slideshow cycling, in milliseconds 176 directionNav: false, // Boolean: Create navigation for previous/next navigation? ( true/false ) 177 controlsContainer: '#exodus-slider-container', // Add controls here 178 start: function (slider) { // when first slide loads 179 180 var fade_speed, opacity; 181 182 // Hide controls if only one slide (see "if only only slide" above ) 183 if (single_slide) { 184 $('.flex-control-nav').hide(); 185 } 186 187 // Play video slide on click 188 $('.exodus-slide-video').on('click', function (event) { 189 190 var slide_element, slide_id, video_url, video_html, match, vimeo_id, youtube_id; 191 192 event.preventDefault(); 193 194 // Get data 195 slide_element = $(this); 196 slide_id = slide_element.attr('id'); 197 video_url = $('a', slide_element).attr('href'); 198 video_html = ''; 199 200 // Vimeo 201 if (video_url.indexOf('vimeo') > -1) { 202 203 // Extract video ID from Vimeo URL and build HTML for player 204 match = video_url.match(/\d+/); 205 if (match && match[0].length) { 206 vimeo_id = match[0]; 207 video_html = '<iframe src="' + '//player.vimeo.com/video/' + vimeo_id + '?title=0&byline=0&portrait=0&color=ffffff&autoplay=1" width="1170" height="500" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'; 208 } 209 210 } 211 212 // YouTube 213 else if (video_url.indexOf('youtu') > -1) { // match youtube.com or youtu.be 214 215 // Get video ID from YouTube URL and build HTML for player 216 // Helpful regex information here: http://bit.ly/13H4NKw 217 match = video_url.match(/.*(?:youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=)([^#\&\?]*).*/); 218 if (match && match[1].length == 11) { 219 youtube_id = match[1]; 220 video_html = '<iframe src="' + '//www.youtube.com/embed/' + youtube_id + '?wmode=transparent&autoplay=1&rel=0&showinfo=0&color=white&modestbranding=1" width="1170" height="500" frameborder="0" allowfullscreen></iframe>'; 221 } 222 223 } 224 225 // Show the video 226 if (video_html) { 227 228 // Pause slideshow 229 slider.pause(); 230 231 // Hide slide image (contains overlay) 232 $('.exodus-slide-image-container', slide_element).hide(); 233 234 // Hide title/description. 235 $('.exodus-slide-title, .exodus-slide-description', slide_element).hide(); 236 237 // Destroy previous video frame if still there 238 $('.exodus-slide-video-wrapper').remove(); 239 240 // Add wrapper to video iframe so it can be centered 241 video_html = '<div class="exodus-slide-video-wrapper exodus-centered-content">' + video_html + '</div>'; 242 243 // Inject the video iframe 244 $(slide_element).append(video_html); 245 246 // Responsive sizing for video 247 exodus_resize_slider_content(); 248 setTimeout(function () { 249 exodus_resize_slider_content(); // ensure YouTube control rendering 250 }, 2000); 251 252 } 253 254 }); 255 256 // Click on caption container goes to URL if this is not video slide 257 // Otherwide clicks to right and left of title/description do nothing 258 $('.exodus-slide-not-video.exodus-slide-linked .exodus-slide-caption').on('click', function (event) { 259 260 var click_url; 261 262 event.preventDefault(); 263 264 // Get Click URL 265 click_url = $('a', $(this).parents('li')).attr('href'); 266 267 // Go to URL 268 if (click_url) { 269 if ($(this).parents('.exodus-slide-click-new').length > 0) { 270 window.open(click_url, '_blank'); 271 } else { 272 window.location.href = click_url; 273 } 274 } 275 276 }); 277 278 // Resize slide contents title/description and video for responsive 279 $(window).on('load resize', function () { 280 exodus_resize_slider_content(); 281 }); 282 283 }, 284 before: function () { // before slide changes 285 286 // Destroy all video iframes 287 $('.exodus-slide-video-wrapper').remove(); 288 289 // Show image again (hidden when video played) 290 $('.exodus-slide-image-container').show(); 291 292 // Show title/description again (hidden when video played). 293 $('.exodus-slide-title, .exodus-slide-description').show(); 294 295 // Resize responsive 296 exodus_resize_slider_content(); 297 298 }, 299 after: function () { 300 301 // Resize responsive 302 exodus_resize_slider_content(); 303 304 } 305 306 }); 307 308 } 309
310 /****************************************** 311 * SINGLE EVENT 312 ******************************************/ 313 314 // Single event only 315 if ($('.exodus-event-full').length) { 316 317 // Recurrence tooltip 318 $('.exodus-event-meta-recurrence a, .exodus-event-meta-excluded-dates a').tooltipster({ 319 theme: 'exodus-tooltipster', 320 arrow: false, 321 animation: 'fade', 322 speed: 250, // fade speed 323 }).on('click', function (e) { 324 e.preventDefault(); // stop clicks 325 }); 326 327 } 328 329 /****************************************** 330 * EVENT CALENDAR 331 ******************************************/ 332 333 // Calendar template only 334 if ($('#exodus-calendar').length) { 335 336 // Attach dropdowns to controls 337 exodus_attach_calendar_dropdowns(); 338 339 // AJAX-load event calendar when use controls 340 // This keeps page from reloading and scrolling to top 341 // PJAX updates URL, <title> and browser/back history 342 $(document).pjax('.exodus-calendar-control, .exodus-calendar-dropdown a', '#exodus-calendar', { 343 fragment: '#exodus-calendar', // replace only the calendar 344 scrollTo: false, // don't scroll to top after loading 345 timeout: 5000, // page reloads after timeout (default 650) 346 }); 347 348 // Loading indicator 349 $(document).on('pjax:send', function () { 350 $('.exodus-calendar-dropdown-control').dropdown('hide'); // hide controls 351 $('#exodus-calendar-loading').fadeIn(250); 352 }) 353 $(document).on('pjax:complete', function () { 354 $('#exodus-calendar-loading').fadeOut(50); // show more suddenly 355 }) 356 357 // After contents replaced 358 $(document).on('pjax:success', function () { 359 360 // Re-attach dropdowns to controls 361 exodus_attach_calendar_dropdowns(); 362 363 // Re-activate tooltip hovering 364 exodus_activate_calendar_hover(); 365 366 }); 367 368 // Hide dropdowns on back/forward 369 $(document).on('pjax:popstate', function (e) { 370 if (e.direction) { 371 $('.exodus-calendar-dropdown-control').dropdown('hide'); 372 } 373 }); 374 375 // Use Tipster to show event hover for each link 376 exodus_activate_calendar_hover(); 377 378 // Handle mobile clicks on linked days 379 $(document).on('click', 'a.exodus-calendar-table-day-number', function (e) { 380 381 var $day, $events, date_formatted, scroll_offset; 382 383 e.preventDefault(); 384 385 // Get day cell 386 $day = $(this).parents('td'); 387 388 // Show heading for date 389 date_formatted = $day.attr('data-date-formatted'); 390 $('#exodus-calendar-list h3:first-of-type').remove(); 391 $('#exodus-calendar-list').prepend('<h3 id="exodus-calendar-list-heading">' + date_formatted + '</h3>'); 392 $('#exodus-calendar-list-heading').fadeIn(250); 393 394 // Hide all events in list and show list container 395 $('#exodus-calendar-list .exodus-calendar-list-entry').hide(); 396 $('#exodus-calendar-list').show(); 397 398 // Show all events for this day 399 $events = $('.exodus-calendar-table-day-events li', $day); 400 $events.each(function () { 401 402 var event_id; 403 404 // Get event ID 405 event_id = $(this).attr('data-event-id'); 406 407 // Show that event in list 408 $('#exodus-calendar-list .exodus-calendar-list-entry[data-event-id="' + event_id + '"]').fadeIn(250); 409 410 }); 411 412 // Scroll down if events are out of view 413 // Otherwise user sees no change 414 if (!$('#exodus-calendar-list-heading').visible()) { 415 416 // Scroll events into bottom of screen 417 scroll_offset = 0 - $(window).height() + 150; // negative 418 419 $.smoothScroll({ 420 scrollTarget: '#exodus-calendar-list-heading', 421 offset: scroll_offset, 422 easing: 'swing', 423 speed: 800 424 }); 425 426 } 427 428 }); 429 430 } 431 432 /****************************************** 433 * GALLERIES 434 ******************************************/ 435 436 // Make clicks on caption also go to URL 437 $('.gallery-caption').on('click', function () { 438 439 var $parent, url; 440 441 $parent = $(this).parent(); 442 url = $('a', $parent).prop('href'); 443 444 // Go to URL if no data- attributes, which indicate Jetpack Carousel or possbily other lightbox 445 if (url && $.isEmptyObject($('.gallery-icon img', $parent).data())) { 446 window.location = url; 447 } 448 449 }); 450 451 /*--------------------------------------------- 452 * Buttons 453 *--------------------------------------------*/ 454 455 // Use theme styles for Gutenberg buttons. 456 $('.wp-block-button').each(function () { 457 458 var align_class = ''; 459 if ($(this).hasClass('alignleft')) { 460 align_class = 'alignleft'; 461 } else if ($(this).hasClass('alignright')) { 462 align_class = 'alignright'; 463 } else if ($(this).hasClass('aligncenter')) { 464 align_class = 'aligncenter'; 465 } 466 467 // Get button link. 468 if ($('a', this).length) { 469 var $button_link = $('a', this); 470 } else if ($('button', this).length) { 471 var $button_link = $('button', this); 472 } 473 474 // Remove class and style from button. 475 $button_link 476 .removeClass() 477 .removeAttr('style', '') // color. 478 .addClass('exodus-button') 479 .addClass('exodus-button-block') 480 .addClass(align_class); 481 482 // Move button outside of container then remove container. 483 $(this) 484 .after($button_link) 485 .remove(); 486 487 // Show button (hidden in style.css). 488 $button_link.css('visibility', 'visible') 489 490 }); 491 492 /****************************************** 493 * COMMENTS 494 ******************************************/ 495
496 // Scroll to comments when comments link at top of single page/post clicked 497 if ($('a.exodus-scroll-to-comments').length) { 498 $('a.exodus-scroll-to-comments').smoothScroll({ 499 offset: -60, 500 easing: 'swing', 501 speed: 1200 502 }); 503 } 504 505 // Scroll to comments when link from another page is clicked 506 if ('#comments' == window.location.hash || '#respond' == window.location.hash) { 507 508 // Scroll down 509 $.smoothScroll({ 510 scrollTarget: '#comments', 511 easing: 'swing', 512 speed: 1200 513 }); 514 515 } 516 517 // Comment Validation using jQuery Validation Plugin by Jörn Zaefferer 518 // http://bassistance.de/jquery-plugins/jquery-plugin-validation/ 519 if (jQuery().validate) { // if plugin loaded 520 521 var $validate_params, $validate_comment_field; 522 523 // Parameters 524 $validate_params = { 525 rules: { 526 author: { 527 required: exodus_main.comment_name_required !== '' ? true : false // if WP configured to require 528 }, 529 email: { 530 required: exodus_main.comment_email_required !== '' ? true : false, // if WP configured to require 531 email: true // check validity 532 }, 533 url: 'url' // optional but check validity 534 }, 535 messages: { // localized error strings 536 author: exodus_main.comment_name_error_required, 537 email: { 538 required: exodus_main.comment_email_error_required, 539 email: exodus_main.comment_email_error_invalid 540 }, 541 url: exodus_main.comment_url_error_invalid 542 } 543 }; 544 545 // Comment textarea 546 // Use ID instead of name to work with Antispam Bee plugin which duplicates/hides original textarea 547 $validate_comment_field = $('#comment').attr('name'); 548 $validate_params['rules'][$validate_comment_field] = 'required'; 549 $validate_params['messages'][$validate_comment_field] = exodus_main.comment_message_error_required; 550 551 // Validate the form 552 $('#commentform').validate($validate_params); 553 554 } 555 556 /****************************************** 557 * WIDGETS 558 ******************************************/ 559 560 // Categories dropdown redirect 561 $('.exodus-dropdown-taxonomy-redirect').on('change', function () { 562 563 var taxonomy, term_id; 564 565 taxonomy = $(this).prev('input[name=taxonomy]').val(); 566 term_id = $('option:selected', this).val(); 567 568 if (taxonomy && term_id && -1 != term_id) { 569 location.href = exodus_main.home_url + '/?redirect_taxonomy=' + taxonomy + '&redirect_term_id=' + term_id; 570 } 571 572 }); 573 574 /****************************************** 575 * LIST ITEM COUNTS 576 ******************************************/ 577 578 // Modify list item counts 579 // This includes widgets and sermon topics, etc. indexes using wp_list_categories() 580 // Change (#) into <span class="exodus-list-item-count">#</span> so it can be styled 581 var $list_items = $('.exodus-list li, .exodus-sermon-index-list li, .widget_categories li, .widget_ctfw-categories li, .widget_ctfw-archives li, .widget_ctfw-galleries li, .widget_recent_comments li, .widget_archive li, .widget_pages li, .widget_links li, .widget_nav_menu li, .widget_meta li'); 582 for (var i = 0; i < $list_items.length; i++) { 583 584 $list_items.each(function () { 585 586 var modified_count; 587 588 // Manipulate it 589 modified_count = $(this).html().replace(/(<\/a>.*)\(([0-9]+)\)/, '$1 <span class="exodus-list-item-count">$2</span>'); 590 591 // Replace it 592 $(this).html(modified_count); 593 594 }); 595 596 } 597 $list_items.parent('ul').css('visibility', 'visible'); 598 599 /****************************************** 600 * CSS CLASSES 601 ******************************************/ 602 603 /************** BODY CLASSES **************/ 604 605 // <body> classes for client detection (mobile, browser, etc.) should be done here with JS 606 // instead of in body.php so that they work when caching plugins are used. 607 608 // Mobile Detection 609 // Useful for :hover issue with slider video play icon (some browsers handle it better than others) 610 // The regex below is based on wp_is_mobile() -- good enough for most 611 // "Mobile" will handle iOS devices and many others 612 if (navigator.userAgent.match(/Mobile|Android|Silk\/|Kindle|BlackBerry|Opera Mini|Opera Mobi/)) { 613 $('body').addClass('exodus-is-mobile'); 614 } else { 615 $('body').addClass('exodus-not-mobile'); 616 } 617 618 // iOS Detection 619 // Especially useful for re-styling form submit buttons, which iOS takes too much liberty with 620 if (navigator.userAgent.match(/iPad|iPod|iPhone|iWatch/)) { 621 $('body').addClass('exodus-is-ios'); 622 } else { 623 $('body').addClass('exodus-not-ios'); 624 } 625 626 // No Rounded Corners in IE11 627 // Because there is a border radius bug that makes extra lines in dropdowns, caption images, gallery captions
628 // http://stackoverflow.com/questions/20051783/ie-11-border-radius-weirdness-did-not-occur-in-ie-9-and-ie-10 629 // Remove this when Microsoft fixes the issue 630 if ($('body').hasClass('exodus-rounded') && navigator.userAgent.match(/Trident.*rv[ :]*11\./)) { // IE11 and Rounded Corners on 631 $('body') 632 .removeClass('exodus-rounded') 633 .addClass('exodus-not-rounded'); 634 } 635 636}); 637 638/****************************************** 639 * FUNCTIONS 640 ******************************************/ 641 642/************ MENU ACTIVATION *************/ 643 644var $exodus_header_menu_raw; // make accessible to exodus_activate_menu() later 645 646// Activate Menu Function 647// Also used in Customizer admin preview JS 648function exodus_activate_menu() { 649 650 var $header_menu_raw_list, $header_menu_raw_items; 651 652 // Continue if menu not empty 653 if (!jQuery('#exodus-header-menu-content').children().length) { 654 return; 655 } 656 657 // Make copy of menu contents before Superfish modified 658 // Original markup works better with MeanMenu (less Supersubs and styling issues) 659 if (!jQuery($exodus_header_menu_raw).length) { // not done already 660 $exodus_header_menu_raw = jQuery('<div></div>'); // Create empty div 661 $header_menu_raw_list = jQuery('<ul></ul>'); // Create empty list 662 $header_menu_raw_items = jQuery('#exodus-header-menu-content').html(); // Get menu items 663 $header_menu_raw_list = $header_menu_raw_list.html($header_menu_raw_items); // Copy items to empty list 664 $exodus_header_menu_raw = $exodus_header_menu_raw.html($header_menu_raw_list); // Copy list to div 665 } 666 667 // Regular Menu (Superfish) 668 jQuery('#exodus-header-menu-content').supersubs({ // Superfish dropdowns 669 minWidth: 13, // minimum width of sub-menus in em units 670 maxWidth: 13, // maximum width of sub-menus in em units 671 extraWidth: 1 // extra width can ensure lines don't sometimes turn over due to slight rounding differences and font-family 672 }).superfish({ 673 delay: 250, 674 disableHI: false, 675 animation: { 676 opacity: 'show', 677 //height:'show' 678 }, 679 speed: 150, // animation 680 onInit: function () { 681 682 // Responsive Menu (MeanMenu) for small screens 683 // Replaces regular menu with responsive controls 684 // Init after Superfish done because Supersubs needs menu visible for calculations 685 jQuery($exodus_header_menu_raw).meanmenu({ 686 meanMenuContainer: '#exodus-header-menu', 687 meanScreenWidth: 640, // use responsive.css to hide #exodus-header-menu-content at same size 688 meanRevealPosition: 'center', 689 meanRemoveAttrs: true, // remove any Superfish classes, duplicate item ID's, etc. 690 removeElements: '#exodus-header-menu-inner' // toggle visibility of regular 691 }); 692 693 }, 694 onBeforeShow: function () { 695 696 // Make dropdowns on right open to the left if will go off screen 697 // This considers that the links may have wrapped and dropdowns may be mobile-size 698 699 var $link, $dropdown, $dropdown_width, $offset; 700 701 // Detect if is first-level dropdown and if not return 702 if (jQuery(this, '#exodus-header-menu-content').parents('li.menu-item').length != 1) { 703 return; 704 } 705 706 // Top-level link hovered on 707 $link = jQuery(this).parents('#exodus-header-menu-content > li.menu-item'); 708 709 // First-level dropdown 710 $dropdown = jQuery('> ul', $link); 711 712 // First-level dropdown width 713 $dropdown_width = $dropdown.outerWidth(); 714 $dropdown_width_adjusted = $dropdown_width - 15; // compensate for left alignment 715 716 // Remove classes first in case don't need anymore 717 $link.removeClass('exodus-dropdown-align-right exodus-dropdown-open-left'); 718 719 // Get offset between left side of link and right side of window 720 $offset = jQuery(window).width() - $link.offset().left; 721 722 // Is it within one dropdown length of window's right edge? 723 // Add .exodus-dropdown-align-right to make first-level dropdown not go off screen 724 if ($offset < $dropdown_width_adjusted) { 725 $link.addClass('exodus-dropdown-align-right'); 726 } 727 728 // Is it within two dropdown lengths of window's right edge? 729 // Add .exodus-dropdown-open-left to open second-level dropdowns left: https://github.com/joeldbirch/superfish/issues/98 730 if ($offset < ($dropdown_width_adjusted * 2)) { 731 $link.addClass('exodus-dropdown-open-left'); 732 } 733 734 }, 735 }); 736 737} 738 739/************** HEADER ICONS **************/ 740 741// Hide menu bar's social icons if they will show on second line 742function exodus_show_hide_menu_icons() { 743 744 var header_menu_icons_visible, header_menu_inner_width, header_menu_links_icons_width; 745 746 // Gather data 747 header_menu_icons_visible = jQuery('#exodus-header-menu .exodus-l
747ist-icons').is(':visible'); 748 header_menu_inner_width = jQuery('#exodus-header-menu-inner').width(); 749 header_menu_links_icons_width = jQuery('#exodus-header-menu-content').width() + jQuery('#exodus-header-menu .exodus-list-icons').width() + 30; /* pad for wider trigger zone */ 750 751 // If menu link and menu icon containers have same total width as their container, hide icons so they don't appear on second line 752 if (header_menu_links_icons_width >= header_menu_inner_width) { 753 if (header_menu_icons_visible) { 754 jQuery('#exodus-header-menu .exodus-list-icons').hide(); 755 } 756 } 757 758 // Show icons if there is room again 759 else if (!header_menu_icons_visible) { 760 jQuery('#exodus-header-menu .exodus-list-icons').show(); 761 } 762 763} 764 765/************ HOMEPAGE SLIDER *************/ 766 767// Resize slide contents title/description and video for responsive 768// See .exodus-centered-content { width: 90%; } in responsive.css 769// Cannot do with CSS alone for slider because % of slider is 1700 overflow hidden, not actual window width 770// Done on load, resize and on video play 771function exodus_resize_slider_content() { 772 773 var browser_width, centered_decimal, content_width; 774 775 // Get browser width 776 browser_width = jQuery(window).width(); 777 778 // Get percentage being used for centered content at this screen size 779 centered_decimal = parseFloat(jQuery('.exodus-centered-content').css('width')) / parseFloat(jQuery('.exodus-centered-content').parent().css('width')); 780 781 // Calculate width for centered slider title/description 782 content_width = browser_width * centered_decimal; 783 784 // Modify width of title/desc 785 jQuery('#exodus-slider .exodus-centered-content').width(content_width); 786 787 // Then show it if not already shown -- hidden on first load so user doesn't see snap info place 788 jQuery('.exodus-slide-caption').fadeIn(250); 789 790 // Modify width of video 791 if (browser_width <= 1280) { 792 jQuery('.exodus-slide-video-wrapper').width(browser_width); // 100% for videos 793 } else { 794 jQuery('.exodus-slide-video-wrapper').width(browser_width).width(content_width); // helps YouTube controls render 795 } 796 797} 798 799/***************** FONTS ******************/ 800 801// Change <body> helper font/setting class 802// Used by Theme Customizer (and front-end demo customizer) 803function exodus_update_body_font_class(setting, font) { 804 805 var setting_slug, font_slug, body_class; 806 807 // Prepare strings 808 setting_slug = setting.replace(/_/g, '-'); 809 font_slug = font.toLowerCase().replace(/\s/g, '-'); // spaces to - 810 body_class = 'exodus-' + setting_slug + '-' + font_slug; 811 812 // Remove old class 813 jQuery('body').removeClass(function (i, css_class) { // helpful information: http://bit.ly/1f7KH3f 814 return (css_class.match(new RegExp('\\b\\S+-' + setting_slug + '-\\S+', 'g')) || []).join(' '); 815 }) 816 817 // Add new class 818 jQuery('body').addClass(body_class); 819 820} 821 822/************* EVENT CALENDAR *************/ 823 824// Attach calendar dropdowns to controls 825// Used on load and after PJAX replaces content 826function exodus_attach_calendar_dropdowns() { 827 828 // Remove it from before </body> if already exists (old before PJAX) 829 jQuery('body > #exodus-calendar-month-dropdown').remove(); 830 jQuery('body > #exodus-calendar-category-dropdown').remove(); 831 832 // Move it from calendar container to before </body> 833 // jQuery Dropdown work sbest with it there 834 // But need it in main calendar container for PJAX to get new contents of dropdowns 835 jQuery('#exodus-calendar-month-dropdown').appendTo('body'); 836 jQuery('#exodus-calendar-category-dropdown').appendTo('body'); 837 838 // Re-attach dropdown to control 839 jQuery('#exodus-calendar-month-control').dropdown('attach', '#exodus-calendar-month-dropdown'); 840 jQuery('#exodus-calendar-category-control').dropdown('attach', '#exodus-calendar-category-dropdown'); 841 842} 843 844// Use Tipster to show calendar's event hover for each link 845function exodus_activate_calendar_hover() { 846 847 // Use Tipster to show event hover for each link 848 jQuery('.exodus-calendar-list-entry').each(function () { 849 850 var event_id; 851 852 // Get ID 853 event_id = jQuery(this).attr('data-event-id'); 854 855 // Activate tooltips on links having that ID 856 if (event_id) { 857 jQuery('.exodus-calendar-table-day-events a[data-event-id="' + event_id + '"]').tooltipster({ 858 theme: 'exodus-tooltipster-calendar', 859 content: jQuery(this), 860 contentCloning: true, 861 functionInit: function (origin, content) { 862 863 var date_formatted; 864 865 // Get localized date from calendar 866 date_formatted = jQuery(origin).parents('td').attr('data-date-formatted'); 867 868 // Add date to the tooltip 869 jQuery('.exodus-calendar-list-entry-date', content).html(date_formatted); 870 871 return content; 872 873 }, 874 minWidth: 300, 875 maxWidth: 600, 876 touchDevices: false, // no hovers on touch, unless also has mouse 877 interactive: true, // let them click on tooltip
878 arrow: false, 879 animation: 'fade', 880 speed: 250, // fade speed 881 onlyOne: true, // immediately close other tooltips when opening 882 }); 883 } 884 885 }); 886 887} 888 889/****************************************** 890 * <HEAD> 891 ******************************************/ 892 893// Stop Edge browser from linking phone numbers. 894// Later, when possible, style the links instead of removing. 895if (/Edge/.test(navigator.userAgent)) { 896 jQuery('head').append('<meta name="format-detection" content="telephone=no">'); 897} 898 899/****************************************** 900 * GOOGLE MAPS 901 ******************************************/ 902 903// Global marker image 904var ctfw_map_marker_image = exodus_main.color_url + '/images/map-icon.png'; 905//var ctfw_map_marker_image_hidpi = exodus_main.color_url + '/images/[email protected]'; 906//var ctfw_map_marker_image_width = 26; // only necessary when providing HiDPI image 907//var ctfw_map_marker_image_height = 26;
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.