Skip to content

Commit

Permalink
Implemented destination part of sharing
Browse files Browse the repository at this point in the history
If present, parse search part of URL, fund data parameter, and assign every input it contains.
  • Loading branch information
wincentbalin committed Jun 18, 2024
1 parent 97b88f8 commit e56e16f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,22 @@
'?data=', encodeURIComponent(JSON.stringify(data))].join('');
window.open(url, '_blank');
});

if (document.location.search) {
document.location.search.substring(1).split('&').map(function(param) {
return param.split('=');
}).filter(function(kv) {
var key = kv[0];
return key === 'data';
}).forEach(function(kv) {
var data = JSON.parse(decodeURIComponent(kv[1]));
inputIds.filter(function(id) {
return id in data;
}).forEach(function(id) {
document.getElementById(id).innerText = data[id];
});
});
}
</script>
</body>
</html>

0 comments on commit e56e16f

Please sign in to comment.