1(function ( $ ) { 2 3 //the best component to see all the functionality for this is the header 4 //TODO: document all the options 5 6 var KEYS = { 7 TAB: 9, 8 ESC: 27, 9 ENTER: 13, 10 SPACE: 32, 11 UP: 38, 12 DOWN: 40, 13 LEFT: 37, 14 RIGHT: 39 15 } 16 17 // CSP-safe condition evaluator (replaces eval() for data attribute conditions) 18 var evaluateCondition = function(condition) { 19 if (!condition || condition === "") return false; 20 21 // Handle simple boolean strings 22 if (condition === "true") return true; 23 if (condition === "false") return false; 24 25 // Handle window width comparisons: $(window).width() < 992, $(window).width() > 768, etc. 26 var widthMatch = condition.match(/\$\(window\)\.width\(\)\s*([<>=!]+)\s*(\d+)/); 27 if (widthMatch) { 28 var operator = widthMatch[1]; 29 var value = parseInt(widthMatch[2], 10); 30 var width = $(window).width(); 31 32 switch(operator) { 33 case '<': return width < value; 34 case '<=': return width <= value; 35 case '>': return width > value; 36 case '>=': return width >= value; 37 case '==': return width == value; 38 case '===': return width === value; 39 case '!=': return width != value; 40 case '!==': return width !== value; 41 default: break; 42 } 43 } 44 45 // Unknown condition - log warning and return false (safe default) 46 console.warn('popups.js: Unrecognized condition "' + condition + '". Add support in evaluateCondition() if needed.'); 47 return false; 48 } 49 50 $(document).ready(function() { 51 //helper functions 52 window.closeGroup = function($button, includeButton) { 53 var groupname = $button.attr("data-popups-group") || $button.attr("data-group"); 54 var $groupbtns; 55 if(includeButton) { 56 $groupbtns = $("*[data-popups-group='" + groupname + "']").length > 0 ? $("*[data-popups-group='" + groupname + "']") : $("*[data-group='" + groupname + "']"); 57 } else { 58 $groupbtns = $("*[data-popups-group='" + groupname + "']").length > 0 ? $("*[data-popups-group='" + groupname + "']").not($button) : $("*[data-group='" + groupname + "']").not($button); 59 } 60 61 $groupbtns = $groupbtns.filter("[aria-expanded='true']") 62 63 64 $groupbtns.each(function(index,el){ 65 time = 0; 66 var tryLock = window.setInterval(function(){ 67 if(!closePopup($(el))) { 68 time = 50; 69 } else { 70 window.clearInterval(tryLock); 71 } 72 }, time) 73 }) 74 } 75 window.closePopup = function($button,advanceFocus) { 76 77 var speed = parseInt($button.attr("data-popups-speed") || $button.attr("data-speed") || 0,10); 78 var isModal = $button.attr("data-popups-modal") || $button.attr("data-modal") == "true" || false; 79 var $target = $("#" + $button.attr("aria-controls")); 80 81 //fall advanceFocus back to true if it us unset 82 advanceFocus = (advanceFocus == null ? true : advanceFocus) 83 84 if($target != null) { 85 if($target[0].locked){ 86 return false; 87 } 88 $target[0].locked = true; 89 90 $button.attr("aria-expanded","false"); 91 92 var openChildren = $target.find("[aria-expanded=true]"); 93 $target.slideUp(speed,function(){ 94 $target.attr("aria-hidden",true); 95 if(isModal) { 96 $("body").css({"overflow":"auto"}); 97 } 98 $target[0].locked = false; 99 openChildren.each(function(item,child){ 100 window.closePopup($(child)); 101 }) 102 $target.trigger("closed-finished.popups") 103 }); 104 $target.off("focusout.popups") 105 return true; 106 107 } else { 108 } 109 } 110 window.openPopup = function($button,skipAdvance) { 111 112 var speed = parseInt($button.attr("data-popups-speed") || $button.attr("data-speed") || 0,10); 113 var isModal = $button.attr("data-popups-modal") || $button.attr("data-modal") == "true" || false; 114 var $target = $("#" + $button.attr("aria-controls")); 115 116 if($target[0].locked){ 117 return; 118 } 119 $target[0].locked = true; 120 121 //close the siblings 122 closeGroup($button) 123 124 //open the item 125 $button.attr("aria-expanded","true"); 126 var advanceFocus = $button.attr("data-popups-advance-focus") == "true" || $button.attr("data-advance-focus") == "true"; 127 var advanceFocusTo = $button[0].hasAttribute("data-popups-advance-focus-to") ? $button.attr("data-popups-advance-focus-to") : "input,a,button" ; 128 var focusableItems = $target.find(advanceFocusTo); 129 $target.slideDown(speed,function() { 130 $target.attr("aria-hidden",false); 131 if(advanceFocus && !skipAdvance) { 132 133 focusableItems.eq(0).focus(); 134 } 135 if(isModal) { 136 $("body").css({"overflow":"hidden"}); 137 //max height to bottom of page 138 $target.css({ 139 "overflow-y": "scroll", 140 "max-height": ($(window).height() - $target.position().top) 141 }); 142 } 143 144 $button.trigger("opened-finished.popups") 145 $target[0].locked = false;
146 147 148 }); 149 150 var closeOnFocusOut = $button[0].hasAttribute("data-popups-close-on-focusout") ? $button.attr("data-popups-close-on-focusout") : true; 151 var $openArea = $target; 152 if(closeOnFocusOut == true) { 153 //close if we advance past the last item 154 $openArea.off("focusout.popups").on("focusout.popups",function(subEvent) { 155 //timeout for the focus to actually change 156 setTimeout(function () { 157 console.log($openArea.find(":focus").length > 0); 158 if ($openArea.find(":focus").length > 0) { 159 //return; 160 } else { 161 window.closePopup($button,false); 162 } 163 },75); 164 }) 165 } 166 } 167 168 //nuclear option--should only be called at the beginning after page load --better to use refreshPopup 169 window.refreshPopups = function() { 170 var popupCmps = $(".component[data-popups]"); 171 popupCmps.each(function(index, cmp) { 172 var init = window.initPopup(cmp); 173 return init; 174 }); 175 } 176 177 window.initPopup = function(button) { 178 window.registerClick(button); 179 } 180 181 window.refreshPopup = function(cmp) { 182 window.registerClick(cmp); 183 } 184 185 $(window).on("resize",function() { 186 refreshPopups() 187 }) 188 189 window.registerClick = function(cmp) { 190 191 var $cmp = $(cmp); 192 193 //unset our events ) 194 var popups = $cmp.find("*[aria-haspopup='true']"); 195 popups.off("click.popups keydown.popups"); 196 197 var closeable = $cmp.find(".closeable"); 198 closeable.off("keydown.popups"); 199 200 var closeableItems = $cmp.find("*[data-popups-closeable]"); 201 closeableItems.off("keydown.popups") 202 203 group = $cmp.find("*[data-group],*[data-popups-group]"); 204 var groupHoverChangeItems = group.filter("[data-popups-group-close*='hover']"); 205 var groupFocusChangeItems = group.filter("[data-popups-group-close*='focus']"); 206 groupHoverChangeItems.off("hover.groups"); 207 groupFocusChangeItems.off("focus.groups"); 208 209 popups.each(function(index,popup){ 210 211 $(popup).attr("data-popups-on","false") 212 //dont apply the listeners if this is true 213 if(typeof $(popup).attr("data-popups-disabled") != "undefined") { 214 if(evaluateCondition($(popup).attr("data-popups-disabled"))) { 215 return; 216 } 217 } 218 if(typeof $(popup).attr("data-popups-off-condition") != "undefined") { 219 if(evaluateCondition($(popup).attr("data-popups-off-condition"))) { 220 return; 221 } 222 } 223 $(popup).attr("data-popups-on","true") 224 225 //else apply listeners 226 $(popup).on("click.popups",function(event){ 227 228 var hrefAttr = $(event.delegateTarget).attr("href"); 229 var isAccordion = $(event.delegateTarget).hasClass("accordion-head"); 230 231 if($(window).width() > 992 && typeof hrefAttr !== 'undefined' && hrefAttr !== false && !isAccordion) { 232 window.location = hrefAttr; 233 } 234 235 if($(event.delegateTarget).attr("aria-expanded") == "true") { 236 if($(event.delegateTarget).attr("data-popups-follow-on-second-action") == "true" && !$(event.target).is($(event.delegateTarget).attr("data-popups-second-action-override-control")) ) { 237 window.location = hrefAttr; 238 } 239 event.preventDefault(); 240 window.closePopup($(event.delegateTarget)); 241 } else { 242 event.preventDefault(); 243 window.openPopup($(event.delegateTarget)); 244 } 245 }).on("keydown.popups",function(event){ 246 247 248 249 //opener keys 250 var openKeys = ["ENTER","SPACE","DOWN"]; 251 if(typeof $(event.delegateTarget).attr("data-popups-open-keys") != "undefined") { 252 openKeys = $(event.delegateTarget).attr("data-popups-open-keys").split(","); 253 } 254 var secondActionKeys = ["ENTER"]; 255 if(typeof $(event.delegateTarget).attr("data-popups-second-action-keys") != "undefined") { 256 openKeys = $(event.delegateTarget).attr("data-popups-open-keys").split(","); 257 } 258 259 openKeys.forEach(function(key) { 260 if(event.keyCode == KEYS[key]) { 261 //if its closed, open it 262 if($(event.delegateTarget).attr("aria-expanded") != "true") { 263 event.preventDefault(); 264 window.openPopup($(event.delegateTarget)); 265 } else { 266 //if its already open, and we want to follow the link on the second action, and the key is one of the second action keys 267 //if the key is one of the second action keys 268 secondActionKeys.forEach(function(secondKey) { 269 if(event.keyCode == KEYS[secondKey]){ 270 //if we want to follow on the second action 271 if($(event.delegateTarget).attr("data-popups-follow-on-second-action") == "true" && !$(event.target).is($(event.delegateTarget).attr("data-popups-second-action-override-control")) ) { 272 window.location = $(event.delegateTarget).attr("href"); 273 } 274 } 275 }) 276 //else if we made it here, do nothing 277 event.preventDefault(); 278 } 279 } 280 }) 281 282 var closeKeys = ["ESC","UP"]; 283 if(typeof $(event.delegateTarget).attr("data-popups-close-keys") != "undefined") { 284 closeKeys = $(event.delegateTarget).attr("data-popups-open-keys").split(","); 285 } 286 287 288 closeKeys.forEach(function(key) { 289 if(event.keyCode == KEYS[key] && $(event.delegateTarget).attr("aria-expanded") == "true") { 290 event.preventDefault(); 291 window.closePopup($(event.delegateTarget)); 292 } 293 }) 294 295 296 }) 297 }) 298 299 popups.filter("[aria-expanded='true']").each(function(index,element) { 300 window.openPopup($(element),true) 301 }); 302 303 //closing 304 //old
305 closeable.on("keydown.popups",function(event){ 306 if(event.keyCode == KEYS.ESC) { 307 var $fromButton = $("*[aria-controls='" + $(event.delegateTarget).attr("id") + "']"); 308 window.closePopup($fromButton); 309 $fromButton.focus(); 310 } 311 }); 312 //new 313 closeableItems.on("keydown.popups",function(event){ 314 if(event.keyCode == KEYS.ESC) { 315 var $fromButton = $("*[aria-controls='" + $(event.delegateTarget).attr("data-popups-closeable-id") + "']"); 316 window.closePopup($fromButton); 317 $fromButton.focus(); 318 } 319 }) 320 /* 321 closeableItems.on("blur",function(event){ 322 var $fromButton = $("*[aria-controls='" + $(event.delegateTarget).attr("data-popups-closeable-id") + "']"); 323 var $relatedTarget = $(event.relatedTarget); 324 var $target = $("#" + $(event.delegateTarget).attr("aria-controls")); 325 326 //is related target the child of the from button's target? 327 var isRelCh = $target.find($relatedTarget).length > 0; 328 329 if($fromButton.length > 0 && !isRelCh) { 330 window.closePopup($fromButton); 331 } 332 }) 333 */ 334 335 groupFocusChangeItems.on("focus.groups",function(event){ 336 window.closeGroup($(event.delegateTarget)); 337 }) 338 groupHoverChangeItems.on("hover.groups",function(event){ 339 window.closeGroup($(event.delegateTarget)); 340 }) 341 342 } 343 344 //initialize our popups 345 window.refreshPopups(); 346 }); 347 348 349}( jQuery )); 350 351(function ($) { 352 $(document).ready(function () { 353 var cfPath = '/bin/uc-base/emergency-notice.json'; 354 355 $.ajax({ 356 url: cfPath, 357 type: 'GET', 358 dataType: 'json', 359 cache: false 360 }).done(function (data) { 361 if (data && data.message && data.message.trim().length > 0) { 362 var $notice = $('#global-emergency-notice'); 363 var $header = $('.component.header'); 364 var template = $('body').data('template'); 365 366 $('#emergency-message').html(data.message); 367 $notice.css({ 'display': 'block' }); 368 369 // Adjust page layout for fixed emergency notice 370 var noticeHeight = $notice.outerHeight(); 371 372 // Store notice height globally for header.js scroll handler 373 window.emergencyNoticeHeight = noticeHeight; 374 375 // Add body padding to push content below fixed notice 376 $('body').css('padding-top', noticeHeight + 'px'); 377 378 if (template === 'uc-home' || template === 'uc-secondary') { 379 // These templates have fixed headers via CSS 380 // Set initial top position 381 $header.css('top', noticeHeight + 'px'); 382 } else { 383 // Affix templates: header starts relative, body padding handles it 384 // When header becomes affixed (fixed), adjust its top position 385 $header.on('affixed.bs.affix', function () { 386 $(this).css('top', noticeHeight + 'px'); 387 }); 388 389 // When header returns to top (relative), remove the top offset 390 $header.on('affixed-top.bs.affix', function () { 391 $(this).css('top', ''); 392 }); 393 } 394 } 395 }).fail(function () { 396 // Silent fail - no emergency notice shown 397 }); 398 }); 399}(jQuery)); 400 401 402(function ( $ ) { 403 404 $(document).ready(function() { 405 406 var $elements; 407 var wcmModeIsDisabled = $("body").hasClass("wcmmode-disabled"); 408 var wcmModeIsAuthor = !wcmModeIsDisabled; 409 410 function loadImage(el) { 411 $element = $(el); 412 var url = $element.attr("data-lazyload-src"); 413 $element.removeAttr("data-lazyload"); 414 $element.removeAttr("data-lazyload-src"); 415 416 if(typeof(url) == 'undefined'){ 417 return; 418 } 419 420 if($element.is("img")) { 421 $element.attr("src", url); 422 } else { 423 $element.css({ 424 "background-image" : "url(" + url + ")" 425 }); 426 } 427 428 //get a new imagelist 429 $elements = $("*[data-lazyload]"); 430 431 } 432 433 window.initImages = function() { 434 435 $elements = $("*[data-lazyload]"); 436 437 $(window).off("scroll.lazy-load"); 438 439 $(window).on("scroll.lazy-load",function(){ 440 window.checkImages(); 441 }); 442 443 //initial load 444 window.checkImages(); 445 } 446 447 window.checkImages = function() { 448 449 var windowpos = window.scrollY + window.innerHeight; 450 $elements.each(function(index, element) { 451 //if within 100 pixel of the bottom of the window, load it (or we're in author) 452 if(windowpos + 100 > $(element).offset().top || wcmModeIsAuthor) { 453 loadImage(element); 454 } 455 }) 456 } 457 458 window.initImages(); 459 460 }); 461 462}( jQuery )); 463(function ( $ ) { 464 465 466// Scroller 467// ======== 468// 469// setup: 470// .component[data-scroller] 471// ....*[data-scroller-parent][data-scroller-speed(optional)] 472// .......*[data-scroller-arrow data-scroller-arrow-left] 473// .......*[data-scroller-child] 474// ...........(items) 475// .......*[data-scroller-arrow data-scroller-arrow-right] 476 477 $(document).ready(function() { 478 479 //helper functions 480 function scollLeft() { 481 482 } 483 function scollRight() { 484 485 } 486 487 window.refreshScroller = function() { 488 var scrollerCmps = $(".component[data-scroller]"); 489 scrollerCmps.each(function(index, cmp) { 490 var init = window.initScroller(cmp); 491 return init; 492 }); 493 } 494 495 window.initScroller = function(cmp) { 496 497 //within this component find each scroller parent 498 scrollerParents = $(cmp).find("[data-scroller-parent]"); 499 500 scrollerParent.each(function(index,parent) { 501 $parent = $(parent); 502 $child = $parent.children("[data-scroller-child]"); 503 $items = $child.children(); 504 505 //set some initial css values 506 //width of parent should be handled on a case-by case, basis, but auto usually does he trick 507 $parent.css({ 508 "overflow": "hidden" 509 }); 510 $child.css({ 511 "display": "flex" 512 }); 513 $items.css({ 514 "flex-shrink" : 0 515 }) 516 517 //set the max-width of the child to the width of the containing items 518 var totalWidth = 0; 519 items.each(function(i,e) { 520 totalWidth = $(e).width(); 521 }) 522 $child.css({ 523 "width": totalWidth 524 }); 525 526 }); 527 528 529 } 530 531 }); 532 533}( 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.