Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geocaching Height : no more working (June 2019) since link has changed #42

Closed
Krevo opened this issue Jun 9, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@Krevo
Copy link

commented Jun 9, 2019

I've got the error :
TypeError: Cannot read property 'length' of null at getCoords (userscript.html?id=e50fbb23-e0b0-4d26-a4f1-aedc68293fb5:60)

(seems to be on line 54 : return (target && target.href && (matched = target.href.match(pattern), matched.length === 3))

Currently lat and lng are grabbed from the link with id ctl00_ContentBody_uxViewLargerMap
but this kind of link seems to have changed, since a recent update on maps.

I actually have this link :
<a_ id="ctl00_ContentBody_uxViewLargerMap" title="Voir une plus grande carte" href="/play/map/GC1Y014" target="_blank" rel="noopener noreferrer">Afficher la carte agrandie</a>

Locally I've replaced the line :
const coords = getCoords("ctl00_ContentBody_uxViewLargerMap");
with :
const coords = {lat: lat, lng: lng};

as the page seems to expose directly vars called lat and lng as I can se on the source of the page :

<script type="text/javascript">   var isLoggedIn = true;   var lat=45.879233, lng=6.887133, guid='0157909c-6d0d-4ef7-9f07-4dd858dc1f89'; </script>

@JRInge JRInge added the bug label Jun 10, 2019

@JRInge JRInge self-assigned this Jun 10, 2019

JRInge added a commit that referenced this issue Jun 10, 2019

Changed getCoords() method
Cache listing on geocaching.com no longer has coordinates available in an element with a known id (issue #42).  Now gets lat and lng global variables from content context using unsafeWindow.  Alternative strategies would be to parse from document.body.innerHTML, or search all A.href strings for likely looking coords.
@JRInge

This comment has been minimized.

Copy link
Owner

commented Jun 10, 2019

I think this is fixed in the Height Development branch. If it works for you too @Krevo, I'll deploy the fix tomorrow.

@Krevo

This comment has been minimized.

Copy link
Author

commented Jun 11, 2019

I confirm, it works for me ! :-)
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.