PageSourceSearch

https://onsight.librestream.com/DXR.axd?r=1_16-oyo8q

js librestream.com collected 2026-10-02 07:12:04 UTC 30,082 bytes, 707 lines download raw bytes

1(function () {
2var PopupUtils = {
3 NotSetAlignIndicator: "NotSet",
4 InnerAlignIndicator: "Sides",
5 OutsideLeftAlignIndicator: "OutsideLeft",
6 LeftSidesAlignIndicator: "LeftSides",
7 RightSidesAlignIndicator: "RightSides",
8 OutsideRightAlignIndicator: "OutsideRight",
9 CenterAlignIndicator: "Center",
10 AboveAlignIndicator: "Above",
11 TopSidesAlignIndicator: "TopSides",
12 MiddleAlignIndicator: "Middle",
13 BottomSidesAlignIndicator: "BottomSides",
14 BelowAlignIndicator: "Below",
15 WindowCenterAlignIndicator: "WindowCenter",
16 LeftAlignIndicator: "Left",
17 RightAlignIndicator: "Right",
18 TopAlignIndicator: "Top",
19 BottomAlignIndicator: "Bottom",
20 WindowLeftAlignIndicator: "WindowLeft",
21 WindowRightAlignIndicator: "WindowRight",
22 WindowTopAlignIndicator: "WindowTop",
23 WindowBottomAlignIndicator: "WindowBottom",
24 IsAlignNotSet: function (align) {
25  return align == PopupUtils.NotSetAlignIndicator;
26 },
27 IsInnerAlign: function (align) {
28  return align.indexOf(PopupUtils.InnerAlignIndicator) != -1;
29 },
30 IsRightSidesAlign: function(align) {
31  return align == PopupUtils.RightSidesAlignIndicator;
32 },
33 IsOutsideRightAlign: function(align) {
34  return align == PopupUtils.OutsideRightAlignIndicator;
35 },
36 IsCenterAlign: function(align) {
37  return align == PopupUtils.CenterAlignIndicator;
38 },
39 FindPopupElementById: function (id) {
40  if(id == "")
41   return null; 
42  var popupElement = ASPx.GetElementById(id);
43  if(!ASPx.IsExistsElement(popupElement)) {
44   var idParts = id.split("_");
45   var uniqueId = idParts.join("$");
46   popupElement = ASPx.GetElementById(uniqueId);
47  }
48  return popupElement;
49 },
50 FindEventSourceParentByTestFunc: function (evt, testFunc) {
51  return ASPx.GetParent(ASPx.Evt.GetEventSource(evt), testFunc);
52 },
53 PreventContextMenu: function (evt) {
54  if(evt.stopPropagation)
55   evt.stopPropagation();
56  if(evt.preventDefault)
57   evt.preventDefault();
58  if(ASPx.Browser.WebKitFamily)
59   evt.returnValue = false;
60 },
61 GetDocumentClientWidthForPopup: function() {
62  return ASPx.Browser.WebKitTouchUI ? document.body.offsetWidth : ASPx.GetDocumentClientWidth();
63 },
64 GetDocumentClientHeightForPopup: function() {
65  return ASPx.Browser.WebKitTouchUI ? document.body.offsetHeight : ASPx.GetDocumentClientHeight();
66 },
67 AdjustPositionToClientScreen: function (element, pos, rtl, isX) {
68  var min = isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop(),
69   max = min + (isX ? ASPx.GetDocumentClientWidth() : ASPx.GetDocumentClientHeight());
70  max -= (isX ? element.offsetWidth : element.offsetHeight);
71  if(rtl && isX) {
72   if(pos < min) pos = min;
73   if(pos > max) pos = max;
74  } else {
75   if(pos > max) pos = max;
76   if(pos < min) pos = min;
77  }
78  return pos;
79 },
80 GetPopupAbsoluteX: function(element, popupElement, hAlign, hOffset, x, left, rtl, isPopupFullCorrectionOn) {
81  return PopupUtils.getPopupAbsolutePos(element, popupElement, hAlign, hOffset, x, left, rtl, isPopupFullCorrectionOn, false, false, true);
82 },
83 GetPopupAbsoluteY: function (element, popupElement, vAlign, vOffset, y, top, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders) {
84  return PopupUtils.getPopupAbsolutePos(element, popupElement, vAlign, vOffset, y, top, false, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, false);
85 },
86 getPopupAbsolutePos: function(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, isHorizontal) {
87  var calculator = getPositionCalculator();
88  calculator.applyParams(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, isHorizontal);
89  var position = calculator.getPopupAbsolutePos();
90  calculator.disposeState();
91  return position;
92 },
93 RemoveFocus: function (parent) {
94  var div = document.createElement('div');
95  div.tabIndex = "-1";
96  PopupUtils.ConcealDivElement(div);
97  parent.appendChild(div);
98  if(ASPx.IsFocusable(div))
99   div.focus();
100  ASPx.RemoveElement(div);
101 },
102 ConcealDivElement: function (div) {
103  div.style.position = "absolute";
104  div.style.left = 0;
105  div.style.top = 0;
106  if(ASPx.Browser.WebKitFamily) {
107   div.style.opacity = 0;
108   div.style.width = 1;
109   div.style.height = 1;
110  } else {
111   div.style.border = 0;
112   div.style.width = 0;
113   div.style.height = 0;
114  }
115 },
116 InitAnimationProperties: function(element, onAnimStopCallString) {
117  element.popuping = true;
118  element.onAnimStopCallString = onAnimStopCallString;
119 },
120 InitAnimationDiv: function (element, x, y, onAnimStopCallString, skipSizeInit) {
121  PopupUtils.InitAnimationProperties(element, onAnimStopCallString);
122  PopupUtils.InitAnimationDivCore(element);
123  if(!skipSizeInit) {
124   ASPx.SetStyles(element, { width: "", height: "" });
125   ASPx.SetStyles(element, { width: element.offsetWidth, height: element.offsetHeight });
126  }
127  ASPx.SetStyles(element, { left: x, top: y });
128 },
129 InitAnimationDivCore: function (element) {
130  ASPx.SetStyles(element, {
131   overflow: "hidden",
132   position: "absolute"
133  });
134 },
135 StartSlideAnimation: function (animationDivElement, element, iframeElement, duration, preventChangingWidth, preventChangingHeight) {
136  if(iframeElement) {
137   var endLeft = ASPx.PxToInt(iframeElement.style.left);
138   var endTop = ASPx.PxToInt(iframeElement.style.top);
139   var startLeft = ASPx.PxToInt(element.style.left) < 0 ? endLeft : animationDivElement.offsetLeft + animationDivElement.offsetWidth;
140   var startTop = ASPx.PxToInt(element.style.top) < 0 ? endTop : animationDivElement.offsetTop + animationDivElement.offsetHeight;
141   var properties = {
142    left: { from: startLeft, to: endLeft, unit: "px" },
143    top: { from: startTop, to: endTop, unit: "px" }
144   };
145   if(!preventChangingWidth)
146    properties.width = { to: element.offsetWidth, unit: "px" };
147   if(!preventChangingHeight)
148    properties.height = { to: element.offsetHeight, unit: "px" };
149   ASPx.AnimationHelper.createMultipleAnimationTransition(iframeElement, {
150    duration: duration
151   }).Start(properties);
152  }
153  ASPx.AnimationHelper.createMultipleAnimationTransition(element, {
154   duration: duration,
155   onComplete: function () { PopupUtils.AnimationFinished(animationDivElement, element); }
156  }).Start({
157   left: { to: 0, unit: "px" },
158   top: { to: 0, unit: "px" }
159  });
160 },
161 AnimationFinished: function (animationDivElement, element) {
162  if(PopupUtils.StopAnimation(animationDivElement, element) && ASPx.IsExists(animationDivElement.onAnimStopCallString) &&
163   animationDivElement.onAnimStopCallString !== "") {
164   window.setTimeout(animationDivElement.onAnimStopCallString, 0);
165  }
166 },
167 StopAnimation: function (animationDivElement, element) {
168  if(animationDivElement.popuping) {
169   ASPx.AnimationHelper.cancelAnimation(element);
170   animationDivElement.popuping = false;
171   animationDivElement.style.overflow = "visible";
172   return true;
173  }
174  return false;
175 },
176 GetAnimationHorizontalDirection: function (popupPosition, horizontalAlign, verticalAlign, rtl) {
177  if(PopupUtils.IsInnerAlign(horizontalAlign)
178   && !PopupUtils.IsInnerAlign(verticalAlign)
179   && !PopupUtils.IsAlignNotSet(verticalAlign))
180   return 0;
181  var toTheLeft = (horizontalAlign == PopupUtils.OutsideLeftAlignIndicator || horizontalAlign == PopupUtils.RightSidesAlignIndicator || (horizontalAlign == PopupUtils.NotSetAlignIndicator && rtl)) ^ popupPosition.isInverted;
182  return toTheLeft ? 1 : -1;
183 },
184 GetAnimationVerticalDirection: function (popupPosition, horizontalAlign, verticalAlign) {
185  if(PopupUtils.IsInnerAlign(verticalAlign)
186   && !PopupUtils.IsInnerAlign(horizontalAlign)
187   && !PopupUtils.IsAlignNotSet(horizontalAlign))
188   return 0;
189  var toTheTop = (verticalAlign == PopupUtils.AboveAlignIndicator || verticalAlign == PopupUtils.BottomSidesAlignIndicator) ^ popupPosition.isInverted;
190  return toTheTop ? 1 : -1;
191 },
192 IsVerticalScrollExists: function () {
193  var scrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowY !== "hidden" && ASPx.GetCurrentStyle(document.documentElement).overflowY !== "hidden";
194  return (scrollIsNotHidden && ASPx.GetDocumentHeight() > ASPx.GetDocumentClientHeight());
195 },
196 CoordinatesInDocumentRect: function (x, y) {
197  var docScrollLeft = ASPx.GetDocumentScrollLeft();
198  var docScrollTop = ASPx.GetDocumentScrollTop();
199  return (x > docScrollLeft && y > docScrollTop &&
200   x < ASPx.GetDocumentClientWidth() + docScrollLeft &&
201   y < ASPx.GetDocumentClientHeight() + docScrollTop);
202 },
203 GetElementZIndexArray: function (element) {
204  var currentElement = element;
205  var zIndexesArray = [0];
206  while(currentElement && currentElement.tagName != "BODY") {
207   if(currentElement.style) {
208    if(typeof (currentElement.style.zIndex) != "undefined" && currentElement.style.zIndex != "")
209     zIndexesArray.unshift(currentElement.style.zIndex);
210   }
211   currentElement = currentElement.parentNode;
212  }
213  return zIndexesArray;
214 },
215 IsHigher: function (higherZIndexArrat, zIndexArray) {
216  if(zIndexArray == null) return true;
217  var count = (higherZIndexArrat.length >= zIndexArray.length) ? higherZIndexArrat.length : zIndexArray.length;
218  for(var i = 0; i < count; i++)
219   if(typeof (higherZIndexArrat[i]) != "undefined" && typeof (zIndexArray[i]) != "undefined") {
220    var higherZIndexArrayCurrentElement = parseInt(higherZIndexArrat[i].toString());
221    var zIndexArrayCurrentElement = parseInt(zIndexArray[i].toString());
222    if(higherZIndexArrayCurrentElement != zIndexArrayCurrentElement)
223     return higherZIndexArrayCurrentElement > zIndexArrayCurrentElement;
224   } else return typeof (zIndexArray[i]) == "undefined";
225  return true;
226 },
227 TestIsPopupElement: function (element) {
228  return !!element.DXPopupElementControl;
229 },
230 adjustViewportScrollWrapper: function(wrapper, wrapperScroll, windowElement) {
231  var document = wrapper.ownerDocument;
232  var window = document.defaultView || document.parentWindow;
233  var isWindowElementDisplayed = ASPx.IsElementDisplayed(windowElement);
234  if(!isWindowElementDisplayed) {
235   wrapper.style.cssText = "";
236   wrapperScroll.style.cssText = "";
237   return; 
238  }
239  var windowRect = windowElement.getBoundingClientRect();
240  var yAxis = this.calculateViewPortScrollDataByAxis(wrapper.style.top, windowRect.top, windowElement.offsetHeight, window.innerHeight, wrapper.scrollTop);
241  var xAxis = this.calculateViewPortScrollDataByAxis(wrapper.style.left, windowRect.left, windowElement.offsetWidth, window.innerWidth, wrapper.scrollLeft);
242  this.prepareViewPortScrollData(xAxis, yAxis);
243  ASPx.SetStyles(windowElement, {
244   top: yAxis.windowOffset,
245   left: xAxis.windowOffset
246  });
247  ASPx.SetStyles(wrapper, {
248   width: xAxis.wrapperSize,
249   height: yAxis.wrapperSize,
250   position: "absolute",
251   overflow: ASPx.Browser.MobileUI ? "scroll" : "auto",
252   zIndex: windowElement.style.zIndex
253  });
254  ASPx.SetAbsoluteX(wrapper, ASPx.GetDocumentScrollLeft());
255  ASPx.SetAbsoluteY(wrapper, ASPx.GetDocumentScrollTop());
256  ASPx.SetStyles(wrapperScroll, {
257   width: xAxis.wrapperScrollSize,
258   height: yAxis.wrapperScrollSize,
259   position: "absolute",
260   overflow: "hidden"
261  });
262  wrapper.scrollLeft = xAxis.scrollSize;
263  wrapper.scrollTop = yAxis.scrollSize;
264 },
265 calculateViewPortScrollDataByAxis: function(wrapperOffsetStyle, windowOffset, windowSize, viewPortSize, scrollSize) {
266  var isWindowOffsetNegative = windowOffset < 0;
267  windowOffset = isWindowOffsetNegative ? 0 : windowOffset;
268  var wrapperScrollSize = Math.max(viewPortSize + Math.abs(Math.min(0, windowOffset)), windowSize + Math.abs(windowOffset));
269  return { 
270   windowOffset: isWindowOffsetNegative ? 0 : windowOffset,
271   wrapperSize: viewPortSize,
272   wrapperScrollSize: wrapperScrollSize,
273   scrollSize: isWindowOffsetNegative ? scrollSize + Math.abs(windowOffset) : 0,
274   hasScroll: wrapperScrollSize > viewPortSize
275  };
276 },
277 prepareViewPortScrollData: function(xAxis, yAxis) {
278  var scrollBarSize = ASPx.GetVerticalScrollBarWidth();
279  if(yAxis.hasScroll && !xAxis.hasScroll) {
280   xAxis.wrapperScrollSize = Math.min(xAxis.wrapperSize - scrollBarSize, xAxis.wrapperScrollSize);
281  } else if(xAxis.hasScroll && !yAxis.hasScroll) {
282   yAxis.wrapperScrollSize = Math.min(yAxis.wrapperSize - scrollBarSize, yAxis.wrapperScrollSize);
283  } else if(yAxis.hasScroll && xAxis.hasScroll) {
284   yAxis.wrapperScrollSize -= scrollBarSize;
285   xAxis.wrapperScrollSize -= scrollBarSize;
286  }
287 }
288};
289PopupUtils.OverControl = {
290 GetPopupElementByEvt: function (evt) {
291  return PopupUtils.FindEventSourceParentByTestFunc(evt, PopupUtils.TestIsPopupElement);
292 },
293 OnMouseEvent: function (evt, mouseOver) {
294  var popupElement = PopupUtils.OverControl.GetPopupElementByEvt(evt);
295  if(mouseOver)
296   popupElement.DXPopupElementControl.OnPopupElementMouseOver(evt, popupElement);
297  else
298   popupElement.DXPopupElementControl.OnPopupElementMouseOut(evt, popupElement);
299 },
300 OnMouseOut: function (evt) {
301  PopupUtils.OverControl.OnMouseEvent(evt, false);
302 },
303 OnMouseOver: function (evt) {
304  PopupUtils.OverControl.OnMouseEvent(evt, true);
305 }
306};
307PopupUtils.BodyScrollHelper = (function () {
308 var windowScrollLock = {},
309  windowScroll = {},
310  hideScrollbarsClassName = "dxpc-hideScrollbars",
311  savedHtmlOverflow = "";
312 function lockWindowScroll(windowId) {
313  windowScrollLock[windowId] = true;
314 }
315 function unlockWindowScroll(windowId) {
316  delete windowScrollLock[windowId];
317 }
318 function isLocked(windowId) {
319  return !!windowScrollLock[windowId];
320 }
321 function isAnyWindowScrollLocked() {
322  for(var key in windowScrollLock) 
323   if (windowScrollLock.hasOwnProperty(key) && windowScrollLock[key] === true)
324    return true;
325  return false;
326 }
327 function replaceVerticalScrollByPadding() {
328  var currentBodyStyle = ASPx.GetCurrentStyle(document.body),
329   paddingWidth = ASPx.GetVerticalScrollBarWidth() + ASPx.PxToInt(currentBodyStyle.paddingRight);
330  ASPx.Attr.ChangeStyleAttribute(document.body, "padding-right", paddingWidth + "px");
331 }
332 function needToChangeOverflowUsingStyle() {
333  return ASPx.Browser.IE && ASPx.Browser.Version >= 11;
334 }
335 function changeOverflow() {
336  if(needToChangeOverflowUsingStyle()) { 
337   savedHtmlOverflow = document.documentElement.style.overflow;
338   document.documentElement.style.overflow = "hidden";
339  }
340  else
341   ASPx.Attr.ChangeStyleAttribute(document.documentElement, "overflow", "hidden");
342  if(ASPx.GetCurrentStyle(document.body).overflowY === "scroll")
343   ASPx.Attr.ChangeStyleAttribute(document.body, "overflow", "hidden");
344  resetOverflowCache();
345 }
346 function restoreOverflow() {
347  if(needToChangeOverflowUsingStyle()) { 
348   document.documentElement.style.overflow = savedHtmlOverflow;
349   savedHtmlOverflow = "";
350  }
351  else
352   ASPx.Attr.RestoreStyleAttribute(document.documentElement, "overflow");
353  ASPx.Attr.RestoreStyleAttribute(document.body, "overflow");
354  resetOverflowCache();
355 }
356 function resetOverflowCache() {
357  ASPx.verticalScrollIsNotHidden = null;
358  ASPx.horizontalScrollIsNotHidden = null;
359 }
360 function saveScrollPosition(windowId) {
361  windowScroll[windowId] = {
362   x: window.pageXOffset,
363   y: window.pageYOffset
364  };
365 }
366 function restoreScrollPosition(windowId) {
367  var currentWindowScroll = windowScroll[windowId];
368  if(!!currentWindowScroll)
369   window.scrollTo(currentWindowScroll.x, currentWindowScroll.y);
370 }
371 function restoreBodyScroll(windowId) {
372  unlockWindowScroll(windowId);
373  if(isAnyWindowScrollLocked())
374   return;
375  if(ASPx.Browser.IE) {
376   ASPx.Attr.RestoreAttribute(document.body, "scroll");
377   restoreOverflow();
378   restoreScrollPosition(windowId);
379  } else if(ASPx.Browser.WebKitTouchUI) {
380   ASPx.Attr.RestoreStyleAttribute(document.body, "position");
381   ASPx.Attr.RestoreStyleAttribute(document.body, "height");
382   ASPx.Attr.RestoreStyleAttribute(document.body, "margin");
383   ASPx.RemoveClassNameFromElement(document.documentElement, hideScrollbarsClassName);
384   ASPx.Attr.RestoreStyleAttribute(document.body, "overflow");
385   restoreScrollPosition(windowId);
386  } else {
387   restoreOverflow();
388   restoreScrollPosition(windowId);
389  }
390  if(ASPx.Browser.Chrome)
391   var dummy = document.documentElement.scrollTop; 
392  ASPx.Attr.RestoreStyleAttribute(document.body, "padding-right");
393  ASPx.Attr.RestoreStyleAttribute(document.body, "height");
394  ASPx.Attr.RestoreStyleAttribute(document.body, "width");
395 }
396 return {
397  RestoreIfLocked: function(windowId) {
398   if(isLocked(windowId))
399    restoreBodyScroll(windowId);
400  },
401  HideBodyScroll: function(windowId) {
402   if(isAnyWindowScrollLocked()) { 
403    lockWindowScroll(windowId);
404    return;
405   }
406   lockWindowScroll(windowId);
407   if(PopupUtils.IsVerticalScrollExists())
408    replaceVerticalScrollByPadding();
409   if(ASPx.Browser.IE) {
410    saveScrollPosition(windowId);
411    ASPx.Attr.ChangeAttribute(document.body, "scroll", "no");
412    changeOverflow();
413   } else if(ASPx.Browser.WebKitTouchUI) {
414    saveScrollPosition(windowId);
415    ASPx.Attr.ChangeStyleAttribute(document.body, "overflow", "hidden");
416    ASPx.Attr.ChangeStyleAttribute(document.body, "position", "relative");
417    ASPx.Attr.ChangeStyleAttribute(document.body, "height", "100%");
418    ASPx.Attr.ChangeStyleAttribute(document.body, "margin", "0");
419    ASPx.AddClassNameToElement(document.documentElement, hideScrollbarsClassName);
420   } else {
421    saveScrollPosition(windowId);
422    changeOverflow();
423    var documentHeight = ASPx.GetDocumentHeight();
424    var documentWidth = ASPx.GetDocumentWidth();
425    if(window.pageYOffset > 0 && ASPx.PxToInt(window.getComputedStyle(document.body, null)) != documentHeight)
426     ASPx.Attr.ChangeStyleAttribute(document.body, "height", documentHeight + "px");
427    if(window.pageXOffset > 0 && ASPx.PxToInt(window.getComputedStyle(document.body, null)) != documentWidth)
428     ASPx.Attr.ChangeStyleAttribute(document.body, "width", documentWidth + "px");
429   }
430  },
431  RestoreBodyScroll: restoreBodyScroll
432 };
433})();
434var PositionAlignConsts = {
435 NOT_SET: 0,
436 OUTSIDE_START: 1,
437 NEAR_BOUND_START: 2,
438 INNER_START: 3,
439 CENTER: 4,
440 INNER_END: 5,
441 NEAR_BOUND_END: 6,
442 OUTSIDE_END: 7,
443 WINDOW_CENTER: 8,
444 WINDOW_START: 9,
445 WINDOW_END: 10
446};
447var AlignIndicatorTable = {};
448var PositionCalculator = ASPx.CreateClass(null, {
449 constructor: function() {
450  this.element = null;
451  this.popupElement = null;
452  this.align = 0;
453  this.offset = 0;
454  this.startPos = 0;
455  this.startPosInit = 0;
456  this.rtl = false;
457  this.isPopupFullCorrectionOn = false;
458  this.isHorizontal = true;
459  this.size = 0;
460  this.bodySize = 0;
461  this.actualBodySize = 0;
462  this.elementStartPos = 0;
463  this.scrollStartPos = 0;
464  this.isInverted = false;
465  this.popupElementSize = 0;
466  this.boundStartPos = 0;
467  this.boundEndPos = 0;
468  this.innerBoundStartPos = 0;
469  this.innerBoundEndPos = 0;
470  this.isMoreFreeSpaceLeft = false;
471  this.nearBoundOverlapRate = 0.25;
472  this.functionsTable = {};
473  this.initializeFunctionsTable();
474 },
475 applyParams: function(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, isHorizontal) {
476  this.isHorizontal = isHorizontal;
477  this.element = element;
478  this.popupElement = popupElement;
479  this.align = this.getAlignValueFromIndicator(align);
480  this.offset = offset;
481  this.startPos = startPos;
482  this.startPosInit = startPosInit;
483  this.rtl = rtl;
484  this.isPopupFullCorrectionOn = isPopupFullCorrectionOn;
485  this.ignoreAlignWithoutScrollReserve = ignoreAlignWithoutScrollReserve;
486  this.ignorePopupElementBorders = ignorePopupElementBorders;
487  this.calculateParams();
488 },
489 disposeState: function() {
490  this.element = null;
491  this.popupElement = null;
492 },
493 getPopupAbsolutePos: function() {
494  if(this.isWindowAlign()) {
495   var showAtPos = this.startPos != ASPx.InvalidPosition && !this.popupElement;
496   if(showAtPos)
497    this.align = PositionAlignConsts.NOT_SET;
498   else
499    return this.getWindowAlignPos();
500  }
501  if(this.popupElement)
502   this.calculatePopupElement();
503  else
504   this.align = PositionAlignConsts.NOT_SET;
505  return this.getPopupAbsolutePosCore();
506 },
507 initializeFunctionsTable: function() {
508  var table = this.functionsTable;
509  table[PositionAlignConsts.NOT_SET] = this.calculateNotSet;
510  table[PositionAlignConsts.OUTSIDE_START] = this.calculateOutsideStart;
511  table[PositionAlignConsts.INNER_START] = this.calculateInnerStart;
512  table[PositionAlignConsts.CENTER] = this.calculateCenter;
513  table[PositionAlignConsts.INNER_END] = this.calculateInnerEnd;
514  table[PositionAlignConsts.OUTSIDE_END] = this.calculateOutsideEnd;
515  table[PositionAlignConsts.NEAR_BOUND_START] = this.calculateNearBoundStart;
516  table[PositionAlignConsts.NEAR_BOUND_END] = this.calculateNearBoundEnd;
517  table[PositionAlignConsts.WINDOW_CENTER] = this.calculateWindowCenter;
518  table[PositionAlignConsts.WINDOW_START] = this.calculateWindowStart;
519  table[PositionAlignConsts.WINDOW_END] = this.calculateWindowEnd;
520 },
521 calculateParams: function() {
522  this.size = this.getElementSize();
523  if(this.isHorizontal) {
524   this.bodySize = ASPx.GetDocumentClientWidth();
525   this.elementStartPos = ASPx.GetAbsoluteX(this.popupElement) + this.getBorderCorrection();
526   this.scrollStartPos = ASPx.GetDocumentScrollLeft();
527  }
528  else {
529   this.bodySize = ASPx.GetDocumentClientHeight();
530   this.elementStartPos = ASPx.GetAbsoluteY(this.popupElement) + this.getBorderCorrection();
531   this.scrollStartPos = ASPx.GetDocumentScrollTop();
532  }
533 },
534 getBorderCorrection: function() {
535  if(!this.ignorePopupElementBorders)
536   return 0;
537  var style = getComputedStyle(this.popupElement);
538  return ASPx.PxToInt(this.isHorizontal ? style.borderLeftWidth : style.borderTopWidth);
539 },
540 isWindowAlign: function() {
541  return this.align == PositionAlignConsts.WINDOW_CENTER || this.align == PositionAlignConsts.WINDOW_START ||
542   this.align == PositionAlignConsts.WINDOW_END;
543 },
544 getWindowAlignPos: function() {
545  this.actualBodySize = ASPx.Browser.WebKitTouchUI ? this.getWindowInnerSize() : this.bodySize;
546  return this.getPopupAbsolutePosCore();
547 },
548 getPopupAbsolutePosCore: function() {
549  var calculationFunc = this.functionsTable[this.align];
550  calculationFunc.call(this);
551  return new ASPx.PopupPosition(this.startPos, this.isInverted);
552 },
553 calculateWindowCenter: function() {
554  this.startPos = Math.max(Math.ceil(this.actualBodySize / 2 - this.size / 2), 0) + this.scrollStartPos + this.offset;
555 },
556 calculateWindowStart: function() {
557  this.startPos = this.scrollStartPos + this.offset;
558 },
559 calculateWindowEnd: function() {
560  this.startPos = this.scrollStartPos + this.actualBodySize - this.size + this.offset;
561 },
562 calculatePopupElement: function() {
563  this.popupElementSize = this.getPopupElementSize();
564  this.boundStartPos = this.elementStartPos - this.size;
565  this.boundEndPos = this.elementStartPos + this.popupElementSize;
566  this.innerBoundStartPos = this.elementStartPos;
567  this.innerBoundEndPos = this.elementStartPos + this.popupElementSize - this.size;
568  var hasLeftScrollReserve = this.boundStartPos >= 0;
569  this.isMoreFreeSpaceLeft = (this.bodySize - (this.boundEndPos + this.size) < this.boundStartPos - 2 * this.scrollStartPos) && (!this.ignoreAlignWithoutScrollReserve || hasLeftScrollReserve);
570 },
571 calculateOutsideStart: function() {
572  this.isInverted = this.isPopupFullCorrectionOn && (!(this.boundStartPos - this.scrollStartPos > 0 || this.isMoreFreeSpaceLeft));
573  if(this.isInverted)
574   this.startPos = this.boundEndPos - this.offset;
575  else
576   this.startPos = this.boundStartPos + this.offset;
577 },
578 calculateInnerStart: function() {
579  this.startPos = this.innerBoundStartPos + this.offset;
580  if(this.isPopupFullCorrectionOn)
581   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
582 },
583 calculateCenter: function() {
584  this.startPos = this.elementStartPos + Math.round((this.popupElementSize - this.size) / 2) + this.offset;
585 },
586 calculateInnerEnd: function() {
587  this.startPos = this.innerBoundEndPos + this.offset;
588  if(this.isPopupFullCorrectionOn)
589   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
590 },
591 calculateOutsideEnd: function() {
592  this.isInverted = this.isPopupFullCorrectionOn && (!(this.boundEndPos + this.size < this.bodySize + this.scrollStartPos || !this.isMoreFreeSpaceLeft));
593  if(this.isInverted)
594   this.startPos = this.boundStartPos - this.offset;
595  else
596   this.startPos = this.boundEndPos + this.offset;
597 },
598 calculateNotSet: function() {
599  if(this.rtl)
600   this.calculateNotSetRightToLeft();
601  else
602   this.calculateNotSetLeftToRight();
603 },
604 calculateNotSetLeftToRight: function() {
605  if(!ASPx.IsValidPosition(this.startPos)) {
606   if(this.popupElement)
607    this.startPos = this.elementStartPos;
608   else if(this.offset)
609    this.startPos = 0;
610   else
611    this.startPos = this.startPosInit;
612  }
613  this.isInverted = this.isPopupFullCorrectionOn && (this.startPos - this.scrollStartPos + this.size > this.bodySize && this.startPos - this.scrollStartPos > this.bodySize / 2);
614  if(this.isInverted)
615   this.startPos = this.startPos - this.size - this.offset;
616  else
617   this.startPos = this.startPos + this.offset;
618 },
619 calculateNotSetRightToLeft: function() {
620  if(!ASPx.IsValidPosition(this.startPos)) {
621   if(this.popupElement)
622    this.startPos = this.innerBoundEndPos;
623   else if(this.offset)
624    this.startPos = 0;
625   else
626    this.startPos = this.startPosInit;
627  }
628  else
629   this.startPos -= this.size;
630  this.isInverted = this.isPopupFullCorrectionOn && (this.startPos < this.scrollStartPos && this.startPos - this.scrollStartPos < this.bodySize / 2);
631  if(this.isInverted)
632   this.startPos = this.startPos + this.size + this.offset;
633  else
634   this.startPos = this.startPos - this.offset;
635 },
636 calculateNearBoundStart: function() {
637  this.startPos = this.boundStartPos + this.offset + this.size * this.nearBoundOverlapRate;
638  if(this.isPopupFullCorrectionOn)
639   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
640 },
641 calculateNearBoundEnd: function() {
642  this.startPos = this.boundEndPos + this.offset - this.size * this.nearBoundOverlapRate;
643  if(this.isPopupFullCorrectionOn)
644   this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal);
645 },
646 getAlignValueFromIndicator: function(alignIndicator) {
647  var alignValue = AlignIndicatorTable[alignIndicator];
648  if(alignValue === undefined)
649   throw "Incorrect align indicator.";
650  return alignValue;
651 },
652 getElementSize: function() {
653  return this.getCustomElementSize(this.element, false);
654 },
655 getPopupElementSize: function() {
656  return this.getCustomElementSize(this.popupElement, this.ignorePopupElementBorders);
657 },
658 getCustomElementSize: function(customElement, ignoreBorders) {
659  if(ignoreBorders) {
660   return this.isHorizontal ? ASPx.GetClearClientWidth(customElement) : ASPx.GetClearClientHeight(customElement);
661  }
662  return this.isHorizontal ? ASPx.GetElementOffsetWidth(customElement) : ASPx.GetElementOffsetHeight(customElement);
663 },
664 getWindowInnerSize: function() {
665  return this.isHorizontal ? window.innerWidth : window.innerHeight;
666 }
667});
668var positionCalculator = null;
669function getPositionCalculator() {
670 if(positionCalculator == null)
671  positionCalculator = new PositionCalculator();
672 return positionCalculator;
673}
674function initializeAlignIndicatorTable() {
675 AlignIndicatorTable[PopupUtils.NotSetAlignIndicator] = PositionAlignConsts.NOT_SET;
676 AlignIndicatorTable[PopupUtils.OutsideLeftAlignIndicator] = PositionAlignConsts.OUT
676SIDE_START;
677 AlignIndicatorTable[PopupUtils.AboveAlignIndicator] = PositionAlignConsts.OUTSIDE_START;
678 AlignIndicatorTable[PopupUtils.LeftAlignIndicator] = PositionAlignConsts.NEAR_BOUND_START;
679 AlignIndicatorTable[PopupUtils.TopAlignIndicator] = PositionAlignConsts.NEAR_BOUND_START;
680 AlignIndicatorTable[PopupUtils.LeftSidesAlignIndicator] = PositionAlignConsts.INNER_START;
681 AlignIndicatorTable[PopupUtils.TopSidesAlignIndicator] = PositionAlignConsts.INNER_START;
682 AlignIndicatorTable[PopupUtils.CenterAlignIndicator] = PositionAlignConsts.CENTER;
683 AlignIndicatorTable[PopupUtils.MiddleAlignIndicator] = PositionAlignConsts.CENTER;
684 AlignIndicatorTable[PopupUtils.RightSidesAlignIndicator] = PositionAlignConsts.INNER_END;
685 AlignIndicatorTable[PopupUtils.BottomSidesAlignIndicator] = PositionAlignConsts.INNER_END;
686 AlignIndicatorTable[PopupUtils.RightAlignIndicator] = PositionAlignConsts.NEAR_BOUND_END;
687 AlignIndicatorTable[PopupUtils.BottomAlignIndicator] = PositionAlignConsts.NEAR_BOUND_END;
688 AlignIndicatorTable[PopupUtils.OutsideRightAlignIndicator] = PositionAlignConsts.OUTSIDE_END;
689 AlignIndicatorTable[PopupUtils.BelowAlignIndicator] = PositionAlignConsts.OUTSIDE_END;
690 AlignIndicatorTable[PopupUtils.WindowCenterAlignIndicator] = PositionAlignConsts.WINDOW_CENTER;
691 AlignIndicatorTable[PopupUtils.WindowLeftAlignIndicator] = PositionAlignConsts.WINDOW_START;
692 AlignIndicatorTable[PopupUtils.WindowTopAlignIndicator] = PositionAlignConsts.WINDOW_START;
693 AlignIndicatorTable[PopupUtils.WindowRightAlignIndicator] = PositionAlignConsts.WINDOW_END;
694 AlignIndicatorTable[PopupUtils.WindowBottomAlignIndicator] = PositionAlignConsts.WINDOW_END;
695}
696initializeAlignIndicatorTable();
697ASPx.PopupPosition = function(position, isInverted) {
698 this.position = position;
699 this.isInverted = isInverted;
700};
701ASPx.PopupSize = function(width, height) {
702 this.width = width;
703 this.height = height;
704};
705ASPx.PopupUtils = PopupUtils;
706ASPx.PositionCalculator = PositionCalculator;
707})();

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.