PageSourceSearch

https://foxscore.dev/js/tooltips.js

js foxscore.dev collected 2026-10-07 20:30:00 UTC 3,632 bytes, 78 lines download raw bytes

1"use strict";
2var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6    return c > 3 && r && Object.defineProperty(target, key, r), r;
7};
8Object.defineProperty(exports, "__esModule", { value: true });
9var Placement;
10(function (Placement) {
11    Placement["Top"] = "top";
12    Placement["TopStart"] = "top-start";
13    Placement["TopEnd"] = "top-end";
14    Placement["Bottom"] = "bottom";
15    Placement["BottomStart"] = "bottom-start";
16    Placement["BottomEnd"] = "bottom-end";
17    Placement["Left"] = "left-start";
18    Placement["LeftStart"] = "left-start";
19    Placement["LeftEnd"] = "left-end";
20    Placement["Right"] = "right-start";
21    Placement["RightStart"] = "right-start";
22    Placement["RightEnd"] = "right-end";
23})(Placement || (Placement = {}));
24class TooltipOptions {
25    constructor() {
26        this.allowHtml = false;
27        this.arrow = false;
28        this.variant = Variant.Neutral;
29        this.delay = null;
30    }
31}
32class Tooltips extends Static {
33    static init() {
34        const observer = new MutationObserver(function (mutations) {
35            mutations.forEach(function (mutation) {
36                for (var i = 0; i < mutation.addedNodes.length; i++)
37                    Tooltips.ScanElement(mutation.addedNodes[i]);
38            });
39        });
40        observer.observe(document, {
41            childList: true
42        });
43        // Get all elements with the tooltip attribute
44        const initialElements = document.querySelectorAll("[tooltip]");
45        initialElements.forEach(Tooltips.ScanElement);
46    }
47    static ScanElement(element) {
48        const message = element.getAttribute("tooltip");
49        if (!message)
50            return;
51        const options = new TooltipOptions();
52        options.allowHtml = element.hasAttribute("tooltip-allowHtml");
53        options.arrow = element.hasAttribute("tooltip-arrow");
54        options.variant = element.getAttribute("tooltip-variant");
55        options.placement = element.getAttribute("tooltip-placement");
56        options.delay = element.hasAttribute("tooltip-delay")
57            ? parseInt(element.getAttribute("tooltip-delay"))
58            : null;
59        Tooltips.Spawn(element, message, options);
60    }
61    static Spawn(element, content, options = null) {
62        var _a, _b, _c, _d, _e;
63        // @ts-ignore
64        tippy(element, {
65            content: content,
66            allowHTML: (_a = options === null || options === void 0 ? void 0 : options.allowHtml) !== null && _a !== void 0 ? _a : false,
67            placement: (_b = options === null || options === void 0 ? void 0 : options.placement) !== null && _b !== void 0 ? _b : undefined,
68            arrow: (_c = options === null || options === void 0 ? void 0 : options.arrow) !== null && _c !== void 0 ? _c : false,
69            theme: (_d = options === null || options === void 0 ? void 0 : options.variant) !== null && _d !== void 0 ? _d : Variant.Neutral,
70            delay: [(_e = options === null || options === void 0 ? void 0 : options.delay) !== null && _e !== void 0 ? _e : 500, 0],
71            animation: 'shift-away',
72        });
73    }
74}
75__decorate([
76    onInitialize
77], Tooltips, "init", null);
78//# sourceMappingURL=tooltips.js.map

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.