GCFinn

Finn Kart-link for Geocaching.com

  1. // ==UserScript==
  2. // @name GCFinn
  3. // @version 1.1.3
  4. // @namespace https://greatest.deepsurf.us/nb/scripts/40538-gcfinn
  5. // @description Finn Kart-link for Geocaching.com
  6. // @include http*://*geocaching.com/geocache/*
  7. // @include http*://*geocaching.com/seek/cache_details.aspx*
  8. // ==/UserScript==
  9.  
  10. // Copyright (c) 2009-2010 Jostein Austvik Jacobsen
  11. // Edited by Lord Wadar 2017-2021
  12. //
  13. // Permission is hereby granted, free of charge, to any person
  14. // obtaining a copy of this software and associated documentation
  15. // files (the "Software"), to deal in the Software without
  16. // restriction, including without limitation the rights to use,
  17. // copy, modify, merge, publish, distribute, sublicense, and/or sell
  18. // copies of the Software, and to permit persons to whom the
  19. // Software is furnished to do so, subject to the following
  20. // conditions:
  21. //
  22. // The above copyright notice and this permission notice shall be
  23. // included in all copies or substantial portions of the Software.
  24. //
  25. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  27. // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  29. // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  30. // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  31. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  32. // OTHER DEALINGS IN THE SOFTWARE.
  33.  
  34. mapLinks = document.getElementById('ctl00_ContentBody_MapLinks_MapLinks');
  35. mapLinksLi = mapLinks.getElementsByTagName('li');
  36. query = mapLinksLi[0].getElementsByTagName('a')[0].href.split("?");
  37. query = query[query.length-1];
  38. lat = null;
  39. lng = null;
  40. for (var i = 0; i < query.split("&").length; i++) {
  41. pair = query.split("&")[i];
  42. if (pair.split("=").length <= 1) continue;
  43. key = pair.split("=")[0];
  44. if (key == "lat")
  45. lat = pair.split("=")[1];
  46. if (key == "lng" || key == "lon")
  47. lng = pair.split("=")[1];
  48. }
  49. if (lat != null && lng != null) {
  50. cacheName = document.getElementById('ctl00_ContentBody_CacheName').textContent;
  51. finnLink = document.createElement('li');
  52. finnLink.innerHTML = '<a href="http://kart.finn.no/?lng='+lng+'&lat='+lat+'&zoom=20&mapType=finnhybrid&markers='+lng+','+lat+',r,'+escape(cacheName)+'" target="_blank">FINN Kart</a>';
  53. mapLinks.prepend(finnLink);
  54. }