1/** 2 * ColorMag theme custom JS file. 3 * 4 * @package ColorMag 5 */ 6 7jQuery( document ).ready( 8 function () { 9 10 /** 11 * Search. 12 */ 13 var hideSearchForm = function () { 14 jQuery( '#cm-masthead .search-form-top' ).removeClass( 'show' ); 15 jQuery( '#cm-content' ).removeClass( 'backdrop' ); 16 }; 17 18 // For Search Icon Toggle effect added at the top. 19 jQuery( '.search-top' ).click( 20 function () { 21 jQuery( this ).next( '#cm-masthead .search-form-top' ).toggleClass( 'show' ); 22 23 jQuery( '#cm-content' ).toggleClass( 'backdrop' ); 24 // Focus after some time to fix conflict with toggleClass. 25 setTimeout( 26 function () { 27 jQuery( '#cm-masthead .search-form-top input' ).focus(); 28 }, 29 200 30 ); 31 32 // For esc key press. 33 jQuery( document ).on( 34 'keyup', 35 function ( e ) { 36 // On esc key press. 37 if ( 27 === e.keyCode ) { 38 // If search box is opened. 39 if ( jQuery( '#cm-masthead .search-form-top' ).hasClass( 'show' ) ) { 40 hideSearchForm(); 41 } 42 } 43 } 44 ); 45 46 jQuery( document ).on( 47 'click.outEvent', 48 function ( e ) { 49 if ( e.target.closest( '.cm-top-search' ) ) { 50 return; 51 } 52 53 hideSearchForm(); 54 55 // Unbind current click event. 56 jQuery( document ).off( 'click.outEvent' ); 57 } 58 ); 59 } 60 ); 61 62 /** 63 * Scroll to top JS setting. 64 */ 65 // Hides the scroll up button initially. 66 jQuery( '#scroll-up' ).hide(); 67 68 // Scroll up settings. 69 jQuery( window ).scroll( 70 function () { 71 if ( jQuery( this ).scrollTop() > 1000 ) { 72 jQuery( '#scroll-up' ).fadeIn(); 73 } else { 74 jQuery( '#scroll-up' ).fadeOut(); 75 } 76 } 77 ); 78 79 jQuery( 'a#scroll-up' ).click( 80 function () { 81 jQuery( 'body,html' ).animate( 82 { 83 scrollTop : 0 84 }, 85 800 86 ); 87 return false; 88 } 89 ); 90 91 /** 92 * Better responsive menu settings. 93 */ 94 // Adds right icon to submenu. 95 jQuery( '.cm-menu-primary-container .menu-item-has-children' ) ; 96 97 // Adds down icon for menu with sub menu. 98 jQuery( '.cm-menu-primary-container .cm-submenu-toggle' ).click( 99 function () { 100 jQuery( this ).parent( '.menu-item-has-children' ).children( 'ul.sub-menu' ).first().slideToggle( '1000' ); 101 } 102 ); 103 104 jQuery( document ).on( 105 'click', 106 '#cm-primary-nav ul li.menu-item-has-children > a', 107 function ( event ) { 108 var menuClass = jQuery( this ).parent( '.menu-item-has-children' ); 109 110 if ( ! menuClass.hasClass( 'focus' ) && jQuery( window ).width() <= 768 ) { 111 menuClass.addClass( 'focus' ); 112 event.preventDefault(); 113 menuClass.children( '.sub-menu' ).css( 114 { 115 'display' : 'block' 116 } 117 ); 118 } 119 } 120 ); 121 122 /** 123 * Scrollbar on fixed responsive menu. 124 */ 125 jQuery( window ).on( 'load', 126 function() { 127 if ( window.matchMedia( '(max-width: 768px)' ).matches && jQuery( '#cm-masthead .sticky-wrapper, #cm-masthead .headroom' ).length >= 1 ) { 128 var screenHeight = jQuery( window ).height(); 129 var availableMenuHeight = screenHeight - 88; 130 var menu = jQuery( '#cm-primary-nav' ).find( 'ul' ).first(); 131 132 menu.css( 'max-height', availableMenuHeight ); 133 menu.addClass( 'menu-scrollbar' ); 134 } 135 } 136 ); 137 138 // add widget block title class. 139 jQuery( '.wp-block-group__inner-container h2' ).wrap( '<div class="block-title"></div>' ); 140 jQuery( '.wp-block-heading' ).wrap( '<div class="block-title"></div>' ); 141 142 // Magnific Popup Setting. 143 if ( typeof jQuery.fn.magnificPopup !== 'undefined' ) { 144 145 // Featured Image Popup Setting. 146 jQuery( '.image-popup' ).magnificPopup( { type : 'image' } ); 147 148 // Magnific Popup for gallery. 149 jQuery( '.gallery' ).find( 'a[href*=".jpg"], a[href*=".jpeg"], a[href*=".png"], a[href*=".gif"], a[href*=".ico"]' ).magnificPopup( 150 { 151 type : 'image', 152 gallery : { enabled : true } 153 } 154 ); 155 156 // Ticker news popup. 157 jQuery( '.colormag-ticker-news-popup-link' ).magnificPopup( 158 { 159 type : 'ajax', 160 callbacks : { 161 parseAjax : function ( mfpResponse ) { 162 var setting = jQuery.magnificPopup.instance,
163 content = jQuery( setting.currItem.el[0] ), 164 fragment = ( 165 content.data( 'fragment' ) 166 ); 167 mfpResponse.data = jQuery( mfpResponse.data ).find( fragment ); 168 } 169 } 170 } 171 ); 172 173 } 174 175 // Fitvids setting. 176 if ( typeof jQuery.fn.fitVids !== 'undefined' ) { 177 jQuery( '.fitvids-video' ).fitVids(); 178 } 179 180 // NewsTicker JS Settings. 181 if ( typeof jQuery.fn.newsTicker !== 'undefined' ) { 182 183 /* global colormag_ticker_settings */ 184 if ( typeof colormag_ticker_settings !== 'undefined' ) { 185 186 // Settings of the ticker. 187 var breaking_news_slide_effect = colormag_ticker_settings.breaking_news_slide_effect; 188 var breaking_news_duration = parseInt( colormag_ticker_settings.breaking_news_duration, 10 ); 189 var breaking_news_speed = parseInt( colormag_ticker_settings.breaking_news_speed, 10 ); 190 191 jQuery( '.newsticker' ).newsTicker( 192 { 193 row_height : 20, 194 max_rows : 1, 195 direction : breaking_news_slide_effect, 196 speed : breaking_news_speed, 197 duration : breaking_news_duration, 198 autostart : 1, 199 pauseOnHover : 1, 200 start : function () { 201 jQuery( '.newsticker' ).css( 'visibility', 'visible' ); 202 } 203 } 204 ); 205 206 } 207 208 // Breaking news widget. 209 var breaking_news_widget_init = function ( breaking_news_slider, breaking_news_slider_up, breaking_news_slider_down, breaking_news_slider_direction, breaking_news_slider_duration, breaking_news_slider_row_height, breaking_news_slider_max_row ) { 210 jQuery( breaking_news_slider ).newsTicker( 211 { 212 row_height : breaking_news_slider_row_height, 213 max_rows : breaking_news_slider_max_row, 214 duration : breaking_news_slider_duration, 215 direction : breaking_news_slider_direction, 216 prevButton : jQuery( breaking_news_slider_up ), 217 nextButton : jQuery( breaking_news_slider_down ), 218 start : function () { 219 jQuery( '.cm-breaking-news-slider-widget' ).css( 220 { 221 'visibility' : 'visible', 222 } 223 ); 224 } 225 } 226 ); 227 }; 228 229 var breaking_news_widget_wrapper = jQuery( '.cm-breaking-news' ); 230 jQuery( breaking_news_widget_wrapper ).each( 231 function () { 232 var breaking_news_slider = jQuery( this ).children( '.cm-breaking-news-slider-widget' ); 233 var breaking_news_slider_up = jQuery( this ).children( '.cm-slide-up' ); 234 var breaking_news_slider_down = jQuery( this ).children( '.cm-slide-down' ); 235 var breaking_news_slider_direction = jQuery( this ).children( '.cm-breaking-news-slider-widget' ).data( 'direction' ); 236 var breaking_news_slider_duration = jQuery( this ).children( '.cm-breaking-news-slider-widget' ).data( 'duration' ); 237 var breaking_news_slider_row_height = jQuery( this ).children( '.cm-breaking-news-slider-widget' ).data( 'rowheight' ); 238 var breaking_news_slider_max_row = jQuery( this ).children( '.cm-breaking-news-slider-widget' ).data( 'maxrows' ); 239 240 breaking_news_widget_init( breaking_news_slider, breaking_news_slider_up, breaking_news_slider_down, breaking_news_slider_direction, breaking_news_slider_duration, breaking_news_slider_row_height, breaking_news_slider_max_row ); 241 } 242 ); 243 244 } 245 246 // Settings of the sticky menu. 247 if ( typeof jQuery.fn.sticky !== 'undefined' ) { 248 var wpAdminBar = jQuery( '#wpadminbar' ); 249 250 if ( wpAdminBar.length ) { 251 jQuery( '#cm-primary-nav' ).sticky( 252 { 253 topSpacing : wpAdminBar.height(), 254 zIndex : 999 255 } 256 ); 257 } else { 258 jQuery( '#cm-primary-nav' ).sticky( 259 { 260 topSpacing : 0, 261 zIndex : 999 262 } 263 ); 264 } 265 } 266 267 // Adds placeholder in search input. 268 jQuery( '.wp-block-search__input' ).attr("placeholder", "Suchen ..."); 269 270 // Menu reveal on scroll. 271 if ( typeof jQuery.fn.headroom !== 'undefined' ) { 272 var offset_value = jQuery( '#cm-primary-nav' ).offset().top; 273 var wpAdminBar = jQuery( '#wpadminbar' ); 274 var menuwidth = jQuery( '.cm-primary-nav' ).width(); 275 276 if ( wpAdminBar.length ) { 277 offset_value = wpAdminBar.height() + jQuery( '#cm-primary-nav' ).offset().top; 278 } 279 280 jQuery( '.cm-primary-nav' ).headroom( 281 { 282 'offset' : offset_value, 283 'tolerance' : 0, 284 onPin : function () { 285 if ( wpAdminBar.length ) { 286 jQuery( '.cm-primary-nav' ).css( 287 { 288 'top' : wpAdminBar.height(), 289 'position' : 'fixed', 290 'width' : menuwidth 291 } 292 ); 293 } else { 294 jQuery( '.cm-primary-nav' ).css( 295 { 296 'top' : 0, 297 'position' : 'fixed', 298 'width' : menuwidth 299 } 300 ); 301 } 302 }, 303 onTop : function () { 304 jQuery( '.cm-primary-nav' ).css( 305 { 306 'top' : 0, 307 'position' : 'relative' 308 } 309 ); 310 } 311 } 312 ); 313 } 314 315 // BxSlider JS Settings. 316 if ( typeof jQuery.fn.bxSlider !== 'undefined' ) { 317 318 // Category slider widget slider setting. 319 var category_init = function ( category_slider, category_mode, category_speed, category_pause, category_auto, category_hover ) { 320 jQuery( category_slider ).bxSlider( 321 { 322 mode : category_mode, 323 speed : category_speed, 324 auto : category_auto, 325 pause : category_pause, 326 autoHover : category_hover, 327 adaptiveHeight : true, 328 nextText : '<div class="cm-category-slide-next"><svg class="cm-icon coloramg-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
328<path d="M3 11h15.59l-7.3-7.29a1 1 0 0 1 1.42-1.42l9 9a.93.93 0 0 1 .21.33A1 1 0 0 1 22 12a1.09 1.09 0 0 1-.08.39 1.06 1.06 0 0 1-.21.31l-9 9a1 1 0 0 1-1.42 0 1 1 0 0 1 0-1.42l7.3-7.28H3a1 1 0 0 1 0-2Z"></path></svg></div>', 329 prevText : '<div class="cm-category-slide-prev"><svg class="cm-icon coloramg-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 11H5.41l7.3-7.29a1 1 0 1 0-1.42-1.42l-9 9a.93.93 0 0 0-.21.33A1 1 0 0 0 2 12a1.09 1.09 0 0 0 .08.39 1.06 1.06 0 0 0 .21.31l9 9a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42L5.41 13H21a1 1 0 0 0 0-2Z"></path></svg></div>', 330 pager : false, 331 tickerHover : true, 332 onSliderLoad : function () { 333 jQuery( '.cm-slider-area-rotate' ).css( 'visibility', 'visible' ); 334 jQuery( '.cm-slider-area-rotate' ).css( 'height', 'auto' ); 335 } 336 } 337 ); 338 }; 339 340 var category_slider_wrapper = jQuery( '.cm-featured-category-slider ' ); 341 jQuery( category_slider_wrapper ).each( 342 function () { 343 var category_slider = jQuery( this ).children( '.cm-slider-area-rotate' ); 344 var category_mode = jQuery( this ).children( '.cm-slider-area-rotate' ).data( 'mode' ); 345 var category_speed = jQuery( this ).children( '.cm-slider-area-rotate' ).data( 'speed' ); 346 var category_pause = jQuery( this ).children( '.cm-slider-area-rotate' ).data( 'pause' ); 347 var category_auto = jQuery( this ).children( '.cm-slider-area-rotate' ).data( 'auto' ); 348 var category_hover = jQuery( this ).children( '.cm-slider-area-rotate' ).data( 'hover' ); 349 350 category_init( category_slider, category_mode, category_speed, category_pause, category_auto, category_hover ); 351 } 352 ); 353 354 // Style 5 widget JS Setting. 355 var style5_slider_init = function ( style5_slider, style5_speed, style5_pause, style5_auto, style5_hover ) { 356 jQuery( style5_slider ).bxSlider( 357 { 358 minSlides : 1, 359 maxSlides : 2, 360 slideWidth : 390, 361 slideMargin : 20, 362 speed : style5_speed, 363 pause : style5_pause, 364 auto : style5_auto, 365 autoHover : style5_hover, 366 adaptiveHeight : true, 367 nextText : '<div class="slide-next"><i class="fa fa-angle-right"></i></div>', 368 prevText : '<div class="slide-prev"><i class="fa fa-angle-left"></i></div>', 369 pager : false, 370 captions : false, 371 onSliderLoad : function () { 372 jQuery( '.cm-featured-posts--style-5 .cm-highlighted-post' ).css( 'visibility', 'visible' ); 373 jQuery( '.cm-featured-posts--style-5 .cm-highlighted-post' ).css( 'height', 'auto' ); 374 } 375 } 376 ); 377 }; 378 379 var style5_slider_wrapper = jQuery( '.cm-posts' ); 380 jQuery( style5_slider_wrapper ).each( 381 function () { 382 var style5_slider = jQuery( this ).children( '.cm-featured-posts--style-5 .cm-highlighted-post' ); 383 var style5_speed = jQuery( this ).children( '.cm-featured-posts--style-5 .cm-highlighted-post' ).data( 'speed' ); 384 var style5_pause = jQuery( this ).children( '.cm-featured-posts--style-5 .cm-highlighted-post' ).data( 'pause' ); 385 var style5_auto = jQuery( this ).children( '.cm-featured-posts--style-5 .cm-highlighted-post' ).data( 'auto' ); 386 var style5_hover = jQuery( this ).children( '.cm-featured-posts--style-5 .cm-highlighted-post' ).data( 'hover' ); 387 388 style5_slider_init( style5_slider, style5_speed, style5_pause, style5_auto, style5_hover ); 389 } 390 ); 391 392 // Style 6 widget JS Setting. 393 var style6_slider_init = function ( style6_slider_class, style6_pager_class, style6_mode, style6_speed, style6_pause, style6_auto, style6_hover ) { 394 jQuery( style6_slider_class ).bxSlider( 395 { 396 mode : style6_mode, 397 speed : style6_speed, 398 pause : style6_pause, 399 auto : style6_auto, 400 pagerCustom : style6_pager_class, 401 autoHover : style6_hover, 402 controls : false, 403 nextText : '', 404 prevText : '', 405 nextSelector : '', 406 prevSelector : '', 407 captions : false, 408 onSliderLoad : function () { 409 jQuery( '.thumbnail-big-sliders' ).css( 'visibility', 'visible' ); 410 jQuery( '.thumbnail-big-sliders' ).css( 'height', 'auto' ); 411 } 412 } 413 ); 414 }; 415 416 var style6_slider_wrapper = jQuery( '.cm-thumbnail-slider-news' );
417 jQuery( style6_slider_wrapper ).each( 418 function () { 419 var style6_slider_class = jQuery( this ).children( '.thumbnail-big-sliders' ); 420 var style6_pager_class = jQuery( this ).children( '.cm-thumbnail-slider' ); 421 var style6_mode = jQuery( this ).children( '.thumbnail-big-sliders' ).data( 'mode' ); 422 var style6_speed = jQuery( this ).children( '.thumbnail-big-sliders' ).data( 'speed' ); 423 var style6_pause = jQuery( this ).children( '.thumbnail-big-sliders' ).data( 'pause' ); 424 var style6_auto = jQuery( this ).children( '.thumbnail-big-sliders' ).data( 'auto' ); 425 var style6_hover = jQuery( this ).children( '.thumbnail-big-sliders' ).data( 'hover' ); 426 427 style6_slider_init( style6_slider_class, style6_pager_class, style6_mode, style6_speed, style6_pause, style6_auto, style6_hover ); 428 } 429 ); 430 431 // Style 7 widget JS Setting. 432 var style7_slider_init = function ( style7_slider, style7_speed ) { 433 jQuery( style7_slider ).bxSlider( 434 { 435 minSlides : 5, 436 maxSlides : 8, 437 slideWidth : 150, 438 slideMargin : 12, 439 ticker : true, 440 speed : style7_speed, 441 tickerHover : true, 442 useCSS : false, 443 onSliderLoad : function () { 444 jQuery( '.cm-image-ticker-news' ).css( 'visibility', 'visible' ); 445 jQuery( '.cm-image-ticker-news' ).css( 'height', 'auto' ); 446 } 447 } 448 ); 449 }; 450 451 var style7_slider_wrapper = jQuery( '.cm-featured-posts--style-7' ); 452 jQuery( style7_slider_wrapper ).each( 453 function () { 454 var style7_slider = jQuery( this ).children( '.cm-image-ticker-news' ); 455 var style7_speed = jQuery( this ).children( '.cm-image-ticker-news' ).data( 'speed' ); 456 457 style7_slider_init( style7_slider, style7_speed ); 458 } 459 ); 460 461 // Post format gallery slider setting. 462 jQuery( '.blog .gallery-images, .archive .gallery-images, .search .gallery-images, .single-post .gallery-images' ).bxSlider( 463 { 464 mode : 'fade', 465 speed : 1500, 466 auto : true, 467 pause : 3000, 468 adaptiveHeight : true, 469 nextText : '', 470 prevText : '', 471 nextSelector : '.slide-next', 472 prevSelector : '.slide-prev', 473 pager : false 474 } 475 ); 476 477 // Related post carousel. 478 jQuery( window ).on( 'load colormagAjaxSinglePostLoaded', function() { 479 480 jQuery( '.related-post-carousel' ).bxSlider( 481 { 482 minSlides : 1, 483 maxSlides : 2, 484 auto : true, 485 slideWidth : 390, 486 slideMargin : 20, 487 moveSlides : 1, 488 shrinkItems : true, 489 speed : 3000, 490 autoHover : true, 491 nextText : '<div class="slide-next"><svg class="cm-icon coloramg-icon--arrow-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 11h15.59l-7.3-7.29a1 1 0 0 1 1.42-1.42l9 9a.93.93 0 0 1 .21.33A1 1 0 0 1 22 12a1.09 1.09 0 0 1-.08.39 1.06 1.06 0 0 1-.21.31l-9 9a1 1 0 0 1-1.42 0 1 1 0 0 1 0-1.42l7.3-7.28H3a1 1 0 0 1 0-2Z"></path></svg></i></div>', 492 prevText : '<div class="slide-prev"><svg class="cm-icon coloramg-icon--arrow-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 11H5.41l7.3-7.29a1 1 0 1 0-1.42-1.42l-9 9a.93.93 0 0 0-.21.33A1 1 0 0 0 2 12a1.09 1.09 0 0 0 .08.39 1.06 1.06 0 0 0 .21.31l9 9a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42L5.41 13H21a1 1 0 0 0 0-2Z"></path></svg></div>', 493 pager : false, 494 captions : false, 495 onSliderLoad : function () { 496 jQuery( '.related-post-carousel' ).css( 'visibility', 'visible' ); 497 jQuery( '.related-post-carousel' ).css( 'height', 'auto' ); 498 } 499 } 500 ); 501 }); 502 } 503 504 // Tabbed widget. 505 if ( typeof jQuery.fn.easytabs !== 'undefined' ) { 506 jQuery( '.cm-tabbed-widget' ).easytabs(); 507 } 508 509 // Sticky sidebar JS setting. 510 if ( typeof jQuery.fn.theiaStickySidebar !== 'undefined' && typeof ResizeSensor !== 'undefined' ) { 511 // Calculate the whole height of sticky menu. 512 var height = jQuery( '#site-navigation-sticky-wrapper' ).outerHeight(); 513 514 // Assign height value to 0 if it returns null. 515 if ( height === null ) { 516 height = 0; 517 } 518 519 // Apply sticky sidebar/content area JS setting. 520 jQuery( '#cm-primary, #cm-secondary, #cm-tertiary' ).theiaStickySidebar( 521 { 522 additionalMarginTop : 40 + height 523 } 524 ); 525 } 526 527 /** 528 * Featured video playlist widget setting. 529 */ 530 jQuery( '.video-player' ).each( 531 function ( index ) { 532 533 var playercontainer = jQuery( this ); 534 var itemid = 'video-playlist-item-' + index; 535 var playerframe = jQuery( this ).find( '.player-frame' ); 536 537 playercontainer.attr( 'id', itemid ); 538 539 playerframe.video(); 540 541 update_video_status( playercontainer ); 542 543 playerframe.addVideoEvent( 544 'ready', 545 function () { 546 playerframe.css( 'visibility', 'visible' ).fadeIn(); 547 } 548 ); 549 550 playercontainer.on( 551 'click', 552 '.video-playlist-item', 553 function () { 554 var item = jQuery( this ); 555 var iframe_id = item.data( 'id' ); 556 var current_video_id = jQuery( '#' + iframe_id ); 557 var src = item.data( 'src' ); 558 559 // Pause all videos if a item is clicked. 560 playercontainer.find( '.player-frame' ).each( 561 function () { 562 jQuery( this ).pauseVideo().hide(); 563 } 564 ); 565 566 if ( ! current_video_id.length ) { 567 playercontainer.find( '.video-frame' ).append( '<iframe id="' + iframe_id + '" class="player-frame" src="' + src + '" frameborder="0" width="100%" height="434" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>' ); 568 current_video_id = jQuery( '#' + iframe_id ); 569 current_video_id.video(); 570 571 current_video_id.addVideoEvent( 572 'ready', 573 function ( e, $current_video_id, video_type ) { 574 current_video_id.playVideo(); 575 } 576 ); 577 } else { 578 current_video_id.playVideo(); 579 } 580 581 current_video_id.css( 'visibility', 'visible' ).fadeIn(); 582 583 update_video_status( playercontainer ); 584 } 585 ); 586 587 } 588 ); 589 590 // Update Video status. 591 function update_video_status( playercontainer ) { 592 playercontainer.find( '.player-frame' ).each( 593 function () { 594 var frame = jQuery( this ), 595 videoitem = jQuery( '[data-id="' + frame.attr( 'id' ) + '"]' ); 596 597 frame.addVideoEvent( 598 'play', 599 function ( e, $video, video_type ) { 600 videoitem.removeClass( 'is-paused' ).addClass( 'is-playing' ); 601 } 602 ); 603 604 frame.addVideoEvent( 605 'pause', 606 function ( e, $video, video_type ) { 607 videoitem.removeClass( 'is-playing' ).addClass( 'is-paused' ); 608 } 609 ); 610 611 frame.addVideoEvent( 612 'finish', 613 function ( e, $video, video_type ) { 614 videoitem.removeClass( 'is-paused is-playing' ); 615 } 616 ); 617 } 618 ); 619 } 620 621 // Scroll Reading Progress JS Setting. 622 if ( typeof jQuery.fn.prognroll !== 'undefined' ) { 623 jQuery( 'body' ).prognroll( 624 { 625 height : 5, 626 color : colormag_progress_bar_indicator_color.bg_color, 627 custom : false, 628 } 629 ); 630 } 631 632 // Google Maps Settings. 633 if ( typeof google !== 'undefined' && typeof colormag_google_maps_widget_settings !== 'undefined' ) { 634 635 // Create function to initialize Google Maps. 636 function initMap() { 637 638 // Float the value coming from wp_localize_script to be used for JS. 639 var longitude = parseFloat( colormag_google_maps_widget_settings.longitude ); 640 var latitude = parseFloat( colormag_google_maps_widget_settings.latitude ); 641 var zoom_size = parseInt( colormag_google_maps_widget_settings.zoom_size ); 642 643 // Add latitude and longitude to variable. 644 var latitudelongitude = { 645 lat : latitude, 646 lng : longitude 647 }; 648 649 var map = new google.maps.Map( 650 document.getElementById( 'GoogleMaps' ), 651 { 652 zoom : zoom_size, 653 center : latitudelongitude 654 } 655 ); 656 657 var marker = new google.maps.Marker( 658 { 659 position : latitudelongitude, 660 map : map 661 } 662 ); 663 664 } 665 666 // Call the function to display the Google Maps. 667 initMap();
668 669 // Add the dynamic width and height set in widget options. 670 jQuery( '#GoogleMaps' ).css( 671 { 672 height : colormag_google_maps_widget_settings.height 673 } 674 ); 675 676 } 677 678 /** 679 * Social share button. 680 */ 681 ( 682 function () { 683 684 var facebookShare = jQuery( '.share-buttons #facebook' )[0], 685 twitterShare = jQuery( '.share-buttons #twitter' )[0], 686 pinterestshare = jQuery( '.share-buttons #pinterest' )[0], 687 facebookWindow, 688 twitterWindow, 689 pinterestWindow; 690 691 if ( facebookShare ) { 692 jQuery( facebookShare ).click( 693 function ( e ) { 694 e.preventDefault(); 695 facebookWindow = window.open( 696 'https://www.facebook.com/sharer/sharer.php?u=' + document.URL + '&p[title]=' + document.title, 697 'facebook-popup', 698 'height=350,width=600' 699 ); 700 701 if ( facebookWindow.focus ) { 702 facebookWindow.focus(); 703 } 704 705 return false; 706 } 707 ); 708 } 709 710 if ( twitterShare ) { 711 jQuery( twitterShare ).click( 712 function ( e ) { 713 e.preventDefault(); 714 twitterWindow = window.open( 715 'https://twitter.com/share?text=' + document.title + '&url=' + document.URL, 716 'twitter-popup', 717 'height=350,width=600' 718 ); 719 720 if ( twitterWindow.focus ) { 721 twitterWindow.focus(); 722 } 723 724 return false; 725 } 726 ); 727 } 728 729 if ( pinterestshare ) { 730 jQuery( pinterestshare ).click( 731 function ( e ) { 732 e.preventDefault(); 733 var featuredImage = jQuery( '.cm-posts .cm-featured-image img' ).attr( 'src' ) ? jQuery( '.cm-posts .cm-featured-image img' ).attr( 'src' ) : ''; 734 735 pinterestWindow = window.open( 736 'https://pinterest.com/pin/create/button/?url=' + document.URL + '&media=' + featuredImage + '&description=' + document.title, 737 'pinterest-popup', 738 'height=350,width=600' 739 ); 740 741 if ( pinterestWindow.focus ) { 742 pinterestWindow.focus(); 743 } 744 745 return false; 746 } 747 ); 748 } 749 750 }() 751 ); 752 753 } 754); 755 756/** 757 * Flyout related posts featured JS setting. 758 */ 759jQuery( 760 function () { 761 762 // Flyout related post. 763 var related_posts_flyout_wrapper = jQuery( '#related-posts-wrapper-flyout' ); 764 765 function colormag_flyout_posts_window_scroll() { 766 var primary_height = jQuery( '#cm-primary' ).outerHeight(); 767 var window_height = jQuery( this ).scrollTop() + jQuery( this ).height(); 768 var window_bottom = jQuery( document ).height() - window_height; 769 770 if ( window_height > window_bottom ) { 771 related_posts_flyout_wrapper.addClass( 'flyout' ); 772 } else { 773 related_posts_flyout_wrapper.removeClass( 'flyout' ); 774 } 775 } 776 777 jQuery( window ).on( 'scroll', colormag_flyout_posts_window_scroll ); 778 779 jQuery( '#flyout-related-post-close' ).click( 780 function () { 781 related_posts_flyout_wrapper.removeClass( 'flyout' ); 782 783 jQuery( window ).off( 'scroll', colormag_flyout_posts_window_scroll ); 784 } 785 ); 786 787 } 788);
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.