| Conditions | 1 |
| Paths | 18 |
| Total Lines | 615 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 8 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | /** |
||
| 10 | ;( function( $, window, document, undefined ) { |
||
|
|
|||
| 11 | |||
| 12 | 'use strict'; |
||
| 13 | |||
| 14 | var $document = $( document ), |
||
| 15 | $window = $( window ), |
||
| 16 | windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight, |
||
| 17 | windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Adds browser class to html tag. |
||
| 21 | * |
||
| 22 | * @package lsx |
||
| 23 | * @subpackage scripts |
||
| 24 | */ |
||
| 25 | lsx.add_class_browser_to_html = function() { |
||
| 26 | if ( 'undefined' !== typeof platform ) { |
||
| 27 | var platform_name = platform.name.toLowerCase(), |
||
| 28 | platform_version = platform.version.toLowerCase().replace(/\..*$/g, ''); |
||
| 29 | |||
| 30 | $( 'html' ).addClass( platform_name ).addClass( platform_version ); |
||
| 31 | } |
||
| 32 | }; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Test if the sidebar exists (if exists, add a class to the body). |
||
| 36 | * |
||
| 37 | * @package lsx |
||
| 38 | * @subpackage scripts |
||
| 39 | */ |
||
| 40 | lsx.add_class_sidebar_to_body = function() { |
||
| 41 | if ( $( '#secondary' ).length > 0 ) { |
||
| 42 | $( 'body' ).addClass( 'has-sidebar' ); |
||
| 43 | } |
||
| 44 | }; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Add Bootstrap class to WordPress tables. |
||
| 48 | * |
||
| 49 | * @package lsx |
||
| 50 | * @subpackage scripts |
||
| 51 | */ |
||
| 52 | lsx.add_class_bootstrap_to_table = function() { |
||
| 53 | var tables = $( 'table#wp-calendar' ); |
||
| 54 | |||
| 55 | if ( tables.length > 0 ) { |
||
| 56 | tables.addClass( 'table' ); |
||
| 57 | } |
||
| 58 | }; |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Add a class to identify when the mobile nav is open |
||
| 62 | * |
||
| 63 | * @package lsx |
||
| 64 | * @subpackage scripts |
||
| 65 | */ |
||
| 66 | |||
| 67 | lsx.navbar_toggle_handler = function() { |
||
| 68 | $( '.navbar-toggle' ).parent().on( 'click', function() { |
||
| 69 | var $parent = $( this ); |
||
| 70 | $parent.toggleClass( 'open' ); |
||
| 71 | } ); |
||
| 72 | }; |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Fix Bootstrap menus (touchstart). |
||
| 76 | * |
||
| 77 | * @package lsx |
||
| 78 | * @subpackage scripts |
||
| 79 | */ |
||
| 80 | // lsx.fix_bootstrap_menus_touchstart = function() { |
||
| 81 | // $( '.dropdown-menu' ).on( 'touchstart.dropdown.data-api', function( e ) { |
||
| 82 | // e.stopPropagation(); |
||
| 83 | // } ); |
||
| 84 | // }; |
||
| 85 | |||
| 86 | /** |
||
| 87 | * Fix Bootstrap menus (dropdown). |
||
| 88 | * |
||
| 89 | * @package lsx |
||
| 90 | * @subpackage scripts |
||
| 91 | */ |
||
| 92 | lsx.fix_bootstrap_menus_dropdown = function() { |
||
| 93 | $( '.navbar-nav .dropdown, #top-menu .dropdown' ).on( 'show.bs.dropdown', function() { |
||
| 94 | if ( windowWidth < 1200 ) { |
||
| 95 | $( this ).siblings( '.open' ).removeClass( 'open' ).find( 'a.dropdown-toggle' ).attr( 'data-toggle', 'dropdown' ); |
||
| 96 | $( this ).find( 'a.dropdown-toggle' ).removeAttr( 'data-toggle' ); |
||
| 97 | } |
||
| 98 | } ); |
||
| 99 | |||
| 100 | if ( windowWidth > 1199 ) { |
||
| 101 | $( '.navbar-nav li.dropdown a, #top-menu li.dropdown a' ).each( function() { |
||
| 102 | $( this ).removeClass( 'dropdown-toggle' ); |
||
| 103 | $( this ).removeAttr( 'data-toggle' ); |
||
| 104 | } ); |
||
| 105 | } |
||
| 106 | |||
| 107 | $window.resize( function() { |
||
| 108 | if ( windowWidth > 1199 ) { |
||
| 109 | $( '.navbar-nav li.dropdown a, #top-menu li.dropdown a' ).each( function() { |
||
| 110 | $( this ).removeClass( 'dropdown-toggle' ); |
||
| 111 | $( this ).removeAttr( 'data-toggle' ); |
||
| 112 | } ); |
||
| 113 | } else { |
||
| 114 | $( '.navbar-nav li.dropdown a, #top-menu li.dropdown a' ).each( function() { |
||
| 115 | $( this ).addClass( 'dropdown-toggle' ); |
||
| 116 | $( this ).attr( 'data-toggle', 'dropdown' ); |
||
| 117 | } ); |
||
| 118 | } |
||
| 119 | } ); |
||
| 120 | }; |
||
| 121 | |||
| 122 | /** |
||
| 123 | * Fix Bootstrap menus (dropdown inside dropdown - click). |
||
| 124 | * |
||
| 125 | * @package lsx |
||
| 126 | * @subpackage scripts |
||
| 127 | */ |
||
| 128 | lsx.fix_bootstrap_menus_dropdown_click = function() { |
||
| 129 | if ( windowWidth < 1200 ) { |
||
| 130 | $( '.navbar-nav .dropdown .dropdown > a, #top-menu .dropdown .dropdown > a' ).on( 'click', function( e ) { |
||
| 131 | if ( ! $( this ).parent().hasClass( 'open' ) ) { |
||
| 132 | $( this ).parent().addClass( 'open' ); |
||
| 133 | $( this ).next( '.dropdown-menu' ).dropdown( 'toggle' ); |
||
| 134 | e.stopPropagation(); |
||
| 135 | e.preventDefault(); |
||
| 136 | } |
||
| 137 | } ); |
||
| 138 | |||
| 139 | $( '.navbar-nav .dropdown .dropdown .dropdown-menu a, #top-menu .dropdown .dropdown > a' ).on( 'click', function( e ) { |
||
| 140 | document.location.href = this.href; |
||
| 141 | } ); |
||
| 142 | } |
||
| 143 | }; |
||
| 144 | |||
| 145 | /** |
||
| 146 | * Fix LazyLoad on Envira |
||
| 147 | * |
||
| 148 | * @package lsx |
||
| 149 | * @subpackage scripts |
||
| 150 | */ |
||
| 151 | lsx.fix_lazyload_envira_gallery = function() { |
||
| 152 | if ( $( '.lazyload, .lazyloaded' ).length > 0 ) { |
||
| 153 | if ( typeof envira_isotopes == 'object' ) { |
||
| 154 | $window.scroll( function() { |
||
| 155 | $( '.envira-gallery-wrap' ).each( function() { |
||
| 156 | var id = $( this ).attr( 'id' ); |
||
| 157 | id = id.replace( 'envira-gallery-wrap-', '' ); |
||
| 158 | |||
| 159 | if ( typeof envira_isotopes[ id ] == 'object' ) { |
||
| 160 | envira_isotopes[ id ].enviratope( 'layout' ); |
||
| 161 | } |
||
| 162 | } ); |
||
| 163 | } ); |
||
| 164 | } |
||
| 165 | } |
||
| 166 | }; |
||
| 167 | |||
| 168 | /** |
||
| 169 | * Fixed main menu. |
||
| 170 | * |
||
| 171 | * @package lsx |
||
| 172 | * @subpackage scripts |
||
| 173 | */ |
||
| 174 | lsx.set_main_menu_as_fixed = function() { |
||
| 175 | if ( windowWidth > 1199 ) { |
||
| 176 | if ( $( 'body' ).hasClass( 'top-menu-fixed' ) ) { |
||
| 177 | $( 'header.navbar' ).scrollToFixed( { |
||
| 178 | marginTop: function() { |
||
| 179 | var wpadminbar = $( '#wpadminbar' ); |
||
| 180 | |||
| 181 | if ( wpadminbar.length > 0 ) { |
||
| 182 | return wpadminbar.outerHeight(); |
||
| 183 | } |
||
| 184 | |||
| 185 | return 0; |
||
| 186 | }, |
||
| 187 | |||
| 188 | minWidth: 768, |
||
| 189 | |||
| 190 | preFixed: function() { |
||
| 191 | $( this ).addClass( 'scrolled' ); |
||
| 192 | }, |
||
| 193 | |||
| 194 | preUnfixed: function() { |
||
| 195 | $( this ).removeClass( 'scrolled' ); |
||
| 196 | } |
||
| 197 | } ); |
||
| 198 | } |
||
| 199 | } |
||
| 200 | }; |
||
| 201 | |||
| 202 | /** |
||
| 203 | * Banner effect (parallax). |
||
| 204 | * |
||
| 205 | * @package lsx |
||
| 206 | * @subpackage scripts |
||
| 207 | */ |
||
| 208 | lsx.set_banner_effect_parallax = function() { |
||
| 209 | var $banner, |
||
| 210 | $bannerImage, |
||
| 211 | bannerEndPosition, |
||
| 212 | base = -40, |
||
| 213 | |||
| 214 | bannerParallax = function() { |
||
| 215 | if ( $window.scrollTop() <= bannerEndPosition ) { |
||
| 216 | var scrolled = $window.scrollTop() / bannerEndPosition * 100, |
||
| 217 | top = base + scrolled, |
||
| 218 | bottom = base - scrolled; |
||
| 219 | |||
| 220 | $bannerImage.css( { |
||
| 221 | 'top': top + 'px', |
||
| 222 | 'bottom': bottom + 'px' |
||
| 223 | } ); |
||
| 224 | } |
||
| 225 | }; |
||
| 226 | |||
| 227 | if ( windowWidth > 1199 ) { |
||
| 228 | $banner = $( '.page-banner:not(.gmap-banner)' ); |
||
| 229 | |||
| 230 | if ( $banner.length > 0 ) { |
||
| 231 | bannerEndPosition = $banner.height() + $banner.offset().top; |
||
| 232 | $bannerImage = $banner.children( '.page-banner-image' ); |
||
| 233 | |||
| 234 | if ( $bannerImage.length > 0 ) { |
||
| 235 | bannerParallax(); |
||
| 236 | |||
| 237 | $window.scroll( function() { |
||
| 238 | bannerParallax(); |
||
| 239 | } ); |
||
| 240 | } |
||
| 241 | } |
||
| 242 | } |
||
| 243 | }; |
||
| 244 | |||
| 245 | /** |
||
| 246 | * Search form effect (on mobile). |
||
| 247 | * |
||
| 248 | * @package lsx |
||
| 249 | * @subpackage scripts |
||
| 250 | */ |
||
| 251 | lsx.set_search_form_effect_mobile = function() { |
||
| 252 | $document.on( 'click', 'header.navbar #searchform button.search-submit', function( e ) { |
||
| 253 | if ( windowWidth < 1200 ) { |
||
| 254 | e.preventDefault(); |
||
| 255 | var form = $( this ).closest( 'form' ); |
||
| 256 | |||
| 257 | if ( form.hasClass( 'hover' ) ) { |
||
| 258 | form.submit(); |
||
| 259 | } else { |
||
| 260 | form.addClass( 'hover' ); |
||
| 261 | form.find( '.search-field' ).focus(); |
||
| 262 | } |
||
| 263 | } |
||
| 264 | } ); |
||
| 265 | |||
| 266 | $document.on( 'blur', 'header.navbar #searchform .search-field', function( e ) { |
||
| 267 | if ( windowWidth < 1200 ) { |
||
| 268 | var form = $( this ).closest( 'form' ); |
||
| 269 | form.removeClass( 'hover' ); |
||
| 270 | } |
||
| 271 | } ); |
||
| 272 | }; |
||
| 273 | |||
| 274 | /** |
||
| 275 | * Search form effect (on mobile). |
||
| 276 | * |
||
| 277 | * @package lsx |
||
| 278 | * @subpackage scripts |
||
| 279 | */ |
||
| 280 | lsx.search_form_prevent_empty_submissions = function() { |
||
| 281 | $document.on( 'submit', '#searchform', function( e ) { |
||
| 282 | if ( '' === $( this ).find('input[name="s"]').val() ) { |
||
| 283 | e.preventDefault(); |
||
| 284 | } |
||
| 285 | } ); |
||
| 286 | |||
| 287 | $document.on( 'blur', 'header.navbar #searchform .search-field', function( e ) { |
||
| 288 | if ( windowWidth < 1200 ) { |
||
| 289 | var form = $( this ).closest( 'form' ); |
||
| 290 | form.removeClass( 'hover' ); |
||
| 291 | } |
||
| 292 | } ); |
||
| 293 | }; |
||
| 294 | |||
| 295 | /** |
||
| 296 | * Slider Lightbox. |
||
| 297 | * |
||
| 298 | * @package lsx |
||
| 299 | * @subpackage scripts |
||
| 300 | */ |
||
| 301 | lsx.build_slider_lightbox = function() { |
||
| 302 | $( 'body:not(.single-tour-operator) .gallery' ).slickLightbox( { |
||
| 303 | caption: function( element, info ) { |
||
| 304 | return $( element ).find( 'img' ).attr( 'alt' ); |
||
| 305 | } |
||
| 306 | } ); |
||
| 307 | }; |
||
| 308 | |||
| 309 | /** |
||
| 310 | * Init WooCommerce slider. |
||
| 311 | * |
||
| 312 | * @package lsx |
||
| 313 | * @subpackage scripts |
||
| 314 | */ |
||
| 315 | lsx.init_wc_slider = function() { |
||
| 316 | var $wcSlider = $( '.lsx-woocommerce-slider' ); |
||
| 317 | |||
| 318 | $wcSlider.each( function( index, el ) { |
||
| 319 | var $self = $( this ), |
||
| 320 | _slidesToShow = 4, |
||
| 321 | _slidesToScroll = 4, |
||
| 322 | _slidesToShow_992 = 3, |
||
| 323 | _slidesToScroll_992 = 3, |
||
| 324 | _slidesToShow_768 = 1, |
||
| 325 | _slidesToScroll_768 = 1; |
||
| 326 | |||
| 327 | if ( $self.find( '.lsx-woocommerce-review-slot' ).length > 0 ) { |
||
| 328 | _slidesToShow = 2; |
||
| 329 | _slidesToScroll = 2; |
||
| 330 | _slidesToShow_992 = 2; |
||
| 331 | _slidesToScroll_992 = 2; |
||
| 332 | } |
||
| 333 | |||
| 334 | if ( $self.closest( '#secondary' ).length > 0 ) { |
||
| 335 | _slidesToShow = 1; |
||
| 336 | _slidesToScroll = 1; |
||
| 337 | _slidesToShow_992 = 1; |
||
| 338 | _slidesToScroll_992 = 1; |
||
| 339 | } |
||
| 340 | |||
| 341 | $self.on( 'init', function( event, slick ) { |
||
| 342 | if ( slick.options.arrows && slick.slideCount > slick.options.slidesToShow ) { |
||
| 343 | $self.addClass( 'slick-has-arrows' ); |
||
| 344 | } |
||
| 345 | } ); |
||
| 346 | |||
| 347 | $self.on( 'setPosition', function( event, slick ) { |
||
| 348 | if ( ! slick.options.arrows ) { |
||
| 349 | $self.removeClass('slick-has-arrows'); |
||
| 350 | } else if ( slick.slideCount > slick.options.slidesToShow ) { |
||
| 351 | $self.addClass('slick-has-arrows'); |
||
| 352 | } |
||
| 353 | } ); |
||
| 354 | |||
| 355 | $self.slick( { |
||
| 356 | draggable: false, |
||
| 357 | infinite: true, |
||
| 358 | swipe: false, |
||
| 359 | cssEase: 'ease-out', |
||
| 360 | dots: true, |
||
| 361 | slidesToShow: _slidesToShow, |
||
| 362 | slidesToScroll: _slidesToScroll, |
||
| 363 | responsive: [{ |
||
| 364 | breakpoint: 992, |
||
| 365 | settings: { |
||
| 366 | slidesToShow: _slidesToShow_992, |
||
| 367 | slidesToScroll: _slidesToScroll_992, |
||
| 368 | draggable: true, |
||
| 369 | arrows: false, |
||
| 370 | swipe: true |
||
| 371 | } |
||
| 372 | }, { |
||
| 373 | breakpoint: 768, |
||
| 374 | settings: { |
||
| 375 | slidesToShow: _slidesToShow_768, |
||
| 376 | slidesToScroll: _slidesToScroll_768, |
||
| 377 | draggable: true, |
||
| 378 | arrows: false, |
||
| 379 | swipe: true |
||
| 380 | } |
||
| 381 | }] |
||
| 382 | } ); |
||
| 383 | } ); |
||
| 384 | |||
| 385 | if ( $( 'a[href="#tab-bundled_products"]' ).length > 0 ) { |
||
| 386 | $document.on( 'click', 'a[href="#tab-bundled_products"]', function( e ) { |
||
| 387 | $( '#tab-bundled_products .lsx-woocommerce-slider' ).slick( 'setPosition' ); |
||
| 388 | }); |
||
| 389 | } |
||
| 390 | } |
||
| 391 | |||
| 392 | /** |
||
| 393 | * Remove gallery IMG width and height. |
||
| 394 | * |
||
| 395 | * @package lsx |
||
| 396 | * @subpackage scripts |
||
| 397 | */ |
||
| 398 | lsx.remove_gallery_img_width_height = function() { |
||
| 399 | $( '.gallery-size-full img' ).each( function() { |
||
| 400 | var $self = $( this ); |
||
| 401 | |||
| 402 | $self.removeAttr( 'height' ); |
||
| 403 | $self.removeAttr( 'width' ); |
||
| 404 | } ); |
||
| 405 | }; |
||
| 406 | |||
| 407 | /** |
||
| 408 | * Helper function to scroll to an element. |
||
| 409 | * |
||
| 410 | * @package lsx |
||
| 411 | * @subpackage scripts |
||
| 412 | */ |
||
| 413 | lsx.do_scroll = function( _$el ) { |
||
| 414 | var _href = ( _$el.href ).replace( /^[^#]*(#.+$)/gi, '$1' ), |
||
| 415 | _$to = $( _href ), |
||
| 416 | _top = parseInt( _$to.offset().top ), |
||
| 417 | _extra = -100; |
||
| 418 | |||
| 419 | $( 'html, body' ).animate( { |
||
| 420 | scrollTop: ( _top+_extra ) |
||
| 421 | }, 800); |
||
| 422 | }; |
||
| 423 | |||
| 424 | /** |
||
| 425 | * Fix WooCommerce API orders style/HTML. |
||
| 426 | * Fix WooCommerce checkboxes style/HTML. |
||
| 427 | * |
||
| 428 | * @package lsx |
||
| 429 | * @subpackage scripts |
||
| 430 | */ |
||
| 431 | lsx.fix_wc_elements = function( _$el ) { |
||
| 432 | $( '.woocommerce-MyAccount-content .api-manager-changelog, .woocommerce-MyAccount-content .api-manager-download' ).each( function() { |
||
| 433 | var $this = $( this ); |
||
| 434 | |||
| 435 | $this.children( 'br:first-child' ).remove(); |
||
| 436 | $this.children( 'hr:first-child' ).remove(); |
||
| 437 | |||
| 438 | $this.children( 'hr:last-child' ).remove(); |
||
| 439 | $this.children( 'br:last-child' ).remove(); |
||
| 440 | } ); |
||
| 441 | |||
| 442 | $( '.woocommerce-form__label-for-checkbox.checkbox' ).removeClass( 'checkbox' ); |
||
| 443 | |||
| 444 | $( document.body ).on( 'updated_checkout', function() { |
||
| 445 | $( '.woocommerce-form__label-for-checkbox.checkbox' ).removeClass( 'checkbox' ); |
||
| 446 | } ); |
||
| 447 | }; |
||
| 448 | |||
| 449 | /** |
||
| 450 | * Fix Caldera Forms modal title. |
||
| 451 | * |
||
| 452 | * @package lsx |
||
| 453 | * @subpackage scripts |
||
| 454 | */ |
||
| 455 | lsx.fix_caldera_form_modal_title = function() { |
||
| 456 | $( '[data-remodal-id]' ).each( function() { |
||
| 457 | var $form = $( this ), |
||
| 458 | $button = $( '[data-remodal-target="' + $form.attr( 'id' ) + '"]' ), |
||
| 459 | title = $button.text(); |
||
| 460 | |||
| 461 | $form.find( '[role="field"]' ).first().before( '<div><h4>' + title + '</h4></div>' ); |
||
| 462 | } ); |
||
| 463 | }; |
||
| 464 | |||
| 465 | /** |
||
| 466 | * Open/close WC footer bar search. |
||
| 467 | * |
||
| 468 | * @package lsx |
||
| 469 | * @subpackage scripts |
||
| 470 | */ |
||
| 471 | |||
| 472 | lsx.wc_footer_bar_toggle_handler = function() { |
||
| 473 | $( '.lsx-wc-footer-bar-link-toogle' ).on( 'click', function( event ) { |
||
| 474 | event.preventDefault(); |
||
| 475 | $( '.lsx-wc-footer-bar-form' ).slideToggle(); |
||
| 476 | $( '.lsx-wc-footer-bar' ).toggleClass( 'lsx-wc-footer-bar-search-on' ); |
||
| 477 | } ); |
||
| 478 | }; |
||
| 479 | |||
| 480 | /** |
||
| 481 | * Fix WC messages/notices visual. |
||
| 482 | * |
||
| 483 | * @package lsx |
||
| 484 | * @subpackage scripts |
||
| 485 | */ |
||
| 486 | |||
| 487 | lsx.wc_fix_messages_visual = function() { |
||
| 488 | $( |
||
| 489 | '.woocommerce-message,' + |
||
| 490 | '.woocommerce-info,' + |
||
| 491 | '.woocommerce-error,' + |
||
| 492 | '.woocommerce-noreviews,' + |
||
| 493 | '.woocommerce_message,' + |
||
| 494 | '.woocommerce_info,' + |
||
| 495 | '.woocommerce_error,' + |
||
| 496 | '.woocommerce_noreviews,' + |
||
| 497 | 'p.no-comments,' + |
||
| 498 | '.stock,' + |
||
| 499 | '.woocommerce-password-strength' ).each( function() { |
||
| 500 | var _$this = $( this ); |
||
| 501 | |||
| 502 | if ( 0 === _$this.find( '.button' ).length ) { |
||
| 503 | return; |
||
| 504 | } |
||
| 505 | |||
| 506 | _$this.wrapInner( '<div class="lsx-woocommerce-message-text"></div>' ); |
||
| 507 | _$this.addClass( 'lsx-woocommerce-message-wrap' ); |
||
| 508 | _$this.find( '.button' ).appendTo( _$this ); |
||
| 509 | } |
||
| 510 | ); |
||
| 511 | }; |
||
| 512 | |||
| 513 | /** |
||
| 514 | * Fix WC subscrive to replies checkbox visual. |
||
| 515 | * |
||
| 516 | * @package lsx |
||
| 517 | * @subpackage scripts |
||
| 518 | */ |
||
| 519 | |||
| 520 | lsx.wc_fix_subscribe_to_replies_checkbox = function() { |
||
| 521 | $( 'input[name="subscribe_to_replies"]' ).removeClass( 'form-control' ); |
||
| 522 | }; |
||
| 523 | |||
| 524 | /** |
||
| 525 | * Add to the WC Quick View modal the close button. |
||
| 526 | * |
||
| 527 | * @package lsx |
||
| 528 | * @subpackage scripts |
||
| 529 | */ |
||
| 530 | |||
| 531 | lsx.wc_add_quick_view_close_button = function() { |
||
| 532 | $( 'body' ).on( 'quick-view-displayed', function( event ) { |
||
| 533 | if ( 0 === $( '.pp_content_container' ).children( '.close' ).length ) { |
||
| 534 | $( '.pp_content_container' ).prepend( '<button type="button" class="close">×</button>' ); |
||
| 535 | } |
||
| 536 | } ); |
||
| 537 | |||
| 538 | $document.on( 'click', '.pp_content_container .close', function( e ) { |
||
| 539 | $.prettyPhoto.close(); |
||
| 540 | } ); |
||
| 541 | }; |
||
| 542 | |||
| 543 | /** |
||
| 544 | * Fix WC subscriptions empty message. |
||
| 545 | * |
||
| 546 | * @package lsx |
||
| 547 | * @subpackage scripts |
||
| 548 | */ |
||
| 549 | |||
| 550 | lsx.wc_fix_subscriptions_empty_message = function() { |
||
| 551 | if ( '' === $( '.first-payment-date' ).text() ) { |
||
| 552 | $( '.first-payment-date' ).remove(); |
||
| 553 | } |
||
| 554 | }; |
||
| 555 | |||
| 556 | /** |
||
| 557 | * On window resize. |
||
| 558 | * |
||
| 559 | * @package lsx |
||
| 560 | * @subpackage scripts |
||
| 561 | */ |
||
| 562 | $window.resize( function() { |
||
| 563 | |||
| 564 | windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; |
||
| 565 | windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; |
||
| 566 | |||
| 567 | } ); |
||
| 568 | |||
| 569 | /** |
||
| 570 | * On document ready. |
||
| 571 | * |
||
| 572 | * @package lsx |
||
| 573 | * @subpackage scripts |
||
| 574 | */ |
||
| 575 | $document.ready( function() { |
||
| 576 | |||
| 577 | lsx.navbar_toggle_handler(); |
||
| 578 | |||
| 579 | // lsx.fix_bootstrap_menus_touchstart(); |
||
| 580 | |||
| 581 | lsx.add_class_browser_to_html(); |
||
| 582 | lsx.add_class_sidebar_to_body(); |
||
| 583 | lsx.add_class_bootstrap_to_table(); |
||
| 584 | |||
| 585 | lsx.set_main_menu_as_fixed(); |
||
| 586 | |||
| 587 | lsx.search_form_prevent_empty_submissions(); |
||
| 588 | lsx.remove_gallery_img_width_height(); |
||
| 589 | |||
| 590 | lsx.init_wc_slider(); |
||
| 591 | lsx.fix_wc_elements(); |
||
| 592 | lsx.fix_caldera_form_modal_title(); |
||
| 593 | lsx.wc_footer_bar_toggle_handler(); |
||
| 594 | lsx.wc_fix_messages_visual(); |
||
| 595 | lsx.wc_fix_subscribe_to_replies_checkbox(); |
||
| 596 | lsx.wc_add_quick_view_close_button(); |
||
| 597 | lsx.wc_fix_subscriptions_empty_message(); |
||
| 598 | |||
| 599 | } ); |
||
| 600 | |||
| 601 | /** |
||
| 602 | * On window load. |
||
| 603 | * |
||
| 604 | * @package lsx |
||
| 605 | * @subpackage scripts |
||
| 606 | */ |
||
| 607 | $window.load( function() { |
||
| 608 | |||
| 609 | lsx.fix_bootstrap_menus_dropdown(); |
||
| 610 | lsx.fix_bootstrap_menus_dropdown_click(); |
||
| 611 | lsx.fix_lazyload_envira_gallery(); |
||
| 612 | |||
| 613 | lsx.set_search_form_effect_mobile(); |
||
| 614 | |||
| 615 | lsx.build_slider_lightbox(); |
||
| 616 | |||
| 617 | lsx.set_banner_effect_parallax(); |
||
| 618 | |||
| 619 | /* LAST CODE TO EXECUTE */ |
||
| 620 | $( 'body.preloader-content-enable' ).addClass( 'html-loaded' ); |
||
| 621 | |||
| 622 | } ); |
||
| 623 | |||
| 624 | } )( jQuery, window, document ); |
||
| 625 |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.