2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6 * ===========================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END====================================================
21 Object.defineProperty(Element.prototype, 'outerHeight', {
23 var height = this.clientHeight;
24 height += getStyle(this,'marginTop');
25 height += getStyle(this,'marginBottom');
26 height += getStyle(this,'borderTopWidth');
27 height += getStyle(this,'borderBottomWidth');
32 if (document.addEventListener) {
33 document.addEventListener('DOMContentLoaded', function () {
34 var height = document.querySelector("#footer").outerHeight;
35 document.querySelector("#inner").setAttribute("style",
36 "margin-bottom:" + height.toString()+ "px");
39 window.attachEvent("onload", function () {
40 var height = document.querySelector("#footer").outerHeight;
41 document.querySelector("#inner").setAttribute("style",
42 "margin-bottom:" + height.toString()+ "px");
48 function getStyle(el, prop) {
49 var result = el.currentStyle ? el.currentStyle[prop] :
50 document.defaultView.getComputedStyle(el,"")[prop];
51 if (parseInt(result,10))
52 return parseInt(result,10);
57 function divVisibility(divID) {
58 var element = document.querySelector("#"+divID);
59 if (element.style.display=="block")
60 element.style.display="none";
62 element.style.display="block";
65 function datesURL(histPage) {
67 var yearStart = document.querySelector('#yearStart').value;
68 var yearEnd = document.querySelector('#yearEnd').value;
69 var monthStart = document.querySelector('#monthStart').value;
70 var monthEnd = document.querySelector('#monthEnd').value;
71 if (monthStart.length == 1) monthStart = 0 + monthStart;
72 if (monthEnd.length == 1) monthEnd = 0 + monthEnd;
74 validated &= validateYear(yearStart);
75 validated &= validateYear(yearEnd);
76 validated &= validateMonth(monthStart);
77 validated &= validateMonth(monthEnd);
79 if (validated) window.location=histPage+"&dates="+yearStart+monthStart+"-"+yearEnd+monthEnd;
80 else alert("Please correct your date selections");
83 function userFilter(approvalPage) {
84 var user = document.querySelector('#userTextBox').value;
86 window.location=approvalPage+"?user="+user;
88 window.location=approvalPage;
91 function validateYear(year) {
92 var today = new Date();
93 if (year >= 1900 && year <= today.getFullYear()) return true;
97 function validateMonth(month) {
98 if (month) return true;
102 function alterLink(breadcrumbToFind, newTarget) {
103 var breadcrumbs = document.querySelector("#breadcrumbs").getElementsByTagName("A");
104 for (var i=0; i< breadcrumbs.length;i++) {
105 var breadcrumbHref = breadcrumbs[i].getAttribute('href');
106 if (breadcrumbHref.indexOf(breadcrumbToFind)>-1)
107 breadcrumbs[i].setAttribute('href', newTarget);
111 // clipBoardData object not cross-browser supported. Only IE it seems
112 function copyToClipboard(controlId) {
113 var control = document.getElementById(controlId);
114 if (control == null) {
115 alert("ERROR - control not found - " + controlId);
117 var controlValue = control.href;
118 window.clipboardData.setData("text/plain", controlValue);
119 alert("Copied text to clipboard : " + controlValue);