PageSourceSearch

https://sohopizza.co.th/assets/confetti/confetti.min.js

js sohopizza.co.th collected 2026-09-29 02:54:07 UTC 7,456 bytes, 201 lines download raw bytes

1var Confetti = function() {
2    var t = function() {
3        return function() {
4            this.gravity = 10,
5            this.particle_count = 75,
6            this.particle_size = 1,
7            this.explosion_power = 25,
8            this.destroy_target = !0,
9            this.fade = !1
10        }
11    }()
12      , e = function() {
13        function e(n) {
14            var r = this;
15            if (this.bursts = [],
16            this.setCount = function(t) {
17                if ("number" != typeof t)
18                    throw new Error("Input must be of type 'number'");
19                e.CONFIG.particle_count = t
20            }
21            ,
22            this.setPower = function(t) {
23                if ("number" != typeof t)
24                    throw new Error("Input must be of type 'number'");
25                e.CONFIG.explosion_power = t
26            }
27            ,
28            this.setSize = function(t) {
29                if ("number" != typeof t)
30                    throw new Error("Input must be of type 'number'");
31                e.CONFIG.particle_size = t
32            }
33            ,
34            this.setFade = function(t) {
35                if ("boolean" != typeof t)
36                    throw new Error("Input must be of type 'boolean'");
37                e.CONFIG.fade = t
38            }
39            ,
40            this.destroyTarget = function(t) {
41                if ("boolean" != typeof t)
42                    throw new Error("Input must be of type 'boolean'");
43                e.CONFIG.destroy_target = t
44            }
45            ,
46            this.setupCanvasContext = function() {
47                if (!e.CTX) {
48                    var t = document.createElement("canvas");
49                    e.CTX = t.getContext("2d"),
50                    t.width = 2 * window.innerWidth,
51                    t.height = 2 * window.innerHeight,
52                    t.style.position = "fixed",
53                    t.style.top = "0",
54                    t.style.left = "0",
55                    t.style.width = "calc(100%)",
56                    t.style.height = "calc(100%)",
57                    t.style.margin = "0",
58                    t.style.padding = "0",
59                    t.style.zIndex = "999999999",
60                    t.style.pointerEvents = "none",
61                    document.body.appendChild(t),
62                    window.addEventListener("resize", function() {
63                        t.width = 2 * window.innerWidth,
64                        t.height = 2 * window.innerHeight
65                    })
66                }
67            }
68            ,
69            this.setupElement = function(t) {
70                var n;
71                r.element = t instanceof HTMLElement ? t : document.getElementById(t),
72                null === (n = r.element) || void 0 === n || n.addEventListener("click", function(t) {
73                    var n = new o(2 * t.clientX,2 * t.clientY);
74                    r.bursts.push(new i(n)),
75                    e.CONFIG.destroy_target && (r.element.style.visibility = "hidden")
76                })
77            }
78            ,
79            this.play = function(n) {
80                r.bursts.push(new i(n));
81                e.CONFIG.destroy_target && (r.element.style.visibility = "hidden");
82            }
83            ,
84            this.update = function(t) {
85                r.delta_time = (t - r.time) / 1e3,
86                r.time = t;
87                for (var e = r.bursts.length - 1; e >= 0; e--)
88                    r.bursts[e].update(r.delta_time),
89                    0 == r.bursts[e].particles.length && r.bursts.splice(e, 1);
90                r.draw(),
91                window.requestAnimationFrame(r.update)
92            }
93            ,
94            !n)
95                throw new Error("Missing id");
96            e.CONFIG || (e.CONFIG = new t),
97            this.time = (new Date).getTime(),
98            this.delta_time = 0,
99            this.setupCanvasContext(),
100            this.setupElement(n),
101            window.requestAnimationFrame(this.update)
102        }
103        return e.prototype.draw = function() {
104            s.clearScreen();
105            for (var t = 0, e = this.bursts; t < e.length; t++) {
106                e[t].draw()
107            }
108        }
109        ,
110        e
111    }()
112      , i = function() {
113        function t(t) {
114            this.particles = [];
115            for (var i = 0;
115 i < e.CONFIG.particle_count; i++)
116                this.particles.push(new n(t))
117        }
118        return t.prototype.update = function(t) {
119            for (var e = this.particles.length - 1; e >= 0; e--)
120                this.particles[e].update(t),
121                this.particles[e].checkBounds() && this.particles.splice(e, 1)
122        }
123        ,
124        t.prototype.draw = function() {
125            for (var t = this.particles.length - 1; t >= 0; t--)
126                this.particles[t].draw()
127        }
128        ,
129        t
130    }()
131      , n = function() {
132        function t(t) {
133            this.size = new o((16 * Math.random() + 4) * e.CONFIG.particle_size,(4 * Math.random() + 4) * e.CONFIG.particle_size),
134            this.position = new o(t.x - this.size.x / 2,t.y - this.size.y / 2),
135            this.velocity = r.generateVelocity(),
136            this.rotation = 360 * Math.random(),
137            this.rotation_speed = 10 * (Math.random() - .5),
138            this.hue = 360 * Math.random(),
139            this.opacity = 100,
140            this.lifetime = Math.random() + .25
141        }
142        return t.prototype.update = function(t) {
143            this.velocity.y += e.CONFIG.gravity * (this.size.y / (10 * e.CONFIG.particle_size)) * t,
144            this.velocity.x += 25 * (Math.random() - .5) * t,
145            this.velocity.y *= .98,
146            this.velocity.x *= .98,
147            this.position.x += this.velocity.x,
148            this.position.y += this.velocity.y,
149            this.rotation += this.rotation_speed,
150            e.CONFIG.fade && (this.opacity -= this.lifetime)
151        }
152        ,
153        t.prototype.checkBounds = function() {
154            return this.position.y - 2 * this.size.x > 2 * window.innerHeight
155        }
156        ,
157        t.prototype.draw = function() {
158            s.drawRectangle(this.position, this.size, this.rotation, this.hue, this.opacity)
159        }
160        ,
161        t
162    }()
163      , o = function() {
164        return function(t, e) {
165            this.x = t || 0,
166            this.y = e || 0
167        }
168    }()
169      , r = function() {
170        function t() {}
171        return t.generateVelocity = function() {
172            var t = Math.random() - .5
173              , i = Math.random() - .7
174              , n = Math.sqrt(t * t + i * i);
175            return i /= n,
176            new o((t /= n) * (Math.random() * e.CONFIG.explosion_power),i * (Math.random() * e.CONFIG.explosion_power))
177        }
178        ,
179        t
180    }()
181      , s = function() {
182        function t() {}
183        return t.clearScreen = function() {
184            e.CTX && e.CTX.clearRect(0, 0, 2 * window.innerWidth, 2 * window.innerHeight)
185        }
186        ,
187        t.drawRectangle = function(t, i, n, o, r) {
188            e.CTX && (e.CTX.save(),
189            e.CTX.beginPath(),
190            e.CTX.translate(t.x + i.x / 2, t.y + i.y / 2),
191            e.CTX.rotate(n * Math.PI / 180),
192            e.CTX.rect(-i.x / 2, -i.y / 2, i.x, i.y),
193            e.CTX.fillStyle = "hsla(" + o + "deg, 90%, 65%, " + r + "%)",
194            e.CTX.fill(),
195            e.CTX.restore())
196        }
197        ,
198        t
199    }();
200    return e
201}();

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.