{"id":21240627,"url":"https://github.com/chrisnajman/sortable-dictionary-v2","last_synced_at":"2025-07-22T16:06:05.400Z","repository":{"id":218054841,"uuid":"716468179","full_name":"chrisnajman/sortable-dictionary-v2","owner":"chrisnajman","description":"Sortable dictionary with edit and delete functionality.","archived":false,"fork":false,"pushed_at":"2024-01-19T12:23:39.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-15T03:43:38.021Z","etag":null,"topics":["accessible-tables","css-nesting","darkmodetoggle","html-css-javascript","html-template","localstorage"],"latest_commit_sha":null,"homepage":"https://chrisnajman.github.io/sortable-dictionary-v2/","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrisnajman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-11-09T07:46:48.000Z","updated_at":"2023-12-10T12:58:32.000Z","dependencies_parsed_at":"2024-01-19T13:57:51.665Z","dependency_job_id":null,"html_url":"https://github.com/chrisnajman/sortable-dictionary-v2","commit_stats":null,"previous_names":["chrisnajman/sortable-dictionary-v2"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chrisnajman/sortable-dictionary-v2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisnajman%2Fsortable-dictionary-v2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisnajman%2Fsortable-dictionary-v2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisnajman%2Fsortable-dictionary-v2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisnajman%2Fsortable-dictionary-v2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisnajman","download_url":"https://codeload.github.com/chrisnajman/sortable-dictionary-v2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisnajman%2Fsortable-dictionary-v2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266524888,"owners_count":23942834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accessible-tables","css-nesting","darkmodetoggle","html-css-javascript","html-template","localstorage"],"created_at":"2024-11-21T00:52:11.229Z","updated_at":"2025-07-22T16:06:05.366Z","avatar_url":"https://github.com/chrisnajman.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sortable Dictionary (V2)\n\n## Description\n\nI'm always looking up words, in several languages, so I decided to build my own sortable dictionary.\n\nNote: the page doesn't break when viewed on a mobile, but I'd recommend using tablet or desktop for the best experience.\n\nThis build features enhancements and modifications to my previous [sortable dictionary](https://github.com/chrisnajman/sortable-dictionary) project.\n\n### How it works\n\n#### Adding an entry\n\n- Add a word or phrase (required) to the modal dialog form.\n  - All language characters and accents are allowed, together with hyphens and single apostrophes.\n    - Special characters are not allowed.\n  - Clicking 'Cancel' will close the form and modal.\n- Select a language (optional):\n  - If the form is submitted without selecting a language, the default language (English) will be printed to the table row.\n  - If the language is not available, you can select \"Other\". This can be edited after the form is submitted.\n- Add a definition (optional). This can be added (or edited) after the form is submitted.\n\n#### Editing/sorting/deleting an entry\n\nOnce the form has been submitted, a new table row is generated.\n\nNote: usually, new table rows go to the bottom of the table. For ease of use in this project, the newly-generated entry appears at the top. To signal this, the new entry is briefly highlighted.\n\n- Either the word/phrase or language can be sorted (a-z and z-a) via:\n  - two buttons in the 'Word/phrase' table header, and\n  - two buttons in the 'Language' table header.\n    - At least two rows need to be generated before the sort buttons are enabled.\n- A definition can be edited (or added).\n- If the language selected was \"Other\", a \"Set language\" button will appear in the entry under 'Language'.\n\nEntries, edits, additions and sort order are saved to local storage.\nDeleted entries are also deleted from local storage.\n\n## HTML\n\n- `template` used for dynamic `table` rows.\n- `dialog` is used to house the form.\n- The table has a min-width of 736px. At screens smaller than 768px (width dimensions of iPad Mini) scrollbars will appear.\n\n## Javascript\n\n- Dialog modal.\n- Theme switcher.\n- Sort functionality (using ES6 `.sort()` method).\n- ES6 (no transpilation to ES5)\n\n## CSS\n\n- `grid` used for page layout.\n- `flexbox` used for page elements.\n- Files are organised using `@import` to pull modules into `style.css`.\n- Files are organised internally using CSS nesting.\n- Responsive (as far as a data table can be responsive).\n- Dark theme.\n\n## Adding a language\n\nThis requires adding code to both the HTML and JavaScript (You can add as many languages as you require).\nFirst, look up the relevant [ISO Country Code](https://www.w3docs.com/learn-html/html-language-codes.html).\n\n- E.g. for 'Portuguese', the country code is 'pt'.\n\nThen, in `./index.html` add `\u003coption value=\"pt\"\u003ePortuguese\u003c/option\u003e` somewhere in the `select` dropdown:\n\n```HTML\n\u003cselect id=\"language-select\" name=\"language-select\" data-language-select\u003e\n    \u003coption value=\"en\"\u003eEnglish\u003c/option\u003e\n    \u003coption value=\"fr\"\u003eFrench\u003c/option\u003e\n    \u003coption value=\"de\"\u003eGerman\u003c/option\u003e\n    \u003coption value=\"it\"\u003eItalian\u003c/option\u003e\n    \u003coption value=\"la\"\u003eLatin\u003c/option\u003e\n    \u003coption value=\"es\"\u003eSpanish\u003c/option\u003e\n    \u003coption value=\"pt\"\u003ePortuguese\u003c/option\u003e \u003c!-- Portuguese added --\u003e\n    \u003coption value=\"und\"\u003eOther\u003c/option\u003e\n\u003c/select\u003e\n```\n\nFinally, in `./js/script.js` add a new `case` in the `switch` statement:\n\n```JavaScript\nfunction convertLangSelectToFullName(entry) {\n  switch (entry.language) {\n    case \"en\":\n      entry.language = \"English\"\n      break\n    case \"fr\":\n      entry.language = \"French\"\n      break\n    case \"de\":\n      entry.language = \"German\"\n      break\n    case \"it\":\n      entry.language = \"Italian\"\n      break\n    case \"la\":\n      entry.language = \"Latin\"\n      break\n    case \"es\":\n      entry.language = \"Spanish\"\n      break\n    case \"pt\":\n      entry.language = \"Portuguese\" /* Portuguese added */\n      break\n    case \"und\":\n      entry.language = \"Other\"\n      break\n    default:\n      entry.language = \"Not available\"\n  }\n}\n```\n\n## Testing\n\n- Tested on:\n  - Windows 10\n    - Chrome\n    - Firefox\n    - Microsoft Edge\n\nThe page has been tested in both browser and device views.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisnajman%2Fsortable-dictionary-v2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisnajman%2Fsortable-dictionary-v2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisnajman%2Fsortable-dictionary-v2/lists"}