PageSourceSearch

https://moirestaurant.com/omakase-experience-soho/src/js/jquery.nav.js

js moirestaurant.com collected 2026-10-01 06:29:34 UTC 7,449 bytes, 223 lines download raw bytes

1
2
3/*
4--------------------------------------------------------
5Scalemenu
6
7
8*/
9var scalemenu={
10divholders: {}, 
11divgroups: {}, 
12lastactiveingroup: {}, 
13preloadimages: [],
14
15show:function(divids){ 
16	if (typeof divids=="object"){
17		for (var i=0; i<divids.length; i++)
18			this.showhide(divids[i], "show")
19	}
20	else
21		this.showhide(divids, "show")
22},
23
24hide:function(divids){ 
25	if (typeof divids=="object"){
26		for (var i=0; i<divids.length; i++)
27			this.showhide(divids[i], "hide")
28	}
29	else
30		this.showhide(divids, "hide")
31},
32
33toggle:function(divid){ 
34	if (typeof divid=="object")
35		divid=divid[0]
36	this.showhide(divid, "toggle")
37},
38
39addDiv:function(divid, attrstring){ 
40	this.divholders[divid]=({id: divid, $divref: null, attrs: attrstring})
41	this.divholders[divid].getAttr=function(name){ 
42		var attr=new RegExp(name+"=([^,]+)", "i") 
43		return (attr.test(this.attrs) && parseInt(RegExp.$1)!=0)? RegExp.$1 : null 
44	}
45	this.currentid=divid 
46	return this
47},
48
49showhide:function(divid, action){
50	var $divref=this.divholders[divid].$divref 
51	if (this.divholders[divid] && $divref.length==1){ 
52		var targetgroup=this.divgroups[$divref.attr('groupname')] 
53		if ($divref.attr('groupname') && targetgroup.count>1 && (action=="show" || action=="toggle" && $divref.css('display')=='none')){ 
54			if (targetgroup.lastactivedivid && targetgroup.lastactivedivid!=divid) 
55				this.slideengine(targetgroup.lastactivedivid, 'hide') 
56				this.slideengine(divid, 'show')
57			targetgroup.lastactivedivid=divid 
58		}
59		else{
60			this.slideengine(divid, action)
61		}
62	}
63},
64
65slideengine:function(divid, action){
66	var $divref=this.divholders[divid].$divref
67	var $togglerimage=this.divholders[divid].$togglerimage
68	if (this.divholders[divid] && $divref.length==1){ 
69		var animateSetting={height: action}
70		if ($divref.attr('fade'))
71			animateSetting.opacity=action
72		$divref.animate(animateSetting, $divref.attr('speed')? parseInt($divref.attr('speed')) : 500, function(){
73			if ($togglerimage){
74				$togglerimage.attr('src', ($divref.css('display')=="none")? $togglerimage.data('srcs').closed : $togglerimage.data('srcs').open)
75			}
76			if (scalemenu.ontoggle){
77				try{
78					scalemenu.ontoggle(jQuery, $divref.get(0), $divref.css('display'))
79				}
80				catch(e){
81					alert("An error exists inside your \"ontoggle\" function:\n\n"+e+"\n\nAborting execution of function.")
82				}
83			}
84		})
85		return false
86	}
87},
88
89generatemap:function(){
90	var map={}
91	for (var i=0; i<arguments.length; i++){
92		if (arguments[i][1]!=null){ 
93			map[arguments[i][0]]=arguments[i][1]
94		}
95	}
96	return map
97},
98
99init:function(){
100	var ac=this
101	jQuery(document).ready(function($){
102		scalemenu.ontoggle=scalemenu.ontoggle || null
103		var urlparamopenids=scalemenu.urlparamselect() 
104		var persistopenids=ac.getCookie('acopendivids') 
105		var groupswithpersist=ac.getCookie('acgroupswithpersist') 
106		if (persistopenids!=null) 
107			persistopenids=(persistopenids=='nada')? [] : persistopenids.split(',') 
108		groupswithpersist=(groupswithpersist==null || groupswithpersist=='nada')? [] : groupswithpersist.split(',') 
109		jQuery.each(ac.divholders, function(){
110			this.$divref=$('#'+this.id)
111			if ((this.getAttr('persist') || jQuery.inArray(this.getAttr('group'), groupswithpersist)!=-1) && persistopenids!=null){ 
112				var cssdisplay=(jQuery.inArray(this.id, persistopenids)!=-1)? 'block' : 'none'
113			}
114			else{
115				var cssdisplay=this.getAttr('hide')? 'none' : null
116			}
117			if (urlparamopenids[0]=="all" || jQuery.inArray(this.id, urlparamopenids)!=-1){ 
118				cssdisplay='block'
119			}
120			else if (urlparamopenids[0]=="none"){
121				cssdisplay='none'
122			}
123			this.$divref.css(ac.generatemap(['height', this.getAttr('height')], ['display', cssdisplay]))
124			this.$divref.attr(ac.generatemap(['groupname', this.getAttr('group')], ['fade', this.getAttr('fade')], ['speed', this.getAttr('speed')]))
125			if (this.getAttr('group')){ //if this DIV has the "group" attr defined
126				var targetgroup=ac.divgroups[this.getAttr('group')] || (ac.divgroups[this.getAttr('group')]={}) 
127				
128				targetgroup.count=(targetgroup.count||0)+1 
129				if (jQuery.inArray(this.id, urlparamopenids)!=-1){ 
130					targetgroup.lastactivedivid=this.id 
131					targetgroup.overridepersist=1 
132				}
133				if (!targetgroup.lastactivedivid && this.$divref.css('display')!='none' || cssdisplay=="block" && typeof targetgroup.overridepersist=="undefined") 
134					targetgroup.lastactivedivid=this.id 
135				this.$divref.css({display:'none'}) 
136			}
137		}) 
138		jQuery.each(ac.divgroups, function(){ 
139			if (this.lastactivedivid && urlparamopenids[0]!="none") 
140				ac.divholders[this.lastactivedivid].$divref.show()
141		})
142		if (scalemenu.ontoggle){
143			jQuery.each(ac.divholders, function(){ 
144				scalemenu.ontoggle(jQuery, this.$divref.get(0), this.$divref.css('display'))
145			})
146		}
147 		//Parse page for links containing rel attribute
148		var $allcontrols=$('a[rel]').filter('[rel^="collapse["], [rel^="expand["], [rel^="toggle["]') 
149		$allcontrols.each(function(){ //loop though each control link
150			this._divids=this.getAttribute('rel').replace(/(^\w+)|(\s+)/g, "").replace(/[\[\]']/g, "") 
151			if (this.getElementsByTagName('img').length==1 && ac.divholders[this._divids]){ 
152				scalemenu.preloadimage(this.getAttribute('data-openimage'), this.getAttribute('data-closedimage'))
153				$togglerimage=$(this).find('img').eq(0).data('srcs', {open:this.getAttribute('data-openimage'), closed:this.getAttribute('data-closedimage')}) 
154				ac.divholders[this._divids].$togglerimage=$(this).find('img').eq(0) 
155				ac.divholders[this._divids].$togglerimage.attr('src', (ac.divholders[this._divids].$divref.css('display')=="none")? $togglerimage.data('srcs').closed : $togglerimage.data('srcs').open
155)
156			}
157			$(this).click(function(){ 
158				var relattr=this.getAttribute('rel')
159				var divids=(this._divids=="")? [] : this._divids.split(',') 
160				if (divids.length>0){
161					scalemenu[/expand/i.test(relattr)? 'show' : /collapse/i.test(relattr)? 'hide' : 'toggle'](divids) 
162					return false
163				}
164			}) 
165		})
166
167		$(window).bind('unload', function(){
168			ac.uninit()
169		})
170	}) 
171},
172
173uninit:function(){
174	var opendivids='', groupswithpersist=''
175	jQuery.each(this.divholders, function(){
176		if (this.$divref.css('display')!='none'){
177			opendivids+=this.id+',' 
178		}
179		if (this.getAttr('group') && this.getAttr('persist'))
180			groupswithpersist+=this.getAttr('group')+',' 
181	})
182	opendivids=(opendivids=='')? 'nada' : opendivids.replace(/,$/, '')
183	groupswithpersist=(groupswithpersist=='')? 'nada' : groupswithpersist.replace(/,$/, '')
184	this.setCookie('acopendivids', opendivids)
185	this.setCookie('acgroupswithpersist', groupswithpersist)
186},
187
188getCookie:function(Name){ 
189	var re=new RegExp(Name+"=[^;]*", "i"); 
190	if (document.cookie.match(re)) 
191		return document.cookie.match(re)[0].split("=")[1] 
192	return null
193},
194
195setCookie:function(name, value, days){
196	if (typeof days!="undefined"){ 
197		var expireDate = new Date()
198		expireDate.setDate(expireDate.getDate()+days)
199		document.cookie = name+"="+value+"; path=/; expires="+expireDate.toGMTString()
200	}
201	else 
202		document.cookie = name+"="+value+"; path=/"
203},
204
205urlparamselect:function(){
206	window.location.search.match(/expanddiv=([\w\-_,]+)/i) 
207	return (RegExp.$1!="")? RegExp.$1.split(",") : []
208},
209
210preloadimage:function(){
211	var preloadimages=this.preloadimages
212	for (var i=0; i<arguments.length; i++){
213		if (arguments[i] && arguments[i].length>0){
214			preloadimages[preloadimages.length]=new Image()
215			preloadimages[preloadimages.length-1].src=arguments[i]
216		}
217	}
218}
219
220}
221
222  
223

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.