PageSourceSearch

https://servizionline.biassono.org/cmsbiassono/assets/scripts/apktools.js?v=202609271547

js biassono.org collected 2026-10-02 11:21:01 UTC 3,909 bytes, 132 lines download raw bytes

1class APKTool {
2    constructor(el, name, beginActionName, endActionName) {
3        this.el = el;
4        this.name = name;
5        this.isDisabled = false; // GIRARE isActive
6        this.isOn = false;
7        this.inAction = false;
8        this.setAction(beginActionName);
9        this.actionEnded = this.actioned.bind(this);
10        this.endActionName = endActionName;
11        this.el.addEventListener(endActionName, this.actionEnded);
12    }
13    attach(toolbar) {
14        this.toolbar = toolbar;
15    }
16    detach() {
17        this.toolbar = null;
18    }
19    static Create(name, beginActionName, endActionName, ico, tooltip) {
20        let HTMLTool = document.createElement('div');
21        HTMLTool.className = 'inp_tool ico_' + ico;
22        HTMLTool.setAttribute('role', 'button');
23        HTMLTool.setAttribute('alt', tooltip);
24        HTMLTool.setAttribute('title', tooltip);
25        let this_class = new APKTool(HTMLTool, name, beginActionName, endActionName);
26        return this_class;
27    }
28    render() {
29    }
30    enable() {
31        if (!this.isDisabled)
32            return;
33        this.isDisabled = false;
34        Main.RemoveClass(this.el, 'disabled');
35    }
36    disable() {
37        if (this.isDisabled)
38            return;
39        this.isDisabled = true;
40        Main.AddClass(this.el, 'disabled');
41    }
42    /**
43     * Setta o sovrascrive l'azione associata al tool
44     * @param {string} actionName
45     */
46    setAction(actionName) {
47        this.eventAction = this.action.bind(this, actionName);
48        this.el.addEventListener('click', this.eventAction);
49    }
50    action(event) {
51        console.log('action');
52        if (this.inAction || this.isDisabled)
53            return;
54        console.log(this);
55        this.inAction = true;
56        this.toolbar.owner.el.dispatchEvent(new Event(event));
57    }
58    actioned() {
59        console.log('actioned');
60        this.inAction = false;
61        this.toolbar.owner.el.dispatchEvent(new Event(this.endActionName));
62    }
63    on() {
64        Main.TraceLog(`on()`);
65        if (this.isOn)
66            return;
67        this.isOn = true;
68        Main.AddClass(this.el, 'pressed');
69    }
70    off() {
71        Main.TraceLog(`off()`);
72        if (!this.isOn)
73            return;
74        this.isOn = false;
75        Main.RemoveClass(this.el, 'pressed');
76    }
77}
78class APKToolbar {
79    constructor(el, owner) {
80        this.el = el;
81        this.owner = owner;
82        this.tools = [];
83    }
84    assign(owner) {
85        this.owner = owner;
86    }
87    retire() {
88        this.owner = null;
89    }
90    build() { }
91    static Create(owner) {
92        let HTMLToolbar = document.createElement('div');
93        HTMLToolbar.className = 'inp_tools';
94        let this_class = new APKToolbar(HTMLToolbar, owner);
95        return this_class;
96    }
97    render() {
98        for (let t = 0; t < this.tools.length; t++) {
99            this.tools[t].render();
100            this.el.appendChild(this.tools[t].el);
101        }
102    }
103    addTool(tool) {
104        this.tools.push(tool);
105        tool.attach(this);
106        return this.tools.length - 1;
107    }
108    updateTool(tool, idTool) {
109        if (idTool < 0 || idTool >= this.tools.length)
110            return null;
111        this.tools.splice(idTool, 1, tool);
112    }
113    getTool(idTool) {
114        if (idTool < 0 || idTool >= this.tools.length)
115            return null;
116        return this.tools[idTool];
117    }
118    deleteTool(idTool) {
119        if (idTool < 0 || idTool >= this.tools.length)
120            return null;
121        return this.tools.splice(idTool, 1);
122    }
123    getIdToolByName(name) {
124        for (let t = 0; t < this.tools.length; t++) {
125            if (this.tools[t].name == name) {
126                return t;
127            }
128        }
129        return -1;
130    }
131}
132//# sourceMappingURL=apktools.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.