1/** 2 * @file 3 * Icon select javascript behaviours. 4 */ 5 6/** Polyfill for IE11 */ 7(function () { 8 function CustomEvent ( event, params ) { 9 params = params || { bubbles: false, cancelable: false, detail: undefined }; 10 var evt = document.createEvent( 'CustomEvent' ); 11 evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); 12 return evt; 13 } 14 15 CustomEvent.prototype = window.Event.prototype; 16 17 window.CustomEvent = CustomEvent; 18})(); 19 20(function (drupalSettings) { 21 'use strict'; 22 23 // Full support for IE 11. 24 var iconSelectEvent = new CustomEvent('iconselectloaded'); 25 26 var xhr = new XMLHttpRequest(); 27 28 if (!drupalSettings.icon_select || !drupalSettings.icon_select.icon_select_url) { 29 return; 30 } 31 xhr.open('get', drupalSettings.icon_select.icon_select_url, true); 32 xhr.responseType = 'document'; 33 xhr.onreadystatechange = function () { 34 if (xhr.readyState !== 4) { 35 return; 36 } 37 38 try { 39 var svg = xhr.responseXML.documentElement; 40 svg = document.importNode(svg, true); 41 svg.id = 'svg-icon-sprite'; 42 document.body.appendChild(svg); 43 44 svg.style.display = 'none'; 45 svg.style.display = 'block'; 46 } 47 catch (e) { 48 console.log(e); 49 } 50 51 window.dispatchEvent(iconSelectEvent); 52 }; 53 54 xhr.send(); 55})(drupalSettings);
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.