Greasy Fork is available in English.

Waze Editor - Easy Place Node Dragging

Allows easier dragging of place nodes in Waze Editor.

  1. // ==UserScript==
  2. // @name Waze Editor - Easy Place Node Dragging
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Allows easier dragging of place nodes in Waze Editor.
  6. // @author aoi
  7. // @match https://www.waze.com/*/editor
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // Get the map object.
  15. let map = W.map;
  16.  
  17. // Define the drag function.
  18. let dragNode = (e) => {
  19. // Get the current node being dragged.
  20. let node = e.target;
  21.  
  22. // Get the current map point.
  23. let latlng = map.mouseEventToLatLng(e);
  24.  
  25. // Move the node to the new map point.
  26. node.setLatLng(latlng);
  27. };
  28.  
  29. // Add the drag event listener to all place nodes.
  30. map.on('click', (e) => {
  31. // Check if the clicked item is a place node.
  32. if (e.target instanceof Waze.Feature.Vector.PlaceNode) {
  33. // Add the drag event listener.
  34. e.target.on('drag', dragNode);
  35. }
  36. });
  37.  
  38. // Remove the drag event listener from all place nodes when the mouse is released.
  39. map.on('mouseup', (e) => {
  40. // Check if the released item is a place node.
  41. if (e.target instanceof Waze.Feature.Vector.PlaceNode) {
  42. // Remove the drag event listener.
  43. e.target.off('drag', dragNode);
  44. }
  45. });
  46. })();