1// JavaScript Document 2 3 4function g_EBI(id) 5{ //element by id 6 var el = document.getElementById(id) 7 if(el) 8 return el; 9 else 10 return; 11} 12 13 14 15function popFile(path) { 16 var win = window.open(path, '_blank'); 17 win ? win.focus() : alert("Please enable popups."); 18} 19 20 21 22 23var imageNames = []; 24var imageSrcs = []; 25 26// addImageToPreload( "/images/BM_web_button00.gif" ); 27// addImageToPreload( "/images/BM_web_button01.gif" ); 28// addImageToPreload( "/images/BM_web_button02.gif" ); 29// addImageToPreload( "/images/BM_web_button03.gif" ); 30// addImageToPreload( "/images/BM_web_button04.gif" ); 31// addImageToPreload( "/images/BM_web_button05.gif" ); 32 33addImageToPreload( "/images/BM_www00_img.jpg" ); 34addImageToPreload( "/images/BM_www01_img.jpg" ); 35addImageToPreload( "/images/BM_www02_img.jpg" ); 36addImageToPreload( "/images/BM_www03_img.jpg" ); 37addImageToPreload( "/images/BM_www04_img.jpg" ); 38addImageToPreload( "/images/BM_www05_img.jpg" ); 39 40function addImageToPreload(imgStr) 41{ 42//NOTE: if the name or arguments of 'addImageToPreload' changes we need to change the function getPreloadFileList() 43 var currMax = imageNames.length; 44 imageSrcs[currMax] = new Image; 45 imageNames[currMax] = imgStr; 46} 47function doImageLoad(id, bool) 48{ 49 //if the bool is true then move to next image if there are more, wait 2 secs and go to main page if done loading, otherwise just reloop this function 50 if(bool) 51 { 52 id++; 53 if(id < imageNames.length) 54 { 55 imageSrcs[id].src = imageNames[id]; 56 setTimeout("doImageLoad(" + id + ", false);", 10); 57 } 58 } 59 else 60 { 61 if(imageSrcs[id].complete) //do next 62 setTimeout("doImageLoad(" + id + ", true);", 10); 63 else //wait for same 64 setTimeout("doImageLoad(" + id + ", false);", 10); 65 } 66 67} 68doImageLoad(0, true); 69 70 71 72 73var minOpac = 30; 74var maxOpac = 100; 75function initDisplay() { 76 setItemOpac('www01', minOpac); 77 setItemOpac('www02', minOpac); 78 setItemOpac('www03', minOpac); 79 setItemOpac('www04', minOpac); 80 setItemOpac('www05', minOpac); 81 82 if(getReqVar('mod') === 'listeria') { 83 mdls.listeria.show(); 84 } 85} 86 87function setItemOpac(id, opac) 88{ 89 if(!g_EBI(id)) return; 90 setOpacity(g_EBI(id), opac); 91} 92 93function setOpacity(obj, opacity) 94{ 95 opacity = (opacity == 100)?99.999:opacity; 96 97 // IE/Win 98 obj.style.filter = "alpha(opacity:"+opacity+")"; 99 100 // Safari<1.2, Konqueror 101 obj.style.KHTMLOpacity = opacity/100; 102 103 // Older Mozilla and Firefox 104 obj.style.MozOpacity = opacity/100; 105 106 // Safari 1.2, newer Firefox and Mozilla, CSS3 107 obj.style.opacity = opacity/100; 108} 109 110 111var currSelID = 'www00'; 112function setBtn(el, way) 113{ 114 if(!g_EBI(el.id)) return; 115 if(el.id==currSelID) return; 116 117 118 setBtnOnOff(el, way); 119 120} 121 122function setBtnOnOff(el, way) 123{ 124 if(!el || !g_EBI(el.id)) return; 125 if(way==0) 126 setOpacity(el, minOpac); 127 else 128 setOpacity(el, maxOpac); 129} 130 131function clickBtn(el) 132{ 133 var imgEl = g_EBI('main_img'); 134 if(!imgEl) return; 135 136 if(el.id==currSelID) return; 137 138 if(g_EBI(currSelID)) 139 { 140 g_EBI(currSelID).src = "/images/BM_" + currSelID + "_btn.gif"; 141 setOpacity(g_EBI(currSelID), minOpac); 142 } 143 144 currSelID = el.id; 145 146 el.src = "/images/BM_" + el.id + "_btn_D.gif"; 147 imgEl.src = "/images/BM_" + el.id + "_img.jpg"; 148 149} 150 151 152const mdls = { 153 lang_avail: ['en', 'es', 'ca', 'fr'], //TODO: rear1324 include these: ,'es','ca','fr], 154 lang: 'en', 155 156 listeria: { 157 tab: '', 158 loading: false, 159 show: function() { 160 util.el('mdl_listeria').style.display = 'block'; 161 this.init(); 162 }, 163 kill: function() { 164 util.el('mdl_listeria').style.display = 'none'; 165 }, 166 167 init: function() { 168 this.setLang(navigator.language); 169 this.initLangUpdates(); 170 this.setTab('intro'); 171 }, 172 173 initLang: function() { 174 let l = mdls.lang; 175 if(l.startsWith('en')) { l = 'en'; } 176 else if(l.startsWith('es')) { l = 'es'; } 177 else if(l.startsWith('ca')) { l = 'ca'; } 178 179 if(!mdls.lang_avail.includes(l)) { l = 'en'; } 180 mdls.lang = l; 181 182 console.log("LANG: " + mdls.lang); 183 util.html('mdl_listeria_btn_lang', "<img src='/images/flags/" + mdls.lang + ".svg' class='w3-circle' style='width: 20px; height: 20px;' /> " + mdls.lang.toUpperCase()); 184 }, 185 setLang: function(lang) { 186 mdls.lang = lang; 187 this.initLang(); 188 this.initLangUpdates(); 189 if(this.tab) { this.setTab(this.tab); } 190 }, 191 initLangUpdates: function() { 192 let fields = [ 193 'list-intro', 'list-reg-us', 'list-reg-eu', 'list-test', 'list-equipment', 'list-video', 194 'list-contact-us', 195 'email-name', 'email-addr', 'email-phone', 'email-msg', 'email-send' 196 ]; 197 let field_lang = { 198 'en': { 199 'list-intro': 'Overview', 'list-reg-us': 'US Regulation', 'list-reg-eu': 'EU Regulation', 'list-test': 'Test Kits', 'list-equipment': 'Equipment', 'list-video': 'Demo Video', 200 'list-contact-us': 'Contact Us', 201 'email-name': 'Name', 'email-addr': 'Email Address', 'email-phone': 'Phone Number', 'email-msg': 'Message', 'email-send': 'Send Message' 202 }, 203 'es': { 204 'list-intro': 'Descripción', 'list-reg-us': 'EE.UU. Reglamentación', 'list-reg-eu': 'EU Reglamentación', 'list-test': 'Elementos', 'list-equipment': 'Equipo', 'list-video': 'Demostración', 205 'list-contact-us': 'Contacto', 206 'email-name': 'Nombre', 'email-addr': 'Dirección de correo electrónico', 'email-phone': 'Número de teléfono', 'email-msg': 'Mensaje para enviar', 'email-send': 'Enviar mensaje' 207 }, 208 'ca': { 209 'list-intro': 'Descripció', 'list-reg-us': 'EUA Regulació', 'list-reg-eu': 'EU Regulació', 'list-test': 'Kits de prova', 'list-equipment': 'Equipament', 'list-video': 'Demostració', 210 'list-contact-us': 'Contacte',
211 'email-name': 'Nom', 'email-addr': 'Adreça de correu electrònic', 'email-phone': 'Número de telèfon', 'email-msg': 'Missatge per enviar', 'email-send': 'Enviar missatge' 212 }, 213 'fr': { 214 'list-intro': 'Aperçu', 'list-reg-us': 'Règlement USA', 'list-reg-eu': 'Règlement l\'EU', 'list-test': 'Appareils', 'list-equipment': 'Ãquipement', 'list-video': 'Démonstration', 215 'list-contact-us': 'Contactez-nous', 216 'email-name': 'Nom', 'email-addr': 'Adresse email', 'email-phone': 'Numéro de téléphone', 'email-msg': 'Message à envoyer', 'email-send': 'Envoyer un message' 217 }, 218 }; 219 220 for(const f of fields) { 221 try { 222 let val = field_lang[mdls.lang][f]; 223 if(!val) { continue; } 224 util.html('lang_specific_lbl__' + f, val); 225 } catch (e) { 226 console.log(e); 227 } 228 } 229 230 //ATTR: LANG_LABEL 231 let label_lang = { 232 'en': { 233 'email-name': 'Your Name', 'email-addr': 'Email Address', 'email-phone': 'Phone Number', 'email-message': 'Please tell us how we can help you.' 234 }, 235 'es': { 236 'email-name': 'Su nombre', 'email-addr': 'Dirección de correo electrónico', 'email-phone': 'Número de teléfono', 'email-message': 'Por favor, dÃganos cómo podemos ayudarle.' 237 }, 238 'ca': { 239 'email-name': 'El teu nom', 'email-addr': 'Adreça de correu electrònic', 'email-phone': 'Número de telèfon', 'email-message': 'Si us plau, digueu-nos com us podem ajudar.' 240 }, 241 'fr': { 242 'email-name': 'Votre nom', 'email-addr': 'Adresse email', 'email-phone': 'Numéro de téléphone', 'email-message': 'Veuillez nous dire comment nous pouvons vous aider.' 243 } 244 } 245 246 let items = document.querySelectorAll("[LANG_LABEL]"); 247 for(const itz of items) { 248 try { 249 let fval = itz.getAttribute("LANG_LABEL"); 250 let val = label_lang[mdls.lang][fval]; 251 if(!val) { continue; } 252 itz.placeholder = val; 253 } catch (e) { 254 console.log(e); 255 } 256 } 257 258 }, 259 260 setTab: function(tab) { 261 if(this.loading) { return; } 262 if(this.tab) { 263 util.jq_removeClass('mdl_listeria_btn__' + this.tab, 'w3-light-green'); 264 } 265 this.tab = tab; 266 util.jq_addClass('mdl_listeria_btn__' + this.tab, 'w3-light-green'); 267 268 //force the height for video so it won't cut 269 let hFull = this.tab === 'video' ? '95vh' : '75vh'; 270 $('#mdl_listeria_win_rect').css('max-height', hFull); 271 272 let uri = "/listeria/content/" + mdls.lang + "/" + this.tab + ".html"; 273 this.loading = true; 274 let _this = this; 275 276 util.el('mdl_listeria_content').style.display = 'none'; 277 util.el('mdl_listeria_content_loading').style.display = 'block'; 278 $.get(uri, function(response) { 279 util.html('mdl_listeria_content', response); 280 }).fail(function() { 281 console.log("err get: " + uri); 282 }).always(function () { 283 _this.loading = false; 284 util.el('mdl_listeria_content_loading').style.display = 'none'; 285 util.el('mdl_listeria_content').style.display = 'block'; 286 }); 287 } 288 }, 289 290 emailer: { 291 show: function() { 292 util.el('mdl_email').style.display = 'block'; 293 }, 294 kill: function() { 295 util.el('mdl_email').style.display = 'none'; 296 }, 297 send: function() { 298 const prefix = 'em_'; 299 const n = util.val(prefix + 'name'); 300 const addr = util.val(prefix + 'addr'); 301 const ph = util.val(prefix + 'ph').replace(/\s/g, ''); 302 const msg = util.val(prefix + 'msg').replace(/\n/g, '\n'); 303 304 if(n.replace(/\s/g, '') === '' || addr.replace(/\s/g, '') === '' || ph === '' || msg.replace(/\s/g, '') === '') { 305 let msg = "Please enter all information"; 306 if(mdls.lang === 'es') { 307 msg = "Por favor, ingrese toda la información."; 308 } else if(mdls.lang === 'ca') { 309 msg = "Introduïu tota la informació"; 310 } else if(mdls.lang === 'fr') { 311 msg = "Veuillez saisir toutes les informations."; 312 } 313 314 mdls.err.show(msg); 315 return; 316 } 317 318 let uri = 'mailer.php?' + 319 '&lang=' + mdls.lang + 320 '&name=' + n + 321 '&addr=' + addr + 322 '&ph=' + ph + 323 '&msg=' + encodeURI(msg); 324 325 util.el('em_btn_send').disabled = true; 326 const _this = this; 327 $.ajax({ url: uri }) 328 .done(function(data) { 329 util.el('em_btn_send').disabled = false;
330 let msg = ""; 331 if(data !== 'SUCCESS') { 332 msg = data; 333 } else { 334 msg = 'Your request has been submitted and we will be in contact with you soon.'; 335 if(mdls.lang === 'es') { 336 msg = "Su solicitud ha sido enviada y nos pondremos en contacto con usted pronto."; 337 } else if(mdls.lang === 'ca') { 338 msg = "La seva sol·licitud ha estat enviada i ens posarem en contacte amb vostè aviat."; 339 } else if(mdls.lang === 'fr') { 340 msg = "Votre demande a été soumise et nous vous contacterons prochainement."; 341 } 342 _this.kill(); 343 } 344 mdls.err.show(msg); 345 }); 346 } 347 }, 348 err: { 349 show: function(msg) { 350 util.html('errmodal_msg', msg); 351 util.el('mdl_err').style.display = 'block'; 352 }, 353 kill: function() { 354 util.el('mdl_err').style.display = 'none'; 355 } 356 } 357}; 358
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.