2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
23 var popupWindowDirective = function($log, $window) {
\r
25 function getZIndex(element) {
\r
27 $(window.document).find("*").each(function() {
\r
28 var zIndex = parseInt($(this).css("z-index"));
\r
29 if (zIndex > maxZIndex) {
\r
37 var scrollPosition = {
\r
42 var link = function(scope, element, attrs, controller, transcludeFn) {
\r
44 var zIndex = getZIndex(element.parent()) + 1;
\r
46 element.css("z-index", zIndex + 1);
\r
48 var backgroundStyle = "display: none; position: fixed; z-index:"
\r
49 + zIndex + ";" + "top: 0; left: 0; width: 100%; height: 100%;"
\r
50 + "background-color: #000000; opacity: 0.5";
\r
52 var className = attrs["class"];
\r
53 var classString = "";
\r
54 if (className !== undefined && className !== null && className !== "") {
\r
55 element.children().children().children().children().addClass(
\r
57 element.removeClass(className);
\r
60 element.before("<div style='" + backgroundStyle + "'></div>");
\r
62 attrs.$observe("ngxShow", function(value) {
\r
63 if (value === "true") {
\r
65 x : $window.pageXOffset,
\r
66 y : $window.pageYOffset
\r
68 $window.scrollTo(0, 0);
\r
69 element.css("display", "table");
\r
70 element.prev().css("display", "block");
\r
71 } else if (value === "false") {
\r
72 element.css("display", "none");
\r
73 element.prev().css("display", "none");
\r
74 $window.scrollTo(scrollPosition.x, scrollPosition.y);
\r
84 template : '<table style="display: none; position: absolute; left: 0; top: 0; width: 100%; height: 100%; border-collapse: collapse; margin: 0; padding: 0"> <tr><td align="center" style="vertical-align: top; padding: 10px"><div style="display: inline-block; padding: 5px; background-color: white" ng-transclude></div></td></tr></table>'
\r
88 appDS2.directive("popupWindow", [ "$log", "$window", popupWindowDirective ]);
\r