PageSourceSearch

https://mmradiosmile.com/template/wall_1/js/menu.js

js mmradiosmile.com collected 2026-09-25 06:14:11 UTC 7,717 bytes, 377 lines download raw bytes

1function Browser() {
2
3  var ua, s, i;
4
5  this.isIE    = false;  // Internet Explorer
6  this.isNS    = false;  // Netscape
7  this.version = null;
8
9  ua = navigator.userAgent;
10
11  s = "MSIE";
12  if ((i = ua.indexOf(s)) >= 0) {
13    this.isIE = true;
14    this.version = parseFloat(ua.substr(i + s.length));
15    return;
16  }
17
18  s = "Netscape6/";
19  if ((i = ua.indexOf(s)) >= 0) {
20    this.isNS = true;
21    this.version = parseFloat(ua.substr(i + s.length));
22    return;
23  }
24
25  // Treat any other "Gecko" browser as NS 6.1.
26
27  s = "Safari";
28  if ((i = ua.indexOf(s)) >= 0) {
29    this.isSA = true;
30    this.version = 1.0;
31    return;
32  }
33
34  s = "Gecko";
35  if ((i = ua.indexOf(s)) >= 0) {
36    this.isNS = true;
37    this.version = 6.1;
38    return;
39  }
40
41}
42
43var browser = new Browser();
44
45var activeButton = null;
46
47if (browser.isIE)
48  document.onmousedown = pageMousedown;
49else
50  document.addEventListener("mousedown", pageMousedown, true);
51
52
53
54
55function pageMousedown(event) {
56
57  var el;
58
59  if (activeButton == null)
60    return;
61
62  if (browser.isIE)
63    el = window.event.srcElement;
64  else
65    el = (event.target.tagName ? event.target : event.target.parentNode);
66
67  if (el == activeButton)
68    return;
69
70  if (getContainerWith(el, "DIV", "MENU") == null) {
71    resetButton(activeButton);
72    activeButton = null;
73  }
74}
75
76
77function buttonClick(event, menuId) {
78
79  var button;
80
81  if (browser.isIE)
82    button = window.event.srcElement;
83  else
84    button = event.currentTarget;
85
86  button.blur();
87
88  if (button.menu == null) {
89    button.menu = document.getElementById(menuId);
90    if (button.menu.isInitialized == null)
91      menuInit(button.menu);
92  }
93
94  if (activeButton != null)
95    resetButton(activeButton);
96
97  if (button != activeButton) {
98    depressButton(button);
99    activeButton = button;
100  }
101  else
102    activeButton = null;
103
104  return false;
105}
106
107function buttonMouseover(event, menuId) {
108
109  var button;
110
111  // Find the target button element.
112
113  if (browser.isIE)
114    button = window.event.srcElement;
115  else
116    button = event.currentTarget;
117
118  // If any other button menu is active, make this one active instead.
119
120  if (activeButton != null && activeButton != button)
121    buttonClick(event, menuId);
122}
123
124function depressButton(button) {
125
126  var x, y;
127
128  x = getPageOffsetLeft(button);
129  y = getPageOffsetTop(button) + button.offsetHeight;
130  if (browser.isSA){
131		y -=5;
132	}
133  button.menu.style.left = x + "px";
134  button.menu.style.top  = y + "px";
135  button.menu.style.visibility = "visible";
136}
137
138
139
140
141function resetButton(button) {
142
143//  removeClassName(button, "MENUBUTTONACTIVE");
144
145  if (button.menu != null) {
146    closeSubMenu(button.menu);
147    button.menu.style.visibility = "hidden";
148  }
149}
150
151function menuMouseover(event) {
152
153  var menu;
154
155  // Find the target menu element.
156
157  if (browser.isIE)
158    menu = getContainerWith(window.event.srcElement, "DIV", "menu");
159  else
160    menu = event.currentTarget;
161
162  // Close any active sub menu.
163
164  if (menu.activeItem != null)
165    closeSubMenu(menu);
166}
167
168
169function menuItemMouseover(event, menuId) {
170
171  var item, menu, x, y;
172
173  if (browser.isIE)
174    item = getContainerWith(window.event.srcElement, "A", "MENUITEM");
175  else
176    item = event.currentTarget;
177  menu = getContainerWith(item, "DIV", "MENU");
178
179  if (menu.activeItem != null)
180    closeSubMenu(menu);
181  menu.activeItem = item;
182
183//  item.className += " MENUITEMHIGHLIGHT";
184
185  if (item.subMenu == null) {
186    item.subMenu = document.getElementById(menuId);
187    if (item.subMenu.isInitialized == null)
188      menuInit(item.subMenu);
189  }
190
191  x = getPageOffsetLeft(item) + item.offsetWidth;
192  y = getPageOffsetTop(item)-3.0;
193
194  var maxX, maxY;
195
196  if (browser.isNS) {
197    maxX = window.scrollX + window.innerWidth;
198    maxY = window.scrollY + window.innerHeight;
199  }
200  if (browser.isIE) {
201    maxX = (document.documentElement.scrollLeft   != 0 ? document.documentElement.scrollLeft   : document.body.scrollLeft)
202         + (document.documentElement.clientWidth  != 0 ? document.documentElement.clientWidth  : document.body.clientWidth);
203    maxY = (document.documentElement.scrollTop    != 0 ? document.documentElement.scrollTop    : document.body.scrollTop)
204         + (document.documentElement.clientHeight != 0 ? document.documentElement.clientHeight : document.body.clientHeight);
205  }
206  if (browser.isSA) {
207    maxX = window.scrollX + window.innerWidth;
208    maxY = window.scrollY + window.innerHeight ;
209  }
210
211  maxX -= item.subMenu.offsetWidth;
212  maxY -= item.subMenu.offsetHeight;
213
214  if (x > maxX)
215    x = Math.max(0, x - item.offsetWidth - item.subMenu.offsetWidth
216      + (menu.offsetWidth - item.offsetWidth));
217  y = Math.max(0, Math.min(y, maxY));
218  if (browser.isSA) {
219    item.subMenu.style.left = (x) + "px";
220    item.subMenu.style.top  = (y) + "px";
221  }else{
222    item.subMenu.style.left = x + "px";
223    item.subMenu.style.top  = y + "px";
224  }
225  item.subMenu.style.visibility = "visible";
226
227  if (browser.isIE)
228    window.event.cancelBubble = true;
229  else
230    event.stopPropagation();
231}
232
233
234
235
236function closeSubMenu(menu) {
237
238  if (menu == null || menu.activeItem == null)
239    return;
240
241  if (menu.activeItem.subMenu != null) {
242    closeSubMenu(menu.activeItem.subMenu);
243    menu.activeItem.subMenu.style.visibility = "hidden";
244    menu.activeItem.subMenu = null;
245  }
246//  removeClassName(menu.activeItem, "MENUITEMHIGHLIGHT");
247  menu.activeItem = null;
248}
249
250
251
252
253function menuInit(menu) {
254
255  var itemList, spanList;
256  var textEl, arrowEl;
257  var itemWidth;
258  var w, dw;
259  var i, j;
260
261  if (browser.isIE) {
262    menu.style.lineHeight = "2.5ex";
263    spanList = menu.getElementsByTagName("SPAN");
264    for (i = 0; i < spanList.length; i++)
265      if (hasClassName(spanList[i], "MENUITEMARROW")) {
266        spanList[i].style.fontFamily = "Webdings";
267        spanList[i].firstChild.nodeValue = "4";
268      }
269  }
270
271  itemList = menu.getElementsByTagName("A");
272  if (itemList.length > 0)
273    itemWidth = itemList[0].offsetWidth;
274  else
275    return;
276
277  for (i = 0; i < itemList.length; i++) {
278    spanList = itemList[i].getElementsByTagName("SPAN");
279    textEl  = null;
280    arrowEl = null;
281    for (j = 0; j < spanList.length; j++) {
282      if (hasClassName(spanList[j], "MENUITEMTEXT"))
283        textEl = spanList[j];
284      if (hasClassName(spanList[j], "MENUITEMARROW"))
285        arrowEl = spanList[j];
286    }
287    if (textEl != null && arrowEl != null)
288      textEl.style.paddingRight = (itemWidth 
289        - (textEl.offsetWidth + arrowEl.offsetWidth)) + "px";
290  }
291
292  if (browser.isIE) {
293    w = itemList[0].offsetWidth;
294    itemList[0].style.width = w + "px";
295    dw = itemList[0].offsetWidth - w;
296    w -= dw;
297    itemList[0].style.width = w + "px";
298  }
299  menu.isInitialized = true;
300}
301
302
303
304
305function getContainerWith(node, tagName, className) {
306
307  while (node != null) {
308    if (node.tagName != null && node.tagName == tagName &&
309        hasClassName(node, className))
310      return node;
311    node = node.parentNode;
312  }
313
314  return node;
315}
316
317
318
319
320function hasClassName(el, name) {
321
322  var i, list;
323
324  list = el.className.split(" ");
325  for (i = 0; i < list.length; i++)
326    if (list[i] == name)
327      return true;
328
329  return false;
330}
331
332
333
334
335function removeClassName(el, name) {
336
337  var i, curList, newList;
338
339  if (el.className == null)
340    return;
341
342  newList = new Array();
343  curList = el.className.split(" ");
344  for (i = 0; i < curList.length; i++)
345    if (curList[i] != name)
346      newList.push(curList[i]);
347  el.className = newList.join(" ");
348}
349
350
351
352
353
354function getPageOffsetLeft(el) {
355
356  var x;
357
358  x = el.offsetLeft;
359  if (el.offsetParent != null)
360    x += getPageOffsetLeft(el.offsetParent)+0.5;
361
362  return x;
363}
364
365
366
367
368function getPageOffsetTop(el) {
369
370  var y;
371
372  y = el.offsetTop;
373  if (el.offsetParent != null)
374    y += getPageOffsetTop(el.offsetParent);
375
376  return y;
377}

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.