1/* 2* 2007-2014 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-2014 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() <= 767 && responsiveflagMenu == false) 41 { 42 menuChange('enable'); 43 responsiveflagMenu = true; 44 } 45 else if ($(document).width() >= 768) 46 { 47 menuChange('disable'); 48 responsiveflagMenu = false;
49 } 50} 51 52// init Super Fish Menu for 767px+ 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('id') != "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 categoryMenu.superfish('destroy'); 81 $('.sf-menu').removeAttr('style'); 82 83 mCategoryGrover.on('click touchstart', function(){ 84 $(this).toggleClass('active').parent().find('ul.menu-content').stop().slideToggle('medium'); 85 }); 86 87 $('.sf-menu > li > ul').addClass('menu-mobile clearfix').parent().prepend('<span class="menu-mobile-grover"></span>'); 88 89 $(".sf-menu .menu-mobile-grover").on('click touchstart', function(){ 90 var catSubUl = $(this).next().next('.menu-mobile'); 91 if (catSubUl.is(':hidden')) 92 { 93 catSubUl.slideDown(); 94 $(this).addClass('active'); 95 } 96 else 97 { 98 catSubUl.slideUp(); 99 $(this).removeClass('active'); 100 } 101 return false; 102 }); 103 104 105 $('#block_top_menu > ul:first > li > a').on('click touchstart', function(e){ 106 if ($(this).parent('li').find('ul').length) 107 { 108 e.preventDefault(); 109 var mobCatSubUl = $(this).next('.menu-mobile'); 110 var mobMenuGrover = $(this).next('.menu-mobile-grover'); 111 if (mobCatSubUl.is(':hidden')) 112 { 113 mobCatSubUl.slideDown(); 114 mobMenuGrover.addClass('active'); 115 } 116 else 117 { 118 mobCatSubUl.slideUp(); 119 mobMenuGrover.removeClass('active'); 120 } 121 } 122 }); 123 124} 125 126// change the menu display at different resolutions 127function menuChange(status) 128{ 129 status == 'enable' ? mobileInit(): desktopInit(); 130}
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.