WME Bootstrap

Bootstrap library for custom Waze Map Editor scripts

2023-02-23 기준 버전입니다. 최신 버전을 확인하세요.

이 스크립트는 직접 설치하는 용도가 아닙니다. 다른 스크립트에서 메타 지시문 // @require https://update.greasyfork.org/scripts/450160/1153357/WME%20Bootstrap.js을(를) 사용하여 포함하는 라이브러리입니다.

작성자
Anton Shevchuk
버전
0.1.2
생성일
2022-08-25
갱신일
2023-02-23
크기
6.21KB
라이선스
MIT

WME Bootstrap

This is a small Boostrap library for checking WME loading and providing useful events, which you can use for your scripts.

For what?

You can meet the realization of checking loading in the many scripts; it looks like this:

// 👎
function init() {
  /* checking */
  setTimeout(init, 200) 
}

No need more this way; look at the following code:

// 👍
$(document).on('bootstrap.wme', () => { /* your code here */ } )

So I think it's clear.

Need more?

So, it is not all. This script trigger more events for common events in the WME where you can manipulate the arguments.

Require Script

// @require https://greasyfork.org/scripts/450160-wme-bootstrap/code/WME-Bootstrap.js

Events

All following events are triggered on the document

  • bootstrap.wme – when all WME-objects are ready for usage
  • none.wme – when nothing chosen
  • node.wme – when chosen node for edit
  • nodes.wme – when chosen more than one node (I'm not sure how it is possible)
  • segment.wme – when chosen segment for edit
  • segments.wme – when chosen more than one segment
  • venue.wme – when chosen place or point for edit
  • venues.wme – when chosen more than one place or point
  • point.wme – when chosen point place for edit
  • place.wme – when chosen place for edit
  • residential.wme – when chosen residential place for edit

Arguments

  • eventjQuery.Event
  • elementHTMLElement of the sidebar panel
  • modelW.model
  • models – array of W.model

Usage

(function () {
  'use strict'

  $(document)
    .on('bootstrap.wme', function () {
      console.info('ready')
    })
    .on('none.wme', (e) => {
      console.info('none')
    })
    .on('node.wme', (event, element, model) => {
      console.info('node', model)
      console.info('sidebar', element)
    })
    .on('nodes.wme', (event, element, models) => {
      console.info('nodes', models)
    })
    .on('segment.wme', (event, element, model) => {
      console.info('segment', model)
      console.info('sidebar', element)
    })
    .on('segments.wme', (event, element, models) => {
      console.info('segments', models)
    })
    .on('venue.wme', (event, element, model) => {
      console.info('venue', model)
    })
    .on('venues.wme', (event, element, model) => {
      console.info('venues', models)
    })
    .on('point.wme', (event, element, model) => {
      console.info('point', model)
    })
    .on('place.wme', (event, element, model) => {
      console.info('place', model)
    })
    .on('residential.wme', (event, element, model) => {
      console.info('residential', model)
    })
})();

Links

Author homepage: http://anton.shevchuk.name/
Script homepage: https://github.com/AntonShevchuk/wme-bootstrap
GreasyFork: https://greasyfork.org/en/scripts/450160-wme-bootstrap