wait for copyText promise

This commit is contained in:
Ryan@fsunuc 2023-01-16 01:33:03 -05:00
parent 7143576773
commit ae56a9aa74
2 changed files with 11 additions and 10 deletions

View File

@ -447,11 +447,16 @@ function CopyInputs(){
} }
} }
console.log(copyText); //console.log(copyText);
navigator.clipboard.writeText(copyText); navigator.clipboard.writeText(copyText).then(
() => {
alert('setting copied to clipboard.\nCan paste it in Monte Carlo simulation.\n' + copyText);
}).catch(
() =>{
alert('Cannot copy.');
});
alert('setting copied to clipboard.\nCan paste it in Monte Carlo simulation.');
//window.open('simpleSim.html'); //window.open('simpleSim.html');
} }

View File

@ -291,25 +291,21 @@ The source code for calculation can be found in <a href="https://github.com/cale
<script> <script>
function GetClipBoard(){ function GetClipBoard(){
navigator.clipboard.readText().then( navigator.clipboard.readText().then(
function(result){ function(result){
heliosText = result; //console.log(result);
console.log(result);
if( result.substring(0,16) == "====HELIOSMATICS" ){ if( result.substring(0,16) == "====HELIOSMATICS" ){
let haha = result.substring(17).split(', '); let haha = result.substring(17).split(', ');
console.log(haha); //console.log(haha);
//alert(haha);
document.getElementsByName('beam_AZ')[0].value = haha[0]; document.getElementsByName('beam_AZ')[0].value = haha[0];
document.getElementsByName('beam_Ex')[0].value = haha[1]; document.getElementsByName('beam_Ex')[0].value = haha[1];
document.getElementsByName('target_AZ')[0].value = haha[2]; document.getElementsByName('target_AZ')[0].value = haha[2];
document.getElementsByName('lRecoil_AZ')[0].value = haha[3]; document.getElementsByName('lRecoil_AZ')[0].value = haha[3];
document.getElementsByName('KEA')[0].value = haha[5]; document.getElementsByName('KEA')[0].value = haha[5];
document.getElementsByName('BField')[0].value = haha[4]; document.getElementsByName('BField')[0].value = haha[4];
document.getElementsByName('posArray')[0].value = haha[6]; document.getElementsByName('posArray')[0].value = haha[6];
document.getElementsByName('posRecoil')[0].value = haha[7]; document.getElementsByName('posRecoil')[0].value = haha[7];
} }
} }
); );