Leaderboard
Popular Content
Showing content with the highest reputation since 01/15/25 in all areas
-
Reverse Wherigo Solver?
Hodějovice reacted to Udo for a question
Hi there, using tampermonkey and a script, you can solve it on the geocaching webpage directly. The code searches for 3 6-digit codes and calculates the coordinates. You'll find a button in the top left corner of the Cache-page. Unfortunately you have to click the button about three times to calculate the coordinates, insert the data into the personal notes, and correct the coordinates, but it is usually much faster than copy and paste... Install Tampermonkey, Create a new empty script and paste the source-code My source-code: // ==UserScript== // @name calc Reverse Wherigo (Waldmeister) ohne DB // @namespace http://mediastation // @match http*://www.geocaching.com/seek/cache_details.aspx?* // @match http*://www.geocaching.com/geocache/GC* // @grant GM_getValue // @grant GM_setValue // @grant GM_log // @grant GM.xmlhttpRequest // @grant GM_addStyle // @grant unsafeWindow // @grant GM.openInTab // @description calculate coordinates from WIG 6-digit codes // // // @version 1.1.0 // ==/UserScript== /*--- Create a button in a container div. It will be styled and positioned with CSS. */ var zNode = document.createElement ('div'); zNode.innerHTML = '<button id="myWIGButton" type="button">Solve Reverse WIG</button>'; zNode.setAttribute ('id', 'myWIGContainer'); document.body.appendChild (zNode); //--- Activate the newly added button. document.getElementById ("myWIGButton").addEventListener ( "click", ButtonClickAction, false ); //--- Style our newly added elements using CSS. GM_addStyle ( multilineStr ( function () {/*! #myWIGContainer { position: absolute; top: 0; left: 10px; font-size: 10px; background: red; opacity: 0.9; z-index: 1100; padding: 5px 20px; } #myWIGButton { cursor: pointer; } #myWIGContainer p { color: red; background: white; } */} ) ); function gowherei(args){ var answer= []; var AAAAAA = parseFloat(args[1]); var BBBBBB = parseFloat(args[2]); var CCCCCC = parseFloat(args[3]); //alert(AAAAAA + ' - ' + BBBBBB + ' - ' + CCCCCC); var LongVORZ = 1.0; var LatKOMP = 0.0; var LatVORZ = 1.0; var LongKOMP = 0.0; if (( AAAAAA % 1000 - AAAAAA % 100) / 100 == 1) { LatVORZ = 1; LongVORZ = 1; } if ((AAAAAA % 1000 - AAAAAA % 100) / 100 == 2) { LatVORZ = -1; LongVORZ = 1; } if ((AAAAAA % 1000 - AAAAAA % 100) / 100 == 3) { LatVORZ = 1; LongVORZ = -1; } if ((AAAAAA % 1000 - AAAAAA % 100) / 100 == 4) { LatVORZ = -1; LongVORZ = -1; } if ((((CCCCCC % 100000 - CCCCCC % 10000) / 10000 + (CCCCCC % 100 - CCCCCC % 10) / 10) % 2) == 0){ LongKOMP = (LongVORZ * ((AAAAAA % 100000 - AAAAAA % 10000) / 10000 * 100 + (CCCCCC % 1000000 - CCCCCC % 100000) / 100000 * 10 + CCCCCC % 10 + (BBBBBB % 1000 - BBBBBB % 100) / 100 * 0.1 + (BBBBBB % 1000000 - BBBBBB % 100000) / 100000 * 0.01 + (AAAAAA % 100 - AAAAAA % 10) / 10 * 0.001 + (CCCCCC % 100000 - CCCCCC % 10000) / 10000 * 1.0E-4 + BBBBBB % 10 * 1.0E-5)); } else { LongKOMP = (LongVORZ * ((BBBBBB % 100 - BBBBBB % 10) / 10 * 100 + CCCCCC % 10 * 10 + (AAAAAA % 100 - AAAAAA % 10) / 10 + (AAAAAA % 100000 - AAAAAA % 10000) / 10000 * 0.1 + (BBBBBB % 1000 - BBBBBB % 100) / 100 * 0.01 + BBBBBB % 10 * 0.001 + (CCCCCC % 100000 - CCCCCC % 10000) / 10000 * 1.0E-4 + (BBBBBB % 100000 - BBBBBB % 10000) / 10000 * 1.0E-5)); } if ((((CCCCCC % 100000 - CCCCCC % 10000) / 10000 + (CCCCCC % 100 - CCCCCC % 10) / 10) % 2) == 0){ LatKOMP = (LatVORZ * ((AAAAAA % 10000 - AAAAAA % 1000) / 1000 * 10 + (BBBBBB % 100 - BBBBBB % 10) / 10 + (BBBBBB % 100000 - BBBBBB % 10000) / 10000 * 0.1 + (CCCCCC % 1000 - CCCCCC % 100) / 100 * 0.01 + (AAAAAA % 1000000 - AAAAAA % 100000) / 100000 * 0.001 + (CCCCCC % 100 - CCCCCC % 10) / 10 * 1.0E-4 + AAAAAA % 10 * 1.0E-5)); } else{ LatKOMP = (LatVORZ * ((BBBBBB % 1000000 - BBBBBB % 100000) / 100000 * 10 + AAAAAA % 10 + (AAAAAA % 10000 - AAAAAA % 1000) / 1000 * 0.1 + (CCCCCC % 1000000 - CCCCCC % 100000) / 100000 * 0.01 + (CCCCCC % 1000 - CCCCCC % 100) / 100 * 0.001 + (CCCCCC % 100 - CCCCCC % 10) / 10 * 1.0E-4 + (AAAAAA % 1000000 - AAAAAA % 100000) / 100000 * 1.0E-5)); } answer[0]=LatKOMP.toFixed(6); answer[1]=LongKOMP.toFixed(6); return (answer); } function wig_split (wig){ const myregex = /.*?([0-9]{6}).*?([0-9]{6}).*?([0-9]{6})/; let wig_value = myregex.exec(wig); return(wig_value); } function coordtotext(coord,my_type){ if (coord<0 && my_type =='N'){my_type='S';} if (coord<0 && my_type =='E'){my_type='W';} coord=Math.abs(coord); var my_grad=Math.floor(coord); var my_dez=(coord - my_grad) *60; my_dez=my_dez.toFixed(3); var my_text = my_type + ' ' +my_grad + ' ' + my_dez; //alert(my_text); return(my_text); } function ButtonClickAction (zEvent) { /*--- For our dummy action, we'll just add a line of text to the top of the screen. */ var udo_GC_Name=btoa(encodeURIComponent(document.getElementById("ctl00_ContentBody_CacheName").textContent)); var udo_GC_id=btoa(encodeURIComponent(document.getElementById("ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode").textContent)); var udo_GC_tupel=wig_split(encodeURIComponent(document.getElementById("ctl00_ContentBody_LongDescription").textContent)); var udo_coord=gowherei(udo_GC_tupel); //alert(udo_GC_tupel); //alert(udo_coord[0]+' - ' +udo_coord[1]); var mylat=btoa(coordtotext(udo_coord[0],'N')); var mylon=btoa(coordtotext(udo_coord[1],'E')); //alert (mylat + ' ' + mylon); var udo_GC_desc ='Lat (dec) ' + udo_coord[0] + '\n'; udo_GC_desc +='Lon (dec) ' + udo_coord[1] + '\n'; udo_GC_desc +='coordinate ' + atob(mylat) + ' ' + atob(mylon) + '\n'; udo_GC_desc +='calculated '+ Date() + '\n'; udo_GC_desc +='tupel ' + udo_GC_tupel[1] + '-' + udo_GC_tupel[2] + '-'+ udo_GC_tupel[3] + '\n'; var my_gc_coord = atob(mylat) + ' ' + atob(mylon); document.getElementById("viewCacheNote").click(); document.getElementById("cacheNoteText").value=udo_GC_desc; document.querySelector(".js-pcn-submit").click(); document.getElementById("uxLatLon").click(); document.getElementById("newCoordinates").value=my_gc_coord;// + ' ' + atob(mylon) ; document.querySelector(".btn-cc-parse").click(); document.querySelector(".btn-cc-accept").click(); } function multilineStr (dummyFunc) { var str = dummyFunc.toString (); str = str.replace (/^[^\/]+\/\*!?/, '') // Strip function () { /*! .replace (/\s*\*\/\s*\}\s*$/, '') // Strip */ } .replace (/\/\/.+$/gm, '') // Double-slash comments wreck CSS. Strip them. ; return str; } sometimes it also gets dates, then an old-school copy & paste has to be done... Please take it, as it is, no warranty, no guarantee that it will run correctly. I calculate all Waldmeister WIG with this tool. hth Udo1 point