initial commit
This commit is contained in:
commit
4a5b037263
5 changed files with 77 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.idea
|
25
LICENSE
Normal file
25
LICENSE
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
distribute this software, either in source code form or as a compiled
|
||||||
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
means.
|
||||||
|
|
||||||
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
For more information, please refer to <http://unlicense.org/>
|
||||||
|
|
28
index.html
Normal file
28
index.html
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
|
||||||
|
<title>QR code generator</title>
|
||||||
|
<style>
|
||||||
|
#qrcode {
|
||||||
|
margin-top: 15px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
<input id="text" type="text" value="https://gabnotes.org">
|
||||||
|
<button id="button">Generate</button>
|
||||||
|
|
||||||
|
<div id="qrcode"></div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Made with <a href="https://davidshimjs.github.io/qrcodejs/">qrcode.js</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<script src="qrcode.min.js"></script>
|
||||||
|
<script src="script.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
1
qrcode.min.js
vendored
Normal file
1
qrcode.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
22
script.js
Normal file
22
script.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
const qrcode = new QRCode("qrcode");
|
||||||
|
const elText = document.getElementById("text");
|
||||||
|
const btn = document.getElementById("button");
|
||||||
|
|
||||||
|
function makeCode() {
|
||||||
|
if (!elText.value) {
|
||||||
|
elText.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
qrcode.makeCode(elText.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
makeCode();
|
||||||
|
|
||||||
|
elText.addEventListener("blur", event => {makeCode()});
|
||||||
|
elText.addEventListener("keydown", event => {
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
makeCode();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btn.addEventListener("click", event => {makeCode()});
|
Loading…
Reference in a new issue