1"use strict"; 2 3qWebshop.gridMenu = { 4 openDuration : 50, 5 closeDuration : 200, 6 clickDelay : 10, 7 init : function(){ 8 var bod = $("body"); 9 if ( qWebshop.isTouchDevice() ){ 10 bod.on( "click", "div.productwrapper", qWebshop.gridMenu._touchClick ); 11 } 12 bod.on( "mouseenter", "div.productwrapper", qWebshop.gridMenu._open ); 13 bod.on( "mouseleave", "div.productwrapper", qWebshop.gridMenu._close ); 14 bod.on( "click", "div.productwrapper img", qWebshop.gridMenu._thumbClick ); 15 bod.on( "click", "div.groupwrapper img", qWebshop.gridMenu._thumbClick ); 16 }, 17 _thumbClick : function( evt ){ 18 var elem = $(this).closest("div.productwrapper"); 19 20 // abort if image already has link 21 if ( !!elem.find("div.image a").length ){ 22 return; 23 } 24 25 var visMenu = elem.find("div.menu:visible"); 26 if ( !!visMenu.length ){ 27 var viewlink = visMenu.find("li.view a"); 28 //bypass jquery click bug 29 viewlink[0].click(); 30 } 31 var nomenu = !!elem.closest("div.productgrid.nomenu").length; 32 if ( nomenu ){ 33 var namelink = elem.find("div.info div.name a"); 34 if ( !!namelink.length ){ 35 elem.find("div.info div.name a")[0].click(); 36 } 37 } 38 }, 39 _touchClick : function(evt){ 40 var elem = $(this); 41 var targ = $(evt.target); 42 if ( targ.is("a") ) return; 43 // faster to not use selectors for parent 44 if ( targ.parent().is("a") ) return; 45 evt.preventDefault(); 46 47 var visiblebefore = !!elem.find("div.menu:visible").length; 48 // delay to account for android chrome hover-on-click 49 setTimeout( function(){ 50 var visiblenow = !!elem.find("div.menu:visible").length; 51 if ( visiblebefore != visiblenow ) return; 52 53 if ( !visiblenow ){ 54 qWebshop.gridMenu._open.call( elem, evt ); 55 } else { 56 //qWebshop.gridMenu._close.call( elem, evt ); 57 } 58 }, qWebshop.gridMenu.clickDelay ); 59 }, 60 _open : function(evt){ 61 var prodwrap = $(this); 62 var menu = prodwrap.find("div.menu"); 63 var h = menu.height(); 64 // yield to account for android chrome hover-on-click 65 setTimeout( function(){ 66 menu.height( 0 ); 67 menu.show(); 68 menu.animate({height: h+"px"}, qWebshop.gridMenu.openDuration ); 69 }, 0 ); 70 }, 71 _close : function(evt){ 72 var prodwrap = $(this); 73 var menu = prodwrap.find("div.menu"); 74 menu.animate({height: "0px"}, qWebshop.gridMenu.closeDuration, null, function(){ 75 menu.hide(); 76 menu.css( {height: ""} ); 77 }); 78 } 79}
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.