UR Editor Profile Viewer

Changes the editor names in URs to a link direct to the editor profile.

  1. // ==UserScript==
  2. // @name UR Editor Profile Viewer
  3. // @namespace Dude495
  4. // @version 2020.03.25.01
  5. // @description Changes the editor names in URs to a link direct to the editor profile.
  6. // @author Dude495
  7. // @include /^https:\/\/(www|beta)\.waze\.com\/(?!user\/)(.{2,6}\/)?editor\/?.*$/
  8. // @require https://gf.qytechs.cn/scripts/24851-wazewrap/code/WazeWrap.js
  9. // @license GNU GPLv3
  10. // @grant none
  11. // ==/UserScript==
  12. // HUGE Thanks to Joyriding & MoM for their patience and helping me learn to the basics and walk me through my first script!!!
  13.  
  14. (async function() {
  15. 'use strict';
  16. var VERSION = GM_info.script.version;
  17. var SCRIPT_NAME = GM_info.script.name;
  18. var UPDATE_ALERT = false;
  19. var UPDATE_NOTES = [
  20. SCRIPT_NAME + ' has been updated to v' + VERSION,
  21. '',
  22. '* WazeWrap version bump.'
  23. ].join('\n');
  24.  
  25. if (UPDATE_ALERT) {
  26. SCRIPT_NAME = SCRIPT_NAME.replace( /\s/g, '') + VERSION;
  27. if (localStorage.getItem(SCRIPT_NAME) !== VERSION) {
  28. alert(UPDATE_NOTES);
  29. localStorage.setItem(SCRIPT_NAME, VERSION);
  30. }
  31. }
  32. function EPV() {
  33. var i;
  34. for (i = 0; i < $('span.username').length; i++) {
  35. if ($('span.username')[i].textContent.includes('(')) {
  36. var epvusername = $('span.username')[i].textContent.match(/(.*)\(\d\)/);
  37. var username = epvusername[1];
  38. var profilelink = '<a href="https://www.waze.com/user/editor/' + username + '" target="_blank">' + epvusername[0] + '</a>';
  39. $('span.username')[i].innerHTML = profilelink;
  40. }
  41. }
  42. }
  43. function PURPM() {
  44. if ($('#panel-container > div > div.place-update > div > div.body > div.scrollable > div > div.add-details > div.small.user')[0].childNodes[1].textContent.includes('(')) {
  45. var center = W.map.center.clone().transform(W.map.projection.projCode, W.map.displayProjection.projCode);
  46. var LON = center.lon;
  47. var LAT = center.lat;
  48. var ZOOM = W.map.zoom;
  49. var ENVL = $('#sidepanel-prefs > div > div > form > div:nth-child(4) > select')[0].value;
  50. var ENV = $('#env-select > div > select')[0].value;
  51. if ($('#landmark-edit-general > ul > li:nth-child(2)')[0] !== undefined) {
  52. let VenueID = $('#landmark-edit-general > ul > li:nth-child(2)')[0].textContent.match(/([0-9].*)/)[1];
  53. var PermaLink = encodeURIComponent('https://www.waze.com/' + ENVL + '/editor?env=' + ENV + '&lon=' + LON + '&lat=' + LAT + '&zoom=' + ZOOM + '&venues=' + VenueID);
  54. } else {
  55. PermaLink = encodeURIComponent('https://www.waze.com/' + ENVL + '/editor?env=' + ENV + '&lon=' + LON + '&lat=' + LAT + '&zoom=' + ZOOM);
  56. }
  57. var epvusername = $('#panel-container > div > div.place-update > div > div.body > div.scrollable > div > div.add-details > div.small.user')[0].childNodes[1].textContent.match(/(.*)\(\d\)/);
  58. var username = epvusername[1];
  59. var profilelink = ' <a href="https://www.waze.com/forum/ucp.php?i=pm&mode=compose&username=' + username + '&subject=About This Place Update Request&message=[url=' + PermaLink + ']PermaLink[/url] " target="_blank">(PM)</a>';
  60. $('#panel-container > div > div.place-update > div > div.body > div.scrollable > div > div.add-details > div.small.user')[0].innerHTML += profilelink;
  61. };
  62. };
  63. function init() {
  64. var mo = new MutationObserver(mutations => {
  65. mutations.forEach(m => m.addedNodes.forEach(node => {
  66. if ($(node).hasClass('conversation-view') || $(node).hasClass('map-comment-feature-editor')) EPV();
  67. else if ($(node).hasClass('place-update-edit')) PURPM();
  68. }));
  69. });
  70. mo.observe(document.querySelector('#panel-container'), {childList: true, subtree:true});
  71. mo.observe($('#edit-panel .contents')[0], {childList:true, subtree:true});
  72. };
  73. function bootstrap() {
  74. if (W && W.loginManager && W.loginManager.user && ($('#panel-container').length || $('span.username').length >= 1)) {
  75. init();
  76. console.log(GM_info.script.name, 'Initialized');
  77. } else {
  78. console.log(GM_info.script.name, 'Bootstrap failed. Trying again...');
  79. window.setTimeout(() => bootstrap(), 500);
  80. }
  81. }
  82. bootstrap();
  83. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址