1/** 2 * @file atix_instant_system.js 3 * 4 * Contains the behavior added to instant-system block 5 */ 6(function ($, Drupal, drupalSettings, once) { 7 Drupal.behaviors.instantsystem = { 8 attach: function (context) { 9 once('instantsystem', 'body', context).forEach(function (element) { 10 var widgets = drupalSettings.atix_instant_system; 11 Object.values(widgets).forEach((item) => { 12 var mode = item.mode; 13 var script = document.createElement('script'); 14 script.type = 'text/javascript'; 15 script.async = true; 16 script.src = item.url; 17 script.src += $.param(item.params); 18 if (mode !== 'light') { 19 opts = item.opts; 20 opts.forEach((item) => { 21 var p = findGetParameter(item); 22 if (p !== undefined && p !== '') { 23 script.src += '&' + item + '=' + p; 24 } 25 }); 26 } 27 document.getElementsByTagName('body')[0].appendChild(script); 28 }); 29 }); 30 } 31 }; 32})(jQuery, Drupal, drupalSettings, once); 33 34var getUrlParameter = function getUrlParameter(sParam) { 35 var widgets = drupalSettings.atix_instant_system; 36 Object.values(widgets).forEach((item) => { 37 if (typeof item[sParam] !== 'undefined') { 38 return item[sParam]; 39 } 40 }); 41 42 var sPageURL = decodeURIComponent(window.location.search.substring(1)); 43 var sURLVariables = sPageURL.split('&'), sParameterName, i; 44 45 for (i = 0; i < sURLVariables.length; i++) { 46 sParameterName = sURLVariables[i].split('='); 47 48 if (sParameterName[0] === sParam) { 49 return sParameterName[1] === undefined ? true : sParameterName[1]; 50 } 51 } 52}; 53 54function findGetParameter(parameterName) { 55 var result = '', tmp = []; 56 location.search 57 .substring(1) 58 .split("&") 59 .forEach(function (item) { 60 tmp = item.split("="); 61 if (tmp[0] === parameterName) 62 result = decodeURIComponent(tmp[1]); 63 }); 64 return result; 65}
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.