mirror of
https://github.com/Polaris-Entertainment/bytefy.git
synced 2026-07-08 00:25:09 +00:00
Add chrome extension
This commit is contained in:
@@ -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>
|
||||
@@ -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.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user