blob: cdd26153c7f9ccd0a0c4d9db8c18471ae2132161 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
(function (Icinga) {
"use strict";
try {
var CopyToClipboard = require('icinga/icinga-php-library/widget/CopyToClipboard');
} catch (e) {
console.warn('Unable to provide copy to clipboard feature. Libraries not available:', e);
return;
}
class CopyToClipboardBehavior extends Icinga.EventListener {
constructor(icinga)
{
super(icinga);
this.on('rendered', '#main > .container', this.onRendered, this);
/**
* Clipboard buttons
*
* @type {WeakMap<object, CopyToClipboard>}
* @private
*/
this._clipboards = new WeakMap();
}
onRendered(event)
{
let _this = event.data.self;
event.currentTarget.querySelectorAll('[data-icinga-clipboard]').forEach(button => {
_this._clipboards.set(button, new CopyToClipboard(button));
});
}
}
Icinga.Behaviors = Icinga.Behaviors || {};
Icinga.Behaviors.CopyToClipboardBehavior = CopyToClipboardBehavior;
})(Icinga);
|