1/** 2* @constructor Crea instancia para modal de inactividad 3* @param timer el tiempo que detendra a la funcion antes de ejecutarse 4* @param component nombre del componente a ejecutar, ejemplo showModal 5* @param content Objeto con los parametros del componente a ejecutar una vez termine el timer 6*/ 7 8var timeout; 9function InactivityModal(timer,component,content) { 10 this.valComponent = component; 11 this.contentObj = content; 12 this.valTimer = timer * 1000; 13 var _this = this 14 15 let events = ["mousemove","wheel","scroll","click"] 16 events.forEach(event => { 17 document.addEventListener (event, function () { 18 _this.resetTimer(_this.valTimer) 19 }) 20 }); 21 22 this.resetVars(); 23 24 this.startTime(this.valTimer,component,content); 25 26} 27 28InactivityModal.prototype.startTime = function(timer){ 29 timeout = setTimeout(() => {this.showComponent(timer)}, timer) 30} 31 32InactivityModal.prototype.resetTimer = function(timer){ 33 clearTimeout(timeout) 34 this.goActive(timer) 35} 36 37InactivityModal.prototype.goActive = function(timer){ 38 this.startTime(timer) 39} 40 41InactivityModal.prototype.showComponent = function(){ 42 var _this = this; 43 44 switch(this.valComponent){ 45 case "showModal": 46 AdpUtils.showModal(this.contentObj) 47 break; 48 /*case "showBannerRAO": 49 AdpUtils.showBannerRAO(this.contentObj) 50 break; 51 case "showNotificationTDC": 52 AdpUtils.showNotificationTDC(this.contentObj) 53 break; 54 case "showPushCrosell": 55 AdpUtils.showPushCrosell(this.contentObj) 56 break; 57 case "showPickupCard": 58 AdpUtils.showPickupCard(this.contentObj) 59 break;*/ 60 } 61 62 setTimeout(() => { 63 document.querySelector("[data-modal-close]").addEventListener('click',function(){ 64 _this.resetTimer(_this.valTimer); 65 _this.resetVars(); 66 }) 67 }, 2000) 68 69} 70 71InactivityModal.prototype.resetVars = function(){ 72 switch(this.valComponent){ 73 case "showModal": 74 flagModal = false; 75 break; 76 /*case "showBannerRAO": 77 flagBannerRAO = false; 78 break; 79 case "showNotificationTDC": 80 flagNotificationTDC = false; 81 break; 82 case "showPushCrosell": 83 showPushCrosell = false; 84 break; 85 case "showPickupCard": 86 flagPickupCard = false; 87 break;*/ 88 } 89 90}
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.