jQuery(document).ready(function() { //collapses var titles = jQuery(".collapsableContent .collapsableTitle, .collapsableTextContent .collapsableTextTitle"); titles.each(function(index, element) { var heightTitle = jQuery(this).outerHeight() jQuery(this).click(function(e) { var jQueryparent = jQuery(this).parent(); if(jQueryparent.hasClass("contentOpened")) { var heightTitle = jQuery(this).outerHeight(); jQueryparent.animate({"height":heightTitle}, 500); } else { var oldHeight = jQueryparent.height(); var newHeight = jQueryparent.css("height","auto").height(); jQueryparent .css("height",oldHeight) .animate({"height":newHeight},{duration: 500, complete: function(){ jQuery(this).height(""); }}); } jQueryparent.toggleClass("contentOpened"); }); var jQueryparent = jQuery(this).parent(); var theID = jQueryparent.attr("id"); if(theID) { var paramPattern = new RegExp("[?|&]"+theID+"=","i"); if(paramPattern.exec(window.location.search)) { var offset = jQueryparent.offset().top; jQuery("html, body") .animate({ scrollTop: (offset-heightTitle)+"px" }); jQueryparent.toggleClass("contentOpened"); return; } } jQueryparent.height(heightTitle); }); // When using find on sprys, open them up. jQuery('.collapsableContent').scroll(function(){ var $this = jQuery(this); if (! $this.hasClass('contentOpened')) { jQuery(this).children('.collapsableTitle, .collapsableTextTitle').click(); } }); }); jQuery(document).ready(function(){ //Dumb IE 8 fix jQuery('.altRows p:nth-child(2n+1)').addClass('odd'); //Navigation JS jQuery('.menu-item-type-custom.menu-item-has-children:not(.current-menu-ancestor) > a').toggle(function(){jQuery(this).parent().toggleClass('current-menu-ancestor');},function(){jQuery(this).parent().toggleClass('current-menu-ancestor');}); //Academic Calendar jQuery(".academicCalendar ul").css("list-style", "none"); jQuery(".academicCalendar li").css({height:"50px", padding: "5px", border: "1px solid #000", margin: "0", background: "none" }); jQuery(".academicCalendar li:even").css({ float: "left", width: "25%", margin: "0 10px 0 0" }); jQuery(".academicCalendar li:odd").css({ width: "95%" }); jQuery(".academicCalendar ul li:nth-child(4n+3)").css("background", "#eee"); jQuery(".academicCalendar ul li:nth-child(4n)").css("background", "#eee"); }); // Report percentage scrolled (function($) { var maxScroll = 0; $(document).ready(function(){ $(document).scroll(); }); $(document).scroll(function(){ var totalHeight = $(document).outerHeight(); var windowHeight = $(window).outerHeight(); var windowPos = $(window).scrollTop(); var percentScrolled = Math.round(((windowPos+windowHeight)/totalHeight)*10000)/100; maxScroll = Math.max(percentScrolled, maxScroll); }); $(window).on('beforeunload', function(){ ga('send', 'event', 'page', 'scroll-percent', maxScroll); }); })(jQuery); function getStyle(oElm, strCssRule) { var strValue = ""; if(document.defaultView && document.defaultView.getComputedStyle) { strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule); } else if(oElm.currentStyle) { strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1) { return p1.toUpperCase(); }); strValue = oElm.currentStyle[strCssRule]; } return strValue; } var counter = 0; function setBaseFontSize(increment) { var allTags = new Array ( new Array("p", ""), new Array("h2", ""), new Array("h3", ""), new Array("h4", ""), new Array("div", "CollapsiblePanelTab"), new Array("th", ""), new Array("a", "") ); if (counter === 0) { defaultMain = getStyle(document.getElementById('leftCol'), 'font-size'); defaultMain = defaultMain.replace('px', ''); for(i = 0; i < allTags.length; i++) { if( (document.getElementById('leftCol').getElementsByTagName(allTags[i][0]).length !== 0) ) { eval(allTags[i][0] + "Tags = new Array();"); eval(allTags[i][0] + "Tags = document.getElementById('leftCol').getElementsByTagName('" + allTags[i][0] + "');"); if(!allTags[i][1]) { eval("default" + allTags[i][0] + "= getStyle(" + allTags[i][0] + "Tags[0], 'font-size');"); eval("default" + allTags[i][0] + "= default" + allTags[i][0] + ".replace('px','');"); } else { for(a = 0; a < (eval(allTags[i][0] + "Tags")).length; a++) { if((eval(allTags[i][0] + "Tags"))[a].className == allTags[i][1]) { eval("default" + allTags[i][0] + allTags[i][1] + "= getStyle(" + allTags[i][0] + "Tags[a], 'font-size');"); eval("default" + allTags[i][0] + allTags[i][1] + "= default" + allTags[i][0] + allTags[i][1] + ".replace('px','');"); } } } } } counter++; } document.getElementById('leftCol').style.fontSize = (parseInt(defaultMain,10) + parseInt(increment,10)) + "px"; for(j = 0; j < allTags.length; j++) { if(document.getElementById('leftCol').getElementsByTagName(allTags[j][0]).length !== 0) { for (k = 0; k < (eval(allTags[j][0] + "Tags")).length; k++) { if(!allTags[j][1]) { (eval(allTags[j][0] + "Tags"))[k].style.fontSize = (parseInt(eval("default" + allTags[j][0]),10) + parseInt(increment,10)) + "px"; } else { for(m = 0; m < (eval(allTags[j][0] + "Tags")).length; m++) { if((eval(allTags[j][0] + "Tags"))[m].className == allTags[j][1]) { (eval(allTags[j][0] + "Tags"))[m].style.fontSize = (parseInt(eval("default" + allTags[j][0] + allTags[j][1]),10) + parseInt(increment,10)) + "px"; } } } } } } } function scrollTop() { jQuery("html, body") .animate({ scrollTop: "0px" }); }