make qr code for selected text
let selection = window.getSelection().toString();
let encodedSelection = encodeURIComponent(selection)
let popupContent = `<html lang="en">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"> </script>
</head>
<body>
<main>
<h1> qr code for current selection</h1>
<div id="qrcode"></div>
<div id="whatsappQrcodeContainer" style="display: none">
<h1> Detected phone number, so here is whatsapp link - </h1>
<div id="whatsappQrcode"></div>
</div>
</main>
<script>
let selection = decodeURIComponent("${encodedSelection}");
var qrcode = new QRCode("qrcode",selection);
let phPattern=/^[+]?[0-9]{8,13}$/;
let possiblePhNumber = selection.replace(/[^+0-9]/g, '');
if(phPattern.test(possiblePhNumber)){
document.getElementById("whatsappQrcodeContainer").style.display = "block";
let qrcode = new QRCode('whatsappQrcode','https://wa.me/'+possiblePhNumber);
}
</script>
</body>
</html>`;
myWindow = window.open("",'header', 'menubar=0', 'toolbar=0');
myWindow.document.write(popupContent);