Skip to content

Commit

Permalink
feat: make image size autoscale
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Krebs committed Jun 5, 2023
1 parent 6b76e03 commit 5d6559b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 3 additions & 2 deletions extension/src/action.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#mainPopup {
background-color: black;
display: flex;
height: 150px; width: 150px; font-family: Helvetica, Ubuntu, Arial, sans-serif; } h1 {
/*height: 150px; width: 150px;*/ font-family: Helvetica, Ubuntu, Arial, sans-serif; }
h1 {
font-size: 2em;
}

Expand All @@ -22,4 +23,4 @@
<script src="qrcode.min.js" type="text/javascript"></script>
<script src="index.js" type="text/javascript"></script>

</html>
</html>
13 changes: 10 additions & 3 deletions extension/src/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
chrome.tabs.query({ active: true }, tabs => {
const url = tabs[0].url;
const url = tabs[0].url;
const size = (() => {
const length = url.length;
if (length>60) {
if (length>150) return 300;
return length*2;
} else return 120
})();
new QRCode(document.getElementById("qrcode"), {
text: url,
width: 128,
height: 128,
width: size,
height: size,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.H
Expand Down

0 comments on commit 5d6559b

Please sign in to comment.