WME-Force-Data

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

  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.1
  9. // @grant none
  10. // @copyright 2015 rickzabel
  11. // ==/UserScript==
  12. //---------------------------------------------------------------------------------------
  13. (function() {
  14. var ForecedDataRunOnLoad = "no";
  15. function bootstrap_WMEForceWazeData() {
  16. if (typeof($) === 'function') {
  17. console.info('WME-Force-Data: Jquery Loaded');
  18. window.window.setInterval(WMEForceWazeData_CheckAndMove, 2000);
  19. } else {
  20. console.info('WME-Force-Data: no Jquery');
  21. setTimeout(bootstrap_WMEForceWazeData, 1000);
  22. }
  23. }
  24.  
  25. function WMEForceWazeData_CheckAndMove() {
  26. try {
  27. var UserID = Waze.loginManager.getLoggedInUser().id; //editor's id number
  28. var UserLevel = W.model.users.objects[UserID].rank + 1; //editor's rank
  29.  
  30. /*if($('#welcome-popup > div > div.login > div.login-form > form > input.form-control.password').val() !== null){
  31. $('#welcome-popup > div > div.login > div.login-form > form > input.form-control.password').click();
  32. $('#welcome-popup > div > div.login > div.login-form > form > div.form-action > button').click();
  33. }
  34. */
  35. } catch (err) {
  36. // if ((Object.keys(W.model.updateRequestSessions.objects).length === 0 || ForecedDataRunOnLoad = "no") && !$('#welcome-popup > div > div.login > div.login-form > form > input.form-control.password')) {
  37. console.info('WME-Force-Data: Waze\'s data is missing attempting a map move to force data into loading.');
  38. WMEForceWazeData_ShowWMEMessage('WME-Force-Data: Waze\'s data is missing attempting a map move to force data into loading.', 5000);
  39. var CurrentLocation = Waze.map.getCenter();
  40. CurrentLocation.lat = CurrentLocation.lat - 0.0000001;
  41. Waze.map.setCenter(CurrentLocation, W.map.mapState.mapLocation.zoom);
  42. ForecedDataRunOnLoad = "yes";
  43. //}
  44. }
  45. }
  46.  
  47. function WMEForceWazeData_ShowWMEMessage(message, delay) {
  48. var dateNow = new Date();
  49. var TrickRemove = dateNow.getTime();
  50. var width = message.length * 10;
  51. 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>';
  52. $("#toolbar").append(c);
  53. $("#WMEForceWazeDataMapNote" + TrickRemove).show().delay(delay).queue(function(n) {
  54. $(this).remove();
  55. n();
  56. });
  57.  
  58. };
  59.  
  60. setTimeout(bootstrap_WMEForceWazeData, 1000);
  61. })();