It’s been raised before how In British records there’s a need for OS Grid references (for numerous reasons, which can be omitted here).I thought to add it in to my browser using a temporary firefox addin I use, and thought I would pass on the functional no-frllls code that does the task (using an example latitude,longitude (aLatLng=) which can be fetched from the web page) in case anyone felt it was useful to adapt -
<html><body>
<span id='os' onclick="osshow('55.9220459,-3.4202912');">Click to show OS</span>
<script>
function osshow(sLatLng) {
var oOS=document.createElement('script');oOS.type='module';
oOS.innerHTML=
`var aLatLng,o;
import {LatLon} from 'https://cdn.jsdelivr.net/npm/geodesy@2.4.0/osgridref.js';
aLatLng=[`+sLatLng+`];
(o=document.getElementById('os')).innerHTML=(new LatLon(aLatLng[0]*1,aLatLng[1]*1)).toOsGrid().toString(10);o.onclick=null;`
document.body.appendChild(oOS);
}
</script>
</body></html>
3 Likes
David, Any chance of publishing and releasing the Firefox add-in for this conversion ??
I made a general add-in I use to adjust inaturalist pages so it’s full of a lot of other things, I should provide a link to it with instructions. There’s a more formal innaturalist add-in which the author might want to put the OS code in too in a suitable way. But I use a temporary add-in so I can adjust and use without any formal effort.
1 Like
You’re welcome to make use of it; it’s fairly ad hoc (not optimised) so let me know if anything doesn’t operate as expected at your end as it may be some things are tied to my settings (it does things by finding IDs on the page, which could be different for different settings, I’ve not experimented, but just using Scientific names it isn’t arranged to handle, I have Scientific (Common) name option).
Download here, save as a .js file somewhere on your computer -
https://www.paintdrawer.co.uk/temp/firefoxadjust.js
In firefox, do about:debugging
and pin that tab for reuse. Under “This Firefox” click “Load Temporary Add-on” and load the file, which will then be listed. It will stay there as long as you keep firefox open, that’s why pinning the tab is useful, and remember where you loaded it from for next time. You can remove it by reopening the browser, or click Remove underneath it.
Your OS conversion is on an observation as the word “OS” - when clicked it will replace with the OS grid reference and also copy to clipboard, if the observation is in the UK.
Various other things, such as the ability to make custom lists (typically Std Oth ?), and photobrowsing that’s much larger than usual, and under an observation most of the buttons either copy to the clipboard or launch a related webpage, or are buttons for adding to custom lists…
1 Like
I’ve just made some adjustments to it.