PageSourceSearch

https://leonadrive.ca/wp-content/themes/York-Template-2014-2020/js/functions.js?x46774

js leonadrive.ca collected 2026-09-26 10:19:29 UTC 7,494 bytes, 250 lines download raw bytes

1/**
2 * Functionality specific to Twenty Thirteen.
3 *
4 * Provides helper functions to enhance the theme experience.
5 */
6var currentMenu ="";
7
8( function( $ ) {
9
10	var html               = $( 'html' ),
11	    navbar             = $( '#navbar' ),
12	    scrollOffsetMethod = ( typeof window.scrollY === 'undefined' ),
13	    adjustAnchor;
14
15
16        var body    = $( 'body' ),
17            _window = $( window );
18
19        /**
20         * Adds a top margin to the footer if the sidebar widget area is higher
21         * than the rest of the page, to help the footer always visually clear
22         * the sidebar.
23         */
24        $( function() {
25                if ( body.is( '.sidebar' ) ) {
26                        var sidebar   = $( '#tertiary .widget-area' ),
27                            secondary = ( 0 === sidebar.length ) ? -40 : sidebar.height(),
28                            margin    = $( '#tertiary .widget-area' ).height() - $( '#content' ).height() - secondary;
29
30                        if ( margin > 0 && _window.innerWidth() > 999 ) {
31                                $( '#colophon' ).css( 'margin-top', margin + 'px' );
32                        }
33                        $(".site-content").css({'min-height':($("#tertiary .widget-area").height()+'px')});
34                }
35        } );
36
37                                
38$("#iatwitter-widget-0").ready(function(){
39    //twh = $(#twitter-widget-0).height();
40    //thisHeight = $("#tertiary .widget-area").height() + $("#tertiary .widget-area iframe.twitter-timeline").height() + "px";
41    // May need to add callback to Twitter widget to calculate properly
42    if ( $("#tertiary .widget-area").height() >  $(".site-content").height()) {
43       $(".site-content").css('min-height',$("#tertiary .widget-area").height()+ 100 + "px");
44       $(".site-content").resize();
45    }
46});
47
48//$(twttr.widgets.createTimeline.length).ready(function(){
49if ( $("#tertiary .widget-area").height() >  $(".site-content").height()) {
50       $(".site-content").css('min-height',$("#tertiary .widget-area").height()+ 300 + "px");
51       $(".site-content").resize();
52}
53//});
54
55
56	/**
57	 * Repositions the window on jump-to-anchor to account for navbar
58	 * height.
59	 */
60	adjustAnchor = function() {
61		if ( window.location.hash )
62			window.scrollBy( 0, -49 );
63	};
64
65	$( function() {
66		adjustAnchor();
67	} );
68	_window.on( 'hashchange.twentythirteen', adjustAnchor );
69
70	/**
71	 * Displays the fixed navbar based on screen position.
72	 */
73	if ( _window.innerWidth() > 111644 ) {
74		_window.on( 'scroll.twentythirteen', function() {
75			var scrollOffset = scrollOffsetMethod ? document.documentElement.scrollTop : window.scrollY;
76
77			if ( scrollOffset > navbarOffset )
78				html.addClass( 'navbar-fixed' );
79			else
80				html.removeClass( 'navbar-fixed' );
81		} );
82	}
83
84	/**
85	 * Allows clicking the navbar to scroll to top.
86	 */
87	navbar.on( 'click.twentythirteen', function( event ) {
88		// Ensure that the navbar element was the target of the click.
89		if ( 'navbar' == event.target.id  || 'site-navigation' == event.target.id )
90			$( 'html, body' ).animate( { scrollTop: 0 }, 'fast' );
91	} );
92
93	/**
94	 * Enables menu toggle for small screens.
95	 */
96	 
97	 
98	( function() {
99		var nav = $( '#site-navigation' ), button, menu;
100		if ( ! nav )
101			return;
102
103		button = nav.find( '.menu-toggle' );
104		menu   = nav.find( '.nav-menu' );
105		if ( ! button )
106			return;
107
108		// Hide button if menu is missing or empty.
109		if ( ! menu || ! menu.children().length ) {
110			button.hide();
111			return;
112		}
113                
114                var mousedown = false;
115		$( '.menu-toggle' ).on( 'mousedown', function(e) {
116		    nav.toggleClass( 'toggled-on' );
117                    mousedown = true;
118                     console.log(e);
119
120		});
121
122                $( '.menu-toggle' ).on( 'focus', function(e) {
123                    if (mousedown == false) {
124                      nav.toggleClass( 'toggled-on' );
125                      console.log(e);
126                    }
127                } );
128
129
130	} )();
131
132	/**
133	 * Makes "skip to content" link work correctly in IE9 and Chrome for better
134	 * accessibility.
135	 *
136	 * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
137	 */
138	_window.on( 'hashchange.twentythirteen', function() {
139		var element = document.getElementById( location.hash.substring( 1 ) );
140
141		if ( element ) {
142			if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) )
143				element.tabIndex = -1;
144
145			element.focus();
146		}
147	});
148
149	/**
150	 * Arranges footer widgets vertically.
151	 */
152	if ( $.isFunction( $.fn.masonry ) ) {
153		var columnWidth = body.is( '.sidebar' ) ? 228 : 245;
154
155		$( '#secondary .widget-area' ).masonry( {
156			itemSelector: '.widget',
157			columnWidth: columnWidth,
158			gutterWidth: 20,
159			isRTL: body.is( '.rtl' )
160		} );
161	}
162
163	//Don't display page title if it is empty
164	$("h1.entry-title:empty").css("display","none");
165       
166        //Toggle Quicklinks menu 
167        $(".btn-navbar").on("click", function(){
168	        //$("#yorklinks-container").slideToggle();
169                $("#yorklinks-container").toggleClass("nav-container-open");
170		$(this).toggleClass("btn-nav-open");
171	});
172
173        // Listen for escape key to close quicklinks
174        
175        
176        $(document).keyup(function(e) {
177
178          var key = e.keyCode || event.which;
179
180 
181           if (key === 27) { // esc keycode
182              if ($( "#ql-button" ).hasClass("AnimateOn")) {
183                 $("#ql-button" ).trigger( "click");
184              }
185
186              // close megamenu on escape
187              if ($( ".menu-item" ).hasClass("megaHover")) {
188                  $(".megaHover ul.sub-menu").css("display","none");
189              }
190            
191           }
192
193       });
194
195jQuery( "#ql-button,#hide" ).click(function() {
196  jQuery( "#quick-links-container" ).slideToggle( "fast", function() {
197    if ( !jQuery("#ql-button").hasClass("AnimateOn")) {
198       jQuery("#ql-button").addClass("AnimateOn");
199    } else {
200       jQuery("#ql-button").removeClass("AnimateOn");
201    }
202  });
203});
204$(document).ready(function(){
205  $("#hide").click(function(){
206    $("#quick-links-container").hide();
207  });
208});
209
210// Set Search behavior
211
212$('.search-button2').on("click", function(){ $("#yeb13searchfield").focus() });
213//$('#yeb11searchfield').on("blur", function(){ $("#yeb11banner").css("height","50px") });
214
215$("form.search-form .header-search").attr("placeholder","");
216$("form.search-form .header-search").attr("value","Search this site");
217
218//$("form.search-form .search-submit").addClass("icon-search-widget");
219//$("form.search-form .search-submit").attr("value"," Search");
220
221$("form.search-form .header-search").click(function() {if (!this.cleared) { this.cleared = true; this.value = ''; } });
222
223//$("form.search-form .search-field").on("click", function() {
224//  if (!this.cleared) { this.cleared = true; this.value = ''; }
225//});
226
227$('.squelch-taas-accordion > h3').replaceWith(function() {
228        return $('<div>').html($(this).html());
229});
230
231
232// Add for attribute to search from label:
233$(".search-form label").attr("for","s");
234
235
236// Make= Menu button tabbable
237$(".menu-toggle").attr("tabindex",0);
238/*
239if ($.browser.msie) {
240  var ieversion = new Number($.browser.version);
241  if (ieversion <= 7) {
242    var r = confirm('You are using an outdated and unsupported web browser. Please click "OK" if you would like to install a newer version.');
243    if (r == true) {
244      window.location="http://computing.yorku.ca/students/technology-used-in-courses/a-better-browser/";
245    };
246    return;
247  };
248};
249*/
250} )( 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.