PageSourceSearch

https://commoncollections.be/libs/svg-manager.js

js commoncollections.be collected 2026-10-06 20:07:14 UTC 2,903 bytes, 80 lines download raw bytes

1class SvgManager {
2    constructor(options, container, type) {
3        this.defaults = {
4            type: "normal"
5        };
6        this.container = container;
7        this.transitionEnd = [];
8        this.timer = [];
9        this.initSvg();
10    }
11
12    initSvg() {
13        var that = this;
14        var svgs = this.container.querySelectorAll(".svg-anim");
15
16        svgs.forEach((svg, index) => {
17		console.log("SVG ELEMENT");
18            this.transitionEnd[index] = false;
19            this.timer[index] = null;
20
21			/*
22            if (CONF.s.isSafari) {
23                let svg1 = svg.querySelector(".svg-1");
24                svg1.classList.add("inverse");
25            }
26			*/
27
28            svg.addEventListener("mouseenter", function() {
29                if (svg.classList.contains("off")) return;
30
31                let svg1 = svg.querySelector(".svg-1");
32                that.transitionEnd[index] = false;
33                svg1.classList.add("anim");
34                svg1.classList.remove("inverse", "hidden");
35
36                //svg.addEventListener(CONF.s.transitionEnd, function() {
37                //    that.transitionEnd[index] = true;
38                //}, { once: true });
39            });
40
41            svg.addEventListener("mouseleave", function() {
42                if (svg.classList.contains("off")) return;
43
44                let svg1 = svg.querySelector(".svg-1");
45                let svg2 = svg.querySelector(".svg-2");
46                //svg.removeEventListener(CONF.s.transitionEnd);
47
48                if (that.transitionEnd[index]) {
49                    //svg1.className = CONF.s.isSafari ? "svg-1 inverse hidden" : "svg-1 hidden";
50                    svg2.className = "svg-2";
51
52                    that.timer[index] = setTimeout(function() {
53                        svg2.classList.add("anim");
54                        that.timer[index] = setTimeout(function() {
55                            that.timer[index] = null;
56                            that.transitionEnd[index] = false;
57                            //svg1.className = CONF.s.isSafari ? "svg-1 inverse" : "svg-1";
58                            svg2.classList.remove("anim");
59                            svg2.classList.add("hidden");
60                        }, 300);
61                    }, 20);
62                } else {
63                    //svg1.className = CONF.s.isSafari ? "svg-1 inverse" : "svg-1";
64                    svg2.classList.remove("anim");
65                    svg2.classList.add("hidden");
66                }
67            });
68        });
69    }
70}
71
72// Example usage
73// let manager = new SvgManager(options, document.body, type);
74const options = {};  // can be expanded in the future
75const container = document.body;
76const type = "";  // not used in current code but can be a placeholder for future use
77
78// Create an instance of SvgManager
79// setTimeout(()=>{const svgManager = new SvgManager(options, container, type)}, 1000);
80

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.