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