Google Calendar Openstreetmap Links

Automatically replaces the "Map" link in the google calendar overview with openstreetmap links.

  1. // ==UserScript==
  2. // @name Google Calendar Openstreetmap Links
  3. // @include https://www.google.com/calendar/render?&pli=1#h
  4. // @version 1.1
  5. // @description:en Automatically replaces the "Map" link in the google calendar overview with openstreetmap links.
  6. // @grant none
  7. // @namespace https://gf.qytechs.cn/users/9466
  8. // @description Automatically replaces the "Map" link in the google calendar overview with openstreetmap links.
  9. // ==/UserScript==
  10. window.addEventListener('load', function () {
  11. var target = document.querySelector('.bubble');
  12. console.log(target);
  13. var pattern = re = new RegExp('.*&q=(.+)&.*')
  14. var replacement = 'https://openstreetmap.org/search?query=$1'
  15. // create an observer instance
  16. var observer = new MutationObserver(function (mutations) {
  17. mutations.forEach(function (mutation) {
  18. googleMapsLink = target.querySelector('a[href^=\'https://maps.google\']');
  19. if (googleMapsLink) {
  20. googleMapsLink.attributes.href.textContent = googleMapsLink.attributes.href.textContent.replace(pattern, replacement);
  21. }
  22. });
  23. });
  24. // configuration of the observer:
  25. var config = {
  26. attributes: true,
  27. childList: false,
  28. characterData: false
  29. };
  30. // pass in the target node, as well as the observer options
  31. observer.observe(target, config);
  32. }, false);

QingJ © 2025

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