1; (function (ng) { 2 'use strict'; 3 4 var isTouchDevice = 'ontouchstart' in document.documentElement; 5 6 var ModalController = function ($element, $attrs, $location, $scope, modalDefaultOptions, modalService) { 7 8 var ctrl = this, 9 urlSearch = $location.search(); 10 11 if (ng.isDefined(urlSearch.modal) && urlSearch.modal === $attrs.id) { 12 ctrl.isOpen = true; 13 } else { 14 ctrl.isOpen = ng.isDefined($attrs.isOpen) ? $attrs.isOpen === 'true' : modalDefaultOptions.isOpen; 15 } 16 17 ctrl.modalClickOut = function (event) { 18 if (ctrl.closeOut === true && event.currentTarget == event.target && ctrl.isFloating === false) { 19 ctrl.close(); 20 } 21 }; 22 23 ctrl.setVisibleFooter = function (visible) { 24 ctrl.isShowFooter = visible; 25 }; 26 27 ctrl.close = function (skipRemove) { 28 29 ctrl.isOpen = false; 30 31 if (isTouchDevice === true) { 32 document.body.style.width = 'auto'; 33 document.body.classList.remove('adv-body-fixed-touch'); 34 } 35 36 document.body.classList.remove('bodyNotScroll'); 37 38 modalService.removeItemQueue(ctrl); 39 40 if (ctrl.callbackClose != null) { 41 ctrl.callbackClose($scope); 42 } 43 44 if (ctrl.destroyOnClose === true && !skipRemove) { 45 $element.remove(); 46 modalService.removeFromStorage(ctrl.id); 47 } 48 }; 49 50 ctrl.destroy = function () { 51 52 ctrl.close(); 53 54 $element.remove(); 55 56 modalService.removeFromStorage(ctrl.id); 57 }; 58 59 ctrl.open = function (skipQueue, modalDataAdditional) { 60 var queue, lastItem; 61 62 if (modalService.isWorking() === true || (modalService.checkQueue(ctrl) === true || skipQueue === true)) { 63 64 ctrl.modalDataAdditional = modalDataAdditional; 65 66 ctrl.isOpen = true; 67 68 if (isTouchDevice === true) { 69 document.body.style.width = document.body.offsetWidth + 'px'; 70 document.body.classList.add('adv-body-fixed-touch'); 71 } 72 73 document.body.classList.add('bodyNotScroll'); 74 75 if (ctrl.callbackOpen != null) { 76 ctrl.callbackOpen($scope); 77 } 78 } 79 80 if (modalService.existInQueue(ctrl) === false) { 81 modalService.addQueue(ctrl); 82 } 83 84 $element.css('z-index', modalService.getNewZIndex()); 85 }; 86 87 ctrl.getModalScope = function () { 88 return ctrl; 89 }; 90 91 ctrl.getModalElement = function () { 92 return $element; 93 }; 94 95 ctrl.getTransformValue = function (x, y) { 96 return 'translate3d(' + x.toFixed() + 'px,' + y.toFixed() + 'px, 0px)'; 97 }; 98 99 ctrl.getTransformMethodString = function () { 100 if (ng.isDefined(this.transform)) { 101 return this.transform; 102 } 103 104 var methodsArray = ['webkitTransform', 'MozTransform', 'msTransform', 'OTransform', 'transform'], 105 noopStyle = document.createElement('span').style; 106 107 for (var i = 0, il = methodsArray.length; i < il; i += 1) { 108 if (ng.isDefined(noopStyle[methodsArray[i]])) { 109 this.transform = methodsArray[i]; 110 break; 111 } 112 } 113 114 return this.transform; 115 }; 116 }; 117 118 ng.module('modal') 119 .controller('ModalCtrl', ModalController); 120 121 ModalController.$inject = ['$element', '$attrs', '$location', '$scope', 'modalDefaultOptions', 'modalService']; 122 123})(angular);
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.