Skip to content

Commit

Permalink
Added QR code
Browse files Browse the repository at this point in the history
  • Loading branch information
jlucaspains committed Jan 6, 2025
1 parent 83c2155 commit 23ccd46
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion browser-extensions/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
<head>
<style>
.container {
min-height: 5rem;
height: 5rem;
width: 10rem;
padding: 1rem;
}

.result {
font-size: 2rem;
margin: auto;
Expand All @@ -18,7 +19,9 @@
<div class="container">
<div id="sharp-cooking-message">Trying to extract recipe. Please wait...</div>
<div id="sharp-cooking-code" class="result"></div>
<div id="qrcode"></div>
</div>
<script src="qrcode.js"></script>
<script src="popup.js">
</script>
</body>
Expand Down
6 changes: 6 additions & 0 deletions browser-extensions/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ chrome.runtime.onMessage.addListener(
document.getElementById("sharp-cooking-code").innerHTML = request.code || "";
document.getElementById("sharp-cooking-message").innerHTML = request.error || "";

new QRCode(document.getElementById("qrcode"), {
text: request.code,
width: 128,
height: 128
});

return false; // there is no need to respond
}
}
Expand Down
Loading

0 comments on commit 23ccd46

Please sign in to comment.