1// 20-12-29 2 3// Check if the window is smaller than 992px (mobile) 4function IsMobile() { 5 return $(window).width() < 992; 6} 7 8// Check if the window is 1024 or smaller 9function IsLaptop() { 10 return $(window).width() <= 1024; 11} 12 13// Check if the window is 768px or larger 14function IsTabletOrHigher() { 15 return $(window).width() >= 768; 16} 17 18// Checks if an element exists 19// Returns true if the element exists 20 21// Example Usage 22// if($('.header').exists()) 23// { 24// $('.header').addClass('I-found-it'); 25// } 26 27jQuery.fn.extend({ 28 exists: function () { 29 return (!!$(this).length); 30 } 31}); 32 33// Checks if elementToCheck is empty and adds the class empty-element if it is 34// Optional second parameter minWidthRemoveClass is the minimum window width that you want the empty-element class to be removed 35// Returns true for single elements if the elementToCheck is empty 36function ElementEmptyCheck(elementToCheck, minWidthRemoveClass) { 37 if ($(elementToCheck).length > 1) { 38 $(elementToCheck).each(function () { 39 if ($(window).width() < minWidthRemoveClass || minWidthRemoveClass === undefined) { 40 if ($(this).text().trim() === '') { 41 $(this).addClass('empty-element'); 42 } 43 44 else { 45 $(this).removeClass('empty-element'); 46 } 47 } 48 49 else { 50 $(this).removeClass('empty-element'); 51 } 52 }); 53 } 54 55 else { 56 if ($(window).width() < minWidthRemoveClass || minWidthRemoveClass === undefined) { 57 if ($(elementToCheck).text().trim() === '') { 58 $(elementToCheck).addClass('empty-element'); 59 return true; 60 } 61 62 else { 63 $(elementToCheck).removeClass('empty-element'); 64 return false; 65 } 66 } 67 68 else { 69 $(elementToCheck).removeClass('empty-element'); 70 return false; 71 } 72 } 73} 74 75// Checks if an element goes off the screen 76 77// Example Usage 78// if (element.is(':off-right')) 79// { 80// element.addClass('went-off-right'); 81// } 82 83(function ($) { 84 $.extend($.expr[':'], { 85 'off-top': function (el) { 86 return $(el).offset().top < $(window).scrollTop(); 87 }, 88 'off-right': function (el) { 89 return $(el).offset().left + $(el).outerWidth() - $(window).scrollLeft() >= $(window).width(); 90 }, 91 'off-bottom': function (el) { 92 return $(el).offset().top + $(el).outerHeight() - $(window).scrollTop() > $(window).height(); 93 }, 94 'off-left': function (el) { 95 return $(el).offset().left < $(window).scrollLeft(); 96 }, 97 'off-screen': function (el) { 98 return $(el).is(':off-top, :off-right, :off-bottom, :off-left'); 99 } 100 }); 101})(jQuery); 102 103// Bootstrap responsive tables 104try { 105 let allTables = $('.ccms-contentelement.ccms-contentelement-Editor').find('table'); 106 allTables.addClass('table table-bordered'); 107 allTables.parents('.FW_EDITOR_STYLE').addClass('table-responsive'); 108} 109 110catch (error) { 111 console.log(error); 112} 113 114// High Contrast Mode 115function setCookie(cname, cvalue, exdays) { 116 const d = new Date(); 117 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 118 let expires = "expires=" + d.toUTCString(); 119 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 120} 121 122function getCookie(cname) { 123 let name = cname + "="; 124 let decodedCookie = decodeURIComponent(document.cookie); 125 let ca = decodedCookie.split(';'); 126 for (let i = 0; i < ca.length; i++) { 127 let c = ca[i]; 128 while (c.charAt(0) == ' ') { 129 c = c.substring(1); 130 } 131 if (c.indexOf(name) == 0) { 132 return c.substring(name.length, c.length); 133 } 134 } 135 return ""; 136} 137 138let mode; 139let enabled = false; 140let scheme = '2'; 141let timeoutId = null; 142let modeChangerActive = false; 143let highContrastButton = document.getElementsByClassName('contrast-high'); 144let resetContrastButton = document.getElementsByClassName('contrast-reg'); 145 146try { 147 enabled = getCookie("highContrastEnabled") === 'true' ? true : false; 148 149 if (enabled) { 150 highContrastButton[0].style.display = 'none'; 151 resetContrastButton[0].style.display = 'inline'; 152 } 153 154 else { 155 highContrastButton[0].style.display = 'inline'; 156 resetContrastButton[0].style.display = 'none'; 157 } 158} 159 160catch (error) { 161 console.log(error); 162} 163 164window.onunload = function (e) { 165 setCookie("highContrastEnabled", enabled, 365); 166} 167 168let filterMap = 169{ 170 '0': 'url("#contrast__off")', 171 '1': 'url("#contrast__highcontrast")', 172 '2': 'url("#contrast__grayscale")', 173 '3': 'url("#contrast__invert")', 174 '4': 'url("#contrast__invert_grayscale")', 175 '5': 'url("#contrast__yellow_on_black")' 176}; 177 178let svgContent = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1"><defs><filter x="0" y="0" width="99999" height="99999" id="contrast__off"><feComponentTransfer><feFuncR type="table" tableValues="0 1"/><feFuncG type="table" tableValues="0 1"/><feFuncB type="table" tableValues="0 1"/></feComponentTransfer></filter><filter x="0" y="0" width="99999" height="99999" id="contrast__highcontrast"><feComponentTransfer><feFuncR type="gamma" exponent="3.0"/><feFuncG type="gamma" exponent="3.0"/><feFuncB type="gamma" exponent="3.0"/></feComponentTransfer></filter><filter x="0" y="0" width="99999" height="99999" id="contrast__highcontrast_back"><feComponentTransfer><feFuncR type="gamma" exponent="0.33"/><feFuncG type="gamma" exponent="0.33"/><feFuncB type="gamma" exponent="0.33"/></feComponentTransfer></filter><filter x="0" y="0" width="99999" height="99999" id="contrast__grayscale"><feColorMatrix type="matrix" values="0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"/><feComponentTransfer><feFuncR type="gamma" exponent="3"/><feFuncG type="gamma" exponent="3"/><feFuncB type="gamma" exponent="3"/></feComponentTransfer></filter><filter x="0" y="0" width="99999" height="99999" id="contrast__grayscale_back"><feComponentTransfer><feFuncR type="gamma" exponent="0.33"/><feFuncG type="gamma" exponent="0.33"/><feFuncB type="gamma" exponent="0.33"/></feComponentTransfer></filter><filter x="0" y="0" width="99999" height="99999" id="contrast__invert"><feComponentTransfer><feFuncR type="gamma" amplitude="-1" exponent="3" offset="1"/><feFuncG type="gamma" amplitude="-1" exponent="3" offset="1"/><feFuncB type="gamma" amplitude="-1" exponent="3" offset="1"/></feComponentTransfer></filter><filter x="0" y="0" width="99999" height="99999" id="contrast__invert_back"><feComponentTransfer><feFuncR type="table" tableValues="1 0"/><feFuncG type="table" tableValues="1 0"/><feFuncB type="table" tableValues="1 0"/></feComponentTransfer><feComponentTransfer><feFuncR type="gamma" exponent="1.7"/><feFuncG type="gamma" exponent="1.7"/><feFuncB type="gamma" exponent="1.7"/></feComponentTransfer></filter><filter x="0" y="0" width="99999" height="99999" id="contrast__invert_grayscale"><feColorMatrix type="matrix" values="0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"/><feComponentTransfer><feFuncR type="gamma" amplitude="-1" exponent="3" offset="1"/><feFuncG type="gamma" amplitude="-1" exponent="3" offset="1"/><feFuncB type="gamma" amplitude="-1" exponent="3" offset="1"/></feComponentTransfer></filter><filter x="0" y="0" width="99999" height="99999" id="contrast__yellow_on_black"><feComponentTransfer><feFuncR type="gamma" amplitude="-1" exponent="3" offset="1"/><feFuncG type="gamma" amplitude="-1" exponent="3" offset="1"/><feFuncB type="gamma" amplitude="-1" exponent="3" offset="1"/></feComponentTransfer><feColorMatrix type="matrix" values="0.3 0.5 0.2 0 0 0.3 0.5 0.2 0 0 0 0 0 0 0 0 0 0 1 0"/></filter><filter x="0" y="0" width="99999" height="99999" id="contrast__yellow_on_black_back"><feComponentTransfer><feFuncR type="table" tableValues="1 0"/><feFuncG type="table" tableValues="1 0"/><feFuncB type="table" tableValues="1 0"/></feComponentTransfer><feComponentTransfer><feFuncR type="gamma" exponent="0.33"/><feFuncG type="gamma" exponent="0.33"/><feFuncB type="gamma" exponent="0.33"/></feComponentTransfer></filter></defs></svg>'; 179 180let cssTemplate = 'html[hc="a0"] { -webkit-filter: url("#contrast__off"); } html[hcx="0"] img[src*="jpg"], html[hcx="0"] img[src*="jpeg"], html[hcx="0"] svg image, html[hcx="0"] img.rg_i, html[hcx="0"] embed, html[hcx="0"] object, html[hcx="0"] video { -webkit-filter: url("#contrast__off"); } html[hc="a1"] { -webkit-filter: url("#contrast__highcontrast"); } html[hcx="1"] img[src*="jpg"], html[hcx="1"] img[src*="jpeg"], html[hcx="1"] img.rg_i, html[hcx="1"] svg image, html[hcx="1"] embed, html[hcx="1"] object, html[hcx="1"] video { -webkit-filter: url("#contrast__highcontrast_back"); } html[hc="a2"] { -webkit-filter: url("#contrast__grayscale"); } html[hcx="2"] img[src*="jpg"], html[hcx="2"] img[src*="jpeg"], html[hcx="2"] img.rg_i, html[hcx="2"] svg image, html[hcx="2"] embed, html[hcx="2"] object, html[hcx="2"] video { -webkit-filter: url("#contrast__grayscale_back"); } html[hc="a3"] { -webkit-filter: url("#contrast__invert"); } html[hcx="3"] img[src*="jpg"], html[hcx="3"] img[src*="jpeg"], html[hcx="3"] img.rg_i, html[hcx="3"] svg image, html[hcx="3"] embed, html[hcx="3"] object, html[hcx="3"] video { -webkit-filter: url("#contrast__invert_back"); } html[hc="a4"] { -webkit-filter: url("#contrast__invert_grayscale"); } html[hcx="4"] img[src*="jpg"], html[hcx="4"] img[src*="jpeg"], html[hcx="4"] img.rg_i, html[hcx="4"] svg image, html[hcx="4"] embed, html[hcx="4"] object, html[hcx="4"] video { -webkit-filter: url("#contrast__invert_back"); } html[hc="a5"] { -webkit-filter: url("#contrast__yellow_on_black"); } html[hcx="5"] img[src*="jpg"], html[hcx="5"] img[src*="jpeg"], html[hcx="5"] img.rg_i, html[hcx="5"] svg image, html[hcx="5"] embed, html[hcx="5"] object, html[hcx="5"] video { -webkit-filter: url("#contrast__yellow_on_black_back"); }'; 181 182// Add the elements to the page that make high-contrast adjustments possible. 183function addOrUpdateExtraElements() { 184 if (!enabled) { 185 return; 186 } 187 188 let style = document.getElementById('hc_style'); 189 if (!style) { 190 let baseUrl = window.location.href.replace(window.location.hash, '');
191 let css = cssTemplate.replace(/#/g, baseUrl + '#'); 192 style = document.createElement('style'); 193 style.id = 'hc_style'; 194 style.setAttribute('type', 'text/css'); 195 style.innerHTML = css; 196 document.head.appendChild(style); 197 } 198 199 let bg = document.getElementById('contrast__bkgnd'); 200 if (!bg) { 201 bg = document.createElement('div'); 202 bg.id = 'contrast__bkgnd'; 203 bg.style.position = 'fixed'; 204 bg.style.left = '0px'; 205 bg.style.top = '0px'; 206 bg.style.right = '0px'; 207 bg.style.bottom = '0px'; 208 bg.style.zIndex = -1999999999; 209 document.body.appendChild(bg); 210 } 211 bg.style.display = 'block'; 212 bg.style.background = window.getComputedStyle(document.body).background; 213 214 // As a special case, replace a zero-alpha background with white, 215 // otherwise we can't invert it. 216 let c = bg.style.backgroundColor; 217 c = c.replace(/\s\s*/g, ''); 218 if (m = /^rgba\(([\d]+),([\d]+),([\d]+),([\d]+|[\d]*.[\d]+)\)/.exec(c)) { 219 if (m[4] == '0') { 220 bg.style.backgroundColor = '#fff'; 221 } 222 } 223 224 // Add a hidden element with the SVG filters. 225 let wrap = document.getElementById('contrast__svg_filters'); 226 if (wrap) 227 return; 228 229 wrap = document.createElement('span'); 230 wrap.id = 'contrast__svg_filters'; 231 wrap.setAttribute('hidden', ''); 232 wrap.innerHTML = svgContent; 233 document.body.appendChild(wrap); 234} 235 236 237// This is called on load and every time the mode might have changed 238// (i.e. enabling/disabling, or changing the type of contrast adjustment 239// for this page). 240function Update() { 241 let html = document.documentElement; 242 if (enabled) { 243 244 if (!document.body) { 245 window.setTimeout(Update, 100); 246 return; 247 } 248 addOrUpdateExtraElements(); 249 if (html.getAttribute('hc') != mode + scheme) 250 html.setAttribute('hc', mode + scheme); 251 if (html.getAttribute('hcx') != scheme) 252 html.setAttribute('hcx', scheme); 253 254 if (window == window.top) { 255 window.scrollBy(0, 1); 256 window.scrollBy(0, -1); 257 } 258 } 259 260 else { 261 html.setAttribute('hc', mode + '0'); 262 html.setAttribute('hcx', '0'); 263 window.setTimeout(function () { 264 html.removeAttribute('hc'); 265 html.removeAttribute('hcx'); 266 let bg = document.getElementById('contrast__bkgnd'); 267 if (bg) 268 bg.style.display = 'none'; 269 }, 0); 270 } 271} 272 273function ChangeMode(event) { 274 if (enabled) { 275 if (event.defaultPrevented) { 276 return; // Do nothing if the event was already processed 277 } 278 279 switch (event.code) { 280 case "Digit0": 281 case "Numpad0": 282 scheme = 0; 283 break; 284 case "Digit1": 285 case "Numpad1": 286 scheme = 1; 287 break; 288 case "Digit2": 289 case "Numpad2": 290 scheme = 2; 291 break; 292 case "Digit3": 293 case "Numpad3": 294 scheme = 3; 295 break; 296 case "Digit4": 297 case "Numpad4": 298 scheme = 4; 299 break; 300 case "Digit5": 301 case "Numpad5": 302 scheme = 5; 303 break; 304 default: 305 return; // Quit when this doesn't handle the key event. 306 } 307 Update(); 308 309 // Cancel the default action to avoid it being handled twice 310 event.preventDefault(); 311 } 312} 313 314function ToggleContrast(event) { 315 // event.preventDefault(); 316 enabled = !enabled; 317 318 if (enabled) { 319 highContrastButton[0].style.display = 'none'; 320 resetContrastButton[0].style.display = 'inline'; 321 } 322 323 else { 324 highContrastButton[0].style.display = 'inline'; 325 resetContrastButton[0].style.display = 'none'; 326 } 327 Update(); 328} 329 330function init() { 331 if (window == window.top) { 332 mode = 'a'; 333 } 334 335 else { 336 mode = 'b'; 337 } 338 339 // Update again after a few seconds and again after load so that 340 // the background isn't wrong for long. 341 window.setTimeout(addOrUpdateExtraElements, 2000); 342 window.addEventListener('load', function () { 343 addOrUpdateExtraElements(); 344 345 highContrastButton[0].addEventListener("click", ToggleContrast); 346 resetContrastButton[0].addEventListener("click", ToggleContrast); 347 if (modeChangerActive) { 348 document.addEventListener("keydown", ChangeMode); 349 } 350 // Also Update when the document body attributes change.
351 let config = { attributes: true, childList: false, characterData: false }; 352 let observer = new MutationObserver(function (mutations) { 353 addOrUpdateExtraElements(); 354 }); 355 observer.observe(document.body, config); 356 }); 357} 358 359try { 360 init(); 361} 362 363catch (error) { 364 console.log(error); 365} 366 367try { 368 Update(); 369} 370 371catch (error) { 372 console.log(error); 373} 374 375function SetCopyrightText() { 376 let currentDate = new Date(); 377 let currentYear = currentDate.getFullYear(); 378 let subFooterText = document.getElementsByClassName("sub-footer")[0].textContent; 379 let copyrightDate = subFooterText.indexOf('Copyright'); 380 let copyrightText = subFooterText.substr(copyrightDate, 16); 381 let copyrightYear = copyrightText.substring(copyrightText.length, copyrightText.length - 4); 382 copyrightYear = parseInt(copyrightYear); 383 let newCopyrightText = 'Copyright \u00A9 '; 384 385 if (copyrightYear < currentYear) { 386 newCopyrightText += copyrightYear + ' - ' + currentYear; 387 } 388 389 else { 390 newCopyrightText += copyrightYear; 391 } 392 393 let newSubFooterHTML = document.getElementsByClassName("sub-footer")[0].innerHTML.replace(copyrightText, newCopyrightText); 394 395 document.getElementsByClassName("sub-footer")[0].innerHTML = newSubFooterHTML; 396} 397 398$(document).ready(SetCopyrightText); 399 400// Add empty alt text to school manager icons since they are only decorative 401try { 402 $('img[src*="schoolmanager.catapultcms.com/utilities/GetAssetIcon"]').attr('alt', ''); 403} 404 405catch (error) { 406 console.log(error); 407} 408 409// Skip Link 410function SkipNav() { 411 const currentUrl = window.location.href; 412 const url = currentUrl.charAt(currentUrl.length - 1) === '#' ? currentUrl.slice(0, currentUrl.length - 1) : currentUrl; 413 if (url.includes("#maincontent")) { 414 window.location.assign(url); 415 } 416 else { 417 const newURL = url + '#maincontent'; 418 window.location.assign(newURL); 419 } 420} 421 422try { 423 $(document).ready(function () { 424 $("#skiptocontent").click(function (e) { 425 try { 426 e.preventDefault(); 427 SkipNav(); 428 } 429 430 catch (error) { 431 console.log(error); 432 } 433 }); 434 }); 435} 436 437catch (error) { 438 console.log(error); 439}
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.