{"id":26119304,"url":"https://github.com/4msar/search-modal","last_synced_at":"2025-04-13T10:34:23.924Z","repository":{"id":59800457,"uuid":"539290343","full_name":"4msar/search-modal","owner":"4msar","description":"Search modal","archived":false,"fork":false,"pushed_at":"2023-05-12T04:53:28.000Z","size":130,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T01:51:30.686Z","etag":null,"topics":["hacktoberfest","javascript","modal","search"],"latest_commit_sha":null,"homepage":"https://search-modal.msar.me/","language":"JavaScript","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/4msar.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-21T03:38:01.000Z","updated_at":"2024-05-27T10:56:29.000Z","dependencies_parsed_at":"2025-03-10T12:42:31.667Z","dependency_job_id":null,"html_url":"https://github.com/4msar/search-modal","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4msar%2Fsearch-modal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4msar%2Fsearch-modal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4msar%2Fsearch-modal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4msar%2Fsearch-modal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/4msar","download_url":"https://codeload.github.com/4msar/search-modal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248698968,"owners_count":21147565,"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","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":["hacktoberfest","javascript","modal","search"],"created_at":"2025-03-10T12:26:01.626Z","updated_at":"2025-04-13T10:34:23.891Z","avatar_url":"https://github.com/4msar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Search Modal\n\nThis is a simple search modal that can be used in any project. It is built with vanilla JavaScript and CSS.\n\n## Installation \n\n`yarn add search-modal` or `npm install search-modal`\n\n## Configuration \n```js\nconst button = document.querySelector('button.open-search-modal');\n    const instance = window.SearchModal({\n        // initialize the search modal \n        autoInit: true,\n        searchUrl: \"\", // to search from server \n        searchKey: \"query\",\n        // only applicable when the `searchUrl` is not provided, to search from static data or preloaded data \n        data:[\n            {\n                title: \"Example\",\n                category: \"Category\",\n                summary: \"Summary of example one\",\n                url: \"/example\"\n            },\n            {\n                title: \"Example 2\",\n                category: \"Category\",\n                summary: \"Another brief example\",\n                url: \"/example-2\"\n            }\n        ],\n        // transform the data \n        transform: (data) =\u003e data.map(item=\u003e({\n            title: item.title, \n            category: item.category, \n            excerpt: item.summary, \n            url: item.url,\n        })),\n        callback: (event, data) =\u003e {\n            console.log({ event, data });\n        }\n    });\n    button.addEventListener('click', () =\u003e {\n        instance.open();\n    });\n```\n\n## unpkg usage by @dandv\n```\n\n\u003clink rel=\"stylesheet\" href=\"https://search-modal.msar.me/dist/style.css\"\u003e\n\u003cscript type=\"module\"\u003e\n  import SearchModal from 'https://unpkg.com/search-modal?module';\n  const instance = SearchModal({ ... });\n\n  // Activate on Cmd/Ctrl+K\n  document.addEventListener(\"keydown\", (event) =\u003e {\n    if ((event.ctrlKey || event.metaKey) \u0026\u0026 event.key === \"k\") {\n      event.preventDefault();\n      instance.open();\n    }\n  });\n\u003c/script\u003e\n\n```\n\n## Example \n![demo](./screenshot.png) \n\n[Demo](https://search-modal.msar.me/)\n\n## To Do \n\n- Add documentation\n- Proper example \n\n## History \nThis project was inspired from by algolia DocSearch modal which is tightly binded with algolia, that's why we write this package to provide smooth search experience.\nThe design provided by [Atiqur Rahman](//github.com/atiq-ur) and developed by [Saiful Alam](//github.com/4msar)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4msar%2Fsearch-modal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F4msar%2Fsearch-modal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4msar%2Fsearch-modal/lists"}