Added uppercase option to UUID generator
Update uuid-generator.yml, uuid-generator.yml, and 2 more files...
This commit is contained in:
@@ -10,6 +10,7 @@ type.uuid4: "UUID4 / GUID4"
|
|||||||
option.count: "UUID Count"
|
option.count: "UUID Count"
|
||||||
option.hyphen: "Add hyphens"
|
option.hyphen: "Add hyphens"
|
||||||
option.guid_brackets: "Add GUID brackets"
|
option.guid_brackets: "Add GUID brackets"
|
||||||
|
option.uppercase: "Generate in uppercase"
|
||||||
|
|
||||||
generate: "Generate"
|
generate: "Generate"
|
||||||
|
|
||||||
|
@@ -10,6 +10,7 @@ type.uuid4: "UUID4 / GUID4"
|
|||||||
option.count: "Nombre d'UUID/GUID"
|
option.count: "Nombre d'UUID/GUID"
|
||||||
option.hyphen: "Ajouter trait d'union"
|
option.hyphen: "Ajouter trait d'union"
|
||||||
option.guid_brackets: "Ajouter accolades pour GUID"
|
option.guid_brackets: "Ajouter accolades pour GUID"
|
||||||
|
option.uppercase: "Générer en majuscules"
|
||||||
|
|
||||||
generate: "Générer"
|
generate: "Générer"
|
||||||
|
|
||||||
|
@@ -19,6 +19,8 @@ import {initCore} from "../../js/nibblepoker-core.mjs";
|
|||||||
const eOptionHyphenInput = document.querySelector("input#uuid-generator-option-hyphens");
|
const eOptionHyphenInput = document.querySelector("input#uuid-generator-option-hyphens");
|
||||||
/** @type {HTMLInputElement} */
|
/** @type {HTMLInputElement} */
|
||||||
const eOptionGuidBracketsInput = document.querySelector("input#uuid-generator-option-guid-brackets");
|
const eOptionGuidBracketsInput = document.querySelector("input#uuid-generator-option-guid-brackets");
|
||||||
|
/** @type {HTMLInputElement} */
|
||||||
|
const eOptionUppercaseInput = document.querySelector("input#uuid-generator-option-uppercase");
|
||||||
|
|
||||||
/** @type {HTMLElement} */
|
/** @type {HTMLElement} */
|
||||||
const eGenerateButton = document.querySelector("#uuid-generator-generate");
|
const eGenerateButton = document.querySelector("#uuid-generator-generate");
|
||||||
@@ -40,14 +42,14 @@ import {initCore} from "../../js/nibblepoker-core.mjs";
|
|||||||
}
|
}
|
||||||
|
|
||||||
function changeDesiredCount(difference = 0) {
|
function changeDesiredCount(difference = 0) {
|
||||||
if(difference !== 0) {
|
if (difference !== 0) {
|
||||||
eOptionCountInput.value = getDesiredCount() + difference;
|
eOptionCountInput.value = getDesiredCount() + difference;
|
||||||
}
|
}
|
||||||
eOptionCountInput.value = getDesiredCount();
|
eOptionCountInput.value = getDesiredCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
eGenerateButton.addEventListener("click", function() {
|
eGenerateButton.addEventListener("click", function () {
|
||||||
ePreviewTextArea.value = "";
|
ePreviewTextArea.value = "";
|
||||||
|
|
||||||
let desiredCount = getDesiredCount();
|
let desiredCount = getDesiredCount();
|
||||||
@@ -57,20 +59,26 @@ import {initCore} from "../../js/nibblepoker-core.mjs";
|
|||||||
let addGuidBrackets = eOptionGuidBracketsInput.checked;
|
let addGuidBrackets = eOptionGuidBracketsInput.checked;
|
||||||
|
|
||||||
lastUUIDs = [];
|
lastUUIDs = [];
|
||||||
for(let i= 0; i < desiredCount; i++) {
|
if (eOptionUppercaseInput.checked) {
|
||||||
lastUUIDs.push(uuidGenerator(addHyphens, addGuidBrackets));
|
for (let i = 0; i < desiredCount; i++) {
|
||||||
ePreviewTextArea.value += uuidGenerator(addHyphens, addGuidBrackets) + "\n";
|
lastUUIDs.push(uuidGenerator(addHyphens, addGuidBrackets).toUpperCase());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < desiredCount; i++) {
|
||||||
|
lastUUIDs.push(uuidGenerator(addHyphens, addGuidBrackets));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ePreviewTextArea.value = lastUUIDs.join("\n");
|
ePreviewTextArea.value = lastUUIDs.join("\n");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Count option
|
// Count option
|
||||||
eOptionCountInput.addEventListener("change", function() {
|
eOptionCountInput.addEventListener("change", function () {
|
||||||
changeDesiredCount(0);
|
changeDesiredCount(0);
|
||||||
});
|
});
|
||||||
eOptionCountInput.addEventListener("mousewheel", function(e) {
|
eOptionCountInput.addEventListener("mousewheel", function (e) {
|
||||||
// Handling wheel scroll on count field.
|
// Handling wheel scroll on count field.
|
||||||
if(e.wheelDelta < 0) {
|
if (e.wheelDelta < 0) {
|
||||||
changeDesiredCount(-1);
|
changeDesiredCount(-1);
|
||||||
} else {
|
} else {
|
||||||
changeDesiredCount(1);
|
changeDesiredCount(1);
|
||||||
@@ -78,19 +86,19 @@ import {initCore} from "../../js/nibblepoker-core.mjs";
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Download buttons
|
// Download buttons
|
||||||
eDownloadRawButton.addEventListener("click", function() {
|
eDownloadRawButton.addEventListener("click", function () {
|
||||||
if (lastUUIDs.length <= 0) {
|
if (lastUUIDs.length <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
downloadStringAsFile(lastUUIDs.join("\n"), "uuids.txt", "text/plain");
|
downloadStringAsFile(lastUUIDs.join("\n"), "uuids.txt", "text/plain");
|
||||||
});
|
});
|
||||||
eDownloadJsonButton.addEventListener("click", function() {
|
eDownloadJsonButton.addEventListener("click", function () {
|
||||||
if (lastUUIDs.length <= 0) {
|
if (lastUUIDs.length <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
downloadStringAsFile(JSON.stringify(lastUUIDs, null, 4), "uuids.json", "application/json");
|
downloadStringAsFile(JSON.stringify(lastUUIDs, null, 4), "uuids.json", "application/json");
|
||||||
});
|
});
|
||||||
eDownloadYamlButton.addEventListener("click", function() {
|
eDownloadYamlButton.addEventListener("click", function () {
|
||||||
if (lastUUIDs.length <= 0) {
|
if (lastUUIDs.length <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<label for="uuid-generator-option-count" class="mr-xs">{{ l10n("option.count", "uuid-generator", user_lang) }}:</label>
|
<label for="uuid-generator-option-count" class="mr-xs">{{ l10n("option.count", "uuid-generator", user_lang) }}:</label>
|
||||||
<input id="uuid-generator-option-count" class="p-xxs border r-s" type="number" value="4" min="1" max="1000">
|
<input id="uuid-generator-option-count" class="p-xxs border r-s" type="number" value="4" min="1" max="1000">
|
||||||
|
|
||||||
<br>
|
<hr class="subtle">
|
||||||
|
|
||||||
<label for="uuid-generator-option-hyphens" class="mr-xxs">{{ l10n("option.hyphen", "uuid-generator", user_lang) }}:</label>
|
<label for="uuid-generator-option-hyphens" class="mr-xxs">{{ l10n("option.hyphen", "uuid-generator", user_lang) }}:</label>
|
||||||
<input id="uuid-generator-option-hyphens" class="r-m border cb-pretty" type="checkbox" checked>
|
<input id="uuid-generator-option-hyphens" class="r-m border cb-pretty" type="checkbox" checked>
|
||||||
@@ -19,6 +19,11 @@
|
|||||||
<label for="uuid-generator-option-guid-brackets" class="mr-xxs">{{ l10n("option.guid_brackets", "uuid-generator", user_lang) }}:</label>
|
<label for="uuid-generator-option-guid-brackets" class="mr-xxs">{{ l10n("option.guid_brackets", "uuid-generator", user_lang) }}:</label>
|
||||||
<input id="uuid-generator-option-guid-brackets" class="r-m border cb-pretty" type="checkbox">
|
<input id="uuid-generator-option-guid-brackets" class="r-m border cb-pretty" type="checkbox">
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<label for="uuid-generator-option-uppercase" class="mr-xxs">{{ l10n("option.uppercase", "uuid-generator", user_lang) }}:</label>
|
||||||
|
<input id="uuid-generator-option-uppercase" class="r-m border cb-pretty" type="checkbox">
|
||||||
|
|
||||||
<hr class="subtle">
|
<hr class="subtle">
|
||||||
|
|
||||||
<button id="uuid-generator-generate" class="p-xs r-s border b-light success">
|
<button id="uuid-generator-generate" class="p-xs r-s border b-light success">
|
||||||
|
Reference in New Issue
Block a user