PageSourceSearch

https://www2.myworkpension.co.uk/Resources/System/JavaScript/resize.js.aspx

js myworkpension.co.uk collected 2026-10-04 17:57:48 UTC 5,636 bytes, 156 lines download raw bytes

1
2
3function debugMessage(aMessage) {
4  var ENABLELOGGING = false;
5
6  if (ENABLELOGGING) {
7if (console) 
8    if (console.log)
9      console.log(aMessage);
10}
11
12}
13
14$(window).ready(function() { 
15  __resize(); 
16  $(window).resize(function() { debugMessage("Window.Resize()"); __resize(); });
17  $(window).bind("resize", function() { debugMessage("Window.Bind.Resize()"); __resize(); });
18  $("body").resize(function() { debugMessage("Body.Resize()"); __resize(); });
19  $(document).resize(function() { debugMessage("Document.Resize()"); __resize(); });
20});
21
22function getFormHeight(aForm) {
23  var lResult = 0;
24  $(aForm).children().each(function() {
25      lResult += $(this).outerHeight() + __getExtraHeightForElement($(this));
26  });
27  return lResult;
28}
29
30function getElementHeight(aElement) {
31  //if ($(aElement).prop("tagName") == "FORM") return getFormHeight(aElement);
32  return $(aElement).outerHeight();
33}
34
35function ignoreElement(aElement) {
36  //debugMessage($(aElement));
37  //debugMessage(getElementHeight($(aElement)) + " ignore?");
38  if ($(aElement).attr("id") == "tblHeader") return false;
39  if ($(aElement).css("position") == "absolute") return true;
40  if ($(aElement).attr("id") == "tableTimeout") return true;
41  if ($(aElement).attr("id") == "notificationbar") return true;
42  if ($(aElement).attr("id") == "divPosition") return true;
43  if ($(aElement).attr("id") == "toast8-container") return true;
44  if (!($(aElement).is(":visible"))) return true;
45  //if ($(aElement).attr("type") == "hidden") return true;
46  if ($(aElement).attr("role") == "dialog") return true;
47  //if ($(aElement).prop("tagName") == "xml") return true;
48
49  if (aElement.tagName == "SCRIPT") return true;
50
51  //debugMessage(" NO!");
52  return false;
53}
54
55function __isNaN(aValue) {
56  var lResult = parseInt(aValue);
57  if (isNaN(lResult)) return 0; 
58  return lResult;
59}
60
61function __getExtraHeightForElement(aElement) {
62  return __isNaN(aElement.css("margin-top")) + __isNaN(aElement.css("margin-bottom")) + 
63      __isNaN(aElement.css("border-top")) + __isNaN(aElement.css("border-bottom")) + 
64      __isNaN(aElement.css("padding-top")) + __isNaN(aElement.css("padding-bottom"))
65}
66
67var gOldHeight = -1;
68
69// Ensures that control elements that are to appear at the bottom of the page, 
70// are correctly fixed to the bottom.
71function __resizeStandardElements() {
72  var lStandardElements = new Array("#divWorkFlowControls", "#divWizardControls", "#divErrors", "div.Layout_Table");
73  var lBottom = 0;
74  for (var x = 0; x < lStandardElements.length; x++) {
75	  if ($(lStandardElements[x]).css("position") == "fixed") {
76	      $(lStandardElements[x]).css("bottom", lBottom + "px");
77	      lBottom += $(lStandardElements[x]).outerHeight() - 1;
78	  }
79  }
80
81  return lBottom;
82}
83
84//-----------------------------------------------------------------------------
85function __resize()  {
86  debugMessage("__resize()");
87  var lBottom = __resizeStandardElements();
88  var lContent = $("#divContent");
89  if (lContent.length == 0) return;
90
91  var lHeight = $(window).height();
92  var lToRemove = 0;
93
94  // Run through all the siblings of the element, and total up their combined height
95  // into the lToRemove variable.
96  lContent.siblings().each(function(aIndex, aElement) {
97    if ((aElement != lContent[0]) && (!(ignoreElement(aElement)))) {
98      var lElementHeight = ($(aElement).outerHeight() == 0 ? $(aElement).children().outerHeight() : $(aElement).outerHeight());
99      debugMessage($(aElement));
100      debugMessage(lElementHeight);
101
102      lToRemove += lElementHeight;
103    }
104    
105  });
106  lContent.height(lHeight - __getExtraHeightForElement(lContent) - 4 - lToRemove);
107  //lContent.css("height", "calc(100vh - " + lToRemove + "px)");
108
109  __resizeTabControl();
110
111  lContent.show();
112}
113
114//-----------------------------------------------------------------------------
115function __resizeTabControl() {
116  debugMessage("__resizeTabControl()");
117  $("*[id='TabControl']").each(function() {
118    if ($(this).closest("#divWorkFlowControls").length == 0) {
119      var lElement = $(this);
120      if ((lElement.parent().attr("class") == "tabcontainer") || (lElement.parent().parent().attr("class") == "Layout_Form")) return;
121      var lHeight;// 
122      debugMessage("parent.isform::" + $(this).parent().is("form"));
123      if ($(this).parent().is("form") || $(this).parent().is(".Layout_Table")) 
124        lHeight = $(this).parent().parent().height();
125      else {
126        if (lElement.parent().attr("class") == "Layout_Form")
127          lHeight = $(this).parent().parent().height();
128        else
129          lHeight = $(this).parent().height();
130      }
131      debugMessage("parent.height::" + lHeight);
132      lHeight -= __getExtraHeightForElement(lElement);
133
134      $(this).siblings().each(function() {
135        if ((this != lElement[0]) && (!(ignoreElement(this)))) {
136          debugMessage(getElementHeight($(this)));
137          lHeight -= getElementHeight($(this));
138        }
139    
140      });
141      debugMessage("__getExtraHeightForElement::" + __getExtraHeightForElement(lElement));
142      lHeight -= __getExtraHeightForElement(lElement);
143
144      debugMessage("set.height::" + lHeight);
145      lElement.height(lHeight);
146
147      //lElement.find("#Panels").height(lHeight - lElement.find("#Tabs").outerHeight() - __getExtraHeightForElement(lElement.find("#Panels")) - 4);
148      lElement.find("#Panels:eq(0)").height(lHeight - lElement.find("#Tabs:eq(0)").outerHeight() - 4);
149    }
150  });
151}
152
153/*
154 $Rev: 12659 $
155 $Id: resize.js.aspx 12659 2018-10-18 12:04:46Z chrisn $ 
156*/

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.