-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
27 lines (24 loc) · 905 Bytes
/
script.js
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
document.querySelector('#print').addEventListener('click', function(event) {
window.print();
});
var inputIds = ['backaddress', 'addressnote', 'address', 'additionalinformation', 'text', 'footer'];
document.querySelector('#share').addEventListener('click', function(event) {
var params = new URLSearchParams();
inputIds.forEach(function(id) {
var text = document.getElementById(id).innerText.trim();
if (text !== '') {
params.set(id, text);
}
});
var url = [document.location.origin, document.location.pathname,
'?', params.toString()].join('');
window.open(url, '_blank');
});
if (document.location.search) {
var params = new URLSearchParams(document.location.search);
inputIds.forEach(function(id) {
if (params.has(id)) {
document.getElementById(id).innerText = params.get(id);
}
});
}