{"id":25640741,"url":"https://github.com/orca-scan/notch-detected-event","last_synced_at":"2025-04-15T02:51:01.660Z","repository":{"id":47932270,"uuid":"226202833","full_name":"orca-scan/notch-detected-event","owner":"orca-scan","description":"Detect the existence of a device notch","archived":false,"fork":false,"pushed_at":"2025-02-21T00:06:27.000Z","size":514,"stargazers_count":20,"open_issues_count":7,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T04:42:23.713Z","etag":null,"topics":["javascript","pwa"],"latest_commit_sha":null,"homepage":"https://orcascan.com","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/orca-scan.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":"2019-12-05T22:51:31.000Z","updated_at":"2025-02-21T00:09:07.000Z","dependencies_parsed_at":"2025-02-21T01:19:52.705Z","dependency_job_id":"66d787a3-96c8-49f7-bb6d-e6258028b281","html_url":"https://github.com/orca-scan/notch-detected-event","commit_stats":{"total_commits":14,"total_committers":3,"mean_commits":4.666666666666667,"dds":0.5,"last_synced_commit":"bf87e6de56ebf0c20349c5b4a4fcba0310158bdb"},"previous_names":["orca-scan/notch-detected-event","john-doherty/notch-detected-event"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orca-scan%2Fnotch-detected-event","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orca-scan%2Fnotch-detected-event/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orca-scan%2Fnotch-detected-event/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orca-scan%2Fnotch-detected-event/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orca-scan","download_url":"https://codeload.github.com/orca-scan/notch-detected-event/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248997087,"owners_count":21195797,"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":["javascript","pwa"],"created_at":"2025-02-23T04:46:29.393Z","updated_at":"2025-04-15T02:51:01.636Z","avatar_url":"https://github.com/orca-scan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# notch-detected-event\n\nA 0.7k script that fires a `notch-detected` event if the device has a notch \u003ci\u003e(currently iPhone X, XS, XR, XS Max and Google Pixel 3)\u003c/i\u003e. If detected a [HTML5 data attribute](http://html5doctor.com/html5-custom-data-attributes/) will be added to the `\u003chtml\u003e` element:\n\n```html\n\u003chtml data-notch=\"true\"\u003e\n```\n\nAllows you to modify the UI at runtime using CSS:\n\n```css\n/* make room for the notch at the top */\n@media screen and (orientation: portrait) {\n  html[data-notch=\"true\"] {\n    padding-top: 44px;\n    height: calc(100% - 44px);\n  }\n}\n\n/* make room for the notch at the sides */\n@media screen and (orientation: landscape) {\n  html[data-notch=\"true\"] {\n    padding-left: 44px;\n    padding-right: 44px;\n    width: calc(100% - 44px - 44px);\n  }\n}\n```\n\nOr listen for the **notch-detected** event and execute some logic:\n\n```js\nwindow.addEventListener('notch-detected', function(e) {\n  console.log(\"Notch detected, move shit around\");\n});\n```\n\n## Install\n\nAdd [notch-detected-event.min.js](dist/notch-detected-event.min.js) to your app/page.\n\n## Contributing\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -m 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request\n\n### Development\n\nThe project includes everything needed to develop/test. Run the following then visit [http://your-local-ip:8080](http://localhost:8080) on your mobile device or emulator.\n\n```bash\ngit clone https://github.com/orca-scan/notch-detected-event\ncd notch-detected-event\nnpm install\nnpm start\n```\n\n### Update .min files\n\nTo create a new version of the minified [notch-detected-event.min.js](dist/notch-detected-event.min.js) file from source, tweak the version number in `package.json` and run the following:\n\n```bash\nnpm run build\n```\n\n## Star the repo\n\nFind this useful? Star the repo - it help us priorities open source tasks 🌟\n\n## License\n\n[MIT License](LICENSE) © Orca Scan - a [barcode app](https://orcascan.com) with simple [barcode tracking APIs](https://orcascan.com/guides?tag=for-developers).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forca-scan%2Fnotch-detected-event","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forca-scan%2Fnotch-detected-event","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forca-scan%2Fnotch-detected-event/lists"}