PageSourceSearch

https://www.aoyama.ac.jp/wp-content/themes/aoyamagakuin/js/navigation.js

js aoyama.ac.jp collected 2026-09-24 08:38:06 UTC 5,187 bytes, 163 lines download raw bytes

1var $menu_array = $menu_array || [];
2// $(window).on('load', function() {
3//   var preWidth = window.innerWidth;
4//   if (preWidth <= 800) {
5//     $('#sp-logo').css('margin-top', $('#header').height() + 'px');
6//     $('#modal_burger').css('top', '-' + $('#header').height() + 'px');
7//     setNav();
8//   }
9//   window.addEventListener("resize", function() {
10//     if (preWidth >=800 && window.innerWidth < 800) {
11//       $('#spNavBox01').css({'display': 'block'});
12//       $('#sp-logo').css('margin-top', $('#header').height() + 'px');
13//       $('#modal_burger').css('top', '-' + $('#header').height() + 'px');
14//       setNav();
15//     }
16//     preWidth = window.innerWidth;
17//   });
18
19// 	$('.spNavBox01_item').each(function(index, element) {
20// 		if($(element).children('.spNavBox01_list').length > 0) {
21// 			$(element).children('a').addClass('arrow');
22// 		}
23// 		if($(element).children('a').attr('target')) {
24// 			$(element).children('a').addClass('link');
25// 		}
26// 	});
27// });
28
29
30$(window).on('load', function() {
31var preWidth = window.innerWidth;
32if (preWidth <= 800) {
33    //$('#sp-logo').css('margin-top', $('#header').height() + 'px');
34    //$('#modal_burger').css('top', '-' + $('#header').height() + 'px');
35    setNav();
36  }
37  window.addEventListener("resize", function() {
38    if (preWidth >=800 && window.innerWidth < 800) {
39      $('#spNavBox01').css({'display': 'block'});
40      //$('#sp-logo').css('margin-top', $('#header').height() + 'px');
41      //$('#modal_burger').css('top', '-' + $('#header').height() + 'px');
42      setNav();
43    }
44    preWidth = window.innerWidth;
45  });
46
47	$('.spNavBox01_item').each(function(index, element) {
48		if($(element).children('.spNavBox01_list').length > 0) {
49			$(element).children('a').addClass('arrow');
50		}
51		if($(element).children('a').attr('target')) {
52			$(element).children('a').addClass('link');
53		}
54	});
55if (preWidth < 800) {
56  //$('main').css('margin-top', 0);
57  //$('#sp-logo').css('margin-top', $('#header').height() + 'px');
58  //$('#modal_burger').css('top', '-' + $('#header').height() + 'px');
59	setNav();
60}
61else {
62	$('#spNavBox01').css({'display': 'block'});
63  //$('#sp-logo').css('margin-top', $('#header').height() + 'px');
64  //$('main').css('margin-top', $('#header').outerHeight() - 25);
65	setNav();
66}
67	window.addEventListener("resize", function() {
68		if (window.innerWidth <= 799) {
69      //$('main').css('margin-top', 0);
70      //$('#sp-logo').css('margin-top', $('#header').height() + 'px');
71      //$('#modal_burger').css('top', '-' + $('#header').height() + 'px');
72			setNav();
73		}
74		else {
75			$('#spNavBox01').css({'display': 'block'});
76      //$('#sp-logo').css('margin-top', $('#header').height() + 'px');
77			//$('#modal_burger').css('top', '-' + $('#header').height() + 'px');
78			setNav();
79      //$('main').css('margin-top', $('#header').outerHeight() - 25);
80		}
81		preWidth = window.innerWidth;
82		
83	});
84});
85
86function setNav() {
87  if (!$('.spNavBox01_item .itemWrapper').length) {
88    $('#spNavBox01 a').wrapInner('<span class="itemWrapper"></span>');
89  }
90
91  var fileName = location.pathname;
92
93  $('#spNavBox01').waSlideMenu({
94		scrollToTopSpeed : 300,
95		onLatestClick: function(){
96			if ($(this).attr('target')) {
97				window.open($(this).attr('href'), '_blank');
98			} else {
99				window.location.href = $(this).attr('href');
100			}
101		},
102		// 開いているページのメニュー項目を選択状態にする
103		afterLoad: function(base) {
104      var hideMenu = false;
105			var fileName = location.pathname;
106			$('li[class^="spNavBox01_item"] a').each(function(index, element) {
107				if ($(element).attr('href') && $(element).attr('href') == fileName)  {
108          if ($menu_array.indexOf($(element).attr('href')) != -1) {
109            $(element).next('.spNavBox01_list').remove();
110            $(element).removeClass('arrow');
111          }
112
113					var lists = findClickLists($(element).parent());
114					var time = 500;
115					lists.forEach(function(list) {
116						setTimeout(function() {
117              if ($menu_array.indexOf($(list).attr('href')) != -1) {
118                hideMenu = true;
119                $(list).parent('.spNavBox01_item').addClass('select');
120                $(list).next('.spNavBox01_list').remove();
121                $(list).removeClass('arrow');
122              }
123              if (!hideMenu) {
124                $(list).click();
125              }
126						}, time);
127						time += 500;
128					});
129
130					var listElement = $(element).parent('li[class^="spNavBox01_item"]:first');
131					listElement.addClass('select');
132				}
133			});
134
135      $('li[class^="spNavBox01_item"] a').each(function(index, element) {
136        // 下層ページをナビから非表示にする
137    		if ($menu_array.indexOf($(element).attr('href')) != -1) {
138    			$(element).next('.spNavBox01_list').remove();
139    		}
140      });
141		}
142	});
143}
144
145function findClickLists(element) {
146	var lists = [];
147	var item = $(element);
148	while(true) {
149		parentItem = $(item).parent('.spNavBox01_list').parent('.spNavBox01_item');
150		var link = $(parentItem).find('a:first');
151		if (parentItem.length ==  0) {
152			break;
153		}
154		lists.unshift(link);
155		item = parentItem;
156	}
157
158	return lists;
159}
160
161function getParentURL(url) {
162	return url.replace(/[^/]*$/, "");
163}

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.