1/** 2* 2007-2015 PrestaShop 3* 4* NOTICE OF LICENSE 5* 6* This source file is subject to the Academic Free License (AFL 3.0) 7* that is bundled with this package in the file LICENSE.txt. 8* It is also avaiposle through the world-wide-web at this URL: 9* http://opensource.org/licenses/afl-3.0.php 10* If you did not receive a copy of the license and are unable to 11* obtain it through the world-wide-web, please send an email 12* to [email protected] so we can send you a copy immediately. 13* 14* DISCLAIMER 15* 16* Do not edit or add to this file if you wish to upgrade PrestaShop to newer 17* versions in the future. If you wish to customize PrestaShop for your 18* needs please refer to http://www.prestashop.com for more information. 19* 20* @author PrestaShop SA <[email protected]> 21* @copyright 2007-2015 PrestaShop SA 22* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 23* International Registered Trademark & Property of PrestaShop SA 24* 25* Don't forget to prefix your containers with your own identifier 26* to avoid any conflicts with others containers. 27*/ 28 29$(document).ready(function() 30{ 31 activeMobile(); 32 $(window).resize(function(){ 33 if($(window).width() < 992) 34 { 35 $('.pos-menu-horizontal').addClass('pos-mobile-menu'); 36 $('#_mobile_megamenu img').parent('a').addClass("img_banner"); 37 $('.pos-mobile-menu').removeClass('container'); 38 } 39 else 40 { 41 $('.pos-menu-horizontal').removeClass('pos-mobile-menu'); 42 $('.pos-menu-horizontal .menu-dropdown').show(); 43 } 44 45 46 }); 47 48 posInitHorizontalMegamenu(); 49 50 $('#_desktop_megamenu img').parent('a').addClass("img_desktop"); 51 $('#_mobile_megamenu img').parent('a').addClass("img_banner"); 52 window.top.ceFrontend.hooks.addAction('frontend/element_ready/widget', function($scope, $) { 53 var widget = $scope.data('element_type'); 54 55 if (widget == 'pos_menu.default') { 56 posInitHorizontalMegamenu(); 57 } 58 }); 59}); 60function posInitHorizontalMegamenu() { 61 var $menuHorizontal = $('.pos-menu-horizontal'); 62 var $list = $menuHorizontal.find('li.hasChild'); 63 64 $list.hover(function() { 65 setOffset($(this)) 66 }); 67 var setOffset = function($li) { 68 var $dropdown = $li.find('.menu-dropdown'); 69 if($dropdown.hasClass('cat-drop-menu')){ 70 return; 71 } 72 $dropdown.css({ 73 'right': '', 74 'left': '', 75 'width': $dropdown.data('width') 76 }); 77 78 var dropdownWidth = $dropdown.outerWidth(); 79 var dropdownOffset = $dropdown.offset(); 80 var toRight; 81 var viewportWidth; 82 var dropdownOffsetRight; 83 var $window = $(window); 84 var $body = $('body'); 85 var screenWidth = $window.width(); 86 if (!dropdownWidth || !dropdownOffset) { 87 return 88 } 89 if (dropdownWidth > screenWidth) { 90 dropdownWidth = screenWidth 91 } 92 $dropdown.css({ 93 'width': dropdownWidth 94 }); 95 if ($li.hasClass('hasChild') && dropdownWidth > 1200) { 96 viewportWidth = $window.width(); 97 if (dropdownOffset.left + dropdownWidth >= viewportWidth) { 98 toRight = dropdownOffset.left + dropdownWidth - viewportWidth; 99 $dropdown.css({ 100 left: -toRight 101 }) 102 } 103 $li.addClass('menu_initialized') 104 } else if ($li.hasClass('dropdown-mega')) { 105 viewportWidth = $('#header .elementor-container').innerWidth(); 106 dropdownOffsetRight = viewportWidth - dropdownOffset.left - dropdownWidth; 107 var extraSpace = 0; 108 var containerOffset = ($window.width() - viewportWidth) / 2; 109 var dropdownOffsetLeft; 110 if (dropdownWidth >= viewportWidth) { 111 extraSpace = (viewportWidth - dropdownWidth) / 2 112 } 113 dropdownOffsetLeft = dropdownOffset.left - containerOffset; 114 if (dropdownOffsetLeft + dropdownWidth >= viewportWidth) { 115 toRight = dropdownOffsetLeft + dropdownWidth - viewportWidth; 116 $dropdown.css({ 117 left: -toRight - extraSpace -10 118 }) 119 } 120 121 $li.addClass('menu_initialized') 122 } else { 123 $li.addClass('menu_initialized') 124 } 125 }; 126 $list.each(function() { 127 setOffset($(this)) 128 }) 129} 130function activeMobile(){ 131 $('.pos-menu-horizontal .menu-item > .icon-drop-mobile').on('click', function(){ 132 if($(this).hasClass('open_menu')) { 133 $('.pos-menu-horizontal .menu-item > .icon-drop-mobile').removeClass( 'open_menu' ); 134 $(this).removeClass( 'open_menu' );
135 $(this).next('.pos-menu-horizontal .menu-dropdown').slideUp(); 136 $('.pos-menu-horizontal .menu-item > .icon-drop-mobile').next('.pos-menu-horizontal .menu-dropdown').slideUp(); 137 } 138 else { 139 $('.pos-menu-horizontal .menu-item > .icon-drop-mobile').removeClass( 'open_menu' ); 140 $('.pos-menu-horizontal .menu-item > .icon-drop-mobile').next('.pos-menu-horizontal .menu-dropdown').slideUp(); 141 $(this).addClass( 'open_menu' ); 142 $(this).next('.pos-menu-horizontal .menu-dropdown').slideDown(); 143 144 } 145 146 }); 147 $('.pos-menu-horizontal .cat-drop-menu .icon-drop-mobile').on('click', function(){ 148 if($(this).hasClass('open_menu')) { 149 $(this).parent().siblings().find('.icon-drop-mobile').removeClass( 'open_menu' ); 150 $(this).removeClass( 'open_menu' ); 151 $(this).next('.pos-menu-horizontal .cat-drop-menu').slideUp(); 152 $(this).parent().siblings().find('.cat-drop-menu').slideUp(); 153 } 154 else { 155 $(this).parent().siblings().find('.icon-drop-mobile').removeClass( 'open_menu' ); 156 $(this).parent().siblings().find('.cat-drop-menu').slideUp(); 157 $(this).addClass( 'open_menu' ); 158 $(this).next('.pos-menu-horizontal .cat-drop-menu').slideDown(); 159 160 } 161 162 }); 163 $('.pos-menu-horizontal .pos-menu-col > .icon-drop-mobile').on('click', function(){ 164 if($(this).hasClass('open_menu')) { 165 $('.pos-menu-horizontal .pos-menu-col > .icon-drop-mobile').removeClass( 'open_menu' ); 166 $(this).removeClass( 'open_menu' ); 167 $(this).next('.pos-menu-horizontal ul.ul-column').slideUp(); 168 $('.pos-menu-horizontal .pos-menu-col > .icon-drop-mobile').next('.pos-menu-horizontal ul.ul-column').slideUp(); 169 } 170 else { 171 $('.pos-menu-horizontal .pos-menu-col > .icon-drop-mobile').removeClass( 'open_menu' ); 172 $('.pos-menu-horizontal .pos-menu-col > .icon-drop-mobile').next('.pos-menu-horizontal ul.ul-column').slideUp(); 173 $(this).addClass( 'open_menu' ); 174 $(this).next('.pos-menu-horizontal ul.ul-column').slideDown(); 175 176 } 177 178 }); 179 $('.pos-menu-horizontal .submenu-item > .icon-drop-mobile').on('click', function(){ 180 if($(this).hasClass('open_menu')) { 181 $('.pos-menu-horizontal .submenu-item > .icon-drop-mobile').removeClass( 'open_menu' ); 182 $(this).removeClass( 'open_menu' ); 183 $(this).next('.pos-menu-horizontal ul.category-sub-menu').slideUp(); 184 $('.pos-menu-horizontal .submenu-item > .icon-drop-mobile').next('.pos-menu-horizontal ul.category-sub-menu').slideUp(); 185 } 186 else { 187 $('.pos-menu-horizontal .submenu-item > .icon-drop-mobile').removeClass( 'open_menu' ); 188 $('.pos-menu-horizontal .submenu-item > .icon-drop-mobile').next('.pos-menu-horizontal ul.category-sub-menu').slideUp(); 189 $(this).addClass( 'open_menu' ); 190 $(this).next('.pos-menu-horizontal ul.category-sub-menu').slideDown(); 191 192 } 193 }); 194 195 196}
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.