1(function ($, drupalSettings, Drupal) { 2 Drupal.behaviors.mfZoneBulletinDomtom = { 3 attach: function (context, settings) { 4 if (jQuery(context).find('#zone-bulletin-domtom').once('mfZoneBulletinDomtom').length > 0) { 5 var loaded = false; 6 7 var mfRes = Drupal.behaviors.tools.wrapper; 8 var domain = drupalSettings.mf_site_details.domain; 9 var bulletinType; 10 (drupalSettings.mf_site_details.type === 'DIRAG') ? bulletinType = 'BGP_actus': bulletinType = 'BGP' 11 mfRes.reportRaw(domain, 'forecast', bulletinType).then( 12 function (data) { 13 var currentHour = moment().utc().tz('Pacific/Noumea').hour(); 14 15 if(!data) { 16 $('#zone-bulletin-domtom').html(''); 17 return; 18 } 19 20 var bulletin = ""; 21 var description = ""; 22 if(data.report_title != null) { 23 bulletin += "<h2 style='display:flex'><i class='fa fa-newspaper' style='margin-right: 10px;'></i> " + data.report_title + "</h2>"; 24 } 25 26 for(var key in data.text_bloc_item) { 27 var block = data.text_bloc_item[key]; 28 29 //Avant 11h : matin J / après-midi J / nuit J à J+1 30 if(block.instants && currentHour < 11) { 31 if(block.instants.indexOf('morning') == -1) continue; 32 } 33 //De 11h à 17h : après-midi J / nuit J à J+1 34 else if (block.instants && currentHour < 17) { 35 if(block.instants.indexOf('afternoon') == -1) continue; 36 } 37 //Après 17h : nuit J à J+1 / J+1 matin / J+1 après-midi 38 else if(block.instants) { 39 if(block.instants.indexOf('evening') == -1) continue; 40 } 41 42 if(block.bloc_title) { 43 if(key > 1) { 44 bulletin += '<h3>' + block.bloc_title + '</h3>'; 45 } 46 else { 47 bulletin += '<h3>' + block.bloc_title + '</h3>'; 48 } 49 50 if(block.text) { 51 bulletin += '<p><b>' + block.text + '</b></p>'; 52 description += '<p><b>' + block.text + '</b></p>'; 53 } 54 } 55 56 else if(block.text) { 57 if(key == 1) { 58 bulletin += '<p style="font-style:italic">' + block.text + '</p>'; 59 description += '<p style="font-style:italic">' + block.text + '</p>'; 60 } 61 else if (key == 2) { 62 bulletin += '<p><b>' + block.text + '</b></p>'; 63 description += '<p><b>' + block.text + '</b></p>'; 64 } 65 else { 66 bulletin += '<p>' + block.text + '</p>'; 67 description += '<p>' + block.text + '</p>'; 68 } 69 } 70 } 71 $('.zone-bulletin-details .rte').html(bulletin); 72 73 } 74 ).catch(function(err) { 75 $('#zone-bulletin-domtom').html(''); 76 return; 77 }); 78 } 79 } 80 } 81})(jQuery, drupalSettings, Drupal); 82 83 84
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.