diff --git a/.vscode/extensions.json b/.vscode/extensions.json
index 3ff560f..c074ed9 100644
--- a/.vscode/extensions.json
+++ b/.vscode/extensions.json
@@ -1,5 +1,6 @@
{
"recommendations": [
- "charliermarsh.ruff"
+ "charliermarsh.ruff",
+ "biomejs.biome"
]
}
diff --git a/cardie/static/main/authentication.css b/cardie/static/main/authentication.css
index 165cb7d..31e8d43 100644
--- a/cardie/static/main/authentication.css
+++ b/cardie/static/main/authentication.css
@@ -68,8 +68,13 @@ html {
z-index: 0;
- background: rgb(61,132,148);
- background: linear-gradient(120deg, rgb(61, 84, 148) 9%, rgb(62, 34, 139) 47%, rgb(37, 210, 187) 91%);
+ background: rgb(61, 132, 148);
+ background: linear-gradient(
+ 120deg,
+ rgb(61, 84, 148) 9%,
+ rgb(62, 34, 139) 47%,
+ rgb(37, 210, 187) 91%
+ );
}
#authentication_privacypolicy {
@@ -84,4 +89,4 @@ html {
#authentication_privacypolicy:hover {
scale: 1.1;
opacity: 1;
-}
\ No newline at end of file
+}
diff --git a/cardie/static/main/card.css b/cardie/static/main/card.css
index 293f228..f6fcb32 100644
--- a/cardie/static/main/card.css
+++ b/cardie/static/main/card.css
@@ -2,7 +2,7 @@
.card_card {
margin: 10px;
-
+
width: 600px;
aspect-ratio: 1.75;
@@ -11,7 +11,8 @@
display: block;
}
-.card_card_front, .card_card_back {
+.card_card_front,
+.card_card_back {
position: absolute;
top: 0;
width: 100%;
@@ -198,4 +199,4 @@
border: none;
background-color: none;
color: rgb(64, 163, 255);
-}
\ No newline at end of file
+}
diff --git a/cardie/static/main/card_view.css b/cardie/static/main/card_view.css
index ee7f5c5..ab57d21 100644
--- a/cardie/static/main/card_view.css
+++ b/cardie/static/main/card_view.css
@@ -55,4 +55,4 @@ html {
#cardview_bottom_owned {
opacity: 0.8;
-}
\ No newline at end of file
+}
diff --git a/cardie/static/main/editor.css b/cardie/static/main/editor.css
index 4ed4315..6a7b9ef 100644
--- a/cardie/static/main/editor.css
+++ b/cardie/static/main/editor.css
@@ -177,26 +177,26 @@ html {
border: var(--default-glass-border);
backdrop-filter: var(--default-glass-blur);
border-radius: 20px;
-
+
aspect-ratio: 1;
width: auto;
height: 40%;
max-height: 40%;
-
+
z-index: 3;
-
+
position: fixed;
top: 50%;
left: 50%;
translate: -50% -50%;
-
+
padding: clamp(1.5vh, 15px, 1.5vw);
-
+
display: flex;
flex-direction: column;
-
+
display: none; /* Keep hidden until needed */
-
+
/* Starting properties for animation */
opacity: 0;
scale: 0.8;
@@ -209,25 +209,25 @@ html {
#editor-iconselector {
background-color: var(--default-glass-background);
backdrop-filter: var(--default-glass-blur);
-
+
aspect-ratio: 1;
width: calc(100vw - 1.5vh);
height: 100vh;
max-height: 100vh;
-
+
z-index: 3;
-
+
position: fixed;
top: 0px;
left: 0px;
-
+
padding: clamp(1.5vh, 15px, 1.5vw);
-
+
display: flex;
flex-direction: column;
-
+
display: none; /* Keep hidden until needed */
-
+
/* Starting properties for animation */
opacity: 0;
scale: 0.8;
@@ -270,9 +270,9 @@ html {
justify-content: center;
margin: clamp(0.8vh, 8px, 0.8vw);
- -webkit-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- -moz-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
+ -webkit-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ -moz-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
}
.editor-iconselector-icon:hover {
@@ -338,21 +338,21 @@ html {
border: var(--default-glass-border);
backdrop-filter: var(--default-glass-blur);
border-radius: 20px;
-
+
z-index: 3;
-
+
position: fixed;
top: 50%;
left: 50%;
translate: -50% -50%;
-
+
padding: clamp(2vh, 20px, 2vw);
-
+
display: flex;
flex-direction: column;
-
+
display: none; /* Keep hidden until needed */
-
+
/* Starting properties for animation */
opacity: 0;
scale: 0.8;
@@ -371,21 +371,21 @@ html {
border: var(--default-glass-border);
backdrop-filter: var(--default-glass-blur);
border-radius: 20px;
-
+
z-index: 3;
-
+
position: fixed;
top: 50vh;
left: 50vw;
translate: -50% -50%;
-
+
padding: clamp(2vh, 20px, 2vw);
-
+
display: flex;
flex-direction: column;
-
+
display: none; /* Keep hidden until needed */
-
+
/* Starting properties for animation */
opacity: 0;
scale: 0.8;
@@ -488,5 +488,4 @@ html {
margin-left: clamp(1.5vh, 15px, 1.5vw);
margin-right: clamp(1vh, 10px, 1vw);
-
-}
\ No newline at end of file
+}
diff --git a/cardie/static/main/editor_print.css b/cardie/static/main/editor_print.css
index dad0e6e..c1c5932 100644
--- a/cardie/static/main/editor_print.css
+++ b/cardie/static/main/editor_print.css
@@ -48,10 +48,10 @@
min-height: 2in;
max-width: 3.5in;
max-height: 2in;
-
}
- .card_card_front, .card_card_back {
+ .card_card_front,
+ .card_card_back {
position: unset;
top: unset;
border: 2px solid rgb(0, 0, 0);
@@ -67,7 +67,8 @@
overflow: hidden;
}
- .card_card_back, .card_card_front {
+ .card_card_back,
+ .card_card_front {
transform: rotateY(0);
}
@@ -110,7 +111,7 @@
grid-template-columns: repeat(2, 1fr);
grid-template-rows: repeat(3, 1fr);
grid-column-gap: 0.1in;
- grid-row-gap: 0.1in;
+ grid-row-gap: 0.1in;
}
#print_back_div {
@@ -120,8 +121,7 @@
grid-template-columns: repeat(2, 1fr);
grid-template-rows: repeat(3, 1fr);
grid-column-gap: 0.1in;
- grid-row-gap: 0.1in;
-
+ grid-row-gap: 0.1in;
}
#print_front_div * {
@@ -131,4 +131,4 @@
#print_back_div * {
visibility: visible;
}
-}
\ No newline at end of file
+}
diff --git a/cardie/static/main/footer.css b/cardie/static/main/footer.css
index a6df232..bbd2509 100644
--- a/cardie/static/main/footer.css
+++ b/cardie/static/main/footer.css
@@ -1,4 +1,3 @@
-
@media (min-width: 1000px) {
/* Large screens */
@@ -6,7 +5,7 @@
position: fixed;
bottom: 20px;
left: 20px;
-
+
display: flex;
flex-direction: column;
}
@@ -18,17 +17,17 @@
border: var(--default-glass-border);
backdrop-filter: var(--default-glass-blur);
border-radius: 50px;
-
+
display: flex;
align-items: center;
justify-content: center;
}
-
+
.footer_main_button_image {
width: clamp(4vh, 40px, 4vw);
height: auto;
}
-
+
.footer_main_button_icon {
color: white;
font-size: clamp(3vh, 30px, 3vw);
@@ -37,21 +36,21 @@
.footer_main_contents {
display: flex;
flex-direction: row;
-
+
background-color: var(--default-glass-background);
border: var(--default-glass-border);
backdrop-filter: var(--default-glass-blur);
border-radius: 10px;
-
+
padding: clamp(0.5vh, 5px, 0.5vw);
margin-left: clamp(1vh, 10px, 1vw);
-
+
height: fit-content;
}
-
+
.footer_main_contents_link {
font-family: var(--default-font-family);
- font-size: clamp(1.4vh, 14px, 1.4vwS);
+ font-size: clamp(1.4vh, 14px, 1.4vws);
color: white;
opacity: 0.7;
text-decoration: none;
@@ -66,7 +65,7 @@
align-items: center;
margin-bottom: clamp(1vh, 10px, 1vw);
}
-
+
.footer_warning_button {
width: clamp(6vh, 60px, 6vw);
height: clamp(6vh, 60px, 6vw);
@@ -74,46 +73,45 @@
border: var(--default-glass-border);
backdrop-filter: var(--default-glass-blur);
border-radius: clamp(5vh, 50px, 5vw);
-
+
display: flex;
align-items: center;
justify-content: center;
}
-
+
.footer_warning_contents {
display: flex;
flex-direction: column;
-
+
background-color: rgba(178, 145, 60, 0.4);
border: var(--default-glass-border);
backdrop-filter: var(--default-glass-blur);
border-radius: 10px;
-
+
padding: clamp(1vh, 10px, 1vw);
margin-left: clamp(1vh, 10px, 1vw);
-
+
height: fit-content;
}
-
+
.footer_warning_contents_title {
color: white;
font-family: var(--default-font-family);
opacity: 0.7;
font-weight: 600;
font-size: clamp(1.4vh, 14px, 1.4vw);
-
+
margin: 0px;
}
-
+
.footer_warning_contents_text {
color: white;
font-family: var(--default-font-family);
opacity: 0.7;
font-size: clamp(1.2vh, 12pv, 1.2vw);
-
+
margin: 0px;
}
-
}
@media (max-width: 1000px) {
@@ -123,7 +121,7 @@
position: fixed;
bottom: 10px;
left: 10px;
-
+
display: flex;
flex-direction: column;
}
@@ -135,17 +133,17 @@
border: var(--default-glass-border);
backdrop-filter: var(--default-glass-blur);
border-radius: 50px;
-
+
display: flex;
align-items: center;
justify-content: center;
}
-
+
.footer_main_button_image {
width: clamp(4vh, 40px, 4vw);
height: auto;
}
-
+
.footer_main_button_icon {
color: white;
font-size: clamp(3vh, 30px, 3vw);
@@ -154,21 +152,21 @@
.footer_main_contents {
display: flex;
flex-direction: row;
-
+
background-color: var(--default-glass-background);
border: var(--default-glass-border);
backdrop-filter: var(--default-glass-blur);
border-radius: 10px;
-
+
padding: clamp(0.2vh, 2px, 0.2vw);
margin-left: clamp(0.5vh, 5px, 0.5vw);
-
+
height: fit-content;
}
-
+
.footer_main_contents_link {
font-family: var(--default-font-family);
- font-size: clamp(1.2vh, 12px, 1.2vwS);
+ font-size: clamp(1.2vh, 12px, 1.2vws);
color: white;
opacity: 0.7;
text-decoration: none;
@@ -183,7 +181,7 @@
align-items: center;
margin-bottom: clamp(1vh, 10px, 1vw);
}
-
+
.footer_warning_button {
width: clamp(5vh, 50px, 5vw);
height: clamp(5vh, 50px, 5vw);
@@ -191,46 +189,45 @@
border: var(--default-glass-border);
backdrop-filter: var(--default-glass-blur);
border-radius: 50px;
-
+
display: flex;
align-items: center;
justify-content: center;
}
-
+
.footer_warning_contents {
display: flex;
flex-direction: column;
-
+
background-color: rgba(178, 145, 60, 0.4);
border: var(--default-glass-border);
backdrop-filter: var(--default-glass-blur);
border-radius: 10px;
-
+
padding: clamp(0.2vh, 2px, 0.2vw);
margin-left: clamp(0.5vh, 5px, 0.5vw);
-
+
height: fit-content;
}
-
+
.footer_warning_contents_title {
color: white;
font-family: var(--default-font-family);
opacity: 0.7;
font-weight: 600;
font-size: 14px;
-
+
margin: 0px;
}
-
+
.footer_warning_contents_text {
color: white;
font-family: var(--default-font-family);
opacity: 0.7;
font-size: 12px;
-
+
margin: 0px;
}
-
}
.footer_main {
@@ -257,4 +254,4 @@
.footer_warning_contents_text > a {
color: white;
font-weight: 500;
-}
\ No newline at end of file
+}
diff --git a/cardie/static/main/home.css b/cardie/static/main/home.css
index 47fe569..bda112f 100644
--- a/cardie/static/main/home.css
+++ b/cardie/static/main/home.css
@@ -9,28 +9,28 @@ html {
display: flex;
flex-direction: row;
justify-content: space-between;
-
+
margin-left: clamp(5vh, 50px, 5vw);
margin-right: clamp(5vh, 50px, 5vw);
margin-top: clamp(5vh, 50px, 5vw);
}
-
+
#home-top-text {
margin-left: clamp(6vh, 60px, 6vw);
}
-
+
#home-navigation {
margin-top: clamp(1vh, 10px, 1vw);
margin-left: clamp(12vh, 120px, 12vw);
margin-bottom: clamp(2vh, 20px, 2vw);
}
-
+
#home-wallet {
margin-left: clamp(12vh, 120px, 12vw);
display: flex;
flex-direction: column;
}
-
+
#home-cards {
margin-left: clamp(12vh, 120px, 12vw);
display: flex;
@@ -52,28 +52,28 @@ html {
display: flex;
flex-direction: row;
justify-content: space-between;
-
+
margin-left: clamp(1vh, 10px, 1vw);
margin-right: clamp(1vh, 10px, 1vw);
margin-top: clamp(1vh, 10px, 1vw);
}
-
+
#home-top-text {
margin-left: clamp(2vh, 20px, 2vw);
}
-
+
#home-navigation {
margin-top: clamp(1vh, 10px, 1vw);
margin-left: clamp(2vh, 20px, 2vw);
margin-bottom: clamp(1vh, 10px, 1vw);
}
-
+
#home-wallet {
margin-left: clamp(2vh, 20px, 2vw);
display: flex;
flex-direction: column;
}
-
+
#home-cards {
margin-left: clamp(2vh, 20px, 2vw);
display: flex;
@@ -173,8 +173,7 @@ html {
border: var(--default-glass-border);
backdrop-filter: var(--default-glass-blur);
border-radius: 15px;
- transition: opacity 0.3s ease,
- scale 0.3s ease;
+ transition: opacity 0.3s ease, scale 0.3s ease;
z-index: 3;
/* Starting properties for animation */
@@ -204,4 +203,4 @@ html {
#dialog_home_delete {
display: flex;
flex-direction: column;
-}
\ No newline at end of file
+}
diff --git a/cardie/static/main/index.css b/cardie/static/main/index.css
index b289922..c010eb8 100644
--- a/cardie/static/main/index.css
+++ b/cardie/static/main/index.css
@@ -2,7 +2,8 @@ html {
background: rgb(37, 40, 49);
}
-body, html {
+body,
+html {
margin: 0px;
scroll-snap-points-y: repeat(100vh);
scroll-snap-type: y mandatory;
@@ -54,8 +55,13 @@ body, html {
z-index: -10;
- background: rgb(61,132,148);
- background: linear-gradient(120deg, rgba(61,132,148,1) 9%, rgba(34,73,139,1) 47%, rgba(37,210,108,1) 91%);
+ background: rgb(61, 132, 148);
+ background: linear-gradient(
+ 120deg,
+ rgba(61, 132, 148, 1) 9%,
+ rgba(34, 73, 139, 1) 47%,
+ rgba(37, 210, 108, 1) 91%
+ );
}
@media (min-width: 1000px) {
@@ -65,29 +71,29 @@ body, html {
margin-top: clamp(1vh, 10px, 1vw);
position: absolute;
top: 0px;
-
+
display: flex;
flex-direction: row;
-
+
justify-content: space-between;
align-items: center;
z-index: 5;
-
+
width: 100%;
}
-
+
#index_top_image {
width: clamp(6vh, 60px, 6vw);
margin-left: clamp(1vh, 10px, 1vw);
height: auto;
}
-
+
#index_top_links {
display: flex;
flex-direction: row;
align-items: center;
}
-
+
#index_top_account {
display: flex;
flex-direction: row;
@@ -110,14 +116,14 @@ body, html {
flex-direction: column-reverse;
z-index: 5;
-
+
width: 100%;
}
-
+
#index_top_image {
display: none;
}
-
+
#index_top_links {
display: flex;
flex-direction: column;
@@ -125,7 +131,7 @@ body, html {
margin-left: clamp(3vh, 30px, 3vw);
margin-top: clamp(1vh, 10px, 1vw);
}
-
+
#index_top_account {
display: flex;
flex-direction: column;
@@ -138,8 +144,6 @@ body, html {
}
}
-
-
@media (min-width: 1000px) {
/* Large screens */
@@ -152,12 +156,12 @@ body, html {
padding-left: clamp(4vh, 40px, 4vw);
scroll-snap-align: center;
}
-
+
#home_card_image {
width: 60vw;
height: auto;
}
-
+
#home_editor {
height: 100vh;
display: flex;
@@ -167,12 +171,11 @@ body, html {
padding-left: clamp(4vh, 40px, 4vw);
scroll-snap-align: center;
}
-
+
#home_editor_image {
width: 60vw;
height: auto;
}
-
}
@media (max-width: 1000px) {
@@ -186,12 +189,12 @@ body, html {
flex-direction: column;
scroll-snap-align: center;
}
-
+
#home_card_image {
width: 90vw;
height: auto;
}
-
+
#home_editor {
height: 100vh;
display: flex;
@@ -200,14 +203,14 @@ body, html {
flex-direction: column;
scroll-snap-align: center;
}
-
+
#home_editor_image {
width: 90vw;
height: auto;
}
- #home_card_text, #home_editor_text {
+ #home_card_text,
+ #home_editor_text {
margin-left: clamp(2vh, 20px, 2vw);
}
-
-}
\ No newline at end of file
+}
diff --git a/cardie/static/main/notifications.css b/cardie/static/main/notifications.css
index 5a6ece3..fa30ddc 100644
--- a/cardie/static/main/notifications.css
+++ b/cardie/static/main/notifications.css
@@ -13,12 +13,11 @@
.notifications {
display: flex;
flex-direction: column;
-
+
position: fixed;
bottom: clamp(1vh, 10px, 1vw);
right: clamp(1vh, 10px, 1vw);
}
-
}
@media (max-width: 1000px) {
@@ -27,7 +26,7 @@
.notifications {
display: flex;
flex-direction: column;
-
+
position: fixed;
top: clamp(1vh, 10px, 1vw);
left: 50%;
@@ -85,4 +84,4 @@
color: white;
font-size: clamp(3vh, 30px, 3vw);
margin-right: 10px;
-}
\ No newline at end of file
+}
diff --git a/cardie/static/main/privacy.css b/cardie/static/main/privacy.css
index 07002e8..0dfff39 100644
--- a/cardie/static/main/privacy.css
+++ b/cardie/static/main/privacy.css
@@ -1,5 +1,3 @@
-
-
@media (min-width: 1000px) {
/* Large screens */
@@ -8,21 +6,21 @@
margin-top: clamp(4vh, 40px, 4vw);
width: fit-content;
}
-
+
#privacy_lastupdated {
margin-left: clamp(2vh, 20px, 2vw);
}
-
+
#privacy_content {
margin-left: clamp(2vh, 20px, 2vw);
margin-top: clamp(2vh, 20px, 2vw);
}
-
+
.privacy_content_section {
margin-left: clamp(2vh, 20px, 2vw);
margin-top: clamp(2vh, 20px, 2vw);
}
-
+
.privacy_header {
margin-top: clamp(2vh, 20px, 2vw);
}
@@ -36,22 +34,22 @@
margin-top: clamp(2vh, 20px, 2vw);
width: fit-content;
}
-
+
#privacy_lastupdated {
margin-left: clamp(1vh, 10px, 1vw);
}
-
+
#privacy_content {
margin-left: clamp(1vh, 10px, 1vw);
margin-top: clamp(2vh, 20px, 2vw);
}
-
+
.privacy_content_section {
margin-left: clamp(1vh, 10px, 1vw);
margin-top: clamp(2vh, 20px, 2vw);
}
-
+
.privacy_header {
margin-top: clamp(2vh, 20px, 2vw);
}
-}
\ No newline at end of file
+}
diff --git a/cardie/static/main/scripts/authentication/authentication.js b/cardie/static/main/scripts/authentication/authentication.js
index f6656a4..fbdea47 100644
--- a/cardie/static/main/scripts/authentication/authentication.js
+++ b/cardie/static/main/scripts/authentication/authentication.js
@@ -1,23 +1,21 @@
try {
var temp_uuid = new URL(window.location.href).searchParams.get("temp_uuid");
-
} catch {
var temp_uuid = false;
}
try {
var ref = new URL(window.location.href).searchParams.get("ref");
-
} catch {
var ref = false;
}
function show_warning(warning) {
- log("WARNING", warning)
+ log("WARNING", warning);
document.querySelector("#authentication-error > p").innerText = warning;
document.querySelector("#authentication-error").style.display = "flex";
- setTimeout(function() {
+ setTimeout(() => {
document.querySelector("#authentication-error").classList.add("show");
}, 100);
}
@@ -31,29 +29,32 @@ async function sign_in() {
var response = await fetch(server_ip + "/auth/signin", {
method: "GET",
headers: {
- "X-CSRFToken": document.querySelector('input[name="csrfmiddlewaretoken"]').value,
- "Internal": true,
- "Username": username,
- "Password": password,
- "TempUUID": temp_uuid
- }
+ "X-CSRFToken": document.querySelector(
+ 'input[name="csrfmiddlewaretoken"]',
+ ).value,
+ Internal: true,
+ Username: username,
+ Password: password,
+ TempUUID: temp_uuid,
+ },
});
-
} else {
var response = await fetch(server_ip + "/auth/signin", {
method: "GET",
headers: {
- "X-CSRFToken": document.querySelector('input[name="csrfmiddlewaretoken"]').value,
- "Internal": true,
- "Username": username,
- "Password": password
- }
+ "X-CSRFToken": document.querySelector(
+ 'input[name="csrfmiddlewaretoken"]',
+ ).value,
+ Internal: true,
+ Username: username,
+ Password: password,
+ },
});
}
- log("DEBUG", temp_uuid)
+ log("DEBUG", temp_uuid);
- response.text().then(function (text) {
+ response.text().then((text) => {
if (text == "success") {
log("INFO", "Success!");
@@ -62,26 +63,20 @@ async function sign_in() {
} else {
window.location.href = `${server_ip}/home`;
}
-
-
} else if (text == "error_missing_headers_and_session") {
show_warning("Missing headers and no session data!");
-
} else if (text == "error_password_wrong") {
show_warning("Your password is incorrect!");
-
} else if (text == "error_no_accounts") {
show_warning("No accounts match that username!");
-
} else if (text == "error_multiple_accounts_exist") {
- show_warning("Multiple accounts exist with that username... that's really not supposed to happen...");
-
+ show_warning(
+ "Multiple accounts exist with that username... that's really not supposed to happen...",
+ );
} else if (text == "error_sign_in_disabled") {
show_warning("Signing in is disabled on this server");
-
} else if (text.includes("card_added_to_account")) {
window.location.href = `${server_ip}/editor?uuid=${text.replace("card_added_to_account ", "")}`;
-
} else {
show_warning("There was a problem signing you in!");
}
@@ -98,28 +93,32 @@ async function create_account() {
var response = await fetch(server_ip + "/auth/createaccount", {
method: "GET",
headers: {
- "X-CSRFToken": document.querySelector('input[name="csrfmiddlewaretoken"]').value,
- "Internal": true,
- "Username": username,
- "Password": password,
- "Email": email,
- "TempUUID": temp_uuid
- }
+ "X-CSRFToken": document.querySelector(
+ 'input[name="csrfmiddlewaretoken"]',
+ ).value,
+ Internal: true,
+ Username: username,
+ Password: password,
+ Email: email,
+ TempUUID: temp_uuid,
+ },
});
} else {
var response = await fetch(server_ip + "/auth/createaccount", {
method: "GET",
headers: {
- "X-CSRFToken": document.querySelector('input[name="csrfmiddlewaretoken"]').value,
- "Internal": true,
- "Username": username,
- "Password": password,
- "Email": email
- }
+ "X-CSRFToken": document.querySelector(
+ 'input[name="csrfmiddlewaretoken"]',
+ ).value,
+ Internal: true,
+ Username: username,
+ Password: password,
+ Email: email,
+ },
});
}
- response.text().then(function (text) {
+ response.text().then((text) => {
if (text == "success") {
log("INFO", "Success!");
@@ -128,40 +127,30 @@ async function create_account() {
} else {
window.location.href = `${server_ip}/home`;
}
-
} else if (text == "no_username") {
show_warning("Your account needs an username!");
-
} else if (text == "no_password") {
show_warning("Your account needs an password!");
-
} else if (text == "no_email") {
show_warning("Your account needs an email!");
-
} else if (text == "error_account_already_exists") {
show_warning("An account with that username already exists!");
-
} else if (text == "error_missing_headers") {
show_warning("There is missing header data!");
-
} else if (text == "error_missing_headers_and_session") {
show_warning("Missing headers and no session data!");
-
} else if (text == "error_password_wrong") {
show_warning("Your password is incorrect!");
-
} else if (text == "error_no_accounts") {
show_warning("No accounts match that username!");
-
} else if (text == "error_multiple_accounts_exist") {
- show_warning("Multiple accounts exist with that username... that's really not supposed to happen...");
-
+ show_warning(
+ "Multiple accounts exist with that username... that's really not supposed to happen...",
+ );
} else if (text == "error_create_account_disabled") {
show_warning("Creating accounts is disabled on this server");
-
} else if (text.includes("card_added_to_account")) {
window.location.href = `${server_ip}/editor?uuid=${text.replace("card_added_to_account ", "")}`;
-
} else {
show_warning("There was a problem creating your account!");
}
@@ -172,38 +161,53 @@ async function create_account() {
function check_sign_in() {
document.querySelector("#signin-signin").disabled = !(
- document.querySelector("#signin-username").value != "" &&
+ document.querySelector("#signin-username").value != "" &&
document.querySelector("#signin-password").value != ""
);
}
function check_create_account() {
document.querySelector("#createaccount-createaccount").disabled = !(
- document.querySelector("#createaccount-username").value != "" &&
- document.querySelector("#createaccount-password").value != "" &&
+ document.querySelector("#createaccount-username").value != "" &&
+ document.querySelector("#createaccount-password").value != "" &&
document.querySelector("#createaccount-email").value != ""
);
}
document.querySelector("#signin-signin").addEventListener("click", sign_in);
-document.querySelector("#createaccount-createaccount").addEventListener("click", create_account);
-
-document.querySelector("#signin-username").addEventListener("input", check_sign_in);
-document.querySelector("#signin-password").addEventListener("input", check_sign_in);
-document.querySelector("#createaccount-username").addEventListener("input", check_create_account);
-document.querySelector("#createaccount-password").addEventListener("input", check_create_account);
-document.querySelector("#createaccount-email").addEventListener("input", check_create_account);
+document
+ .querySelector("#createaccount-createaccount")
+ .addEventListener("click", create_account);
+
+document
+ .querySelector("#signin-username")
+ .addEventListener("input", check_sign_in);
+document
+ .querySelector("#signin-password")
+ .addEventListener("input", check_sign_in);
+document
+ .querySelector("#createaccount-username")
+ .addEventListener("input", check_create_account);
+document
+ .querySelector("#createaccount-password")
+ .addEventListener("input", check_create_account);
+document
+ .querySelector("#createaccount-email")
+ .addEventListener("input", check_create_account);
document.querySelector("#signin-signin").disabled = true;
document.querySelector("#createaccount-createaccount").disabled = true;
-document.addEventListener("keyup", (event) => {
- if (event.code === "Enter") {
- if (document.querySelector("#signin-box").style.display != "none") {
- sign_in();
-
- } else {
- create_account();
+document.addEventListener(
+ "keyup",
+ (event) => {
+ if (event.code === "Enter") {
+ if (document.querySelector("#signin-box").style.display != "none") {
+ sign_in();
+ } else {
+ create_account();
+ }
}
- }
-}, false);
\ No newline at end of file
+ },
+ false,
+);
diff --git a/cardie/static/main/scripts/card_view/card_view.js b/cardie/static/main/scripts/card_view/card_view.js
index d2819aa..e6310c5 100644
--- a/cardie/static/main/scripts/card_view/card_view.js
+++ b/cardie/static/main/scripts/card_view/card_view.js
@@ -1,37 +1,44 @@
var cardview_json;
async function render_card_view() {
- let uuid_param = new URL(window.location.href).searchParams.get("uuid");
+ const uuid_param = new URL(window.location.href).searchParams.get("uuid");
if (uuid_param == null) {
log("WARNING", "No UUID");
- // TODO: Show that the card cannot be found
-
+ // TODO: Show that the card cannot be found
} else {
const response = await fetch(server_ip + "/getcard", {
method: "POST",
headers: {
- "UUID": uuid_param,
- }
+ UUID: uuid_param,
+ },
});
- response.text().then(function (text) {
+ response.text().then((text) => {
if (text == "Request is not a POST request") {
log("WARNING", text);
- create_notification("There was an issue fetching the card", text, "warning");
-
+ create_notification(
+ "There was an issue fetching the card",
+ text,
+ "warning",
+ );
} else if (text == "Card does not exist!") {
// TODO: Show that the card cannot be found
log("WARNING", "Card does not exist");
- create_notification("That card could not be found", text, "warning");
-
+ create_notification(
+ "That card could not be found",
+ text,
+ "warning",
+ );
} else {
log("INFO", "This card exists on the server!");
card_render_from_json(".card_card", text);
cardview_json = text;
- document.querySelector("#cardview_text_cardname").innerText = JSON.parse(text)["name"];
- document.querySelector("#cardview_text_username").innerText = `Created by ${JSON.parse(text)["author"]}`;
+ document.querySelector("#cardview_text_cardname").innerText =
+ JSON.parse(text)["name"];
+ document.querySelector("#cardview_text_username").innerText =
+ `Created by ${JSON.parse(text)["author"]}`;
show_cardview_status();
}
});
@@ -40,85 +47,118 @@ async function render_card_view() {
function show_cardview_status() {
try {
- var from_wallet_param = new URL(window.location.href).searchParams.get("from_wallet");
+ var from_wallet_param = new URL(window.location.href).searchParams.get(
+ "from_wallet",
+ );
} catch {
var from_wallet_param = false;
}
if (from_wallet_param) {
- document.querySelector("#cardview_bottom_createaccount").style.display = "none";
+ document.querySelector("#cardview_bottom_createaccount").style.display =
+ "none";
document.querySelector("#cardview_bottom_save").style.display = "none";
document.querySelector("#cardview_bottom_owned").style.display = "none";
-
} else {
if (username == JSON.parse(cardview_json)["author"]) {
- document.querySelector("#cardview_bottom_createaccount").style.display = "none";
- document.querySelector("#cardview_bottom_save").style.display = "none";
- document.querySelector("#cardview_bottom_owned").style.display = "block";
-
+ document.querySelector(
+ "#cardview_bottom_createaccount",
+ ).style.display = "none";
+ document.querySelector("#cardview_bottom_save").style.display =
+ "none";
+ document.querySelector("#cardview_bottom_owned").style.display =
+ "block";
} else if (username) {
- document.querySelector("#cardview_bottom_createaccount").style.display = "none";
- document.querySelector("#cardview_bottom_save").style.display = "block";
- document.querySelector("#cardview_bottom_owned").style.display = "none";
-
+ document.querySelector(
+ "#cardview_bottom_createaccount",
+ ).style.display = "none";
+ document.querySelector("#cardview_bottom_save").style.display =
+ "block";
+ document.querySelector("#cardview_bottom_owned").style.display =
+ "none";
} else {
- document.querySelector("#cardview_bottom_createaccount").style.display = "block";
- document.querySelector("#cardview_bottom_save").style.display = "none";
- document.querySelector("#cardview_bottom_owned").style.display = "none";
+ document.querySelector(
+ "#cardview_bottom_createaccount",
+ ).style.display = "block";
+ document.querySelector("#cardview_bottom_save").style.display =
+ "none";
+ document.querySelector("#cardview_bottom_owned").style.display =
+ "none";
}
}
-
-
}
async function save_to_wallet() {
- let uuid_param = new URL(window.location.href).searchParams.get("uuid");
+ const uuid_param = new URL(window.location.href).searchParams.get("uuid");
if (uuid_param == null) {
log("WARNING", "No UUID");
- // TODO: Show that the card cannot be found
-
+ // TODO: Show that the card cannot be found
} else {
const response = await fetch(server_ip + "/savetowallet", {
method: "POST",
headers: {
- "UUID": uuid_param,
- }
+ UUID: uuid_param,
+ },
});
- response.text().then(function (text) {
+ response.text().then((text) => {
if (text == "Request is not a POST request") {
log("WARNING", text);
- create_notification("There was an issue fetching the card", text, "warning");
-
+ create_notification(
+ "There was an issue fetching the card",
+ text,
+ "warning",
+ );
} else if (text == "Missing headers") {
log("WARNING", text);
- create_notification("There was a problem saving your card", text, "warning");
-
+ create_notification(
+ "There was a problem saving your card",
+ text,
+ "warning",
+ );
} else if (text == "Not signed in") {
log("WARNING", text);
- create_notification("There was a problem saving your card", text, "warning");
+ create_notification(
+ "There was a problem saving your card",
+ text,
+ "warning",
+ );
window.location.href = `${server_ip}/authentication`;
-
} else if (text == "Card not found") {
log("WARNING", text);
- create_notification("There was a problem saving your card", text, "warning");
-
+ create_notification(
+ "There was a problem saving your card",
+ text,
+ "warning",
+ );
} else if (text == "Success") {
log("INFO", "Card saved to wallet");
- create_notification("Card saved", "This card has been saved to your wallet", "check-circle");
-
+ create_notification(
+ "Card saved",
+ "This card has been saved to your wallet",
+ "check-circle",
+ );
} else {
- log("WARNING", "There was an unknown error saving that card to your wallet");
- create_notification("There was a problem saving your card", "There was an unknown error", "warning");
+ log(
+ "WARNING",
+ "There was an unknown error saving that card to your wallet",
+ );
+ create_notification(
+ "There was a problem saving your card",
+ "There was an unknown error",
+ "warning",
+ );
}
});
}
}
-document.querySelector("#cardview_signin").addEventListener("click", (event) => {
- window.location.href = `${server_ip}/authentication?sign_in=true&ref=${window.location.href}`
-});
+document
+ .querySelector("#cardview_signin")
+ .addEventListener("click", (event) => {
+ window.location.href = `${server_ip}/authentication?sign_in=true&ref=${window.location.href}`;
+ });
document.querySelector("#cardview_save").addEventListener("click", (event) => {
save_to_wallet();
diff --git a/cardie/static/main/scripts/editor/editor.js b/cardie/static/main/scripts/editor/editor.js
index bfccb71..dbc29bc 100644
--- a/cardie/static/main/scripts/editor/editor.js
+++ b/cardie/static/main/scripts/editor/editor.js
@@ -13,12 +13,12 @@ try {
async function start_editor() {
if (demo_param == false) {
- let uuid_param = new URL(window.location.href).searchParams.get("uuid");
+ const uuid_param = new URL(window.location.href).searchParams.get("uuid");
document.querySelector("#editor_main_preview_demo").style.display = "none";
if (uuid_param == null) {
- let new_uuid = crypto.randomUUID();
+ const new_uuid = crypto.randomUUID();
const response = await fetch(server_ip + "/createcard", {
method: "POST",
@@ -27,7 +27,7 @@ async function start_editor() {
}
});
- response.text().then(function (text) {
+ response.text().then((text) => {
if (text == "Done") {
var refresh = window.location.protocol + "//" + window.location.host + window.location.pathname + '?uuid=' + new_uuid;
window.history.pushState({ path: refresh }, '', refresh);
@@ -50,7 +50,7 @@ async function start_editor() {
}
});
- response.text().then(function (text) {
+ response.text().then((text) => {
if (text == "Request is not a POST request") {
status_error();
log("WARNING", "There was a problem");
@@ -82,7 +82,7 @@ async function start_editor() {
async function save_card(card_json) {
status_saving();
- let uuid_param = new URL(window.location.href).searchParams.get("uuid");
+ const uuid_param = new URL(window.location.href).searchParams.get("uuid");
const response = await fetch(server_ip + "/savecard", {
method: "POST",
@@ -92,7 +92,7 @@ async function save_card(card_json) {
}
});
- response.text().then(function (text) {
+ response.text().then((text) => {
if (text == "Done") {
log("INFO", "Data has been saved")
status_saved();
@@ -136,7 +136,7 @@ async function editor_demo_auth(sign_in) {
}
});
- response.text().then(function (text) {
+ response.text().then((text) => {
if (text == "Missing headers") {
log("WARNING", text);
create_notification("There was an error creating the temporary card", "Missing headers in the request", "warning");
@@ -161,8 +161,8 @@ async function editor_demo_auth(sign_in) {
}
function setup_qrcode() {
- let uuid_param = new URL(window.location.href).searchParams.get("uuid");
- let url = `${server_ip}/card?uuid=${uuid_param}&`
+ const uuid_param = new URL(window.location.href).searchParams.get("uuid");
+ const url = `${server_ip}/card?uuid=${uuid_param}&`
qrcode = new QRCode("qrcode", {
url: url,
@@ -207,7 +207,7 @@ document.querySelector("#editor_header_title_home").addEventListener("click", (e
});
document.querySelector("#editor_share_copylink").addEventListener("click", async (event) => {
- let uuid_param = new URL(window.location.href).searchParams.get("uuid");
+ const uuid_param = new URL(window.location.href).searchParams.get("uuid");
await navigator.clipboard.writeText(`${server_ip}/card?uuid=${uuid_param}&`).then(() => {
event.target.innerHTML = ` Copied!`;
@@ -219,8 +219,8 @@ document.querySelector("#editor_share_copylink").addEventListener("click", async
});
document.querySelector("#editor_share_copyqr").addEventListener("click", async (event) => {
- let uuid_param = new URL(window.location.href).searchParams.get("uuid");
- let url = `${server_ip}/card?uuid=${uuid_param}&`
+ const uuid_param = new URL(window.location.href).searchParams.get("uuid");
+ const url = `${server_ip}/card?uuid=${uuid_param}&`
qrcode.makeCode(url);
@@ -236,8 +236,8 @@ document.querySelector("#editor_share_copyqr").addEventListener("click", async (
});
document.querySelector("#editor_share_downloadqr").addEventListener("click", (event) => {
- let uuid_param = new URL(window.location.href).searchParams.get("uuid");
- let url = `${server_ip}/card?uuid=${uuid_param}&`
+ const uuid_param = new URL(window.location.href).searchParams.get("uuid");
+ const url = `${server_ip}/card?uuid=${uuid_param}&`
qrcode.makeCode(url);
diff --git a/cardie/static/main/scripts/editor/editor_information.js b/cardie/static/main/scripts/editor/editor_information.js
index 48ada73..b6432a5 100644
--- a/cardie/static/main/scripts/editor/editor_information.js
+++ b/cardie/static/main/scripts/editor/editor_information.js
@@ -5,64 +5,78 @@ var currently_editing_icon;
var items_list;
function open_iconselector_foritem(event) {
- let item = event.target.closest(".link_item, .text_item");
+ const item = event.target.closest(".link_item, .text_item");
currently_editing_icon = item;
show_iconselector();
}
function editor_create_json() {
- let card_json = {
- "uuid": "unknown",
- "name": "",
- "author": "unknown",
- "layout": "left",
- "details": {
- "primary": "",
- "secondary": ""
+ const card_json = {
+ uuid: "unknown",
+ name: "",
+ author: "unknown",
+ layout: "left",
+ details: {
+ primary: "",
+ secondary: "",
},
- "information": {
- "items": []
+ information: {
+ items: [],
},
- "colors": {
- "background": "#ffffff",
- "accent": "#000000",
- "text": "#000000"
+ colors: {
+ background: "#ffffff",
+ accent: "#000000",
+ text: "#000000",
},
- "font_style": "Simple",
- "version": 4
- }
+ font_style: "Simple",
+ version: 4,
+ };
- card_json["name"] = document.querySelector("#editor_header_name_text_cardname").innerText;
+ card_json["name"] = document.querySelector(
+ "#editor_header_name_text_cardname",
+ ).innerText;
card_json["author"] = username;
card_json["layout"] = layout;
- card_json["details"]["primary"] = document.querySelector("#editor_main_settings_details_primary").value;
- card_json["details"]["secondary"] = document.querySelector("#editor_main_settings_details_secondary").value;
-
- card_json["colors"]["background"] = document.querySelector("#editor_main_settings_colors_background").value;
- card_json["colors"]["accent"] = document.querySelector("#editor_main_settings_colors_accent").value;
- card_json["colors"]["text"] = document.querySelector("#editor_main_settings_colors_text").value;
+ card_json["details"]["primary"] = document.querySelector(
+ "#editor_main_settings_details_primary",
+ ).value;
+ card_json["details"]["secondary"] = document.querySelector(
+ "#editor_main_settings_details_secondary",
+ ).value;
+
+ card_json["colors"]["background"] = document.querySelector(
+ "#editor_main_settings_colors_background",
+ ).value;
+ card_json["colors"]["accent"] = document.querySelector(
+ "#editor_main_settings_colors_accent",
+ ).value;
+ card_json["colors"]["text"] = document.querySelector(
+ "#editor_main_settings_colors_text",
+ ).value;
card_json["font_style"] = font_style;
for (const item in items_list) {
- let item_uuid = items_list[item].id;
- let item_icon = items_list[item].icon;
- let item_text = items_list[item].text;
- let item_url = items_list[item].url;
- let item_url_enabled = items_list[item].url_enabled;
- let item_position = items_list[item].position;
-
- let item_json = {
- "uuid": item_uuid,
- "icon": item_icon,
- "text": item_text,
- "url": item_url,
- "url_enabled": item_url_enabled,
- "position": item_position
- }
+ const item_uuid = items_list[item].id;
+ const item_icon = items_list[item].icon;
+ const item_text = items_list[item].text;
+ const item_url = items_list[item].url;
+ const item_url_enabled = items_list[item].url_enabled;
+ const item_position = items_list[item].position;
+
+ const item_json = {
+ uuid: item_uuid,
+ icon: item_icon,
+ text: item_text,
+ url: item_url,
+ url_enabled: item_url_enabled,
+ position: item_position,
+ };
card_json["information"]["items"].push(item_json);
- card_json["information"]["items"].sort((a, b) => a.position - b.position)
+ card_json["information"]["items"].sort(
+ (a, b) => a.position - b.position,
+ );
}
return card_json;
@@ -73,53 +87,65 @@ function editor_load_from_json(json) {
json = JSON.parse(json);
- document.querySelector("#editor_header_name_text_cardname").innerText = json["name"];
- document.querySelector("#editor_main_settings_details_primary").value = json["details"]["primary"];
- document.querySelector("#editor_main_settings_details_secondary").value = json["details"]["secondary"];
-
- document.querySelector("#editor_main_settings_colors_background").value = json["colors"]["background"];
- document.querySelector("#editor_main_settings_colors_accent").value = json["colors"]["accent"];
- document.querySelector("#editor_main_settings_colors_text").value = json["colors"]["text"];
+ document.querySelector("#editor_header_name_text_cardname").innerText =
+ json["name"];
+ document.querySelector("#editor_main_settings_details_primary").value =
+ json["details"]["primary"];
+ document.querySelector("#editor_main_settings_details_secondary").value =
+ json["details"]["secondary"];
+
+ document.querySelector("#editor_main_settings_colors_background").value =
+ json["colors"]["background"];
+ document.querySelector("#editor_main_settings_colors_accent").value =
+ json["colors"]["accent"];
+ document.querySelector("#editor_main_settings_colors_text").value =
+ json["colors"]["text"];
font_style = json["font_style"];
card_set_font(".card_card", font_style);
- window.dispatchEvent(new CustomEvent('sendLoadedFontFromJson', {
- detail: { font_style }
- }));
+ window.dispatchEvent(
+ new CustomEvent("sendLoadedFontFromJson", {
+ detail: { font_style },
+ }),
+ );
card_set_layout(".card_card", json["layout"]);
layout = json["layout"];
- json["information"]["items"].sort((a, b) => a.position - b.position)
+ json["information"]["items"].sort((a, b) => a.position - b.position);
for (const item in json["information"]["items"]) {
- let uuid = json["information"]["items"][item]["uuid"];
- let text = json["information"]["items"][item]["text"];
- let icon = json["information"]["items"][item]["icon"];
- let url = json["information"]["items"][item]["url"];
- let url_enabled = json["information"]["items"][item]["url_enabled"];
- let position = json["information"]["items"][item]["position"];
-
- window.dispatchEvent(new CustomEvent('createItem', {
- detail: { uuid, text, icon, url, url_enabled, position }
- }));
+ const uuid = json["information"]["items"][item]["uuid"];
+ const text = json["information"]["items"][item]["text"];
+ const icon = json["information"]["items"][item]["icon"];
+ const url = json["information"]["items"][item]["url"];
+ const url_enabled = json["information"]["items"][item]["url_enabled"];
+ const position = json["information"]["items"][item]["position"];
+
+ window.dispatchEvent(
+ new CustomEvent("createItem", {
+ detail: { uuid, text, icon, url, url_enabled, position },
+ }),
+ );
}
}
function status_saved() {
- document.querySelector("#editor_status").innerHTML = ' Saved';
+ document.querySelector("#editor_status").innerHTML =
+ ' Saved';
}
function status_saving() {
- document.querySelector("#editor_status").innerHTML = ' Saving...';
+ document.querySelector("#editor_status").innerHTML =
+ ' Saving...';
}
function status_error() {
- document.querySelector("#editor_status").innerHTML = ' Error';
-
+ document.querySelector("#editor_status").innerHTML =
+ ' Error';
}
-window.addEventListener('itemData', (event) => {
+window.addEventListener("itemData", (event) => {
const { items } = event.detail;
items_list = items;
-});
\ No newline at end of file
+});
diff --git a/cardie/static/main/scripts/editor/icons.js b/cardie/static/main/scripts/editor/icons.js
index acca6a9..10b8914 100644
--- a/cardie/static/main/scripts/editor/icons.js
+++ b/cardie/static/main/scripts/editor/icons.js
@@ -1,10 +1,10 @@
// TODO: Support {{ server_url }}
-let icons_url = "http://127.0.0.1:8000/iconlist";
+const icons_url = "http://127.0.0.1:8000/iconlist";
const itemsData = []; // Array to store item data
var icon_selected_item;
function create_icon(icon) {
- let div_element = document.createElement("div");
+ const div_element = document.createElement("div");
div_element.classList.add("editor-iconselector-icon");
div_element.setAttribute("icon", icon);
@@ -22,7 +22,9 @@ function create_icon(icon) {
itemsData.push(div_element);
- document.querySelector("#editor-iconselector-icons").appendChild(div_element)
+ document
+ .querySelector("#editor-iconselector-icons")
+ .appendChild(div_element);
}
function render_icons(icons) {
@@ -44,59 +46,81 @@ document.addEventListener("DOMContentLoaded", (event) => {
// Function to render items
const renderItems = (filteredItems) => {
- document.querySelector("#editor-iconselector-icons").innerHTML = '';
- filteredItems.forEach(item => document.querySelector("#editor-iconselector-icons").appendChild(item));
+ document.querySelector("#editor-iconselector-icons").innerHTML = "";
+ filteredItems.forEach((item) =>
+ document.querySelector("#editor-iconselector-icons").appendChild(item),
+ );
};
// Function to sort items alphabetically by the icon attribute
const sortItems = (items) => {
- return items.sort((a, b) => a.getAttribute('icon').localeCompare(b.getAttribute('icon')));
+ return items.sort((a, b) =>
+ a.getAttribute("icon").localeCompare(b.getAttribute("icon")),
+ );
};
// Function to filter items based on search query
const filterItems = (query) => {
const lowerCaseQuery = query.toLowerCase();
- return itemsData.filter(item => item.getAttribute('icon').toLowerCase().includes(lowerCaseQuery));
+ return itemsData.filter((item) =>
+ item.getAttribute("icon").toLowerCase().includes(lowerCaseQuery),
+ );
};
// Event listener for the search box
-document.querySelector("#editor-iconselector-top-search").addEventListener('input', (e) => {
- const query = e.target.value;
- const filteredItems = filterItems(query);
- const sortedItems = sortItems(filteredItems);
- renderItems(sortedItems);
-});
+document
+ .querySelector("#editor-iconselector-top-search")
+ .addEventListener("input", (e) => {
+ const query = e.target.value;
+ const filteredItems = filterItems(query);
+ const sortedItems = sortItems(filteredItems);
+ renderItems(sortedItems);
+ });
function show_iconselector(item) {
icon_selected_item = item;
show_background_blur();
document.querySelector("#editor-iconselector").style.display = "flex";
- document.querySelector("#editor-iconselector").classList.remove("hide-iconselector");
- document.querySelector("#editor-iconselector").classList.add("show-iconselector");
+ document
+ .querySelector("#editor-iconselector")
+ .classList.remove("hide-iconselector");
+ document
+ .querySelector("#editor-iconselector")
+ .classList.add("show-iconselector");
}
function hide_iconselector() {
- document.querySelector("#editor-iconselector").classList.add("hide-iconselector");
-
- setTimeout(function() {
- document.querySelector("#editor-iconselector").classList.remove("show-iconselector");
+ document
+ .querySelector("#editor-iconselector")
+ .classList.add("hide-iconselector");
+
+ setTimeout(() => {
+ document
+ .querySelector("#editor-iconselector")
+ .classList.remove("show-iconselector");
document.querySelector("#editor-iconselector").style.display = "none";
hide_background_blur();
}, 500);
}
function icon_clicked(event) {
- let icon = event.target.closest(".editor-iconselector-icon").getAttribute("icon");
- console.log(icon_selected_item, icon)
+ const icon = event.target
+ .closest(".editor-iconselector-icon")
+ .getAttribute("icon");
+ console.log(icon_selected_item, icon);
- window.dispatchEvent(new CustomEvent('iconSelected', {
- detail: { icon_selected_item, icon }
- }));
+ window.dispatchEvent(
+ new CustomEvent("iconSelected", {
+ detail: { icon_selected_item, icon },
+ }),
+ );
hide_iconselector();
}
-document.querySelector("#editor-iconselector-top-close").addEventListener("click", (event) => {
- hide_iconselector();
-});
\ No newline at end of file
+document
+ .querySelector("#editor-iconselector-top-close")
+ .addEventListener("click", (event) => {
+ hide_iconselector();
+ });
diff --git a/cardie/static/main/scripts/editor/print.js b/cardie/static/main/scripts/editor/print.js
index a4dee2e..16e9659 100644
--- a/cardie/static/main/scripts/editor/print.js
+++ b/cardie/static/main/scripts/editor/print.js
@@ -1,42 +1,57 @@
var print_single = false;
-document.querySelector("#editor_share_print").addEventListener("click", (event) => {
- document.querySelector("#dialog_print").showModal()
-});
-
-document.querySelector("#dialog_print > .ui_dialog_generic_top > .ui_dialog_generic_top_close").addEventListener("click", (event) => {
- document.querySelector("#dialog_print").close();
-});
-
-document.querySelector("#dialog_print_single").addEventListener("click", (event) => {
- print_single = true;
-});
-
-document.querySelector("#dialog_print_double").addEventListener("click", (event) => {
- print_single = false;
-});
-
-document.querySelector("#dialog_print_print").addEventListener("click", (event) => {
- log("INFO", "Opening print dialog");
- window.print();
-});
+document
+ .querySelector("#editor_share_print")
+ .addEventListener("click", (event) => {
+ document.querySelector("#dialog_print").showModal();
+ });
+
+document
+ .querySelector(
+ "#dialog_print > .ui_dialog_generic_top > .ui_dialog_generic_top_close",
+ )
+ .addEventListener("click", (event) => {
+ document.querySelector("#dialog_print").close();
+ });
+
+document
+ .querySelector("#dialog_print_single")
+ .addEventListener("click", (event) => {
+ print_single = true;
+ });
+
+document
+ .querySelector("#dialog_print_double")
+ .addEventListener("click", (event) => {
+ print_single = false;
+ });
+
+document
+ .querySelector("#dialog_print_print")
+ .addEventListener("click", (event) => {
+ log("INFO", "Opening print dialog");
+ window.print();
+ });
window.addEventListener("beforeprint", (event) => {
log("INFO", "Preparing DOM for printing");
if (print_single) {
for (let card = 0; card < 3; card++) {
- let new_card = document.querySelector(".card_card").cloneNode(true);
+ const new_card = document
+ .querySelector(".card_card")
+ .cloneNode(true);
new_card.classList.add("print-card");
- document.querySelector("#editor_main_preview").appendChild(new_card);
+ document
+ .querySelector("#editor_main_preview")
+ .appendChild(new_card);
}
-
} else {
- let front_div = document.createElement("div");
+ const front_div = document.createElement("div");
front_div.classList.add("print-div");
front_div.id = "print_front_div";
- let back_div = document.createElement("div");
+ const back_div = document.createElement("div");
back_div.classList.add("print-div");
back_div.id = "print_back_div";
@@ -44,29 +59,35 @@ window.addEventListener("beforeprint", (event) => {
document.querySelector("#editor_main_preview").appendChild(back_div);
for (let card = 0; card < 8; card++) {
- let card_front = document.querySelector(".card_card > .card_card_front").cloneNode(true);
+ const card_front = document
+ .querySelector(".card_card > .card_card_front")
+ .cloneNode(true);
card_front.classList.add("print-card");
document.querySelector("#print_front_div").appendChild(card_front);
}
for (let card = 0; card < 8; card++) {
- let card_back = document.querySelector(".card_card > .card_card_back").cloneNode(true);
+ const card_back = document
+ .querySelector(".card_card > .card_card_back")
+ .cloneNode(true);
card_back.classList.add("print-card");
document.querySelector("#print_back_div").appendChild(card_back);
}
document.querySelector(".card_card").style.display = "none";
- document.querySelector("#editor_main_preview").classList.add("twosided");
+ document
+ .querySelector("#editor_main_preview")
+ .classList.add("twosided");
}
});
window.addEventListener("afterprint", (event) => {
log("INFO", "Cleaning up DOM after printing");
- document.querySelector("#editor_main_preview").classList.remove("twosided")
+ document.querySelector("#editor_main_preview").classList.remove("twosided");
document.querySelector(".card_card").style.display = "block";
- let cards = document.querySelectorAll(".print-card");
+ const cards = document.querySelectorAll(".print-card");
// TODO: Throws an exception but still works
try {
@@ -76,9 +97,9 @@ window.addEventListener("afterprint", (event) => {
} catch {
null;
}
-
+
try {
- let divs = document.querySelectorAll(".print-div");
+ const divs = document.querySelectorAll(".print-div");
// TODO: Throws an exception but still works
for (const div in divs) {
@@ -87,4 +108,4 @@ window.addEventListener("afterprint", (event) => {
} catch {
null;
}
-});
\ No newline at end of file
+});
diff --git a/cardie/static/main/scripts/editor/rename.js b/cardie/static/main/scripts/editor/rename.js
index 90536c0..a694fe3 100644
--- a/cardie/static/main/scripts/editor/rename.js
+++ b/cardie/static/main/scripts/editor/rename.js
@@ -1,4 +1,4 @@
-function show_rename() {
+function show_rename() {
show_background_blur();
document.querySelector("#editor_rename").style.display = "flex";
@@ -9,8 +9,10 @@ function show_rename() {
function hide_rename() {
document.querySelector("#editor_rename").classList.add("hide-rename");
- setTimeout(function() {
- document.querySelector("#editor_rename").classList.remove("show-rename");
+ setTimeout(() => {
+ document
+ .querySelector("#editor_rename")
+ .classList.remove("show-rename");
document.querySelector("#editor_rename").style.display = "none";
hide_background_blur();
@@ -18,20 +20,27 @@ function hide_rename() {
}
function rename_card() {
- let card_name = document.querySelector("#editor_rename_input").value;
+ const card_name = document.querySelector("#editor_rename_input").value;
- document.querySelector("#editor_header_name_text_cardname").innerText = card_name;
+ document.querySelector("#editor_header_name_text_cardname").innerText =
+ card_name;
hide_rename();
}
-document.querySelector("#editor_rename_top_close").addEventListener("click", (event) => {
- hide_rename();
-});
-
-document.querySelector("#editor_rename_submit").addEventListener("click", (event) => {
- rename_card();
-});
-
-document.querySelector("#editor_header_name_button").addEventListener("click", (event) => {
- show_rename();
-});
\ No newline at end of file
+document
+ .querySelector("#editor_rename_top_close")
+ .addEventListener("click", (event) => {
+ hide_rename();
+ });
+
+document
+ .querySelector("#editor_rename_submit")
+ .addEventListener("click", (event) => {
+ rename_card();
+ });
+
+document
+ .querySelector("#editor_header_name_button")
+ .addEventListener("click", (event) => {
+ show_rename();
+ });
diff --git a/cardie/static/main/scripts/external/qrcode.min.js b/cardie/static/main/scripts/external/qrcode.min.js
index 993e88f..eda7116 100644
--- a/cardie/static/main/scripts/external/qrcode.min.js
+++ b/cardie/static/main/scripts/external/qrcode.min.js
@@ -1 +1,1171 @@
-var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this.parsedData=[];for(var b=[],d=0,e=this.data.length;e>d;d++){var f=this.data.charCodeAt(d);f>65536?(b[0]=240|(1835008&f)>>>18,b[1]=128|(258048&f)>>>12,b[2]=128|(4032&f)>>>6,b[3]=128|63&f):f>2048?(b[0]=224|(61440&f)>>>12,b[1]=128|(4032&f)>>>6,b[2]=128|63&f):f>128?(b[0]=192|(1984&f)>>>6,b[1]=128|63&f):b[0]=f,this.parsedData=this.parsedData.concat(b)}this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function b(a,b){this.typeNumber=a,this.errorCorrectLevel=b,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function i(a,b){if(void 0==a.length)throw new Error(a.length+"/"+b);for(var c=0;c=f;f++){var h=0;switch(b){case d.L:h=l[f][0];break;case d.M:h=l[f][1];break;case d.Q:h=l[f][2];break;case d.H:h=l[f][3]}if(h>=e)break;c++}if(c>l.length)throw new Error("Too long data");return c}function s(a){var b=encodeURI(a).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return b.length+(b.length!=a?3:0)}a.prototype={getLength:function(){return this.parsedData.length},write:function(a){for(var b=0,c=this.parsedData.length;c>b;b++)a.put(this.parsedData[b],8)}},b.prototype={addData:function(b){var c=new a(b);this.dataList.push(c),this.dataCache=null},isDark:function(a,b){if(0>a||this.moduleCount<=a||0>b||this.moduleCount<=b)throw new Error(a+","+b);return this.modules[a][b]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var d=0;d=7&&this.setupTypeNumber(a),null==this.dataCache&&(this.dataCache=b.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,b){for(var c=-1;7>=c;c++)if(!(-1>=a+c||this.moduleCount<=a+c))for(var d=-1;7>=d;d++)-1>=b+d||this.moduleCount<=b+d||(this.modules[a+c][b+d]=c>=0&&6>=c&&(0==d||6==d)||d>=0&&6>=d&&(0==c||6==c)||c>=2&&4>=c&&d>=2&&4>=d?!0:!1)},getBestMaskPattern:function(){for(var a=0,b=0,c=0;8>c;c++){this.makeImpl(!0,c);var d=f.getLostPoint(this);(0==c||a>d)&&(a=d,b=c)}return b},createMovieClip:function(a,b,c){var d=a.createEmptyMovieClip(b,c),e=1;this.make();for(var f=0;f=g;g++)for(var h=-2;2>=h;h++)this.modules[d+g][e+h]=-2==g||2==g||-2==h||2==h||0==g&&0==h?!0:!1}},setupTypeNumber:function(a){for(var b=f.getBCHTypeNumber(this.typeNumber),c=0;18>c;c++){var d=!a&&1==(1&b>>c);this.modules[Math.floor(c/3)][c%3+this.moduleCount-8-3]=d}for(var c=0;18>c;c++){var d=!a&&1==(1&b>>c);this.modules[c%3+this.moduleCount-8-3][Math.floor(c/3)]=d}},setupTypeInfo:function(a,b){for(var c=this.errorCorrectLevel<<3|b,d=f.getBCHTypeInfo(c),e=0;15>e;e++){var g=!a&&1==(1&d>>e);6>e?this.modules[e][8]=g:8>e?this.modules[e+1][8]=g:this.modules[this.moduleCount-15+e][8]=g}for(var e=0;15>e;e++){var g=!a&&1==(1&d>>e);8>e?this.modules[8][this.moduleCount-e-1]=g:9>e?this.modules[8][15-e-1+1]=g:this.modules[8][15-e-1]=g}this.modules[this.moduleCount-8][8]=!a},mapData:function(a,b){for(var c=-1,d=this.moduleCount-1,e=7,g=0,h=this.moduleCount-1;h>0;h-=2)for(6==h&&h--;;){for(var i=0;2>i;i++)if(null==this.modules[d][h-i]){var j=!1;g>>e));var k=f.getMask(b,d,h-i);k&&(j=!j),this.modules[d][h-i]=j,e--,-1==e&&(g++,e=7)}if(d+=c,0>d||this.moduleCount<=d){d-=c,c=-c;break}}}},b.PAD0=236,b.PAD1=17,b.createData=function(a,c,d){for(var e=j.getRSBlocks(a,c),g=new k,h=0;h8*l)throw new Error("code length overflow. ("+g.getLengthInBits()+">"+8*l+")");for(g.getLengthInBits()+4<=8*l&&g.put(0,4);0!=g.getLengthInBits()%8;)g.putBit(!1);for(;;){if(g.getLengthInBits()>=8*l)break;if(g.put(b.PAD0,8),g.getLengthInBits()>=8*l)break;g.put(b.PAD1,8)}return b.createBytes(g,e)},b.createBytes=function(a,b){for(var c=0,d=0,e=0,g=new Array(b.length),h=new Array(b.length),j=0;j=0?p.get(q):0}}for(var r=0,m=0;mm;m++)for(var j=0;jm;m++)for(var j=0;j=0;)b^=f.G15<=0;)b^=f.G18<>>=1;return b},getPatternPosition:function(a){return f.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,b,c){switch(a){case e.PATTERN000:return 0==(b+c)%2;case e.PATTERN001:return 0==b%2;case e.PATTERN010:return 0==c%3;case e.PATTERN011:return 0==(b+c)%3;case e.PATTERN100:return 0==(Math.floor(b/2)+Math.floor(c/3))%2;case e.PATTERN101:return 0==b*c%2+b*c%3;case e.PATTERN110:return 0==(b*c%2+b*c%3)%2;case e.PATTERN111:return 0==(b*c%3+(b+c)%2)%2;default:throw new Error("bad maskPattern:"+a)}},getErrorCorrectPolynomial:function(a){for(var b=new i([1],0),c=0;a>c;c++)b=b.multiply(new i([1,g.gexp(c)],0));return b},getLengthInBits:function(a,b){if(b>=1&&10>b)switch(a){case c.MODE_NUMBER:return 10;case c.MODE_ALPHA_NUM:return 9;case c.MODE_8BIT_BYTE:return 8;case c.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(27>b)switch(a){case c.MODE_NUMBER:return 12;case c.MODE_ALPHA_NUM:return 11;case c.MODE_8BIT_BYTE:return 16;case c.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else{if(!(41>b))throw new Error("type:"+b);switch(a){case c.MODE_NUMBER:return 14;case c.MODE_ALPHA_NUM:return 13;case c.MODE_8BIT_BYTE:return 16;case c.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}}},getLostPoint:function(a){for(var b=a.getModuleCount(),c=0,d=0;b>d;d++)for(var e=0;b>e;e++){for(var f=0,g=a.isDark(d,e),h=-1;1>=h;h++)if(!(0>d+h||d+h>=b))for(var i=-1;1>=i;i++)0>e+i||e+i>=b||(0!=h||0!=i)&&g==a.isDark(d+h,e+i)&&f++;f>5&&(c+=3+f-5)}for(var d=0;b-1>d;d++)for(var e=0;b-1>e;e++){var j=0;a.isDark(d,e)&&j++,a.isDark(d+1,e)&&j++,a.isDark(d,e+1)&&j++,a.isDark(d+1,e+1)&&j++,(0==j||4==j)&&(c+=3)}for(var d=0;b>d;d++)for(var e=0;b-6>e;e++)a.isDark(d,e)&&!a.isDark(d,e+1)&&a.isDark(d,e+2)&&a.isDark(d,e+3)&&a.isDark(d,e+4)&&!a.isDark(d,e+5)&&a.isDark(d,e+6)&&(c+=40);for(var e=0;b>e;e++)for(var d=0;b-6>d;d++)a.isDark(d,e)&&!a.isDark(d+1,e)&&a.isDark(d+2,e)&&a.isDark(d+3,e)&&a.isDark(d+4,e)&&!a.isDark(d+5,e)&&a.isDark(d+6,e)&&(c+=40);for(var k=0,e=0;b>e;e++)for(var d=0;b>d;d++)a.isDark(d,e)&&k++;var l=Math.abs(100*k/b/b-50)/5;return c+=10*l}},g={glog:function(a){if(1>a)throw new Error("glog("+a+")");return g.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;a>=256;)a-=255;return g.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},h=0;8>h;h++)g.EXP_TABLE[h]=1<h;h++)g.EXP_TABLE[h]=g.EXP_TABLE[h-4]^g.EXP_TABLE[h-5]^g.EXP_TABLE[h-6]^g.EXP_TABLE[h-8];for(var h=0;255>h;h++)g.LOG_TABLE[g.EXP_TABLE[h]]=h;i.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var b=new Array(this.getLength()+a.getLength()-1),c=0;cf;f++)for(var g=c[3*f+0],h=c[3*f+1],i=c[3*f+2],k=0;g>k;k++)e.push(new j(h,i));return e},j.getRsBlockTable=function(a,b){switch(b){case d.L:return j.RS_BLOCK_TABLE[4*(a-1)+0];case d.M:return j.RS_BLOCK_TABLE[4*(a-1)+1];case d.Q:return j.RS_BLOCK_TABLE[4*(a-1)+2];case d.H:return j.RS_BLOCK_TABLE[4*(a-1)+3];default:return void 0}},k.prototype={get:function(a){var b=Math.floor(a/8);return 1==(1&this.buffer[b]>>>7-a%8)},put:function(a,b){for(var c=0;b>c;c++)this.putBit(1==(1&a>>>b-c-1))},getLengthInBits:function(){return this.length},putBit:function(a){var b=Math.floor(this.length/8);this.buffer.length<=b&&this.buffer.push(0),a&&(this.buffer[b]|=128>>>this.length%8),this.length++}};var l=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],o=function(){var a=function(a,b){this._el=a,this._htOption=b};return a.prototype.draw=function(a){function g(a,b){var c=document.createElementNS("http://www.w3.org/2000/svg",a);for(var d in b)b.hasOwnProperty(d)&&c.setAttribute(d,b[d]);return c}var b=this._htOption,c=this._el,d=a.getModuleCount();Math.floor(b.width/d),Math.floor(b.height/d),this.clear();var h=g("svg",{viewBox:"0 0 "+String(d)+" "+String(d),width:"100%",height:"100%",fill:b.colorLight});h.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),c.appendChild(h),h.appendChild(g("rect",{fill:b.colorDark,width:"1",height:"1",id:"template"}));for(var i=0;d>i;i++)for(var j=0;d>j;j++)if(a.isDark(i,j)){var k=g("use",{x:String(i),y:String(j)});k.setAttributeNS("http://www.w3.org/1999/xlink","href","#template"),h.appendChild(k)}},a.prototype.clear=function(){for(;this._el.hasChildNodes();)this._el.removeChild(this._el.lastChild)},a}(),p="svg"===document.documentElement.tagName.toLowerCase(),q=p?o:m()?function(){function a(){this._elImage.src=this._elCanvas.toDataURL("image/png"),this._elImage.style.display="block",this._elCanvas.style.display="none"}function d(a,b){var c=this;if(c._fFail=b,c._fSuccess=a,null===c._bSupportDataURI){var d=document.createElement("img"),e=function(){c._bSupportDataURI=!1,c._fFail&&_fFail.call(c)},f=function(){c._bSupportDataURI=!0,c._fSuccess&&c._fSuccess.call(c)};return d.onabort=e,d.onerror=e,d.onload=f,d.src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",void 0}c._bSupportDataURI===!0&&c._fSuccess?c._fSuccess.call(c):c._bSupportDataURI===!1&&c._fFail&&c._fFail.call(c)}if(this._android&&this._android<=2.1){var b=1/window.devicePixelRatio,c=CanvasRenderingContext2D.prototype.drawImage;CanvasRenderingContext2D.prototype.drawImage=function(a,d,e,f,g,h,i,j){if("nodeName"in a&&/img/i.test(a.nodeName))for(var l=arguments.length-1;l>=1;l--)arguments[l]=arguments[l]*b;else"undefined"==typeof j&&(arguments[1]*=b,arguments[2]*=b,arguments[3]*=b,arguments[4]*=b);c.apply(this,arguments)}}var e=function(a,b){this._bIsPainted=!1,this._android=n(),this._htOption=b,this._elCanvas=document.createElement("canvas"),this._elCanvas.width=b.width,this._elCanvas.height=b.height,a.appendChild(this._elCanvas),this._el=a,this._oContext=this._elCanvas.getContext("2d"),this._bIsPainted=!1,this._elImage=document.createElement("img"),this._elImage.style.display="none",this._el.appendChild(this._elImage),this._bSupportDataURI=null};return e.prototype.draw=function(a){var b=this._elImage,c=this._oContext,d=this._htOption,e=a.getModuleCount(),f=d.width/e,g=d.height/e,h=Math.round(f),i=Math.round(g);b.style.display="none",this.clear();for(var j=0;e>j;j++)for(var k=0;e>k;k++){var l=a.isDark(j,k),m=k*f,n=j*g;c.strokeStyle=l?d.colorDark:d.colorLight,c.lineWidth=1,c.fillStyle=l?d.colorDark:d.colorLight,c.fillRect(m,n,f,g),c.strokeRect(Math.floor(m)+.5,Math.floor(n)+.5,h,i),c.strokeRect(Math.ceil(m)-.5,Math.ceil(n)-.5,h,i)}this._bIsPainted=!0},e.prototype.makeImage=function(){this._bIsPainted&&d.call(this,a)},e.prototype.isPainted=function(){return this._bIsPainted},e.prototype.clear=function(){this._oContext.clearRect(0,0,this._elCanvas.width,this._elCanvas.height),this._bIsPainted=!1},e.prototype.round=function(a){return a?Math.floor(1e3*a)/1e3:a},e}():function(){var a=function(a,b){this._el=a,this._htOption=b};return a.prototype.draw=function(a){for(var b=this._htOption,c=this._el,d=a.getModuleCount(),e=Math.floor(b.width/d),f=Math.floor(b.height/d),g=[''],h=0;d>h;h++){g.push("");for(var i=0;d>i;i++)g.push(' | ');g.push("
")}g.push("
"),c.innerHTML=g.join("");var j=c.childNodes[0],k=(b.width-j.offsetWidth)/2,l=(b.height-j.offsetHeight)/2;k>0&&l>0&&(j.style.margin=l+"px "+k+"px")},a.prototype.clear=function(){this._el.innerHTML=""},a}();QRCode=function(a,b){if(this._htOption={width:256,height:256,typeNumber:4,colorDark:"#000000",colorLight:"#ffffff",correctLevel:d.H},"string"==typeof b&&(b={text:b}),b)for(var c in b)this._htOption[c]=b[c];"string"==typeof a&&(a=document.getElementById(a)),this._android=n(),this._el=a,this._oQRCode=null,this._oDrawing=new q(this._el,this._htOption),this._htOption.text&&this.makeCode(this._htOption.text)},QRCode.prototype.makeCode=function(a){this._oQRCode=new b(r(a,this._htOption.correctLevel),this._htOption.correctLevel),this._oQRCode.addData(a),this._oQRCode.make(),this._el.title=a,this._oDrawing.draw(this._oQRCode),this.makeImage()},QRCode.prototype.makeImage=function(){"function"==typeof this._oDrawing.makeImage&&(!this._android||this._android>=3)&&this._oDrawing.makeImage()},QRCode.prototype.clear=function(){this._oDrawing.clear()},QRCode.CorrectLevel=d}();
\ No newline at end of file
+var QRCode;
+!(() => {
+ function a(a) {
+ (this.mode = c.MODE_8BIT_BYTE), (this.data = a), (this.parsedData = []);
+ for (var b = [], d = 0, e = this.data.length; e > d; d++) {
+ var f = this.data.charCodeAt(d);
+ f > 65536
+ ? ((b[0] = 240 | ((1835008 & f) >>> 18)),
+ (b[1] = 128 | ((258048 & f) >>> 12)),
+ (b[2] = 128 | ((4032 & f) >>> 6)),
+ (b[3] = 128 | (63 & f)))
+ : f > 2048
+ ? ((b[0] = 224 | ((61440 & f) >>> 12)),
+ (b[1] = 128 | ((4032 & f) >>> 6)),
+ (b[2] = 128 | (63 & f)))
+ : f > 128
+ ? ((b[0] = 192 | ((1984 & f) >>> 6)),
+ (b[1] = 128 | (63 & f)))
+ : (b[0] = f),
+ (this.parsedData = this.parsedData.concat(b));
+ }
+ this.parsedData.length != this.data.length &&
+ (this.parsedData.unshift(191),
+ this.parsedData.unshift(187),
+ this.parsedData.unshift(239));
+ }
+ function b(a, b) {
+ (this.typeNumber = a),
+ (this.errorCorrectLevel = b),
+ (this.modules = null),
+ (this.moduleCount = 0),
+ (this.dataCache = null),
+ (this.dataList = []);
+ }
+ function i(a, b) {
+ if (void 0 == a.length) throw new Error(a.length + "/" + b);
+ for (var c = 0; c < a.length && 0 == a[c]; ) c++;
+ this.num = new Array(a.length - c + b);
+ for (var d = 0; d < a.length - c; d++) this.num[d] = a[d + c];
+ }
+ function j(a, b) {
+ (this.totalCount = a), (this.dataCount = b);
+ }
+ function k() {
+ (this.buffer = []), (this.length = 0);
+ }
+ function m() {
+ return "undefined" != typeof CanvasRenderingContext2D;
+ }
+ function n() {
+ var a = !1,
+ b = navigator.userAgent;
+ return (
+ /android/i.test(b) &&
+ ((a = !0),
+ (aMat = b.toString().match(/android ([0-9]\.[0-9])/i)),
+ aMat && aMat[1] && (a = Number.parseFloat(aMat[1]))),
+ a
+ );
+ }
+ function r(a, b) {
+ for (var c = 1, e = s(a), f = 0, g = l.length; g >= f; f++) {
+ var h = 0;
+ switch (b) {
+ case d.L:
+ h = l[f][0];
+ break;
+ case d.M:
+ h = l[f][1];
+ break;
+ case d.Q:
+ h = l[f][2];
+ break;
+ case d.H:
+ h = l[f][3];
+ }
+ if (h >= e) break;
+ c++;
+ }
+ if (c > l.length) throw new Error("Too long data");
+ return c;
+ }
+ function s(a) {
+ var b = encodeURI(a)
+ .toString()
+ .replace(/\%[0-9a-fA-F]{2}/g, "a");
+ return b.length + (b.length != a ? 3 : 0);
+ }
+ (a.prototype = {
+ getLength: function () {
+ return this.parsedData.length;
+ },
+ write: function (a) {
+ for (var b = 0, c = this.parsedData.length; c > b; b++)
+ a.put(this.parsedData[b], 8);
+ },
+ }),
+ (b.prototype = {
+ addData: function (b) {
+ var c = new a(b);
+ this.dataList.push(c), (this.dataCache = null);
+ },
+ isDark: function (a, b) {
+ if (
+ 0 > a ||
+ this.moduleCount <= a ||
+ 0 > b ||
+ this.moduleCount <= b
+ )
+ throw new Error(a + "," + b);
+ return this.modules[a][b];
+ },
+ getModuleCount: function () {
+ return this.moduleCount;
+ },
+ make: function () {
+ this.makeImpl(!1, this.getBestMaskPattern());
+ },
+ makeImpl: function (a, c) {
+ (this.moduleCount = 4 * this.typeNumber + 17),
+ (this.modules = new Array(this.moduleCount));
+ for (var d = 0; d < this.moduleCount; d++) {
+ this.modules[d] = new Array(this.moduleCount);
+ for (var e = 0; e < this.moduleCount; e++)
+ this.modules[d][e] = null;
+ }
+ this.setupPositionProbePattern(0, 0),
+ this.setupPositionProbePattern(this.moduleCount - 7, 0),
+ this.setupPositionProbePattern(0, this.moduleCount - 7),
+ this.setupPositionAdjustPattern(),
+ this.setupTimingPattern(),
+ this.setupTypeInfo(a, c),
+ this.typeNumber >= 7 && this.setupTypeNumber(a),
+ null == this.dataCache &&
+ (this.dataCache = b.createData(
+ this.typeNumber,
+ this.errorCorrectLevel,
+ this.dataList,
+ )),
+ this.mapData(this.dataCache, c);
+ },
+ setupPositionProbePattern: function (a, b) {
+ for (var c = -1; 7 >= c; c++)
+ if (!(-1 >= a + c || this.moduleCount <= a + c))
+ for (var d = -1; 7 >= d; d++)
+ -1 >= b + d ||
+ this.moduleCount <= b + d ||
+ (this.modules[a + c][b + d] =
+ (c >= 0 && 6 >= c && (0 == d || 6 == d)) ||
+ (d >= 0 && 6 >= d && (0 == c || 6 == c)) ||
+ (c >= 2 && 4 >= c && d >= 2 && 4 >= d)
+ ? !0
+ : !1);
+ },
+ getBestMaskPattern: function () {
+ for (var a = 0, b = 0, c = 0; 8 > c; c++) {
+ this.makeImpl(!0, c);
+ var d = f.getLostPoint(this);
+ (0 == c || a > d) && ((a = d), (b = c));
+ }
+ return b;
+ },
+ createMovieClip: function (a, b, c) {
+ var d = a.createEmptyMovieClip(b, c),
+ e = 1;
+ this.make();
+ for (var f = 0; f < this.modules.length; f++)
+ for (
+ var g = f * e, h = 0;
+ h < this.modules[f].length;
+ h++
+ ) {
+ var i = h * e,
+ j = this.modules[f][h];
+ j &&
+ (d.beginFill(0, 100),
+ d.moveTo(i, g),
+ d.lineTo(i + e, g),
+ d.lineTo(i + e, g + e),
+ d.lineTo(i, g + e),
+ d.endFill());
+ }
+ return d;
+ },
+ setupTimingPattern: function () {
+ for (var a = 8; a < this.moduleCount - 8; a++)
+ null == this.modules[a][6] &&
+ (this.modules[a][6] = 0 == a % 2);
+ for (var b = 8; b < this.moduleCount - 8; b++)
+ null == this.modules[6][b] &&
+ (this.modules[6][b] = 0 == b % 2);
+ },
+ setupPositionAdjustPattern: function () {
+ for (
+ var a = f.getPatternPosition(this.typeNumber), b = 0;
+ b < a.length;
+ b++
+ )
+ for (var c = 0; c < a.length; c++) {
+ var d = a[b],
+ e = a[c];
+ if (null == this.modules[d][e])
+ for (var g = -2; 2 >= g; g++)
+ for (var h = -2; 2 >= h; h++)
+ this.modules[d + g][e + h] =
+ -2 == g ||
+ 2 == g ||
+ -2 == h ||
+ 2 == h ||
+ (0 == g && 0 == h)
+ ? !0
+ : !1;
+ }
+ },
+ setupTypeNumber: function (a) {
+ for (
+ var b = f.getBCHTypeNumber(this.typeNumber), c = 0;
+ 18 > c;
+ c++
+ ) {
+ var d = !a && 1 == (1 & (b >> c));
+ this.modules[Math.floor(c / 3)][
+ (c % 3) + this.moduleCount - 8 - 3
+ ] = d;
+ }
+ for (var c = 0; 18 > c; c++) {
+ var d = !a && 1 == (1 & (b >> c));
+ this.modules[(c % 3) + this.moduleCount - 8 - 3][
+ Math.floor(c / 3)
+ ] = d;
+ }
+ },
+ setupTypeInfo: function (a, b) {
+ for (
+ var c = (this.errorCorrectLevel << 3) | b,
+ d = f.getBCHTypeInfo(c),
+ e = 0;
+ 15 > e;
+ e++
+ ) {
+ var g = !a && 1 == (1 & (d >> e));
+ 6 > e
+ ? (this.modules[e][8] = g)
+ : 8 > e
+ ? (this.modules[e + 1][8] = g)
+ : (this.modules[this.moduleCount - 15 + e][8] = g);
+ }
+ for (var e = 0; 15 > e; e++) {
+ var g = !a && 1 == (1 & (d >> e));
+ 8 > e
+ ? (this.modules[8][this.moduleCount - e - 1] = g)
+ : 9 > e
+ ? (this.modules[8][15 - e - 1 + 1] = g)
+ : (this.modules[8][15 - e - 1] = g);
+ }
+ this.modules[this.moduleCount - 8][8] = !a;
+ },
+ mapData: function (a, b) {
+ for (
+ var c = -1,
+ d = this.moduleCount - 1,
+ e = 7,
+ g = 0,
+ h = this.moduleCount - 1;
+ h > 0;
+ h -= 2
+ )
+ for (6 == h && h--; ; ) {
+ for (var i = 0; 2 > i; i++)
+ if (null == this.modules[d][h - i]) {
+ var j = !1;
+ g < a.length && (j = 1 == (1 & (a[g] >>> e)));
+ var k = f.getMask(b, d, h - i);
+ k && (j = !j),
+ (this.modules[d][h - i] = j),
+ e--,
+ -1 == e && (g++, (e = 7));
+ }
+ if (((d += c), 0 > d || this.moduleCount <= d)) {
+ (d -= c), (c = -c);
+ break;
+ }
+ }
+ },
+ }),
+ (b.PAD0 = 236),
+ (b.PAD1 = 17),
+ (b.createData = (a, c, d) => {
+ for (
+ var e = j.getRSBlocks(a, c), g = new k(), h = 0;
+ h < d.length;
+ h++
+ ) {
+ var i = d[h];
+ g.put(i.mode, 4),
+ g.put(i.getLength(), f.getLengthInBits(i.mode, a)),
+ i.write(g);
+ }
+ for (var l = 0, h = 0; h < e.length; h++) l += e[h].dataCount;
+ if (g.getLengthInBits() > 8 * l)
+ throw new Error(
+ "code length overflow. (" +
+ g.getLengthInBits() +
+ ">" +
+ 8 * l +
+ ")",
+ );
+ for (
+ g.getLengthInBits() + 4 <= 8 * l && g.put(0, 4);
+ 0 != g.getLengthInBits() % 8;
+ )
+ g.putBit(!1);
+ for (;;) {
+ if (g.getLengthInBits() >= 8 * l) break;
+ if ((g.put(b.PAD0, 8), g.getLengthInBits() >= 8 * l)) break;
+ g.put(b.PAD1, 8);
+ }
+ return b.createBytes(g, e);
+ }),
+ (b.createBytes = (a, b) => {
+ for (
+ var c = 0,
+ d = 0,
+ e = 0,
+ g = new Array(b.length),
+ h = new Array(b.length),
+ j = 0;
+ j < b.length;
+ j++
+ ) {
+ var k = b[j].dataCount,
+ l = b[j].totalCount - k;
+ (d = Math.max(d, k)),
+ (e = Math.max(e, l)),
+ (g[j] = new Array(k));
+ for (var m = 0; m < g[j].length; m++)
+ g[j][m] = 255 & a.buffer[m + c];
+ c += k;
+ var n = f.getErrorCorrectPolynomial(l),
+ o = new i(g[j], n.getLength() - 1),
+ p = o.mod(n);
+ h[j] = new Array(n.getLength() - 1);
+ for (var m = 0; m < h[j].length; m++) {
+ var q = m + p.getLength() - h[j].length;
+ h[j][m] = q >= 0 ? p.get(q) : 0;
+ }
+ }
+ for (var r = 0, m = 0; m < b.length; m++) r += b[m].totalCount;
+ for (var s = new Array(r), t = 0, m = 0; d > m; m++)
+ for (var j = 0; j < b.length; j++)
+ m < g[j].length && (s[t++] = g[j][m]);
+ for (var m = 0; e > m; m++)
+ for (var j = 0; j < b.length; j++)
+ m < h[j].length && (s[t++] = h[j][m]);
+ return s;
+ });
+ for (
+ var c = {
+ MODE_NUMBER: 1,
+ MODE_ALPHA_NUM: 2,
+ MODE_8BIT_BYTE: 4,
+ MODE_KANJI: 8,
+ },
+ d = { L: 1, M: 0, Q: 3, H: 2 },
+ e = {
+ PATTERN000: 0,
+ PATTERN001: 1,
+ PATTERN010: 2,
+ PATTERN011: 3,
+ PATTERN100: 4,
+ PATTERN101: 5,
+ PATTERN110: 6,
+ PATTERN111: 7,
+ },
+ f = {
+ PATTERN_POSITION_TABLE: [
+ [],
+ [6, 18],
+ [6, 22],
+ [6, 26],
+ [6, 30],
+ [6, 34],
+ [6, 22, 38],
+ [6, 24, 42],
+ [6, 26, 46],
+ [6, 28, 50],
+ [6, 30, 54],
+ [6, 32, 58],
+ [6, 34, 62],
+ [6, 26, 46, 66],
+ [6, 26, 48, 70],
+ [6, 26, 50, 74],
+ [6, 30, 54, 78],
+ [6, 30, 56, 82],
+ [6, 30, 58, 86],
+ [6, 34, 62, 90],
+ [6, 28, 50, 72, 94],
+ [6, 26, 50, 74, 98],
+ [6, 30, 54, 78, 102],
+ [6, 28, 54, 80, 106],
+ [6, 32, 58, 84, 110],
+ [6, 30, 58, 86, 114],
+ [6, 34, 62, 90, 118],
+ [6, 26, 50, 74, 98, 122],
+ [6, 30, 54, 78, 102, 126],
+ [6, 26, 52, 78, 104, 130],
+ [6, 30, 56, 82, 108, 134],
+ [6, 34, 60, 86, 112, 138],
+ [6, 30, 58, 86, 114, 142],
+ [6, 34, 62, 90, 118, 146],
+ [6, 30, 54, 78, 102, 126, 150],
+ [6, 24, 50, 76, 102, 128, 154],
+ [6, 28, 54, 80, 106, 132, 158],
+ [6, 32, 58, 84, 110, 136, 162],
+ [6, 26, 54, 82, 110, 138, 166],
+ [6, 30, 58, 86, 114, 142, 170],
+ ],
+ G15: 1335,
+ G18: 7973,
+ G15_MASK: 21522,
+ getBCHTypeInfo: (a) => {
+ for (
+ var b = a << 10;
+ f.getBCHDigit(b) - f.getBCHDigit(f.G15) >= 0;
+ )
+ b ^= f.G15 << (f.getBCHDigit(b) - f.getBCHDigit(f.G15));
+ return ((a << 10) | b) ^ f.G15_MASK;
+ },
+ getBCHTypeNumber: (a) => {
+ for (
+ var b = a << 12;
+ f.getBCHDigit(b) - f.getBCHDigit(f.G18) >= 0;
+ )
+ b ^= f.G18 << (f.getBCHDigit(b) - f.getBCHDigit(f.G18));
+ return (a << 12) | b;
+ },
+ getBCHDigit: (a) => {
+ for (var b = 0; 0 != a; ) b++, (a >>>= 1);
+ return b;
+ },
+ getPatternPosition: (a) => f.PATTERN_POSITION_TABLE[a - 1],
+ getMask: (a, b, c) => {
+ switch (a) {
+ case e.PATTERN000:
+ return 0 == (b + c) % 2;
+ case e.PATTERN001:
+ return 0 == b % 2;
+ case e.PATTERN010:
+ return 0 == c % 3;
+ case e.PATTERN011:
+ return 0 == (b + c) % 3;
+ case e.PATTERN100:
+ return (
+ 0 == (Math.floor(b / 2) + Math.floor(c / 3)) % 2
+ );
+ case e.PATTERN101:
+ return 0 == ((b * c) % 2) + ((b * c) % 3);
+ case e.PATTERN110:
+ return 0 == (((b * c) % 2) + ((b * c) % 3)) % 2;
+ case e.PATTERN111:
+ return 0 == (((b * c) % 3) + ((b + c) % 2)) % 2;
+ default:
+ throw new Error("bad maskPattern:" + a);
+ }
+ },
+ getErrorCorrectPolynomial: (a) => {
+ for (var b = new i([1], 0), c = 0; a > c; c++)
+ b = b.multiply(new i([1, g.gexp(c)], 0));
+ return b;
+ },
+ getLengthInBits: (a, b) => {
+ if (b >= 1 && 10 > b)
+ switch (a) {
+ case c.MODE_NUMBER:
+ return 10;
+ case c.MODE_ALPHA_NUM:
+ return 9;
+ case c.MODE_8BIT_BYTE:
+ return 8;
+ case c.MODE_KANJI:
+ return 8;
+ default:
+ throw new Error("mode:" + a);
+ }
+ else if (27 > b)
+ switch (a) {
+ case c.MODE_NUMBER:
+ return 12;
+ case c.MODE_ALPHA_NUM:
+ return 11;
+ case c.MODE_8BIT_BYTE:
+ return 16;
+ case c.MODE_KANJI:
+ return 10;
+ default:
+ throw new Error("mode:" + a);
+ }
+ else {
+ if (!(41 > b)) throw new Error("type:" + b);
+ switch (a) {
+ case c.MODE_NUMBER:
+ return 14;
+ case c.MODE_ALPHA_NUM:
+ return 13;
+ case c.MODE_8BIT_BYTE:
+ return 16;
+ case c.MODE_KANJI:
+ return 12;
+ default:
+ throw new Error("mode:" + a);
+ }
+ }
+ },
+ getLostPoint: (a) => {
+ for (var b = a.getModuleCount(), c = 0, d = 0; b > d; d++)
+ for (var e = 0; b > e; e++) {
+ for (
+ var f = 0, g = a.isDark(d, e), h = -1;
+ 1 >= h;
+ h++
+ )
+ if (!(0 > d + h || d + h >= b))
+ for (var i = -1; 1 >= i; i++)
+ 0 > e + i ||
+ e + i >= b ||
+ ((0 != h || 0 != i) &&
+ g == a.isDark(d + h, e + i) &&
+ f++);
+ f > 5 && (c += 3 + f - 5);
+ }
+ for (var d = 0; b - 1 > d; d++)
+ for (var e = 0; b - 1 > e; e++) {
+ var j = 0;
+ a.isDark(d, e) && j++,
+ a.isDark(d + 1, e) && j++,
+ a.isDark(d, e + 1) && j++,
+ a.isDark(d + 1, e + 1) && j++,
+ (0 == j || 4 == j) && (c += 3);
+ }
+ for (var d = 0; b > d; d++)
+ for (var e = 0; b - 6 > e; e++)
+ a.isDark(d, e) &&
+ !a.isDark(d, e + 1) &&
+ a.isDark(d, e + 2) &&
+ a.isDark(d, e + 3) &&
+ a.isDark(d, e + 4) &&
+ !a.isDark(d, e + 5) &&
+ a.isDark(d, e + 6) &&
+ (c += 40);
+ for (var e = 0; b > e; e++)
+ for (var d = 0; b - 6 > d; d++)
+ a.isDark(d, e) &&
+ !a.isDark(d + 1, e) &&
+ a.isDark(d + 2, e) &&
+ a.isDark(d + 3, e) &&
+ a.isDark(d + 4, e) &&
+ !a.isDark(d + 5, e) &&
+ a.isDark(d + 6, e) &&
+ (c += 40);
+ for (var k = 0, e = 0; b > e; e++)
+ for (var d = 0; b > d; d++) a.isDark(d, e) && k++;
+ var l = Math.abs((100 * k) / b / b - 50) / 5;
+ return (c += 10 * l);
+ },
+ },
+ g = {
+ glog: (a) => {
+ if (1 > a) throw new Error("glog(" + a + ")");
+ return g.LOG_TABLE[a];
+ },
+ gexp: (a) => {
+ while (0 > a) a += 255;
+ while (a >= 256) a -= 255;
+ return g.EXP_TABLE[a];
+ },
+ EXP_TABLE: new Array(256),
+ LOG_TABLE: new Array(256),
+ },
+ h = 0;
+ 8 > h;
+ h++
+ )
+ g.EXP_TABLE[h] = 1 << h;
+ for (var h = 8; 256 > h; h++)
+ g.EXP_TABLE[h] =
+ g.EXP_TABLE[h - 4] ^
+ g.EXP_TABLE[h - 5] ^
+ g.EXP_TABLE[h - 6] ^
+ g.EXP_TABLE[h - 8];
+ for (var h = 0; 255 > h; h++) g.LOG_TABLE[g.EXP_TABLE[h]] = h;
+ (i.prototype = {
+ get: function (a) {
+ return this.num[a];
+ },
+ getLength: function () {
+ return this.num.length;
+ },
+ multiply: function (a) {
+ for (
+ var b = new Array(this.getLength() + a.getLength() - 1), c = 0;
+ c < this.getLength();
+ c++
+ )
+ for (var d = 0; d < a.getLength(); d++)
+ b[c + d] ^= g.gexp(g.glog(this.get(c)) + g.glog(a.get(d)));
+ return new i(b, 0);
+ },
+ mod: function (a) {
+ if (this.getLength() - a.getLength() < 0) return this;
+ for (
+ var b = g.glog(this.get(0)) - g.glog(a.get(0)),
+ c = new Array(this.getLength()),
+ d = 0;
+ d < this.getLength();
+ d++
+ )
+ c[d] = this.get(d);
+ for (var d = 0; d < a.getLength(); d++)
+ c[d] ^= g.gexp(g.glog(a.get(d)) + b);
+ return new i(c, 0).mod(a);
+ },
+ }),
+ (j.RS_BLOCK_TABLE = [
+ [1, 26, 19],
+ [1, 26, 16],
+ [1, 26, 13],
+ [1, 26, 9],
+ [1, 44, 34],
+ [1, 44, 28],
+ [1, 44, 22],
+ [1, 44, 16],
+ [1, 70, 55],
+ [1, 70, 44],
+ [2, 35, 17],
+ [2, 35, 13],
+ [1, 100, 80],
+ [2, 50, 32],
+ [2, 50, 24],
+ [4, 25, 9],
+ [1, 134, 108],
+ [2, 67, 43],
+ [2, 33, 15, 2, 34, 16],
+ [2, 33, 11, 2, 34, 12],
+ [2, 86, 68],
+ [4, 43, 27],
+ [4, 43, 19],
+ [4, 43, 15],
+ [2, 98, 78],
+ [4, 49, 31],
+ [2, 32, 14, 4, 33, 15],
+ [4, 39, 13, 1, 40, 14],
+ [2, 121, 97],
+ [2, 60, 38, 2, 61, 39],
+ [4, 40, 18, 2, 41, 19],
+ [4, 40, 14, 2, 41, 15],
+ [2, 146, 116],
+ [3, 58, 36, 2, 59, 37],
+ [4, 36, 16, 4, 37, 17],
+ [4, 36, 12, 4, 37, 13],
+ [2, 86, 68, 2, 87, 69],
+ [4, 69, 43, 1, 70, 44],
+ [6, 43, 19, 2, 44, 20],
+ [6, 43, 15, 2, 44, 16],
+ [4, 101, 81],
+ [1, 80, 50, 4, 81, 51],
+ [4, 50, 22, 4, 51, 23],
+ [3, 36, 12, 8, 37, 13],
+ [2, 116, 92, 2, 117, 93],
+ [6, 58, 36, 2, 59, 37],
+ [4, 46, 20, 6, 47, 21],
+ [7, 42, 14, 4, 43, 15],
+ [4, 133, 107],
+ [8, 59, 37, 1, 60, 38],
+ [8, 44, 20, 4, 45, 21],
+ [12, 33, 11, 4, 34, 12],
+ [3, 145, 115, 1, 146, 116],
+ [4, 64, 40, 5, 65, 41],
+ [11, 36, 16, 5, 37, 17],
+ [11, 36, 12, 5, 37, 13],
+ [5, 109, 87, 1, 110, 88],
+ [5, 65, 41, 5, 66, 42],
+ [5, 54, 24, 7, 55, 25],
+ [11, 36, 12],
+ [5, 122, 98, 1, 123, 99],
+ [7, 73, 45, 3, 74, 46],
+ [15, 43, 19, 2, 44, 20],
+ [3, 45, 15, 13, 46, 16],
+ [1, 135, 107, 5, 136, 108],
+ [10, 74, 46, 1, 75, 47],
+ [1, 50, 22, 15, 51, 23],
+ [2, 42, 14, 17, 43, 15],
+ [5, 150, 120, 1, 151, 121],
+ [9, 69, 43, 4, 70, 44],
+ [17, 50, 22, 1, 51, 23],
+ [2, 42, 14, 19, 43, 15],
+ [3, 141, 113, 4, 142, 114],
+ [3, 70, 44, 11, 71, 45],
+ [17, 47, 21, 4, 48, 22],
+ [9, 39, 13, 16, 40, 14],
+ [3, 135, 107, 5, 136, 108],
+ [3, 67, 41, 13, 68, 42],
+ [15, 54, 24, 5, 55, 25],
+ [15, 43, 15, 10, 44, 16],
+ [4, 144, 116, 4, 145, 117],
+ [17, 68, 42],
+ [17, 50, 22, 6, 51, 23],
+ [19, 46, 16, 6, 47, 17],
+ [2, 139, 111, 7, 140, 112],
+ [17, 74, 46],
+ [7, 54, 24, 16, 55, 25],
+ [34, 37, 13],
+ [4, 151, 121, 5, 152, 122],
+ [4, 75, 47, 14, 76, 48],
+ [11, 54, 24, 14, 55, 25],
+ [16, 45, 15, 14, 46, 16],
+ [6, 147, 117, 4, 148, 118],
+ [6, 73, 45, 14, 74, 46],
+ [11, 54, 24, 16, 55, 25],
+ [30, 46, 16, 2, 47, 17],
+ [8, 132, 106, 4, 133, 107],
+ [8, 75, 47, 13, 76, 48],
+ [7, 54, 24, 22, 55, 25],
+ [22, 45, 15, 13, 46, 16],
+ [10, 142, 114, 2, 143, 115],
+ [19, 74, 46, 4, 75, 47],
+ [28, 50, 22, 6, 51, 23],
+ [33, 46, 16, 4, 47, 17],
+ [8, 152, 122, 4, 153, 123],
+ [22, 73, 45, 3, 74, 46],
+ [8, 53, 23, 26, 54, 24],
+ [12, 45, 15, 28, 46, 16],
+ [3, 147, 117, 10, 148, 118],
+ [3, 73, 45, 23, 74, 46],
+ [4, 54, 24, 31, 55, 25],
+ [11, 45, 15, 31, 46, 16],
+ [7, 146, 116, 7, 147, 117],
+ [21, 73, 45, 7, 74, 46],
+ [1, 53, 23, 37, 54, 24],
+ [19, 45, 15, 26, 46, 16],
+ [5, 145, 115, 10, 146, 116],
+ [19, 75, 47, 10, 76, 48],
+ [15, 54, 24, 25, 55, 25],
+ [23, 45, 15, 25, 46, 16],
+ [13, 145, 115, 3, 146, 116],
+ [2, 74, 46, 29, 75, 47],
+ [42, 54, 24, 1, 55, 25],
+ [23, 45, 15, 28, 46, 16],
+ [17, 145, 115],
+ [10, 74, 46, 23, 75, 47],
+ [10, 54, 24, 35, 55, 25],
+ [19, 45, 15, 35, 46, 16],
+ [17, 145, 115, 1, 146, 116],
+ [14, 74, 46, 21, 75, 47],
+ [29, 54, 24, 19, 55, 25],
+ [11, 45, 15, 46, 46, 16],
+ [13, 145, 115, 6, 146, 116],
+ [14, 74, 46, 23, 75, 47],
+ [44, 54, 24, 7, 55, 25],
+ [59, 46, 16, 1, 47, 17],
+ [12, 151, 121, 7, 152, 122],
+ [12, 75, 47, 26, 76, 48],
+ [39, 54, 24, 14, 55, 25],
+ [22, 45, 15, 41, 46, 16],
+ [6, 151, 121, 14, 152, 122],
+ [6, 75, 47, 34, 76, 48],
+ [46, 54, 24, 10, 55, 25],
+ [2, 45, 15, 64, 46, 16],
+ [17, 152, 122, 4, 153, 123],
+ [29, 74, 46, 14, 75, 47],
+ [49, 54, 24, 10, 55, 25],
+ [24, 45, 15, 46, 46, 16],
+ [4, 152, 122, 18, 153, 123],
+ [13, 74, 46, 32, 75, 47],
+ [48, 54, 24, 14, 55, 25],
+ [42, 45, 15, 32, 46, 16],
+ [20, 147, 117, 4, 148, 118],
+ [40, 75, 47, 7, 76, 48],
+ [43, 54, 24, 22, 55, 25],
+ [10, 45, 15, 67, 46, 16],
+ [19, 148, 118, 6, 149, 119],
+ [18, 75, 47, 31, 76, 48],
+ [34, 54, 24, 34, 55, 25],
+ [20, 45, 15, 61, 46, 16],
+ ]),
+ (j.getRSBlocks = (a, b) => {
+ var c = j.getRsBlockTable(a, b);
+ if (void 0 == c)
+ throw new Error(
+ "bad rs block @ typeNumber:" +
+ a +
+ "/errorCorrectLevel:" +
+ b,
+ );
+ for (var d = c.length / 3, e = [], f = 0; d > f; f++)
+ for (
+ var g = c[3 * f + 0],
+ h = c[3 * f + 1],
+ i = c[3 * f + 2],
+ k = 0;
+ g > k;
+ k++
+ )
+ e.push(new j(h, i));
+ return e;
+ }),
+ (j.getRsBlockTable = (a, b) => {
+ switch (b) {
+ case d.L:
+ return j.RS_BLOCK_TABLE[4 * (a - 1) + 0];
+ case d.M:
+ return j.RS_BLOCK_TABLE[4 * (a - 1) + 1];
+ case d.Q:
+ return j.RS_BLOCK_TABLE[4 * (a - 1) + 2];
+ case d.H:
+ return j.RS_BLOCK_TABLE[4 * (a - 1) + 3];
+ default:
+ return void 0;
+ }
+ }),
+ (k.prototype = {
+ get: function (a) {
+ var b = Math.floor(a / 8);
+ return 1 == (1 & (this.buffer[b] >>> (7 - (a % 8))));
+ },
+ put: function (a, b) {
+ for (var c = 0; b > c; c++)
+ this.putBit(1 == (1 & (a >>> (b - c - 1))));
+ },
+ getLengthInBits: function () {
+ return this.length;
+ },
+ putBit: function (a) {
+ var b = Math.floor(this.length / 8);
+ this.buffer.length <= b && this.buffer.push(0),
+ a && (this.buffer[b] |= 128 >>> (this.length % 8)),
+ this.length++;
+ },
+ });
+ var l = [
+ [17, 14, 11, 7],
+ [32, 26, 20, 14],
+ [53, 42, 32, 24],
+ [78, 62, 46, 34],
+ [106, 84, 60, 44],
+ [134, 106, 74, 58],
+ [154, 122, 86, 64],
+ [192, 152, 108, 84],
+ [230, 180, 130, 98],
+ [271, 213, 151, 119],
+ [321, 251, 177, 137],
+ [367, 287, 203, 155],
+ [425, 331, 241, 177],
+ [458, 362, 258, 194],
+ [520, 412, 292, 220],
+ [586, 450, 322, 250],
+ [644, 504, 364, 280],
+ [718, 560, 394, 310],
+ [792, 624, 442, 338],
+ [858, 666, 482, 382],
+ [929, 711, 509, 403],
+ [1003, 779, 565, 439],
+ [1091, 857, 611, 461],
+ [1171, 911, 661, 511],
+ [1273, 997, 715, 535],
+ [1367, 1059, 751, 593],
+ [1465, 1125, 805, 625],
+ [1528, 1190, 868, 658],
+ [1628, 1264, 908, 698],
+ [1732, 1370, 982, 742],
+ [1840, 1452, 1030, 790],
+ [1952, 1538, 1112, 842],
+ [2068, 1628, 1168, 898],
+ [2188, 1722, 1228, 958],
+ [2303, 1809, 1283, 983],
+ [2431, 1911, 1351, 1051],
+ [2563, 1989, 1423, 1093],
+ [2699, 2099, 1499, 1139],
+ [2809, 2213, 1579, 1219],
+ [2953, 2331, 1663, 1273],
+ ],
+ o = (() => {
+ var a = function (a, b) {
+ (this._el = a), (this._htOption = b);
+ };
+ return (
+ (a.prototype.draw = function (a) {
+ function g(a, b) {
+ var c = document.createElementNS(
+ "http://www.w3.org/2000/svg",
+ a,
+ );
+ for (var d in b)
+ b.hasOwnProperty(d) && c.setAttribute(d, b[d]);
+ return c;
+ }
+ var b = this._htOption,
+ c = this._el,
+ d = a.getModuleCount();
+ Math.floor(b.width / d),
+ Math.floor(b.height / d),
+ this.clear();
+ var h = g("svg", {
+ viewBox: "0 0 " + String(d) + " " + String(d),
+ width: "100%",
+ height: "100%",
+ fill: b.colorLight,
+ });
+ h.setAttributeNS(
+ "http://www.w3.org/2000/xmlns/",
+ "xmlns:xlink",
+ "http://www.w3.org/1999/xlink",
+ ),
+ c.appendChild(h),
+ h.appendChild(
+ g("rect", {
+ fill: b.colorDark,
+ width: "1",
+ height: "1",
+ id: "template",
+ }),
+ );
+ for (var i = 0; d > i; i++)
+ for (var j = 0; d > j; j++)
+ if (a.isDark(i, j)) {
+ var k = g("use", {
+ x: String(i),
+ y: String(j),
+ });
+ k.setAttributeNS(
+ "http://www.w3.org/1999/xlink",
+ "href",
+ "#template",
+ ),
+ h.appendChild(k);
+ }
+ }),
+ (a.prototype.clear = function () {
+ while (this._el.hasChildNodes())
+ this._el.removeChild(this._el.lastChild);
+ }),
+ a
+ );
+ })(),
+ p = "svg" === document.documentElement.tagName.toLowerCase(),
+ q = p
+ ? o
+ : m()
+ ? (function () {
+ function a() {
+ (this._elImage.src =
+ this._elCanvas.toDataURL("image/png")),
+ (this._elImage.style.display = "block"),
+ (this._elCanvas.style.display = "none");
+ }
+ function d(a, b) {
+ if (
+ ((this._fFail = b),
+ (this._fSuccess = a),
+ null === this._bSupportDataURI)
+ ) {
+ var d = document.createElement("img"),
+ e = () => {
+ (this._bSupportDataURI = !1),
+ this._fFail && _fFail.call(this);
+ },
+ f = () => {
+ (this._bSupportDataURI = !0),
+ this._fSuccess &&
+ this._fSuccess.call(this);
+ };
+ return (
+ (d.onabort = e),
+ (d.onerror = e),
+ (d.onload = f),
+ (d.src =
+ "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="),
+ void 0
+ );
+ }
+ this._bSupportDataURI === !0 && this._fSuccess
+ ? this._fSuccess.call(this)
+ : this._bSupportDataURI === !1 &&
+ this._fFail &&
+ this._fFail.call(this);
+ }
+ if (this._android && this._android <= 2.1) {
+ var b = 1 / window.devicePixelRatio,
+ c = CanvasRenderingContext2D.prototype.drawImage;
+ CanvasRenderingContext2D.prototype.drawImage =
+ function (a, d, e, f, g, h, i, j) {
+ if ("nodeName" in a && /img/i.test(a.nodeName))
+ for (
+ var l = arguments.length - 1;
+ l >= 1;
+ l--
+ )
+ arguments[l] = arguments[l] * b;
+ else
+ "undefined" == typeof j &&
+ ((arguments[1] *= b),
+ (arguments[2] *= b),
+ (arguments[3] *= b),
+ (arguments[4] *= b));
+ c.apply(this, arguments);
+ };
+ }
+ var e = function (a, b) {
+ (this._bIsPainted = !1),
+ (this._android = n()),
+ (this._htOption = b),
+ (this._elCanvas = document.createElement("canvas")),
+ (this._elCanvas.width = b.width),
+ (this._elCanvas.height = b.height),
+ a.appendChild(this._elCanvas),
+ (this._el = a),
+ (this._oContext = this._elCanvas.getContext("2d")),
+ (this._bIsPainted = !1),
+ (this._elImage = document.createElement("img")),
+ (this._elImage.style.display = "none"),
+ this._el.appendChild(this._elImage),
+ (this._bSupportDataURI = null);
+ };
+ return (
+ (e.prototype.draw = function (a) {
+ var b = this._elImage,
+ c = this._oContext,
+ d = this._htOption,
+ e = a.getModuleCount(),
+ f = d.width / e,
+ g = d.height / e,
+ h = Math.round(f),
+ i = Math.round(g);
+ (b.style.display = "none"), this.clear();
+ for (var j = 0; e > j; j++)
+ for (var k = 0; e > k; k++) {
+ var l = a.isDark(j, k),
+ m = k * f,
+ n = j * g;
+ (c.strokeStyle = l
+ ? d.colorDark
+ : d.colorLight),
+ (c.lineWidth = 1),
+ (c.fillStyle = l
+ ? d.colorDark
+ : d.colorLight),
+ c.fillRect(m, n, f, g),
+ c.strokeRect(
+ Math.floor(m) + 0.5,
+ Math.floor(n) + 0.5,
+ h,
+ i,
+ ),
+ c.strokeRect(
+ Math.ceil(m) - 0.5,
+ Math.ceil(n) - 0.5,
+ h,
+ i,
+ );
+ }
+ this._bIsPainted = !0;
+ }),
+ (e.prototype.makeImage = function () {
+ this._bIsPainted && d.call(this, a);
+ }),
+ (e.prototype.isPainted = function () {
+ return this._bIsPainted;
+ }),
+ (e.prototype.clear = function () {
+ this._oContext.clearRect(
+ 0,
+ 0,
+ this._elCanvas.width,
+ this._elCanvas.height,
+ ),
+ (this._bIsPainted = !1);
+ }),
+ (e.prototype.round = (a) =>
+ a ? Math.floor(1e3 * a) / 1e3 : a),
+ e
+ );
+ })()
+ : (() => {
+ var a = function (a, b) {
+ (this._el = a), (this._htOption = b);
+ };
+ return (
+ (a.prototype.draw = function (a) {
+ for (
+ var b = this._htOption,
+ c = this._el,
+ d = a.getModuleCount(),
+ e = Math.floor(b.width / d),
+ f = Math.floor(b.height / d),
+ g = [
+ '',
+ ],
+ h = 0;
+ d > h;
+ h++
+ ) {
+ g.push("");
+ for (var i = 0; d > i; i++)
+ g.push(
+ ' | ',
+ );
+ g.push("
");
+ }
+ g.push("
"), (c.innerHTML = g.join(""));
+ var j = c.childNodes[0],
+ k = (b.width - j.offsetWidth) / 2,
+ l = (b.height - j.offsetHeight) / 2;
+ k > 0 &&
+ l > 0 &&
+ (j.style.margin = l + "px " + k + "px");
+ }),
+ (a.prototype.clear = function () {
+ this._el.innerHTML = "";
+ }),
+ a
+ );
+ })();
+ (QRCode = function (a, b) {
+ if (
+ ((this._htOption = {
+ width: 256,
+ height: 256,
+ typeNumber: 4,
+ colorDark: "#000000",
+ colorLight: "#ffffff",
+ correctLevel: d.H,
+ }),
+ "string" == typeof b && (b = { text: b }),
+ b)
+ )
+ for (var c in b) this._htOption[c] = b[c];
+ "string" == typeof a && (a = document.getElementById(a)),
+ (this._android = n()),
+ (this._el = a),
+ (this._oQRCode = null),
+ (this._oDrawing = new q(this._el, this._htOption)),
+ this._htOption.text && this.makeCode(this._htOption.text);
+ }),
+ (QRCode.prototype.makeCode = function (a) {
+ (this._oQRCode = new b(
+ r(a, this._htOption.correctLevel),
+ this._htOption.correctLevel,
+ )),
+ this._oQRCode.addData(a),
+ this._oQRCode.make(),
+ (this._el.title = a),
+ this._oDrawing.draw(this._oQRCode),
+ this.makeImage();
+ }),
+ (QRCode.prototype.makeImage = function () {
+ "function" == typeof this._oDrawing.makeImage &&
+ (!this._android || this._android >= 3) &&
+ this._oDrawing.makeImage();
+ }),
+ (QRCode.prototype.clear = function () {
+ this._oDrawing.clear();
+ }),
+ (QRCode.CorrectLevel = d);
+})();
diff --git a/cardie/static/main/scripts/global/background_blur.js b/cardie/static/main/scripts/global/background_blur.js
index 208f328..c706081 100644
--- a/cardie/static/main/scripts/global/background_blur.js
+++ b/cardie/static/main/scripts/global/background_blur.js
@@ -1,7 +1,7 @@
-function show_background_blur() {
+function show_background_blur() {
document.querySelector(".background_blur").style.display = "flex";
- setTimeout(function() {
+ setTimeout(() => {
document.querySelector(".background_blur").classList.add("show");
}, 10);
}
@@ -10,7 +10,7 @@ function hide_background_blur() {
// TODO: This doesn't seem to animate correctly
document.querySelector(".background_blur").classList.remove("show");
- setTimeout(function() {
+ setTimeout(() => {
document.querySelector(".background_blur").style.display = "none";
}, 500);
-}
\ No newline at end of file
+}
diff --git a/cardie/static/main/scripts/global/card.js b/cardie/static/main/scripts/global/card.js
index 3e0ec2e..1488a2d 100644
--- a/cardie/static/main/scripts/global/card.js
+++ b/cardie/static/main/scripts/global/card.js
@@ -4,43 +4,48 @@ var cards = document.getElementsByClassName("card_card");
var card_items = [];
for (let i = 0; i < cards.length; i++) {
- cards[i].addEventListener("click", function() {
+ cards[i].addEventListener("click", () => {
cards[i].classList.toggle("card_flipped");
});
}
-var card_i_style = document.createElement('style');
-card_i_style.type = 'text/css';
-document.getElementsByTagName('head')[0].appendChild(card_i_style);
+var card_i_style = document.createElement("style");
+card_i_style.type = "text/css";
+document.getElementsByTagName("head")[0].appendChild(card_i_style);
-var card_p_style = document.createElement('style');
-card_p_style.type = 'text/css';
-document.getElementsByTagName('head')[0].appendChild(card_p_style);
+var card_p_style = document.createElement("style");
+card_p_style.type = "text/css";
+document.getElementsByTagName("head")[0].appendChild(card_p_style);
// Functions for adding elements to the card
function card_delete_items(card_selector) {
- card_items = []
+ card_items = [];
document.querySelector(`${card_selector} .card_items`).replaceChildren();
document.querySelector(`#dialog_card_menu_items`).replaceChildren();
}
function card_create_text_item(card_selector, uuid, icon, text) {
- let existing_selector = card_items.find(entry => entry.selector === card_selector);
+ let existing_selector = card_items.find(
+ (entry) => entry.selector === card_selector,
+ );
if (existing_selector) {
- existing_selector.items.push({"uuid": uuid, "text": text});
+ existing_selector.items.push({ uuid: uuid, text: text });
} else {
- card_items.push({selector: card_selector, items: [{"uuid": uuid, "text": text}]});
- existing_selector = {items: []};
+ card_items.push({
+ selector: card_selector,
+ items: [{ uuid: uuid, text: text }],
+ });
+ existing_selector = { items: [] };
}
- let div = document.createElement("div");
+ const div = document.createElement("div");
div.classList.add("card_item_text");
- div.setAttribute("uuid", uuid)
+ div.setAttribute("uuid", uuid);
- let icon_element = document.createElement("i");
+ const icon_element = document.createElement("i");
icon_element.className = `ph-bold ${icon}`;
- let text_element = document.createElement("p");
+ const text_element = document.createElement("p");
text_element.innerText = text;
div.appendChild(icon_element);
@@ -48,10 +53,9 @@ function card_create_text_item(card_selector, uuid, icon, text) {
if (existing_selector.items.length <= 7) {
document.querySelector(`${card_selector} .card_items`).appendChild(div);
-
} else {
- if (!(document.querySelector("#dialog_card_menu_button"))) {
- let menu_button = document.createElement("button")
+ if (!document.querySelector("#dialog_card_menu_button")) {
+ const menu_button = document.createElement("button");
menu_button.id = "dialog_card_menu_button";
menu_button.innerHTML = ` View more items...`;
@@ -60,46 +64,52 @@ function card_create_text_item(card_selector, uuid, icon, text) {
document.querySelector("#dialog_card_menu").showModal();
});
- document.querySelector(`${card_selector} .card_items`).appendChild(menu_button);
+ document
+ .querySelector(`${card_selector} .card_items`)
+ .appendChild(menu_button);
}
-
+
document.querySelector(`#dialog_card_menu_items`).appendChild(div);
}
}
function card_create_link_item(card_selector, uuid, icon, text, url) {
- let existing_selector = card_items.find(entry => entry.selector === card_selector);
+ let existing_selector = card_items.find(
+ (entry) => entry.selector === card_selector,
+ );
if (existing_selector) {
- existing_selector.items.push({"uuid": uuid, "text": text});
+ existing_selector.items.push({ uuid: uuid, text: text });
} else {
- card_items.push({selector: card_selector, items: [{"uuid": uuid, "text": text}]});
- existing_selector = {items: []};
+ card_items.push({
+ selector: card_selector,
+ items: [{ uuid: uuid, text: text }],
+ });
+ existing_selector = { items: [] };
}
- let div = document.createElement("div");
+ const div = document.createElement("div");
div.classList.add("card_item_link");
- div.setAttribute("uuid", uuid)
+ div.setAttribute("uuid", uuid);
- let icon_element = document.createElement("i");
+ const icon_element = document.createElement("i");
icon_element.className = `ph-bold ${icon}`;
- let button_element = document.createElement("button");
+ const button_element = document.createElement("button");
button_element.innerText = text;
button_element.addEventListener("click", (event) => {
event.stopPropagation();
window.location.href = url;
- })
+ });
div.appendChild(icon_element);
div.appendChild(button_element);
if (existing_selector.items.length <= 7) {
document.querySelector(`${card_selector} .card_items`).appendChild(div);
-
} else {
- if (!(document.querySelector("#dialog_card_menu_button"))) {
- let menu_button = document.createElement("button")
+ if (!document.querySelector("#dialog_card_menu_button")) {
+ const menu_button = document.createElement("button");
menu_button.id = "dialog_card_menu_button";
menu_button.innerHTML = ` View more items...`;
@@ -108,16 +118,22 @@ function card_create_link_item(card_selector, uuid, icon, text, url) {
document.querySelector("#dialog_card_menu").showModal();
});
- document.querySelector(`${card_selector} .card_items`).appendChild(menu_button);
+ document
+ .querySelector(`${card_selector} .card_items`)
+ .appendChild(menu_button);
}
-
+
document.querySelector(`#dialog_card_menu_items`).appendChild(div);
}
}
function card_set_colors(card_selector, background, accent, text) {
- document.querySelector(`${card_selector} .card_card_front`).style.backgroundColor = background;
- document.querySelector(`${card_selector} .card_card_back`).style.backgroundColor = background;
+ document.querySelector(
+ `${card_selector} .card_card_front`,
+ ).style.backgroundColor = background;
+ document.querySelector(
+ `${card_selector} .card_card_back`,
+ ).style.backgroundColor = background;
card_i_style.innerHTML = `${card_selector} i { color: ${accent} }`;
card_p_style.innerHTML = `${card_selector} p { color: ${text} }`;
@@ -129,39 +145,55 @@ function card_render_from_json(card_selector, json) {
json = JSON.parse(json);
card_delete_items(card_selector);
- document.querySelector(`${card_selector} .card_top_text_username`).innerText = json["details"]["primary"];
- document.querySelector(`${card_selector} .card_top_text_pronouns`).innerText = json["details"]["secondary"];
-
- card_set_colors(card_selector, json["colors"]["background"], json["colors"]["accent"], json["colors"]["text"])
+ document.querySelector(
+ `${card_selector} .card_top_text_username`,
+ ).innerText = json["details"]["primary"];
+ document.querySelector(
+ `${card_selector} .card_top_text_pronouns`,
+ ).innerText = json["details"]["secondary"];
+
+ card_set_colors(
+ card_selector,
+ json["colors"]["background"],
+ json["colors"]["accent"],
+ json["colors"]["text"],
+ );
card_set_layout(card_selector, json["layout"]);
card_set_font(card_selector, json["font_style"]);
for (const item in json["information"]["items"]) {
if (json["information"]["items"][item]["url_enabled"]) {
- card_create_link_item(card_selector, json["information"]["items"][item]["uuid"], json["information"]["items"][item]["icon"], json["information"]["items"][item]["text"], json["information"]["items"][item]["url"]);
-
+ card_create_link_item(
+ card_selector,
+ json["information"]["items"][item]["uuid"],
+ json["information"]["items"][item]["icon"],
+ json["information"]["items"][item]["text"],
+ json["information"]["items"][item]["url"],
+ );
} else {
- card_create_text_item(card_selector, json["information"]["items"][item]["uuid"], json["information"]["items"][item]["icon"], json["information"]["items"][item]["text"]);
+ card_create_text_item(
+ card_selector,
+ json["information"]["items"][item]["uuid"],
+ json["information"]["items"][item]["icon"],
+ json["information"]["items"][item]["text"],
+ );
}
}
}
function card_set_layout(card_selector, layout) {
// layout can be "left", "right", "center"
- let card = document.querySelector(`${card_selector} .card_card_front`);
+ const card = document.querySelector(`${card_selector} .card_card_front`);
if (layout == "left") {
card.setAttribute("card-align", "left");
-
} else if (layout == "right") {
card.setAttribute("card-align", "right");
-
} else if (layout == "center") {
- card.setAttribute("card-align", "center")
-
- } else if (layout == "") { // Default value in databases
+ card.setAttribute("card-align", "center");
+ } else if (layout == "") {
+ // Default value in databases
card.setAttribute("card-align", "left");
-
} else {
log("WARNING", "The card layout parameter is not an accepted value");
}
@@ -172,9 +204,13 @@ function card_set_font(card_selector, name) {
load_font(font_style["header"]["name"], font_style["header"]["url"]);
load_font(font_style["text"]["name"], font_style["text"]["url"]);
- let primary_top = document.querySelector(`${card_selector} .card_top_text_username`);
- let secondary_top = document.querySelector(`${card_selector} .card_top_text_pronouns`);
- let items = document.querySelector(`${card_selector} .card_items`);
+ const primary_top = document.querySelector(
+ `${card_selector} .card_top_text_username`,
+ );
+ const secondary_top = document.querySelector(
+ `${card_selector} .card_top_text_pronouns`,
+ );
+ const items = document.querySelector(`${card_selector} .card_items`);
primary_top.style.fontFamily = font_style["header"]["name"];
secondary_top.style.fontFamily = font_style["text"]["name"];
@@ -184,9 +220,9 @@ function card_set_font(card_selector, name) {
}
for (let i = 0; i < cards.length; i++) {
- let outer = cards[i],
- maxWidth = outer.clientWidth,
- maxHeight = outer.clientHeight;
+ const outer = cards[i],
+ maxWidth = outer.clientWidth,
+ maxHeight = outer.clientHeight;
window.addEventListener("resize", resize);
@@ -194,22 +230,27 @@ for (let i = 0; i < cards.length; i++) {
function resize() {
let scale,
- width = window.innerWidth,
- height = window.innerHeight,
- isMax = width >= maxWidth && height >= maxHeight;
+ width = window.innerWidth,
+ height = window.innerHeight,
+ isMax = width >= maxWidth && height >= maxHeight;
scale = Math.min(width / maxWidth, height / maxHeight);
- outer.style.transform = isMax ? '' : 'scale(' + scale + ')';
+ outer.style.transform = isMax ? "" : "scale(" + scale + ")";
}
}
-window.addEventListener('setFontOnCard', (event) => { // Called when a font item is clicked in the editor
+window.addEventListener("setFontOnCard", (event) => {
+ // Called when a font item is clicked in the editor
event.stopImmediatePropagation();
const { header, text, style_name } = event.detail;
card_set_font(".card_card", style_name);
font_style = style_name;
});
-document.querySelector("#dialog_card_menu > .ui_dialog_generic_top > .ui_dialog_generic_top_close").addEventListener("click", (event) => {
- document.querySelector("#dialog_card_menu").close();
-});
\ No newline at end of file
+document
+ .querySelector(
+ "#dialog_card_menu > .ui_dialog_generic_top > .ui_dialog_generic_top_close",
+ )
+ .addEventListener("click", (event) => {
+ document.querySelector("#dialog_card_menu").close();
+ });
diff --git a/cardie/static/main/scripts/global/favicon.js b/cardie/static/main/scripts/global/favicon.js
index cf3b4be..f0a89b1 100644
--- a/cardie/static/main/scripts/global/favicon.js
+++ b/cardie/static/main/scripts/global/favicon.js
@@ -4,10 +4,10 @@ const favicon_light_url = window.__CONFIG__.favicon.light;
const favicon_dark_url = window.__CONFIG__.favicon.dark;
function createFavIconElement() {
- const link = document.createElement("link");
- link.rel = "icon";
- document.head.appendChild(link);
- return link;
+ const link = document.createElement("link");
+ link.rel = "icon";
+ document.head.appendChild(link);
+ return link;
}
/**
*
@@ -15,37 +15,37 @@ function createFavIconElement() {
* @param {string} dark
*/
function handle_favicon(light, dark) {
- /**
- * @type {HTMLLinkElement}
- */
- const iconElement =
- document.querySelector("link[rel~='icon']") ?? createFavIconElement();
-
- /**
- * @param {boolean} isDark
- * @returns {void}
- * @description This function changes the favicon based on the color scheme
- */
- function handleColorScheme(isDark) {
- iconElement.href = isDark ? light : dark;
- }
-
- /**
- * @param {MediaQueryListEvent} event
- * @returns {void}
- * @description This function is called when the color scheme changes and passes the new color scheme in the event.matches property
- */
- function colorSchemeListener(event) {
- handleColorScheme(event.matches);
- }
-
- const colorSchemaMediaQuery = window.matchMedia(
- "(prefers-color-scheme: dark)",
- );
-
- colorSchemaMediaQuery.addEventListener("change", colorSchemeListener);
-
- handleColorScheme(colorSchemaMediaQuery.matches);
+ /**
+ * @type {HTMLLinkElement}
+ */
+ const iconElement =
+ document.querySelector("link[rel~='icon']") ?? createFavIconElement();
+
+ /**
+ * @param {boolean} isDark
+ * @returns {void}
+ * @description This function changes the favicon based on the color scheme
+ */
+ function handleColorScheme(isDark) {
+ iconElement.href = isDark ? light : dark;
+ }
+
+ /**
+ * @param {MediaQueryListEvent} event
+ * @returns {void}
+ * @description This function is called when the color scheme changes and passes the new color scheme in the event.matches property
+ */
+ function colorSchemeListener(event) {
+ handleColorScheme(event.matches);
+ }
+
+ const colorSchemaMediaQuery = window.matchMedia(
+ "(prefers-color-scheme: dark)",
+ );
+
+ colorSchemaMediaQuery.addEventListener("change", colorSchemeListener);
+
+ handleColorScheme(colorSchemaMediaQuery.matches);
}
handle_favicon(favicon_light_url, favicon_dark_url);
diff --git a/cardie/static/main/scripts/global/font_styles.js b/cardie/static/main/scripts/global/font_styles.js
index a74d5d8..7190643 100644
--- a/cardie/static/main/scripts/global/font_styles.js
+++ b/cardie/static/main/scripts/global/font_styles.js
@@ -1,57 +1,72 @@
// This file lists the available font styles to be used for cards
// It will primarily contain the array of font style objects which can then be imported by the editor preview or cardview to allow the font to be changed
-var font_styles = [
- {"name": "Simple",
- "header": {"name": "Noto Sans", "url": "Noto Sans"},
- "text": {"name": "Noto Sans", "url": "Noto Sans"}
+var font_styles = [
+ {
+ name: "Simple",
+ header: { name: "Noto Sans", url: "Noto Sans" },
+ text: { name: "Noto Sans", url: "Noto Sans" },
},
- {"name": "Modern",
- "header": {"name": "Bebas Neue", "url": "https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap"},
- "text": {"name": "Noto Sans", "url": "Noto Sans"}
+ {
+ name: "Modern",
+ header: {
+ name: "Bebas Neue",
+ url: "https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap",
+ },
+ text: { name: "Noto Sans", url: "Noto Sans" },
},
- {"name": "Fancy",
- "header": {"name": "Roboto Slab", "url": "https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@100..900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"},
- "text": {"name": "EB Garamond", "url": "https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400..800;1,400..800&display=swap"}
+ {
+ name: "Fancy",
+ header: {
+ name: "Roboto Slab",
+ url: "https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@100..900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap",
+ },
+ text: {
+ name: "EB Garamond",
+ url: "https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400..800;1,400..800&display=swap",
+ },
},
];
function get_font_style(name) {
- return(font_styles.find(font => font.name == name));
+ return font_styles.find((font) => font.name == name);
}
async function load_font(name, url) {
if (url.includes("https://") || url.includes("http://")) {
load_font_css(url);
log("INFO", `Loaded font ${name}`);
-
} else {
- log("INFO", `Not loading font ${name} because it doesn't have a web url.`);
+ log(
+ "INFO",
+ `Not loading font ${name} because it doesn't have a web url.`,
+ );
}
-
}
async function load_font_css(url) {
- let cssId = url;
+ const cssId = url;
if (!document.getElementById(cssId)) {
- let link = document.createElement('link');
- link.id = cssId;
- link.rel = 'stylesheet';
- link.type = 'text/css';
+ const link = document.createElement("link");
+ link.id = cssId;
+ link.rel = "stylesheet";
+ link.type = "text/css";
link.href = url;
- link.media = 'all';
- document.getElementsByTagName('head')[0].appendChild(link);
+ link.media = "all";
+ document.getElementsByTagName("head")[0].appendChild(link);
}
}
document.addEventListener("DOMContentLoaded", (event) => {
- window.dispatchEvent(new CustomEvent('sendFontStyles', {
- detail: { font_styles }
- }));
+ window.dispatchEvent(
+ new CustomEvent("sendFontStyles", {
+ detail: { font_styles },
+ }),
+ );
});
-window.addEventListener('loadFont', (event) => {
+window.addEventListener("loadFont", (event) => {
event.stopImmediatePropagation();
const { font_name, font_url } = event.detail;
load_font(font_name, font_url);
-});
\ No newline at end of file
+});
diff --git a/cardie/static/main/scripts/global/logging.js b/cardie/static/main/scripts/global/logging.js
index e24a0ff..dca0b54 100644
--- a/cardie/static/main/scripts/global/logging.js
+++ b/cardie/static/main/scripts/global/logging.js
@@ -5,51 +5,57 @@ var LOG_LEVEL = "DEBUG";
function log_level_to_number(level) {
if (level == "DEBUG") {
return 1;
-
} else if (level == "INFO") {
return 2;
-
} else if (level == "WARNING") {
return 3;
-
} else if (level == "CRITICAL") {
return 4;
-
} else {
return 0;
}
}
function log_date() {
- const options = { hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: false, "timeZone": "EST" };
- var now = new Date;
+ const options = {
+ hour: "2-digit",
+ minute: "2-digit",
+ second: "2-digit",
+ hour12: false,
+ timeZone: "EST",
+ };
+ var now = new Date();
var string = now.toLocaleTimeString("en-us", options);
return string;
}
function log(level, text) {
- let log_level = log_level_to_number(level);
- let allowed_log_level = log_level_to_number(LOG_LEVEL);
- let date = log_date();
+ const log_level = log_level_to_number(level);
+ const allowed_log_level = log_level_to_number(LOG_LEVEL);
+ const date = log_date();
if (log_level >= allowed_log_level) {
if (log_level == 0) {
- console.log(`%c[${date}] ${text}`, "color: #a1a1a1; font-style: italic;");
-
+ console.log(
+ `%c[${date}] ${text}`,
+ "color: #a1a1a1; font-style: italic;",
+ );
} else if (log_level == 1) {
console.debug(`%c[${date}] ${text}`, "color: #ffffff;");
-
} else if (log_level == 2) {
console.info(`%c[${date}] ${text}`, "color: #7fb5ff;");
-
} else if (log_level == 3) {
- console.warn(`%c[${date}] ${text}`, "color: #ffa371; font-weight: bold;");
-
+ console.warn(
+ `%c[${date}] ${text}`,
+ "color: #ffa371; font-weight: bold;",
+ );
} else if (log_level == 4) {
- console.error(`%c[${date}] ${text}`, "color: #ff7878; font-weight: bold;");
-
+ console.error(
+ `%c[${date}] ${text}`,
+ "color: #ff7878; font-weight: bold;",
+ );
}
} else {
null;
}
-}
\ No newline at end of file
+}
diff --git a/cardie/static/main/scripts/global/notifications.js b/cardie/static/main/scripts/global/notifications.js
index f26bd26..7e3b7de 100644
--- a/cardie/static/main/scripts/global/notifications.js
+++ b/cardie/static/main/scripts/global/notifications.js
@@ -1,22 +1,22 @@
-let notification_box = document.createElement("div");
+const notification_box = document.createElement("div");
notification_box.classList.add("notifications");
document.body.appendChild(notification_box);
function create_notification(header, body, icon) {
- let notification = document.createElement("div");
+ const notification = document.createElement("div");
notification.classList.add("notification");
-
- let notification_icon = document.createElement("i");
+
+ const notification_icon = document.createElement("i");
notification_icon.className = `ph-bold ph-${icon} notification_icon`;
- let notification_text = document.createElement("div");
- notification_text.classList.add("notification_text")
+ const notification_text = document.createElement("div");
+ notification_text.classList.add("notification_text");
- let notification_header = document.createElement("p");
+ const notification_header = document.createElement("p");
notification_header.classList.add("notification_header");
notification_header.innerText = header;
- let notification_body = document.createElement("p");
+ const notification_body = document.createElement("p");
notification_body.classList.add("notification_body");
notification_body.innerText = body;
@@ -28,15 +28,15 @@ function create_notification(header, body, icon) {
document.querySelector(".notifications").appendChild(notification);
- setTimeout(function() {
+ setTimeout(() => {
notification.classList.add("show");
- }, 100)
+ }, 100);
- setTimeout(function() {
+ setTimeout(() => {
notification.classList.remove("show");
- setTimeout(function() {
+ setTimeout(() => {
notification.remove();
}, 300);
}, 5000);
-}
\ No newline at end of file
+}
diff --git a/cardie/static/main/scripts/home/home.js b/cardie/static/main/scripts/home/home.js
index aaceeaf..20df54c 100644
--- a/cardie/static/main/scripts/home/home.js
+++ b/cardie/static/main/scripts/home/home.js
@@ -1,6 +1,9 @@
-
function home_card_edit(event) {
- let uuid = event.target.closest(".home_card").querySelector(":scope > .home_card_text > .home_card_text_uuid").innerText;
+ const uuid = event.target
+ .closest(".home_card")
+ .querySelector(
+ ":scope > .home_card_text > .home_card_text_uuid",
+ ).innerText;
window.location.href = server_ip + "/editor" + `?uuid=${uuid}&`;
}
@@ -8,76 +11,80 @@ var open_home_card_uuid;
var open_home_card_target;
function home_card_menu(event) {
- let home_card = event.target.closest(".home_card");
+ const home_card = event.target.closest(".home_card");
if (home_card.getAttribute("open") == "false") {
home_card.style.position = "relative";
home_card.style.zIndex = "3";
home_card.style.scale = "1.05";
show_background_blur();
- home_card.querySelector(".home_card_menu_button > i").className = "ph-bold ph-x-circle";
+ home_card.querySelector(".home_card_menu_button > i").className =
+ "ph-bold ph-x-circle";
home_card.setAttribute("open", true);
document.querySelector("#home_card_menu").style.display = "flex";
const rect = home_card.getBoundingClientRect();
- document.querySelector("#home_card_menu").style.top = `${rect.bottom + 10}px`;
- document.querySelector("#home_card_menu").style.left = `${rect.right - document.querySelector("#home_card_menu").offsetWidth}px`;
+ document.querySelector("#home_card_menu").style.top =
+ `${rect.bottom + 10}px`;
+ document.querySelector("#home_card_menu").style.left =
+ `${rect.right - document.querySelector("#home_card_menu").offsetWidth}px`;
- setTimeout(function() {
+ setTimeout(() => {
document.querySelector("#home_card_menu").classList.add("show");
}, 50);
- open_home_card_uuid = home_card.querySelector(".home_card_text_uuid").innerText;
+ open_home_card_uuid = home_card.querySelector(
+ ".home_card_text_uuid",
+ ).innerText;
open_home_card_target = home_card;
-
} else {
- home_card.querySelector(".home_card_menu_button > i").className = "ph-bold ph-dots-three";
+ home_card.querySelector(".home_card_menu_button > i").className =
+ "ph-bold ph-dots-three";
home_card.style.scale = "1";
document.querySelector("#home_card_menu").classList.remove("show");
hide_background_blur();
- setTimeout(function() {
+ setTimeout(() => {
home_card.style.zIndex = "1";
home_card.setAttribute("open", "false");
document.querySelector("#home_card_menu").style.display = "none";
}, 500);
}
-
}
function create_home_card(uuid, name) {
- let div = document.createElement("div");
+ const div = document.createElement("div");
div.classList.add("home_card");
- let edit_button = document.createElement("button");
+ const edit_button = document.createElement("button");
edit_button.classList.add("ui_button_icon");
- edit_button.classList.add("home_card_edit_button")
+ edit_button.classList.add("home_card_edit_button");
- let edit_button_icon = document.createElement("i");
+ const edit_button_icon = document.createElement("i");
edit_button_icon.className = "ph-bold ph-pencil-simple-line";
edit_button.appendChild(edit_button_icon);
edit_button.addEventListener("click", (event) => home_card_edit(event));
- let menu_button = document.createElement("button");
+ const menu_button = document.createElement("button");
menu_button.classList.add("ui_button_icon");
- menu_button.classList.add("home_card_menu_button")
+ menu_button.classList.add("home_card_menu_button");
- let menu_button_icon = document.createElement("i");
+ const menu_button_icon = document.createElement("i");
menu_button_icon.className = "ph-bold ph-dots-three";
menu_button.appendChild(menu_button_icon);
menu_button.addEventListener("click", (event) => home_card_menu(event));
- let text_div = document.createElement("div");
+ const text_div = document.createElement("div");
text_div.classList.add("home_card_text");
- let text_name = document.createElement("p");
+ const text_name = document.createElement("p");
text_name.classList.add("home_card_text_name");
text_name.innerText = name;
- let text_uuid = document.createElement("p");
+ const text_uuid = document.createElement("p");
text_uuid.classList.add("home_card_text_uuid");
text_uuid.innerText = uuid;
@@ -94,37 +101,39 @@ function create_home_card(uuid, name) {
}
function create_wallet_card(uuid, name) {
- let div = document.createElement("div");
+ const div = document.createElement("div");
div.classList.add("home_card");
- let view_button = document.createElement("button");
+ const view_button = document.createElement("button");
view_button.classList.add("ui_button_icon");
- view_button.classList.add("home_wallet_view_button")
+ view_button.classList.add("home_wallet_view_button");
- let view_button_icon = document.createElement("i");
+ const view_button_icon = document.createElement("i");
view_button_icon.className = "ph-bold ph-arrow-circle-right";
view_button.appendChild(view_button_icon);
view_button.addEventListener("click", (event) => home_wallet_view(event));
- let remove_button = document.createElement("button");
+ const remove_button = document.createElement("button");
remove_button.classList.add("ui_button_icon");
- remove_button.classList.add("home_wallet_remove_button")
+ remove_button.classList.add("home_wallet_remove_button");
- let remove_button_icon = document.createElement("i");
+ const remove_button_icon = document.createElement("i");
remove_button_icon.className = "ph-bold ph-trash";
remove_button.appendChild(remove_button_icon);
- remove_button.addEventListener("click", (event) => home_wallet_remove(event));
+ remove_button.addEventListener("click", (event) =>
+ home_wallet_remove(event),
+ );
- let text_div = document.createElement("div");
+ const text_div = document.createElement("div");
text_div.classList.add("home_card_text");
- let text_name = document.createElement("p");
+ const text_name = document.createElement("p");
text_name.classList.add("home_card_text_name");
text_name.innerText = name;
- let text_uuid = document.createElement("p");
+ const text_uuid = document.createElement("p");
text_uuid.classList.add("home_card_text_uuid");
text_uuid.innerText = uuid;
@@ -141,33 +150,55 @@ function create_wallet_card(uuid, name) {
}
function home_wallet_view(event) {
- let uuid = event.target.closest(".home_card").querySelector(":scope > .home_card_text > .home_card_text_uuid").innerText;
- window.location.href = server_ip + "/card" + `?uuid=${uuid}&from_wallet=true`;
+ const uuid = event.target
+ .closest(".home_card")
+ .querySelector(
+ ":scope > .home_card_text > .home_card_text_uuid",
+ ).innerText;
+ window.location.href =
+ server_ip + "/card" + `?uuid=${uuid}&from_wallet=true`;
}
async function home_wallet_remove(event) {
const response = await fetch(server_ip + "/removefromwallet", {
method: "POST",
headers: {
- "uuid": event.target.closest(".home_card").querySelector(":scope > .home_card_text > .home_card_text_uuid").innerText
- }
+ uuid: event.target
+ .closest(".home_card")
+ .querySelector(
+ ":scope > .home_card_text > .home_card_text_uuid",
+ ).innerText,
+ },
});
- response.text().then(function (text) {
+ response.text().then((text) => {
if (text == "Request is not a POST request") {
- create_notification("There was a problem removing that card from your wallet", text, "warning");
+ create_notification(
+ "There was a problem removing that card from your wallet",
+ text,
+ "warning",
+ );
log("WARNING", text);
-
} else if (text == "Not signed in") {
- create_notification("There was a problem removing that card from your wallet", text, "warning");
+ create_notification(
+ "There was a problem removing that card from your wallet",
+ text,
+ "warning",
+ );
log("WARNING", text);
-
} else if (text == "Success") {
- create_notification("Card removed from wallet", "The card has been removed from your wallet", "check-circle");
+ create_notification(
+ "Card removed from wallet",
+ "The card has been removed from your wallet",
+ "check-circle",
+ );
window.location.reload();
-
} else {
- create_notification("There was a problem removing that card from your wallet", "There was an unknown issue", "warning");
+ create_notification(
+ "There was a problem removing that card from your wallet",
+ "There was an unknown issue",
+ "warning",
+ );
log("WARNING", "There was an unknown issue: " + text);
}
});
@@ -177,15 +208,18 @@ async function list_cards() {
const response = await fetch(server_ip + "/listcards", {
method: "POST",
headers: {
- "Username": username,
- }
+ Username: username,
+ },
});
- response.text().then(function (text) {
+ response.text().then((text) => {
if (text == "Request is not a POST request") {
- create_notification("There was a problem listing your cards", text, "warning");
+ create_notification(
+ "There was a problem listing your cards",
+ text,
+ "warning",
+ );
return false;
-
} else {
text = JSON.parse(text);
for (const card in text) {
@@ -200,11 +234,14 @@ async function log_out() {
method: "POST",
});
- response.text().then(function (text) {
+ response.text().then((text) => {
if (text == "Request is not a POST request") {
- create_notification("There was a problem logging out", text, "warning");
+ create_notification(
+ "There was a problem logging out",
+ text,
+ "warning",
+ );
return false;
-
} else {
window.location.href = server_ip + "/authentication";
}
@@ -220,21 +257,24 @@ async function get_wallet() {
method: "POST",
});
- response.text().then(function (text) {
+ response.text().then((text) => {
if (text == "Request is not a POST request") {
log("WARNING", text);
- create_notification("There was a problem getting your wallet", text, "warning");
+ create_notification(
+ "There was a problem getting your wallet",
+ text,
+ "warning",
+ );
return false;
-
} else if (text == "Not signed in") {
log("WARNING", "You're not signed in!");
window.location.href = `${server_ip}/authentication`;
-
} else {
text = JSON.parse(text);
if (!text.length == 0) {
- document.querySelector("#home_wallet_nocards").style.display = "none";
+ document.querySelector("#home_wallet_nocards").style.display =
+ "none";
}
for (const card in text) {
@@ -252,103 +292,168 @@ document.querySelector("#home_menu_edit").addEventListener("click", (event) => {
window.location.href = `${server_ip}/editor?uuid=${open_home_card_uuid}&`;
});
-document.querySelector("#home_menu_rename").addEventListener("click", (event) => {
- document.querySelector("#dialog_home_rename_input").value = open_home_card_target.querySelector(".home_card_text > .home_card_text_name").innerText;
- document.querySelector("#dialog_home_rename").showModal();
-});
-
-document.querySelector("#dialog_home_rename > .ui_dialog_generic_top > .ui_dialog_generic_top_close").addEventListener("click", (event) => {
- document.querySelector("#dialog_home_rename").close();
-});
-
-document.querySelector("#dialog_home_rename_submit").addEventListener("click", async (event) => {
- const response = await fetch(server_ip + "/renamecard", {
- method: "POST",
- headers: {
- "uuid": open_home_card_uuid,
- "name": document.querySelector("#dialog_home_rename_input").value
- }
+document
+ .querySelector("#home_menu_rename")
+ .addEventListener("click", (event) => {
+ document.querySelector("#dialog_home_rename_input").value =
+ open_home_card_target.querySelector(
+ ".home_card_text > .home_card_text_name",
+ ).innerText;
+ document.querySelector("#dialog_home_rename").showModal();
});
- response.text().then(function (text) {
- if (text == "Request is not a POST request") {
- create_notification("There was a problem renaming your card", text, "warning");
- log("WARNING", text)
-
- } else if (text == "Missing headers") {
- create_notification("There was a problem renaming your card", text, "warning");
- log("WARNING", text);
-
- } else if (text == "Card not found") {
- create_notification("There was a problem renaming your card", text, "warning");
- log("WARNING", text);
-
- } else if (text == "Success") {
- create_notification("Card deleted", "Your card has been renaming", "check-circle");
- log("INFO", "Card renamed");
- window.location.reload();
-
- } else {
- create_notification("There was a problem", "There was an unknown problem renaming your card", "warning");
- log("WARNING", "There was an unknown problem renaming the card");
- }
+document
+ .querySelector(
+ "#dialog_home_rename > .ui_dialog_generic_top > .ui_dialog_generic_top_close",
+ )
+ .addEventListener("click", (event) => {
+ document.querySelector("#dialog_home_rename").close();
});
-});
-
-document.querySelector("#home_menu_copylink").addEventListener("click", async (event) => {
- await navigator.clipboard.writeText(`${server_ip}/card?uuid=${open_home_card_uuid}&`).then(() => {
- event.target.closest(".ui_button_small").style.color = "#5dca63";
- setInterval( () => {
- event.target.closest(".ui_button_small").style.color = "#ffffff";
- }, 1000);
+document
+ .querySelector("#dialog_home_rename_submit")
+ .addEventListener("click", async (event) => {
+ const response = await fetch(server_ip + "/renamecard", {
+ method: "POST",
+ headers: {
+ uuid: open_home_card_uuid,
+ name: document.querySelector("#dialog_home_rename_input").value,
+ },
+ });
+
+ response.text().then((text) => {
+ if (text == "Request is not a POST request") {
+ create_notification(
+ "There was a problem renaming your card",
+ text,
+ "warning",
+ );
+ log("WARNING", text);
+ } else if (text == "Missing headers") {
+ create_notification(
+ "There was a problem renaming your card",
+ text,
+ "warning",
+ );
+ log("WARNING", text);
+ } else if (text == "Card not found") {
+ create_notification(
+ "There was a problem renaming your card",
+ text,
+ "warning",
+ );
+ log("WARNING", text);
+ } else if (text == "Success") {
+ create_notification(
+ "Card deleted",
+ "Your card has been renaming",
+ "check-circle",
+ );
+ log("INFO", "Card renamed");
+ window.location.reload();
+ } else {
+ create_notification(
+ "There was a problem",
+ "There was an unknown problem renaming your card",
+ "warning",
+ );
+ log(
+ "WARNING",
+ "There was an unknown problem renaming the card",
+ );
+ }
+ });
});
-});
-document.querySelector("#home_menu_delete").addEventListener("click", (event) => {
- document.querySelector("#dialog_home_delete").showModal();
-});
-
-document.querySelector("#dialog_home_delete > .ui_dialog_generic_top > .ui_dialog_generic_top_close").addEventListener("click", (event) => {
- document.querySelector("#dialog_home_delete").close();
-});
-
-document.querySelector("#dialog_home_delete_cancel").addEventListener("click", (event) => {
- document.querySelector("#dialog_home_delete").close();
-});
-
-document.querySelector("#dialog_home_delete_delete").addEventListener("click", async (event) => {
- const response = await fetch(server_ip + "/deletecard", {
- method: "POST",
- headers: {
- "uuid": open_home_card_uuid
- }
+document
+ .querySelector("#home_menu_copylink")
+ .addEventListener("click", async (event) => {
+ await navigator.clipboard
+ .writeText(`${server_ip}/card?uuid=${open_home_card_uuid}&`)
+ .then(() => {
+ event.target.closest(".ui_button_small").style.color =
+ "#5dca63";
+
+ setInterval(() => {
+ event.target.closest(".ui_button_small").style.color =
+ "#ffffff";
+ }, 1000);
+ });
});
- response.text().then(function (text) {
- if (text == "Request is not a POST request") {
- create_notification("There was a problem deleting your card", text, "warning");
- log("WARNING", text)
-
- } else if (text == "Missing headers") {
- create_notification("There was a problem deleting your card", text, "warning");
- log("WARNING", text);
+document
+ .querySelector("#home_menu_delete")
+ .addEventListener("click", (event) => {
+ document.querySelector("#dialog_home_delete").showModal();
+ });
- } else if (text == "Card not found") {
- create_notification("There was a problem deleting your card", text, "warning");
- log("WARNING", text);
+document
+ .querySelector(
+ "#dialog_home_delete > .ui_dialog_generic_top > .ui_dialog_generic_top_close",
+ )
+ .addEventListener("click", (event) => {
+ document.querySelector("#dialog_home_delete").close();
+ });
- } else if (text == "Success") {
- create_notification("Card deleted", "Your card has been deleted", "check-circle");
- log("INFO", "Card deleted");
- window.location.reload();
+document
+ .querySelector("#dialog_home_delete_cancel")
+ .addEventListener("click", (event) => {
+ document.querySelector("#dialog_home_delete").close();
+ });
- } else {
- create_notification("There was a problem", "There was an unknown problem deleting your card", "warning");
- log("WARNING", "There was an unknown problem deleting the card");
- }
+document
+ .querySelector("#dialog_home_delete_delete")
+ .addEventListener("click", async (event) => {
+ const response = await fetch(server_ip + "/deletecard", {
+ method: "POST",
+ headers: {
+ uuid: open_home_card_uuid,
+ },
+ });
+
+ response.text().then((text) => {
+ if (text == "Request is not a POST request") {
+ create_notification(
+ "There was a problem deleting your card",
+ text,
+ "warning",
+ );
+ log("WARNING", text);
+ } else if (text == "Missing headers") {
+ create_notification(
+ "There was a problem deleting your card",
+ text,
+ "warning",
+ );
+ log("WARNING", text);
+ } else if (text == "Card not found") {
+ create_notification(
+ "There was a problem deleting your card",
+ text,
+ "warning",
+ );
+ log("WARNING", text);
+ } else if (text == "Success") {
+ create_notification(
+ "Card deleted",
+ "Your card has been deleted",
+ "check-circle",
+ );
+ log("INFO", "Card deleted");
+ window.location.reload();
+ } else {
+ create_notification(
+ "There was a problem",
+ "There was an unknown problem deleting your card",
+ "warning",
+ );
+ log(
+ "WARNING",
+ "There was an unknown problem deleting the card",
+ );
+ }
+ });
});
-});
list_cards();
-get_wallet();
\ No newline at end of file
+get_wallet();
diff --git a/cardie/static/main/scripts/index/index.js b/cardie/static/main/scripts/index/index.js
index 33a1221..feddcc1 100644
--- a/cardie/static/main/scripts/index/index.js
+++ b/cardie/static/main/scripts/index/index.js
@@ -1,31 +1,39 @@
-
-document.querySelector("#welcome_box_buttons_signin").addEventListener("click", function() {
- window.location.href = server_ip + "/authentication";
-});
-
-document.querySelector("#welcome_box_buttons_sourcecode").addEventListener("click", function() {
- window.location.href = "https://github.com/nfoert/cardie";
-});
-
-document.querySelector("#welcome_box_buttons_demo").addEventListener("click", function() {
- window.location.href = server_ip + "/editor?demo=True&";
-});
-
-document.querySelector("#index_top_account_signin").addEventListener("click", (event) => {
- window.location.href = `${server_ip}/authentication`;
-});
-
-document.querySelector("#index_top_account_home").addEventListener("click", (event) => {
- window.location.href = `${server_ip}/home`;
-
-});
+document
+ .querySelector("#welcome_box_buttons_signin")
+ .addEventListener("click", () => {
+ window.location.href = server_ip + "/authentication";
+ });
+
+document
+ .querySelector("#welcome_box_buttons_sourcecode")
+ .addEventListener("click", () => {
+ window.location.href = "https://github.com/nfoert/cardie";
+ });
+
+document
+ .querySelector("#welcome_box_buttons_demo")
+ .addEventListener("click", () => {
+ window.location.href = server_ip + "/editor?demo=True&";
+ });
+
+document
+ .querySelector("#index_top_account_signin")
+ .addEventListener("click", (event) => {
+ window.location.href = `${server_ip}/authentication`;
+ });
+
+document
+ .querySelector("#index_top_account_home")
+ .addEventListener("click", (event) => {
+ window.location.href = `${server_ip}/home`;
+ });
if (username) {
document.querySelector("#index_top_account_signin").style.display = "none";
- document.querySelector("#index_top_account_home").innerHTML = ` ${username}`;
+ document.querySelector("#index_top_account_home").innerHTML =
+ ` ${username}`;
document.querySelector("#index_top_account_home").style.display = "block";
-
} else {
document.querySelector("#index_top_account_signin").style.display = "block";
document.querySelector("#index_top_account_home").style.display = "none";
-}
\ No newline at end of file
+}
diff --git a/cardie/static/main/ui.css b/cardie/static/main/ui.css
index 486c6c3..2aee610 100644
--- a/cardie/static/main/ui.css
+++ b/cardie/static/main/ui.css
@@ -1,4 +1,4 @@
-/*
+/*
ui.css
Handles styles for every common user interface element
Quick references for every element class name is below
@@ -68,14 +68,13 @@
width: fit-content;
- -webkit-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- -moz-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
+ -webkit-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ -moz-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
}
.ui_button_large:hover:enabled {
scale: 1.05;
- cursor: pointer;
}
.ui_button_large:active:enabled {
@@ -106,14 +105,13 @@
margin-top: clamp(0.5vh, 5px, 0.5vw);
margin-bottom: clamp(0.5vh, 5px, 0.5vw);
- -webkit-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- -moz-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
+ -webkit-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ -moz-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
}
.ui_button_grid:hover:enabled {
scale: 1.05;
- cursor: pointer;
}
.ui_button_grid:active:enabled {
@@ -145,14 +143,13 @@
aspect-ratio: 1;
- -webkit-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- -moz-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
+ -webkit-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ -moz-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
}
.ui_button_icon:hover:enabled {
scale: 1.1;
- cursor: pointer;
}
.ui_button_icon:active:enabled {
@@ -186,14 +183,13 @@
width: clamp(3.5vh, 35px, 3.5vw);
height: clamp(3.5vh, 35px, 3.5vw);
- -webkit-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- -moz-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
+ -webkit-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ -moz-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
}
.ui_button_smallicon:hover:enabled {
scale: 1.05;
- cursor: pointer;
}
.ui_button_smallicon:active:enabled {
@@ -208,7 +204,7 @@
.ui_button_small {
background-color: var(--default-glass-background);
color: var(--default-text-color);
- border-radius: 100px;
+ border-radius: 100px;
border: var(--default-glass-border);
transition: var(--default-transition);
font-size: clamp(1.4vh, 14px, 1.4vw);
@@ -226,14 +222,13 @@
white-space: nowrap;
- -webkit-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- -moz-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
+ -webkit-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ -moz-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
}
.ui_button_small:hover:enabled {
scale: 1.05;
- cursor: pointer;
}
.ui_button_small:active:enabled {
@@ -245,7 +240,6 @@
opacity: 0.7;
}
-
/* Text */
.ui_text_header {
font-family: var(--default-font-family);
@@ -322,7 +316,6 @@
opacity: 0.8;
}
-
/* Image */
.ui_image_generic {
border-radius: 10px;
@@ -332,16 +325,15 @@
opacity: 0.8;
- -webkit-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- -moz-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
+ -webkit-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ -moz-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
}
.ui_image_generic:hover {
opacity: 1;
}
-
/* Status Boxes */
.ui_status_info {
background-color: rgba(57, 72, 112, 0.5);
@@ -355,9 +347,9 @@
padding: clamp(1vh, 10px, 1vw);
margin: clamp(1vh, 10px, 1vw);
- -webkit-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- -moz-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
+ -webkit-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ -moz-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
}
.ui_status_warning {
@@ -372,9 +364,9 @@
padding: clamp(1vh, 10px, 1vw);
margin: clamp(1vh, 10px, 1vw);
- -webkit-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- -moz-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
+ -webkit-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ -moz-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
}
.ui_status_critical {
@@ -389,9 +381,9 @@
padding: clamp(1vh, 10px, 1vw);
margin: clamp(1vh, 10px, 1vw);
- -webkit-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- -moz-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
+ -webkit-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ -moz-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
}
.ui_status_text {
@@ -418,7 +410,6 @@
opacity: 0.8;
}
-
/* Text Areas */
.ui_input_generic {
background-color: var(--default-glass-background);
@@ -442,9 +433,9 @@
width: 100%;
- -webkit-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- -moz-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
+ -webkit-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ -moz-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
}
.ui_input_generic::placeholder {
@@ -456,13 +447,11 @@
scale: 1.05;
}
-
/* Spacers */
.ui_spacer {
height: clamp(2vh, 20px, 2vw);
}
-
/* Separators */
.ui_separator_vertical {
width: clamp(0.3vh, 3px, 0.3vw);
@@ -477,15 +466,15 @@
backdrop-filter: var(--default-glass-blur);
- -webkit-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- -moz-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
+ -webkit-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ -moz-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
}
.ui_separator_horizontal {
height: clamp(0.3vh, 3px, 0.3vw);
/* TODO: Technically this works for now but it should be fixed properly later */
- width: 85%;
+ width: 85%;
margin-left: clamp(1vh, 10px, 1vw);
margin-right: clamp(1vh, 10px, 1vw);
@@ -496,9 +485,9 @@
backdrop-filter: var(--default-glass-blur);
- -webkit-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- -moz-box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
- box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.75);
+ -webkit-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ -moz-box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.75);
}
/* Background Blur */
diff --git a/cardie/static/main/variables.css b/cardie/static/main/variables.css
index 53852d5..f0a2d18 100644
--- a/cardie/static/main/variables.css
+++ b/cardie/static/main/variables.css
@@ -1,17 +1,16 @@
:root {
background: rgb(37, 40, 49);
- --default-background-color: #35374B;
+ --default-background-color: #35374b;
--default-font-family: "Noto Sans", sans-serif;
--default-transition: 0.3s ease;
--default-text-color: white;
- --color-primary: #35374B;
+ --color-primary: #35374b;
--color-secondary: #344955;
- --color-tertiary: #50727B;
- --color-quaternary: #78A083;
+ --color-tertiary: #50727b;
+ --color-quaternary: #78a083;
--default-glass-background: rgba(180, 180, 180, 0.4);
--default-glass-border: rgba(167, 167, 167, 0.5) 2px solid;
--default-glass-blur: blur(20px);
-
-}
\ No newline at end of file
+}