diff --git a/card-sort.html b/card-sort.html index 8dbe263..6c8cfc9 100644 --- a/card-sort.html +++ b/card-sort.html @@ -227,6 +227,9 @@ categoryTemplate.content.querySelector('.title').removeAttribute('placeholder'); } buttonCreateCategory.addEventListener('click', () => createCategory()); + if (settings.isRandomized) { + cardTexts.sort(() => Math.random() - 0.5); + } for (const text of cardTexts) { createCard(text); } diff --git a/common-scripts.js b/common-scripts.js index 2f14928..acf2501 100644 --- a/common-scripts.js +++ b/common-scripts.js @@ -2,15 +2,19 @@ const settingsFlagsKey = '?'; const settingsFlagsEnum = { allowCategoryEditing: 1, + isRandomized: 2, }; const settingsDefaults = { allowCategoryEditing: true, + isRandomized: false, }; function loadSettings(data) { - const settings = {}; + const settings = Object.assign({}, settingsDefaults); const flags = data[settingsFlagsKey]; - settings.allowCategoryEditing = Boolean(settingsFlagsEnum.allowCategoryEditing & flags); + for (const settingName of Object.keys(settingsFlagsEnum)) { + settings[settingName] = Boolean(settingsFlagsEnum[settingName] & flags); + } return settings; } function saveSettings(settings) { diff --git a/index.html b/index.html index 52d9908..d8e026d 100644 --- a/index.html +++ b/index.html @@ -28,7 +28,6 @@ } textarea { padding: 0.5em; - margin-bottom: 1em; width: 100%; height: 20vh; } @@ -50,6 +49,9 @@ word-break: break-all; padding-bottom: 2em; } + hr { + opacity: .3; + }
@@ -63,6 +65,15 @@