WME-EntryPoint

Library for Waze Map Editor Greasy Fork scripts

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/480123/1281900/WME-EntryPoint.js

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         WME EntryPoint
// @version      0.0.1
// @description  Library for Waze Map Editor Greasy Fork scripts
// @license      MIT License
// @author       Anton Shevchuk
// @namespace    https://greasyfork.org/users/227648-anton-shevchuk
// @supportURL   https://github.com/AntonShevchuk/wme-entrypoint/issues
// @match        https://*.waze.com/editor*
// @match        https://*.waze.com/*/editor*
// @exclude      https://*.waze.com/user/editor*
// @icon         https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://anton.shevchuk.name&size=64
// @grant        none
// ==/UserScript==

/* jshint esversion: 8 */

class entryPoint {
  constructor () {
    let {
      point = { type: 'Point', coordinates: [0, 0] },
      entry = true,
      exit = false,
      primary = false,
      name = ''
    } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}

    this._point = point
    this._entry = entry
    this._exit = exit
    this._isPrimary = primary
    this._name = name
  }

  with () {
    let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}
    return new entryPoint(Object.assign(this.toJSON(), e))
  }

  getPoint () {
    return this._point
  }

  getEntry () {
    return this._entry
  }

  getExit () {
    return this._exit
  }

  getName () {
    return this._name
  }

  isPrimary () {
    return this._isPrimary
  }

  toJSON () {
    return {
      entry: this._entry,
      exit: this._exit,
      name: this._name,
      point: this._point,
      primary: this._isPrimary
    }
  }

  clone () {
    return this.with()
  }

  equals (e) {
    return this._point.type === e._point.type
      && this._point.coordinates[0] === e._point.coordinates[0]
      && this._point.coordinates[1] === e._point.coordinates[1]
      && this._name === e._name
      && this._isPrimary === e._isPrimary
      && this._entry === e._entry
      && this._exit === e._exit
  }
}