{"id":16725396,"url":"https://github.com/antonshevchuk/wme-template","last_synced_at":"2026-04-09T13:13:00.119Z","repository":{"id":145594273,"uuid":"532516755","full_name":"AntonShevchuk/wme-template","owner":"AntonShevchuk","description":"Template of the script for Waze Map Editor","archived":false,"fork":false,"pushed_at":"2025-07-05T09:31:54.000Z","size":38,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-14T12:42:58.300Z","etag":null,"topics":["greasyfork","waze","wme-scripts"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AntonShevchuk.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,"zenodo":null}},"created_at":"2022-09-04T11:14:04.000Z","updated_at":"2025-07-05T09:31:57.000Z","dependencies_parsed_at":"2023-11-21T17:48:22.908Z","dependency_job_id":"dc74eb28-f573-4641-8f4a-35e735f9c71d","html_url":"https://github.com/AntonShevchuk/wme-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AntonShevchuk/wme-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonShevchuk%2Fwme-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonShevchuk%2Fwme-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonShevchuk%2Fwme-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonShevchuk%2Fwme-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AntonShevchuk","download_url":"https://codeload.github.com/AntonShevchuk/wme-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonShevchuk%2Fwme-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278526244,"owners_count":26001325,"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-10-05T02:00:06.059Z","response_time":54,"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":["greasyfork","waze","wme-scripts"],"created_at":"2024-10-12T22:49:04.795Z","updated_at":"2026-04-09T13:13:00.103Z","avatar_url":"https://github.com/AntonShevchuk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WME Template\n\nTemplate for Waze Map Editor userscripts. TypeScript source with Rollup build pipeline.\n\n## Libraries\n\n* [Common Utils](https://github.com/AntonShevchuk/common.utils) - `Container`, `SimpleCache`, `Settings`, `Tools`\n* [Geo Utils](https://github.com/AntonShevchuk/geo.utils) - `GeoUtils` static class for geospatial calculations\n* [WME-Bootstrap](https://github.com/AntonShevchuk/wme-bootstrap) - triggers `jQuery.Event` for all major WME events\n* [WME-Base](https://github.com/AntonShevchuk/wme-base) - `WMEBase` parent class with event handlers, shortcuts, permissions\n* [WME-UI](https://github.com/AntonShevchuk/wme-ui) - UI helpers: Tab, Panel, Modal, Fieldset, controls\n\n## Project Structure\n\n```\nsrc/\n  name.ts          # script name constant (unique identifier)\n  translations.ts  # translations (en, uk, ru) accessed via WMEUI.t(NAME)\n  settings.ts      # default settings (persisted to localStorage)\n  buttons.ts       # button definitions with shortcuts\n  style.css        # plain CSS (imported as string)\n  template.ts      # main class extending WMEBase\n  index.ts         # bootstrap: register translations/styles, init\n  globals.d.ts     # type declarations for WME libraries\n  meta.ts          # userscript header\n```\n\n## Development\n\n```bash\nnpm install\nnpm run build           # build dist/WME-Template.user.js\nnpm run build:bundled   # build all-in-one version (libraries included)\nnpm run watch           # rebuild on changes\n```\n\n## Demonstrated Features\n\n### WME-Base\n\n- **Event handlers**: `onSegment`, `onSegments`, `onVenue`, `onVenues`, `onNode`, `onNodes`, `onPoint`, `onPlace`, `onResidential`, `onNone`\n- **Shortcuts**: `createShortcut(id, description, keys, callback)`\n- **Permissions**: `canEditSegment(model)`, `canEditVenue(model)`\n- **Selection**: `getSelection()`, `getSelectedSegments()`, `getSelectedVenues()`\n- **Logging**: `log()`, `warn()`, `error()`, `group()`, `groupEnd()`\n\n### WME-UI\n\n- **Tab**: sidebar tab with icon - `helper.createTab(title, { sidebar, icon })`\n- **Panel**: inline panel injected into edit sidebar - `helper.createPanel(title)`\n- **Modal**: floating overlay with close button - `helper.createModal(title)`\n- **Fieldset**: collapsible group - `helper.createFieldset(title)`\n- **Controls**: `addButton`, `addButtons`, `addCheckbox`, `addCheckboxes`, `addNumber`, `addInput`, `addRange`, `addText`, `addDiv`\n- **Dynamic updates**: `setText()` on text elements, `remove()` on any element\n- **Translations**: `WMEUI.addTranslation(NAME, data)`, `WMEUI.t(NAME)`\n- **Styles**: `WMEUI.addStyle(css)`\n\n### CommonUtils\n\n- **Settings**: `new Settings(name, defaults)` with `get()`, `set()`, `save()`, `load()`\n\n## Quick Start\n\n### 1. Define name, translations, and settings\n\n```typescript\n// name.ts\nexport const NAME = 'MyScript'\n\n// translations.ts - english is required\nexport const TRANSLATION = {\n  en: { title: 'My Script', buttons: { run: 'Run' } },\n  uk: { title: 'Мій скрипт', buttons: { run: 'Запуск' } },\n}\n\n// settings.ts - persisted to localStorage\nexport const SETTINGS = { enabled: true, threshold: 10 }\n```\n\n### 2. Define buttons\n\n```typescript\n// buttons.ts\nexport function getButtons () {\n  return {\n    A: {\n      title: WMEUI.t(NAME).buttons.run,\n      description: WMEUI.t(NAME).buttons.run,\n      shortcut: 'S+1',\n      callback: null  // wired in index.ts\n    },\n  }\n}\n```\n\n### 3. Create the main class\n\n```typescript\n// my-script.ts\nexport class MyScript extends WMEBase {\n  panel: WMEUIHelperPanel\n  tab: WMEUIHelperTab\n\n  init (buttons: Record\u003cstring, any\u003e) {\n    this.panel = this.helper.createPanel(WMEUI.t(NAME).title)\n    this.panel.addButtons(buttons)\n\n    this.tab = this.helper.createTab(WMEUI.t(NAME).title, {\n      sidebar: this.wmeSDK.Sidebar,\n      icon: 'polygon',\n    })\n    this.tab.inject()\n  }\n\n  onSegment (event: JQuery.Event, element: HTMLElement, model: Segment) {\n    if (this.canEditSegment(model)) {\n      element.prepend(this.panel.html())\n    }\n  }\n}\n```\n\n### 4. Bootstrap\n\n```typescript\n// index.ts\n$(document).on('bootstrap.wme', () =\u003e {\n  WMEUI.addTranslation(NAME, TRANSLATION)\n  WMEUI.addStyle(css)\n\n  const instance = new MyScript(NAME, SETTINGS)\n  const buttons = getButtons()\n  buttons.A.callback = () =\u003e instance.onRun()\n  instance.init(buttons)\n})\n```\n\n## @require Libraries\n\n```javascript\n// @require      https://update.greasyfork.org/scripts/389765/1793258/CommonUtils.js\n// @require      https://update.greasyfork.org/scripts/571719/1793257/GeoUtils.js\n// @require      https://update.greasyfork.org/scripts/450160/1792042/WME-Bootstrap.js\n// @require      https://update.greasyfork.org/scripts/450221/1793261/WME-Base.js\n// @require      https://update.greasyfork.org/scripts/450320/1794414/WME-UI.js\n```\n\n## Links\n\nAuthor homepage: https://anton.shevchuk.name/  \nScript homepage: https://github.com/AntonShevchuk/wme-template  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonshevchuk%2Fwme-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonshevchuk%2Fwme-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonshevchuk%2Fwme-template/lists"}