1(function ($) { 2 const $html = $('html'); 3 4 // lazyload images 5 Journal.lazy('image', '.lazyload', { 6 loaded: function (el) { 7 el.classList.add('lazyloaded'); 8 } 9 }); 10 11 // tooltips 12 if (Journal['isDesktop']) { 13 Journal.lazy('tooltip', '[data-toggle="tooltip-hover"]', { 14 load: function (el) { 15 const $el = $(el); 16 17 $el.tooltip({ container: 'body' }); 18 } 19 }); 20 } 21 22 // tooltip class 23 $(document).on('show.bs.tooltip', function (e) { 24 const $el = $(e.target); 25 26 $el.attr('title', ''); 27 $el.data('tooltipClass') && $el.data('bs.tooltip').$tip.addClass($el.data('tooltipClass')); 28 }); 29 30 // dropdowns 31 Journal.lazy('dropdown', '[data-toggle="dropdown"]', { 32 load: function (el) { 33 const $el = $(el); 34 35 $el.attr('data-toggle', 'dropdown-hover'); 36 } 37 }); 38 39 // dropdowns clear 40 function clear_dropdowns() { 41 const $trigger = $('> .dropdown-toggle', this); 42 const $dropdown = $(this); 43 const relatedTarget = { relatedTarget: $trigger[0] }; 44 45 $dropdown.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)); 46 47 if (e.isDefaultPrevented()) { 48 return; 49 } 50 51 $dropdown.removeClass('open'); 52 $trigger.attr('aria-expanded', 'true'); 53 54 $dropdown.trigger(e = $.Event('hidden.bs.dropdown', relatedTarget)); 55 } 56 57 // dropdown toggle 58 $(document).on('click', '[data-toggle="dropdown-hover"]', function (e) { 59 const $trigger = $(this); 60 const $dropdown = $(this).closest('.dropdown'); 61 const relatedTarget = { relatedTarget: $trigger[0] }; 62 const isOpen = $dropdown.hasClass('open'); 63 const isLink = $trigger.attr('href') && !$trigger.attr('href').startsWith('javascript:;'); 64 65 if (isOpen && isLink) { 66 return; 67 } 68 69 e.preventDefault(); 70 e.stopPropagation(); 71 72 if (!isOpen) { 73 $dropdown.trigger(e = $.Event('show.bs.dropdown', relatedTarget)); 74 75 if (e.isDefaultPrevented()) { 76 return; 77 } 78 79 $('.dropdown.open').not($dropdown).not($dropdown.parents('.dropdown')).each(clear_dropdowns); 80 81 $dropdown.addClass('open'); 82 $trigger.attr('aria-expanded', 'false'); 83 84 $dropdown.trigger(e = $.Event('shown.bs.dropdown', relatedTarget)); 85 } else { 86 $dropdown.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)); 87 88 if (e.isDefaultPrevented()) { 89 return; 90 } 91 92 $dropdown.removeClass('open'); 93 $trigger.attr('aria-expanded', 'true'); 94 95 $dropdown.trigger(e = $.Event('hidden.bs.dropdown', relatedTarget)); 96 } 97 }); 98 99 // dropdown clear 100 $(document).on('click', function (e) { 101 $('.dropdown.open').not($(e.target).parents('.dropdown')).each(clear_dropdowns); 102 }); 103 104 // dropdown on hover 105 if (Journal['isDesktop']) { 106 function dropdownOver(e) { 107 if (Journal['isTouch']) { 108 return; 109 } 110 111 const $trigger = $('> .dropdown-toggle', this); 112 const $dropdown = $(this); 113 const relatedTarget = { relatedTarget: $trigger[0] }; 114 115 $dropdown.trigger(e = $.Event('show.bs.dropdown', relatedTarget)); 116 117 if (e.isDefaultPrevented()) { 118 return; 119 } 120 121 $dropdown.addClass('open'); 122 $trigger.attr('aria-expanded', 'false'); 123 124 $dropdown.trigger(e = $.Event('shown.bs.dropdown', relatedTarget)); 125 } 126 127 function dropdownOut(e) { 128 if (Journal['isTouch']) { 129 return; 130 } 131 132 const $trigger = $('> .dropdown-toggle', this); 133 const $dropdown = $(this); 134 const relatedTarget = { relatedTarget: $trigger[0] }; 135 136 $dropdown.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)); 137 138 if (e.isDefaultPrevented()) { 139 return; 140 } 141 142 $dropdown.removeClass('open'); 143 $trigger.attr('aria-expanded', 'true'); 144 145 $dropdown.trigger(e = $.Event('hidden.bs.dropdown', relatedTarget)); 146 } 147 148 $(document).hoverIntent({ 149 over: dropdownOver, 150 out: dropdownOut, 151 selector: '.dropdown:not([data-overlay]):not(.search-dropdown-page):not(.dropdown .dropdown)' 152 }); 153 154 $(document).on('mouseenter', '.dropdown .dropdown', dropdownOver); 155 $(document).on('mouseleave', '.dropdown .dropdown', dropdownOut); 156 } 157 158 // show animation 159 $(document).on('shown.bs.dropdown', function (e) { 160 const $dropdown = $(e.target); 161 162 $dropdown.outerWidth(); 163 $dropdown.addClass('animating'); 164 }); 165 166 $(document).on('hidden.bs.dropdown', function (e) { 167 const $dropdown = $(e.target); 168 169 $dropdown.removeClass('animating'); 170 }); 171 172 // dropdown templates + color scheme 173 $(document).on('show.bs.dropdown', function (e) { 174 const el = $(e.target).find('template')[0] || $(' > template', e.target)[0]; 175 176 if (Journal['mobile_header_active']) { 177 if (Journal['header_mobile_dropdown_color_scheme']) { 178 const menu = $(e.target).find('.dropdown-menu')[0] || $(' > .dropdown-menu', e.target)[0]; 179 if (!$(menu).is('[class*="color-scheme-"]')) { 180 menu.classList.add(Journal['header_mobile_dropdown_color_scheme']); 181 } 182 } 183 } else { 184 if (Journal['header_dropdown_color_scheme']) { 185 const menu = $(e.target).find('.dropdown-menu')[0] || $(' > .dropdown-menu', e.target)[0]; 186 if (!$(menu).is('[class*="color-scheme-"]')) { 187 menu.classList.add(Journal['header_dropdown_color_scheme']); 188 } 189 } 190 } 191 192 if (el) { 193 Journal.template(el); 194 Journal.lazy(); 195 } 196 }); 197 198 $(document).on('shown.bs.dropdown', function (e) { 199 const $el = $(e.target); 200 if ($el.data('open-color-scheme')) { 201 $el.addClass($el.data('open-color-scheme')); 202 } 203 }); 204 205 $(document).on('hidden.bs.dropdown', function (e) { 206 const $el = $(e.target); 207 if ($el.data('open-color-scheme')) { 208 $el.removeClass($el.data('open-color-scheme')); 209 } 210 }); 211 212 // popover class 213 $(document).on('show.bs.popover', function (e) { 214 const $el = $(e.target); 215 216 $el.data('popoverClass') && $el.data('bs.popover').$tip.addClass($el.data('popoverClass')); 217 }); 218 219 // datepicker class 220 $(document).on('dp.show', function (e) { 221 const $el = $(e.target); 222 223 $el.data('pickerClass') && $el.data('DateTimePicker').widget.addClass($el.data('pickerClass')); 224 }); 225 226 // panel-active class 227 $(document).on('show.bs.collapse', function (e) { 228 $(e.target).parent().addClass('panel-active'); 229 }); 230 231 $(document).on('hide.bs.collapse', function (e) { 232 $(e.target).parent().removeClass('panel-active'); 233 }); 234 235 // panel templates 236 $(document).on('show.bs.collapse', function (e) { 237 const el = $(e.target).find('template')[0]; 238 239 if (el) { 240 Journal.template(el); 241 Journal.lazy(); 242 } 243 }); 244 245 // tabs templates 246 $(document).on('show.bs.tab', function (e) { 247 const href = $(e.target).attr('href'); 248 const el = $(href).filter('template')[0]; 249 250 if (el) { 251 Journal.template(el); 252 Journal.lazy(); 253 } 254 }); 255 256 // off canvas 257 $(document).on('click', '[data-off-canvas]', function (e) { 258 e.preventDefault(); 259 260 const $this = $(this); 261 const $container = $('.' + $this.data('off-canvas')); 262 263 if (Journal['header_offcanvas_color_scheme']) { 264 $container[0].classList.add('has-color-scheme', Journal['header_offcanvas_color_scheme']); 265 } 266 267 const el = $container.find('template')[0]; 268 269 if (el) { 270 Journal.template(el); 271 Journal.lazy(); 272 } 273 274 $html.addClass('mobile-overlay'); 275 $html.addClass($this.data('off-canvas') + '-open'); 276 277 $container.outerWidth(); 278 $container.addClass('animating');
279 //$('.desktop-mobile-main-menu-container .main-menu-item-1 .collapse').addClass('in'); 280 //$('.desktop-mobile-main-menu-wrapper .main-menu .open-menu').attr('aria-expanded', true) 281 282 if ($this.data('off-canvas') === 'mobile-main-menu-container') { 283 Journal.mobileOffCanvasDropdownOffset && Journal.mobileOffCanvasDropdownOffset(); 284 } 285 }); 286 287 $(document).on('click', '.mobile-overlay .site-wrapper, .x', function () { 288 const $this = $(this); 289 290 $('.mobile-container.animating').removeClass('animating'); 291 292 $html.removeClass('mobile-overlay'); 293 294 setTimeout(function () { 295 $('[data-off-canvas]').each(function () { 296 const $this = $(this); 297 $html.removeClass($this.data('off-canvas') + '-open'); 298 }); 299 }, 300); 300 }); 301 302 // accordion menus 303 $(document).on('click', '.accordion-menu span[data-toggle="collapse"]', function (e) { 304 return false; 305 }); 306 307 // accordion menus first tap open 308 $(document).on('click', '.accordion-menu a', function (e) { 309 const $this = $(this); 310 const $trigger = $('> span[data-toggle="collapse"]', this); 311 const isLink = $this.attr('href') && !$this.attr('href').startsWith('javascript:'); 312 313 if (Journal['isDesktop'] && isLink) { 314 return; 315 } 316 317 if ($trigger.length && (!isLink || $trigger.attr('aria-expanded') !== 'true')) { 318 e.preventDefault(); 319 320 $trigger.trigger('click'); 321 } 322 }); 323 324 // grid dimensions 325 if (Journal['isDesktop'] && Journal['isAdmin']) { 326 Journal.lazy('dimensions', '.grid-col', { 327 load: function (el) { 328 $(el).one('mouseover', function () { 329 const $this = $(this); 330 $this.attr('data-dimensions', $this.width() + ' x ' + $this.height() + ' (Admin Only)'); 331 }); 332 } 333 }); 334 } 335 336 // admin edit 337 if (Journal['isDesktop'] && Journal['isAdmin']) { 338 $(document).on('click', '[data-edit]', function () { 339 window['__j_edited'] = false; 340 const src = Journal.admin_url + '#/' + $(this).data('edit'); 341 342 $('.admin-edit-popup').remove(); 343 344 $html.addClass('is-editor-open'); 345 346 $('body').append('' + 347 '<div class="admin-edit-popup">' + 348 ' <div class="journal-loading"><em class="fa fa-spinner fa-spin"></em></div>' + 349 ' <button class="admin-close-edit" type="button">×</button>' + 350 ' <iframe src="' + src + '" onload="$(\'.admin-edit-popup .journal-loading\').remove()" />' + 351 '</div>'); 352 }); 353 354 $(document).on('click', '.admin-close-edit', function () { 355 if (window['__j_edited']) { 356 window.location.reload(); 357 } else { 358 $html.removeClass('is-editor-open'); 359 $('.admin-edit-popup').remove(); 360 } 361 }); 362 363 $(document).on('click', '.admin-close-bar', function () { 364 $(this).tooltip('hide'); 365 $html.toggleClass('admin-bar-visible'); 366 window.localStorage.setItem('j-editor', $html.hasClass('admin-bar-visible') ? 'visible' : 'hidden'); 367 }); 368 } 369 370 // load deferred inline scripts 371 if (Journal['performanceJSDefer']) { 372 $('script[type="text/javascript/defer"]').each(function () { 373 $(this).after($('<script type="text/javascript"/>').text($(this).clone().text())).remove(); 374 }); 375 } 376 377 // open popup links in new tab 378 if (Journal['isLoginPopup'] || Journal['isRegisterPopup'] || Journal['isQuickviewPopup'] || Journal['isOptionsPopup']) { 379 $('a[href]').each(function () { 380 const $this = $(this); 381 382 if (!$this.attr('target')) { 383 $this.attr('target', '_blank'); 384 } 385 386 if (!Journal['isDesktop']) { 387 $this.removeClass('agree'); 388 } 389 }); 390 } 391 392 // smoothscroll 393 if (!('scrollBehavior' in document.documentElement.style)) { 394 Journal.load(Journal['assets']['smoothscroll'], 'smoothscroll'); 395 } 396 397 // anchors scroll 398 $(document).on('click', '[data-scroll-to]', function (e) { 399 e.preventDefault(); 400 401 $($(this).data('scroll-to'))[0].scrollIntoView({ behavior: 'smooth' }); 402 }); 403 404 // scroll top 405 if (Journal['scrollTop']) { 406 let scrollTopTimeout; 407 408 $(window).on('scroll', function () { 409 const scroll = $(this)[0].scrollY; 410 411 clearTimeout(scrollTopTimeout); 412 413 if (scroll > 500) { 414 $('.scroll-top').addClass('scroll-top-active'); 415 416 scrollTopTimeout = setTimeout(function () { 417 $('.scroll-top').removeClass('scroll-top-active'); 418 }, 3000); 419 } else { 420 $('.scroll-top').removeClass('scroll-top-active'); 421 } 422 }); 423 424 $('.scroll-top').on('click', function () { 425 window.scrollTo({ top: 0, behavior: 'smooth' }); 426 }); 427 } 428 429 // Module Blocks 430 $(document).on('click', '.block-expand', function () { 431 $(this).closest('.expand-block').find('.expand-content').toggleClass('block-expanded'); 432 }); 433 434 $('.block-map iframe').on('load', function () { 435 $('.block-map .journal-loading').hide(); 436 }); 437 438 // ripple effect
439 if (Journal['rippleStatus'] && Journal['rippleSelectors']) { 440 Journal.lazy('ripple', Journal['rippleSelectors'], { 441 load: function (el) { 442 const ripple = document.createElement('small'); 443 444 el.classList.add('ripple'); 445 el.appendChild(ripple); 446 el.addEventListener('click', function (e) { 447 e = e.touches ? e.touches[0] : e; 448 const r = el.getBoundingClientRect(), d = Math.sqrt(Math.pow(r.width, 2) + Math.pow(r.height, 2)) * 2; 449 el.style.cssText = `--s: 0; --o: 1;`; 450 el.offsetTop; 451 el.style.cssText = `--t: 1; --o: 0; --d: ${d}; --x:${e.clientX - r.left}; --y:${e.clientY - r.top};` 452 }); 453 } 454 }); 455 } 456 457 // fix Opencart name attribute html5 validator issue (replace name with data-name) 458 $(function () { 459 $('#form-currency .currency-select').off('click').on('click', function (e) { 460 e.preventDefault(); 461 462 $('#form-currency input[name=\'code\']').val($(this).data('name')); 463 464 $('#form-currency').submit(); 465 }); 466 467 // Language 468 if (Journal['ocv'] !== 4) { 469 $('#form-language .language-select').off('click').on('click', function (e) { 470 e.preventDefault(); 471 472 $('#form-language input[name=\'code\']').val($(this).data('name')); 473 474 $('#form-language').submit(); 475 }); 476 } 477 }); 478 479 // popup 480 $(document).delegate('[data-open-popup]', 'click', function (e) { 481 const $template = $($(this).data('open-popup')); 482 483 // show modal 484 $('.popup-wrapper').remove(); 485 486 $('body').append($template.html()); 487 488 setTimeout(function () { 489 $('html').addClass('popup-open popup-center'); 490 Journal.lazy(); 491 }, 10); 492 }); 493 494 // popup close oc4 495 $(document).delegate('[data-bs-dismiss="modal"]', 'click', function (e) { 496 $(e.target).closest('.modal').modal('hide'); 497 }); 498 499 // flyout menu offset 500 function flyoutOffset(el) { 501 el.style.setProperty('--element-top-offset', el.getBoundingClientRect().top + 'px'); 502 } 503 504 $(document).on('shown.bs.dropdown', function (e) { 505 const $parent = $(e.relatedTarget).parent(); 506 507 if ($parent.hasClass('flyout-menu-item')) { 508 const $dropdown = $('> .j-dropdown', $parent); 509 510 flyoutOffset($dropdown[0]); 511 } 512 }); 513 514 $(window).on('scroll', function () { 515 if (!Journal['mobile_header_active']) { 516 document.querySelectorAll('.flyout-menu > .j-menu > .flyout-menu-item.mega-menu > .j-dropdown').forEach(flyoutOffset); 517 } 518 }); 519})(jQuery); 520 521(function ($) { 522 // title h1 third party extensions 523 $('#content > h1').addClass('title page-title'); 524})(jQuery); 525 526// @todo check the following 527 528(function ($) { 529 var $html = $('html'); 530 var $body = $('body'); 531 532 $(document).delegate('.btn-extra', 'click', function () { 533 parent.window.__popup_url = $(this).data('product_url') || ''; 534 }); 535 536 // Main Menu Hover Site Overlay 537 538 var $desktop_main_menu_wrapper = $('.desktop-main-menu-wrapper'); 539 var $desktop_cart_wrapper = $('.desktop-cart-wrapper'); 540 var $desktop_search_wrapper = $('.desktop-search-wrapper'); 541 542 $desktop_main_menu_wrapper.delegate('.main-menu > .j-menu > .dropdown', 'mouseover', function () { 543 $body.addClass('menu-open'); 544 }); 545 546 $desktop_main_menu_wrapper.delegate('.main-menu', 'mouseleave', function () { 547 $body.removeClass('menu-open'); 548 }); 549 550 $desktop_cart_wrapper.delegate('#cart', 'mouseover', function () { 551 $body.addClass('cart-open'); 552 }); 553 554 $desktop_cart_wrapper.delegate('#cart', 'mouseleave', function () { 555 $body.removeClass('cart-open'); 556 }); 557 558 $desktop_search_wrapper.delegate('.search-categories', 'mouseover', function () { 559 $body.addClass('search-open'); 560 }); 561 562 $desktop_search_wrapper.delegate('.search-categories', 'mouseleave', function () { 563 $body.removeClass('search-open'); 564 }); 565 566 567 // $desktop_main_menu_wrapper.delegate('.main-menu > .j-menu > .mega-menu', 'mouseover', function () { 568 // $(this).addClass('animation-delay'); 569 // }); 570 // 571 // $desktop_main_menu_wrapper.delegate('.main-menu > .j-menu > .mega-menu', 'mouseleave', function () { 572 // var $this = $(this); 573 // setTimeout(function () { 574 // $this.removeClass('animation-delay'); 575 // }, 250); 576 // }); 577 578 //$('head').append('<style>.desktop-main-menu-wrapper .menu-item.dropdown::before {height: ' + ($body.height() - $('header').height()) + 'px} </style>'); 579 580 //Footer Links module collapse 581 $('.links-menu .module-title').addClass('closed'); 582 583 $('.links-menu .module-title').click(function () { 584 $(this).toggleClass('closed'); 585 }); 586 587 // Popup scroll from outside 588 const target = document.querySelector(Journal['isPopup'] ? 'html' : '.popup-inner-body > .grid-rows'); 589 590 if (target && parent.document.documentElement.classList.contains('popup-open')) { 591 parent.document.addEventListener('wheel', function (event) { 592 target.scrollTop += event.deltaY; 593 }); 594 } 595 596 if (Journal['isOptionsPopup']) { 597 const $el = document.querySelector('.popup-options .button-group-page'); 598 599 document.documentElement.style.setProperty('--popup-fixed-buttons', `${$el ? $el.offsetHeight : 0}px`); 600 } 601 602 if (Journal['isQuickviewPopup']) { 603 const $el = document.querySelector('.popup-quickview .button-group-page'); 604 605 document.documentElement.style.setProperty('--popup-fixed-buttons', `${$el ? $el.offsetHeight : 0}px`); 606 } 607 608 // Manufacturer index height 609 if (document.documentElement.classList.contains('route-product-manufacturer')) { 610 const $el = document.querySelector('.brand-index'); 611 612 document.documentElement.style.setProperty('--brand-index-height', `${$el ? $el.offsetHeight : 0}px`); 613 } 614 615 // Product page fixed buttons height 616 if (document.documentElement.classList.contains('route-product-product')) { 617 const $el = document.querySelector('.button-group-page'); 618 619 document.documentElement.style.setProperty('--fixed-product-buttons', `${$el ? $el.offsetHeight : 0}px`); 620 } 621 622 //Page buttons dual agree class 623 if (document.querySelectorAll('.buttons > div').length > 1 && document.querySelectorAll('.buttons > div > .agree').length > 0) { 624 document.querySelector('.buttons').classList.add('dual-agree'); 625 } 626 $(function () { 627 $('.product-img, .product-image img').hover(function (e) { 628 $(this).attr('data-title', $(this).attr('title')); 629 $(this).removeAttr('title'); 630 }, 631 function (e) { 632 $(this).attr('title', $(this).attr('data-title')); 633 }); 634 }); 635 636 $('#information-information #content table').each(function () { 637 $(this).wrap('<div class="table-responsive"></div>') 638 }); 639 640})(jQuery); 641 642(function ($) { 643 var $html = $('html'); 644 var $body = $('body'); 645 646 if ($html.hasClass('footer-reveal')) { 647 var footerHeight = $('.desktop.footer-reveal footer').outerHeight(); 648 $('.desktop body').css('padding-bottom', footerHeight); 649 } 650})(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.