Implemented interaction with docker registry.
This commit is contained in:
@@ -3,3 +3,4 @@ import.meta.glob([
|
||||
]);
|
||||
import './bootstrap';
|
||||
import './_menu.js';
|
||||
import './block-copy.js';
|
||||
|
21
app/application/resources/site/js/block-copy.js
Normal file
21
app/application/resources/site/js/block-copy.js
Normal file
@@ -0,0 +1,21 @@
|
||||
[].slice.call(document.querySelectorAll('.block-copy')).map(function(el) {
|
||||
|
||||
let button = el.querySelector('button');
|
||||
button.addEventListener('click', () => {
|
||||
navigator.clipboard.writeText(el.querySelector('.block-copy-text').textContent)
|
||||
.then(() => {
|
||||
button.textContent = button.getAttribute('data-copy-success');
|
||||
setTimeout(function () {
|
||||
button.textContent = button.getAttribute('data-default');
|
||||
}, 3000);
|
||||
})
|
||||
.catch(err => {
|
||||
button.textContent = button.getAttribute('data-copy-error');
|
||||
setTimeout(function () {
|
||||
button.textContent = button.getAttribute('data-default');
|
||||
}, 3000);
|
||||
console.log('Something went wrong', err);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
Reference in New Issue
Block a user