-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfullw.js
More file actions
39 lines (36 loc) · 1.02 KB
/
Copy pathfullw.js
File metadata and controls
39 lines (36 loc) · 1.02 KB
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
document.addEventListener('DOMContentLoaded', function() {
const field = document.getElementById('intext'),
txtBtn = document.querySelectorAll('.textBtn');
for (var i = 0; i < txtBtn.length; i++) {
txtBtn[i].addEventListener('click', function() {
field.value += this.firstChild.data;
});
}
document.getElementById('fullwsub').addEventListener('click', convertAndCopy, false);
});
function convertAndCopy() {
const fwidth = 0xFEE0;
const fld = document.getElementById('intext'),
message = document.getElementById('copytext');
fld.value = fld.value.replace(/[\u0000-\u007F]/g, function(ch) {
if (ch != " ") {
return String.fromCharCode(ch.charCodeAt(0) + fwidth);
} else {
return " ";
}
});
fld.select();
document.execCommand("Copy");
fadeOutIn(message, 1000);
}
function fadeOutIn(elem, speed) {
if (!elem.style.opacity) {
elem.style.opacity = 1;
}
var outInterval = setInterval(function() {
elem.style.opacity -= 0.02;
if (elem.style.opacity <= 0) {
clearInterval(outInterval);
}
}, speed / 50);
}