PageSourceSearch

https://www.finestwine.com/modules/iqitmegamenu/views/js/front.js

js finestwine.com collected 2026-09-26 15:45:21 UTC 9,040 bytes, 284 lines download raw bytes

1/**
2* 2014-2017 IQIT-COMMERCE.COM
3*
4* NOTICE OF LICENSE
5*
6*  @author    IQIT-COMMERCE.COM <[email protected]>
7*  @copyright 2007-2017 IQIT-COMMERCE.COM
8*  @license   GNU General Public License version 2
9*
10* You can not resell or redistribute this software.
11* 
12*/
13
14// classie - class helper functions, from bonzo https://github.com/ded/bonzo
15
16!function(a){"use strict";function b(a){return new RegExp("(^|\\s+)"+a+"(\\s+|$)")}function f(a,b){var f=c(a,b)?e:d;f(a,b)}var c,d,e;"classList"in document.documentElement?(c=function(a,b){return a.classList.contains(b)},d=function(a,b){a.classList.add(b)},e=function(a,b){a.classList.remove(b)}):(c=function(a,c){return b(c).test(a.className)},d=function(a,b){c(a,b)||(a.className=a.className+" "+b)},e=function(a,c){a.className=a.className.replace(b(c)," ")});var g={hasClass:c,addClass:d,removeClass:e,toggleClass:f,has:c,add:d,remove:e,toggle:f};"function"==typeof define&&define.amd?define(g):a.classie=g}(window);
17
18//hover intent
19(function($){$.fn.hoverIntent=function(handlerIn,handlerOut,selector){var cfg={interval:100,sensitivity:6,timeout:0};if(typeof handlerIn==="object"){cfg=$.extend(cfg,handlerIn)}else{if($.isFunction(handlerOut)){cfg=$.extend(cfg,{over:handlerIn,out:handlerOut,selector:selector})}else{cfg=$.extend(cfg,{over:handlerIn,out:handlerIn,selector:handlerOut})}}var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if(Math.sqrt((pX-cX)*(pX-cX)+(pY-cY)*(pY-cY))<cfg.sensitivity){$(ob).off("mousemove.hoverIntent",track);ob.hoverIntent_s=true;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=false;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=$.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type==="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).on("mousemove.hoverIntent",track);if(!ob.hoverIntent_s){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).off("mousemove.hoverIntent",track);if(ob.hoverIntent_s){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.on({"mouseenter.hoverIntent":handleHover,"mouseleave.hoverIntent":handleHover},cfg.selector)}})(jQuery);
20
21//double tap
22;(function(e,t,n,r){e.fn.doubleTapToGo=function(r){if(!("ontouchstart"in t)&&!navigator.msMaxTouchPoints&&!navigator.userAgent.toLowerCase().match(/windows phone os 7/i))return false;this.each(function(){var t=false;e(this).on("click",function(n){var r=e(this);if(r[0]!=t[0]){n.preventDefault();t=r}});e(n).on("click touchstart MSPointerDown",function(n){var r=true,i=e(n.target).parents();for(var s=0;s<i.length;s++)if(i[s]==t[0])r=false;if(r)t=false})});return this}})(jQuery,window,document);
23
24var cbpHorizontalMenu, cbpVerticalmenu;
25
26$(document).ready(function(){
27
28  cbpHorizontalMenu = (function() {
29
30    var menuId = '#cbp-hrmenu',
31        $listItems = $( menuId + '> ul > li'  ),
32        $menuItems = $listItems.children( 'a, .cbp-main-link' ),
33        $innerTabs = $( menuId + ' .cbp-hrsub-tabs-names li > a'  ),
34        $body = $( 'body' ),
35        current = -1;
36    currentlevel = -1;
37
38
39    if (iqitTheme.hm_submenu_width == 'default') {
40      var $header = $( '#desktop-header-container' );
41    } else{
42      var $header = $( '#header' );
43    }
44
45    $listItems.has('ul').find(' > a').doubleTapToGo();
46
47    function init() {
48      var isTouchDevice = 'ontouchstart' in document.documentElement;
49      if( isTouchDevice ) {
50        $menuItems.on( 'mouseover', open );
51      }
52      else{
53        $menuItems.hoverIntent( {
54          over: open,
55          out: dnthing,
56          interval: 30
57        } );
58      }
59
60      $listItems.on( 'mouseover', function( event ) { event.stopPropagation(); } );
61
62      $innerTabs.hover( function(){
63        $innerTabs.removeClass('active');
64        $(this).tab('show');
65      });
66    }
67
68    var setCurrent = function(strName) {
69      current = strName;
70    };
71
72    function dnthing( event ) {
73
74    }
75
76    function open( event ) {
77
78      $othemenuitem = $('#cbp-hrmenu1').find('.cbp-hropen');
79
80
81      $othemenuitem.find('.cbp-hrsub').removeClass('cbp-show');
82      $othemenuitem.removeClass( 'cbp-hropen' );
83
84      cbpVerticalmenu.setCurrent(-1);
85
86      var $item = $( event.currentTarget ).parent( 'li' ),
87          idx = $item.index();
88
89
90      $submenu = $item.find('.cbp-hrsub');
91
92      if(current == idx )
93        return;
94
95      $submenu.removeClass('cbp-notfit');
96      $submenu.removeClass('cbp-show');
97
98      if( current !== -1 ) {
99        $listItems.eq( current ).removeClass( 'cbp-hropen' );
100      }
101
102      if( current === idx ) {
103        $item.removeClass( 'cbp-hropen' );
104        current = -1;
105
106      }
107      else {
108        $submenu.addClass( 'cbp-show' );
109        iqitmenuwidth = $header.width();
110        iqititemposition = $item.offset().left - $header.offset().left;
111
112        if((iqitmenuwidth-iqititemposition)<=$submenu.width())
113        {
114          $submenu.addClass( 'cbp-notfit' );
115        }
116
117        $item.addClass( 'cbp-hropen' );
118        current = idx;
119        $body.off( 'mouseover' ).on( 'mouseover', close );
120      }
121
122
123
124      return false;
125
126    }
127
128    function close( event ) {
129      $listItems.eq( current ).removeClass( 'cbp-hropen' );
130      current = -1;
131    }
132
133    return { init : init,
134      setCurrent: setCurrent
135    };
136
137  })();
138
139  cbpHorizontalMenu.init();
140
141});
142
143$(document).ready(function(){
144
145  $('.cbp-vertical-on-top').on( 'mouseover', function() {
146    $(this).addClass('cbp-vert-expanded');
147  });
148
149  $('.cbp-vertical-on-top').on( 'mouseleave', function() {
150    $(this).removeClass('cbp-vert-expanded');
151  });
152
153
154
155  cbpVerticalmenu = (function(test) {
156
157    var menuId = '#cbp-hrmenu1-ul',
158        $listItems = $( menuId + ' > li'  ),
159        $menuItems = $listItems.children( 'a' ),
160        $innerTabs = $( menuId + ' .cbp-hrsub-tabs-names li > a'  ),
161        $body = $( 'body' ),
162        current = -1,
163        currentlevel = -1;
164
165    $listItems.has('ul').find(' > a').doubleTapToGo();
166
167
168
169    function init() {
170
171      var isTouchDevice = 'ontouchstart' in document.documentElement;
172      if( isTouchDevice ) {
173        $menuItems.on( 'mouseover', open );
174      }
175      else{
176        $menuItems.hoverIntent( {
177          over: open,
178          out: dnthing,
179          interval: 30
180        } );
181      }
182
183      $listItems.on( 'mouseover', function( event ) { event.stopPropagation(); } );
184
185      $innerTabs.hover( function(){
186        $innerTabs.removeClass('active');
187        $(this).tab('show');
188      });
189
190      $( window ).resize(function() {
191        $('cbp-hrmenu-tab').not('.cbp-hropen').find( '.cbp-hrsub-wrapper' ).removeAttr( 'style' );
192      });
193    }
194
195    function dnthing( event ) {
196
197    }
198
199    var setCurrent = function(strName) {
200      current = strName;
201    };
202
203    function open( event ) {
204
205
206      $othemenuitem = $('#cbp-hrmenu').find('.cbp-hropen');
207
208      $othemenuitem.find('.cbp-hrsub').removeClass('cbp-show');
209      closeElement($othemenuitem);
210
211      cbpHorizontalMenu.setCurrent(-1);
212
213      var $item = $( event.currentTarget ).parent( 'li' ),
214          idx = $item.index();
215
216      if(current == idx )
217        return;
218
219      $submenu = $item.find('.cbp-hrsub');
220      $submenu.removeClass('cbp-show');
221
222      if( current !== -1 ) {
223        closeElement($listItems.eq( current ));
224      }
225
226      if( current === idx ) {
227        closeElement($item);
228        current = -1;
229      }
230      else {
231        $submenu.parent().width($(iqitmegamenu.containerSelector).width()-$(menuId).width());
232        callerHeight = $item.height();
233        $submenu.parent().css( { marginLeft : $item.innerWidth()+"px", marginRight : $item.innerWidth()+"px", marginTop : -callerHeight+"px" } );
234        $submenu.addClass( 'cbp-show' );
235        $item.addClass( 'cbp-hropen' );
236        current = idx;
237        $body.off( 'mouseover' ).on( 'mouseover', close );
238      }
239
240      return false;
241    }
242
243    function close( event ) {
244      closeElement($listItems.eq( current ));
245      current = -1;
246    }
247
248    function closeElement( $element ) {
249      $element.removeClass( 'cbp-hropen' );
250    }
251
252    return { init : init,
253      setCurrent: setCurrent
254    };
255
256  })();
257
258  cbpVerticalmenu.init();
259
260});
261
262
263$(document).ready(function(){
264
265  var iqitMobileMenu = (function() {
266
267    var $menu = $('#iqitmegamenu-mobile');
268    var $expander = $menu.find('.mm-expand');
269
270    $menu.on('click', function (e) {
271      e.stopPropagation()
272    });
273
274    $expander.on('click', function () {
275      $(this).parent().toggleClass('show');
276    });
277  });
278
279  iqitMobileMenu();
280  
281});
282
283
284

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.