PageSourceSearch

https://www.dahlia-nds.co.uk/wp-content/themes/nds/js/svg4everybody.js?ver=1786027532

js dahlia-nds.co.uk collected 2026-10-02 08:13:17 UTC 2,360 bytes, 98 lines download raw bytes

1/*! svg4everybody v1.0.0 | github.com/jonathantneal/svg4everybody */
2(function(document, uses, requestAnimationFrame, CACHE, LTEIE8, IE9TO11) {
3  function embed(svg, g) {
4    if (g) {
5      var viewBox = g.getAttribute('viewBox');
6      var fragment = document.createDocumentFragment();
7      var clone = g.cloneNode(true);
8
9      if (viewBox) {
10        svg.setAttribute('viewBox', viewBox);
11      }
12
13      while (clone.childNodes.length) {
14        fragment.appendChild(clone.childNodes[0]);
15      }
16
17      svg.appendChild(fragment);
18    }
19  }
20
21  function onload() {
22    var xhr = this;
23    var x = document.createElement('x');
24    var s = xhr.s;
25
26    x.innerHTML = xhr.responseText;
27
28    xhr.onload = function() {
29      s.splice(0).map(function(array) {
30        embed(array[0], x.querySelector('#' + array[1].replace(/(\W)/g, '\\$1')));
31      });
32    };
33
34    xhr.onload();
35  }
36
37  function onframe() {
38    var use;
39
40    while ((use = uses[0])) {
41      if (LTEIE8) {
42        var img = new Image(), src, q;
43
44        src = use.getAttribute('xlink:href');
45        q = (/\?[^#]+/.exec(src) || [''])[0];
46        img.src = src.replace(/\?[^#]+/, '').replace('#', '.').replace(/^\./, '') + '.png' + q;
47
48        use.parentNode.replaceChild(img, use);
49      } else {
50        var
51        svg = use.parentNode,
52        url = use.getAttribute('xlink:href').split('#'),
53        url_root = url[0],
54        url_hash = url[1];
55
56        svg.removeChild(use);
57
58        if (url_root.length) {
59          var xhr = CACHE[url_root] = CACHE[url_root] || new XMLHttpRequest();
60
61          if (!xhr.s) {
62            xhr.s = [];
63
64            xhr.open('GET', url_root);
65
66            xhr.onload = onload;
67
68            xhr.send();
69          }
70
71          xhr.s.push([svg, url_hash]);
72
73          if (xhr.readyState === 4) {
74            xhr.onload();
75          }
76
77        } else {
78          embed(svg, document.getElementById(url_hash));
79        }
80      }
81    }
82
83    requestAnimationFrame(onframe);
84  }
85
86  if (LTEIE8 || IE9TO11) {
87    onframe();
88  }
89})(
90  document,
91  document.getElementsByTagName('use'),
92  window.requestAnimationFrame || window.setTimeout,
93  {},
94  /MSIE\s[1-8]\b/.test(navigator.userAgent),
95  /Trident\/[567]\b/.test(navigator.userAgent) || (navigator.userAgent.match(/AppleWebKit\/(\d+)/) || [])[1] < 537,
96  document.createElement('svg'),
97  document.createElement('use')
98);

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.