Should be about dummy proof
34
darkmode.js
@ -28,6 +28,7 @@ function getAppliedMode(userPreference) {
|
|||||||
|
|
||||||
function setAppliedMode(mode) {
|
function setAppliedMode(mode) {
|
||||||
document.documentElement.dataset.appliedMode = mode;
|
document.documentElement.dataset.appliedMode = mode;
|
||||||
|
themeToggle.checked = getAppliedMode(userPreference) === "dark";
|
||||||
}
|
}
|
||||||
|
|
||||||
function togglePreference() {
|
function togglePreference() {
|
||||||
@ -36,39 +37,6 @@ function togglePreference() {
|
|||||||
} else if (userPreference === "dark") {
|
} else if (userPreference === "dark") {
|
||||||
userPreference = "light";
|
userPreference = "light";
|
||||||
}
|
}
|
||||||
console.log(userPreference);
|
|
||||||
saveUserPreference(userPreference);
|
saveUserPreference(userPreference);
|
||||||
setAppliedMode(getAppliedMode(userPreference));
|
setAppliedMode(getAppliedMode(userPreference));
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleDarkMode() {
|
|
||||||
if (getCookie("darkMode") === "on") document.cookie = "darkMode=off;path=/";
|
|
||||||
else document.cookie = "darkMode=on;path=/";
|
|
||||||
refreshDarkMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
function refreshDarkMode() {
|
|
||||||
let darkMode = getCookie("darkMode", "off", "/") === "on";
|
|
||||||
if (darkMode) {
|
|
||||||
document.body.classList.add("dark-theme");
|
|
||||||
document.getElementById("theme").checked = true;
|
|
||||||
} else {
|
|
||||||
if (document.body.classList.contains("dark-theme")) {
|
|
||||||
document.body.classList.remove("dark-theme");
|
|
||||||
}
|
|
||||||
document.getElementById("theme").checked = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCookie(cookieName, valIfNotExists, path) {
|
|
||||||
let cookieArray = document.cookie.split(";");
|
|
||||||
for (let i = 0; i < cookieArray.length; i++) {
|
|
||||||
let cookie = cookieArray[i].split("=");
|
|
||||||
if (cookie[0].trim() === cookieName) {
|
|
||||||
return cookie[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.warn("Cookie \"" + cookieName + "\" does not exist");
|
|
||||||
document.cookie = cookieName + "=" + valIfNotExists + ";path=" + path;
|
|
||||||
return valIfNotExists;
|
|
||||||
}
|
|
22
index.html
@ -58,11 +58,11 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<h1 class="text-center mt mb h1">Signature Card Creator</h1>
|
<h1 class="text-center mt mb h1">Signature Card Creator</h1>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<a id="vcard" href="#" style="display: none">
|
<a id="card" href="#" style="display: none">
|
||||||
<img class="card" id="cardImg" alt="card"/>
|
<img class="card" id="cardImg" alt="card"/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<label for="vcard" class="text-center"></label>
|
<label for="card" class="text-center"></label>
|
||||||
<div class="form-group mt">
|
<div class="form-group mt">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="full_name">Full Name & Credentials</label>
|
<label for="full_name">Full Name & Credentials</label>
|
||||||
@ -96,14 +96,14 @@
|
|||||||
<label for="cellNumber">Cell Number</label>
|
<label for="cellNumber">Cell Number</label>
|
||||||
<input type="tel" class="form-control" id="cellNumber" name="cellNumber" maxlength="15" required="">
|
<input type="tel" class="form-control" id="cellNumber" name="cellNumber" maxlength="15" required="">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group" id="outlookDiv">
|
||||||
<input type="radio" id="o365" name="outlookVer" value="1">
|
<input type="radio" id="o365" name="outlookVer" value="1">
|
||||||
<label id="o365Label" for="o365">MS Office 365</label>
|
<label id="o365Label" for="o365">MS Office 365</label>
|
||||||
<br>
|
<br>
|
||||||
<input type="radio" id="o2016" name="outlookVer" value="0">
|
<input type="radio" id="o2016" name="outlookVer" value="0">
|
||||||
<label id="o2016Label" for="o2016">MS Office 2016</label>
|
<label id="o2016Label" for="o2016">MS Office 2016</label>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-primary" id="formSubmit">Generate VCard</button>
|
<button class="btn btn-primary" id="formSubmit">Generate Signature Card</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@ -125,19 +125,5 @@
|
|||||||
<input style="display: none" id="existingFile" type="file" accept="image/png" name="existingFile">
|
<input style="display: none" id="existingFile" type="file" accept="image/png" name="existingFile">
|
||||||
<script src="script.js"></script>
|
<script src="script.js"></script>
|
||||||
<script src="darkmode.js"></script>
|
<script src="darkmode.js"></script>
|
||||||
<script>
|
|
||||||
clearForm();
|
|
||||||
loadLocations();
|
|
||||||
document.getElementById("fade").addEventListener("click", exitUpload, false);
|
|
||||||
document.getElementById("editCardBtn").addEventListener("click", loadFromExistingCard, false);
|
|
||||||
document.getElementById("formSubmit").addEventListener("click", submitForm, false);
|
|
||||||
document.getElementById("dottedDiv").addEventListener("click", (e) => {
|
|
||||||
document.getElementById("existingFile").click();
|
|
||||||
}, false);
|
|
||||||
document.getElementById("existingFile").addEventListener("input", handleInput, false);
|
|
||||||
document.body.addEventListener("dragover", dragOverHandler, false);
|
|
||||||
document.body.addEventListener("dragleave", dragLeaveHandler, false);
|
|
||||||
document.getElementById("uploadDiv").addEventListener("drop", dropHandler, false);
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 17 KiB |
@ -6,6 +6,7 @@
|
|||||||
<link rel="stylesheet" href="../stylesheet.css">
|
<link rel="stylesheet" href="../stylesheet.css">
|
||||||
<link rel="stylesheet" href="../darkmode.css">
|
<link rel="stylesheet" href="../darkmode.css">
|
||||||
<title>Install Card</title>
|
<title>Install Card</title>
|
||||||
|
<script>document.documentElement.dataset.theme = localStorage.getItem('theme') || 'light';</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@ -53,8 +54,7 @@
|
|||||||
<figure><img src="assets/img3.png" alt="img3" width="60%"></figure>
|
<figure><img src="assets/img3.png" alt="img3" width="60%"></figure>
|
||||||
<p>7. Go to Size and change the height to 1.75". The Width should change automatically to keep in aspect.</p>
|
<p>7. Go to Size and change the height to 1.75". The Width should change automatically to keep in aspect.</p>
|
||||||
<figure><img src="assets/img4.png" alt="img4" width="60%"></figure>
|
<figure><img src="assets/img4.png" alt="img4" width="60%"></figure>
|
||||||
<p>8. Click OK, then OK again to save it.</p>
|
<p>8. Click OK, then OK again to save it, and you will now have the newly created business card included in the signatures.</p>
|
||||||
<p>9. Click OK, and it will now have the newly created business card included in the signatures.</p>
|
|
||||||
</article>
|
</article>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
49
script.js
@ -1,3 +1,29 @@
|
|||||||
|
let backendUrl = "https://signature.caiu.org"
|
||||||
|
let locations = JSON.parse("{}");
|
||||||
|
const locationSelector = document.getElementById("location");
|
||||||
|
|
||||||
|
loadLocations();
|
||||||
|
clearForm();
|
||||||
|
|
||||||
|
document.body.addEventListener("dragover", dragOverHandler, false);
|
||||||
|
document.body.addEventListener("dragleave", dragLeaveHandler, false);
|
||||||
|
document.querySelectorAll('input[name = outlookVer]').forEach((element) => {
|
||||||
|
element.addEventListener("click", (e) => {
|
||||||
|
document.getElementById("outlookDiv").classList.remove("missing-info");
|
||||||
|
}, false);
|
||||||
|
});
|
||||||
|
locationSelector.addEventListener("click", (e) => {
|
||||||
|
locationSelector.classList.remove("missing-info");
|
||||||
|
}, false);
|
||||||
|
document.getElementById("dottedDiv").addEventListener("click", (e) => {
|
||||||
|
document.getElementById("existingFile").click();
|
||||||
|
}, false);
|
||||||
|
document.getElementById("fade").addEventListener("click", exitUpload, false);
|
||||||
|
document.getElementById("editCardBtn").addEventListener("click", loadFromExistingCard, false);
|
||||||
|
document.getElementById("formSubmit").addEventListener("click", submitForm, false);
|
||||||
|
document.getElementById("existingFile").addEventListener("input", handleInput, false);
|
||||||
|
document.getElementById("uploadDiv").addEventListener("drop", dropHandler, false);
|
||||||
|
|
||||||
function handleCheckbox() {
|
function handleCheckbox() {
|
||||||
const extensionInput = document.getElementById("extensionInput");
|
const extensionInput = document.getElementById("extensionInput");
|
||||||
const directLineInput = document.getElementById("directLineInput");
|
const directLineInput = document.getElementById("directLineInput");
|
||||||
@ -12,9 +38,6 @@ function handleCheckbox() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let backendUrl = "https://signature.caiu.org"
|
|
||||||
let locations = JSON.parse("{}");
|
|
||||||
|
|
||||||
function loadLocations() {
|
function loadLocations() {
|
||||||
let locationsList = document.getElementById("location");
|
let locationsList = document.getElementById("location");
|
||||||
|
|
||||||
@ -29,6 +52,7 @@ function loadLocations() {
|
|||||||
response.text().then(text => {
|
response.text().then(text => {
|
||||||
locations = JSON.parse(text);
|
locations = JSON.parse(text);
|
||||||
locationsList.innerText = "";
|
locationsList.innerText = "";
|
||||||
|
locationsList.options[0] = new Option("--- Select ---", "default");
|
||||||
for (let i = 0; i < locations.length; i++) {
|
for (let i = 0; i < locations.length; i++) {
|
||||||
locationsList.options[locationsList.options.length] = new Option(locations[i].name, locations[i].id);
|
locationsList.options[locationsList.options.length] = new Option(locations[i].name, locations[i].id);
|
||||||
}
|
}
|
||||||
@ -47,6 +71,19 @@ function clearForm() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
|
let missing = false;
|
||||||
|
if (locationSelector.value === "default") {
|
||||||
|
locationSelector.classList.add("missing-info");
|
||||||
|
missing = true;
|
||||||
|
}
|
||||||
|
if (document.querySelector('input[name = outlookVer]:checked') == null) {
|
||||||
|
document.getElementById("outlookDiv").classList.add("missing-info");
|
||||||
|
missing = true;
|
||||||
|
}
|
||||||
|
if (missing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let body =
|
let body =
|
||||||
"{" +
|
"{" +
|
||||||
"\"name\":\"" + document.getElementById("full_name").value + "\"," +
|
"\"name\":\"" + document.getElementById("full_name").value + "\"," +
|
||||||
@ -76,7 +113,7 @@ function submitForm() {
|
|||||||
|
|
||||||
function downloadImage(arrayBuffer) {
|
function downloadImage(arrayBuffer) {
|
||||||
const blob = new Blob([arrayBuffer], { type: "image/png" });
|
const blob = new Blob([arrayBuffer], { type: "image/png" });
|
||||||
const cardElement = document.getElementById("vcard");
|
const cardElement = document.getElementById("card");
|
||||||
const imgElement = document.getElementById("cardImg");
|
const imgElement = document.getElementById("cardImg");
|
||||||
|
|
||||||
let urlCreator = window.URL || window.webkitURL;
|
let urlCreator = window.URL || window.webkitURL;
|
||||||
@ -140,6 +177,10 @@ function handleInput() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadFromExistingCard() {
|
function loadFromExistingCard() {
|
||||||
|
if (document.getElementById("editCardBtn").classList.contains("disabled")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
exitUpload();
|
exitUpload();
|
||||||
const data = new FormData();
|
const data = new FormData();
|
||||||
data.append("card", document.getElementById("existingFile").files[0]);
|
data.append("card", document.getElementById("existingFile").files[0]);
|
||||||
|
@ -76,14 +76,12 @@ body {
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
background-color: var(--background-color);
|
background-color: var(--background-color);
|
||||||
transition: color ease-in-out var(--trans-dur), background-color ease-in-out var(--trans-dur);
|
|
||||||
}
|
}
|
||||||
header {
|
header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: var(--theme-blue);
|
background-color: var(--theme-blue);
|
||||||
transition: color ease-in-out var(--trans-dur), background-color ease-in-out var(--trans-dur);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
@ -93,6 +91,7 @@ main {
|
|||||||
footer {
|
footer {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
@ -110,7 +109,6 @@ input {
|
|||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
line-height: inherit;
|
line-height: inherit;
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
transition: color var(--trans-dur) ease-in-out, background-color var(--trans-dur) ease-in-out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
@ -119,7 +117,6 @@ textarea {
|
|||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
line-height: inherit;
|
line-height: inherit;
|
||||||
background-color: var(--theme-blue);
|
background-color: var(--theme-blue);
|
||||||
transition: color ease-in-out var(--trans-dur), background-color ease-in-out var(--trans-dur);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
@ -128,6 +125,7 @@ select {
|
|||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
line-height: inherit;
|
line-height: inherit;
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
@ -178,7 +176,6 @@ h1, h2, h3, h4, h5, h6 {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: var(--theme-green);
|
background-color: var(--theme-green);
|
||||||
border-color: var(--theme-green-accent);
|
border-color: var(--theme-green-accent);
|
||||||
transition: color ease-in-out var(--trans-dur), background-color ease-in-out var(--trans-dur-fast);
|
|
||||||
}
|
}
|
||||||
.btn-primary:hover:not(:disabled):not(.disabled) {
|
.btn-primary:hover:not(:disabled):not(.disabled) {
|
||||||
background-color: var(--theme-green-accent);
|
background-color: var(--theme-green-accent);
|
||||||
@ -194,6 +191,7 @@ select.form-control:not([size]):not([multiple]) {
|
|||||||
input[type="checkbox"], input[type="radio"] {
|
input[type="checkbox"], input[type="radio"] {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
[type="reset"], [type="submit"], button, html [type="button"] {
|
[type="reset"], [type="submit"], button, html [type="button"] {
|
||||||
@ -228,7 +226,6 @@ input[type="checkbox"], input[type="radio"] {
|
|||||||
background-clip: padding-box;
|
background-clip: padding-box;
|
||||||
border: 1px solid #ced4da;
|
border: 1px solid #ced4da;
|
||||||
border-radius: .25rem;
|
border-radius: .25rem;
|
||||||
transition: color var(--trans-dur) ease-in-out, background-color var(--trans-dur) ease-in-out, border-color var(--trans-dur) ease-in-out, box-shadow .15s ease-in-out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
@ -293,6 +290,11 @@ input[type="checkbox"], input[type="radio"] {
|
|||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.missing-info {
|
||||||
|
border: solid 2px var(--danger) !important;
|
||||||
|
border-radius: .25rem;
|
||||||
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
width: 24em;
|
width: 24em;
|
||||||
@ -311,13 +313,12 @@ input[type="checkbox"], input[type="radio"] {
|
|||||||
.x {
|
.x {
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
padding: .75em;
|
padding: .75em;
|
||||||
background: var(--theme-blue);
|
background: var(--theme-green);
|
||||||
border: 2px solid var(--theme-black);
|
border: 2px solid var(--theme-green-accent);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: -1.5em;
|
right: -1.5em;
|
||||||
top: -1.5em;
|
top: -1.5em;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
transition: color ease-in-out var(--trans-dur), background-color ease-in-out var(--trans-dur);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.x div {
|
.x div {
|
||||||
@ -325,9 +326,8 @@ input[type="checkbox"], input[type="radio"] {
|
|||||||
width: 16px;
|
width: 16px;
|
||||||
font-size: 1.5rem;
|
font-size: 1.5rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: var(--text-color-negative);
|
color: var(--text-color);
|
||||||
line-height: 8px !important;
|
line-height: 8px !important;
|
||||||
transition: color ease-in-out var(--trans-dur), background-color ease-in-out var(--trans-dur);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.upload {
|
.upload {
|
||||||
@ -347,7 +347,6 @@ input[type="checkbox"], input[type="radio"] {
|
|||||||
left: 50%;
|
left: 50%;
|
||||||
top: 14em;
|
top: 14em;
|
||||||
margin-left: -20em;
|
margin-left: -20em;
|
||||||
transition: color ease-in-out var(--trans-dur), background-color ease-in-out var(--trans-dur);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.upload img {
|
.upload img {
|
||||||
|