WazeWrapBeta

A base library for WME script writers

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require https://update.greatest.deepsurf.us/scripts/24870/1161434/WazeWrapBeta.js

  1. // ==UserScript==
  2. // @name WazeWrapBeta
  3. // @namespace https://greatest.deepsurf.us/users/30701-justins83-waze
  4. // @version 2023.03.14.03
  5. // @description A base library for WME script writers
  6. // @author JustinS83/MapOMatic
  7. // @include https://beta.waze.com/*editor*
  8. // @include https://www.waze.com/*editor*
  9. // @exclude https://www.waze.com/*user/editor/*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. /* global WazeWrap */
  14. /* global $ */
  15. /* jshint esversion:6 */
  16.  
  17. var WazeWrap = {};
  18.  
  19. (function() {
  20. 'use strict';
  21. const MIN_VERSION = '2019.05.01.01';
  22. const WW_URL = 'https://cdn.jsdelivr.net/gh/WazeDev/WazeWrap@2023.03.14.04/WazeWrapLib.js';
  23.  
  24. async function init(){
  25. const sandboxed = typeof unsafeWindow !== 'undefined';
  26. const pageWindow = sandboxed ? unsafeWindow : window;
  27. const wwAvailable = pageWindow.WazeWrap && (!pageWindow.WazeWrap.Version || pageWindow.WazeWrap.Version > MIN_VERSION);
  28.  
  29. if (wwAvailable) {
  30. WazeWrap = pageWindow.WazeWrap;
  31. } else {
  32. pageWindow.WazeWrap = WazeWrap;
  33. }
  34. if (sandboxed) window.WazeWrap = WazeWrap;
  35. if (!wwAvailable) await $.getScript(WW_URL);
  36. }
  37. function bootstrap(tries = 1) {
  38. if (typeof $ != 'undefined')
  39. init();
  40. else if (tries < 1000)
  41. setTimeout(function () { bootstrap(tries++); }, 100);
  42. else
  43. console.log('WazeWrap launcher failed to load');
  44. }
  45. bootstrap();
  46. })();