{"id":20518324,"url":"https://github.com/tricked-dev/coolkeybinds","last_synced_at":"2025-08-21T16:25:15.469Z","repository":{"id":199023579,"uuid":"702016848","full_name":"Tricked-dev/coolkeybinds","owner":"Tricked-dev","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-08T08:55:08.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-05T23:44:41.714Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tricked-dev.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}},"created_at":"2023-10-08T08:53:14.000Z","updated_at":"2023-10-08T08:53:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"26f1848c-97ec-453e-8dad-3794f10f48b0","html_url":"https://github.com/Tricked-dev/coolkeybinds","commit_stats":null,"previous_names":["tricked-dev/coolkeybinds"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Tricked-dev/coolkeybinds","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tricked-dev%2Fcoolkeybinds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tricked-dev%2Fcoolkeybinds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tricked-dev%2Fcoolkeybinds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tricked-dev%2Fcoolkeybinds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tricked-dev","download_url":"https://codeload.github.com/Tricked-dev/coolkeybinds/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tricked-dev%2Fcoolkeybinds/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271507452,"owners_count":24771824,"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-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":[],"created_at":"2024-11-15T21:39:39.032Z","updated_at":"2025-08-21T16:25:15.035Z","avatar_url":"https://github.com/Tricked-dev.png","language":"TypeScript","readme":"# Coolkeybinds\n\nKeybinds as json\n\nYou can use this library unde the [`The Unlicense`](./LICENSE) license. the code for coolkeybinds can be found in [./src/lib/coolkeybinds.ts](./src/lib/coolkeybinds.ts) and [./src/lib/keybinds.ts](./src/lib/keybinds.ts) just copy the typescript files over to your repo and import them and your done!\nIf you have any improvements / performance improvements to suggest you can create a pull request\n\nList of the key names \u003chttps://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values\u003e\n\n```js\nimport { CoolKeyBinds, type KeyBindOption } from \"./coolkeybinds\";\n\nconst keybindsList: KeyBindOption[] = [\n    {\n        name: \"reload\",\n        bind: \"ctrl+r\",\n    },\n    {\n        name: \"add\",\n        bind: [\"=\", \"ctrl+a\"],\n        when: \"menu\"\n    },\n    {\n        name: \"sub\",\n        bind: [\"-\", \"ctrl+s\"],\n        when: \"menu\"\n    },\n    {\n        name: \"reset\",\n        bind: [\"ctrl+z\"]\n    },\n    {\n        name: \"left\",\n        bind: \"ArrowLeft\",\n        when: \"magic\"\n    },\n    {\n        name: \"right\",\n        bind: \"ArrowRight\",\n        when: \"magic\"\n    },\n    {\n        name: \"up\",\n        bind: \"ArrowUp\",\n        when: \"magic\"\n    },\n    {\n        name: \"down\",\n        bind: \"ArrowDown\",\n        when: \"magic\"\n    },\n    {\n        name: \"magic\",\n        bind: [\"ctrl+m\"],\n    }\n]\n\n\nconst functions = {\n    \"reload\": () =\u003e window.location.reload(),\n    \"magic\": () =\u003e state.magic = !state.magic\n}\n\nexport function findAncestorFocus\u003cT extends string\u003e(elementsObj: Record\u003cT, HTMLElement\u003e) {\n    const result = {} as Record\u003cT, boolean\u003e;\n    for (let key in elementsObj) {\n        result[key] = false;\n    }\n\n    let focused = document.activeElement;\n    while (focused) {\n        for (let key in elementsObj) {\n            if (focused === elementsObj[key]) {\n                result[key] = true;\n            }\n        }\n        focused = focused.parentElement;\n    }\n\n    return result;\n}\nexport const state: Record\u003cstring, boolean\u003e = {\n    magic: false\n}\n\nconst varFunction = () =\u003e {\n    return {\n        ...state,\n        ...findAncestorFocus({\n            \"menu\": document.getElementById(\"form\")!\n        })\n    }\n}\n\nconst keybinds = new CoolKeyBinds(varFunction, functions);\n// this overwrites previous set keybinds\nkeybinds.setKeybinds(keybindsList);\n\nexport default keybinds\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftricked-dev%2Fcoolkeybinds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftricked-dev%2Fcoolkeybinds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftricked-dev%2Fcoolkeybinds/lists"}