1document.addEventListener('DOMContentLoaded', function () { 2 // Optimized: cache selectors, reduce DOM queries, simplify logic 3 const buttonElements = document.querySelectorAll('.save_buttons'); 4 const buttonTrElements = document.querySelectorAll('tr.save_buttons'); 5 if (buttonTrElements.length === 0 || buttonElements.length === 0) return; 6 7 const buttonSection = buttonElements[buttonElements.length - 1]; 8 const container = document.querySelector('.page_body'); 9 if (!container) return; 10 11 const updateButtonShadow = () => { 12 const buttonRect = buttonSection.getBoundingClientRect(); 13 const containerRect = container.getBoundingClientRect(); 14 if (buttonRect.top + buttonSection.offsetHeight >= containerRect.height) { 15 buttonSection.classList.add('scrolled'); 16 } else { 17 buttonSection.classList.remove('scrolled'); 18 } 19 }; 20 21 // Initial shadow state 22 updateButtonShadow(); 23 24 // On scroll, update shadow and nav boxShadow 25 container.addEventListener('scroll', function () { 26 updateButtonShadow(); 27 const topNav = this.querySelector('nav#topNav'); 28 if (topNav) { 29 topNav.style.boxShadow = this.scrollTop > 0 ? '3px 2px 6px 0 #d3d3d3' : 'none'; 30 } 31 }); 32}); 33 34var browser = {}; 35//Check for IE and its version 36browser.ie = (/MSIE (\d+\.\d+);/.test(navigator.userAgent)); 37browser.ieVersion = browser.ie ? new Number(RegExp.$1) : null; 38 39if (browser.ie == true) { 40 document.documentElement.setAttribute('class', 'ie ie' + browser.ieVersion); 41} else if (!!navigator.userAgent.match(/Trident\/7.0/) && navigator.userAgent.indexOf("rv:11.0") != -1) { 42 document.documentElement.setAttribute('class', 'ie ie11'); 43} else if (!!navigator.userAgent.match(/Edge/)) { 44 document.documentElement.setAttribute('class', 'ie edge'); 45} 46 47function hasTouchSupport() { 48 return 'ontouchstart' in window || navigator.maxTouchPoints > 0; 49} 50 51// Fix prototype based Draggable inside our scrolling div content 52if (typeof Position != "undefined") { 53 Position.includeScrollOffsets = true; 54} 55 56/*polyfill window.CustomEvent for IE*/ 57(function () { 58 if (typeof window.CustomEvent === "function") return false; 59 60 function CustomEvent(event, params) { 61 params = params || { bubbles: false, cancelable: false, detail: undefined }; 62 var evt = document.createEvent('CustomEvent'); 63 evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); 64 return evt; 65 } 66 67 CustomEvent.prototype = window.Event.prototype; 68 69 window.CustomEvent = CustomEvent; 70})(); 71 72setTimeout(function (one) { 73 // only if not supported ... 74 if (!one) { 75 var 76 slice = [].slice, 77 // trap original versions 78 Timeout = window.setTimeout, 79 Interval = window.setInterval, 80 // create a delegate 81 delegate = function (callback, $arguments) { 82 $arguments = slice.call($arguments, 2); 83 return function () { 84 callback.apply(null, $arguments); 85 }; 86 } 87 ; 88 // redefine original versions 89 window.setTimeout = function (callback, delay) { 90 return Timeout(delegate(callback, arguments), delay); 91 }; 92 window.setInterval = function (callback, delay) { 93 return Interval(delegate(callback, arguments), delay); 94 }; 95 } 96}, 0, 1); 97 98if (document.images) { 99 spinner = new Image(16, 16); 100 spinner.src = '/images/spinner.gif'; 101} 102 103/** 104 * A replacement for prototype's cumulativeOffset when needed to find position in the viewport (and not relative to parent elements). 105 * This is needed because our body does not scroll, but the page_body is a scrolling div. 106 * 107 * @param element 108 * @returns Element.Offset 109 * @deprecated Use jQuery instead of prototype's cumulativeOffset. 110 */ 111function documentOffset(element) { 112 var offset = jQuery(element).offset(); 113 return new Element.Offset(offset.left, offset.top); 114} 115 116 117function toggle_tab(id, page) { 118 display = ($('section' + id).style.display == '' ? 0 : 1); 119 $('section' + id).style.display = (display ? '' : 'none'); 120 fetch('/images/arrow_' + (display ? 'open' : 'shut') + '.php?page=' + page + '&toggle=' + id) 121 $('image' + id).classList.remove(display ? "fa-caret-right" : "fa-caret-down"); 122 $('image' + id).classList.add(display ? "fa-caret-down" : "fa-caret-right"); 123 $('header' + id).className = (display ? 'toggleon' : 'toggleoff'); 124} 125 126function openwindow(theurl, windowname, features) { 127 window.open(theurl, windowname, features); 128} 129 130function scrollAndScreen() { 131 var scrollX, scrollY, width, height; 132 if (self.pageYOffset) { 133 scrollX = self.pageXOffset; 134 scrollY = self.pageYOffset; 135 } else if (document.documentElement && document.documentElement.scrollTop) { 136 scrollX = document.documentElement.scrollLeft; 137 scrollY = document.documentElement.scrollTop; 138 } else if (document.body) { 139 scrollX = document.body.scrollLeft || document.documentElement.scrollLeft; 140 scrollY = document.body.scrollTop || document.documentElement.scrollTop; 141 }
142 if (self.innerHeight) { 143 width = self.innerWidth; 144 height = self.innerHeight; 145 } else if (document.documentElement && document.documentElement.clientHeight) { 146 width = document.documentElement.clientWidth; 147 height = document.documentElement.clientHeight; 148 } else if (document.body) { 149 width = document.body.clientWidth; 150 height = document.body.clientHeight; 151 } 152 return new Array(scrollX, scrollY, width, height); 153} 154 155function open_iframe(src, settings, withoutContainer, isFullScreen, isBetaNotification = 0) { 156 height = (settings[0] ? settings[0] : '550px'); 157 max_height = height; 158 width = (settings[1] ? settings[1] : '700px'); 159 num = (window.name == 'innerframe1' ? 2 : 1); 160 var position = (settings[2] ? settings[2] : 'absolute'); 161 var innerFrameHeight = (typeof settings[4] !== 'undefined' ? settings[4] : (height - 80)); 162 // Prevent the whole page scrolling when the root popup dialog is opened 163 if (num == 1) { 164 lockPage(); 165 } 166 167 if (withoutContainer && top.$('outerdiv' + num)) { 168 top.$('outerdiv' + num).remove(); 169 } 170 171 if (!top.$('outerdiv' + num)) { 172 top.creatediv('outerdiv' + num); 173 var o = top.$('outerdiv' + num); 174 o.addClassName('popup_outer'); 175 if (withoutContainer) { 176 o.addClassName('without_container'); 177 } 178 innerHTML = '<table id="pop_title' + num + '" cellspacing="0" cellpadding="0" class="popup_head">'; 179 innerHTML += '<tr>'; 180 innerHTML += '<td style="height:26px;max-height:26px;padding: 0px;" colspan="2">'; 181 innerHTML += '<span id="page_title' + num + '" style="position:absolute;top:6px;left:6px;font-weight:bold;color:#242e35;-moz-user-select:none;' + (num == 1 ? 'cursor:move;' : '') + '"></span>'; 182 innerHTML += '<span onclick="close_iframe(' + num + ');" id="iframe_close" style="position:absolute;top:6px;right:6px;cursor:pointer;font-size: 17px;color:red;" ><i style="position:absolute;right:6px;" class="fa fa-classic fa-regular fa-circle-xmark" aria-hidden="true" title="Close Window"></i></span>'; 183 innerHTML += '</td>'; 184 innerHTML += '</tr>'; 185 innerHTML += '<tr>'; 186 innerHTML += '<td style="padding: 0px;">'; 187 innerHTML += '<div id="page_notice' + num + '" style="display:none;width:90%;margin-left:5%;padding:10px;color: #1c7493;background:#ecf3f6;border-radius:6px;"></div>'; 188 innerHTML += '</td>'; 189 innerHTML += '</tr>'; 190 innerHTML += '</table>'; 191 innerHTML += '<iframe id="innerframe' + num + '" name="innerframe' + num + '" onload="hide_loading(' + num + ')" style="height:' + innerFrameHeight + 'px;width:100%;display:none;overflow-x:auto;overflow-y:auto;" scrolling="' + (withoutContainer ? 'no' : 'yes') + '" frameborder="0" src="' + (isBetaNotification ? src : '/cust_login.php') + '"></iframe>'; 192 innerHTML += '<div class="pre_loader" id="loading' + num + '" style="height:' + (height - 80) + 'px;width:100%;"><center><i class="fa fa-regular fa-loader fa-spin fa-xl" style="margin-right:5px;margin-top:' + ((height / 2) - 40) + 'px;"></i> <span class="frame-phrase">Loading - please wait</span></center></div>'; 193 194 o.innerHTML = innerHTML; 195 if (typeof (Draggable) == 'function' && !withoutContainer) { drag_window = new Draggable(o, { starteffect: '', endeffect: '' }); } 196 } else { 197 var o = top.$('outerdiv' + num); 198 top.$('innerframe' + num).style.height = innerFrameHeight + 'px'; 199 top.$('innerframe' + num).style.display = 'none'; 200 top.$('loading' + num).style.height = innerFrameHeight + 'px'; 201 if (typeof (Draggable) == 'function' && document.documentMode !== undefined) { drag_window = new Draggable(o, { starteffect: '', endeffect: '' }); } 202 } 203 top.$('pop_title' + num).onselectstart = function () { return false; } 204 top.$('pop_title' + num).onmousedown = function () { return false; } 205 o.style.height = height + 'px'; 206 o.style.width = width + 'px'; 207 o.style.overflow = typeof settings[3] !== 'undefined' ? settings[3] : 'hidden'; 208 top.$('loading' + num).style.display = ''; 209 if (withoutContainer) { 210 o.style.position = 'fixed'; 211 o.style.overflowX = 'auto'; 212 o.style.overflowY = 'hidden'; 213 } else { 214 o.style.position = position; 215 } 216 if (num == 1) { top.show_overlay(60); } else { show_overlay(30); } 217 position_iframe(num); 218 219 if (top.$('loading' + num).select('img')[0]) { 220 top.$('loading' + num).select('img')[0].style.marginTop = ((height / 2) - 40) + 'px'; 221 } 222 223 o.style.display = ''; 224 (num == 1 ? top.innerframe1.location.href = src : top.innerframe2.location.href = src); 225 top.hide_flyout_menus(); 226 hideselects(); 227 228 if (isFullScreen) { 229 o.style.top = 0; 230 o.style.left = 0; 231 o.style.height = '100%'; 232 o.style.width = '100%'; 233 o.select("iframe")[0].style.height = '100%'; 234 o.select("iframe")[0].style.position = 'static'; 235 o.select("iframe")[0].style.minWidth = '906px'; 236 } 237 238 //Top window is used instead of current window because it's necessary to bind resize and scroll events to root window object in any cases 239 Event.observe(top, 'resize', function () { 240 position_iframe(num, o.style.width); 241 }); 242 Event.observe(top, 'scroll', function () { 243 position_iframe(num, o.style.width); 244 }); 245} 246 247function lockPage() { 248 top.$$('body')[0].style.overflow = 'hidden'; 249} 250 251function unlockPage() { 252 top.$$('body')[0].style.overflow = ''; 253} 254 255function position_iframe(val, widthItem, heightItem) { 256 if (top) { 257 if (typeof widthItem == 'undefined') { 258 widthItem = null; 259 } else { 260 width = widthItem; 261 } 262 263 if (typeof heightItem != 'undefined') { 264 height = heightItem; 265 max_height = heightItem + 1; 266 } 267 268 vars = top.scrollAndScreen(); 269 270 if (top.$('outerdiv' + val)) { 271 if (height > vars[3] || height < max_height) { 272 height = (vars[3] <= max_height ? (vars[3] - 40) : max_height); 273 top.$('outerdiv' + val).style.height = height + 'px'; 274 top.$('innerframe' + val).style.height = (height - 80) + 'px'; 275 } 276 277 top.center_item(top.$('outerdiv' + val), width, height); 278 top.$('overlay').style.width = '100%';//top.document.body.scrollWidth+'px'; 279 top.$('overlay').style.height = (vars[3] > top.document.body.scrollHeight ? vars[3] : top.document.body.scrollHeight) + 'px'; 280 } 281 282 } 283} 284 285function set_iframe_title(title) { 286 var $iframe = jQuery(top.document).find('[name="' + window.name + '"]'); 287 if ($iframe.length && $iframe[0].style) { 288 $iframe.css('display', ''); 289 var frameNum = jQuery(window).attr('name') == 'innerframe2' ? '2' : '1'; 290 jQuery('#loading' + frameNum, top.window.document).css('display', 'none'); 291 jQuery('#page_title' + frameNum, top.window.document).html(title); 292 } 293} 294 295function set_iframe_notice(notice) { 296 if (top.$(window.name) && top.$(window.name).style) { 297 top.$((window.name == 'innerframe2' ? 'page_notice2' : 'page_notice1')).style.display = ''; 298 top.$((window.name == 'innerframe2' ? 'page_notice2' : 'page_notice1')).innerHTML = notice; 299 top.$((window.name == 'innerframe2' ? 'page_notice2' : 'page_notice1')).style.marginTop = '20p
299x'; 300 } 301} 302 303function hide_loading(num) { 304 top.$('loading' + num).style.display = 'none'; 305 top.$('innerframe' + num).style.display = ''; 306} 307 308function set_display_default(num) { 309 num = num || 1; 310 var element = top.$('innerframe' + num); 311 if (element) { 312 element.style.display = ''; 313 } 314} 315 316/** 317 * Close Ereg iframe 318 * @param num 319 */ 320function close_iframe(num) { 321 num = (num ? num : 1); 322 323 if (num != 2) { 324 top.$('overlay').hide(); 325 } else if (typeof top.innerframe1.$ === 'function' && top.innerframe1.$('overlay')) { 326 top.innerframe1.$('overlay').hide(); 327 } 328 329 if (typeof (Draggable) == 'function' && typeof (drag_window) == 'object' && document.documentMode !== undefined) { 330 drag_window.destroy(); 331 } 332 333 top.$('outerdiv' + num).style.display = 'none'; 334 top.$('innerframe' + num).style.display = 'none'; 335 if (!!top.$('page_notice' + num)) { 336 top.$('page_notice' + num).innerHTML = ''; 337 top.$('page_notice' + num).style.display = 'none'; 338 } 339 top.$('page_title' + num).innerHTML = ''; 340 341 if (num == 1) { 342 //Unlock page to allow scrolling when root popup dialog is closed 343 unlockPage(); 344 top.show_flyout_menus(); 345 top.showselects(); 346 if (typeof top.innerframe1.onclose == 'function') { 347 top.innerframe1.onclose(); 348 } 349 if (top.innerframe2) { 350 close_iframe(2); 351 } 352 } 353 354 if (typeof (close_iframe_callback) === 'function') { 355 close_iframe_callback(); 356 } 357 358 var event = new CustomEvent("delete_profile"); 359 top['innerframe' + num].dispatchEvent(event); 360 361 if (num == 1) { 362 //When root popup dialog is closed, we are not interested anymore for inner js, 363 //so we remove popup with all content inside (iframe) 364 top.$('outerdiv' + num).hide(); 365 366 if (top.$('overlay' + num)) { 367 top.$('overlay' + num).hide(); 368 } 369 370 if (top.$('spin')) { 371 top.$('spin').hide(); 372 } 373 } 374} 375 376/** 377 * Close Rfp iframe-popup 378 * @param num 379 */ 380function close_iframe_rfp(num) { 381 //Here we hide html elements 382 parent.$('overlay').hide(); 383 parent.$('#outerdiv' + num).modal('hide'); 384 parent.$('#innerframe' + num).modal('hide'); 385 parent.$('#page_title' + num).innerHTML = ''; 386} 387 388 389var helpPopupHideTimer = null; 390 391function help_popup_on(div, text, zIndex, asPlainText) { 392 if (helpPopupHideTimer) { 393 clearTimeout(helpPopupHideTimer); 394 helpPopupHideTimer = null; 395 } 396 var imgs = div.getElementsByTagName('img'); 397 for (i = 0; i < imgs.length; i++) { 398 imgs[i].src = '/images/help_over.png'; 399 } 400 vars = scrollAndScreen(); 401 if (!document.getElementById('h')) { 402 creatediv('h'); 403 } 404 var h = document.getElementById('h'); 405 var hs = h.style; 406 hs.zIndex = zIndex || 101; 407 hs.background = '#FFFFFF'; 408 hs.border = '1px solid #000000'; 409 hs.position = 'absolute'; 410 hs.width = '350px'; 411 hs.padding = '10px'; 412 if (asPlainText) { 413 h.textContent = text == null ? '' : String(text); 414 } else { 415 h.innerHTML = text; 416 } 417 hs.display = ''; 418 var offset = jQuery(div).offset(); 419 xpos = ((offset.left + 350) > (vars[0] + vars[2]) ? offset.left - 325 : offset.left - 50); 420 if (xpos < 0) xpos = 0; 421 ypos = ((offset.top + h.offsetHeight + 20) > (vars[1] + vars[3]) ? offset.top - h.offsetHeight - 5 : offset.top + 20); 422 hs.top = ypos + 'px'; 423 hs.left = xpos + 'px'; 424 var maxH = (vars[1] + vars[3]) - ypos - 20; 425 if (maxH < 80) maxH = 80; 426 hs.maxHeight = maxH + 'px'; 427 hs.overflowY = 'auto'; 428 h.onmouseover = function() { 429 if (helpPopupHideTimer) { 430 clearTimeout(helpPopupHideTimer); 431 helpPopupHideTimer = null; 432 } 433 }; 434 h.onmouseout = function() { 435 helpPopupHideTimer = setTimeout(function() { 436 var el = document.getElementById('h'); 437 if (el) el.style.display = 'none'; 438 showselects(); 439 }, 150); 440 }; 441 hideselects(); 442} 443 444function help_popup_off(div) { 445 var imgs = div.getElementsByTagName('img'); 446 for (i = 0; i < imgs.length; i++) { imgs[i].src = '/images/help_out.png'; } 447 helpPopupHideTimer = setTimeout(function() { 448 var el = document.getElementById('h'); 449 if (el) el.style.display = 'none'; 450 showselects(); 451 }, 150); 452} 453 454function load_details(im, module, id) { 455 vars = scrollAndScreen(); 456 var off = Element.cumulativeOffset(im); 457 if (off.left + 400 > vars[2]) { off.left -= 400; } 458 if (!$('det')) { creatediv('det'); } 459 new Ajax.Updater($('det'), '/loggedin/detail_popup.php', { parameters: 'module=' + module + '&id=' + id }); 460 $('det').show(); 461 $('det').setStyle({ width: '400px', top: off.top + 21 + 'px', left: off.left + 'px' }); 462} 463 464function close_details() { 465 $('det').innerHTML = ''; 466 $('det').style.display = 'none'; 467} 468 469function show_overlay(opacity, elid, zindex) { 470 vars = scrollAndScreen(); 471 var overlayId = (typeof elid == 'undefined') ? 'overlay' : elid; 472 if (!jQuery('#' + overlayId).length) { 473 creatediv(overlayId); 474 } 475 zindex = typeof zindex == 'undefined' ? 90 : zindex; 476 var o = jQuery('#' + overlayId); 477 o.css('zIndex', zindex); 478 o.css('background', '#000000'); 479 o.css('filter', 'alpha(opacity=' + opacity + ')'); 480 o.css('opacity', (opacity / 100)); 481 o.css('position', 'absolute'); 482 o.css('top', '0px'); 483 o.css('left', '0px'); 484 o.css('width', document.body.scrollWidth + 'px'); 485 o.css('height', (vars[3] > document.body.scrollHeight ? vars[3] : document.body.scrollHeight) + 'px'); 486 o.show(); 487} 488 489function show_spinner(text, zindex, width) { 490 if (!$('spin')) { creatediv('spin'); } 491 if (width === undefined) { 492 width = '200px'; 493 } else if (width.toString().indexOf('px') === -1) { 494 width += 'px'; 495 } 496 var s = $('spin'); 497 var ss = s.style; 498 if (typeof ss != 'undefined') { 499 ss.zIndex = typeof zindex == 'undefined' ? 101 : zindex; 500 ss.background = '#FFFFFF'; 501 ss.border = '1px solid #000000'; 502 ss.position = 'absolute'; 503 ss.width = width; 504 ss.height = '50px'; 505 ss.textAlign = 'center'; 506 ss.fontSize = '14px'; 507 ss.lineHeight = '50px'; 508 ss.color = '#666'; 509 s.innerHTML = '<i class="fa fa-regular fa-loader fa-spin fa-xl" style="margin-right:5px"></i> ' + text; 510 center_item(s, 200, 50); 511 ss.display = ''; 512 } 513} 514 515function hide_spinner() { 516 var $spin = $('spin'); 517 if ($spin) { 518 $spin.style.display = 'none'; 519 $('overlay').style.display = 'none'; 520 } 521} 522 523var timeoutTimer; 524var originalTitle = document.title; 525var flashTimer; 526var windowHasFocus = true; 527var sessionTimeoutLimit = 30; 528var timeoutLeft; 529 530var warningTimer = function () { 531 var seconds = parseInt($('timeout_warning_counter').innerHTML); 532 if (isNaN(seconds)) { 533 window.clearInterval(timeoutTimer); 534 //reset_timeout_warning is not defined in code 535 if (typeof (reset_timeout_warning) !== 'undefined') { 536 reset_timeout_warning(); 537 } 538 } else if (seconds < 2) { 539 window.clearInterval(timeoutTimer); 540 check_timeout_warning(); 541 } else { 542 timeoutLeft = seconds - 1; 543 $('timeout_warning_counter').innerHTML = timeoutLeft; 544 } 545}; 546 547var flashTitle = function () { 548 document.title = (document.title == originalTitle) ? 'Warning: ' + timeoutLeft + ' Seconds Till Log Out!' : originalTitle; 549} 550 551function show_timeout_warning(timeout) { 552 timeoutLeft = timeout; 553 show_overlay(30, 'timeout_overlay', 200); 554 if (!$('timeout_warning')) { creatediv('timeout_warning'); } 555 var s = $('timeout_warning'); 556 var ss = s.style; 557 ss.zIndex = 19011; 558 ss.position = 'absolute'; 559 ss.width = '500px'; 560 ss.height = '170px'; 561 ss['box-shadow'] = '2px 2px 6px rgba(0,0,0,0.6)'; 562 ss.background = '#FFF'; 563 ss['border-bottom'] = '1px solid rgb(255,255,255)'; 564 ss.borderRadius = '5px'; 565 ss['font-family'] = 'Arial'; 566 567 s.innerHTML = '<p style="font-family:\'MuseoSans 500\', Arial, sans-serif;margin: 0 0 0 0; background-color: var(--primary-theme-color);font-size: 18px; font-weight: bold; padding: 8px; color: white;border-top: 1px solid var(--primary-theme-color);border-left: 1px solid var(--primary-theme-color);border-right: 1px solid var(--primary-theme-color);border-top-left-radius: 5px;border-top-right-radius: 5px;">Inactivity Warning!</p>' + 568 '<div style="padding: 10px;">' + 569 '<div style="position: relative;">' + 570 '<p style="position: absolute;top: 0px; left: 0px; width: 65px; margin: 0 0 0 0; padding: 5px; color: #FFF; background-color: #000; text-align: center; font-family:arial">' + 571 '<span id="timeout_warning_counter" style="font-size: 24px; font-family:\'MuseoSans 500\', Arial">' + timeout + '</span><br/>Seconds' + 572 '</p>' + 573 '<div style="padding-left: 90px; font-size: 16px;font-family:\'MuseoSans 500\', Arial, sans-serif;">You will be logged out from STOVA shortly due to inactivity. ' + 574 'If you are still working, you may extend your session for another <span id="session_timeout" style="font-size: 16px; font-weight: bold">' + sessionTimeoutLimit + '</span> minutes.' + 575 '</div>' + 576 '<hr style="border: 1px dotted black"/>
576' + '<input id="timeout_warning_ping" type="button" class="submit" style="font-size: 15px; font-family: \'MuseoSans 500\', Arial, sans-serif" value="I\'m Still Here!"/>' + 577 '</div>'; 578 center_item(s, 500, 160); 579 ss.display = ''; 580 timeoutTimer = setInterval(warningTimer, 1000); 581 clearInterval(flashTimer); 582 flashTimer = setInterval(flashTitle, 500); 583 $('timeout_warning_ping').on('click', function (ev) { 584 ev.preventDefault(); 585 hide_timeout_warning(); 586 check_timeout_warning('session_ping'); 587 }) 588} 589 590function hide_timeout_warning() { 591 if ($('timeout_warning')) { 592 $('timeout_warning').hide(); 593 if (document.getElementById('timeout_overlay') !== null) { 594 $('timeout_overlay').hide(); 595 } 596 else if (document.getElementById('overlay') !== null) { 597 $('overlay').hide(); 598 } 599 clearInterval(timeoutTimer); 600 document.title = originalTitle; 601 if (flashTimer) { 602 clearInterval(flashTimer); 603 } 604 } 605} 606 607function expired_timeout_warning(url) { 608 location.href = url + 'u=' + encodeURI(location.pathname + location.search); 609} 610 611var pop_up_jquery_implementations = function () { 612 show_overlay = function (opacity, elid, zindex) { 613 vars = scrollAndScreen(); 614 var overlayId = (typeof elid == 'undefined') ? 'overlay' : elid; 615 if (!$('#' + overlayId).length) { creatediv(overlayId); } 616 var s = $('#' + overlayId); 617 s.css('zIndex', (typeof zindex == 'undefined') ? 90 : zindex); 618 s.css('background', '#000000'); 619 s.css('filter', 'alpha(opacity=' + opacity + ')'); 620 s.css('opacity', (opacity / 100)); 621 s.css('position', 'absolute'); 622 s.css('top', '0px'); 623 s.css('left', '0px'); 624 s.css('width', document.body.scrollWidth + 'px'); 625 s.css('height', (vars[3] > document.body.scrollHeight ? vars[3] : document.body.scrollHeight) + 'px'); 626 s.css('display', ''); 627 }; 628 629 center_item = function (item, width, height) { 630 vars = scrollAndScreen(); 631 item.css('left', vars[0] + (vars[2] - width) / 2 + 'px'); 632 item.css('top', vars[1] + (vars[3] - height) / 2 + 'px'); 633 }; 634 635 show_timeout_warning = function (timeout) { 636 timeoutLeft = timeout; 637 show_overlay(30, 'timeout_overlay', 200); 638 if (!$('#timeout_warning').length) { creatediv('timeout_warning'); } 639 var s = $('#timeout_warning'); 640 s.css('zIndex', 19011); 641 s.css('position', 'absolute'); 642 s.css('width', '500px'); 643 s.css('height', 'auto'); 644 s.css('box-shadow', '2px 2px 6px rgba(0,0,0,0.6)'); 645 s.css('background', '#FFF'); 646 s.css('border-bottom', '1px solid rgb(255,255,255)'); 647 s.css('borderRadius', '5px'); 648 s.css('font-family', 'Arial'); 649 650 s.html('<p style="font-family:\'MuseoSans 500\', Arial, sans-serif;margin: 0 0 0 0; background-color: var(--primary-theme-color);font-size: 18px; font-weight: bold; padding: 8px; color: white;border-top: 1px solid var(--primary-theme-color);border-left: 1px solid var(--primary-theme-color);border-right: 1px solid var(--primary-theme-color);border-top-left-radius: 5px;border-top-right-radius: 5px;">Inactivity Warning!</p>' + 651 '<div style="padding: 10px;">' + 652 '<div style="position: relative;">' + 653 '<p style="position: absolute;top: 0px; left: 0px; width: 65px; margin: 0 0 0 0; padding: 5px; color: #FFF; background-color: #000; text-align: center; font-family:arial">' + 654 '<span id="timeout_warning_counter" style="font-size: 24px; font-family:\'MuseoSans 500\', Arial">' + timeout + '</span><br/>Seconds' + 655 '</p>' + 656 '<div style="padding-left: 90px; font-size: 16px;font-family:\'MuseoSans 500\', Arial, sans-serif;">You will be logged out from STOVA shortly due to inactivity. ' + 657 'If you are still working, you may extend your session for another <span id="session_timeout" style="font-size: 16px; font-weight: bold">' + sessionTimeoutLimit + '</span> minutes.' + 658 '</div>' + 659 '<hr style="border: 1px dotted black" class="timeout_warning_hr"/>
659' + '<input id="timeout_warning_ping" type="button" class="submit" style="font-size: 15px; font-family: \'MuseoSans 500\', Arial, sans-serif" value="I\'m Still Here!"/>' + 660 '</div>'); 661 center_item(s, 500, 160); 662 s.css('display', ''); 663 timeoutTimer = setInterval(warningTimer, 1000); 664 clearInterval(flashTimer); 665 flashTimer = setInterval(flashTitle, 500); 666 $('#timeout_warning_ping').on('click', function (ev) { 667 ev.preventDefault(); 668 hide_timeout_warning(); 669 check_timeout_warning('session_ping'); 670 }) 671 }; 672 673 hide_timeout_warning = function () { 674 if ($('#timeout_warning').length) { 675 $('#timeout_warning').hide(); 676 $('#timeout_overlay').hide(); 677 clearInterval(timeoutTimer); 678 document.title = originalTitle; 679 if (flashTimer) { 680 clearInterval(flashTimer); 681 } 682 } 683 }; 684}; 685 686 687function check_timeout_warning(action) { 688 var check_timeout_url = '/loggedin/index.php'; 689 690 var request_params = { 691 action: (typeof (action) == 'undefined') ? 'session_timeout_check' : action 692 }; 693 694 var response_callback = function (response) { 695 if (!response.responseJSON || response.responseJSON.session_timeleft < 2) { 696 expired_timeout_warning(response.responseJSON.login_url); 697 } else if (response.responseJSON.session_timeleft < 61) { 698 show_timeout_warning(response.responseJSON.session_timeleft); 699 } else { 700 hide_timeout_warning(); 701 var showAfter = response.responseJSON.session_timeleft - 60; 702 setTimeout(check_timeout_warning, (showAfter < 0 ? 1 : showAfter) * 1000); 703 } 704 }; 705 706 var check_timeout_warning_prototype_implementation = function () { 707 new Ajax.Request(check_timeout_url, { 708 parameters: request_params, 709 asynchronous: false, 710 onComplete: response_callback 711 }); 712 }; 713 714 var check_timeout_warning_jquery_implementation = function () { 715 $.ajax({ 716 type: "POST", 717 data: request_params, 718 url: check_timeout_url, 719 dataType: "json", 720 success: function (response) { 721 var data = {}; 722 data['responseJSON'] = response; 723 response_callback(data); 724 } 725 }); 726 }; 727 728 if (typeof (Ajax) === 'undefined') { 729 pop_up_jquery_implementations(); 730 check_timeout_warning_jquery_implementation(); 731 } else { 732 check_timeout_warning_prototype_implementation(); 733 } 734} 735 736function center_item(item, width, height) { 737 vars = scrollAndScreen(); 738 item.style.left = vars[0] + (vars[2] - width) / 2 + 'px'; 739 var top_height = vars[1] + (vars[3] - height) / 2; 740 if (top_height < 0) { 741 top_height = 0; 742 } 743 item.style.top = top_height + 'px'; 744} 745 746/* Visibility functions used by old eHome */ 747function set_visible(num) { 748 num = num || 1; 749 var element = top.$('innerframe' + num); 750 751 if (element) { 752 element.style.visibility = 'visible'; 753 } 754} 755function hide_visibility(num) { 756 num = num || 1; 757 var element = top.$('innerframe' + num); 758 759 if (element) { 760 element.style.visibility = 'hidden'; 761 } 762} 763 764if (typeof (jQuery) !== "undefined") { 765 jQuery(document).ready(function () { 766 var keyCodes = [33, 34, 38, 40]; 767 768 //prevent default action 769 jQuery("#cloneButton").click(function (event) { 770 event.preventDefault(); 771 }); 772 773 jQuery('#search_term').unbind('focus').focus(function () { 774 jQuery('#search_suggestions').html(''); 775 }).unbind('keyup').keyup(function (event) { 776 if (jQuery.inArray(event.which, keyCodes) >= 0) { 777 searchResultKeyboarNav(event.which); 778 return false; 779 } else if (event.which == 13 && jQuery('#site-search-result ul li.hover').length > 0) { 780 window.location.href = jQuery('#site-search-result ul li.hover:eq(0) a').attr('href'); 781 return false;
782 } else { 783 taskbar_site_search(jQuery(this).val(), $('site-search')); 784 } 785 }); 786 }); 787} 788 789function searchResultKeyboarNav(keyCode) { 790 var $searchResult = jQuery('#site-search-result'); 791 var $searchResultItems = $searchResult.find('ul li'); 792 var index = $searchResultItems.filter('.hover').index(); 793 var len = $searchResultItems.length; 794 795 if (keyCode == 40) { 796 // arrow down 797 if (index == -1) { 798 index = 1; 799 } else { 800 $searchResultItems.eq(index).removeClass('hover'); 801 index++; 802 } 803 804 if (index == len) { 805 index = 1; 806 } 807 808 } else if (keyCode == 38) { 809 // arrow up 810 if (index == -1) { 811 index = len - 1; 812 } else { 813 $searchResultItems.eq(index).removeClass('hover'); 814 index--; 815 } 816 817 if (index == 0) { 818 index = len - 1; 819 } 820 } else if (keyCode == 34 && $searchResult.find('div.pagination a.left').length > 0) { 821 // page down 822 $searchResult.find('div.pagination a.left').click(); 823 return false; 824 } else if (keyCode == 33 && $searchResult.find('div.pagination a.right').length > 0) { 825 // page up 826 $searchResult.find('div.pagination a.right').click(); 827 return false; 828 } 829 830 $searchResultItems.eq(index).addClass('hover'); 831} 832 833var search_timeout, search_offset, search_output, searchType, searchTerm, searchSuggestions; 834function taskbar_site_search(search_term, search_wrapper) { 835 var searchSuggestionsOuter = $(search_wrapper).down('div#search_suggestions_outer'); 836 searchType = $(search_wrapper).down('input#search_type'); 837 searchTerm = $(search_wrapper).down('input#search_term'); 838 searchSuggestions = $('site-search-result'); 839 840 search_offset = 0; 841 search_output = 'encode'; 842 window.clearTimeout(search_timeout); 843 searchSuggestionsOuter.show(); 844 search_term = search_term.replace('%', '').trim(); 845 if (search_term.length > 0) { 846 search_timeout = setTimeout(site_search(searchType, searchTerm, searchSuggestions), 1000); 847 } else { 848 searchSuggestions.innerHTML = ''; 849 } 850} 851 852function site_search() { 853 if (typeof siteSearch == 'object') 854 siteSearch.transport.abort(); 855 acc = ($('search_acc') ? '&accountid=' + $('search_acc').value : ''); 856 jQuery("#loaderId").show(); 857 siteSearch = new Ajax.Request('/loggedin/search.php?search=' + searchTerm.value + '&type=' + searchType.value + '&offset=' + search_offset + '&output=' + search_output + acc, { 858 onSuccess: function (response) { 859 var result = JSON.parse(response.responseText); 860 861 var resultHtml = '<ul><li><h3>Search Result</h3></li>'; 862 863 var resultsPerPage = 6; 864 865 if (result.length > 0) { 866 for (var i = 0; i < result.length; i++) { 867 if (i >= resultsPerPage) { 868 continue; 869 } 870 var href = '#'; 871 var onclick = ''; 872 if (result[i].popup) { 873 onclick = "window.open('" + result[i].url + "', '', '" + result[i].popup + "'); " + 874 "jQuery('#site-search-result').removeClass('open').addClass('closed');" + 875 "return false;"; 876 } else if (result[i].iframe && !result[i].url) { 877 onclick = "open_iframe('" + result[i].iframe + "', new Array('700','750')); return false;"; 878 } else if (result[i].alert) { 879 onclick = "ShowCustomDialog();"; 880 oncontextmenu = "ShowCustomDialog();"; 881 } else { 882 href = result[i].url; 883 } 884 resultHtml += '<li><a href="' + href + '" onclick="' + onclick + '" oncontextmenu="' + oncontextmenu + '">[' + result[i].id + '] ' + result[i].name + '</a></li>'; 885 } 886 } else { 887 resultHtml += '<li class="noresults">No results.</li>'; 888 } 889 890 var prevArrowOnclick = search_offset - resultsPerPage; 891 var nextArrowOnclick = search_offset + resultsPerPage; 892 893 resultHtml += '</ul><div class="pagination-wrap"><div class="pagination">'; 894 if (search_offset > 0) { 895 resultHtml += '<a class="left" onclick=\'(function(e) {search_page_change(' + prevArrowOnclick + ', e)})(event)\'></a>'; 896 } else { 897 resultHtml += '<span class="placeHolder"></span>'; 898 } 899 900 var searchResultCount = 0; 901 if (result.length > resultsPerPage) { 902 searchResultCount = search_offset + resultsPerPage; 903 } else { 904 searchResultCount = search_offset + result.length 905 } 906 907 var searchResultCountStart = 0; 908 if (result.length > 0) { 909 searchResultCountStart = search_offset + 1; 910 } 911 resultHtml += '<span>Results ' + searchResultCountStart + ' to ' + searchResultCount + '</span>'; 912 if (result.length > resultsPerPage) { 913 resultHtml += '<a class="right" onclick=\'(function(e) {search_page_change(' + nextArrowOnclick + ', e)})(event)\'></a>'; 914 } else { 915 resultHtml += '<span class="placeHolder"></span></div></div>'; 916 } 917 918 searchSuggestions.innerHTML = resultHtml; 919 searchSuggestions.addClassName('open'); 920 jQuery("#loaderId").hide(); 921 var $searchResultItems = jQuery('#site-search-result ul li'); 922 $searchResultItems.unbind('mouseover').unbind('mouseout').mouseover(function () { 923 $searchResultItems.filter('.hover').removeClass('hover'); 924 jQuery(this).addClass('hover'); 925 }).mouseout(function () { 926 jQuery(this).removeClass('hover'); 927 }); 928 } 929 }); 930} 931 932function search_page_change(offset, e) { 933 search_offset = offset; 934 935 //preventing futher event propagation to document element 936 e.stopPropagation(); 937 site_search(); 938} 939 940var retain_time_picker; 941function get_time_picker_values(format, limit) { 942 var values = []; 943 for (i = 0; i < 24; i++) { 944 if (limit && !(i >= limit.start.hour && i <= limit.end.hour)) { 945 continue; 946 } 947 for (j = 0; j < 46; j += 15) { 948 if (limit && ((i == limit.start.hour && j < limit.start.minute) || (i == limit.end.hour && j > limit.end.minute))) { 949 continue; 950 } 951 if (format == 'H:i:s' || format == 'H:i') { 952 value = (i < 10 ? '0' : '') + i + ':' + (j < 10 ? '0' : '') + j; 953 } else { 954 hour = (i > 12 ? i - 12 : (i == 0 ? 12 : i)); 955 am_pm = (i > 11 ? 'pm' : 'am'); 956 value = hour + ':' + (j < 10 ? '0' : '') + j + ' ' + am_pm; 957 } 958 values.push(value); 959 } 960 } 961 return values; 962} 963 964var timePickerHolder; 965function show_time_picker(input_id, format) { 966 967 if (!$('time')) { creatediv('time'); } 968 var t = $('time'); 969 var ts = t.style; 970 var timeDisplayElement = jQuery('#' + input_id.replace(/(\[|\])/g, '\\$1')); 971 var offset = timeDisplayElement.offset(); // Replace escapes brackets to make selector valid 972 var limitObj = $(input_id).getAttribute('limit'); 973 var limit; 974 if (limitObj.length) { 975 limit = limitObj.evalJSON(); 976 } 977 var html = '<select id="time_drop" size="15" style="border:1px solid #999999;" onfocus="retain_time_picker=1;" onclick="$(\'' + input_id + '\').value=this.value;close_time_picker();
977" onblur="close_time_picker();">'; 978 979 if(hasTouchSupport()) { 980 html = '<select id="time_drop" size="15" style="border:1px solid #999999;" onfocus="retain_time_picker=1;" onclick="$(\'' + input_id + '\').value=this.value;" onblur="close_time_picker();">'; 981 } 982 else 983 { 984 html = '<select id="time_drop" size="15" style="border:1px solid #999999;" onfocus="retain_time_picker=1;" onclick="$(\'' + input_id + '\').value=this.value;close_time_picker();" onblur="close_time_picker();">'; 985 } 986 987 get_time_picker_values(format,limit).each(function(value) { 988 html+='<option value="'+value+'" '+(value==$(input_id).value?'selected="selected"':'')+'>'+value+'</option>'; 989 }); 990 991 html += '</select>'; 992 t.innerHTML = html; 993 ts.position = 'absolute'; 994 ts.left = offset.left + 'px'; 995 ts.display = ''; 996 vars = scrollAndScreen(); 997 998 ts.top = (offset.top + timeDisplayElement.outerHeight()) + 'px'; 999 if ((offset.top + t.offsetHeight) > (vars[1] + vars[3])) { 1000 ts.top = (offset.top - t.offsetHeight) + 'px'; 1001 } 1002 1003 if (!timePickerHolder) { 1004 timePickerHolder = jQuery(timeDisplayElement); 1005 } 1006 1007 var $pageBody = jQuery('.page_body'); 1008 var $timePicker = jQuery('#time'); 1009 if ($pageBody.length > 0) { 1010 $pageBody.scroll(function () { 1011 if (!$timePicker.length) { 1012 return; 1013 } 1014 var top = timePickerHolder.offset().top + timePickerHolder.outerHeight(); 1015 $timePicker.css({ top: top + 'px' }); 1016 }); 1017 } 1018 if(hasTouchSupport()) { 1019 jQuery("#time_drop").on("change.art", function(){ 1020 var timeVal = jQuery('#time_drop').val(); 1021 $(input_id).value = timeVal; 1022 jQuery("#time_drop").off(); 1023 }); 1024 } 1025} 1026 1027function close_time_picker() { 1028 if ($('time').style.display != 'none') { 1029 var $pageBody = jQuery('.page_body'); 1030 if ($pageBody.length > 0) { 1031 $pageBody.unbind('scroll'); 1032 } 1033 setTimeout(function () { $('time').style.display = (!retain_time_picker ? 'none' : ''); }, 20); 1034 } 1035 if (timePickerHolder) { 1036 timePickerHolder = null; 1037 } 1038 retain_time_picker = 0; 1039} 1040 1041function getAbsPos(elt, which) { 1042 iPos = 0; 1043 while (elt != null) { 1044 iPos += elt['offset' + which]; 1045 elt = elt.offsetParent; 1046 } 1047 return iPos; 1048} 1049 1050function deleteEl(el) { 1051 new Effect.Highlight(el, { startcolor: '#ff0000', endcolor: '#ffffff', afterFinish: function () { el.hide(); Element.remove(el); } }); 1052} 1053function sort(section, col, total, retain_direction, nobg) { 1054 var cols = new Array(); 1055 1056 // Check if the column element exists 1057 if ($(section + '_' + col)) { 1058 // Determine the sorting direction (toggle between 'asc' and 'desc') 1059 var direction = ($(section + '_' + col).className.indexOf('fa-sort-up') > 0 ? 'desc' : 'asc'); 1060 1061 // Toggle the direction if 'retain_direction' is true 1062 if (retain_direction) { 1063 direction = (direction === 'asc' ? 'desc' : 'asc'); 1064 } 1065 1066 // Reset the icons for other columns 1067 for (var i = 0; i < total; i++) { 1068 if (i != col && $(section + '_' + i)) { 1069 $(section + '_' + i).className = 'fa fa-sort fas fa-xs'; // Reset to default sorting icon 1070 } 1071 } 1072 1073 // Set the icon for the current column based on direction 1074 if (direction === 'asc') { 1075 $(section + '_' + col).className = 'fa fa-sort-up fas fa-xs'; // Ascending order 1076 } else { 1077 $(section + '_' + col).className = 'fa fa-sort-down fas fa-xs'; // Descending order 1078 } 1079 1080 // Collect the rows to be sorted 1081 var all_divs = $(section).getElementsByTagName('div'); 1082 for (var i = 0; i < all_divs.length; i++) { 1083 var all_cols = all_divs[i].getElementsByTagName('td'); 1084 cols[i] = { 1085 id: all_divs[i].id, 1086 value: (all_cols[col] ? all_cols[col].innerHTML : '') 1087 }; 1088 } 1089 1090 // Sort the rows based on the direction 1091 cols.sort(direction === 'desc' ? sortDesc : sortAsc); 1092 1093 // Re-insert the sorted rows into the section 1094 for (var i = 0; i < cols.length; i++) { 1095 el = Element.remove($(cols[i]).id); 1096 Element.insert($(section), el); 1097 } 1098 1099 // Optionally reorder background colors 1100 if (!nobg) { 1101 reorder_bgcolor('div', section, ''); 1102 } 1103 1104 // Save the sort state (optional) 1105 if ($('save_' + section + '_sort')) { 1106 $('save_' + section + '_sort').value = col + direction; 1107 } 1108 } 1109} 1110 1111function sortAsc(a, b) { 1112 var x = a.value.toLowerCase(); 1113 var y = b.value.toLowerCase(); 1114 return ((x < y) ? -1 : ((x > y) ? 1 : 0)); 1115} 1116 1117function sortDesc(a, b) { 1118 var x = a.value.toLowerCase(); 1119 var y = b.value.toLowerCase(); 1120 return ((x < y) ? 1 : ((x > y) ? -1 : 0)); 1121} 1122 1123function reorder_bgcolor(element, my_section, ignore) { 1124 var bgcolor = '#FFFFFF'; 1125 var all_els = $(my_section).getElementsByTagName(element); 1126 for (var i = 0; i < all_els.length; i++) { 1127 if (all_els[i].style.display != 'none' && all_els[i] != ignore) { 1128 bgcolor = (bgcolor == '#FFFFFF' ? '#eeeeee' : '#FFFFFF'); 1129 all_els[i].style.background = bgcolor; 1130 } 1131 } 1132} 1133 1134function creatediv(id, parent) { 1135 var newDiv = jQuery('<div></div>').attr('id', id).css({ display: 'none' }); 1136 if (!parent) { 1137 parent = document.body; 1138 } 1139 jQuery(parent).append(newDiv); 1140} 1141 1142function hideselects() { 1143 if (typeof document.body.style.maxHeight == 'undefined') { 1144 var elements = document.getElementsByTagName('select'); 1145 for (i = 0; i < elements.length; i++) { elements[i].style.visibility = 'hidden'; } 1146 } 1147} 1148 1149function showselects() { 1150 if (typeof document.body.style.maxHeight == 'undefined') { 1151 var elements = document.getElementsByTagName('select'); 1152 for (i = 0; i < elements.length; i++) { elements[i].style.visibility = 'visible'; } 1153 } 1154} 1155 1156function setSelection(obj, s, e) { 1157 obj.focus(); 1158 if (obj.setSelectionRange) { 1159 obj.setSelectionRange(s, e); 1160 } else if (obj.createTextRange) { 1161 m = obj.createTextRange(); 1162 m.moveStart('character', s); 1163 m.moveEnd('character', e); 1164 m.select(); 1165 } 1166} 1167 1168String.prototype.addslashes = function () { 1169 return this.replace(/(["\\\.\|\[\]\^\*\+\?\$\(\)])/g, '\\$1'); 1170} 1171String.prototype.trim = function () { 1172 return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"); 1173} 1174 1175// is a given input a number? 1176function isNumber(a) { 1177 return typeof a == 'number' && isFinite(a); 1178} 1179 1180/* Object Functions */ 1181 1182 1183function addOption(theSel, theText, theValue) { 1184 var newOpt = new Option(theText, theValue); 1185 var selLength = theSel.length; 1186 theSel.options[selLength] = newOpt; 1187} 1188 1189function deleteOption(theSel, theIndex) { 1190 var selLength = theSel.length; 1191 if (selLength > 0) { theSel.options[theIndex] = null; } 1192} 1193 1194function moveOptions(theSelFrom, theSelTo, hidden) { 1195 var selLength = theSelFrom.length; 1196 var selectedText = new Array(); 1197 var selectedValues = new Array(); 1198 var selectedCount = 0; 1199 var i; 1200 for (i = selLength - 1; i >= 0; i--) { 1201 if (theSelFrom.options[i].selected) { 1202 selectedText[selectedCount] = theSelFrom.options[i].text; 1203 selectedValues[selectedCount] = theSelFrom.options[i].value; 1204 deleteOption(theSelFrom, i); 1205 selectedCount++; 1206 } 1207 } 1208 for (i = selectedCount - 1; i >= 0; i--) { 1209 addOption(theSelTo, selectedText[i], selectedValues[i]); 1210 } 1211 1212 if (theSelTo.name.indexOf('resource_assignment') != -1 && theSelTo.options.length > 0) { 1213 document.getElementById('resource_inf_msg').classList.remove('hidden'); 1214 } 1215 1216} 1217 1218function moveAllMultiselectListboxOptions(theSelFrom, theSelTo, hidden) { 1219 selectAllMultiselectOptions(jQuery(theSelFrom)); 1220 moveOptions(theSelFrom, theSelTo, hidden); 1221} 1222 1223function selectall(id) { 1224 if ($(id)) { 1225 var length = $(id).length; 1226 for (var i = 0; i < length; i++) { 1227 $(id).options[i].selected = true; 1228 } 1229 } 1230} 1231 1232function selectAllMultiselectOptions($select) { 1233 if ($select) { 1234 $select.find('option').prop('selected', true); 1235 } 1236} 1237 1238function number_format(a, b, c, d) { 1239 a = Math.round(a * Math.pow(10, b)) / Math.pow(10, b); 1240 e = a + ''; 1241 f = e.split('.'); 1242 if (!f[0]) { f[0] = '0'; } 1243 if (!f[1]) { f[1] = ''; } 1244 if (f[1].length < b) { 1245 g = f[1]; 1246 for (i = f[1].length + 1; i <= b; i++) { g += '0'; } 1247 f[1] = g; 1248 } 1249 if (d != '' && f[0].length > 3) { 1250 h = f[0]; 1251 f[0] = ''; 1252 for (j = 3; j < h.length; j += 3) { 1253 i = h.slice(h.length - j, h.length - j + 3); 1254 f[0] = d + i + f[0] + ''; 1255 } 1256 j = h.substr(0, (h.length % 3 == 0) ? 3 : (h.length % 3)); 1257 f[0] = j + f[0]; 1258 } 1259 c = (b <= 0) ? '' : c; 1260 return f[0] + c + f[1]; 1261} 1262 1263function loadselectdescription(id) { 1264 if (id.options[id.selectedIndex].title) { 1265 var selectDescEl = document.getElementById('selectdescription'); 1266 selectDescEl.style.top = getAbsPos(id, 'Top'); 1267 selectDescEl.style.left = getAbsPos(id, 'Left') + id.offsetWidth; 1268 selectDescEl.innerHTML = id.options[id.selectedIndex].title + "<p align=center><a href='javascript:closeselectdescription();'>Close</a></p>"; 1269 selectDescEl.style.display = ''; 1270 } else { 1271 closeselectdescription(); 1272 } 1273} 1274 1275function closeselectdescription() { 1276 var selectDescEl = document.getElementById('selectdescription'); 1277 if (selectDescEl?.style.display == '') { selectDescEl.style.display = 'none'; } 1278} 1279 1280function gettopposition(id) { 1281 if (navigator.appName == "Microsoft Internet Explorer") { 1282 positiontop = (document.body.offsetHeight - document.getElementById(id).clientHeight) / 2 + document.body.scrollTop; 1283 if (positiontop < 0) { 1284 positiontop = 50; 1285 } 1286 } else { 1287 toppos = window.innerHeight - document.getElementById(id).clientHeight; 1288 positiontop = (toppos / 2); 1289 positiontop += window.pageYOffset; 1290 } 1291 return positiontop; 1292} 1293 1294var intFPS = 80; 1295var fltTransitionTimeInSeconds = 0.3; 1296var intBaseCloseHeight = 17; 1297var intTargetOpenHeight = 151; 1298var fltTransitionValue = 0 1299var intTransitionDirection = 0; 1300var objCurrentItem = null; 1301 1302 1303document.addEventListener("click", function (e) { 1304 let repFilterFlyout = top.document.querySelector(".rep_filter_flyout"); 1305 let parentElement = e.target.parentElement; 1306 let parentClassName = parentElement ? parentElement.className : ""; 1307 1308 // Check if the filter flyout is open and should be closed 1309 let shouldCloseFlyout = 1310 repFilterFlyout && 1311 repFilterFlyout.style.display !== "none" && 1312 parentClassName !== "sp_over"; 1313 1314 if (shouldCloseFlyout) { 1315 // Prevent closing if clicking on input-group-addon 1316 if (parentElement && parentClassName.indexOf("input-group-addon") > -1) { 1317 return false;
1318 } 1319 top.close_col_filter(""); 1320 } else { 1321 // Handle sp_over/sp_out toggle 1322 let toggleSpClass = function () { 1323 if (parentElement && parentClassName === "sp_out") { 1324 parentElement.className = "sp_over"; 1325 } 1326 }; 1327 1328 try { 1329 let frame = top.frames.length ? top.frames[0] : top.frames; 1330 let nodes = frame.document.querySelectorAll(".f .sp_over"); 1331 1332 [].forEach.call(nodes, function (node) { 1333 node.className = "sp_out"; 1334 }); 1335 1336 toggleSpClass(); 1337 } catch (err) { 1338 // Cross-origin frame access blocked - skip this operation 1339 toggleSpClass(); 1340 } 1341 } 1342}); 1343 1344function isMouseLeaveOrEnter(e, handler) { 1345 if (e.type != 'mouseout' && e.type != 'mouseover') { return false; } 1346 var reltg = (e.relatedTarget ? e.relatedTarget : (e.type == 'mouseout' ? e.toElement : e.fromElement)); 1347 while (reltg && reltg != handler) { reltg = reltg.parentNode; } 1348 return (reltg != handler); 1349} 1350 1351function hide_flyout_menus() { 1352 if (document.documentMode !== undefined) { 1353 if ($('leftnavlinks')) { $('leftnavlinks').style.display = 'none'; } 1354 if ($('eventquicklinks')) { $('eventquicklinks').style.display = 'none'; } 1355 } 1356} 1357 1358function show_flyout_menus() { 1359 if (document.documentMode !== undefined) { 1360 if ($('leftnavlinks')) { $('leftnavlinks').style.display = ''; } 1361 if ($('eventquicklinks')) { $('eventquicklinks').style.display = ''; } 1362 } 1363} 1364 1365function ajaxWrapper(url, params, successFunc) { 1366 new Ajax.Request(url, { parameters: params, onFailure: function () { ajaxWrapper(url, params, successFunc); }, onSuccess: successFunc }); 1367} 1368 1369function callInProgress(t) { 1370 switch (t.readyState) { 1371 case 1: case 2: case 3: 1372 return true; 1373 break; 1374 default: 1375 return false; 1376 break; 1377 } 1378} 1379 1380function in_array(needle, haystack, strict) { 1381 hsl = haystack.length; 1382 for (i = 0; i < hsl; i++) { 1383 if (strict) { 1384 if (haystack[i] === needle) { return true; } 1385 } else { 1386 if (haystack[i] == needle) { return true; } 1387 } 1388 } 1389 return false; 1390} 1391 1392function validate_email(email) { 1393 if (email == '*/email/*') { return true; } 1394 email = email.replace("'", ''); 1395 var reg = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/i; 1396 return reg.test(email); 1397} 1398 1399function validate_email_wildcard(email) { 1400 email = email.replace("'", ''); 1401 var reg = /^([A-Za-z0-9_\-\.\*])+\@([A-Za-z0-9_\-\.\*])+\.([A-Za-z]{2,})$/; 1402 return reg.test(email); 1403} 1404 1405function validate_domain(domain) { 1406 return /^([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,})$/.test(domain); 1407} 1408 1409function validate_ip(ip) { 1410 return /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(ip); 1411} 1412 1413function validate_company_email_domain(domain) { 1414 return /^([A-Za-z0-9_\-]+\.)+([A-Za-z]{2,})$/.test(domain); 1415} 1416 1417function attendeepopup(item, eventid, attendeeid) { 1418 vars = scrollAndScreen(); 1419 if (!$('attendeepopup')) { 1420 creatediv('attendeepopup'); 1421 $('attendeepopup').setStyle({ zIndex: 101, width: '500px', border: '1px solid #000000', position: 'absolute', background: '#FFFFFF', textAlign: 'center' }); 1422 } 1423 var a = $('attendeepopup'), 1424 report_scroll = $('report_scroll'), 1425 itemposx = getAbsPos(item, 'Left'), 1426 itemposy = getAbsPos(item, 'Top'), itemxpos, itemypos; 1427 1428 // Adjustment for Right side Popup positioning 1429 if (itemposx > 450) { 1430 itemxpos = itemposx - 490; 1431 itemypos = itemposy; 1432 } else { 1433 itemxpos = itemposx - (report_scroll ? report_scroll.scrollLeft : ''); 1434 itemypos = itemposy - (report_scroll ? report_scroll.scrollTop : ''); 1435 } 1436 1437 a.setStyle({ top: (itemypos + 20) + 'px', left: (itemxpos - 10) + 'px' }); 1438 Element.update(a, '<br /><i class="fa fa-regular fa-loader fa-spin fa-xl" style="margin-right:5px;"></i> Loading<br /><br />'); 1439 a.show(); 1440 popup = new Ajax.Request('/loggedin/eReg/manage/attendeepopup.php', 1441 { 1442 parameters: 'eventid=' + eventid + '&attendees=' + attendeeid, 1443 onSuccess: function (t) { 1444 Element.update(a, t.responseText); 1445 if (itemposx < 450) { 1446 xpos = (itemxpos + 500) > (vars[0] + vars[2]) ? itemxpos - 475 : itemxpos - 10; 1447 if ((itemypos + a.offsetHeight + 20) > (vars[1] + vars[3])) { 1448 if (a.offsetHeight > itemypos) { 1449 if (itemypos >= a.offsetHeight / 2) { 1450 ypos = itemypos - a.offsetHeight / 2; 1451 } else { 1452 ypos = 0; 1453 } 1454 1455 xpos += item.parentNode.offsetWidth; 1456 } else { 1457 ypos = itemypos - a.offsetHeight - 30; 1458 } 1459 } else { 1460 ypos = itemypos + 20; 1461 } 1462 a.setStyle({ top: ypos + 'px', left: xpos + 'px' }); 1463 popup = ''; 1464 } 1465 } 1466 }); 1467} 1468 1469function closeattendeepopup() { 1470 if (typeof (popup) == 'object') { popup.transport.abort(); } 1471 $('attendeepopup').hide(); 1472} 1473 1474function discountpopup(item, eventid, feeid) { 1475 vars = scrollAndScreen(); 1476 if (!$('discountpopup')) { 1477 creatediv('discountpopup'); 1478 $('discountpopup').setStyle({ zIndex: 101, width: '200px', border: '1px solid #000000', position: 'absolute', background: '#FFFFFF', textAlign: 'center' }); 1479 } 1480 var a = $('discountpopup'); 1481 var itemxpos = getAbsPos(item, 'Left') - ($('report_scroll') ? $('report_scroll').scrollLeft : ''); 1482 var itemypos = getAbsPos(item, 'Top') - ($('report_scroll') ? $('report_scroll').scrollTop : ''); 1483 a.setStyle({ top: (itemypos + 20) + 'px', left: (itemxpos - 10) + 'px' }); 1484 Element.update(a, '<br /><i class="fa fa-regular fa-loader fa-spin fa-xl" style="margin-right:5px;"></i> Loading<br /><br />'); 1485 a.show(); 1486 popup = new Ajax.Request('/loggedin/eReg/discountcodespopup.php', { parameters: 'eventid=' + eventid + '&feeid=' + feeid, onSuccess: function (t) { Element.update(a, t.responseText); xpos = ((itemxpos) > (vars[0] + vars[2]) ? itemxpos - 475 : itemxpos - 10); ypos = ((itemypos + a.offsetHeight + 20) > (vars[1] + vars[3]) ? itemypos - a.offsetHeight - 30 : itemypos + 20); a.setStyle({ top: ypos + 'px', left: xpos + 'px' }); popup = ''; } }); 1487} 1488 1489function closediscountpopup() { 1490 if (typeof (popup) == 'object') { popup.transport.abort(); } 1491 $('discountpopup').hide(); 1492} 1493 1494function pickcolor(id) { 1495 var buttonHeight = 37; 1496 if (typeof (currentid) == 'string') { 1497 jQuery('#' + currentid).css({ 1498 margin: '1px', 1499 border: '1px solid #000' 1500 }); 1501 } 1502 if (typeof (cp1) != 'object') { 1503 return; 1504 } 1505 1506 jQuery('#' + id).css({ 1507 margin: '0px', 1508 border: '2px solid red' 1509 }); 1510 1511 vars = scrollAndScreen(); 1512 1513 imageypos = jQuery('#' + id).offset().top; 1514 imagexpos = jQuery('#' + id).offset().left; 1515 1516 var cpObject = jQuery('#colorpicker'); 1517 cpObject.show(); 1518 1519 xpos = imagexpos; 1520 ypos = imageypos + 20; 1521 if ((imagexpos + 450) > (vars[2] + vars[0])) { 1522 xpos = imagexpos - 400; 1523 } 1524 if ((imageypos + cpObject.outerHeight() + buttonHeight * 2) > (vars[3] + vars[1])) { 1525 ypos = imageypos - cpObject.outerHeight(); 1526 } 1527 if (ypos < 0) { 1528 ypos = 55; 1529 } 1530 cpObject.css({ 1531 top: ypos + 'px', 1532 left: xpos + 'px' 1533 }); 1534 1535 var startval = jQuery('#' + id + 'field').val().replace('#', ''); 1536 jQuery('#cp1_Hex').val(startval);
1537 cp1._cvp = new Refresh.Web.ColorValuePicker('cp1'); 1538 cp1._cvp.color.setHex(startval); 1539 cp1.positionMapAndSliderArrows(); 1540 cp1.updateVisuals(); 1541 1542 jQuery('#mappoint').show(); 1543 jQuery('#rangearrows').show(); 1544 1545 hideselects(); 1546 1547 currentid = id; 1548} 1549 1550function setcolor(color) { 1551 $(currentid).style.margin = '1px'; 1552 $(currentid).style.border = '1px solid #000'; 1553 $('colorpicker').hide(); 1554 $('mappoint').hide(); 1555 $('rangearrows').hide(); 1556 if (color) { 1557 $(currentid).style.background = color; 1558 $(currentid + 'field').value = color; 1559 if (typeof (refresh_preview) == 'function') { refresh_preview(currentid, color); } 1560 } 1561 showselects(); 1562} 1563 1564function multiSelect(sel, vals, allselectedtext, emptypermitted) { 1565 var current = sel.options[0].text; 1566 if (typeof (emptypermitted) == 'undefined') { 1567 emptypermitted = false; 1568 } 1569 sel.disabled = true; 1570 if (!$('multiSelect')) { 1571 creatediv('multiSelect'); 1572 } else if ($('multiSelect').style.display == '') { 1573 fireEvent($(document.body), 'click'); 1574 } 1575 $('multiSelect').setStyle( 1576 { 1577 zIndex: 5, 1578 width: (parseInt($(sel).getWidth()) - 6) + 'px', 1579 height: 'auto', 1580 position: 'absolute', 1581 background: '#FFFFFF', 1582 textAlign: 'left', 1583 top: (jQuery(sel).offset().top + 35) + 'px', 1584 left: (jQuery(sel).offset().left + 1) + 'px', 1585 padding: '4px', 1586 height: 'auto', 1587 bottom: 'auto' 1588 } 1589 ); 1590 var html = ''; 1591 for (i = 0; i < vals.length; i++) { 1592 1593 html += '<div>'; 1594 html += '<input type="checkbox" id="' + vals[i] + '" value="' + vals[i] + '" ' + (current.indexOf(vals[i]) != -1 || current == allselectedtext ? 'checked="checked"' : '') + ' /> '; 1595 html += '<label for="' + vals[i] + '">' + vals[i] + '</label>'; 1596 html += '</div>'; 1597 1598 } 1599 html += '<div align="center">'; 1600 html += '<input type="button" value="Done" class="submit" onclick="saveMultiSelect($(\'' + sel.id + '\'),\'' + allselectedtext + '\',' + emptypermitted + ');" /> '; 1601 html += '</div>'; 1602 $('multiSelect').innerHTML = html; 1603 Effect.BlindDown('multiSelect', { duration: 0.1 }); 1604 Event.observe($(document.body), 'click', function (event) { 1605 if (!in_array($('multiSelect'), event.element().ancestors()) && event.element().id != sel.id) { 1606 $('multiSelect').hide(); 1607 sel.disabled = false; 1608 $(document.body).stopObserving('click'); 1609 } 1610 }); 1611} 1612 1613function saveMultiSelect(sel, allselectedtext, emptypermitted) { 1614 if (typeof (emptypermitted) == 'undefined') { 1615 emptypermitted = false; 1616 } 1617 var val = ''; 1618 var unselected_statuses = 0; 1619 var collection = $('multiSelect').getElementsByTagName('INPUT'); 1620 for (i = 0; i < collection.length; i++) { 1621 if (collection[i].type.toUpperCase() == 'CHECKBOX') { 1622 if (collection[i].checked) { 1623 val += (val ? ', ' : '') + collection[i].value; 1624 } else { 1625 unselected_statuses++; 1626 } 1627 } 1628 } 1629 if (!val && !emptypermitted) { 1630 alert('Please ensure you have selected at least one option'); 1631 return false; 1632 } else { 1633 $('multiSelect').hide(); 1634 } 1635 val = (unselected_statuses < 1 ? allselectedtext : val); 1636 sel.options[0].text = val; 1637 sel.disabled = false; 1638 if (typeof (window['save_' + sel.id]) == 'function') { 1639 window['save_' + sel.id](sel, val); 1640 1641 } 1642} 1643 1644function fireEvent(element, event) { 1645 if (document.createEventObject) { 1646 var evt = document.createEventObject(); 1647 return element.fireEvent('on' + event, evt) 1648 } else { 1649 var evt = document.createEvent("HTMLEvents"); 1650 evt.initEvent(event, true, true); 1651 return !element.dispatchEvent(evt); 1652 } 1653} 1654 1655function getTransformProperty(element) { 1656 var properties = [ 1657 'transform', 1658 'WebkitTransform', 1659 'msTransform', 1660 'MozTransform', 1661 'OTransform' 1662 ]; 1663 var p; 1664 while (p = properties.shift()) { 1665 if (typeof element.style[p] != 'undefined') { 1666 return p; 1667 } 1668 } 1669 return false;
1670} 1671 1672function getTransform(el) { 1673 prop = getTransformProperty(el); 1674 if (prop != false) { 1675 transform = el.style[prop]; 1676 transform = parseInt(transform.replace('rotate(', '').replace('deg)', '')); 1677 return (!isNaN(transform) ? transform : 0); 1678 } 1679 return 0; 1680} 1681 1682function load_support() { 1683 window.open("/zendesk_sso.php"); 1684} 1685 1686// Waitlist js code 1687window.waitlistReport = (function () { 1688 return { 1689 switchView: function (view) { 1690 var viewId = view.value, 1691 filterId = view.options[view.selectedIndex].getAttribute('data-filter-id'); 1692 1693 report.update_report('action=switch_view&viewid=' + viewId + '&filterid=' + filterId); 1694 }, 1695 1696 switchCategory: function (category) { 1697 report.update_report('action=switch_category&category_id=' + category.value); 1698 } 1699 }; 1700})(); 1701 1702// UI size selection actions 1703document.addEventListener("DOMContentLoaded", function () { 1704 function setUISize(size) { 1705 var selected = document.getElementById('ui-size-select-' + size); 1706 var unselected = document.getElementById('ui-size-select-' + (size === 'standard' ? 'small' : 'standard')); 1707 selected.className = 'active'; 1708 unselected.className = 'inactive'; 1709 document.body.className = document.body.className.replace(/ui-size-\w+/, 'ui-size-' + size); 1710 new Ajax.Request('/loggedin/set_user_preferences.php', { 1711 method: 'post', 1712 parameters: { 1713 action: 'ui-size', 1714 csrf: csrf, 1715 size: size 1716 }, 1717 onSuccess: function (response) { 1718 for (var i = window.frames.length - 1; i >= 0; i--) { 1719 //do not reload frames if within sitebuilder module 1720 if (!window.frames[i].ip && !window.frames[i].ip.baseUrl.includes('websites')) { 1721 window.frames[i].location.reload(); 1722 } 1723 } 1724 } 1725 }); 1726 } 1727 1728 var uiSelectSmall = document.getElementById('ui-size-select-small'); 1729 if (uiSelectSmall) { 1730 uiSelectSmall.addEventListener('click', function (e) { 1731 e.preventDefault(); 1732 e.stopPropagation(); 1733 setUISize('small'); 1734 }); 1735 } 1736 1737 var uiSelectStandard = document.getElementById('ui-size-select-standard'); 1738 if (uiSelectStandard) { 1739 uiSelectStandard.addEventListener('click', function (e) { 1740 e.preventDefault(); 1741 e.stopPropagation(); 1742 setUISize('standard'); 1743 }); 1744 } 1745}); 1746 1747function hideTopNavElm(className) { 1748 if (jQuery(className).hasClass('open')) { 1749 jQuery(className).removeClass('open'); 1750 } 1751} 1752 1753var heapAnalitics = { 1754 id: 0, 1755 init: function () { 1756 1757 if (heapAnalitics.id == 0) { 1758 return; 1759 } 1760 1761 window.heap = window.heap || [], heap.load = function (e, t) { 1762 window.heap.appid = e, window.heap.config = t = t || {}; 1763 var r = t.forceSSL || "https:" === document.location.protocol, 1764 a = document.createElement("script"); 1765 a.type = "text/javascript", a.async = !0, a.src = (r ? "https:" : "http:") + "//cdn.heapanalytics.com/js/heap-" + e + ".js"; 1766 var n = document.getElementsByTagName("script")[0]; 1767 n.parentNode.insertBefore(a, n); 1768 for (var o = function (e) { 1769 return function () { 1770 heap.push([e].concat(Array.prototype.slice.call(arguments, 0))) 1771 } 1772 }, p = ["addEventProperties", "addUserProperties", "clearEventProperties", "identify", "removeEventProperty", "setEventProperties", "track", "unsetEventProperty"], c = 0; c < p.length; c++) heap[p[c]] = o(p[c]) 1773 }; 1774 heap.load(heapAnalitics.id); 1775 } 1776}; 1777 1778var bookmarks = { 1779 items: null, 1780 showing: 0, 1781 init: function () { 1782 bookmarks.pagination.element = jQuery('.bookmarksResult .pagination'); 1783 if (bookmarks.pagination.element < 1) { 1784 return; 1785 } 1786 1787 bookmarks.items = jQuery('.bookmarksResult > ul > li.bookmark') 1788 if (bookmarks.items <= 6) { 1789 bookmarks.pagination.element.hide(); 1790 return; 1791 } 1792 1793 bookmarks.items.slice(6).hide(); 1794 1795 jQuery('span', bookmarks.pagination.element).text('1 to 6'); 1796 1797 bookmarks.pagination.left = jQuery('.left', bookmarks.pagination.element); 1798 bookmarks.pagination.left.addClass('disabled'); 1799 bookmarks.pagination.right = jQuery('.right', bookmarks.pagination.element); 1800 1801 bookmarks.click(); 1802 }, 1803 reInit: function () { 1804 jQuery('.bookmarksResult > ul > li.bookmark').show(); 1805 bookmarks.pagination.element.show(); 1806 bookmarks.pagination.left.removeClass('disabled'); 1807 bookmarks.pagination.right.removeClass('disabled'); 1808 bookmarks.showing = 0; 1809 bookmarks.init(); 1810 }, 1811 add: function (form) { 1812 var bookmark = jQuery('<li class="bookmark name"></li>'); 1813 bookmark.append('<a href="' + window.parent.location.href + '">' + jQuery('input[name="name"]', form).val() + '</a>'); 1814 bookmark.insertAfter(jQuery('.bookmarksResult > ul li:first-child', window.parent.document)); 1815 jQuery('.bookmarksResult > ul > li.extra.noresults', window.parent.document).remove(); 1816 jQuery.post('/loggedin/' + form.attr('action'), form.serialize()); 1817 }, 1818 pagination: { 1819 element: null, 1820 left: null, 1821 right: null, 1822 click: function (e, link) { 1823 e.preventDefault(); 1824 e.stopPropagation(); 1825 if (link.hasClass('left')) { 1826 bookmarks.showing -= 6; 1827 } else {
1828 bookmarks.showing += 6; 1829 } 1830 bookmarks.items.hide(); 1831 bookmarks.items.slice(bookmarks.showing, bookmarks.showing + 6).show(); 1832 var last = bookmarks.showing + 6; 1833 if (last > bookmarks.items.length) { 1834 last = bookmarks.items.length; 1835 } 1836 jQuery('span', bookmarks.pagination.element).text((bookmarks.showing + 1) + ' to ' + last); 1837 if (bookmarks.showing == 0) { 1838 if (!bookmarks.pagination.left.hasClass('disabled')) { 1839 bookmarks.pagination.left.addClass('disabled'); 1840 } 1841 } else { 1842 bookmarks.pagination.left.removeClass('disabled'); 1843 } 1844 if (bookmarks.showing + 6 >= bookmarks.items.length) { 1845 if (!bookmarks.pagination.right.hasClass('disabled')) { 1846 bookmarks.pagination.right.addClass('disabled'); 1847 } 1848 } else { 1849 bookmarks.pagination.right.removeClass('disabled'); 1850 } 1851 } 1852 }, 1853 click: function () { 1854 jQuery('a', bookmarks.pagination.element).on('click', function (e) { 1855 var link = jQuery(this); 1856 if (link.hasClass('disabled')) { 1857 return; 1858 } 1859 bookmarks.pagination.click(e, link); 1860 }); 1861 } 1862} 1863 1864if (typeof (jQuery) !== "undefined") { 1865 jQuery(document).ready(function () { 1866 var toggleLeftNav = function () { 1867 var $hamburgerBtn = jQuery('#hamburger-btn'); 1868 $hamburgerBtn.toggleClass('open'); 1869 jQuery('#leftNav').toggleClass('leftnav-open'); 1870 jQuery('#topNav').toggleClass('leftnav-open'); 1871 jQuery('#leftNav .bottomList').toggleClass('leftnav-open'); 1872 if (jQuery('#notification-banner').length > 0) { 1873 jQuery('#notification-banner').toggleClass('leftnav-open'); 1874 } 1875 jQuery('body').toggleClass('leftnav-open'); 1876 if ($hamburgerBtn.hasClass('open')) { 1877 setTimeout(() => { 1878 jQuery('#feedback-trigger').css('bottom', '42% '); 1879 jQuery('#feedback-trigger').css('right', 'auto '); 1880 jQuery('#feedback-trigger').css('left', '108px'); 1881 jQuery('#feedback-trigger').css('animation', '0.2s ease 0s 1 alternate forwards running pendoFeedbackSlideIn'); 1882 }, "80"); 1883 // Hamburger button is on (navbar is open) 1884 } else { 1885 setTimeout(() => { 1886 jQuery('#feedback-trigger').css('bottom', '42% '); 1887 jQuery('#feedback-trigger').css('right', 'auto '); 1888 jQuery('#feedback-trigger').css('left', '-121px '); 1889 }, "80"); 1890 // Hamburger button is off (navbar is closed) 1891 } 1892 //While left nav is opening or closing we trigger an event every 10ms 1893 var interval = setInterval(function () { 1894 jQuery(window).trigger('leftnav-toggling'); 1895 if (typeof (top.leftNavToggling) === "function") { 1896 top.leftNavToggling(); 1897 } 1898 }, 10); 1899 1900 //After left nav is opened or closed we clear the interval and fire a final event 1901 setTimeout(function () { 1902 jQuery(window).trigger('leftnav-toggle'); 1903 if (typeof (top.leftNavToggle) === "function") { 1904 top.leftNavToggle(); 1905 } 1906 clearInterval(interval); 1907 }, 500); 1908 } 1909 1910 jQuery('#hamburger-btn').on('click', toggleLeftNav); 1911 1912 jQuery('#leftNav ul.accordion>li>a').on('click', function (event) { 1913 if (jQuery('.subMenu', jQuery(this).parent()).length < 1) { 1914 return; 1915 } 1916 jQuery(this).parent().toggleClass('open'); 1917 event.preventDefault(); 1918 1919 var opened = []; 1920 1921 jQuery('#leftNav .left-nav-top > nav > ul.accordion li.open').each(function (i, el) { 1922 opened.push(jQuery(el).attr('rel')); 1923 }); 1924 1925 jQuery.post( 1926 '/loggedin/set_user_preferences.php', 1927 { 1928 action: 'menu-items', 1929 csrf: csrf, 1930 opened: opened 1931 } 1932 ); 1933 return false;
1934 }); 1935 1936 jQuery('#leftNav ul.accordion>li>ul.subMenu>li>a').on('click', function (event) { 1937 if (jQuery('.subMenu', jQuery(this).parent()).length < 1) { 1938 return; 1939 } 1940 jQuery(this).parent().toggleClass('open'); 1941 event.preventDefault(); 1942 return false; 1943 }); 1944 1945 jQuery('#leftNav .left-nav-bottom .userNav>a ').on('click', function (event) { 1946 jQuery(this).parent().toggleClass('open'); 1947 event.preventDefault(); 1948 return false; 1949 }); 1950 1951 1952 var topmenu = jQuery('a.topmenu'); 1953 if (topmenu.length) { 1954 topmenu.on('mouseover', function () { 1955 $(this).closest('li').addClass('active'); 1956 }); 1957 topmenu.on('mouseout', function () { 1958 $(this).closest('li').removeClass('active'); 1959 }); 1960 } 1961 1962 var hideTopNavResults = function () { 1963 hideTopNavElm('.bookmarksResult'); 1964 hideTopNavElm('#site-search-result'); 1965 hideTopNavElm('.viewedResult'); 1966 if (jQuery('#site-search-selector-list').is(':visible')) { 1967 jQuery('#site-search-selector-list').hide(); 1968 } 1969 }; 1970 1971 jQuery(document).on('click', hideTopNavResults); 1972 jQuery('iframe').each(function () { 1973 var iframe = jQuery(this); 1974 iframe.on('load', function () { 1975 iframe.contents().on('click', hideTopNavResults); 1976 }) 1977 }); 1978 var $siteSearchResult = jQuery('#site-search-result'); 1979 $siteSearchResult.click(function (e) { 1980 e.stopPropagation(); 1981 hideTopNavElm('.bookmarksResult'); 1982 hideTopNavElm('.viewedResult'); 1983 }); 1984 jQuery('.search-btn').click(function (e) { 1985 e.stopPropagation(); 1986 if (!$siteSearchResult.hasClass('open')) { 1987 $siteSearchResult.addClass('open').show(); 1988 } 1989 }); 1990 jQuery('.bookmarks-btn').click(function (e) { 1991 e.stopPropagation(); 1992 if (jQuery('.bookmarksResult').hasClass('open')) { 1993 hideTopNavElm('.bookmarksResult'); 1994 return; 1995 } 1996 hideTopNavElm('#site-search-result'); 1997 hideTopNavElm('.viewedResult'); 1998 if (jQuery('#site-search-selector-list').is(':visible')) { 1999 jQuery('#site-search-selector-list').hide(); 2000 } 2001 jQuery('.bookmarksResult').addClass('open'); 2002 }); 2003 jQuery('.recent-btn').click(function (e) { 2004 e.stopPropagation(); 2005 if (jQuery('.viewedResult').hasClass('open')) { 2006 hideTopNavElm('.viewedResult'); 2007 return; 2008 } 2009 hideTopNavElm('.bookmarksResult'); 2010 hideTopNavElm('#site-search-result'); 2011 if (jQuery('#site-search-selector-list').is(':visible')) { 2012 jQuery('#site-search-selector-list').hide(); 2013 } 2014 jQuery('.viewedResult').addClass('open'); 2015 }); 2016 jQuery('#site-search-selector-label').click(function (e) { 2017 e.stopPropagation(); 2018 jQuery('#site-search-selector-list').toggle(); 2019 if (jQuery('.bookmarksResult').hasClass('open')) { 2020 hideTopNavElm('.bookmarksResult'); 2021 return; 2022 } 2023 hideTopNavElm('#site-search-result'); 2024 hideTopNavElm('.viewedResult'); 2025 }); 2026 jQuery('#site-search-selector-list > li > span').click(function (e) { 2027 var relValue = jQuery(this).attr('rel'); 2028 if (relValue == 'contacts' || relValue == 'emails') { 2029 jQuery('search_term').css({ width: '52%' }); 2030 jQuery('search_suggestions_outer').css({ width: '52%' }); 2031 } else { 2032 jQuery('search_term').css({ width: '60%' }); 2033 jQuery('search_suggestions_outer').css({ width: '60%' }); 2034 } 2035 2036 // TODO: Move from prototype to jQuery 2037 var searchWrapper = $('site-search'); 2038 var selectedSpan = $(this).up('div.ver-flyout-inversed').down('ul>li>span.label'); 2039 var relValue = this.getAttribute('rel'); 2040 e.preventDefault(); 2041 $$('.ver-flyout-inversed>ul>li>ul>li>span').invoke('removeClassName', 'selected'); 2042 this.addClassName('selected'); 2043 2044 selectedSpan.innerHTML = this.innerHTML; 2045 selectedSpan.className.split(' ').forEach(function (item) { 2046 if (item !== 'label') { 2047 selectedSpan.removeClassName(item); 2048 } 2049 }); 2050 selectedSpan.addClassName(this.getAttribute('rel'));
2051 searchWrapper.down('input#search_type').value = relValue; 2052 2053 taskbar_site_search(searchWrapper.down('input#search_term').value, $('site-search')); 2054 2055 $$('site-search-selector ul li ul').each(function (el) { 2056 el.setStyle({ display: 'none' }); 2057 }); 2058 }); 2059 2060 bookmarks.init(); 2061 heapAnalitics.init(); 2062 }); 2063} 2064 2065function updateLimitedLicenseTooltip(element) { 2066 var basicTitle = 'The feature you are trying to access is available in Venue Sourcing Premium. Please contact your Account Manager to learn more.'; 2067 element.find("[title]").addBack().each(function () { 2068 if (typeof jQuery(this).attr('title') !== 'undefined' && jQuery(this).attr('title').indexOf(basicTitle) < 0) { 2069 if (jQuery(this).attr('title') == '') { 2070 jQuery(this).attr('title', basicTitle); 2071 } else { 2072 jQuery(this).attr('title', jQuery(this).attr('title') + ' [' + basicTitle + ']'); 2073 } 2074 } 2075 }); 2076} 2077 2078if (typeof (jQuery) !== "undefined") { 2079 jQuery(document).ready(function () { 2080 jQuery('.restricted-action-only-tooltip').each(function () { 2081 updateLimitedLicenseTooltip(jQuery(this)); 2082 }); 2083 jQuery('.restricted-action').each(function () { 2084 updateLimitedLicenseTooltip(jQuery(this)); 2085 jQuery(this).find('button, input, a, select').addBack().each(function () { 2086 jQuery(document).off('click', jQuery(this)); 2087 jQuery(this).off('click').unbind('click').attr('href', 'javascript:void();').attr('target', '') 2088 .attr('disabled', 'disabled'); 2089 jQuery(this).on('click', function (e) { 2090 //RFP.module('shared').module('alert').show(RFP.module('shared').module('alert').DANGER, "You do not have access to this action in Limited License"); 2091 e.preventDefault(); 2092 }); 2093 }); 2094 }); 2095 }) 2096 2097 jQuery(document).on('change', '.js-sourcing-subscription', function () { 2098 jQuery('.js-sourcing-subscription').not(this).removeAttr('checked').removeProp('checked').prop('checked', false); 2099 }); 2100} 2101 2102function copyToClipboard(text) { 2103 var $temp = jQuery("<input>"); 2104 jQuery("body").append($temp); 2105 $temp.val(text).select(); 2106 document.execCommand("copy"); 2107 $temp.remove(); 2108} 2109 2110function getActiveBrowser() { 2111 var browser = navigator.userAgent, tem, M = browser.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; 2112 if (/trident/i.test(M[1])) { 2113 tem = /\brv[ :]+(\d+)/g.exec(browser) || []; 2114 return { name: 'IE', version: (tem[1] || '') }; 2115 } 2116 if (M[1] === 'Chrome') { 2117 tem = browser.match(/\bOPR|Edge\/(\d+)/) 2118 if (tem != null) { return { name: 'Opera', version: tem[1] }; } 2119 } 2120 M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?']; 2121 if ((tem = browser.match(/version\/(\d+)/i)) != null) { M.splice(1, 1, tem[1]); } 2122 return { 2123 name: M[0], 2124 version: M[1] 2125 }; 2126} 2127 2128function hide_iframe_close() { 2129 if (top.$(window.name) && top.$(window.name).style) { 2130 top.$('iframe_close').style.display = 'none'; 2131 } 2132} 2133 2134function ShowCustomDialog() { 2135 jQuery('.global-confirm-box').show(); 2136} 2137 2138function closeAlert() { 2139 jQuery('.global-confirm-box').hide(); 2140} 2141 2142function decreaseCounter(ele, minVal) { 2143 let $input = jQuery(ele).parent().find('input'); 2144 let count = parseInt($input.val()) - 1; 2145 count = count < minVal ? minVal : count; 2146 $input.val(count); 2147 $input.change(); 2148 return false; 2149} 2150 2151function increaseCounter(ele) { 2152 let $input = jQuery(ele).parent().find('input'); 2153 $input.val(parseInt($input.val()) + 1); 2154 $input.change(); 2155 return false; 2156}
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.