UR Editor Profile Viewer

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

当前为 2018-08-19 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name UR Editor Profile Viewer
  3. // @namespace Dude495
  4. // @version 2018.07.29.001
  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. (function() {
  15. 'use strict';
  16.  
  17. var VERSION = GM_info.script.version;
  18. var SCRIPT_NAME = GM_info.script.name;
  19. var UPDATE_ALERT = true;
  20. var UPDATE_NOTES = [
  21. SCRIPT_NAME + ' has been updated to v' + VERSION,
  22. '',
  23. '* Public Release',
  24. '* Huge Thanks to Joyriding and MoM for their patience and help learning this process!'
  25. ].join('\n');
  26.  
  27. if (UPDATE_ALERT) {
  28. SCRIPT_NAME = SCRIPT_NAME.replace( /\s/g, '') + VERSION;
  29. if (localStorage.getItem(SCRIPT_NAME) !== VERSION) {
  30. alert(UPDATE_NOTES);
  31. localStorage.setItem(SCRIPT_NAME, VERSION);
  32. }
  33. }
  34.  
  35. function EPV() {
  36. var i;
  37. for (i = 0; i < $('span.username').length; i++) {
  38. if ($('span.username')[i].textContent.includes('(')) {
  39. var epvusername = $('span.username')[i].textContent.match(/(.*)\(\d\)/);
  40. var username = epvusername[1];
  41. var profilelink = '<a href="https://www.waze.com/user/editor/' + username + '" target="_blank">' + epvusername[0] + '</a>';
  42. $('span.username')[i].innerHTML = profilelink;
  43. }
  44. }
  45. }
  46.  
  47. function init() {
  48. var mo = new MutationObserver(mutations => {
  49. mutations.forEach(m => m.addedNodes.forEach(node => {
  50. if ($(node).hasClass('conversation-view')) EPV();
  51. }));
  52. });
  53. mo.observe(document.querySelector('#panel-container'), {childList: true, subtree:true})
  54. }
  55. function bootstrap() {
  56. if (W && W.loginManager && W.loginManager.user && $('#panel-container').length) {
  57. init();
  58. console.log(GM_info.script.name, 'Initialized');
  59. } else {
  60. console.log(GM_info.script.name, 'Bootstrap failed. Trying again...');
  61. window.setTimeout(() => bootstrap(), 500);
  62. }
  63. }
  64. bootstrap();
  65. })();

QingJ © 2025

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