1class Notification 2{ 3 constructor(config, data, lang) 4 { 5 this.config = config; 6 this.data = data; 7 8 switch(lang) 9 { 10 case 'esp': 11 this.traslations = { 12 'reducedService' : { 13 'title' : 'Servicio Reducido', 14 'onlyService' : 'Por cuestiones operativas, el servicio se encuentra funcionando cada' 15 }, 16 'serviceDoesnotOperate' : { 17 'title' : 'Servicio No Operativo', 18 'stoppedService' : 'Por cuestiones operativas, el servicio no estará funcionando', 19 'since' : 'desde', 20 'until' : 'hasta' 21 }, 22 'routeCuts' : { 23 'title' : 'Rutas Cortadas', 24 'affectedStops' : 'Por cuestiones operativas, el servicio no estará pasando por las siguientes paradas:', 25 }, 26 'time' : { 27 'seconds' : 'segundos', 28 'minutes' : 'minutos', 29 'hours' : 'horas', 30 'weeks' : 'semanas', 31 'months' : 'meses', 32 'years' : 'años' 33 } 34 } 35 break; 36 case 'eng': 37 this.traslations = { 38 'reducedService' : { 39 'title' : 'Reduced Service', 40 'onlyService' : 'For operational reasons, the service is running every' 41 }, 42 'serviceDoesnotOperate' : { 43 'title' : 'Non Operating Service', 44 'stoppedService' : 'For operational reasons, the service will not be working', 45 'since' : 'since', 46 'until' : 'until' 47 }, 48 'routeCuts' : { 49 'title' : 'Cut Routes', 50 'affectedStops' : 'For operational reasons, the service will not be going through the following stops:', 51 }, 52 'time' : { 53 'seconds' : 'seconds', 54 'minutes' : 'minutes', 55 'hours' : 'hours', 56 'weeks' : 'weeks', 57 'months' : 'months', 58 'years' : 'years' 59 } 60 } 61 break; 62 case 'por': 63 this.traslations = { 64 'reducedService' : { 65 'title' : 'Serviço Reduzido', 66 'onlyService' : 'Por razões operacionais, o serviço está sendo executado a cada' 67 }, 68 'serviceDoesnotOperate' : { 69 'title' : 'Serviço Não Operacional', 70 'stoppedService' : 'Por razões operacionais, o serviço não funcionará', 71 'since' : 'de', 72 'until' : 'até' 73 }, 74 'routeCuts' : { 75 'title' : 'Rotas Cortadas', 76 'affectedStops' : 'Por motivos operacionais, o serviço não passará pelas seguintes paradas:' 77 }, 78 'time' : { 79 'seconds' : 'segundos', 80 'minutes' : 'minutos', 81 'hours' : 'horas', 82 'weeks' : 'semanas', 83 'months' : 'meses', 84 'years' : 'anos' 85 } 86 } 87 break; 88 }; 89 90 91 } 92 93 notificate() 94 { 95 var title = ''; 96 var text = ''; 97 var icon = 'warning'; 98 99 var time = new Date(this.config.showingDate + ' 04:00:00'); 100 var currentDate = new Date(); 101 102 var timeCheck = (time.getFullYear() + '-' + (time.getMonth() + 1) + '-' + time.getDate()); 103 var currentDateCheck = (currentDate.getFullYear() + '-' + (currentDate.getMonth() + 1) + '-' + currentDate.getDate()); 104 105 if(timeCheck === currentDateCheck) 106 { 107 switch(this.config.type) 108 { 109 case 1: 110 title = this.traslations.reducedService.title; 111 text = this.traslations.reducedService.onlyService+' '+this.config.frequency+' '+this.traslations.time.minutes; 112 localStorage.setItem('notified', true); 113 localStorage.setItem('lastNotificationType', 1); 114 localStorage.setItem('random', this.config.random); 115 break; 116 case 2: 117 118 if(this.config.sinceDateTime != null) 119 { 120 var since = this.config.sinceDateTime; 121 } 122 else 123 { 124 var since = this.config.sinceDate; 125 } 126 127 if(this.config.untilDateTime != null) 128 { 129 var until = this.config.untilDateTime; 130 } 131 else 132 { 133 var until = this.config.untilDate; 134 } 135 136 title = this.traslations.serviceDoesnotOperate.title; 137 138 text = this.traslations.serviceDoesnotOperate.stoppedService; 139 text += ' '+this.traslations.serviceDoesnotOperate.since+' '+since; 140 text += ' '+this.traslations.serviceDoesnotOperate.until+' '+until; 141 142 localStorage.setItem('notified', true); 143 localStorage.setItem('lastNotificationType', 2); 144 localStorage.setItem('random', this.config.random); 145 146 break; 147 case 3: 148 149 title = this.traslations.routeCuts.title 150 151 text = this.traslations.routeCuts.affectedStops+'<br><br> '; 152 153 for(var i = 0; i< this.config.affectedStops.length; i++) 154 { 155 if(i < this.config.affectedStops.length - 1) 156 { 157 text += ' <strong>- '+this.config.affectedStops[i]+' '+this.data.stops[this.config.affectedStops[i]]+'<br></strong> '; 158 } 159 else 160 { 161 text += ' <strong>- '+this.config.affectedStops[i]+' '+this.data.stops[this.config.affectedStops[i]]+'</strong> '; 162 } 163 } 164 165 localStorage.setItem('notified', true); 166 localStorage.setItem('lastNotificationType', 3); 167 localStorage.setItem('random', this.config.random); 168 169 break; 170 default: 171 172 if(localStorage.getItem('notified') != null) 173 { 174 localStorage.removeItem('notified'); 175 } 176 177 localStorage.setItem('lastNotificationType', 0); 178 localStorage.setItem('random', this.config.random); 179 180 break; 181 } 182 $('#accessiblyAppDialog').hide(); 183 if(this.config.type > 0) 184 { 185 $('#accessiblyAppDialogTitle').html(title); 186 $('#accessiblyAppDialogText').html(text); 187 $('#accessiblyAppDialog').show(); 188 /*Swal.fire({ 189 title: title, 190 html: text, 191 icon: icon, 192 allowEscapeKey: false, 193 allowOutsideClick: false, 194 allowEnterKey: true 195 });*/ 196 } 197 } 198 } 199}
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.