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 available 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 26var responsiveflagMenu = false; 27var categoryMenu = $('ul.sf-menu'); 28var mCategoryGrover = $('.sf-contener .cat-title'); 29 30$(document).ready(function(){ 31 categoryMenu = $('ul.sf-menu'); 32 mCategoryGrover = $('.sf-contener .cat-title'); 33 responsiveMenu(); 34 $(window).resize(responsiveMenu); 35}); 36 37// check resolution 38function responsiveMenu() 39{ 40 if ($(document).width() <= 991 && responsiveflagMenu == false) 41 { 42 menuChange('enable'); 43 responsiveflagMenu = true; 44 } 45 else if ($(document).width() >= 992) 46 { 47 menuChange('disable'); 48 responsiveflagMenu = false;
49 } 50} 51 52// init Super Fish Menu for 991px+ resolution 53function desktopInit() 54{ 55 mCategoryGrover.off(); 56 mCategoryGrover.removeClass('active'); 57 $('.sf-menu > li ul').removeClass('menu-mobile').parent().find('.menu-mobile-grover').remove(); 58 $('.sf-menu').removeAttr('style'); 59 categoryMenu.superfish('init'); 60 //add class for width define 61 $('.sf-menu > li ul').addClass('submenu-container clearfix'); 62 // loop through each sublist under each top list item 63 $('.sf-menu > li > ul').each(function(){ 64 i = 0; 65 //add classes for clearing 66 $(this).each(function(){ 67 if ($(this).attr('class') != "category-thumbnail"){ 68 i++; 69 if(i % 2 == 1) 70 $(this).addClass('first-in-line-xs'); 71 else if (i % 5 == 1) 72 $(this).addClass('first-in-line-lg'); 73 } 74 }); 75 }); 76} 77 78function mobileInit() 79{ 80 81 categoryMenu.superfish('destroy'); 82 $('.sf-menu').removeAttr('style'); 83 84 mCategoryGrover.on('click', function(e){ 85 $(this).toggleClass('active').parent().find('ul.menu-content').stop().slideToggle('medium'); 86 return false; 87 }); 88 89 $('.sf-menu > li ul').addClass('menu-mobile clearfix').parent().prepend('<span class="menu-mobile-grover"></span>'); 90 91 $(".sf-menu .menu-mobile-grover").on('click', function(e){ 92 var catSubUl = $(this).next().next('.menu-mobile'); 93 if (catSubUl.is(':hidden')) 94 { 95 catSubUl.slideDown(); 96 $(this).addClass('active'); 97 } 98 else 99 { 100 catSubUl.slideUp(); 101 $(this).removeClass('active'); 102 } 103 return false; 104 }); 105 106 107 $('#block_top_menu > ul:first > li > a').on('click', function(e){ 108 var parentOffset = $(this).prev().offset(); 109 var relX = parentOffset.left - e.pageX; 110 if ($(this).parent('li').find('ul').length && relX >= 0 && relX <= 20) 111 { 112 e.preventDefault(); 113 var mobCatSubUl = $(this).next('.menu-mobile'); 114 var mobMenuGrover = $(this).prev(); 115 if (mobCatSubUl.is(':hidden')) 116 { 117 mobCatSubUl.slideDown(); 118 mobMenuGrover.addClass('active'); 119 } 120 else 121 { 122 mobCatSubUl.slideUp(); 123 mobMenuGrover.removeClass('active'); 124 } 125 } 126 }); 127 128} 129 130// change the menu display at different resolutions 131function menuChange(status) 132{ 133 status == 'enable' ? mobileInit(): desktopInit(); 134}
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.