PageSourceSearch

https://whatismylocation.ai/js/irish-grid.js?v=46

js whatismylocation.ai collected 2026-10-05 14:58:30 UTC 7,598 bytes, 1 lines download raw bytes

1(function(){"use strict";function d(n,t,i){var r=n*Math.PI/180,f=t*Math.PI/180,e=1-i.b*i.b/(i.a*i.a),u=i.a/Math.sqrt(1-e*Math.sin(r)*Math.sin(r));return{x:u*Math.cos(r)*Math.cos(f),y:u*Math.cos(r)*Math.sin(f),z:u*(1-e)*Math.sin(r)}}function g(n,t){for(var r=1-t.b*t.b/(t.a*t.a),u=Math.sqrt(n.x*n.x+n.y*n.y),i=Math.atan2(n.z,u*(1-r)),f=2*Math.PI,e;Math.abs(i-f)>1e-12;)f=i,e=t.a/Math.sqrt(1-r*Math.sin(i)*Math.sin(i)),i=Math.atan2(n.z+r*e*Math.sin(i),u);return{lat:i*180/Math.PI,lng:Math.atan2(n.y,n.x)*180/Math.PI}}function nt(n,t,i){var r=i?-1:1,u=1+r*t.s/1e6,f=r*t.rx/3600*Math.PI/180,e=r*t.ry/3600*Math.PI/180,o=r*t.rz/3600*Math.PI/180;return{x:r*t.tx+u*n.x-o*n.y+e*n.z,y:r*t.ty+o*n.x+u*n.y-f*n.z,z:r*t.tz-e*n.x+f*n.y+u*n.z}}function ft(n,t){return g(nt(d(n,t,w),k,!0),s)}function et(n,t){return g(nt(d(n,t,s),k,!1),w)}function tt(n,t,r,u,f){return t.ell.b*t.F0*((1+r+5/4*u+5/4*f)*(n-i)-(3*r+3*u+21/8*f)*Math.sin(n-i)*Math.cos(n+i)+(15/8*u+15/8*f)*Math.sin(2*(n-i))*Math.cos(2*(n+i))-35/24*f*Math.sin(3*(n-i))*Math.cos(3*(n+i)))}function l(n,t,i){var o=i.ell.a,c=i.ell.b,y=i.F0,l=n*Math.PI/180,w=t*Math.PI/180,a=1-c*c/(o*o),s=(o-c)/(o+c),k=s*s,d=s*s*s,f=Math.sin(l),h=Math.cos(l),r=Math.tan(l),u=o*y/Math.sqrt(1-a*f*f),p=o*y*(1-a)/Math.pow(1-a*f*f,1.5),v=u/p-1,g=tt(l,i,s,k,d),nt=g+i.N0,it=u/2*f*h,rt=u/24*f*Math.pow(h,3)*(5-r*r+9*v),ut=u/720*f*Math.pow(h,5)*(61-58*r*r+Math.pow(r,4)),ft=u*h,et=u/6*Math.pow(h,3)*(u/p-r*r),ot=u/120*Math.pow(h,5)*(5-18*r*r+Math.pow(r,4)+14*v-58*r*r*v),e=w-b;return{N:nt+it*e*e+rt*Math.pow(e,4)+ut*Math.pow(e,6),E:i.E0+ft*e+et*Math.pow(e,3)+ot*Math.pow(e,5)}}function a(n,t,r){var o=r.ell.a,a=r.ell.b,w=r.F0,k=1-a*a/(o*o),h=(o-a)/(o+a),nt=h*h,it=h*h*h,s=i,d=0;do s=(t-r.N0-d)/(o*w)+s,d=tt(s,r,h,nt,it);while(Math.abs(t-r.N0-d)>1e-5);var v=Math.sin(s),c=Math.tan(s),y=1/Math.cos(s),u=o*w/Math.sqrt(1-k*v*v),l=o*w*(1-k)/Math.pow(1-k*v*v,1.5),g=u/l-1,f=c*c,p=f*f,rt=p*f,ut=c/(2*l*u),ft=c/(24*l*Math.pow(u,3))*(5+3*f+g-9*f*g),et=c/(720*l*Math.pow(u,5))*(61+90*f+45*p),ot=y/u,st=y/(6*Math.pow(u,3))*(u/l+2*f),ht=y/(120*Math.pow(u,5))*(5+28*f+24*p),ct=y/(5040*Math.pow(u,7))*(61+662*f+1320*p+720*rt),e=n-r.E0;return{lat:(s-ut*e*e+ft*Math.pow(e,4)-et*Math.pow(e,6))*180/Math.PI,lng:(b+ot*e-st*Math.pow(e,3)+ht*Math.pow(e,5)-ct*Math.pow(e,7))*180/Math.PI}}function ot(n,t,i){if(n<0||n>=5e5||t<0||t>=5e5)return null;var s=Math.floor(n/1e5),h=4-Math.floor(t/1e5),f=h*5+s;f>7&&f++;for(var c=String.fromCharCode(f+65),e=i/2,o=Math.pow(10,5-e),r=String(Math.floor(n%1e5/o)),u=String(Math.floor(t%1e5/o));r.length<e;)r="0"+r;while(u.length<e)u="0"+u;return c+" "+r+" "+u}function st(n){var t,i;if(n=String(n||"").trim().toUpperCase().replace(/[^A-Z0-9]/g,""),t=n.match(/^([A-HJ-Z])(\d{2,10})$/),!t||t[2].length%2!=0)return null;i=t[1].charCodeAt(0)-65;i>8&&i--;var f=i%5,e=Math.floor(i/5),u=t[2].length/2,r=Math.pow(10,5-u);return{E:f*1e5+parseInt(t[2].slice(0,u),10)*r+r/2,N:(4-e)*1e5+parseInt(t[2].slice(u),10)*r+r/2,figures:t[2].length}}function o(n,t,i){var f=ft(n,t),r=l(f.lat,f.lng,h),e=ot(r.E,r.N,i||6),u;return e?(u=l(n,t,c),{ref:e,E:Math.round(r.E),N:Math.round(r.N),itmE:Math.round(u.E*10)/10,itmN:Math.round(u.N*10)/10}):null}function it(n){var t=st(n),i,r;return t?(i=a(t.E,t.N,h),r=et(i.lat,i.lng),{lat:r.lat,lng:r.lng,E:t.E,N:t.N,figures:t.figures}):null}function rt(n,t){var i=a(n,t,c);return i.lat<51||i.lat>56||i.lng<-11.5||i.lng>-5?null:{lat:i.lat,lng:i.lng}}function t(n,t){var i=window.WIML_I18N;return i&&i[n]||t}function ht(){var n=document.querySelector('input[name="ig-figures"]:checked');return n?parseInt(n.value,10):6}function ut(){if(r){var i=o(r.lat,r.lng,ht());if(!i){n("ig-mine").textContent=t("t_outside_irish_grid","Outside the Irish grid");n("ig-itm").textContent=t("t_ig_island_only","The Irish grid covers the island of Ireland only — see the notes below.");return}n("ig-mine").textContent=i.ref;n("ig-itm").textContent="ITM E "+i.itmE+"  N "+i.itmN+(r.acc?"  (±"+Math.round(r.acc)+" m GPS)":"")}}function e(i,r,e){var s=o(i,r,10),h;if(n("ig-out").hidden=!1,!s){n("ig-ref-out").textContent=t("t_outside_irish_grid","Outside the Irish grid");n("ig-ref-rows").innerHTML="";n("ig-latlng-out").textContent=i.toFixed(6)+", "+r.toFixed(6)+" — "+t("t_ig_elsewhere","
1island of Ireland only; Great Britain has the OS grid, the world has UTM.");return}n("ig-ref-out").textContent=s.ref;h=n("ig-ref-rows");h.innerHTML="";[[6,"100 m"],[8,"10 m"],[4,"1 km"]].forEach(function(n){var e=o(i,r,n[0]),u=document.createElement("div"),f=document.createElement("dt"),t;f.textContent=n[0]+"-figure ("+n[1]+")";t=document.createElement("dd");t.className="coord-value";t.textContent=e.ref;u.appendChild(f);u.appendChild(t);h.appendChild(u)});n("ig-itm-out").textContent="E "+s.itmE+", N "+s.itmN;n("ig-latlng-out").textContent=i.toFixed(6)+", "+r.toFixed(6)+(e?" — "+e:"");u.loadLeaflet(function(){f||(f=u.makeMap("ig-map",{lat:i,lng:r},{zoom:14,staticPin:!0}));n("ig-map-card").hidden=!1;f.setPoint(i,r,14);f.map.invalidateSize()})}function y(){var i=n("ig-q").value.trim(),f,r,o,s;if(i){if(f=it(i),f){e(f.lat,f.lng,i.toUpperCase().replace(/\s+/g," "));n("ig-conv-status").textContent="";return}if(r=i.match(/^(\d{6})(?:\.\d+)?[,\s]+(\d{6,7})(?:\.\d+)?$/),r&&(o=rt(parseFloat(r[1]),parseFloat(r[2])),o)){e(o.lat,o.lng,"ITM "+r[1]+", "+r[2]);n("ig-conv-status").textContent="";return}if(s=u.coords.parseCoordinates(i),s){e(s.lat,s.lng,null);n("ig-conv-status").textContent="";return}n("ig-conv-status").textContent=t("t_resolving","Resolving…");u.resolveLocation(i).then(function(t){n("ig-conv-status").textContent="";e(t.lat,t.lng,t.label)}).catch(function(){n("ig-conv-status").textContent=t("t_ig_no_match","Not a grid reference, ITM pair, coordinates, or a findable place — try “J 337 740”, “715830, 734697”, or a town name.")})}}var u=window.WIML=window.WIML||{},w={a:6378137,b:6356752.314245},s={a:6377340.189,b:6356034.447},i=53.5*Math.PI/180,b=-8*Math.PI/180,h={ell:s,F0:1.000035,E0:2e5,N0:25e4},c={ell:{a:6378137,b:6356752.31414},F0:.99982,E0:6e5,N0:75e4},k={tx:482.53,ty:-130.596,tz:564.557,rx:-1.042,ry:-.214,rz:-.631,s:8.15},v,n,r,f,p;(u.irishgrid={toIrish:o,fromRef:it,fromItm:rt,_tmForward:l,_tmInverse:a,_IG:h,_ITM:c},v=document.getElementById("irishgrid-tool"),v)&&(n=function(n){return document.getElementById(n)},r=null,f=null,n("btn-ig-locate").addEventListener("click",function(){if(!navigator.geolocation){n("ig-status").textContent=t("t_geolocation_not_supported","Geolocation not supported.");return}n("ig-status").textContent=t("t_getting_your_position","Getting your position…");navigator.geolocation.getCurrentPosition(function(t){r={lat:t.coords.latitude,lng:t.coords.longitude,acc:t.coords.accuracy};n("ig-status").textContent="";n("ig-mine-card").hidden=!1;ut()},function(){n("ig-status").textContent=t("t_osg_denied","Permission denied — you can still convert below.")},{enableHighAccuracy:!0,timeout:12e3,maximumAge:0})}),v.addEventListener("change",function(n){n.target&&n.target.name==="ig-figures"&&ut()}),n("btn-ig-copy").addEventListener("click",function(){var i=n("ig-mine").textContent;i&&i!=="—"&&navigator.clipboard.writeText(i).then(function(){n("btn-ig-copy").textContent=t("t_copied","✓ Copied");setTimeout(function(){n("btn-ig-copy").textContent=t("t_copy","Copy")},1500)})}),n("btn-ig-go").addEventListener("click",y),n("ig-q").addEventListener("keydown",function(n){n.key==="Enter"&&(n.preventDefault(),y())}),n("ig-q").addEventListener("recent-selected",function(n){e(n.detail.lat,n.detail.lng,n.detail.name)}),p=new URLSearchParams(location.search).get("q"),p&&(n("ig-q").value=p,y()))})()

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.