{"id":16557199,"url":"https://github.com/mattwright324/gmaps-context-menu","last_synced_at":"2026-04-20T06:31:32.448Z","repository":{"id":93597237,"uuid":"326071907","full_name":"mattwright324/gmaps-context-menu","owner":"mattwright324","description":"Create context menus for Google Maps maps, markers, or shapes","archived":false,"fork":false,"pushed_at":"2021-01-02T23:56:49.000Z","size":14,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-04T23:32:41.320Z","etag":null,"topics":["context-menus","google-maps","google-maps-api"],"latest_commit_sha":null,"homepage":"","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/mattwright324.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":"2021-01-01T23:13:55.000Z","updated_at":"2022-06-30T23:31:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"e4d7f5b3-17c8-4663-9915-63584b72efd5","html_url":"https://github.com/mattwright324/gmaps-context-menu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mattwright324/gmaps-context-menu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattwright324%2Fgmaps-context-menu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattwright324%2Fgmaps-context-menu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattwright324%2Fgmaps-context-menu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattwright324%2Fgmaps-context-menu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattwright324","download_url":"https://codeload.github.com/mattwright324/gmaps-context-menu/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattwright324%2Fgmaps-context-menu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32036372,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"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":["context-menus","google-maps","google-maps-api"],"created_at":"2024-10-11T20:06:46.003Z","updated_at":"2026-04-20T06:31:32.437Z","avatar_url":"https://github.com/mattwright324.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gmaps-context-menu\nCreate context menus for Google Maps maps, markers, or shapes. Looks exactly like context menus in the current [Google Maps](https://www.google.com/maps).\n\n![example comparison](https://i.imgur.com/6MjZ94m.png)\n\nSimply add the css and js to your site and it is ready to go!\n\n```html\n\u003clink rel=\"stylesheet\" href=\"css/gmaps-context-menu.css\" /\u003e\n\u003cscript type=\"text/javascript\"  src=\"js/gmaps-context-menu.js\"\u003e\u003c/script\u003e\n```\n\n### Features\n- Easily customizable\n- Supports multiple context menus for different elements\n- Looks almost exactly like Google Maps context menus\n- Show or hide context menu items with a condition\n\n## Documentation\n\nGo to the [Wiki](https://github.com/mattwright324/gmaps-context-menu/wiki/GmapsContextMenu) for detailed documentation about the `GmapsContextMenu`.\n\n## Code examples\n\nWith your map and markers, circles, shapes...\n\n```js\nconst map = new google.maps.Map(document.getElementById(\"map\"), {\n    zoom: 7,\n    center: {lat: 40.697, lng: -74.259}\n});\nconst circle = new google.maps.Circle({\n    center: {lat: 40.697, lng: -74.259},\n    strokeColor: \"#00fff0\",\n    strokeOpacity: 0.5,\n    strokeWeight: 2,\n    fillColor: \"#00fff0\",\n    fillOpacity: 0.15,\n    radius: 10000\n});\nconst marker = new google.maps.Marker({\n    position: {lat: 40.697, lng: -74.259},\n    draggable: true,\n    optimized: false,\n    zIndex: 99999999,\n    showing: false\n});\n```\n\nUse `gmaps-context-menu` to add the same context menu for all elements.\n\n```js\nconst defaultContextMenu = new GmapsContextMenu(map, {\n    options: [\n        {\n            text: \"Move marker here\",\n            showWhen: function () {\n                return true;\n            },\n            onclick: function (latLng) {\n                // insert your code here\n            }\n        },\n        {\n            text: \"Search here\",\n            showWhen: function () {\n                return true;\n            },\n            onclick: function (latLng) {\n                // insert your code here\n            }\n        }\n    ]\n});\ndefaultContextMenu.registerFor(circle);\ndefaultContextMenu.registerFor(marker);\n```\n\nUse `gmaps-context-menu` to make different context menus for different elements. If you don't register the context menu for a map element it will not appear on right click. Though, you don't want multiple menus registered to open for the same map or they will all open at the same place. An additional parameter on the non-map context menus can turn that off.\n\n```js\nconst mapContextMenu = new GmapsContextMenu(map, {\n    options: [\n        {\n            text: \"Map option\",\n            showWhen: function () {\n                return true;\n            },\n            onclick: function (latLng) {\n                // insert your code here\n            }\n        }\n    ]\n});\n\nconst circleContextMenu = new GmapsContextMenu(map, {\n    registerOpenForMap: false,\n    options: [\n        {\n            text: \"Circle option\",\n            showWhen: function () {\n                return true;\n            },\n            onclick: function (latLng) {\n                // insert your code here\n            }\n        }\n    ]\n});\ncircleContextMenu.registerFor(circle);\n\nconst markerContextMenu = new GmapsContextMenu(map, {\n    registerOpenForMap: false,\n    options: [\n        {\n            text: \"Marker option\",\n            showWhen: function () {\n                return true;\n            },\n            onclick: function (latLng) {\n                // insert your code here\n            }\n        }\n    ]\n});\nmarkerContextMenu.registerFor(marker);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattwright324%2Fgmaps-context-menu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattwright324%2Fgmaps-context-menu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattwright324%2Fgmaps-context-menu/lists"}