WME Fix Map Object

Temporary fix for the changes made in the WME internal data structure that breaks any script that interacts with the map

当前为 2019-10-31 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name WME Fix Map Object
  3. // @namespace http://www.tomputtemans.com/
  4. // @description Temporary fix for the changes made in the WME internal data structure that breaks any script that interacts with the map
  5. // @include /^https:\/\/(www|beta)\.waze\.com\/(?!user\/)(.{2,6}\/)?editor.*$/
  6. // @version 0.0.1
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. /* global W */
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. function init() {
  16. if (typeof W === 'undefined' ||
  17. typeof W.map === 'undefined' ||
  18. typeof W.map.olMap === 'undefined') {
  19. setTimeout(init, 100);
  20. return;
  21. }
  22. // Go through all properties, including the prototype chain
  23. for (var mapProperty in W.map.olMap) {
  24. if (!W.map[mapProperty]) {
  25. W.map[mapProperty] = W.map.olMap[mapProperty];
  26. }
  27. }
  28. }
  29.  
  30. init();
  31. })();