PageSourceSearch

https://www.htlinternationalschool.com/wp-content/themes/clevercou…/superfish/js/supposition.js?ver=1.0

js htlinternationalschool.com collected 2026-10-06 13:17:51 UTC 2,697 bytes, 82 lines download raw bytes

1/*
2 * Supposition v0.3a - an optional enhancer for Superfish jQuery menu widget
3 *
4 * Copyright (c) 2013 Joel Birch - based on work by Jesse Klaasse - credit goes largely to him.
5 * Special thanks to Karl Swedberg for valuable input.
6 *
7 * Dual licensed under the MIT and GPL licenses:
8 *   http://www.opensource.org/licenses/mit-license.php
9 * 	http://www.gnu.org/licenses/gpl.html
10 */
11
12;(function($){
13
14	$.fn.supposition = function(){
15		var $w = $(window), /*do this once instead of every onBeforeShow call*/
16			_offset = function(dir) {
17				return window[dir == 'y' ? 'pageYOffset' : 'pageXOffset']
18				|| document.documentElement && document.documentElement[dir=='y' ? 'scrollTop' : 'scrollLeft']
19			    || document.body[dir=='y' ? 'scrollTop' : 'scrollLeft'];
20			},
21			onInit = function(){
22				/* I haven't touched this bit - needs work as there are still z-index issues */
23				$topNav = $('li',this);
24				var cZ=parseInt($topNav.css('z-index')) + $topNav.length;
25				$topNav.each(function() {
26					$(this).css({zIndex:--cZ});
27				});
28			},
29			onHide = function(){
30				this.css({marginTop:'',marginLeft:''});
31			},
32			onBeforeShow = function(){
33				this.each(function(){
34					var $u = $(this);
35					$u.css('display','block');
36					var menuWidth = $u.width(),
37						parentWidth = $u.parents('ul').width(),
38						totalRight = $w.width() + _offset('x'),
39						menuRight = $u.offset().left + menuWidth;
40					if (menuRight > totalRight) {
41						$u.css('margin-left', ($u.parents('ul').length == 1 ? totalRight - menuRight : -(menuWidth + parentWidth)) + 'px');
42					}
43
44					var windowHeight = $w.height(),
45						offsetTop = $u.offset().top,
46						menuHeight = $u.height(),
47						baseline = windowHeight + _offset('y');
48					var expandUp = (offsetTop + menuHeight > baseline);
49					if (expandUp) {
50						$u.css('margin-top',baseline - (menuHeight + offsetTop));
51					}
52					$u.css('display','none');
53				});
54			};
55		
56		return this.each(function() {
57			var $this = $(this),
58				o = $this.data('sf-options'); /* get this menu's options */
59			
60			/* if callbacks already set, store them */
61			var _onInit = o.onInit,
62				_onBeforeShow = o.onBeforeShow,
63				_onHide = o.onHide;
64				
65			$.extend($this.data('sf-options'),{
66				onInit: function() {
67					onInit.call(this); /* fire our Supposition callback */
68					_onInit.call(this); /* fire stored callbacks */
69				},
70				onBeforeShow: function() {
71					onBeforeShow.call(this); /* fire our Supposition callback */
72					_onBeforeShow.call(this); /* fire stored callbacks */
73				},
74				onHide: function() {
75					onHide.call(this); /* fire our Supposition callback */
76					_onHide.call(this); /* fire stored callbacks */
77				}
78			});
79		});
80	};
81
82})(jQuery);

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.