mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-27 19:57:38 +00:00
Sketch size is reduced by 5 - 6 kB Files are extracted from original source and moved to `static` directory.
28 lines
1.0 KiB
JavaScript
28 lines
1.0 KiB
JavaScript
function setGithubClipboard() {
|
|
var clipboard = 'ESP Easy | Information |\n -----|-----|\n';
|
|
max_loop = 100;
|
|
for (var i = 1; i < max_loop; i++) {
|
|
var cur_id = 'copyText_' + i;
|
|
var test = document.getElementById(cur_id);
|
|
if (test == null) {
|
|
i = max_loop + 1;
|
|
} else {
|
|
var separatorSymbol = '|';
|
|
if (i % 2 == 0) {
|
|
separatorSymbol += '\n'
|
|
}
|
|
clipboard += test.innerHTML.replace(/<[Bb][Rr]\s*\/?>/gim, '\n') + separatorSymbol;
|
|
}
|
|
}
|
|
clipboard = clipboard.replace(/<\/[Dd][Ii][Vv]\s*\/?>/gim, '\n');
|
|
clipboard = clipboard.replace(/<[^>]*>/gim, '');
|
|
var tempInput = document.createElement('textarea');
|
|
tempInput.style = 'position: absolute;left: -1000px; top: -1000px';
|
|
tempInput.innerHTML = clipboard;
|
|
document.body.appendChild(tempInput);
|
|
tempInput.select();
|
|
document.execCommand('copy');
|
|
document.body.removeChild(tempInput);
|
|
alert('Copied: "' + clipboard + '" to clipboard!')
|
|
}
|