WME-Force-Data

When Wazes data does not load this will move the map an unnoticeable amount forcing waze to load in the data

当前为 2015-12-10 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name WME-Force-Data
  3. // @namespace https://greasyfork.org/en/users/5920-rickzabel
  4. // @description When Wazes data does not load this will move the map an unnoticeable amount forcing waze to load in the data
  5. // @include https://www.waze.com/editor/*
  6. // @include https://www.waze.com/*/editor/*
  7. // @include https://editor-beta.waze.com/*
  8. // @version 0.1
  9. // @grant none
  10. // @copyright 2015 rickzabel
  11. // ==/UserScript==
  12. //---------------------------------------------------------------------------------------
  13. (function() {
  14. function bootstrap_WMEForceWazeData() {
  15. if (typeof($) === 'function') {
  16. console.info('WME-Force-Data: Jquery Loaded');
  17. window.window.setInterval(WMEForceWazeData_CheckAndMove, 2000);
  18. } else {
  19. console.info('WME-Force-Data: no Jquery');
  20. setTimeout(bootstrap_WMEForceWazeData, 1000);
  21. }
  22. }
  23.  
  24. function WMEForceWazeData_CheckAndMove() {
  25. try {
  26. var UserID = Waze.loginManager.getLoggedInUser().id; //editor's id number
  27. var UserLevel = W.model.users.objects[UserID].rank + 1; //editor's rank
  28.  
  29. } catch (err) {
  30. if (Object.keys(W.model.updateRequestSessions.objects).length === 0) {
  31. console.info('WME-Force-Data: Waze\'s data is missing attempting a map move to force data into loading.');
  32. WMEForceWazeData_ShowWMEMessage('WME-Force-Data: Waze\'s data is missing attempting a map move to force data into loading.', 5000);
  33. var CurrentLocation = Waze.map.getCenter();
  34. CurrentLocation.lat = CurrentLocation.lat - 0.0000001;
  35. Waze.map.setCenter(CurrentLocation, W.map.mapState.mapLocation.zoom);
  36. }
  37. }
  38. }
  39.  
  40. function WMEForceWazeData_ShowWMEMessage(message, delay) {
  41. var dateNow = new Date();
  42. var TrickRemove = dateNow.getTime();
  43. var width = message.length * 10;
  44. var c = '<div id="WMEForceWazeDataMapNote' + TrickRemove + '" style="width: ' + width + 'px; font-size: 15px; font-weight: bold; margin-left: auto; margin-right: auto; background-color: orange;"><center><b>' + message + '</b></center></div>';
  45. $("#toolbar").append(c);
  46. $("#WMEForceWazeDataMapNote" + TrickRemove).show().delay(delay).queue(function(n) {
  47. $(this).remove();
  48. n();
  49. });
  50.  
  51. };
  52.  
  53. setTimeout(bootstrap_WMEForceWazeData, 1000);
  54. })();