Add chrome extension

This commit is contained in:
Myx
2024-11-15 02:42:25 +01:00
parent 8792699c7c
commit 1b58440d4d
19 changed files with 409 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<title>Current url as QR code</title>
<script src="../libraries/qrcode.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
padding: 10px;
background-color: #121212;
color: #f0f0f0;
}
img {
margin-top: 10px;
}
a {
color: #f0f0f0;
text-decoration: none;
}
.logotype{
width: 100px;
}
</style>
</head>
<body>
<img class="logotype" src="https://bytefy.net/assets/logo-full-orange-beta-vectorized.svg" alt="QR Code">
<p>More online tools at: <a href="https://bytefy.net" target="_blank">bytefy.net</a></p>
<h3>Current url as QR code</h3>
<div id="qrcode"></div>
<script src="popup.js"></script>
</body>
</html>

View File

@@ -0,0 +1,21 @@
document.addEventListener('DOMContentLoaded', function() {
chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
let url = tabs[0].url;
generateQRCode(url);
});
});
function generateQRCode(url) {
let qrCodeElement = document.getElementById('qrcode');
qrCodeElement.innerHTML = "";
if (typeof QRCode !== 'undefined') {
new QRCode(qrCodeElement, {
text: url,
width: 256,
height: 256
});
} else {
console.error("QRCode library is not loaded.");
}
}