1/*! 2 * Additional Theme Methods 3 * 4 * Decibel 3.4.7 5 */ 6/* jshint -W062 */ 7 8/* global DecibelParams, DecibelUi, WVC, Cookies, Event, WVCParams, CountUp */ 9var Decibel = (function ($) { 10 "use strict"; 11 12 return { 13 initFlag: false, 14 isEdge: navigator.userAgent.match(/(Edge)/i) ? true : false, 15 isWVC: "undefined" !== typeof WVC, 16 isMobile: navigator.userAgent.match( 17 /(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i 18 ) 19 ? true 20 : false, 21 loaded: false, 22 hasScrolled: false, 23 menuSkin: "light", 24 debounceTimer: null, 25 debounceTime: 400, 26 27 /** 28 * Init all functions 29 */ 30 init: function () { 31 if (this.initFlag) { 32 return; 33 } 34 35 //WVC.fireAnimation = false, 36 37 //this.startPercent(); 38 39 var _this = this; 40 41 $(".site-content") 42 .find(".wvc-parent-row:first-of-type") 43 .addClass("first-section"); 44 45 this.offGridReleasesParallax(); 46 this.quickView(); 47 this.loginPopup(); 48 this.stickyProductDetails(); 49 //this.transitionCosmetic(); 50 this.WCQuantity(); 51 //this.stickyElements(); 52 this.singlePostNav(); 53 //this.tooltipsy(); 54 //this.interactiveLinks(); 55 this.releaseAnimatedCoverAnimationDelay(); 56 57 this.WcReviewLink(); 58 59 this.isMobile = DecibelParams.isMobile; 60 this.menuSkin = DecibelParams.menuSkin; 61 62 $(window).scroll(function () { 63 var scrollTop = $(window).scrollTop(); 64 _this.backToTopSkin(scrollTop); 65 //_this.transparentStickyMenuSkin( scrollTop ); 66 }); 67 68 this.initFlag = true; 69 }, 70 71 /** 72 * Off-grid releases parallax 73 */ 74 offGridReleasesParallax: function () { 75 if (!this.isWVC) { 76 return; 77 } 78 79 $(".entry-offgrid").each(function (index) { 80 var y = -120, 81 marginTop = 60, 82 smoothness = 50; 83 84 if (index % 2 === 0) { 85 y = 120; 86 marginTop = -60; 87 } 88 89 $(this) 90 .attr( 91 "data-parallax", 92 '{"y":' + y + ', "smoothness":' + smoothness + "}" 93 ) 94 .css({ 95 top: 60, 96 }) 97 .removeClass("wow"); 98 }); 99 }, 100 101 /** 102 * Tooltip 103 */ 104 tooltipsy: function () { 105 if (!this.isMobile) { 106 var $tipspan, 107 selectors = 108 ".product-quickview-button, .wolf_add_to_wishlist, .quickview-product-add-to-cart-icon"; 109 110 $(selectors).tooltipsy(); 111 112 $(document).on("added_to_cart", function ( 113 event, 114 fragments, 115 cart_hash, 116 $button 117 ) { 118 if ( 119 $button.hasClass("wvc-ati-add-to-cart-button") || 120 $button.hasClass("wpm-add-to-cart-button") || 121 $button.hasClass("wolf-release-add-to-cart") || 122 $button.hasClass("product-add-to-cart") 123 ) { 124 $tipspan = $button.find("span"); 125 126 $tipspan.data("tooltipsy").hide(); 127 $tipspan.data("tooltipsy").destroy(); 128 129 $tipspan.attr( 130 "title", 131 DecibelParams.l10n.addedToCart 132 ); 133 134 $tipspan.tooltipsy(); 135 $tipspan.data("tooltipsy").show(); 136 137 setTimeout(function () { 138 $tipspan.data("tooltipsy").hide(); 139 $tipspan.data("tooltipsy").destroy(); 140 $tipspan.attr( 141 "title", 142 DecibelParams.l10n.addToCart 143 ); 144 $tipspan.tooltipsy(); 145 146 $button.removeClass("added"); 147 }, 4000); 148 } 149 }); 150 } 151 }, 152 153 /** 154 * Product quickview 155 */ 156 quickView: function () { 157 $(document).on("added_to_cart", function ( 158 event, 159 fragments, 160 cart_hash, 161 $button 162 ) { 163 if ($button.hasClass("product-add-to-cart")) { 164 //console.log( 'good?' ); 165 $button.attr("href", DecibelParams.WooCommerceCartUrl); 166 $button 167 .find("span") 168 .attr("title", DecibelParams.l10n.viewCart); 169 $button.removeClass("ajax_add_to_cart"); 170 } 171 }); 172 }, 173 174 /** 175 * Sticky product layout 176 */ 177 stickyProductDetails: function () { 178 if ($.isFunction($.fn.stick_in_parent)) { 179 if ($("body").hasClass("sticky-product-details")) { 180 $(".entry-single-product .summary").stick_in_parent({ 181 offset_top: 182 parseInt( 183 DecibelParams.portfolioSidebarOffsetTop, 184 10 185 ) + 40, 186 }); 187 } 188 } 189 }, 190 191 /** 192 * WC login popup 193 */ 194 loginPopup: function () { 195 var $body = $("body"), 196 clicked = false;
197 198 $(document).on( 199 "click", 200 ".account-item-icon-user-not-logged-in, .close-loginform-button", 201 function (event) { 202 event.preventDefault(); 203 204 if ($body.hasClass("loginform-popup-toggle")) { 205 206 $body.removeClass("loginform-popup-toggle"); 207 208 } else { 209 210 $body.removeClass("overlay-menu-toggle"); 211 212 if ( $(".wvc-login-form").length || $(".wolf-core-login-form").length ) { 213 214 $body.addClass("loginform-popup-toggle"); 215 216 } else if ( ! clicked ) { 217 /* AJAX call */ 218 $.post( 219 DecibelParams.ajaxUrl, 220 { action: "decibel_ajax_get_wc_login_form" }, 221 function (response) { 222 //console.log(response); 223 224 if (response) { 225 $("#loginform-overlay-content").append( 226 response 227 ); 228 229 $body.addClass( 230 "loginform-popup-toggle" 231 ); 232 } 233 } 234 ); 235 } 236 } 237 } 238 ); 239 240 if (!this.isMobile) { 241 $(document).mouseup(function (event) { 242 if (1 !== event.which) { 243 return; 244 } 245 246 var $container = $("#loginform-overlay-content"); 247 248 if ( 249 !$container.is(event.target) && 250 $container.has(event.target).length === 0 251 ) { 252 $body.removeClass("loginform-popup-toggle"); 253 } 254 }); 255 } 256 }, 257 258 /** 259 * Custom product quantity styling 260 * 261 * https://stackoverflow.com/questions/48953897/create-a-custom-quantity-field-in-woocommerce 262 */ 263 WCQuantity: function () { 264 $(document).on("click", ".wt-quantity-minus", function (event) { 265 event.preventDefault(); 266 var $input = $(this).parent().find("input.qty"), 267 val = $input.val(), 268 step = $input.attr("step"); 269 step = "undefined" !== typeof step ? parseInt(step) : 1; 270 271 if (val > 1) { 272 $input.val(val - step).change(); 273 } else { 274 $input.val(0); 275 } 276 } ); 277 278 $(document).on("click", ".wt-quantity-plus", function (event) { 279 event.preventDefault(); 280 281 var $input = $(this).parent().find("input.qty"), 282 val = $input.val() ? parseInt($input.val(), 10) : 0, 283 step = $input.attr("step"); 284 step = "undefined" !== typeof step ? parseInt(step) : 1; 285 286 if ( "undefined" === typeof step || "" === step ) { 287 step = 1; 288 } 289 290 $input.val(val + step).change(); 291 } ); 292 }, 293 294 /** 295 * Sticky Portfolio Sidebar 296 */ 297 stickyElements: function () { 298 if ($.isFunction($.fn.stick_in_parent)) { 299 if ( 300 $("body").hasClass("wolf-share") || 301 ($("body").hasClass("single-post") && 302 !this.isMobile && 303 1300 > $(window).width()) 304 ) { 305 $(".wolf-share-buttons-container").stick_in_parent({ 306 offset_top: 66, 307 }); 308 } 309 } 310 }, 311 312 /** 313 * Overlay transition 314 */ 315 transitionCosmetic: function () { 316 $(document).on("click", ".internal-link:not(.disabled)", function ( 317 event 318 ) { 319 if (!event.ctrlKey) { 320 event.preventDefault(); 321 322 var $link = $(this); 323 324 $("body").removeClass( 325 "mobile-menu-toggle overlay-menu-toggle offcanvas-menu-toggle loginform-popup-toggle lateral-menu-toggle" 326 ); 327 $("body").addClass("loading transitioning"); 328 329 Cookies.set( 330 DecibelParams.themeSlug + "_session_loaded", 331 true, 332 { expires: null } 333 ); 334 335 if ($("#decibel-loading-logo").length) { 336 $("#decibel-loading-logo").one( 337 DecibelUi.transitionEventEnd(), 338 function () { 339 Cookies.remove( 340 DecibelParams.themeSlug + 341 "_session_loaded" 342 ); 343 window.location = $link.attr("href"); 344 } 345 ); 346 } else if ($("#decibel-loading-spinner").length) { 347 $("#decibel-loading-spinner").one( 348 DecibelUi.transitionEventEnd(), 349 function () { 350 Cookies.remove( 351 DecibelParams.themeSlug + 352 "_session_loaded" 353 ); 354 window.location = $link.attr("href"); 355 } 356 ); 357 } else if ($(".decibel-loader-overlay").length) { 358 $(".decibel-loader-overlay").one( 359 DecibelUi.transitionEventEnd(), 360 function () { 361 Cookies.remove( 362 DecibelParams.themeSlug + 363 "_session_loaded" 364 ); 365 window.location = $link.attr("href"); 366 } 367 ); 368 } else { 369 window.location = $link.attr("href"); 370 } 371 } 372 }); 373 }, 374 375 singlePostNav: function () { 376 $(".post-nav-link-overlay").on("mouseover", function () { 377 $(this).parent().addClass("nav-hover"); 378 }); 379 380 $(".post-nav-link-overlay").on("mouseout", function () { 381 $(this).parent().removeClass("nav-hover"); 382 }); 383 }, 384 385 /** 386 * Release animated cover transition delay 387 */ 388 releaseAnimatedCoverAnimationDelay: function () {
389 var delay = 400; 390 391 $(".release-display-animated_cover") 392 .find(".entry-release") 393 .each(function () { 394 $(this) 395 .find(".wvc-ad-disc-container") 396 .css({ 397 "transition-delay": delay / 1000 + "s", 398 }); 399 400 delay = delay + 200; 401 }); 402 }, 403 404 transparentStickyMenuSkin: function (scrollTop) { 405 if ( 406 scrollTop < DecibelParams.stickyMenuScrollPoint || 407 "none" === DecibelParams.stickyMenuType 408 ) { 409 return; 410 } 411 412 var $body = $("body"); 413 414 if ($(".wvc-row-visible").first().hasClass("wvc-font-light")) { 415 $body.addClass("menu-skin-dark"); 416 } else { 417 $body.removeClass("menu-skin-dark"); 418 } 419 }, 420 421 /** 422 * Check back to top color 423 */ 424 backToTopSkin: function (scrollTop) { 425 var $button = $("#back-to-top"), 426 $body = $("body"); 427 428 if ( 429 !$button.length || 430 $("body").hasClass("wvc-scrolling") || 431 $("body").hasClass("scrolling") 432 ) { 433 return; 434 } 435 436 if (scrollTop < 550 || this.isMobile) { 437 $button.removeClass("back-to-top-light"); 438 return; 439 } 440 441 if ($(".wvc-row-visible").last().hasClass("wvc-font-light")) { 442 $button.addClass("back-to-top-light"); 443 } else { 444 $button.removeClass("back-to-top-light"); 445 } 446 }, 447 448 /** 449 * IL carousel 450 */ 451 interactiveLinks: function () { 452 var $carousel = $(".wvc-interactive-links-content"); 453 454 $carousel 455 .flickity({ 456 freeScroll: true, 457 prevNextButtons: false, 458 pageDots: false, 459 groupCells: true, 460 //wrapAround: true, 461 cellSelector: ".wvc-interactive-link-item", 462 463 // Disable lightbox on drag 464 }) 465 .on("dragStart.flickity", function () { 466 $carousel.find("a").addClass("wvc-disabled"); 467 }) 468 .on("dragEnd.flickity", function () { 469 setTimeout(function () { 470 $carousel.find("a").removeClass("wvc-disabled"); 471 }, 1000); // wait before re-enabling link 472 }); 473 }, 474 475 WcReviewLink : function () { 476 $(".woocommerce-review-link").on("click", function () { 477 $( '.review-accordion-link' ).trigger( 'click' ); 478 DecibelUi.smoothScroll('#wvc-wc-accordion'); 479 }); 480 }, 481 482 reveal: function () { 483 var _this = this; 484 485 $("body").addClass("loaded reveal"); 486 _this.fireContent(); 487 }, 488 489 /** 490 * Page Load 491 */ 492 loadingAnimation: function () { 493 var _this = this, 494 delay = 50; 495 496 if ( 497 $("#decibel-loading-spinner").length || 498 $("#decibel-loading-logo").length 499 ) { 500 return; 501 } 502 503 setTimeout(function () { 504 $("body").addClass("loaded"); 505 506 if ($(".decibel-loader-overlay").length) { 507 $("body").addClass("reveal"); 508 509 $(".decibel-loader-overlay").one( 510 DecibelUi.transitionEventEnd(), 511 function () { 512 _this.fireContent(); 513 514 setTimeout(function () { 515 $("body").addClass("one-sec-loaded"); 516 }, 100); 517 } 518 ); 519 } else { 520 $("body").addClass("reveal"); 521 522 _this.fireContent(); 523 524 setTimeout(function () { 525 $("body").addClass("one-sec-loaded"); 526 }, 100); 527 } 528 }, delay); 529 }, 530 531 fireContent: function () { 532 var _this = this; 533 534 // Animate 535 $(window).trigger("page_loaded"); 536 DecibelUi.wowAnimate(); 537 538 //console.log( 'page_loaded' ); 539 540 window.dispatchEvent(new Event("resize")); 541 window.dispatchEvent(new Event("scroll")); // Force WOW effect 542 $(window).trigger("just_loaded"); 543 $("body").addClass("one-sec-loaded"); 544 }, 545 }; 546})(jQuery); 547 548(function ($) { 549 "use strict"; 550 551 $(document).ready(function () { 552 Decibel.init(); 553 }); 554 555 $(window).on('pageshow', function() { 556 //Decibel.loadingAnimation(); 557 }); 558 559 $(window).on("wolf_ajax_loaded", function () { 560 //Decibel.loadingAnimation(); 561 }); 562})(jQuery);
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.