1import "textillate"; 2import "lettering.js"; 3 4export default function () { 5 6 function initUserInterface() { 7 // bind a click event to the 'skip-nav' link and give focus 8 var $this = $(this); 9 10 $(".skip-nav").click(function (){ 11 var skipTo="#"+this.href.split('#')[1]; 12 $(skipTo).attr('tabindex', -1).on('blur focusout', function () { 13 $this.removeAttr('tabindex'); 14 }).focus(); 15 }); 16 17 // Script to scroll to top after accordion is open to offset the large accordions 18 $('.collapse').on('shown.bs.collapse', function() { 19 var $card = $(this).closest('.card'); 20 $('html,body').animate({ 21 scrollTop: $card.offset().top - 140 22 }, 500); 23 }); 24 25 // $('.career-picker-row a.btn.white').on('click', function() { 26 // $('html,body').animate({ 27 // scrollTop: $(this).offset().top 28 // }, 500); 29 // }); 30 31 //setupSmoothScroll 32 var anchorLink = $('.anchor-link'); 33 if (anchorLink.length > 0) { 34 anchorLink.on('click', function (event){ 35 event.preventDefault(); 36 var offset = $($(this).attr('href')).offset().top - 100; 37 var $offsetTarget = $($(this).attr('href')); 38 $('html, body').animate({scrollTop:offset}, 500, function (){ 39 $offsetTarget.attr('tabindex', -1).focus(); 40 }); 41 }); 42 } 43 44 $(window).scroll(function() { 45 var scroll = $(window).scrollTop(); 46 47 if (scroll >= 800) { 48 $(".back-to-top").addClass("show"); 49 } else { 50 $(".back-to-top").removeClass("show"); 51 } 52 }); 53 54 // Add to Any 55 function addToAny() { 56 $('<script>var a2a_config = a2a_config || {}; a2a_config.templates = {email: { subject: "${title}", body: "Check out this website: ${link}"}};</' + 'script>').appendTo(document.body); 57 58 var addtoanyScript = document.createElement('script'); 59 addtoanyScript.setAttribute('src', '//static.addtoany.com/menu/page.js'); 60 document.body.appendChild(addtoanyScript); 61 } 62 63 // Bootstrap Select 64 function bootstrapSelect() { 65 $('select').selectpicker(); 66 67 var $showMore = $('.show-more'); 68 var $newsSection = $('.news-section'); 69 var $newsSectionRow = $('.news-section .news-block > .row').not(":eq(0)"); 70 71 if ($newsSection.length > 0){ 72 $newsSectionRow.attr('aria-expanded','false'); 73 $newsSectionRow.attr('tabindex','-1'); 74 $newsSectionRow.addClass('hidden'); 75 } 76 77 78 $showMore.on('click', function(){ 79 $newsSection.toggleClass('open-news'); 80 81 $newsSectionRow.attr('aria-expanded', 82 $newsSectionRow.attr('aria-expanded')=='false' ? 'true' : 'false' 83 ); 84 $newsSectionRow.attr('tabindex', 85 $newsSectionRow.attr('tabindex')=='-1' ? '0' : '-1' 86 ); 87 $newsSectionRow.toggleClass('hidden'); 88 89 $('.more').toggleClass('hide'); 90 $('.less').toggleClass('hide'); 91 }); 92 93 var $loadMore = $('.load-more'); 94 var $programDirectory = $('.program-container'); 95 $loadMore.on('click', function(){ 96 $programDirectory.toggleClass('show-programs'); 97 }) 98 } 99 100 $('.close-alert').on('click', function(){ 101 $('.alert').toggleClass('closed'); 102 }); 103 104 var $slideUpCards = $('.card-content'); 105 var $slideUpCardTrigger = $('.tile-link'); 106 107 $slideUpCardTrigger.on('click', function() { 108 $this.closest($slideUpCards).toggleClass('slide-up'); 109 }); 110 111 function closePreviousCareer() { 112 var $myGroup = $('.career-picker-row'); 113 $myGroup.on('show.bs.collapse','.collapse', function () { 114 $myGroup.find('.collapse.show').collapse('hide'); 115 }); 116 } 117 118 // Video Transcript button 119 $('.play-with-transcript').on('click', function (e) { 120 // Play video automatcially 121 $('#housingVideo')[0].src += '?autoplay=1'; 122 }) 123 124 // Deep linking 125 function deepLinkDegreeTabs() { 126 127 var url = document.location.toString(); 128 129 if (url.match('#')) { 130 $('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show'); 131 } 132 133 //Change hash for page-reload 134 $('.nav-tabs a[href="#' + url.split('#')[1] + '"]').on('shown', function (e) { 135 window.location.hash = e.target.hash; 136 }); 137 } 138 139 // prevent scrolling 140 function preventScroll() { 141 function preventDefault(e) { 142 e = e || window.event; 143 if (e.preventDefault) 144 e.preventDefault(); 145 e.returnValue = false; 146 } 147 148 function preventDefaultForScrollKeys(e) { 149 if (keys[e.keyCode]) { 150 preventDefault(e); 151 return false; 152 } 153 } 154 155 function disableScroll() { 156 if (window.addEventListener) // older FF 157 window.addEventListener('DOMMouseScroll', preventDefault, false); 158 window.onwheel = preventDefault; // modern standard 159 window.onmousewheel = document.onmousewheel = preventDefault; // older browsers, IE 160 window.ontouchmove = preventDefault; // mobile 161 document.onkeydown = preventDefaultForScrollKeys; 162 } 163 164 function enableScroll() { 165 if (window.removeEventListener) 166 window.removeEventListener('DOMMouseScroll', preventDefault, false); 167 window.onmousewheel = document.onmousewheel = null; 168 window.onwheel = null; 169 window.ontouchmove = null; 170 document.onkeydown = null; 171 } 172 } 173 174 //refresh page on browser resize while storing window width 175 function pageReload() { 176 177 if ($('body').find('.col-slider-l').length) { 178 onHomepage(); 179 } 180 181 function onHomepage() { 182 var windowWidth = $(window).width(); 183 184 $(window).resize(function(){ 185 // Check if the window width has actually changed and it's not just iOS triggering a resize event on scroll 186 if ($(window).width() != windowWidth) { 187 188 // Update the window width for next time 189 windowWidth = $(window).width(); 190 191 $(window).bind('resize', function () { 192 if (window.RT) clearTimeout(window.RT); 193 window.RT = setTimeout(function () { 194 this.location.reload(false); /* false to get page from cache */ 195 }, 100); 196 }); 197 } 198 }); 199 } 200 } 201 202 function initSwapText() { 203 $('.filter-trigger').click(function(){ 204 var $this = $(this); 205 $this.toggleClass('collapsed'); 206 if($this.hasClass('collapsed')){ 207 $this.text('Show More Filters'); 208 } else { 209 $this.text('Show Fewer Filters'); 210 } 211 }); 212 } 213 214 addToAny(); 215 bootstrapSelect(); 216 deepLinkDegreeTabs();
217 preventScroll(); 218 pageReload(); 219 initSwapText(); 220 } 221 222 initUserInterface(); 223 224 $( document ).ready(function() { 225 if ($('.col-slider-r').length) { 226 $('body').addClass('homepage'); 227 } 228 229 if ($('.bootstrap-select').length > 0) { 230 $(this).find('ul.dropdown-menu li').each( function () { 231 $(this).find('a').attr('href', "javascript:void(0)"); 232 }); 233 } 234 }); 235};
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.