PageSourceSearch

https://cdn.iz.ru/profiles/portal/themes/purple/js/svg4everybody.js?tlrtsy

js iz.ru collected 2026-09-27 20:54:08 UTC 6,174 bytes, 106 lines download raw bytes

vendor: 6,174 bytes, lines 1-106
1!function(root, factory) {
2    "function" == typeof define && define.amd ? // AMD. Register as an anonymous module unless amdModuleId is set
3    define([], function() {
4        return root.svg4everybody = factory();
5    }) : "object" == typeof module && module.exports ? // Node. Does not work with strict CommonJS, but
6    // only CommonJS-like environments that support module.exports,
7    // like Node.
8    module.exports = factory() : root.svg4everybody = factory();
9}(this, function() {
10    /*! svg4everybody v2.1.9 | github.com/jonathantneal/svg4everybody */
11    function embed(parent, svg, target) {
12        // if the target exists
13        if (target) {
14            // create a document fragment to hold the contents of the target
15            var fragment = document.createDocumentFragment(), viewBox = !svg.hasAttribute("viewBox") && target.getAttribute("viewBox");
16            // conditionally set the viewBox on the svg
17            viewBox && svg.setAttribute("viewBox", viewBox);
18            // copy the contents of the clone into the fragment
19            for (// clone the target
20            var clone = target.cloneNode(!0); clone.childNodes.length; ) {
21                fragment.appendChild(clone.firstChild);
22            }
23            // append the fragment into the svg
24            parent.appendChild(fragment);
25        }
26    }
27    function loadreadystatechange(xhr) {
28        // listen to changes in the request
29        xhr.onreadystatechange = function() {
30            // if the request is ready
31            if (4 === xhr.readyState) {
32                // get the cached html document
33                var cachedDocument = xhr._cachedDocument;
34                // ensure the cached html document based on the xhr response
35                cachedDocument || (cachedDocument = xhr._cachedDocument = document.implementation.createHTMLDocument(""), 
36                cachedDocument.body.innerHTML = xhr.responseText, xhr._cachedTarget = {}), // clear the xhr embeds list and embed each item
37                xhr._embeds.splice(0).map(function(item) {
38                    // get the cached target
39                    var target = xhr._cachedTarget[item.id];
40                    // ensure the cached target
41                    target || (target = xhr._cachedTarget[item.id] = cachedDocument.getElementById(item.id)), 
42                    // embed the target into the svg
43                    embed(item.parent, item.svg, target);
44                });
45            }
46        }, // test the ready state change immediately
47        xhr.onreadystatechange();
48    }
49    function svg4everybody(rawopts) {
50        function oninterval() {
51            // while the index exists in the live <use> collection
52            for (// get the cached <use> index
53            var index = 0; index < uses.length; ) {
54                // get the current <use>
55                var use = uses[index], parent = use.parentNode, svg = getSVGAncestor(parent), src = use.getAttribute("xlink:href") || use.getAttribute("href");
56                if (!src && opts.attributeName && (src = use.getAttribute(opts.attributeName)), 
57                svg && src) {
58                    if (polyfill) {
59                        if (!opts.validate || opts.validate(src, svg, use)) {
60                            // remove the <use> element
61                            parent.removeChild(use);
62                            // parse the src and get the url and id
63                            var srcSplit = src.split("#"), url = srcSplit.shift(), id = srcSplit.join("#");
64                            // if the link is external
65                            if (url.length) {
66                                // get the cached xhr request
67                                var xhr = requests[url];
68                                // ensure the xhr request exists
69                                xhr || (xhr = requests[url] = new XMLHttpRequest(), xhr.open("GET", url), xhr.send(), 
70                                xhr._embeds = []), // add the svg and id as an item to the xhr embeds list
71                                xhr._embeds.push({
72                                    parent: parent,
73                                    svg: svg,
74                                    id: id
75                                }), // prepare the xhr ready state change event
76                                loadreadystatechange(xhr);
77                            } else {
78                                // embed the local id into the svg
79                                embed(parent, svg, document.getElementById(id));
80                            }
81                        } else {
82                            // increase the index when the previous value was not "valid"
83                            ++index, ++numberOfSvgUseElementsToBypass;
84                        }
85                    }
86                } else {
87                    // increase the index when the previous value was not "valid"
88                    ++index;
89                }
90            }
91            // continue the interval
92            (!uses.length || uses.length - numberOfSvgUseElementsToBypass > 0) && requestAnimationFrame(oninterval, 67);
93        }
94        var polyfill, opts = Object(rawopts), newerIEUA = /\bTrident\/[567]\b|\bMSIE (?:9|10)\.0\b/, webkitUA = /\bAppleWebKit\/(\d+)\b/, olderEdgeUA = /\bEdge\/12\.(\d+)\b/, edgeUA = /\bEdge\/.(\d+)\b/, inIframe = window.top !== window.self;
95        polyfill = "polyfill" in opts ? opts.polyfill : newerIEUA.test(navigator.userAgent) || (navigator.userAgent.match(olderEdgeUA) || [])[1] < 10547 || (navigator.userAgent.match(webkitUA) || [])[1] < 537 || edgeUA.test(navigator.userAgent) && inIframe;
96        // create xhr requests object
97        var requests = {}, requestAnimationFrame = window.requestAnimationFrame || setTimeout, uses = document.getElementsByTagName("use"), numberOfSvgUseElementsToBypass = 0;
98        // conditionally start the interval if the polyfill is active
99        polyfill && oninterval();
100    }
101    function getSVGAncestor(node) {
102        for (var svg = node; "svg" !== svg.nodeName.toLowerCase() && (svg = svg.parentNode); ) {}
103        return svg;
104    }
105    return svg4everybody;
106});

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.